mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-22 15:05:18 +01:00
Fixed lingering codestyle issues
This commit is contained in:
parent
9dc2c08e43
commit
16de0f9630
@ -8,11 +8,9 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
|||||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Trident;
|
import org.bukkit.entity.Trident;
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||||
@ -25,24 +23,12 @@ public class Splash extends EcoEnchant {
|
|||||||
"splash", EnchantmentType.NORMAL
|
"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();
|
Trident trident = (Trident) event.getEntity();
|
||||||
Player player = (Player) event.getEntity().getShooter();
|
|
||||||
|
|
||||||
ItemStack item = TridentUtils.getItemStack(trident);
|
ItemStack item = TridentUtils.getItemStack(trident);
|
||||||
|
|
||||||
@ -50,34 +36,34 @@ public class Splash extends EcoEnchant {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.getDisabledWorlds().contains(player.getWorld())) {
|
if (this.getDisabledWorlds().contains(shooter.getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int level = EnchantChecks.getItemLevel(item, this);
|
|
||||||
|
|
||||||
double radius = level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "radius-multiplier");
|
double radius = level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "radius-multiplier");
|
||||||
double damage = level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level");
|
double damage = level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level");
|
||||||
|
|
||||||
for (Entity e : trident.getNearbyEntities(radius, radius, radius)) {
|
for (Entity victim : trident.getNearbyEntities(radius, radius, radius)) {
|
||||||
if (e.hasMetadata("NPC")) {
|
if (victim.hasMetadata("NPC")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(e instanceof LivingEntity)) {
|
if (!(victim instanceof LivingEntity)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
LivingEntity entity = (LivingEntity) e;
|
LivingEntity entity = (LivingEntity) victim;
|
||||||
|
|
||||||
if (e.equals(player)) {
|
if (victim.equals(shooter)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.getPluginManager().callEvent(new EntityDamageByEntityEvent(trident, entity, EntityDamageEvent.DamageCause.ENTITY_ATTACK, damage));
|
Bukkit.getPluginManager().callEvent(new EntityDamageByEntityEvent(trident, entity, EntityDamageEvent.DamageCause.ENTITY_ATTACK, damage));
|
||||||
|
|
||||||
if (!AntigriefManager.canInjure(player, entity)) {
|
if (shooter instanceof Player) {
|
||||||
continue;
|
if (!AntigriefManager.canInjure((Player) shooter, entity)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.damage(damage, trident);
|
entity.damage(damage, trident);
|
||||||
|
@ -416,7 +416,7 @@ public class WatcherTriggers extends PluginDependent implements Listener {
|
|||||||
ItemStack item = TridentUtils.getItemStack(trident);
|
ItemStack item = TridentUtils.getItemStack(trident);
|
||||||
LivingEntity shooter = (LivingEntity) event.getEntity().getShooter();
|
LivingEntity shooter = (LivingEntity) event.getEntity().getShooter();
|
||||||
|
|
||||||
EnchantChecks.getEnchantsOnItem(item).forEach(((enchant, level) -> {
|
EnchantChecks.getEnchantsOnItem(item).forEach((enchant, level) -> {
|
||||||
if (!enchant.isEnabled()) {
|
if (!enchant.isEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -426,7 +426,7 @@ public class WatcherTriggers extends PluginDependent implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enchant.onTridentHit(shooter, level, event);
|
enchant.onTridentHit(shooter, level, event);
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9,6 +9,7 @@ import net.mmogroup.mmolib.api.player.MMOPlayerData;
|
|||||||
import net.mmogroup.mmolib.api.stat.SharedStat;
|
import net.mmogroup.mmolib.api.stat.SharedStat;
|
||||||
import net.mmogroup.mmolib.api.stat.modifier.StatModifier;
|
import net.mmogroup.mmolib.api.stat.modifier.StatModifier;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class Augment extends MMOEnchantment {
|
public class Augment extends MMOEnchantment {
|
||||||
private static final String KEY = "ecoenchants_bonus_mana";
|
private static final String KEY = "ecoenchants_bonus_mana";
|
||||||
@ -18,7 +19,7 @@ public class Augment extends MMOEnchantment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
MMOPlayerData data = MMOPlayerData.get(player);
|
||||||
|
|
||||||
data.getStatMap().getInstance(SharedStat.MAX_MANA).remove(KEY);
|
data.getStatMap().getInstance(SharedStat.MAX_MANA).remove(KEY);
|
||||||
|
@ -8,6 +8,7 @@ import com.willfp.ecoenchants.mmo.structure.MMOEnchantment;
|
|||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class Elixir extends MMOEnchantment {
|
public class Elixir extends MMOEnchantment {
|
||||||
public Elixir() {
|
public Elixir() {
|
||||||
@ -15,7 +16,7 @@ public class Elixir extends MMOEnchantment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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))
|
if(!(attacker instanceof Player && victim instanceof Player))
|
||||||
return;
|
return;
|
||||||
Player pAttacker = (Player) attacker;
|
Player pAttacker = (Player) attacker;
|
||||||
|
@ -8,6 +8,7 @@ import org.bukkit.entity.Arrow;
|
|||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class Siphon extends MMOEnchantment {
|
public class Siphon extends MMOEnchantment {
|
||||||
public Siphon() {
|
public Siphon() {
|
||||||
@ -15,7 +16,7 @@ public class Siphon extends MMOEnchantment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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))
|
if(!(attacker instanceof Player && victim instanceof Player))
|
||||||
return;
|
return;
|
||||||
Player pAttacker = (Player) attacker;
|
Player pAttacker = (Player) attacker;
|
||||||
|
@ -9,6 +9,7 @@ import net.mmogroup.mmolib.api.player.MMOPlayerData;
|
|||||||
import net.mmogroup.mmolib.api.stat.SharedStat;
|
import net.mmogroup.mmolib.api.stat.SharedStat;
|
||||||
import net.mmogroup.mmolib.api.stat.modifier.StatModifier;
|
import net.mmogroup.mmolib.api.stat.modifier.StatModifier;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class Strengthening extends MMOEnchantment {
|
public class Strengthening extends MMOEnchantment {
|
||||||
private static final String KEY = "ecoenchants_bonus_strength";
|
private static final String KEY = "ecoenchants_bonus_strength";
|
||||||
@ -18,7 +19,7 @@ public class Strengthening extends MMOEnchantment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
MMOPlayerData data = MMOPlayerData.get(player);
|
||||||
|
|
||||||
data.getStatMap().getInstance(SharedStat.ATTACK_DAMAGE).remove(KEY);
|
data.getStatMap().getInstance(SharedStat.ATTACK_DAMAGE).remove(KEY);
|
||||||
|
@ -9,6 +9,7 @@ import net.mmogroup.mmolib.api.player.MMOPlayerData;
|
|||||||
import net.mmogroup.mmolib.api.stat.SharedStat;
|
import net.mmogroup.mmolib.api.stat.SharedStat;
|
||||||
import net.mmogroup.mmolib.api.stat.modifier.StatModifier;
|
import net.mmogroup.mmolib.api.stat.modifier.StatModifier;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class Athletic extends MMOEnchantment {
|
public class Athletic extends MMOEnchantment {
|
||||||
private static final String KEY = "ecoenchants_bonus_stamina";
|
private static final String KEY = "ecoenchants_bonus_stamina";
|
||||||
@ -18,7 +19,7 @@ public class Athletic extends MMOEnchantment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
MMOPlayerData data = MMOPlayerData.get(player);
|
||||||
|
|
||||||
data.getStatMap().getInstance(SharedStat.MAX_STAMINA).remove(KEY);
|
data.getStatMap().getInstance(SharedStat.MAX_STAMINA).remove(KEY);
|
||||||
|
@ -8,6 +8,7 @@ import org.bukkit.entity.Arrow;
|
|||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class Fortitude extends MMOEnchantment {
|
public class Fortitude extends MMOEnchantment {
|
||||||
public Fortitude() {
|
public Fortitude() {
|
||||||
@ -15,7 +16,7 @@ public class Fortitude extends MMOEnchantment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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))
|
if(!(attacker instanceof Player && victim instanceof Player))
|
||||||
return;
|
return;
|
||||||
Player pAttacker = (Player) attacker;
|
Player pAttacker = (Player) attacker;
|
||||||
|
@ -8,6 +8,7 @@ import com.willfp.ecoenchants.mmo.structure.MMOEnchantment;
|
|||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class Motivate extends MMOEnchantment {
|
public class Motivate extends MMOEnchantment {
|
||||||
public Motivate() {
|
public Motivate() {
|
||||||
@ -15,7 +16,7 @@ public class Motivate extends MMOEnchantment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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))
|
if(!(attacker instanceof Player && victim instanceof Player))
|
||||||
return;
|
return;
|
||||||
Player pAttacker = (Player) attacker;
|
Player pAttacker = (Player) attacker;
|
||||||
|
Loading…
Reference in New Issue
Block a user