diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/Reconfigurable.java b/LaunchServer/src/main/java/pro/gravit/launchserver/Reconfigurable.java index acb00ba4..07c5cde0 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/Reconfigurable.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/Reconfigurable.java @@ -4,6 +4,14 @@ import java.util.Map; +/** + * Allows calling commands using the config command + */ public interface Reconfigurable { + /** + * Gets a list of commands available for this object. + * @return Key - Command Name + * Value is a command object + */ Map getCommands(); } diff --git a/LauncherCore/src/main/java/pro/gravit/launcher/LauncherAPI.java b/LauncherCore/src/main/java/pro/gravit/launcher/LauncherAPI.java index 644f0296..a0022579 100644 --- a/LauncherCore/src/main/java/pro/gravit/launcher/LauncherAPI.java +++ b/LauncherCore/src/main/java/pro/gravit/launcher/LauncherAPI.java @@ -5,8 +5,10 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +/** + * This annotation implies that method/field/class should not be renamed or obfuscated + */ @Retention(RetentionPolicy.CLASS) @Target({ElementType.TYPE, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.METHOD}) public @interface LauncherAPI { - /* This annotation implies that method/field/class should not be renamed or obfuscated */ } diff --git a/LauncherCore/src/main/java/pro/gravit/launcher/LauncherNetworkAPI.java b/LauncherCore/src/main/java/pro/gravit/launcher/LauncherNetworkAPI.java index cd3ab1ef..9c2fad06 100644 --- a/LauncherCore/src/main/java/pro/gravit/launcher/LauncherNetworkAPI.java +++ b/LauncherCore/src/main/java/pro/gravit/launcher/LauncherNetworkAPI.java @@ -5,6 +5,10 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +/** + * This annotation implies that method/field/class should not be renamed or obfuscated + * It is used for classes and fields serializable with the help of GSON to save the field name during transmission over the network. + */ @Retention(RetentionPolicy.CLASS) @Target({ElementType.TYPE, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.METHOD}) public @interface LauncherNetworkAPI { diff --git a/LauncherCore/src/main/java/pro/gravit/launcher/NeedGarbageCollection.java b/LauncherCore/src/main/java/pro/gravit/launcher/NeedGarbageCollection.java index 3f6147ea..1dfeca49 100644 --- a/LauncherCore/src/main/java/pro/gravit/launcher/NeedGarbageCollection.java +++ b/LauncherCore/src/main/java/pro/gravit/launcher/NeedGarbageCollection.java @@ -1,5 +1,9 @@ package pro.gravit.launcher; +/** + * Determines whether this object requires periodic garbage collection by the gc command + * This interface has nothing to do with java garbage collection. + */ @FunctionalInterface public interface NeedGarbageCollection { void garbageCollection(); diff --git a/LauncherCore/src/main/java/pro/gravit/utils/BiHookSet.java b/LauncherCore/src/main/java/pro/gravit/utils/BiHookSet.java index 28104f32..a636b6e8 100644 --- a/LauncherCore/src/main/java/pro/gravit/utils/BiHookSet.java +++ b/LauncherCore/src/main/java/pro/gravit/utils/BiHookSet.java @@ -8,6 +8,15 @@ public class BiHookSet { @FunctionalInterface public interface Hook { + /** + * @param context custom param + * @param object custom param + * @return + * True if you need to interrupt hook processing + * False to continue processing hook + * @throws HookException + * The hook may return the error text throwing this exception + */ boolean hook(V object, R context) throws HookException; } @@ -19,6 +28,15 @@ public boolean unregisterHook(Hook hook) { return list.remove(hook); } + /** + * @param context custom param + * @param object custom param + * @return + * True if hook to interrupt processing + * False to continue + * @throws HookException + * The hook may return the error text throwing this exception + */ public boolean hook(V context, R object) throws HookException { for (Hook hook : list) { if (hook.hook(context, object)) return true; diff --git a/LauncherCore/src/main/java/pro/gravit/utils/HookSet.java b/LauncherCore/src/main/java/pro/gravit/utils/HookSet.java index 242584b0..59cbbce2 100644 --- a/LauncherCore/src/main/java/pro/gravit/utils/HookSet.java +++ b/LauncherCore/src/main/java/pro/gravit/utils/HookSet.java @@ -8,6 +8,14 @@ public class HookSet { @FunctionalInterface public interface Hook { + /** + * @param context custom param + * @return + * True if you need to interrupt hook processing + * False to continue processing hook + * @throws HookException + * The hook may return the error text throwing this exception + */ boolean hook(R context) throws HookException; } @@ -19,6 +27,14 @@ public boolean unregisterHook(Hook hook) { return list.remove(hook); } + /** + * @param context custom param + * @return + * True if hook to interrupt processing + * False to continue + * @throws HookException + * The hook may return the error text throwing this exception + */ public boolean hook(R context) throws HookException { for (Hook hook : list) { if (hook.hook(context)) return true; diff --git a/LauncherCore/src/main/java/pro/gravit/utils/ProviderMap.java b/LauncherCore/src/main/java/pro/gravit/utils/ProviderMap.java index b98b9c09..56a5e4a5 100644 --- a/LauncherCore/src/main/java/pro/gravit/utils/ProviderMap.java +++ b/LauncherCore/src/main/java/pro/gravit/utils/ProviderMap.java @@ -6,6 +6,10 @@ import pro.gravit.utils.helper.VerifyHelper; +/** + * The relationship between classes of an interface or abstract class and names when they are serialized + * @param Class or interface type + */ public class ProviderMap { protected final Map> PROVIDERS = new ConcurrentHashMap<>(4); protected final String name; diff --git a/LauncherCore/src/main/java/pro/gravit/utils/UniversalJsonAdapter.java b/LauncherCore/src/main/java/pro/gravit/utils/UniversalJsonAdapter.java index e5b0204a..06d8e3d0 100644 --- a/LauncherCore/src/main/java/pro/gravit/utils/UniversalJsonAdapter.java +++ b/LauncherCore/src/main/java/pro/gravit/utils/UniversalJsonAdapter.java @@ -13,6 +13,11 @@ import pro.gravit.utils.helper.LogHelper; +/** + * An adapter that uses {@link ProviderMap} to serialize and deserialize a group of similar objects + * @param Class or interface type + * @see ProviderMap + */ public class UniversalJsonAdapter implements JsonSerializer, JsonDeserializer { public final ProviderMap providerMap; public final String name;