mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-26 15:45:12 +01:00
Refactored util names
This commit is contained in:
parent
bdaed4631f
commit
2e47aa9b02
@ -5,7 +5,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||
import com.willfp.ecoenchants.util.ItemDurability;
|
||||
import com.willfp.ecoenchants.util.DurabilityUtils;
|
||||
import com.willfp.ecoenchants.util.interfaces.EcoRunnable;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.Repairable;
|
||||
@ -36,7 +36,7 @@ public final class DecayCurse extends EcoEnchant implements EcoRunnable {
|
||||
|
||||
int damage = EcoEnchants.DECAY_CURSE.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "damage");
|
||||
|
||||
ItemDurability.damageItemNoBreak(item, damage, player);
|
||||
DurabilityUtils.damageItemNoBreak(item, damage, player);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.nms.Cooldown;
|
||||
import com.willfp.ecoenchants.util.ItemDurability;
|
||||
import com.willfp.ecoenchants.util.DurabilityUtils;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
@ -40,16 +40,16 @@ public final class Abrasion extends EcoEnchant {
|
||||
continue;
|
||||
|
||||
if(armorPiece.equals(victim.getInventory().getHelmet())) {
|
||||
ItemDurability.damageItem(victim, victim.getInventory().getHelmet(), level, 39);
|
||||
DurabilityUtils.damageItem(victim, victim.getInventory().getHelmet(), level, 39);
|
||||
}
|
||||
if(armorPiece.equals(victim.getInventory().getChestplate())) {
|
||||
ItemDurability.damageItem(victim, victim.getInventory().getChestplate(), level, 38);
|
||||
DurabilityUtils.damageItem(victim, victim.getInventory().getChestplate(), level, 38);
|
||||
}
|
||||
if(armorPiece.equals(victim.getInventory().getLeggings())) {
|
||||
ItemDurability.damageItem(victim, victim.getInventory().getLeggings(), level, 37);
|
||||
DurabilityUtils.damageItem(victim, victim.getInventory().getLeggings(), level, 37);
|
||||
}
|
||||
if(armorPiece.equals(victim.getInventory().getBoots())) {
|
||||
ItemDurability.damageItem(victim, victim.getInventory().getBoots(), level, 36);
|
||||
DurabilityUtils.damageItem(victim, victim.getInventory().getBoots(), level, 36);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
|
||||
import com.willfp.ecoenchants.util.ItemDurability;
|
||||
import com.willfp.ecoenchants.util.DurabilityUtils;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -36,16 +36,16 @@ public final class Corrosive extends EcoEnchant {
|
||||
|
||||
|
||||
if(armorPiece.equals(victim.getInventory().getHelmet())) {
|
||||
ItemDurability.damageItem(victim, victim.getInventory().getHelmet(), level, 39);
|
||||
DurabilityUtils.damageItem(victim, victim.getInventory().getHelmet(), level, 39);
|
||||
}
|
||||
if(armorPiece.equals(victim.getInventory().getChestplate())) {
|
||||
ItemDurability.damageItem(victim, victim.getInventory().getChestplate(), level, 38);
|
||||
DurabilityUtils.damageItem(victim, victim.getInventory().getChestplate(), level, 38);
|
||||
}
|
||||
if(armorPiece.equals(victim.getInventory().getLeggings())) {
|
||||
ItemDurability.damageItem(victim, victim.getInventory().getLeggings(), level, 37);
|
||||
DurabilityUtils.damageItem(victim, victim.getInventory().getLeggings(), level, 37);
|
||||
}
|
||||
if(armorPiece.equals(victim.getInventory().getBoots())) {
|
||||
ItemDurability.damageItem(victim, victim.getInventory().getBoots(), level, 36);
|
||||
DurabilityUtils.damageItem(victim, victim.getInventory().getBoots(), level, 36);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||
import com.willfp.ecoenchants.util.Lightning;
|
||||
import com.willfp.ecoenchants.util.LightningUtils;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
@ -24,6 +24,6 @@ public final class Electroshock extends EcoEnchant {
|
||||
if(!EnchantmentUtils.passedChance(this, level))
|
||||
return;
|
||||
|
||||
Lightning.strike(attacker, damage);
|
||||
LightningUtils.strike(attacker, damage);
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||
import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
|
||||
import com.willfp.ecoenchants.util.ItemDurability;
|
||||
import com.willfp.ecoenchants.util.DurabilityUtils;
|
||||
import com.willfp.ecoenchants.util.VectorShapes;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -61,7 +61,7 @@ public final class Farmhand extends EcoEnchant {
|
||||
|
||||
if (!this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "per-block-damage")) {
|
||||
|
||||
ItemDurability.damageItem(player, player.getInventory().getItemInMainHand(), 1, player.getInventory().getHeldItemSlot());
|
||||
DurabilityUtils.damageItem(player, player.getInventory().getItemInMainHand(), 1, player.getInventory().getHeldItemSlot());
|
||||
}
|
||||
|
||||
for (Vector vec : vecs) {
|
||||
@ -79,7 +79,7 @@ public final class Farmhand extends EcoEnchant {
|
||||
block.setType(Material.FARMLAND);
|
||||
if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "per-block-damage")) {
|
||||
|
||||
ItemDurability.damageItem(player, player.getInventory().getItemInMainHand(), 1, player.getInventory().getHeldItemSlot());
|
||||
DurabilityUtils.damageItem(player, player.getInventory().getItemInMainHand(), 1, player.getInventory().getHeldItemSlot());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||
import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
|
||||
import com.willfp.ecoenchants.util.ItemDurability;
|
||||
import com.willfp.ecoenchants.util.DurabilityUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -39,7 +39,7 @@ public final class GreenThumb extends EcoEnchant {
|
||||
if(!AntigriefManager.canPlaceBlock(player, event.getClickedBlock())) return;
|
||||
|
||||
if(this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "damage"))
|
||||
ItemDurability.damageItem(player, player.getInventory().getItemInMainHand(), 1, player.getInventory().getHeldItemSlot());
|
||||
DurabilityUtils.damageItem(player, player.getInventory().getItemInMainHand(), 1, player.getInventory().getHeldItemSlot());
|
||||
|
||||
event.getClickedBlock().setType(Material.GRASS_BLOCK);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||
import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
|
||||
import com.willfp.ecoenchants.util.ItemDurability;
|
||||
import com.willfp.ecoenchants.util.DurabilityUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
@ -42,7 +42,7 @@ public final class Grit extends EcoEnchant {
|
||||
|
||||
int damage = (int) Math.ceil(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level") * totalGritPoints);
|
||||
|
||||
ItemDurability.damageItem(player, player.getInventory().getItemInMainHand(), 1, player.getInventory().getHeldItemSlot());
|
||||
DurabilityUtils.damageItem(player, player.getInventory().getItemInMainHand(), 1, player.getInventory().getHeldItemSlot());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||
import com.willfp.ecoenchants.util.ItemDurability;
|
||||
import com.willfp.ecoenchants.util.DurabilityUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -56,7 +56,7 @@ public final class Slicing extends EcoEnchant {
|
||||
}
|
||||
}, this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "cooldown"));
|
||||
if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "damage-elytra")) {
|
||||
ItemDurability.damageItem(player, player.getInventory().getChestplate(), 1, 38);
|
||||
DurabilityUtils.damageItem(player, player.getInventory().getChestplate(), 1, 38);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||
import com.willfp.ecoenchants.util.ItemDurability;
|
||||
import com.willfp.ecoenchants.util.DurabilityUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.AbstractArrow;
|
||||
@ -37,7 +37,7 @@ public final class Succession extends EcoEnchant {
|
||||
|
||||
if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "per-arrow-damage")) {
|
||||
if(shooter instanceof Player) {
|
||||
ItemDurability.damageItem((Player) shooter, ((Player) shooter).getInventory().getItemInMainHand(), 1, ((Player) shooter).getInventory().getHeldItemSlot());
|
||||
DurabilityUtils.damageItem((Player) shooter, ((Player) shooter).getInventory().getItemInMainHand(), 1, ((Player) shooter).getInventory().getHeldItemSlot());
|
||||
}
|
||||
}
|
||||
}, i * 2);
|
||||
|
@ -5,7 +5,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||
import com.willfp.ecoenchants.nms.Cooldown;
|
||||
import com.willfp.ecoenchants.util.Lightning;
|
||||
import com.willfp.ecoenchants.util.LightningUtils;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
@ -31,6 +31,6 @@ public final class Thor extends EcoEnchant {
|
||||
|
||||
double damage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "lightning-damage");
|
||||
|
||||
Lightning.strike(victim, damage);
|
||||
LightningUtils.strike(victim, damage);
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||
import com.willfp.ecoenchants.util.Lightning;
|
||||
import com.willfp.ecoenchants.util.LightningUtils;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
@ -25,6 +25,6 @@ public final class Zeus extends EcoEnchant {
|
||||
|
||||
double damage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "lightning-damage");
|
||||
|
||||
Lightning.strike(victim, damage);
|
||||
LightningUtils.strike(victim, damage);
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||
import com.willfp.ecoenchants.nms.Cooldown;
|
||||
import com.willfp.ecoenchants.util.Lightning;
|
||||
import com.willfp.ecoenchants.util.LightningUtils;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
@ -30,6 +30,6 @@ public final class Bolt extends EcoEnchant {
|
||||
|
||||
double damage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "lightning-damage");
|
||||
|
||||
Lightning.strike(victim, damage);
|
||||
LightningUtils.strike(victim, damage);
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||
import com.willfp.ecoenchants.util.ItemDurability;
|
||||
import com.willfp.ecoenchants.util.DurabilityUtils;
|
||||
import com.willfp.ecoenchants.util.interfaces.EcoRunnable;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.Repairable;
|
||||
@ -38,7 +38,7 @@ public final class Repairing extends EcoEnchant implements EcoRunnable {
|
||||
int multiplier = EcoEnchants.REPAIRING.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "multiplier");
|
||||
int repairAmount = level * multiplier;
|
||||
|
||||
ItemDurability.repairItem(item, repairAmount);
|
||||
DurabilityUtils.repairItem(item, repairAmount);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.willfp.ecoenchants.enchantments.util;
|
||||
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.util.ItemDurability;
|
||||
import com.willfp.ecoenchants.util.DurabilityUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Arrow;
|
||||
@ -165,16 +165,16 @@ public final class EnchantChecks {
|
||||
if(damage > 0 && isPlayer) {
|
||||
Player player = (Player) entity;
|
||||
if(itemStack.equals(entity.getEquipment().getHelmet())) {
|
||||
ItemDurability.damageItem(player, player.getInventory().getHelmet(), level, 39);
|
||||
DurabilityUtils.damageItem(player, player.getInventory().getHelmet(), level, 39);
|
||||
}
|
||||
if(itemStack.equals(entity.getEquipment().getChestplate())) {
|
||||
ItemDurability.damageItem(player, player.getInventory().getChestplate(), level, 38);
|
||||
DurabilityUtils.damageItem(player, player.getInventory().getChestplate(), level, 38);
|
||||
}
|
||||
if(itemStack.equals(entity.getEquipment().getLeggings())) {
|
||||
ItemDurability.damageItem(player, player.getInventory().getLeggings(), level, 37);
|
||||
DurabilityUtils.damageItem(player, player.getInventory().getLeggings(), level, 37);
|
||||
}
|
||||
if(itemStack.equals(entity.getEquipment().getBoots())) {
|
||||
ItemDurability.damageItem(player, player.getInventory().getBoots(), level, 36);
|
||||
DurabilityUtils.damageItem(player, player.getInventory().getBoots(), level, 36);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
/**
|
||||
* Contains methods for damaging/repairing items
|
||||
*/
|
||||
public class ItemDurability {
|
||||
public class DurabilityUtils {
|
||||
/**
|
||||
* Damage an item in a player's inventory
|
||||
* The slot of a held item can be obtained with {@link PlayerInventory#getHeldItemSlot()}
|
@ -6,7 +6,7 @@ import org.bukkit.entity.LivingEntity;
|
||||
/**
|
||||
* Class containing methods for striking lightning
|
||||
*/
|
||||
public class Lightning {
|
||||
public class LightningUtils {
|
||||
|
||||
/**
|
||||
* Strike lightning on player without fire
|
Loading…
Reference in New Issue
Block a user