From cde358e6ce5a58708910a40a75fe92c6da70bc4e Mon Sep 17 00:00:00 2001 From: Auxilor Date: Mon, 28 Dec 2020 22:40:45 +0000 Subject: [PATCH] Finished Javadoc --- config/checkstyle/suppression.xml | 18 ++++++- .../command/commands/CommandEcodebug.java | 2 +- .../willfp/ecoenchants/alchemy/Alchemy.java | 11 ++++ .../ecoenchants/alchemy/AlchemyMain.java | 3 ++ .../biomes/enchants/offensive/Altitude.java | 3 ++ .../biomes/enchants/offensive/Aquamarine.java | 3 ++ .../willfp/eco/util/config/BaseConfig.java | 2 +- .../willfp/eco/util/config/configs/Lang.java | 22 ++++++-- .../anticheat/plugins/AnticheatAAC.java | 11 +++- .../anticheat/plugins/AnticheatMatrix.java | 3 ++ .../anticheat/plugins/AnticheatNCP.java | 3 ++ .../anticheat/plugins/AnticheatSpartan.java | 3 ++ .../antigrief/AntigriefManager.java | 51 ++++++++++--------- .../antigrief/AntigriefWrapper.java | 35 ++++++------- .../antigrief/plugins/AntigriefLands.java | 8 +++ .../placeholder/PlaceholderManager.java | 34 +++++++------ .../plugins/PlaceholderIntegrationPAPI.java | 11 ++-- 17 files changed, 155 insertions(+), 68 deletions(-) diff --git a/config/checkstyle/suppression.xml b/config/checkstyle/suppression.xml index 051c2ea7..cb761250 100644 --- a/config/checkstyle/suppression.xml +++ b/config/checkstyle/suppression.xml @@ -5,7 +5,23 @@ "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd"> + - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandEcodebug.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandEcodebug.java index 9123f85e..5a1198f0 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandEcodebug.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/commands/CommandEcodebug.java @@ -102,7 +102,7 @@ public class CommandEcodebug extends AbstractCommand { if (enchant.getRarity() == null) { withIssues.add(enchant); } - if (enchant.getRawTargets().isEmpty()) { + if (enchant.getTargets().isEmpty()) { withIssues.add(enchant); } }); diff --git a/eco-extensions/alchemy/src/main/java/com/willfp/ecoenchants/alchemy/Alchemy.java b/eco-extensions/alchemy/src/main/java/com/willfp/ecoenchants/alchemy/Alchemy.java index 9e195564..f5134320 100644 --- a/eco-extensions/alchemy/src/main/java/com/willfp/ecoenchants/alchemy/Alchemy.java +++ b/eco-extensions/alchemy/src/main/java/com/willfp/ecoenchants/alchemy/Alchemy.java @@ -13,12 +13,23 @@ import org.bukkit.potion.PotionEffect; import org.jetbrains.annotations.NotNull; public class Alchemy extends EcoEnchant { + /** + * Instantiate Alchemy Enchantment. + */ public Alchemy() { super("alchemy", EnchantmentType.NORMAL); } + /** + * true Metadata key. + */ private final FixedMetadataValue metaKeyTrue = this.getPlugin().getMetadataValueFactory().create(true); + /** + * Enchantment functionality. + * + * @param event The event to listen for. + */ @EventHandler public void onPotionEffect(@NotNull final EntityPotionEffectEvent event) { if (event.getNewEffect() == null) { diff --git a/eco-extensions/alchemy/src/main/java/com/willfp/ecoenchants/alchemy/AlchemyMain.java b/eco-extensions/alchemy/src/main/java/com/willfp/ecoenchants/alchemy/AlchemyMain.java index ae00b0dc..5db66515 100644 --- a/eco-extensions/alchemy/src/main/java/com/willfp/ecoenchants/alchemy/AlchemyMain.java +++ b/eco-extensions/alchemy/src/main/java/com/willfp/ecoenchants/alchemy/AlchemyMain.java @@ -4,6 +4,9 @@ import com.willfp.eco.util.extensions.Extension; import com.willfp.ecoenchants.enchantments.EcoEnchant; public class AlchemyMain extends Extension { + /** + * Alchemy enchantment. + */ public static final EcoEnchant ALCHEMY = new Alchemy(); @Override diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Altitude.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Altitude.java index 4540d65b..6f7e5de1 100644 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Altitude.java +++ b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Altitude.java @@ -8,6 +8,9 @@ import org.jetbrains.annotations.NotNull; import java.util.Arrays; public class Altitude extends BiomesEnchantment { + /** + * Instantiate enchantment. + */ public Altitude() { super("altitude", EnchantmentType.NORMAL); } diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Aquamarine.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Aquamarine.java index f57b089a..c70ac50f 100644 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Aquamarine.java +++ b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Aquamarine.java @@ -8,6 +8,9 @@ import org.jetbrains.annotations.NotNull; import java.util.Arrays; public class Aquamarine extends BiomesEnchantment { + /** + * Instantiate enchantment. + */ public Aquamarine() { super("aquamarine", EnchantmentType.NORMAL); } diff --git a/eco-util/src/main/java/com/willfp/eco/util/config/BaseConfig.java b/eco-util/src/main/java/com/willfp/eco/util/config/BaseConfig.java index 3cf8d373..00a469ec 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/config/BaseConfig.java +++ b/eco-util/src/main/java/com/willfp/eco/util/config/BaseConfig.java @@ -169,7 +169,7 @@ public abstract class BaseConfig extends PluginDependent implements ValueGetter } /** - * 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-util/src/main/java/com/willfp/eco/util/config/configs/Lang.java b/eco-util/src/main/java/com/willfp/eco/util/config/configs/Lang.java index 967230a4..8c27dcc7 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/config/configs/Lang.java +++ b/eco-util/src/main/java/com/willfp/eco/util/config/configs/Lang.java @@ -4,22 +4,38 @@ import com.willfp.eco.util.StringUtils; import com.willfp.eco.util.config.BaseConfig; import org.jetbrains.annotations.NotNull; -/** - * Wrapper for lang.yml - */ public class Lang extends BaseConfig { + /** + * lang.yml. + */ public Lang() { super("lang", false); } + /** + * Get the prefix for messages in chat. + * + * @return The prefix. + */ public String getPrefix() { return StringUtils.translate(this.getConfig().getString("messages.prefix")); } + /** + * Get the no permission message. + * + * @return The message. + */ public String getNoPermission() { return getPrefix() + StringUtils.translate(this.getConfig().getString("messages.no-permission")); } + /** + * Get a chat message. + * + * @param message The key of the message. + * @return The message with a prefix appended. + */ public String getMessage(@NotNull final String message) { return getPrefix() + StringUtils.translate(this.getConfig().getString("messages." + message)); } diff --git a/eco-util/src/main/java/com/willfp/eco/util/integrations/anticheat/plugins/AnticheatAAC.java b/eco-util/src/main/java/com/willfp/eco/util/integrations/anticheat/plugins/AnticheatAAC.java index 46b7aa6e..a2483da1 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/integrations/anticheat/plugins/AnticheatAAC.java +++ b/eco-util/src/main/java/com/willfp/eco/util/integrations/anticheat/plugins/AnticheatAAC.java @@ -8,9 +8,18 @@ import org.bukkit.entity.Player; import org.bukkit.event.Listener; import org.jetbrains.annotations.NotNull; +import java.util.Objects; + public class AnticheatAAC implements AnticheatWrapper, Listener { + /** + * AAC exemption for EcoEnchants. + */ private final AACExemption ecoEnchantsExemption = new AACExemption("EcoEnchants"); - private final AACAPI api = Bukkit.getServicesManager().load(AACAPI.class); + + /** + * AAC api. + */ + private final AACAPI api = Objects.requireNonNull(Bukkit.getServicesManager().load(AACAPI.class)); @Override public String getPluginName() { diff --git a/eco-util/src/main/java/com/willfp/eco/util/integrations/anticheat/plugins/AnticheatMatrix.java b/eco-util/src/main/java/com/willfp/eco/util/integrations/anticheat/plugins/AnticheatMatrix.java index deab8773..bf38bcfe 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/integrations/anticheat/plugins/AnticheatMatrix.java +++ b/eco-util/src/main/java/com/willfp/eco/util/integrations/anticheat/plugins/AnticheatMatrix.java @@ -13,6 +13,9 @@ import java.util.Set; import java.util.UUID; public class AnticheatMatrix implements AnticheatWrapper, Listener { + /** + * Currently exempt players. + */ private final Set exempt = new HashSet<>(); @Override diff --git a/eco-util/src/main/java/com/willfp/eco/util/integrations/anticheat/plugins/AnticheatNCP.java b/eco-util/src/main/java/com/willfp/eco/util/integrations/anticheat/plugins/AnticheatNCP.java index 72bc8d41..613676fb 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/integrations/anticheat/plugins/AnticheatNCP.java +++ b/eco-util/src/main/java/com/willfp/eco/util/integrations/anticheat/plugins/AnticheatNCP.java @@ -11,6 +11,9 @@ import java.util.Set; import java.util.UUID; public class AnticheatNCP implements AnticheatWrapper { + /** + * Currently exempt players. + */ private final Set exempt = new HashSet<>(); @Override diff --git a/eco-util/src/main/java/com/willfp/eco/util/integrations/anticheat/plugins/AnticheatSpartan.java b/eco-util/src/main/java/com/willfp/eco/util/integrations/anticheat/plugins/AnticheatSpartan.java index b336df78..8dbb437a 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/integrations/anticheat/plugins/AnticheatSpartan.java +++ b/eco-util/src/main/java/com/willfp/eco/util/integrations/anticheat/plugins/AnticheatSpartan.java @@ -13,6 +13,9 @@ import java.util.Set; import java.util.UUID; public class AnticheatSpartan implements AnticheatWrapper, Listener { + /** + * Currently exempt players. + */ private final Set exempt = new HashSet<>(); @Override diff --git a/eco-util/src/main/java/com/willfp/eco/util/integrations/antigrief/AntigriefManager.java b/eco-util/src/main/java/com/willfp/eco/util/integrations/antigrief/AntigriefManager.java index 29d53a13..df0819ef 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/integrations/antigrief/AntigriefManager.java +++ b/eco-util/src/main/java/com/willfp/eco/util/integrations/antigrief/AntigriefManager.java @@ -12,62 +12,65 @@ import java.util.Set; @UtilityClass public class AntigriefManager { - private final Set antigriefs = new HashSet<>(); + /** + * Registered antigriefs. + */ + private final Set registered = new HashSet<>(); /** - * Register a new AntiGrief/Land Management integration + * Register a new AntiGrief/Land Management integration. * - * @param antigrief The integration to register + * @param antigrief The integration to register. */ public void register(@NotNull final AntigriefWrapper antigrief) { - antigriefs.add(antigrief); + registered.add(antigrief); } /** - * Can player break block + * Can player break block. * - * @param player The player - * @param block The block - * @return If player can break block + * @param player The player. + * @param block The block. + * @return If player can break block. */ public boolean canBreakBlock(@NotNull final Player player, @NotNull final Block block) { - return antigriefs.stream().allMatch(antigriefWrapper -> antigriefWrapper.canBreakBlock(player, block)); + return registered.stream().allMatch(antigriefWrapper -> antigriefWrapper.canBreakBlock(player, block)); } /** - * Can player create explosion at location + * Can player create explosion at location. * - * @param player The player - * @param location The location - * @return If player can create explosion + * @param player The player. + * @param location The location. + * @return If player can create explosion. */ public boolean canCreateExplosion(@NotNull final Player player, @NotNull final Location location) { - return antigriefs.stream().allMatch(antigriefWrapper -> antigriefWrapper.canCreateExplosion(player, location)); + return registered.stream().allMatch(antigriefWrapper -> antigriefWrapper.canCreateExplosion(player, location)); } /** - * Can player place block + * Can player place block. * - * @param player The player - * @param block The block - * @return If player can place block + * @param player The player. + * @param block The block. + * @return If player can place block. */ public boolean canPlaceBlock(@NotNull final Player player, @NotNull final Block block) { - return antigriefs.stream().allMatch(antigriefWrapper -> antigriefWrapper.canPlaceBlock(player, block)); + return registered.stream().allMatch(antigriefWrapper -> antigriefWrapper.canPlaceBlock(player, block)); } /** - * Can player injure living entity + * Can player injure living entity. * - * @param player The player - * @param victim The victim - * @return If player can injure + * @param player The player. + * @param victim The victim. + * @return If player can injure. */ public boolean canInjure(@NotNull final Player player, @NotNull final LivingEntity victim) { - return antigriefs.stream().allMatch(antigriefWrapper -> antigriefWrapper.canInjure(player, victim)); + return registered.stream().allMatch(antigriefWrapper -> antigriefWrapper.canInjure(player, victim)); } } diff --git a/eco-util/src/main/java/com/willfp/eco/util/integrations/antigrief/AntigriefWrapper.java b/eco-util/src/main/java/com/willfp/eco/util/integrations/antigrief/AntigriefWrapper.java index 40e399a4..d91fe6d9 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/integrations/antigrief/AntigriefWrapper.java +++ b/eco-util/src/main/java/com/willfp/eco/util/integrations/antigrief/AntigriefWrapper.java @@ -6,43 +6,40 @@ import org.bukkit.block.Block; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -/** - * Interface for Antigrief integrations - */ public interface AntigriefWrapper extends Integration { /** - * Can player break block + * Can player break block. * - * @param player The player - * @param block The block - * @return If player cna break block + * @param player The player. + * @param block The block. + * @return If player cna break block. */ boolean canBreakBlock(Player player, Block block); /** - * Can player create explosion at location + * Can player create explosion at location. * - * @param player The player - * @param location The location - * @return If player can create explosion + * @param player The player. + * @param location The location. + * @return If player can create explosion. */ boolean canCreateExplosion(Player player, Location location); /** - * Can player place block + * Can player place block. * - * @param player The player - * @param block The block - * @return If player can place block + * @param player The player. + * @param block The block. + * @return If player can place block. */ boolean canPlaceBlock(Player player, Block block); /** - * Can player injure living entity + * Can player injure living entity. * - * @param player The player - * @param victim The victim - * @return If player can injure + * @param player The player. + * @param victim The victim. + * @return If player can injure. */ boolean canInjure(Player player, LivingEntity victim); } diff --git a/eco-util/src/main/java/com/willfp/eco/util/integrations/antigrief/plugins/AntigriefLands.java b/eco-util/src/main/java/com/willfp/eco/util/integrations/antigrief/plugins/AntigriefLands.java index aca2a3aa..2159fb39 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/integrations/antigrief/plugins/AntigriefLands.java +++ b/eco-util/src/main/java/com/willfp/eco/util/integrations/antigrief/plugins/AntigriefLands.java @@ -13,8 +13,16 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; public class AntigriefLands extends PluginDependent implements AntigriefWrapper { + /** + * Lands integration. + */ private final LandsIntegration landsIntegration = new LandsIntegration(this.getPlugin()); + /** + * Instantiate new lands integration. + * + * @param plugin The integration provider. + */ public AntigriefLands(@NotNull final AbstractEcoPlugin plugin) { super(plugin); } diff --git a/eco-util/src/main/java/com/willfp/eco/util/integrations/placeholder/PlaceholderManager.java b/eco-util/src/main/java/com/willfp/eco/util/integrations/placeholder/PlaceholderManager.java index fa411fd3..1d162759 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/integrations/placeholder/PlaceholderManager.java +++ b/eco-util/src/main/java/com/willfp/eco/util/integrations/placeholder/PlaceholderManager.java @@ -10,18 +10,22 @@ import java.util.Optional; import java.util.Set; import java.util.concurrent.atomic.AtomicReference; -/** - * Utility class for placeholders - */ @UtilityClass public class PlaceholderManager { + /** + * All registered placeholders. + */ private static final Set REGISTERED_PLACEHOLDERS = new HashSet<>(); + + /** + * All registered placeholder integrations. + */ private static final Set REGISTERED_INTEGRATIONS = new HashSet<>(); /** - * Register a new placeholder integration + * Register a new placeholder integration. * - * @param integration The {@link PlaceholderIntegration} to register + * @param integration The {@link PlaceholderIntegration} to register. */ public static void addIntegration(@NotNull final PlaceholderIntegration integration) { integration.registerIntegration(); @@ -29,9 +33,9 @@ public class PlaceholderManager { } /** - * Register a placeholder + * Register a placeholder. * - * @param expansion The {@link PlaceholderEntry} to register + * @param expansion The {@link PlaceholderEntry} to register. */ public static void registerPlaceholder(@NotNull final PlaceholderEntry expansion) { REGISTERED_PLACEHOLDERS.removeIf(placeholderEntry -> placeholderEntry.getIdentifier().equalsIgnoreCase(expansion.getIdentifier())); @@ -39,11 +43,11 @@ public class PlaceholderManager { } /** - * Get the result of a placeholder with respect to a player + * Get the result of a placeholder with respect to a player. * - * @param player The player to get the result from - * @param identifier The placeholder identifier - * @return The value of the placeholder + * @param player The player to get the result from. + * @param identifier The placeholder identifier. + * @return The value of the placeholder. */ public static String getResult(@Nullable final Player player, @NotNull final String identifier) { @@ -59,11 +63,11 @@ public class PlaceholderManager { } /** - * Translate all placeholders with respect to a player + * Translate all placeholders with respect to a player. * - * @param text The text that may contain placeholders to translate - * @param player The player to translate the placeholders with respect to - * @return The text, translated + * @param text The text that may contain placeholders to translate. + * @param player The player to translate the placeholders with respect to. + * @return The text, translated. */ public static String translatePlaceholders(@NotNull final String text, @Nullable final Player player) { diff --git a/eco-util/src/main/java/com/willfp/eco/util/integrations/placeholder/plugins/PlaceholderIntegrationPAPI.java b/eco-util/src/main/java/com/willfp/eco/util/integrations/placeholder/plugins/PlaceholderIntegrationPAPI.java index ba2033b7..5bfda293 100644 --- a/eco-util/src/main/java/com/willfp/eco/util/integrations/placeholder/plugins/PlaceholderIntegrationPAPI.java +++ b/eco-util/src/main/java/com/willfp/eco/util/integrations/placeholder/plugins/PlaceholderIntegrationPAPI.java @@ -9,12 +9,17 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -/** - * PlaceholderAPI integration - */ public class PlaceholderIntegrationPAPI extends PlaceholderExpansion implements PlaceholderIntegration { + /** + * The linked plugin. + */ private final AbstractEcoPlugin plugin; + /** + * Create a new PlaceholderAPI integration. + * + * @param plugin The plugin to manage placeholders for. + */ public PlaceholderIntegrationPAPI(@NotNull final AbstractEcoPlugin plugin) { this.plugin = plugin; }