diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/AshArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/AshArtifact.java index 3011593b..10cdaabd 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/AshArtifact.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/AshArtifact.java @@ -8,7 +8,7 @@ public class AshArtifact extends Artifact { public AshArtifact() { super( "ash_artifact", - Prerequisite.MinVer1_16 + Prerequisite.MINIMUM_1_16 ); } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/CrimsonArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/CrimsonArtifact.java index cee36963..63acae3e 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/CrimsonArtifact.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/CrimsonArtifact.java @@ -8,7 +8,7 @@ public class CrimsonArtifact extends Artifact { public CrimsonArtifact() { super( "crimson_artifact", - Prerequisite.MinVer1_16 + Prerequisite.MINIMUM_1_16 ); } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SoulArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SoulArtifact.java index 16769740..7232011b 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SoulArtifact.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SoulArtifact.java @@ -8,7 +8,7 @@ public class SoulArtifact extends Artifact { public SoulArtifact() { super( "soul_artifact", - Prerequisite.MinVer1_16 + Prerequisite.MINIMUM_1_16 ); } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SoulFireArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SoulFireArtifact.java index 408e01e1..80b99ae0 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SoulFireArtifact.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SoulFireArtifact.java @@ -8,7 +8,7 @@ public class SoulFireArtifact extends Artifact { public SoulFireArtifact() { super( "soul_fire_artifact", - Prerequisite.MinVer1_16 + Prerequisite.MINIMUM_1_16 ); } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/TearArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/TearArtifact.java index ca835ef5..74cea25b 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/TearArtifact.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/TearArtifact.java @@ -8,7 +8,7 @@ public class TearArtifact extends Artifact { public TearArtifact() { super( "tear_artifact", - Prerequisite.MinVer1_16 + Prerequisite.MINIMUM_1_16 ); } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WarpedArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WarpedArtifact.java index 6d27809f..6f160b64 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WarpedArtifact.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WarpedArtifact.java @@ -8,7 +8,7 @@ public class WarpedArtifact extends Artifact { public WarpedArtifact() { super( "warped_artifact", - Prerequisite.MinVer1_16 + Prerequisite.MINIMUM_1_16 ); } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Economical.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Economical.java index f6fa8717..be2f3716 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Economical.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Economical.java @@ -13,7 +13,7 @@ public class Economical extends EcoEnchant { public Economical() { super( "economical", EnchantmentType.NORMAL, - Prerequisite.HasPaper + Prerequisite.HAS_PAPER ); } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Plasmic.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Plasmic.java index 2713e3a1..d40fe7ab 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Plasmic.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Plasmic.java @@ -24,7 +24,7 @@ public class Plasmic extends EcoEnchant { private static final Material[] items; static { - if(Prerequisite.MinVer1_16.isMet()) { + if(Prerequisite.MINIMUM_1_16.isMet()) { items = new Material[]{ Material.DIAMOND_HELMET, Material.DIAMOND_CHESTPLATE, diff --git a/eco-util/src/main/java/com/willfp/eco/util/StringUtils.java b/eco-util/src/main/java/com/willfp/eco/util/StringUtils.java index 304606b5..e12813e7 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/StringUtils.java +++ b/eco-util/src/main/java/com/willfp/eco/util/StringUtils.java @@ -23,12 +23,13 @@ public class StringUtils { * @param player The player to translate placeholders with respect to. * @return The message, translated. */ - public String translate(@NotNull String message, + public String translate(@NotNull final String message, @Nullable final Player player) { - message = PlaceholderManager.translatePlaceholders(message, player); - message = translateHexColorCodes(message); - message = ChatColor.translateAlternateColorCodes('&', message); - return ChatColor.translateAlternateColorCodes('&', translateHexColorCodes(message)); + String processedMessage = message; + processedMessage = PlaceholderManager.translatePlaceholders(processedMessage, player); + processedMessage = translateHexColorCodes(processedMessage); + processedMessage = ChatColor.translateAlternateColorCodes('&', processedMessage); + return ChatColor.translateAlternateColorCodes('&', translateHexColorCodes(processedMessage)); } /** @@ -38,11 +39,12 @@ public class StringUtils { * @return The message, translated. * @see StringUtils#translate(String, Player) */ - public String translate(@NotNull String message) { - message = PlaceholderManager.translatePlaceholders(message, null); - message = translateHexColorCodes(message); - message = ChatColor.translateAlternateColorCodes('&', message); - return ChatColor.translateAlternateColorCodes('&', translateHexColorCodes(message)); + public String translate(@NotNull final String message) { + String processedMessage = message; + processedMessage = PlaceholderManager.translatePlaceholders(processedMessage, null); + processedMessage = translateHexColorCodes(processedMessage); + processedMessage = ChatColor.translateAlternateColorCodes('&', processedMessage); + return ChatColor.translateAlternateColorCodes('&', translateHexColorCodes(processedMessage)); } private static String translateHexColorCodes(String message) { diff --git a/eco-util/src/main/java/com/willfp/eco/util/VectorUtils.java b/eco-util/src/main/java/com/willfp/eco/util/VectorUtils.java index 3e67d810..28abfcde 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/VectorUtils.java +++ b/eco-util/src/main/java/com/willfp/eco/util/VectorUtils.java @@ -68,8 +68,8 @@ public class VectorUtils { public Vector[] getCircle(final int radius) { ArrayList circleVecs = new ArrayList<>(); - int xoffset = -radius; - int zoffset = -radius; + double xoffset = -radius; + double zoffset = -radius; while (zoffset <= radius) { while (xoffset <= radius) { diff --git a/eco-util/src/main/java/com/willfp/eco/util/config/configs/Config.java b/eco-util/src/main/java/com/willfp/eco/util/config/configs/Config.java index dd5a46d7..d0af6b39 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/config/configs/Config.java +++ b/eco-util/src/main/java/com/willfp/eco/util/config/configs/Config.java @@ -2,10 +2,11 @@ package com.willfp.eco.util.config.configs; import com.willfp.eco.util.config.BaseConfig; -/** - * Wrapper for config.yml - */ + public class Config extends BaseConfig { + /** + * Config.yml. + */ public Config() { super("config", true); } diff --git a/eco-util/src/main/java/com/willfp/eco/util/events/entitydeathbyentity/EntityDeathByEntityEvent.java b/eco-util/src/main/java/com/willfp/eco/util/events/entitydeathbyentity/EntityDeathByEntityEvent.java index 8541f170..33cec908 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/events/entitydeathbyentity/EntityDeathByEntityEvent.java +++ b/eco-util/src/main/java/com/willfp/eco/util/events/entitydeathbyentity/EntityDeathByEntityEvent.java @@ -83,6 +83,8 @@ public class EntityDeathByEntityEvent extends Event { /** * Internal bukkit. + * + * @return The handlers. */ public static HandlerList getHandlerList() { return HANDLERS; diff --git a/eco-util/src/main/java/com/willfp/eco/util/events/naturalexpgainevent/NaturalExpGainBuilder.java b/eco-util/src/main/java/com/willfp/eco/util/events/naturalexpgainevent/NaturalExpGainBuilder.java index e7b62d26..74ec396b 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/events/naturalexpgainevent/NaturalExpGainBuilder.java +++ b/eco-util/src/main/java/com/willfp/eco/util/events/naturalexpgainevent/NaturalExpGainBuilder.java @@ -39,6 +39,8 @@ class NaturalExpGainBuilder { /** * Build a new {@link NaturalExpGainEvent} given a specific reason. + * + * @param reason The {@link BuildReason}. */ NaturalExpGainBuilder(@NotNull final BuildReason reason) { this.reason = reason; diff --git a/eco-util/src/main/java/com/willfp/eco/util/events/naturalexpgainevent/NaturalExpGainListeners.java b/eco-util/src/main/java/com/willfp/eco/util/events/naturalexpgainevent/NaturalExpGainListeners.java index a71e48ea..139a929f 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/events/naturalexpgainevent/NaturalExpGainListeners.java +++ b/eco-util/src/main/java/com/willfp/eco/util/events/naturalexpgainevent/NaturalExpGainListeners.java @@ -54,7 +54,7 @@ public class NaturalExpGainListeners implements Listener { * @param event The even to listen for. */ @EventHandler - public void onExpBottle(ExpBottleEvent event) { + public void onExpBottle(@NotNull final ExpBottleEvent event) { NaturalExpGainBuilder builtEvent = new NaturalExpGainBuilder(NaturalExpGainBuilder.BuildReason.BOTTLE); builtEvent.setLocation(event.getEntity().getLocation()); diff --git a/eco-util/src/main/java/com/willfp/eco/util/extensions/MalformedExtensionException.java b/eco-util/src/main/java/com/willfp/eco/util/extensions/MalformedExtensionException.java index 22eddcf5..4601ecb0 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/extensions/MalformedExtensionException.java +++ b/eco-util/src/main/java/com/willfp/eco/util/extensions/MalformedExtensionException.java @@ -1,5 +1,7 @@ package com.willfp.eco.util.extensions; +import org.jetbrains.annotations.NotNull; + /** * Called when the extension is made incorrectly. */ @@ -14,7 +16,7 @@ public class MalformedExtensionException extends RuntimeException { * * @param errorMessage The error message to show. */ - public MalformedExtensionException(String errorMessage) { + public MalformedExtensionException(@NotNull final String errorMessage) { super(errorMessage); } } diff --git a/eco-util/src/main/java/com/willfp/eco/util/integrations/Integration.java b/eco-util/src/main/java/com/willfp/eco/util/integrations/Integration.java index f821a48c..a243b9f9 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/integrations/Integration.java +++ b/eco-util/src/main/java/com/willfp/eco/util/integrations/Integration.java @@ -1,12 +1,9 @@ package com.willfp.eco.util.integrations; -/** - * Interface for all integrations with optional dependencies - */ public interface Integration { /** - * Get the name of integration - * @return The name + * Get the name of integration. + * @return The name. */ String getPluginName(); } diff --git a/eco-util/src/main/java/com/willfp/eco/util/integrations/IntegrationLoader.java b/eco-util/src/main/java/com/willfp/eco/util/integrations/IntegrationLoader.java index a667c000..3c4d5177 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/integrations/IntegrationLoader.java +++ b/eco-util/src/main/java/com/willfp/eco/util/integrations/IntegrationLoader.java @@ -1,20 +1,36 @@ package com.willfp.eco.util.integrations; import com.willfp.eco.util.lambda.Callable; +import lombok.Getter; +import org.jetbrains.annotations.NotNull; public class IntegrationLoader { + /** + * The lambda to be ran if the plugin is present. + */ private final Callable callable; + + /** + * The plugin to require to load the integration. + */ + @Getter private final String pluginName; - public IntegrationLoader(String pluginName, Callable onLoad) { + /** + * Create a new Integration Loader. + * + * @param pluginName The plugin to require. + * @param onLoad The lambda to be ran if the plugin is present. + */ + public IntegrationLoader(@NotNull final String pluginName, + @NotNull final Callable onLoad) { this.callable = onLoad; this.pluginName = pluginName; } - public String getPluginName() { - return pluginName; - } - + /** + * Load the integration. + */ public void load() { callable.call(); } diff --git a/eco-util/src/main/java/com/willfp/eco/util/lambda/ObjectCallable.java b/eco-util/src/main/java/com/willfp/eco/util/lambda/ObjectCallable.java index 72863098..1599a872 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/lambda/ObjectCallable.java +++ b/eco-util/src/main/java/com/willfp/eco/util/lambda/ObjectCallable.java @@ -1,9 +1,9 @@ package com.willfp.eco.util.lambda; /** - * Functional Interface to return a value of a given type + * Functional Interface to return a value of a given type. * - * @param The type to return + * @param The type to return. */ @FunctionalInterface public interface ObjectCallable { diff --git a/eco-util/src/main/java/com/willfp/eco/util/optional/Prerequisite.java b/eco-util/src/main/java/com/willfp/eco/util/optional/Prerequisite.java index 4e92e8ff..fe581904 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/optional/Prerequisite.java +++ b/eco-util/src/main/java/com/willfp/eco/util/optional/Prerequisite.java @@ -14,12 +14,12 @@ public class Prerequisite { /** * All existing prerequisites are registered on creation. */ - private static final List values = new ArrayList<>(); + private static final List VALUES = new ArrayList<>(); /** * Requires the server to be running minecraft version 1.16 or higher. */ - public static final Prerequisite MinVer1_16 = new Prerequisite( + public static final Prerequisite MINIMUM_1_16 = new Prerequisite( () -> !Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3].contains("15"), "Requires minimum server version of 1.16" ); @@ -27,7 +27,7 @@ public class Prerequisite { /** * Requires the server to be running an implementation of paper. */ - public static final Prerequisite HasPaper = new Prerequisite( + public static final Prerequisite HAS_PAPER = new Prerequisite( () -> ClassUtils.exists("com.destroystokyo.paper.event.player.PlayerElytraBoostEvent"), "Requires server to be running paper (or a fork)" ); @@ -60,7 +60,7 @@ public class Prerequisite { this.isMetCallable = isMetCallable; this.isMet = isMetCallable.call(); this.description = description; - values.add(this); + VALUES.add(this); } /** @@ -74,7 +74,7 @@ public class Prerequisite { * Update all prerequisites' {@link Prerequisite#isMet}. */ public static void update() { - values.forEach(Prerequisite::refresh); + VALUES.forEach(Prerequisite::refresh); } /** diff --git a/eco-util/src/main/java/com/willfp/eco/util/plugin/AbstractEcoPlugin.java b/eco-util/src/main/java/com/willfp/eco/util/plugin/AbstractEcoPlugin.java index 46e0451e..31bc0493 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/plugin/AbstractEcoPlugin.java +++ b/eco-util/src/main/java/com/willfp/eco/util/plugin/AbstractEcoPlugin.java @@ -291,7 +291,7 @@ public abstract class AbstractEcoPlugin extends JavaPlugin { } }); - if (!Prerequisite.HasPaper.isMet()) { + if (!Prerequisite.HAS_PAPER.isMet()) { this.getLog().error(""); this.getLog().error("----------------------------"); this.getLog().error("");