diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/EnchantmentYamlConfig.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/EnchantmentYamlConfig.java
index 506f5df5..eaecba80 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/EnchantmentYamlConfig.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/EnchantmentYamlConfig.java
@@ -21,27 +21,45 @@ import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Objects;
-/**
- * Class implemented by enchantment configs
- */
public abstract class EnchantmentYamlConfig extends PluginDependent implements ValueGetter {
+ /**
+ * The name of the config.
+ */
private final String name;
+ /**
+ * The internal config that stores the values.
+ */
@Getter
private YamlConfiguration config;
+ /**
+ * The physical file of the config.
+ */
@Getter(AccessLevel.PROTECTED)
private File configFile;
+
+ /**
+ * The directory that the config is in.
+ */
private final File directory;
+
+ /**
+ * The provider of the config.
+ */
private final Class> source;
+
+ /**
+ * The type of the stored enchantment.
+ */
private final EnchantmentType type;
/**
- * Create new config yml
+ * Create new enchantment config yml.
*
- * @param name The config name
- * @param source The class of the main class of source or extension
- * @param type The enchantment type
+ * @param name The config name.
+ * @param source The class of the main class of source or extension.
+ * @param type The enchantment type.
*/
protected EnchantmentYamlConfig(@NotNull final String name,
@NotNull final Class> source,
@@ -104,6 +122,9 @@ public abstract class EnchantmentYamlConfig extends PluginDependent implements V
saveResource();
}
+ /**
+ * Update the config. Removes unneeded config keys and adds missing ones.
+ */
public void update() {
try {
config.load(configFile);
@@ -138,7 +159,6 @@ public abstract class EnchantmentYamlConfig extends PluginDependent implements V
}
-
/**
* Get an integer from config.
*
@@ -199,7 +219,7 @@ public abstract class EnchantmentYamlConfig extends PluginDependent implements V
}
/**
- * Get a string from config.C
+ * Get a string from config.
*
* @param path The key to fetch the value from.
* @return The found value, or an empty string if not found.
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantmentCache.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantmentCache.java
index 40e9f7e9..e109fec7 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantmentCache.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantmentCache.java
@@ -110,7 +110,7 @@ public class EnchantmentCache implements Updatable {
}
@ToString
- public static class CacheEntry {
+ public static final class CacheEntry {
/**
* The enchantment that this cache is for.
*/
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/EnchantmentSorter.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/EnchantmentSorter.java
index fd8cbfe3..7a0a3a01 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/EnchantmentSorter.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/EnchantmentSorter.java
@@ -6,6 +6,19 @@ import org.jetbrains.annotations.NotNull;
import java.util.List;
public interface EnchantmentSorter {
+ /**
+ * Sort list of enchantments.
+ *
+ * All implementations must treat enchantments as final or effectively final.
+ *
+ * @param toSort The enchantments to sort.
+ */
void sortEnchantments(@NotNull List toSort);
+
+ /**
+ * Get the parameters that the sorter fulfills.
+ *
+ * @return Array of all parameters.
+ */
SortParameters[] getParameters();
}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/SortParameters.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/SortParameters.java
index eb768f88..cd357891 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/SortParameters.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/SortParameters.java
@@ -1,7 +1,18 @@
package com.willfp.ecoenchants.display.options.sorting;
public enum SortParameters {
+ /**
+ * If the sorter should sort by type or if type should be ignored.
+ */
TYPE,
+
+ /**
+ * If the sorter should sort by rarity or if rarity should be ignored.
+ */
RARITY,
+
+ /**
+ * If the sorter should sort by length or alphabetically.
+ */
LENGTH
}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/SorterManager.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/SorterManager.java
index 7f67f88e..d06ec3f6 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/SorterManager.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/SorterManager.java
@@ -17,8 +17,19 @@ import java.util.Set;
@UtilityClass
public class SorterManager {
+ /**
+ * All registered enchantment sorters.
+ */
private static final Set REGISTERED = new HashSet<>();
+ /**
+ * Get a sorter based off of parameters.
+ *
+ * Any combination of parameters is valid.
+ *
+ * @param parameters The parameters to find a sorter from.
+ * @return The matching sorter.
+ */
public static EnchantmentSorter getSorter(@NotNull final SortParameters... parameters) {
return REGISTERED.stream()
.filter(enchantmentSorter -> Arrays.asList(enchantmentSorter.getParameters()).containsAll(Arrays.asList(parameters)) && enchantmentSorter.getParameters().length == parameters.length)
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Spell.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Spell.java
index da2747d6..8b88a744 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Spell.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Spell.java
@@ -57,6 +57,8 @@ public abstract class Spell extends EcoEnchant {
/**
* Get the cooldown time of the spell (in seconds).
+ *
+ * @return The time, in seconds.
*/
public int getCooldownTime() {
return this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "cooldown");
@@ -166,6 +168,7 @@ public abstract class Spell extends EcoEnchant {
* Used for perks - this should be reworked as it has hardcoded permission references.
*
* @param player The player to query.
+ * @return The multipiler.
*/
public static double getCooldownMultiplier(@NotNull final Player player) {
if (player.hasPermission("ecoenchants.cooldowntime.quarter")) {
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentTarget.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentTarget.java
index e67894c1..166a1aa5 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentTarget.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentTarget.java
@@ -75,7 +75,7 @@ public class EnchantmentTarget implements Registerable, Updatable {
}
/**
- * Update all targets
+ * Update all targets.
*/
@ConfigUpdater
public static void update() {
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentType.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentType.java
index d01247f7..3a609f9a 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentType.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentType.java
@@ -78,7 +78,14 @@ public class EnchantmentType implements Updatable {
Spell.class
);
+ /**
+ * Lambda to fetch the color of the type.
+ */
private final ObjectCallable colorCallable;
+
+ /**
+ * Lambda to fetch the singularity of the type.
+ */
private final ObjectCallable singularCallable;
/**
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/SpellRunnable.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/SpellRunnable.java
index a407df68..861f345c 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/SpellRunnable.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/SpellRunnable.java
@@ -32,7 +32,7 @@ public class SpellRunnable {
* Must be set before execution.
*/
@Setter
- private Callable callable = () -> {
+ private Callable task = () -> {
// Empty as must be set using this#setTask
};
@@ -52,7 +52,7 @@ public class SpellRunnable {
* Run the runnable.
*/
public void run() {
- callable.call();
+ task.call();
updateEndTime();
}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/essentials/EssentialsManager.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/essentials/EssentialsManager.java
index 1d371e2f..86d0c76c 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/essentials/EssentialsManager.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/essentials/EssentialsManager.java
@@ -6,24 +6,24 @@ import org.jetbrains.annotations.NotNull;
import java.util.HashSet;
import java.util.Set;
-/**
- * Utility class for interfacing with EssentialsX
- */
@UtilityClass
public class EssentialsManager {
+ /**
+ * All registered essentials integrations.
+ */
private static final Set REGISTERED = new HashSet<>();
/**
- * Register a new essentials integration
+ * Register a new essentials integration.
*
- * @param essentials The integration to register
+ * @param essentials The integration to register.
*/
public static void register(@NotNull final EssentialsWrapper essentials) {
REGISTERED.add(essentials);
}
/**
- * Register all {@link com.willfp.ecoenchants.enchantments.EcoEnchant}s with Essentials
+ * Register all {@link com.willfp.ecoenchants.enchantments.EcoEnchant}s with Essentials.
*/
public static void registerEnchantments() {
REGISTERED.forEach(EssentialsWrapper::registerAllEnchantments);
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/essentials/EssentialsWrapper.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/essentials/EssentialsWrapper.java
index 5ac67a2d..efde3792 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/essentials/EssentialsWrapper.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/essentials/EssentialsWrapper.java
@@ -2,9 +2,6 @@ package com.willfp.ecoenchants.integrations.essentials;
import com.willfp.eco.util.integrations.Integration;
-/**
- * Interface for Essentials Integration
- */
public interface EssentialsWrapper extends Integration {
/**
* @see EssentialsManager#registerEnchantments();
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/essentials/plugins/IntegrationEssentials.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/essentials/plugins/IntegrationEssentials.java
index 776cd8fa..a56343eb 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/essentials/plugins/IntegrationEssentials.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/essentials/plugins/IntegrationEssentials.java
@@ -8,9 +8,6 @@ import org.bukkit.enchantments.Enchantment;
import java.util.Map;
-/**
- * Concrete implementation of {@link EssentialsWrapper}
- */
@SuppressWarnings("unchecked")
public class IntegrationEssentials implements EssentialsWrapper {
@Override
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/mcmmo/McmmoIntegration.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/mcmmo/McmmoIntegration.java
index 86a29234..4e3e9423 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/mcmmo/McmmoIntegration.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/mcmmo/McmmoIntegration.java
@@ -3,11 +3,10 @@ package com.willfp.ecoenchants.integrations.mcmmo;
import com.willfp.eco.util.integrations.Integration;
import org.bukkit.event.Event;
-/**
- * Interface for mcMMO integrations
- */
public interface McmmoIntegration extends Integration {
/**
+ * @param event The event to check.
+ * @return If the event is fake.
* @see McmmoManager#isFake(Event)
*/
boolean isFake(Event event);
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/mcmmo/McmmoManager.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/mcmmo/McmmoManager.java
index fc146ed3..3742d1d3 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/mcmmo/McmmoManager.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/mcmmo/McmmoManager.java
@@ -1,7 +1,6 @@
package com.willfp.ecoenchants.integrations.mcmmo;
import com.willfp.eco.util.ClassUtils;
-import lombok.experimental.UtilityClass;
import org.bukkit.event.Event;
import org.jetbrains.annotations.NotNull;
@@ -9,17 +8,16 @@ import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
-/**
- * Utility class for interfacing with mcMMO
- */
-@UtilityClass
public class McmmoManager {
+ /**
+ * All registered mcMMO integrations.
+ */
private static final Set REGISTERED = new HashSet<>();
/**
- * Register a new mcMMO integration
+ * Register a new mcMMO integration.
*
- * @param integration The integration to register
+ * @param integration The integration to register.
*/
public static void registerIntegration(@NotNull final McmmoIntegration integration) {
if (!ClassUtils.exists("com.gmail.nossr50.events.fake.FakeEvent")) {
@@ -29,10 +27,10 @@ public class McmmoManager {
}
/**
- * Get if an event is fake
+ * Get if an event is fake.
*
- * @param event The event to check
- * @return If the event is fake
+ * @param event The event to check.
+ * @return If the event is fake.
*/
public static boolean isFake(@NotNull final Event event) {
AtomicBoolean isFake = new AtomicBoolean(false);
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/mcmmo/plugins/McmmoIntegrationImpl.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/mcmmo/plugins/McmmoIntegrationImpl.java
index ecc3f096..cf4cd10a 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/mcmmo/plugins/McmmoIntegrationImpl.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/mcmmo/plugins/McmmoIntegrationImpl.java
@@ -5,9 +5,6 @@ import com.willfp.ecoenchants.integrations.mcmmo.McmmoIntegration;
import org.bukkit.event.Event;
import org.jetbrains.annotations.NotNull;
-/**
- * Concrete implementation of {@link McmmoIntegration}
- */
public class McmmoIntegrationImpl implements McmmoIntegration {
@Override
public boolean isFake(@NotNull final Event event) {
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/worldguard/WorldguardManager.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/worldguard/WorldguardManager.java
index ef1a0e4d..06fe8fec 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/worldguard/WorldguardManager.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/worldguard/WorldguardManager.java
@@ -12,22 +12,25 @@ import java.util.Set;
@UtilityClass
public class WorldguardManager {
+ /**
+ * All registered WorldGuard integrations.
+ */
private static final Set REGISTERED = new HashSet<>();
/**
- * Register a new WorldGuard integration
+ * Register a new WorldGuard integration.
*
- * @param worldguard The integration to register
+ * @param worldguard The integration to register.
*/
public static void register(@NotNull final WorldguardWrapper worldguard) {
REGISTERED.add(worldguard);
}
/**
- * Register a new StateFlag with worldguard
+ * Register a new StateFlag with worldguard.
*
- * @param flagName The name of the flag
- * @param defaultValue The default value for the flag to have
+ * @param flagName The name of the flag.
+ * @param defaultValue The default value for the flag to have.
*/
public static void registerFlag(@NotNull final String flagName,
final boolean defaultValue) {
@@ -35,11 +38,11 @@ public class WorldguardManager {
}
/**
- * Get if an enchant is enabled at a player's location
+ * Get if an enchant is enabled at a player's location.
*
- * @param enchant The enchantment to check
- * @param player The player to query
- * @return If the enchantment is enabled at a player's location
+ * @param enchant The enchantment to check.
+ * @param player The player to query.
+ * @return If the enchantment is enabled at a player's location.
*/
public static boolean enabledForPlayer(@NotNull final EcoEnchant enchant,
@NotNull final LivingEntity player) {
@@ -53,12 +56,12 @@ public class WorldguardManager {
}
/**
- * Get if an enchant is enabled at a specific location
+ * Get if an enchant is enabled at a specific location.
*
- * @param enchant The enchantment to check
- * @param player The player to query
- * @param location The location to query
- * @return If the enchantment is enabled at a player's location
+ * @param enchant The enchantment to check.
+ * @param player The player to query.
+ * @param location The location to query.
+ * @return If the enchantment is enabled at a player's location.
*/
public static boolean enabledForPlayer(@NotNull final EcoEnchant enchant,
@NotNull final LivingEntity player,
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/worldguard/WorldguardWrapper.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/worldguard/WorldguardWrapper.java
index 45844534..0c2fba1f 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/worldguard/WorldguardWrapper.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/worldguard/WorldguardWrapper.java
@@ -6,6 +6,21 @@ import org.bukkit.Location;
import org.bukkit.entity.Player;
public interface WorldguardWrapper extends Integration {
+ /**
+ * Register a flag with WorldGuard.
+ *
+ * @param name The name of the flag.
+ * @param def The default value for the flag to have.
+ */
void registerFlag(String name, boolean def);
+
+ /**
+ * Get if an enchantment is available to be used at a specific location by a player.
+ *
+ * @param enchant The enchantment to query.
+ * @param player The player to query.
+ * @param location The location to query.
+ * @return If the enchantment is allowed to be used.
+ */
boolean enabledForPlayer(EcoEnchant enchant, Player player, Location location);
}
diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/worldguard/plugins/WorldguardIntegrationImpl.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/worldguard/plugins/WorldguardIntegrationImpl.java
index 17866ace..14aeec99 100644
--- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/worldguard/plugins/WorldguardIntegrationImpl.java
+++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/worldguard/plugins/WorldguardIntegrationImpl.java
@@ -12,6 +12,9 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class WorldguardIntegrationImpl implements WorldguardWrapper {
+ /**
+ * Flag registry.
+ */
private static final FlagRegistry REGISTRY = WorldGuard.getInstance().getFlagRegistry();
@Override