Fixed lingering codestyle issues

This commit is contained in:
Auxilor 2021-02-19 18:44:08 +00:00
parent 9dc2c08e43
commit 16de0f9630
9 changed files with 30 additions and 37 deletions

View File

@ -8,11 +8,9 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
import org.bukkit.Bukkit;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Trident;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
@ -25,24 +23,12 @@ public class Splash extends EcoEnchant {
"splash", EnchantmentType.NORMAL
);
}
@EventHandler
public void onSplashLand(@NotNull final ProjectileHitEvent event) {
if (event.getEntityType() != EntityType.TRIDENT) {
return;
}
if (!(event.getEntity().getShooter() instanceof Player)) {
return;
}
if (!(event.getEntity() instanceof Trident)) {
return;
}
@Override
public void onTridentHit(@NotNull final LivingEntity shooter,
final int level,
@NotNull final ProjectileHitEvent event) {
Trident trident = (Trident) event.getEntity();
Player player = (Player) event.getEntity().getShooter();
ItemStack item = TridentUtils.getItemStack(trident);
@ -50,35 +36,35 @@ public class Splash extends EcoEnchant {
return;
}
if (this.getDisabledWorlds().contains(player.getWorld())) {
if (this.getDisabledWorlds().contains(shooter.getWorld())) {
return;
}
int level = EnchantChecks.getItemLevel(item, this);
double radius = level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "radius-multiplier");
double damage = level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level");
for (Entity e : trident.getNearbyEntities(radius, radius, radius)) {
if (e.hasMetadata("NPC")) {
for (Entity victim : trident.getNearbyEntities(radius, radius, radius)) {
if (victim.hasMetadata("NPC")) {
continue;
}
if (!(e instanceof LivingEntity)) {
if (!(victim instanceof LivingEntity)) {
continue;
}
LivingEntity entity = (LivingEntity) e;
LivingEntity entity = (LivingEntity) victim;
if (e.equals(player)) {
if (victim.equals(shooter)) {
continue;
}
Bukkit.getPluginManager().callEvent(new EntityDamageByEntityEvent(trident, entity, EntityDamageEvent.DamageCause.ENTITY_ATTACK, damage));
if (!AntigriefManager.canInjure(player, entity)) {
if (shooter instanceof Player) {
if (!AntigriefManager.canInjure((Player) shooter, entity)) {
continue;
}
}
entity.damage(damage, trident);
}

View File

@ -416,7 +416,7 @@ public class WatcherTriggers extends PluginDependent implements Listener {
ItemStack item = TridentUtils.getItemStack(trident);
LivingEntity shooter = (LivingEntity) event.getEntity().getShooter();
EnchantChecks.getEnchantsOnItem(item).forEach(((enchant, level) -> {
EnchantChecks.getEnchantsOnItem(item).forEach((enchant, level) -> {
if (!enchant.isEnabled()) {
return;
}
@ -426,7 +426,7 @@ public class WatcherTriggers extends PluginDependent implements Listener {
}
enchant.onTridentHit(shooter, level, event);
}));
});
}
/**

View File

@ -9,6 +9,7 @@ import net.mmogroup.mmolib.api.player.MMOPlayerData;
import net.mmogroup.mmolib.api.stat.SharedStat;
import net.mmogroup.mmolib.api.stat.modifier.StatModifier;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class Augment extends MMOEnchantment {
private static final String KEY = "ecoenchants_bonus_mana";
@ -18,7 +19,7 @@ public class Augment extends MMOEnchantment {
}
@Override
public void onArmorEquip(Player player, int level, ArmorEquipEvent event) {
public void onArmorEquip(@NotNull Player player, int level, @NotNull ArmorEquipEvent event) {
MMOPlayerData data = MMOPlayerData.get(player);
data.getStatMap().getInstance(SharedStat.MAX_MANA).remove(KEY);

View File

@ -8,6 +8,7 @@ import com.willfp.ecoenchants.mmo.structure.MMOEnchantment;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Elixir extends MMOEnchantment {
public Elixir() {
@ -15,7 +16,7 @@ public class Elixir extends MMOEnchantment {
}
@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 && victim instanceof Player))
return;
Player pAttacker = (Player) attacker;

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Siphon extends MMOEnchantment {
public Siphon() {
@ -15,7 +16,7 @@ public class Siphon extends MMOEnchantment {
}
@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 instanceof Player && victim instanceof Player))
return;
Player pAttacker = (Player) attacker;

View File

@ -9,6 +9,7 @@ import net.mmogroup.mmolib.api.player.MMOPlayerData;
import net.mmogroup.mmolib.api.stat.SharedStat;
import net.mmogroup.mmolib.api.stat.modifier.StatModifier;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class Strengthening extends MMOEnchantment {
private static final String KEY = "ecoenchants_bonus_strength";
@ -18,7 +19,7 @@ public class Strengthening extends MMOEnchantment {
}
@Override
public void onArmorEquip(Player player, int level, ArmorEquipEvent event) {
public void onArmorEquip(@NotNull Player player, int level, @NotNull ArmorEquipEvent event) {
MMOPlayerData data = MMOPlayerData.get(player);
data.getStatMap().getInstance(SharedStat.ATTACK_DAMAGE).remove(KEY);

View File

@ -9,6 +9,7 @@ import net.mmogroup.mmolib.api.player.MMOPlayerData;
import net.mmogroup.mmolib.api.stat.SharedStat;
import net.mmogroup.mmolib.api.stat.modifier.StatModifier;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class Athletic extends MMOEnchantment {
private static final String KEY = "ecoenchants_bonus_stamina";
@ -18,7 +19,7 @@ public class Athletic extends MMOEnchantment {
}
@Override
public void onArmorEquip(Player player, int level, ArmorEquipEvent event) {
public void onArmorEquip(@NotNull Player player, int level, @NotNull ArmorEquipEvent event) {
MMOPlayerData data = MMOPlayerData.get(player);
data.getStatMap().getInstance(SharedStat.MAX_STAMINA).remove(KEY);

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.Arrow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Fortitude extends MMOEnchantment {
public Fortitude() {
@ -15,7 +16,7 @@ public class Fortitude extends MMOEnchantment {
}
@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 instanceof Player && victim instanceof Player))
return;
Player pAttacker = (Player) attacker;

View File

@ -8,6 +8,7 @@ import com.willfp.ecoenchants.mmo.structure.MMOEnchantment;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.jetbrains.annotations.NotNull;
public class Motivate extends MMOEnchantment {
public Motivate() {
@ -15,7 +16,7 @@ public class Motivate extends MMOEnchantment {
}
@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 && victim instanceof Player))
return;
Player pAttacker = (Player) attacker;