-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from JuliGames/development
Version 1.6 brings the following major changes to the Core: - security notice in APIs pom - TODO#doNotcall defaults to false now - option to get all configs as a collection - new: EnumInterpreter - API now has a lot of javadoc - new: PrimitiveInterpreter - new: Reverser - new: Representation - new: Interpretation - added support for the AdventureWebUi - new: APIUtils - optimized DurationFormatUtilitis - new: ThrowingRunnable - new: MessageRepresentation - new: IndexBackedInterpreterProvider - new: IndexBackedInterpreterProviderBuilder - a lot of new Prompts for Adventure - new: PaperConversationManager - this opens support for ConversationLib! Currently, this has some issues and should not be used on production instances! - new: Automatic Config Mapping - a lot of prompts for paper - new: SUPERCORE - new: VelocityConversationManager - this extends support for ConversationLib to Velocity Additionally, I need to announce that JuliGames may no longer pursue the development of the piece of software at the pace we had before. The person who is in charge of keeping the people behind this project united decided to stop all communication with the team for a while now. We cant provide any details about the health of the maven repo or other services that are maintained by the Juligames Development and Administration Team. I hope this gets resolved and innovation and development can continue as normal.
- Loading branch information
Showing
104 changed files
with
4,193 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="CoreMaster" type="Application" factoryName="Application" | ||
nameIsGenerated="true"> | ||
<option name="MAIN_CLASS_NAME" value="net.juligames.core.master.CoreMaster"/> | ||
<module name="Master"/> | ||
<option name="PROGRAM_PARAMETERS" | ||
value="--add-modules java.se --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED"/> | ||
<option name="VM_PARAMETERS" value="-Dhazelcast.diagnostics.enabled=true -DcoreDebug=true "/> | ||
<extension name="coverage"> | ||
<pattern> | ||
<option name="PATTERN" value="net.juligames.core.master.*"/> | ||
<option name="ENABLED" value="true"/> | ||
</pattern> | ||
</extension> | ||
<method v="2"> | ||
<option name="Make" enabled="true"/> | ||
</method> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!--suppress VulnerableLibrariesLocal --> | ||
<!-- | ||
Security Note: | ||
Please report any issues related to dependencies used in this project immediately to GitHub: | ||
github.com/JuliGames/JuliGamesCore/issues. | ||
For any other inquiries or concerns, please email the development team at [email protected] | ||
--> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>JuliGamesCore</artifactId> | ||
<groupId>net.juligames.core</groupId> | ||
<version>1.5</version> | ||
<version>1.6</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 102 additions & 3 deletions
105
API/src/main/java/net/juligames/core/api/config/Interpreter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,124 @@ | ||
package net.juligames.core.api.config; | ||
|
||
import de.bentzin.tools.DoNotOverride; | ||
import org.jetbrains.annotations.ApiStatus; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
import java.util.function.Function; | ||
|
||
/** | ||
* This interface defines methods for interpreting a string as an instance of a certain type and for reversing the | ||
* interpretation back to a string. | ||
* <p> | ||
* This is an example implementation for interpreting Integers | ||
* <pre> | ||
* {@code | ||
* | ||
* public final class IntegerInterpreter implements Interpreter<Integer> { | ||
* | ||
* @Override | ||
* public Integer interpret(String input) throws Exception { | ||
* return Integer.parseInt(input); | ||
* } | ||
* | ||
* @Override | ||
* public String reverse(Integer integer) { | ||
* return Integer.toString(integer); | ||
* } | ||
* | ||
* public Class<Integer> getType() { | ||
* return Integer.class; | ||
* } | ||
* } | ||
* } | ||
* </pre> | ||
* | ||
* @param <T> the type of object that this Interpreter can interpret | ||
* @author Ture Bentzin | ||
* 26.11.2022 | ||
* @see BuildInInterpreters | ||
*/ | ||
public non-sealed interface Interpreter<T> extends Reverser<T>, PrimitiveInterpreter<T> { | ||
|
||
public interface Interpreter<T> { | ||
/** | ||
* Converts the given input according to this implementation to a given Object of the provided Type. | ||
* This process is known as "interpreting the input as an instance of Type T" | ||
* | ||
* @param input the input to be interpreted | ||
* @return the instance of T that results from the interpretation | ||
* @throws Exception will be thrown if the input can't be interpreted according to this implementation | ||
*/ | ||
@NotNull T interpret(final String input) throws Exception; | ||
|
||
/** | ||
* Converts the given instance of T according to this implementation to a String with the intention that this string | ||
* can be interpreted back to the instance of T with the correct implementation of {@link Interpreter} that | ||
* implements this {@link Reverser}. | ||
* It should always be possible to convert t to a string! | ||
* This process is known as "reversing the interpretation of a string back to the string" | ||
* | ||
* @param t the object to be reversed | ||
* @return the string that was reversed from the instance of T | ||
*/ | ||
@NotNull String reverse(T t); | ||
|
||
/** | ||
* Applies the given function to the result of {@link #reverse(T)} and returns its result. | ||
* | ||
* @param t the object to be reversed | ||
* @param function the function to apply to the result of {@link #reverse(T)} | ||
* @param <R> the type of the result of the function | ||
* @return the result of applying the function to the result of {@link #reverse(T)} | ||
*/ | ||
default <R> R reverseAndThen(@NotNull T t, @NotNull Function<String, R> function) { | ||
return function.apply(reverse(t)); | ||
} | ||
|
||
default <R> R interpretAndThen(@NotNull String input, @NotNull Function<T, R> function) throws Exception { | ||
return function.apply(interpret(input)); | ||
/** | ||
* Completes the given CompletableFuture with the result of {@link #reverse(T)}. | ||
* | ||
* @param t the object to be reversed | ||
* @param completableFuture the CompletableFuture to complete with the result of {@link #reverse(T)} | ||
* @param <R> the type of the CompletableFuture | ||
*/ | ||
@ApiStatus.AvailableSince("1.6") | ||
@ApiStatus.Experimental | ||
default <R> void reverseAndThenComplete(@NotNull T t, @NotNull CompletableFuture<String> completableFuture) { | ||
completableFuture.complete(reverse(t)); | ||
} | ||
|
||
/** | ||
* Interprets the given input according to this implementation to an instance of T and completes the given | ||
* CompletableFuture with the result of the interpretation. This process is known as "interpreting the input as an | ||
* instance of Type T". If the interpretation fails, an Exception will be thrown. | ||
* | ||
* @param input the input to be interpreted | ||
* @param completableFuture the CompletableFuture that should be completed with the result of the interpretation | ||
* @throws Exception will be thrown if the input cant be interpreted according to this implementation | ||
*/ | ||
@ApiStatus.AvailableSince("1.6") | ||
@ApiStatus.Experimental | ||
default <R> void interpretAndThenComplete(@NotNull String input, @NotNull CompletableFuture<T> completableFuture) throws Exception { | ||
completableFuture.complete(interpret(input)); | ||
} | ||
|
||
/** | ||
* This will return a cast of this to a {@link Reverser} | ||
*/ | ||
@DoNotOverride | ||
@ApiStatus.AvailableSince("1.6") | ||
default Reverser<T> asReverser() { | ||
return this; | ||
} | ||
|
||
/** | ||
* This will return a cast of this to a {@link PrimitiveInterpreter} | ||
*/ | ||
@DoNotOverride | ||
@ApiStatus.AvailableSince("1.6") | ||
default PrimitiveInterpreter<T> asIInterpreter() { | ||
return this; | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
API/src/main/java/net/juligames/core/api/config/PrimitiveInterpreter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package net.juligames.core.api.config; | ||
|
||
import org.jetbrains.annotations.ApiStatus; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* This might be used later outside of this package | ||
* | ||
* @author Ture Bentzin | ||
* 12.04.2023 | ||
*/ | ||
@ApiStatus.Internal | ||
@ApiStatus.AvailableSince("1.6") | ||
public sealed interface PrimitiveInterpreter<T> permits Interpreter { | ||
|
||
/** | ||
* Converts the given input according to this implementation to a given Object of the provided Type. | ||
* This process is known as "interpreting the input as an instance of Type T" | ||
* | ||
* @param input the input to be interpreted | ||
* @return the instance of T that results the interpretation | ||
* @throws Exception will be thrown if the input cant be interpreted according to this implementation | ||
*/ | ||
@SuppressWarnings("override") | ||
@NotNull T interpret(final String input) throws Exception; | ||
} |
Oops, something went wrong.