Improved codestyle (6/?)

This commit is contained in:
Auxilor 2020-12-28 14:43:16 +00:00
parent 40f237317e
commit 4c9df0ee9f
97 changed files with 572 additions and 166 deletions

View File

@ -89,12 +89,14 @@
<!-- Checks for Javadoc comments. -->
<!-- See https://checkstyle.org/config_javadoc.html -->
<!--
<module name="InvalidJavadocPosition"/>
<module name="JavadocMethod"/>
<module name="JavadocType"/>
<module name="JavadocVariable"/>
<module name="JavadocStyle"/>
<module name="MissingJavadocMethod"/>
-->
<!-- Checks for Naming Conventions. -->
<!-- See https://checkstyle.org/config_naming.html -->

View File

@ -26,7 +26,7 @@ public final class FastGetEnchants implements FastGetEnchantsProxy {
int level = '\uffff' & compound.getShort("lvl");
Enchantment found = Enchantment.getByKey(CraftNamespacedKey.fromStringOrNull(key));
if(found != null) {
if (found != null) {
foundEnchantments.put(found, level);
}
}
@ -42,7 +42,7 @@ public final class FastGetEnchants implements FastGetEnchantsProxy {
for (NBTBase base : enchantmentNBT) {
NBTTagCompound compound = (NBTTagCompound) base;
String key = compound.getString("id");
if(!key.equals(enchantment.getKey().toString())) {
if (!key.equals(enchantment.getKey().toString())) {
continue;
}

View File

@ -26,7 +26,7 @@ public final class FastGetEnchants implements FastGetEnchantsProxy {
int level = '\uffff' & compound.getShort("lvl");
Enchantment found = Enchantment.getByKey(CraftNamespacedKey.fromStringOrNull(key));
if(found != null) {
if (found != null) {
foundEnchantments.put(found, level);
}
}

View File

@ -69,7 +69,11 @@ public class EnchantmentCache implements Updatable {
);
name = String.valueOf(Configs.LANG.getString("enchantments." + enchantment.getKey().getKey().toLowerCase() + ".name"));
type = enchantment.isCursed() ? EnchantmentType.CURSE : EnchantmentType.NORMAL;
rarity = enchantment.isTreasure() ? EnchantmentRarity.getByName(Configs.CONFIG.getString("rarity.vanilla-treasure-rarity")) : EnchantmentRarity.getByName(Configs.CONFIG.getString("rarity.vanilla-rarity"));
if(enchantment.isTreasure()) {
rarity = EnchantmentRarity.getByName(Configs.CONFIG.getString("rarity.vanilla-treasure-rarity"));
} else {
rarity = EnchantmentRarity.getByName(Configs.CONFIG.getString("rarity.vanilla-rarity"));
}
}
color = type.getColor();

View File

@ -13,4 +13,4 @@ public class HeartArtifact extends Artifact {
public Particle getParticle() {
return Particle.HEART;
}
}
}

View File

@ -13,4 +13,4 @@ public class HoneyArtifact extends Artifact {
public Particle getParticle() {
return Particle.FALLING_HONEY;
}
}
}

View File

@ -5,6 +5,7 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class HarmlessnessCurse extends EcoEnchant {
public HarmlessnessCurse() {
@ -17,9 +18,13 @@ public class HarmlessnessCurse extends EcoEnchant {
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
if (!EnchantmentUtils.passedChance(this, level))
public void onMeleeAttack(@NotNull final LivingEntity attacker,
@NotNull final LivingEntity victim,
final int level,
@NotNull final EntityDamageByEntityEvent event) {
if (!EnchantmentUtils.passedChance(this, level)) {
return;
}
event.setDamage(0);
event.setCancelled(true);

View File

@ -7,6 +7,7 @@ import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.jetbrains.annotations.NotNull;
public class HungerCurse extends EcoEnchant {
public HungerCurse() {
@ -18,15 +19,24 @@ public class HungerCurse extends EcoEnchant {
// START OF LISTENERS
@EventHandler
public void onHunger(FoodLevelChangeEvent event) {
if (!(event.getEntity() instanceof Player))
public void onHunger(@NotNull final FoodLevelChangeEvent event) {
if (!(event.getEntity() instanceof Player)) {
return;
}
Player player = (Player) event.getEntity();
if (!EnchantChecks.helmet(player, this)) return;
if (event.getFoodLevel() > player.getFoodLevel()) return;
if (this.getDisabledWorlds().contains(player.getWorld())) return;
if (!EnchantChecks.helmet(player, this)) {
return;
}
if (event.getFoodLevel() > player.getFoodLevel()) {
return;
}
if (this.getDisabledWorlds().contains(player.getWorld())) {
return;
}
int delta = player.getFoodLevel() - event.getFoodLevel();
delta *= this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "times-more-hunger");

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
public class InaccuracyCurse extends EcoEnchant {
public InaccuracyCurse() {
@ -20,7 +21,10 @@ public class InaccuracyCurse extends EcoEnchant {
@Override
public void onBowShoot(LivingEntity shooter, Arrow arrow, int level, EntityShootBowEvent event) {
public void onBowShoot(@NotNull final LivingEntity shooter,
@NotNull final Arrow arrow,
final int level,
@NotNull final EntityShootBowEvent event) {
double spread = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "spread");
Vector velocity = event.getProjectile().getVelocity().clone();

View File

@ -6,6 +6,7 @@ import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;
import org.jetbrains.annotations.NotNull;
public class MisfortuneCurse extends EcoEnchant {
public MisfortuneCurse() {
@ -18,7 +19,7 @@ public class MisfortuneCurse extends EcoEnchant {
@Override
public void onBlockBreak(Player player, Block block, int level, BlockBreakEvent event) {
public void onBlockBreak(@NotNull Player player, @NotNull Block block, int level, @NotNull BlockBreakEvent event) {
if (!EnchantmentUtils.passedChance(this, level))
return;

View File

@ -28,7 +28,9 @@ public class Famine extends EcoEnchant {
@NotNull final LivingEntity victim,
final int level,
@NotNull final EntityDamageByEntityEvent event) {
if (attacker instanceof Player && ProxyUtils.getProxy(CooldownProxy.class).getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged")) {
if (attacker instanceof Player
&& ProxyUtils.getProxy(CooldownProxy.class).getAttackCooldown((Player) attacker) != 1.0f
&& !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged")) {
return;
}

View File

@ -10,6 +10,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.NotNull;
@SuppressWarnings("deprecation")
public class Graceful extends EcoEnchant {
@ -22,25 +23,35 @@ public class Graceful extends EcoEnchant {
// START OF LISTENERS
@EventHandler
public void onFall(PlayerMoveEvent event) {
public void onFall(@NotNull final PlayerMoveEvent event) {
Player player = event.getPlayer();
if (player.isOnGround())
if (player.isOnGround()) {
return;
}
if(player.getVelocity().getY() > -1) return;
if(player.getLocation().clone().add(0, -3, 0).getBlock().getType().equals(Material.AIR))
if (player.getVelocity().getY() > -1) {
return;
}
if (player.getLocation().clone().add(0, -3, 0).getBlock().getType().equals(Material.AIR)) {
return;
}
if (!EnchantChecks.boots(player, this)) {
return;
}
if(!EnchantChecks.boots(player, this)) return;
int level = EnchantChecks.getBootsLevel(player, this);
if(this.getDisabledWorlds().contains(player.getWorld())) return;
if(!EnchantmentUtils.passedChance(this, level))
if (this.getDisabledWorlds().contains(player.getWorld())) {
return;
}
if (!EnchantmentUtils.passedChance(this, level)) {
return;
}
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 20, 5, false, false, true));
}

View File

@ -7,6 +7,8 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
public class Grapple extends EcoEnchant {
public Grapple() {
super(
@ -18,11 +20,14 @@ public class Grapple extends EcoEnchant {
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull final LivingEntity attacker,
@NotNull final LivingEntity victim,
final int level,
@NotNull final EntityDamageByEntityEvent event) {
double baseMultiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity-multiplier");
Vector vector = attacker.getLocation().toVector().clone().subtract(victim.getLocation().toVector()).normalize().multiply(level * baseMultiplier);
if(VectorUtils.isFinite(vector)) {
if (VectorUtils.isFinite(vector)) {
victim.setVelocity(vector);
}
}

View File

@ -11,6 +11,8 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.jetbrains.annotations.NotNull;
public class GreenThumb extends EcoEnchant {
public GreenThumb() {
super(
@ -21,27 +23,40 @@ public class GreenThumb extends EcoEnchant {
// START OF LISTENERS
@EventHandler
public void onInteract(PlayerInteractEvent event) {
public void onInteract(@NotNull final PlayerInteractEvent event) {
Player player = event.getPlayer();
if (!event.getAction().equals(Action.LEFT_CLICK_BLOCK))
if (!event.getAction().equals(Action.LEFT_CLICK_BLOCK)) {
return;
}
if (event.getClickedBlock() == null)
if (event.getClickedBlock() == null) {
return;
}
if (!event.getClickedBlock().getType().equals(Material.DIRT))
if (!event.getClickedBlock().getType().equals(Material.DIRT)) {
return;
}
if (!EnchantChecks.mainhand(player, this)) return;
if (!EnchantChecks.mainhand(player, this)) {
return;
}
if(this.getDisabledWorlds().contains(player.getWorld())) return;
if (this.getDisabledWorlds().contains(player.getWorld())) {
return;
}
if(!AntigriefManager.canBreakBlock(player, event.getClickedBlock())) return;
if(!AntigriefManager.canPlaceBlock(player, event.getClickedBlock())) return;
if (!AntigriefManager.canBreakBlock(player, event.getClickedBlock())) {
return;
}
if(this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "damage"))
if (!AntigriefManager.canPlaceBlock(player, event.getClickedBlock())) {
return;
}
if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "damage")) {
DurabilityUtils.damageItem(player, player.getInventory().getItemInMainHand(), 1, player.getInventory().getHeldItemSlot());
}
event.getClickedBlock().setType(Material.GRASS_BLOCK);
}

View File

@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.inventory.meta.Damageable;
import org.jetbrains.annotations.NotNull;
public class Grit extends EcoEnchant {
public Grit() {
@ -21,26 +22,35 @@ public class Grit extends EcoEnchant {
// START OF LISTENERS
@EventHandler
public void onGritHurt(EntityDamageByEntityEvent event) {
if (!(event.getEntity() instanceof Player))
public void onGritHurt(@NotNull final EntityDamageByEntityEvent event) {
if (!(event.getEntity() instanceof Player)) {
return;
}
if (!(event.getDamager() instanceof Player))
if (!(event.getDamager() instanceof Player)) {
return;
}
Player player = (Player) event.getEntity();
Player attacker = (Player) event.getDamager();
if (!AntigriefManager.canInjure(attacker, player)) return;
if (!AntigriefManager.canInjure(attacker, player)) {
return;
}
int totalGritPoints = EnchantChecks.getArmorPoints(player, this, 0);
if (totalGritPoints == 0)
if (totalGritPoints == 0) {
return;
if (this.getDisabledWorlds().contains(player.getWorld())) return;
}
if (!(attacker.getInventory().getItemInMainHand() instanceof Damageable))
if (this.getDisabledWorlds().contains(player.getWorld())) {
return;
}
if (!(attacker.getInventory().getItemInMainHand() instanceof Damageable)) {
return;
}
int damage = (int) Math.ceil(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level") * totalGritPoints);

View File

@ -7,6 +7,7 @@ import org.bukkit.World;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Trident;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Hellish extends EcoEnchant {
public Hellish() {
@ -19,9 +20,14 @@ public class Hellish extends EcoEnchant {
@Override
public void onTridentDamage(LivingEntity attacker, LivingEntity victim, Trident trident, int level, EntityDamageByEntityEvent event) {
if(!attacker.getWorld().getEnvironment().equals(World.Environment.NETHER))
public void onTridentDamage(@NotNull final LivingEntity attacker,
@NotNull final LivingEntity victim,
@NotNull final Trident trident,
final int level,
@NotNull final EntityDamageByEntityEvent event) {
if (!attacker.getWorld().getEnvironment().equals(World.Environment.NETHER)) {
return;
}
double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
public class Hook extends EcoEnchant {
public Hook() {
@ -20,7 +21,11 @@ public class Hook extends EcoEnchant {
@Override
public void onArrowDamage(LivingEntity attacker, LivingEntity victim, Arrow arrow, int level, EntityDamageByEntityEvent event) {
public void onArrowDamage(@NotNull final LivingEntity attacker,
@NotNull final LivingEntity victim,
@NotNull final Arrow arrow,
final int level,
@NotNull final EntityDamageByEntityEvent event) {
double baseMultiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity-multiplier");
Vector vector = attacker.getLocation().toVector().clone().subtract(victim.getLocation().toVector()).normalize().multiply(level * baseMultiplier);
if (VectorUtils.isFinite(vector)) {

View File

@ -5,6 +5,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Horde extends EcoEnchant {
public Horde() {
@ -17,7 +18,10 @@ public class Horde extends EcoEnchant {
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull final LivingEntity attacker,
@NotNull final LivingEntity victim,
final int level,
@NotNull final EntityDamageByEntityEvent event) {
double distance = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "distance-per-level") * level;
int entitiesNearby = (int) attacker.getNearbyEntities(distance, distance, distance).stream().filter(entity -> entity instanceof LivingEntity).count();

View File

@ -9,6 +9,8 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
public class IceShot extends EcoEnchant {
public IceShot() {
super(
@ -20,10 +22,15 @@ public class IceShot extends EcoEnchant {
@Override
public void onArrowDamage(LivingEntity attacker, LivingEntity victim, Arrow arrow, int level, EntityDamageByEntityEvent event) {
public void onArrowDamage(@NotNull final LivingEntity attacker,
@NotNull final LivingEntity victim,
@NotNull final Arrow arrow,
final int level,
@NotNull final EntityDamageByEntityEvent event) {
if(!EnchantmentUtils.passedChance(this, level))
if (!EnchantmentUtils.passedChance(this, level)) {
return;
}
victim.setVelocity(new Vector(0, 0, 0));
victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 30, level));

View File

@ -9,6 +9,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.NotNull;
public class Identify extends EcoEnchant {
public Identify() {
@ -21,11 +22,15 @@ public class Identify extends EcoEnchant {
@Override
public void onDeflect(Player blocker, LivingEntity attacker, int level, EntityDamageByEntityEvent event) {
public void onDeflect(@NotNull final Player blocker,
@NotNull final LivingEntity attacker,
final int level,
@NotNull final EntityDamageByEntityEvent event) {
int duration = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level");
if(!EnchantmentUtils.passedChance(this, level))
if (!EnchantmentUtils.passedChance(this, level)) {
return;
}
int finalDuration = duration * level;

View File

@ -10,6 +10,7 @@ import org.bukkit.block.BlockFace;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.jetbrains.annotations.NotNull;
public class Ignite extends EcoEnchant {
public Ignite() {
@ -22,20 +23,26 @@ public class Ignite extends EcoEnchant {
@Override
public void onArrowHit(LivingEntity uncastShooter, int level, ProjectileHitEvent event) {
if (!(uncastShooter instanceof Player))
public void onArrowHit(@NotNull final LivingEntity uncastShooter,
final int level,
@NotNull final ProjectileHitEvent event) {
if (!(uncastShooter instanceof Player)) {
return;
}
if (event.getHitBlock() == null)
if (event.getHitBlock() == null) {
return;
}
Player shooter = (Player) uncastShooter;
if (!AntigriefManager.canBreakBlock(shooter, event.getHitBlock()))
if (!AntigriefManager.canBreakBlock(shooter, event.getHitBlock())) {
return;
}
if (!EnchantmentUtils.passedChance(this, level))
if (!EnchantmentUtils.passedChance(this, level)) {
return;
}
BlockFace face = event.getHitBlockFace();

View File

@ -11,6 +11,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.NotNull;
public class IllusionAspect extends EcoEnchant {
public IllusionAspect() {
@ -23,14 +24,20 @@ public class IllusionAspect extends EcoEnchant {
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
if(attacker instanceof Player && ProxyUtils.getProxy(CooldownProxy.class).getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged")) {
public void onMeleeAttack(@NotNull final LivingEntity attacker,
@NotNull final LivingEntity victim,
final int level,
@NotNull final EntityDamageByEntityEvent event) {
if (attacker instanceof Player
&& ProxyUtils.getProxy(CooldownProxy.class).getAttackCooldown((Player) attacker) != 1.0f
&& !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged")) {
return;
}
if(!EnchantmentUtils.passedChance(this, level))
if (!EnchantmentUtils.passedChance(this, level)) {
return;
}
victim.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, level * 10 + 15, level));
victim.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, level * 10 + 15, level));

View File

@ -7,6 +7,7 @@ import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Trident;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Impact extends EcoEnchant {
public Impact() {
@ -19,10 +20,15 @@ public class Impact extends EcoEnchant {
@Override
public void onTridentDamage(LivingEntity attacker, LivingEntity victim, Trident trident, int level, EntityDamageByEntityEvent event) {
public void onTridentDamage(@NotNull final LivingEntity attacker,
@NotNull final LivingEntity victim,
@NotNull final Trident trident,
final int level,
@NotNull final EntityDamageByEntityEvent event) {
if (!EnchantmentUtils.passedChance(this, level))
if (!EnchantmentUtils.passedChance(this, level)) {
return;
}
event.setDamage(event.getDamage() * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-multiplier"));
}

View File

@ -6,6 +6,8 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Trident;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.jetbrains.annotations.NotNull;
public class Inferno extends EcoEnchant {
public Inferno() {
super(
@ -17,12 +19,12 @@ public class Inferno extends EcoEnchant {
@Override
public void onTridentLaunch(LivingEntity shooter, Trident trident, int level, ProjectileLaunchEvent event) {
public void onTridentLaunch(@NotNull LivingEntity shooter, @NotNull Trident trident, int level, @NotNull ProjectileLaunchEvent event) {
trident.setFireTicks(Integer.MAX_VALUE);
}
@Override
public void onTridentDamage(LivingEntity attacker, LivingEntity victim, Trident trident, int level, EntityDamageByEntityEvent event) {
public void onTridentDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Trident trident, int level, @NotNull EntityDamageByEntityEvent event) {
if(trident.getFireTicks() <= 0) return;
victim.setFireTicks(100);

View File

@ -12,6 +12,7 @@ import org.bukkit.entity.PigZombie;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
public class Infuriate extends EcoEnchant {
public Infuriate() {
@ -24,7 +25,7 @@ public class Infuriate extends EcoEnchant {
@Override
public void onDeflect(Player blocker, LivingEntity attacker, int level, EntityDamageByEntityEvent event) {
public void onDeflect(@NotNull Player blocker, @NotNull LivingEntity attacker, int level, @NotNull EntityDamageByEntityEvent event) {
if(!EnchantmentUtils.passedChance(this, level))
return;

View File

@ -7,6 +7,7 @@ import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Spider;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Insecticide extends EcoEnchant {
public Insecticide() {
@ -19,7 +20,7 @@ public class Insecticide extends EcoEnchant {
@Override
public void onArrowDamage(LivingEntity attacker, LivingEntity victim, Arrow arrow, int level, EntityDamageByEntityEvent event) {
public void onArrowDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Arrow arrow, int level, @NotNull EntityDamageByEntityEvent event) {
if(!(victim instanceof Spider))
return;

View File

@ -7,6 +7,8 @@ import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockDamageEvent;
import org.jetbrains.annotations.NotNull;
public class Instantaneous extends EcoEnchant {
public Instantaneous() {
super(
@ -18,7 +20,7 @@ public class Instantaneous extends EcoEnchant {
@Override
public void onDamageBlock(Player player, Block block, int level, BlockDamageEvent event) {
public void onDamageBlock(@NotNull Player player, @NotNull Block block, int level, @NotNull BlockDamageEvent event) {
if(!EnchantmentUtils.passedChance(this, level))
return;

View File

@ -5,6 +5,8 @@ import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageEvent;
import org.jetbrains.annotations.NotNull;
public class Kinetic extends EcoEnchant {
public Kinetic() {
super(
@ -16,7 +18,7 @@ public class Kinetic extends EcoEnchant {
@Override
public void onDamageWearingArmor(LivingEntity victim, int level, EntityDamageEvent event) {
public void onDamageWearingArmor(@NotNull LivingEntity victim, int level, @NotNull EntityDamageEvent event) {
if(!event.getCause().equals(EntityDamageEvent.DamageCause.FLY_INTO_WALL)) return;
double reduction = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "reduction-per-level");

View File

@ -6,6 +6,8 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Leeching extends EcoEnchant {
public Leeching() {
super(
@ -17,7 +19,7 @@ public class Leeching extends EcoEnchant {
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) {
double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "health-per-level");
double amountToHeal = level * multiplier;
double newHealth = attacker.getHealth() + amountToHeal;

View File

@ -7,6 +7,7 @@ import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Trident;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
import java.util.concurrent.atomic.AtomicInteger;
@ -21,7 +22,7 @@ public class Lesion extends EcoEnchant {
@Override
public void onTridentDamage(LivingEntity attacker, LivingEntity victim, Trident trident, int level, EntityDamageByEntityEvent event) {
public void onTridentDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Trident trident, int level, @NotNull EntityDamageByEntityEvent event) {
if(!EnchantmentUtils.passedChance(this, level))
return;

View File

@ -10,6 +10,8 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
public class Levitate extends EcoEnchant {
public Levitate() {
super(
@ -21,7 +23,7 @@ public class Levitate extends EcoEnchant {
@Override
public void onArrowDamage(LivingEntity attacker, LivingEntity victim, Arrow arrow, int level, EntityDamageByEntityEvent event) {
public void onArrowDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Arrow arrow, int level, @NotNull EntityDamageByEntityEvent event) {
if(!EnchantmentUtils.passedChance(this, level))
return;

View File

@ -9,6 +9,8 @@ import org.bukkit.entity.Enderman;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.MagmaCube;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class LiquidShot extends EcoEnchant {
public LiquidShot() {
super(
@ -20,7 +22,7 @@ public class LiquidShot extends EcoEnchant {
@Override
public void onArrowDamage(LivingEntity attacker, LivingEntity victim, Arrow arrow, int level, EntityDamageByEntityEvent event) {
public void onArrowDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Arrow arrow, int level, @NotNull EntityDamageByEntityEvent event) {
if(!(victim instanceof Blaze || victim instanceof MagmaCube || victim instanceof Enderman))
return;

View File

@ -13,6 +13,7 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.metadata.FixedMetadataValue;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
@ -29,7 +30,7 @@ public class Lumberjack extends EcoEnchant {
@Override
public void onBlockBreak(Player player, Block block, int level, BlockBreakEvent event) {
public void onBlockBreak(@NotNull Player player, @NotNull Block block, int level, @NotNull BlockBreakEvent event) {
if (block.hasMetadata("block-ignore"))
return;

View File

@ -9,6 +9,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.metadata.FixedMetadataValue;
import org.jetbrains.annotations.NotNull;
public class Marking extends EcoEnchant {
public Marking() {
@ -21,7 +22,7 @@ public class Marking extends EcoEnchant {
@Override
public void onArrowDamage(LivingEntity attacker, LivingEntity victim, Arrow arrow, int level, EntityDamageByEntityEvent event) {
public void onArrowDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Arrow arrow, int level, @NotNull EntityDamageByEntityEvent event) {
int ticksPerLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level");
int ticks = ticksPerLevel * level;

View File

@ -6,6 +6,8 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.World;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class NetherInfusion extends EcoEnchant {
public NetherInfusion() {
super(
@ -17,7 +19,7 @@ public class NetherInfusion extends EcoEnchant {
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) {
if(!attacker.getWorld().getEnvironment().equals(World.Environment.NETHER))
return;

View File

@ -7,6 +7,7 @@ import org.bukkit.World;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Netheric extends EcoEnchant {
public Netheric() {
@ -19,7 +20,7 @@ public class Netheric extends EcoEnchant {
@Override
public void onArrowDamage(LivingEntity attacker, LivingEntity victim, Arrow arrow, int level, EntityDamageByEntityEvent event) {
public void onArrowDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Arrow arrow, int level, @NotNull EntityDamageByEntityEvent event) {
if(!attacker.getWorld().getEnvironment().equals(World.Environment.NETHER))
return;

View File

@ -6,6 +6,8 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.World;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Nocturnal extends EcoEnchant {
public Nocturnal() {
super(
@ -17,7 +19,7 @@ public class Nocturnal extends EcoEnchant {
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) {
if(!attacker.getWorld().getEnvironment().equals(World.Environment.NORMAL))
return;

View File

@ -7,6 +7,8 @@ import org.bukkit.Location;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Optics extends EcoEnchant {
public Optics() {
super(
@ -18,7 +20,7 @@ public class Optics extends EcoEnchant {
@Override
public void onArrowDamage(LivingEntity attacker, LivingEntity victim, Arrow arrow, int level, EntityDamageByEntityEvent event) {
public void onArrowDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Arrow arrow, int level, @NotNull EntityDamageByEntityEvent event) {
Location land = arrow.getLocation();
Location source = attacker.getLocation();

View File

@ -7,6 +7,8 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;
import org.jetbrains.annotations.NotNull;
public class Oxygenate extends EcoEnchant {
public Oxygenate() {
super(
@ -18,7 +20,7 @@ public class Oxygenate extends EcoEnchant {
@Override
public void onBlockBreak(Player player, Block block, int level, BlockBreakEvent event) {
public void onBlockBreak(@NotNull Player player, @NotNull Block block, int level, @NotNull BlockBreakEvent event) {
if(player.getRemainingAir() == player.getMaximumAir()) return;
int oxygenLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "oxygen-per-level");

View File

@ -7,6 +7,7 @@ import org.bukkit.entity.Creeper;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Trident;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Pacify extends EcoEnchant {
public Pacify() {
@ -19,7 +20,7 @@ public class Pacify extends EcoEnchant {
@Override
public void onTridentDamage(LivingEntity attacker, LivingEntity victim, Trident trident, int level, EntityDamageByEntityEvent event) {
public void onTridentDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Trident trident, int level, @NotNull EntityDamageByEntityEvent event) {
if(!(victim instanceof Creeper)) return;
double damage = event.getDamage();

View File

@ -6,6 +6,8 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.entity.Horse;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Paladin extends EcoEnchant {
public Paladin() {
super(
@ -17,7 +19,7 @@ public class Paladin extends EcoEnchant {
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) {
if(!(attacker.getVehicle() instanceof Horse)) return;
double damage = event.getDamage();

View File

@ -9,6 +9,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.NotNull;
public class Paralyze extends EcoEnchant {
public Paralyze() {
@ -21,7 +22,7 @@ public class Paralyze extends EcoEnchant {
@Override
public void onDeflect(Player blocker, LivingEntity attacker, int level, EntityDamageByEntityEvent event) {
public void onDeflect(@NotNull Player blocker, @NotNull LivingEntity attacker, int level, @NotNull EntityDamageByEntityEvent event) {
int duration = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level");
if(!EnchantmentUtils.passedChance(this, level))

View File

@ -7,6 +7,8 @@ import org.bukkit.attribute.Attribute;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Parasitic extends EcoEnchant {
public Parasitic() {
super(
@ -18,7 +20,7 @@ public class Parasitic extends EcoEnchant {
@Override
public void onArrowDamage(LivingEntity attacker, LivingEntity victim, Arrow arrow, int level, EntityDamageByEntityEvent event) {
public void onArrowDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Arrow arrow, int level, @NotNull EntityDamageByEntityEvent event) {
double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "health-per-level");
double amountToHeal = level * multiplier;
double newHealth = attacker.getHealth() + amountToHeal;

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Trident;
import org.bukkit.entity.Zombie;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Phantasm extends EcoEnchant {
public Phantasm() {
@ -20,7 +21,7 @@ public class Phantasm extends EcoEnchant {
@Override
public void onTridentDamage(LivingEntity attacker, LivingEntity victim, Trident trident, int level, EntityDamageByEntityEvent event) {
public void onTridentDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Trident trident, int level, @NotNull EntityDamageByEntityEvent event) {
if(!(victim instanceof Zombie || victim instanceof Skeleton)) return;
double damage = event.getDamage();

View File

@ -9,6 +9,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.inventory.EntityEquipment;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
@ -47,7 +48,7 @@ public class Plasmic extends EcoEnchant {
}
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) {
EntityEquipment equipment = victim.getEquipment();
if(equipment == null) return;

View File

@ -5,6 +5,8 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Tameable;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Protector extends EcoEnchant {
public Protector() {
super(
@ -15,7 +17,7 @@ public class Protector extends EcoEnchant {
// START OF LISTENERS
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity uncastVictim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity uncastVictim, int level, @NotNull EntityDamageByEntityEvent event) {
if(!(uncastVictim instanceof Tameable)) return;
Tameable victim = (Tameable) uncastVictim;

View File

@ -5,6 +5,8 @@ import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Proximity extends EcoEnchant {
public Proximity() {
super(
@ -16,7 +18,7 @@ public class Proximity extends EcoEnchant {
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) {
double distance = attacker.getLocation().distance(victim.getLocation());
double decreaseAfter = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "when-closer-than-blocks");

View File

@ -8,6 +8,8 @@ import org.bukkit.entity.Shulker;
import org.bukkit.entity.Trident;
import org.bukkit.entity.Turtle;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Puncture extends EcoEnchant {
public Puncture() {
super(
@ -19,7 +21,7 @@ public class Puncture extends EcoEnchant {
@Override
public void onTridentDamage(LivingEntity attacker, LivingEntity victim, Trident trident, int level, EntityDamageByEntityEvent event) {
public void onTridentDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Trident trident, int level, @NotNull EntityDamageByEntityEvent event) {
if(!(victim instanceof Turtle || victim instanceof Shulker))
return;

View File

@ -7,6 +7,7 @@ import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Slime;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Quadrilateralism extends EcoEnchant {
public Quadrilateralism() {
@ -19,7 +20,7 @@ public class Quadrilateralism extends EcoEnchant {
@Override
public void onArrowDamage(LivingEntity attacker, LivingEntity victim, Arrow arrow, int level, EntityDamageByEntityEvent event) {
public void onArrowDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Arrow arrow, int level, @NotNull EntityDamageByEntityEvent event) {
if(!(victim instanceof Slime))
return;

View File

@ -9,6 +9,8 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.NotNull;
public class Radiance extends EcoEnchant {
public Radiance() {
super(
@ -20,7 +22,7 @@ public class Radiance extends EcoEnchant {
@Override
public void onArrowDamage(LivingEntity attacker, LivingEntity victim, Arrow arrow, int level, EntityDamageByEntityEvent event) {
public void onArrowDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Arrow arrow, int level, @NotNull EntityDamageByEntityEvent event) {
double radius = level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "radius-multiplier");
int duration = level * this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "duration-per-level");

View File

@ -12,6 +12,7 @@ import org.bukkit.entity.Monster;
import org.bukkit.entity.PigZombie;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
public class Rage extends EcoEnchant {
public Rage() {
@ -24,7 +25,7 @@ public class Rage extends EcoEnchant {
@Override
public void onArrowDamage(LivingEntity attacker, LivingEntity victim, Arrow arrow, int level, EntityDamageByEntityEvent event) {
public void onArrowDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Arrow arrow, int level, @NotNull EntityDamageByEntityEvent event) {
if (!EnchantmentUtils.passedChance(this, level))
return;

View File

@ -6,6 +6,7 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.jetbrains.annotations.NotNull;
public class Rapid extends EcoEnchant {
public Rapid() {
@ -18,7 +19,7 @@ public class Rapid extends EcoEnchant {
@Override
public void onBowShoot(LivingEntity shooter, Arrow arrow, int level, EntityShootBowEvent event) {
public void onBowShoot(@NotNull LivingEntity shooter, @NotNull Arrow arrow, int level, @NotNull EntityShootBowEvent event) {
double multiplier = 1 - ((this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percent-faster-per-level") / 100) * level);
if (event.getForce() < multiplier)

View File

@ -5,6 +5,8 @@ import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageEvent;
import org.jetbrains.annotations.NotNull;
public class Reinforcement extends EcoEnchant {
public Reinforcement() {
super(
@ -16,7 +18,7 @@ public class Reinforcement extends EcoEnchant {
@Override
public void onDamageWearingArmor(LivingEntity victim, int level, EntityDamageEvent event) {
public void onDamageWearingArmor(@NotNull LivingEntity victim, int level, @NotNull EntityDamageEvent event) {
if(event.getCause().equals(EntityDamageEvent.DamageCause.FALL)) return;
double reduction = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "reduction-per-level");

View File

@ -7,6 +7,8 @@ import org.bukkit.block.Block;
import org.bukkit.block.data.Ageable;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;
import org.jetbrains.annotations.NotNull;
public class Replenish extends EcoEnchant {
public Replenish() {
super(
@ -18,7 +20,7 @@ public class Replenish extends EcoEnchant {
@Override
public void onBlockBreak(Player player, Block block, int level, BlockBreakEvent event) {
public void onBlockBreak(@NotNull Player player, @NotNull Block block, int level, @NotNull BlockBreakEvent event) {
Material type = block.getType();
if(!(block.getBlockData() instanceof Ageable)) return;

View File

@ -5,6 +5,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageEvent;
import org.jetbrains.annotations.NotNull;
public class Respirator extends EcoEnchant {
public Respirator() {
@ -17,7 +18,7 @@ public class Respirator extends EcoEnchant {
@Override
public void onDamageWearingArmor(LivingEntity victim, int level, EntityDamageEvent event) {
public void onDamageWearingArmor(@NotNull LivingEntity victim, int level, @NotNull EntityDamageEvent event) {
if(!event.getCause().equals(EntityDamageEvent.DamageCause.DRAGON_BREATH)) return;
double reduction = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percent-less-per-level");

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Zombie;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Revenant extends EcoEnchant {
public Revenant() {
@ -20,7 +21,7 @@ public class Revenant extends EcoEnchant {
@Override
public void onArrowDamage(LivingEntity attacker, LivingEntity victim, Arrow arrow, int level, EntityDamageByEntityEvent event) {
public void onArrowDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Arrow arrow, int level, @NotNull EntityDamageByEntityEvent event) {
if(!(victim instanceof Zombie || victim instanceof Skeleton)) return;
double damage = event.getDamage();

View File

@ -6,6 +6,8 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Trident;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Serrated extends EcoEnchant {
public Serrated() {
super(
@ -17,7 +19,7 @@ public class Serrated extends EcoEnchant {
@Override
public void onTridentDamage(LivingEntity attacker, LivingEntity victim, Trident trident, int level, EntityDamageByEntityEvent event) {
public void onTridentDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Trident trident, int level, @NotNull EntityDamageByEntityEvent event) {
double damage = event.getDamage();
double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
double bonus = 1 + (multiplier * level);

View File

@ -7,6 +7,7 @@ import org.bukkit.entity.Arrow;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Settle extends EcoEnchant {
public Settle() {
@ -19,7 +20,7 @@ public class Settle extends EcoEnchant {
@Override
public void onArrowDamage(LivingEntity attacker, LivingEntity victim, Arrow arrow, int level, EntityDamageByEntityEvent event) {
public void onArrowDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Arrow arrow, int level, @NotNull EntityDamageByEntityEvent event) {
if(!(victim instanceof Creeper)) return;
double damage = event.getDamage();

View File

@ -10,6 +10,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
public class Sickening extends EcoEnchant {
public Sickening() {
@ -22,7 +23,7 @@ public class Sickening extends EcoEnchant {
@Override
public void onArrowDamage(LivingEntity attacker, LivingEntity victim, Arrow arrow, int level, EntityDamageByEntityEvent event) {
public void onArrowDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Arrow arrow, int level, @NotNull EntityDamageByEntityEvent event) {
if(!EnchantmentUtils.passedChance(this, level))
return;

View File

@ -7,6 +7,7 @@ import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Slaughter extends EcoEnchant {
public Slaughter() {
@ -19,7 +20,7 @@ public class Slaughter extends EcoEnchant {
@Override
public void onArrowDamage(LivingEntity attacker, LivingEntity victim, Arrow arrow, int level, EntityDamageByEntityEvent event) {
public void onArrowDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Arrow arrow, int level, @NotNull EntityDamageByEntityEvent event) {
if(victim instanceof Monster) return;
double damage = event.getDamage();

View File

@ -5,6 +5,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Stab extends EcoEnchant {
public Stab() {
@ -17,7 +18,7 @@ public class Stab extends EcoEnchant {
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) {
double baseDamage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-base");
double perLevelDamage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level");
double damage = baseDamage + (level * perLevelDamage);

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.NotNull;
public class Stalwart extends EcoEnchant {
public Stalwart() {
@ -20,7 +21,7 @@ public class Stalwart extends EcoEnchant {
@Override
public void onDamageWearingArmor(LivingEntity victim, int level, EntityDamageEvent event) {
public void onDamageWearingArmor(@NotNull LivingEntity victim, int level, @NotNull EntityDamageEvent event) {
if(!EnchantmentUtils.passedChance(this, level))
return;

View File

@ -12,6 +12,8 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
public class StoneSwitcher extends EcoEnchant {
public StoneSwitcher() {
super(
@ -23,7 +25,7 @@ public class StoneSwitcher extends EcoEnchant {
@Override
public void onBlockBreak(Player player, Block block, int level, BlockBreakEvent event) {
public void onBlockBreak(@NotNull Player player, @NotNull Block block, int level, @NotNull BlockBreakEvent event) {
if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR)
return;

View File

@ -11,6 +11,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.NotNull;
public class StrayAspect extends EcoEnchant {
public StrayAspect() {
@ -23,7 +24,7 @@ public class StrayAspect extends EcoEnchant {
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) {
if(attacker instanceof Player && ProxyUtils.getProxy(CooldownProxy.class).getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged")) {
return;
}

View File

@ -11,6 +11,8 @@ import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.jetbrains.annotations.NotNull;
public class Succession extends EcoEnchant {
public Succession() {
super(
@ -22,7 +24,7 @@ public class Succession extends EcoEnchant {
@Override
public void onBowShoot(LivingEntity shooter, Arrow arrow, int level, EntityShootBowEvent event) {
public void onBowShoot(@NotNull LivingEntity shooter, @NotNull Arrow arrow, int level, @NotNull EntityShootBowEvent event) {
int number = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "extra-arrows");
boolean fire = EnchantChecks.mainhand(shooter, Enchantment.ARROW_FIRE);

View File

@ -9,6 +9,7 @@ import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Supercritical extends EcoEnchant {
public Supercritical() {
@ -21,7 +22,7 @@ public class Supercritical extends EcoEnchant {
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) {
if(attacker instanceof Player && ProxyUtils.getProxy(CooldownProxy.class).getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged")) {
return;
}

View File

@ -7,6 +7,8 @@ import org.bukkit.attribute.Attribute;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Sycophant extends EcoEnchant {
public Sycophant() {
super(
@ -18,7 +20,7 @@ public class Sycophant extends EcoEnchant {
@Override
public void onDeflect(Player blocker, LivingEntity attacker, int level, EntityDamageByEntityEvent event) {
public void onDeflect(@NotNull Player blocker, @NotNull LivingEntity attacker, int level, @NotNull EntityDamageByEntityEvent event) {
double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "health-per-level");
double amountToHeal = level * multiplier;
double newHealth = attacker.getHealth() + amountToHeal;

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
public class Tectonic extends EcoEnchant {
@ -21,7 +22,7 @@ public class Tectonic extends EcoEnchant {
@Override
public void onFallDamage(LivingEntity faller, int level, EntityDamageEvent event) {
public void onFallDamage(@NotNull LivingEntity faller, int level, @NotNull EntityDamageEvent event) {
if (!event.getCause().equals(EntityDamageEvent.DamageCause.FALL))
return;

View File

@ -10,6 +10,7 @@ import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Thor extends EcoEnchant {
public Thor() {
@ -22,7 +23,7 @@ public class Thor extends EcoEnchant {
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) {
if (attacker instanceof Player && ProxyUtils.getProxy(CooldownProxy.class).getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged")) {
return;
}

View File

@ -6,6 +6,8 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
public class Tornado extends EcoEnchant {
public Tornado() {
super(
@ -17,7 +19,7 @@ public class Tornado extends EcoEnchant {
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) {
double baseVelocity = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity-per-level");
double yVelocity = baseVelocity * level;

View File

@ -11,6 +11,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.NotNull;
public class Toxic extends EcoEnchant {
public Toxic() {
@ -23,7 +24,7 @@ public class Toxic extends EcoEnchant {
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) {
if (attacker instanceof Player && ProxyUtils.getProxy(CooldownProxy.class).getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged")) {
return;
}

View File

@ -12,6 +12,7 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import java.util.stream.Collectors;
@ -26,7 +27,7 @@ public class Transfuse extends EcoEnchant {
@Override
public void onBlockBreak(Player player, Block block, int level, BlockBreakEvent event) {
public void onBlockBreak(@NotNull Player player, @NotNull Block block, int level, @NotNull BlockBreakEvent event) {
if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR)
return;

View File

@ -10,6 +10,8 @@ import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
public class Tripleshot extends EcoEnchant {
public Tripleshot() {
super(
@ -21,7 +23,7 @@ public class Tripleshot extends EcoEnchant {
@Override
public void onBowShoot(LivingEntity shooter, Arrow arrow, int level, EntityShootBowEvent event) {
public void onBowShoot(@NotNull LivingEntity shooter, @NotNull Arrow arrow, int level, @NotNull EntityShootBowEvent event) {
for (int i = -1; i < 2; i += 2) {

View File

@ -11,6 +11,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.NotNull;
public class VampireAspect extends EcoEnchant {
public VampireAspect() {
@ -23,7 +24,7 @@ public class VampireAspect extends EcoEnchant {
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) {
if(attacker instanceof Player && ProxyUtils.getProxy(CooldownProxy.class).getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged")) {
return;
}

View File

@ -13,6 +13,7 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.metadata.FixedMetadataValue;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
@ -29,7 +30,7 @@ public class Vein extends EcoEnchant {
@Override
public void onBlockBreak(Player player, Block block, int level, BlockBreakEvent event) {
public void onBlockBreak(@NotNull Player player, @NotNull Block block, int level, @NotNull BlockBreakEvent event) {
if (block.hasMetadata("block-ignore"))
return;

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.NotNull;
public class Venom extends EcoEnchant {
public Venom() {
@ -20,7 +21,7 @@ public class Venom extends EcoEnchant {
@Override
public void onArrowDamage(LivingEntity attacker, LivingEntity victim, Arrow arrow, int level, EntityDamageByEntityEvent event) {
public void onArrowDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Arrow arrow, int level, @NotNull EntityDamageByEntityEvent event) {
if (!EnchantmentUtils.passedChance(this, level))
return;

View File

@ -7,6 +7,7 @@ import org.bukkit.World;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Trident;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class VoidAffinity extends EcoEnchant {
public VoidAffinity() {
@ -19,7 +20,7 @@ public class VoidAffinity extends EcoEnchant {
@Override
public void onTridentDamage(LivingEntity attacker, LivingEntity victim, Trident trident, int level, EntityDamageByEntityEvent event) {
public void onTridentDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Trident trident, int level, @NotNull EntityDamageByEntityEvent event) {
if(!attacker.getWorld().getEnvironment().equals(World.Environment.THE_END))
return;

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.inventory.EntityEquipment;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
@ -38,7 +39,7 @@ public class Voltage extends EcoEnchant {
};
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) {
EntityEquipment equipment = victim.getEquipment();
if(equipment == null) return;

View File

@ -6,6 +6,8 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class WaterAffinity extends EcoEnchant {
public WaterAffinity() {
super(
@ -17,7 +19,7 @@ public class WaterAffinity extends EcoEnchant {
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) {
if(!attacker.getLocation().getBlock().getType().equals(Material.WATER))
return;

View File

@ -8,6 +8,8 @@ import org.bukkit.entity.Enderman;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.MagmaCube;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class WaterAspect extends EcoEnchant {
public WaterAspect() {
super(
@ -19,7 +21,7 @@ public class WaterAspect extends EcoEnchant {
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) {
if(!(victim instanceof Blaze || victim instanceof MagmaCube || victim instanceof Enderman))
return;

View File

@ -8,6 +8,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.metadata.FixedMetadataValue;
import org.jetbrains.annotations.NotNull;
public class Weakening extends EcoEnchant {
public Weakening() {
@ -20,7 +21,7 @@ public class Weakening extends EcoEnchant {
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) {
int ticksPerLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level");
int ticks = ticksPerLevel * level;

View File

@ -7,6 +7,7 @@ import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
import java.util.concurrent.atomic.AtomicInteger;
@ -21,7 +22,7 @@ public class Wound extends EcoEnchant {
@Override
public void onArrowDamage(LivingEntity attacker, LivingEntity victim, Arrow arrow, int level, EntityDamageByEntityEvent event) {
public void onArrowDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Arrow arrow, int level, @NotNull EntityDamageByEntityEvent event) {
if (!EnchantmentUtils.passedChance(this, level))
return;

View File

@ -8,6 +8,7 @@ import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Zeus extends EcoEnchant {
public Zeus() {
@ -20,7 +21,7 @@ public class Zeus extends EcoEnchant {
@Override
public void onArrowDamage(LivingEntity attacker, LivingEntity victim, Arrow arrow, int level, EntityDamageByEntityEvent event) {
public void onArrowDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Arrow arrow, int level, @NotNull EntityDamageByEntityEvent event) {
if (!EnchantmentUtils.passedChance(this, level))
return;

View File

@ -9,6 +9,8 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerFishEvent;
import org.jetbrains.annotations.NotNull;
public class Harpoon extends EcoEnchant {
public Harpoon() {
super(
@ -19,23 +21,34 @@ public class Harpoon extends EcoEnchant {
// START OF LISTENERS
@EventHandler
public void onFish(PlayerFishEvent event) {
if(!event.getState().equals(PlayerFishEvent.State.CAUGHT_ENTITY))
public void onFish(@NotNull final PlayerFishEvent event) {
if (!event.getState().equals(PlayerFishEvent.State.CAUGHT_ENTITY)) {
return;
}
if(!(event.getCaught() instanceof LivingEntity))
if (!(event.getCaught() instanceof LivingEntity)) {
return;
}
Player player = event.getPlayer();
LivingEntity victim = (LivingEntity) event.getCaught();
if(victim.hasMetadata("NPC")) return;
if (victim.hasMetadata("NPC")) {
return;
}
if(!AntigriefManager.canInjure(player, victim)) return;
if (!AntigriefManager.canInjure(player, victim)) {
return;
}
if (!EnchantChecks.mainhand(player, this)) return;
if(this.getDisabledWorlds().contains(player.getWorld())) return;
if (!EnchantChecks.mainhand(player, this)) {
return;
}
if (this.getDisabledWorlds().contains(player.getWorld())) {
return;
}
int level = EnchantChecks.getMainhandLevel(player, this);

View File

@ -6,6 +6,8 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class LifeSteal extends EcoEnchant {
public LifeSteal() {
super(
@ -17,7 +19,7 @@ public class LifeSteal extends EcoEnchant {
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) {
double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "health-per-level");
double amountToHeal = level * multiplier;
double newHealth = attacker.getHealth() + amountToHeal;

View File

@ -10,6 +10,8 @@ import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
public class Pentashot extends EcoEnchant {
public Pentashot() {
super(
@ -21,7 +23,7 @@ public class Pentashot extends EcoEnchant {
@Override
public void onBowShoot(LivingEntity shooter, Arrow arrow, int level, EntityShootBowEvent event) {
public void onBowShoot(@NotNull LivingEntity shooter, @NotNull Arrow arrow, int level, @NotNull EntityShootBowEvent event) {
for (int i = -2; i <= 2; i += 1) {
if(i == 0) continue;

View File

@ -5,6 +5,8 @@ import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageEvent;
import org.jetbrains.annotations.NotNull;
public class Preservation extends EcoEnchant {
public Preservation() {
super(
@ -16,7 +18,7 @@ public class Preservation extends EcoEnchant {
@Override
public void onDamageWearingArmor(LivingEntity victim, int level, EntityDamageEvent event) {
public void onDamageWearingArmor(@NotNull LivingEntity victim, int level, @NotNull EntityDamageEvent event) {
if(event.getCause().equals(EntityDamageEvent.DamageCause.FALL)) return;
double reduction = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percent-less-per-level");

View File

@ -8,6 +8,7 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Razor extends EcoEnchant {
public Razor() {
@ -20,7 +21,7 @@ public class Razor extends EcoEnchant {
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) {
double perLevelMultiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
double baseDamage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "base-damage");
double extra = level*perLevelMultiplier + baseDamage;

View File

@ -6,6 +6,8 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.jetbrains.annotations.NotNull;
public class Spring extends EcoEnchant {
public Spring() {
super(
@ -17,14 +19,14 @@ public class Spring extends EcoEnchant {
@Override
public void onDamageWearingArmor(LivingEntity victim, int level, EntityDamageEvent event) {
public void onDamageWearingArmor(@NotNull LivingEntity victim, int level, @NotNull EntityDamageEvent event) {
if (event.getCause() == EntityDamageEvent.DamageCause.FALL) {
event.setCancelled(true);
}
}
@Override
public void onJump(Player player, int level, PlayerMoveEvent event) {
public void onJump(@NotNull Player player, int level, @NotNull PlayerMoveEvent event) {
double multiplier = 0.5 + ((double) (level * level) / 4 - 0.2) / 3;
player.setVelocity(player.getLocation().getDirection().multiply(multiplier).setY(multiplier));
}

View File

@ -5,6 +5,8 @@ import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class Streamlining extends EcoEnchant {
public Streamlining() {
super(
@ -16,7 +18,7 @@ public class Streamlining extends EcoEnchant {
@Override
public void onArmorEquip(Player player, int level, ArmorEquipEvent event) {
public void onArmorEquip(@NotNull Player player, int level, @NotNull ArmorEquipEvent event) {
if(level == 0) {
player.setWalkSpeed(0.2f);
return;

View File

@ -11,6 +11,7 @@ import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Volatile extends EcoEnchant {
public Volatile() {
@ -23,7 +24,7 @@ public class Volatile extends EcoEnchant {
@Override
public void onMeleeAttack(LivingEntity uncastAttacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull LivingEntity uncastAttacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) {
if(!(uncastAttacker instanceof Player)) return;
Player attacker = (Player) uncastAttacker;

View File

@ -12,20 +12,22 @@ import org.bukkit.inventory.GrindstoneInventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull;
import java.util.Map;
public class GrindstoneListeners extends PluginDependent implements Listener {
public GrindstoneListeners(AbstractEcoPlugin plugin) {
public GrindstoneListeners(@NotNull final AbstractEcoPlugin plugin) {
super(plugin);
}
@EventHandler
public void onGrindstone(InventoryClickEvent event) {
public void onGrindstone(@NotNull final InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
if (player.getOpenInventory().getTopInventory().getType() != InventoryType.GRINDSTONE)
if (player.getOpenInventory().getTopInventory().getType() != InventoryType.GRINDSTONE) {
return;
}
GrindstoneInventory inventory = (GrindstoneInventory) player.getOpenInventory().getTopInventory();
@ -39,7 +41,9 @@ public class GrindstoneListeners extends PluginDependent implements Listener {
if (toKeep.isEmpty()) {
inventory.setItem(2, out);
}
if (out == null) return;
if (out == null) {
return;
}
ItemStack newOut = out.clone();
if (newOut.getItemMeta() instanceof EnchantmentStorageMeta) {

View File

@ -2,16 +2,20 @@ package com.willfp.ecoenchants.enchantments.support.merging.grindstone;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import lombok.experimental.UtilityClass;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
import java.util.Map;
@SuppressWarnings("deprecation")
@UtilityClass
public class GrindstoneMerge {
public static Map<Enchantment, Integer> doMerge(ItemStack top, ItemStack bottom) {
public static Map<Enchantment, Integer> doMerge(@Nullable final ItemStack top,
@Nullable final ItemStack bottom) {
Map<Enchantment, Integer> bottomEnchants = new HashMap<>();
Map<Enchantment, Integer> topEnchants = new HashMap<>();
@ -36,17 +40,25 @@ public class GrindstoneMerge {
bottomEnchants.forEach(((enchantment, integer) -> {
if (EcoEnchants.getFromEnchantment(enchantment) != null) {
EcoEnchant ecoEnchant = EcoEnchants.getFromEnchantment(enchantment);
if (!ecoEnchant.isGrindstoneable()) toKeep.putIfAbsent(enchantment, integer);
if (!ecoEnchant.isGrindstoneable()) {
toKeep.putIfAbsent(enchantment, integer);
}
} else {
if (enchantment.isCursed()) toKeep.putIfAbsent(enchantment, integer);
if (enchantment.isCursed()) {
toKeep.putIfAbsent(enchantment, integer);
}
}
}));
topEnchants.forEach(((enchantment, integer) -> {
if (EcoEnchants.getFromEnchantment(enchantment) != null) {
EcoEnchant ecoEnchant = EcoEnchants.getFromEnchantment(enchantment);
if (!ecoEnchant.isGrindstoneable()) toKeep.putIfAbsent(enchantment, integer);
if (!ecoEnchant.isGrindstoneable()) {
toKeep.putIfAbsent(enchantment, integer);
}
} else {
if (enchantment.isCursed()) toKeep.putIfAbsent(enchantment, integer);
if (enchantment.isCursed()) {
toKeep.putIfAbsent(enchantment, integer);
}
}
}));

View File

@ -14,47 +14,209 @@ import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.jetbrains.annotations.NotNull;
public interface Watcher {
default void onArrowDamage(LivingEntity attacker, LivingEntity victim, Arrow arrow, int level, EntityDamageByEntityEvent event) {
/**
* Called when an entity shoots another entity with an arrow.
*
* @param attacker The shooter.
* @param victim The victim.
* @param arrow The arrow entity.
* @param level The level of the enchantment on the arrow.
* @param event The event that called this watcher.
*/
default void onArrowDamage(@NotNull final LivingEntity attacker,
@NotNull final LivingEntity victim,
@NotNull final Arrow arrow,
final int level,
@NotNull final EntityDamageByEntityEvent event) {
// Empty default as enchantments only override required watchers.
}
default void onTridentDamage(LivingEntity attacker, LivingEntity victim, Trident trident, int level, EntityDamageByEntityEvent event) {
/**
* Called when an entity damages another entity with a trident throw.
*
* @param attacker The shooter.
* @param victim The victim.
* @param trident The trident entity.
* @param level The level of the enchantment on the trident.
* @param event The event that called this watcher.
*/
default void onTridentDamage(@NotNull final LivingEntity attacker,
@NotNull final LivingEntity victim,
@NotNull final Trident trident,
final int level,
@NotNull final EntityDamageByEntityEvent event) {
// Empty default as enchantments only override required watchers.
}
default void onJump(Player player, int level, PlayerMoveEvent event) {
/**
* Called when a player jumps.
*
* @param player The player.
* @param level The level of the enchantment found on the player's armor.
* @param event The event that called this watcher.
*/
default void onJump(@NotNull final Player player,
final int level,
@NotNull final PlayerMoveEvent event) {
// Empty default as enchantments only override required watchers.
}
default void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
/**
* Called when an entity attacks another entity with a melee attack.
*
* @param attacker The attacker.
* @param victim The victim.
* @param level The level of the enchantment found on the attacker's weapon.
* @param event The event that called this watcher.
*/
default void onMeleeAttack(@NotNull final LivingEntity attacker,
@NotNull final LivingEntity victim,
final int level,
@NotNull final EntityDamageByEntityEvent event) {
// Empty default as enchantments only override required watchers.
}
default void onBowShoot(LivingEntity shooter, Arrow arrow, int level, EntityShootBowEvent event) {
/**
* Called when an entity shoots a bow.
*
* @param shooter The entity that shot the bow.
* @param arrow The arrow that was shot.
* @param level The level of the enchantment found on the bow.
* @param event The event that called this watcher.
*/
default void onBowShoot(@NotNull final LivingEntity shooter,
@NotNull final Arrow arrow,
final int level,
@NotNull final EntityShootBowEvent event) {
// Empty default as enchantments only override required watchers.
}
default void onFallDamage(LivingEntity faller, int level, EntityDamageEvent event) {
/**
* Called when an entity takes fall damage.
*
* @param faller The entity that took the fall damage.
* @param level The level of the enchantment found on the entity's armor.
* @param event The event that called this watcher.
*/
default void onFallDamage(@NotNull final LivingEntity faller,
final int level,
@NotNull final EntityDamageEvent event) {
// Empty default as enchantments only override required watchers.
}
default void onArrowHit(LivingEntity shooter, int level, ProjectileHitEvent event) {
/**
* Called when an arrow hits a block or entity.
*
* @param shooter The entity that shot the arrow.
* @param level The level of the enchantment found on the arrow.
* @param event The event that called this watcher.
*/
default void onArrowHit(@NotNull final LivingEntity shooter,
final int level,
@NotNull final ProjectileHitEvent event) {
// Empty default as enchantments only override required watchers.
}
default void onTridentHit(LivingEntity shooter, int level, ProjectileHitEvent event) {
/**
* Called when a trident hits a block or entity.
*
* @param shooter The entity that threw the trident.
* @param level The level of the enchantment found on the trident.
* @param event The event that called this watcher.
*/
default void onTridentHit(@NotNull final LivingEntity shooter,
final int level,
@NotNull final ProjectileHitEvent event) {
// Empty default as enchantments only override required watchers.
}
default void onBlockBreak(Player player, Block block, int level, BlockBreakEvent event) {
/**
* Called when a player breaks a block.
*
* @param player The player.
* @param block The block that was broken.
* @param level The level of the enchantment found on the player's main hand item.
* @param event The event that called this watcher.
*/
default void onBlockBreak(@NotNull final Player player,
@NotNull final Block block,
final int level,
@NotNull final BlockBreakEvent event) {
// Empty default as enchantments only override required watchers.
}
default void onDamageWearingArmor(LivingEntity victim, int level, EntityDamageEvent event) {
/**
* Called when an entity takes damage wearing armor.
*
* @param victim The entity that took damage.
* @param level The level of the enchantment found on the entity's armor.
* @param event The event that called this watcher.
*/
default void onDamageWearingArmor(@NotNull final LivingEntity victim,
final int level,
@NotNull final EntityDamageEvent event) {
// Empty default as enchantments only override required watchers.
}
default void onArmorEquip(Player player, int level, ArmorEquipEvent event) {
/**
* Called when an entity puts on or takes off armor with an enchantment.
*
* @param player The player that equipped the armor.
* @param level The level of the enchantment found on the player's armor.
* @param event The event that called this watcher.
*/
default void onArmorEquip(@NotNull final Player player,
final int level,
@NotNull final ArmorEquipEvent event) {
// Empty default as enchantments only override required watchers.
}
default void onDamageBlock(Player player, Block block, int level, BlockDamageEvent event) {
/**
* Called when a player damages a block.
*
* @param player The player that damaged the block.
* @param block The damaged block.
* @param level The level of the enchantment found on the player's main hand.
* @param event The event that called this watcher.
*/
default void onDamageBlock(@NotNull final Player player,
@NotNull final Block block,
final int level,
@NotNull final BlockDamageEvent event) {
// Empty default as enchantments only override required watchers.
}
default void onTridentLaunch(LivingEntity shooter, Trident trident, int level, ProjectileLaunchEvent event) {
/**
* Called when an entity throws a trident.
*
* @param shooter The entity that threw the trident.
* @param trident The trident that was thrown.
* @param level The level of the enchantment found on the trident.
* @param event The event that called this watcher.
*/
default void onTridentLaunch(@NotNull final LivingEntity shooter,
@NotNull final Trident trident,
final int level,
@NotNull final ProjectileLaunchEvent event) {
// Empty default as enchantments only override required watchers.
}
default void onDeflect(Player blocker, LivingEntity attacker, int level, EntityDamageByEntityEvent event) {
/**
* Called when a player blocks an attack with a shield.
*
* @param blocker The player that blocked the attack.
* @param attacker The attacker.
* @param level The level of the enchantment found on the shield.
* @param event The event that called this watcher.
*/
default void onDeflect(@NotNull final Player blocker,
@NotNull final LivingEntity attacker,
final int level,
@NotNull final EntityDamageByEntityEvent event) {
// Empty default as enchantments only override required watchers.
}
}

View File

@ -14,7 +14,7 @@ public class HeatTreated extends BiomesEnchantment {
}
@Override
public boolean isValid(@NotNull Biome biome) {
public boolean isValid(@NotNull final Biome biome) {
return Arrays.stream(new String[]{"desert", "badlands", "savanna"}).anyMatch(biome.name().toLowerCase()::contains);
}
}

View File

@ -13,7 +13,7 @@ public class Icelord extends BiomesEnchantment {
}
@Override
public boolean isValid(@NotNull Biome biome) {
public boolean isValid(@NotNull final Biome biome) {
return Arrays.stream(new String[]{"snowy", "ice", "frozen"}).anyMatch(biome.name().toLowerCase()::contains);
}
}

View File

@ -23,6 +23,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.metadata.FixedMetadataValue;
import org.jetbrains.annotations.NotNull;
public abstract class SummoningEnchantment extends EcoEnchant {
private final SummoningType summoningType;
@ -36,21 +37,21 @@ public abstract class SummoningEnchantment extends EcoEnchant {
public abstract EntityType getEntity();
@Override
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) {
if(!summoningType.equals(SummoningType.MELEE)) return;
doSpawn(attacker, victim, level);
}
@Override
public void onArrowDamage(LivingEntity attacker, LivingEntity victim, Arrow arrow, int level, EntityDamageByEntityEvent event) {
public void onArrowDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Arrow arrow, int level, @NotNull EntityDamageByEntityEvent event) {
if(!summoningType.equals(SummoningType.RANGED)) return;
doSpawn(attacker, victim, level);
}
@Override
public void onTridentDamage(LivingEntity attacker, LivingEntity victim, Trident trident, int level, EntityDamageByEntityEvent event) {
public void onTridentDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Trident trident, int level, @NotNull EntityDamageByEntityEvent event) {
if(!summoningType.equals(SummoningType.TRIDENT)) return;
doSpawn(attacker, victim, level);