Finished Javadoc

This commit is contained in:
Auxilor 2020-12-28 22:40:45 +00:00
parent 0d103ee2a5
commit cde358e6ce
17 changed files with 155 additions and 68 deletions

View File

@ -5,7 +5,23 @@
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<!-- Enchantments don't need javadoc. -->
<suppress files="[\\/]enchantments[\\/]ecoenchants[\\/]" checks="MissingJavadocMethod"/>
<suppress files="[\\/]enchantments[\\/]ecoenchants[\\/]" checks="JavadocVariable"/>
<suppress files="[\\]EcoEnchants.java[\\/]" checks="JavadocVariable"/>
<!-- Extensions don't need javadoc. -->
<suppress files="[\\/]eco-extensions[\\/]" checks="MissingJavadocMethod"/>
<suppress files="[\\/]eco-extensions[\\/]" checks="JavadocVariable"/>
<!-- Fields don't need javadoc -->
<suppress files="EcoEnchants.java" checks="JavadocVariable"/>
<!-- Modified version of library -->
<suppress files="ArmorEquipEvent.java" checks="JavadocVariable"/>
<suppress files="ArmorEquipEvent.java" checks="MissingJavadocMethod"/>
<suppress files="ArmorEquipEvent.java" checks="JavadocStyle"/>
<suppress files="ArmorListener.java" checks="JavadocVariable"/>
<suppress files="ArmorListener.java" checks="MissingJavadocMethod"/>
<suppress files="ArmorType.java" checks="JavadocVariable"/>
<suppress files="ArmorType.java" checks="MissingJavadocMethod"/>
</suppressions>

View File

@ -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);
}
});

View File

@ -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) {

View File

@ -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

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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.

View File

@ -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));
}

View File

@ -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() {

View File

@ -13,6 +13,9 @@ import java.util.Set;
import java.util.UUID;
public class AnticheatMatrix implements AnticheatWrapper, Listener {
/**
* Currently exempt players.
*/
private final Set<UUID> exempt = new HashSet<>();
@Override

View File

@ -11,6 +11,9 @@ import java.util.Set;
import java.util.UUID;
public class AnticheatNCP implements AnticheatWrapper {
/**
* Currently exempt players.
*/
private final Set<UUID> exempt = new HashSet<>();
@Override

View File

@ -13,6 +13,9 @@ import java.util.Set;
import java.util.UUID;
public class AnticheatSpartan implements AnticheatWrapper, Listener {
/**
* Currently exempt players.
*/
private final Set<UUID> exempt = new HashSet<>();
@Override

View File

@ -12,62 +12,65 @@ import java.util.Set;
@UtilityClass
public class AntigriefManager {
private final Set<AntigriefWrapper> antigriefs = new HashSet<>();
/**
* Registered antigriefs.
*/
private final Set<AntigriefWrapper> 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));
}
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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<PlaceholderEntry> REGISTERED_PLACEHOLDERS = new HashSet<>();
/**
* All registered placeholder integrations.
*/
private static final Set<PlaceholderIntegration> 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) {

View File

@ -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;
}