mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-01-24 00:41:23 +01:00
Abstracted ProxyFactory creation into ProxyUtils
This commit is contained in:
parent
11561529f6
commit
012f952c99
@ -1,6 +1,5 @@
|
||||
package com.willfp.ecoenchants.alchemy;
|
||||
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.willfp.ecoenchants.biomes;
|
||||
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import com.willfp.ecoenchants.biomes.enchants.defensive.*;
|
||||
import com.willfp.ecoenchants.biomes.enchants.offensive.*;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.willfp.ecoenchants.effects;
|
||||
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||
import com.willfp.ecoenchants.events.armorequip.ArmorEquipEvent;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.willfp.ecoenchants.effects;
|
||||
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import com.willfp.ecoenchants.effects.enchants.*;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.extensions.Extension;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.willfp.ecoenchants.endershot;
|
||||
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.extensions.Extension;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.willfp.ecoenchants.firewand;
|
||||
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.itemtypes.Spell;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.willfp.ecoenchants.firewand;
|
||||
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.extensions.Extension;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -1,17 +1,16 @@
|
||||
package com.willfp.ecoenchants.mmo;
|
||||
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.extensions.Extension;
|
||||
import com.willfp.ecoenchants.mmo.enchants.misc.Strengthening;
|
||||
import com.willfp.ecoenchants.mmo.enchants.stamina.Athletic;
|
||||
import com.willfp.ecoenchants.mmo.enchants.mana.Augment;
|
||||
import com.willfp.ecoenchants.mmo.enchants.abilities.Discounted;
|
||||
import com.willfp.ecoenchants.mmo.enchants.abilities.Recover;
|
||||
import com.willfp.ecoenchants.mmo.enchants.mana.Augment;
|
||||
import com.willfp.ecoenchants.mmo.enchants.mana.Drain;
|
||||
import com.willfp.ecoenchants.mmo.enchants.mana.Elixir;
|
||||
import com.willfp.ecoenchants.mmo.enchants.mana.Siphon;
|
||||
import com.willfp.ecoenchants.mmo.enchants.mana.Spirituality;
|
||||
import com.willfp.ecoenchants.mmo.enchants.misc.Strengthening;
|
||||
import com.willfp.ecoenchants.mmo.enchants.stamina.Athletic;
|
||||
import com.willfp.ecoenchants.mmo.enchants.stamina.Endurance;
|
||||
import com.willfp.ecoenchants.mmo.enchants.stamina.Fortitude;
|
||||
import com.willfp.ecoenchants.mmo.enchants.stamina.Motivate;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.willfp.ecoenchants.precision;
|
||||
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.willfp.ecoenchants.precision;
|
||||
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.extensions.Extension;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.willfp.ecoenchants.sprintartifacts;
|
||||
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import com.willfp.ecoenchants.extensions.Extension;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.willfp.ecoenchants.summoning;
|
||||
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.willfp.ecoenchants.summoning;
|
||||
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.extensions.Extension;
|
||||
import com.willfp.ecoenchants.summoning.enchants.*;
|
||||
|
@ -4,10 +4,10 @@ import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.ListenerPriority;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.ChatComponentProxy;
|
||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.eco.util.packets.AbstractPacketAdapter;
|
||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||
|
||||
public class PacketChat extends AbstractPacketAdapter {
|
||||
public PacketChat(AbstractEcoPlugin plugin) {
|
||||
@ -22,7 +22,7 @@ public class PacketChat extends AbstractPacketAdapter {
|
||||
continue;
|
||||
if (component.getHandle() == null)
|
||||
return;
|
||||
WrappedChatComponent newComponent = WrappedChatComponent.fromHandle(new ProxyFactory<>(ChatComponentProxy.class).getProxy().modifyComponent(component.getHandle()));
|
||||
WrappedChatComponent newComponent = WrappedChatComponent.fromHandle(ProxyUtils.getProxy(ChatComponentProxy.class).modifyComponent(component.getHandle()));
|
||||
packet.getChatComponents().write(i, newComponent);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
||||
import com.willfp.eco.util.DurabilityUtils;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
@ -29,7 +29,7 @@ public class Abrasion extends EcoEnchant {
|
||||
Player victim = (Player) uncastVictim;
|
||||
|
||||
boolean notcharged = this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged");
|
||||
if (attacker instanceof Player && new ProxyFactory<>(CooldownProxy.class).getProxy().getAttackCooldown((Player) attacker) != 1.0f && !notcharged)
|
||||
if (attacker instanceof Player && ProxyUtils.getProxy(CooldownProxy.class).getAttackCooldown((Player) attacker) != 1.0f && !notcharged)
|
||||
return;
|
||||
|
||||
ArrayList<ItemStack> armor = new ArrayList<>(Arrays.asList(victim.getInventory().getArmorContents()));
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.BlockBreakProxy;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
@ -65,7 +65,7 @@ public class BlastMining extends EcoEnchant {
|
||||
|
||||
toBreak.forEach((block1 -> {
|
||||
block1.setMetadata("block-ignore", new FixedMetadataValue(this.plugin, true));
|
||||
new ProxyFactory<>(BlockBreakProxy.class).getProxy().breakBlock(player, block1);
|
||||
ProxyUtils.getProxy(BlockBreakProxy.class).breakBlock(player, block1);
|
||||
block1.removeMetadata("block-ignore", this.plugin);
|
||||
}));
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
@ -25,7 +25,7 @@ public class Bleed extends EcoEnchant {
|
||||
|
||||
@Override
|
||||
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
|
||||
if (attacker instanceof Player && new ProxyFactory<>(CooldownProxy.class).getProxy().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;
|
||||
|
||||
if (!EnchantmentUtils.passedChance(this, level))
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
@ -26,7 +26,7 @@ public class Cleave extends EcoEnchant {
|
||||
return;
|
||||
|
||||
if (attacker instanceof Player) {
|
||||
if (new ProxyFactory<>(CooldownProxy.class).getProxy().getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
if (ProxyUtils.getProxy(CooldownProxy.class).getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
@ -25,7 +25,7 @@ public class Disable extends EcoEnchant {
|
||||
@Override
|
||||
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
|
||||
if(attacker instanceof Player) {
|
||||
if (new ProxyFactory<>(CooldownProxy.class).getProxy().getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
if (ProxyUtils.getProxy(CooldownProxy.class).getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.BlockBreakProxy;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.eco.util.VectorUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
@ -48,7 +48,7 @@ public class Drill extends EcoEnchant {
|
||||
|
||||
if (!AntigriefManager.canBreakBlock(player, block1)) continue;
|
||||
|
||||
new ProxyFactory<>(BlockBreakProxy.class).getProxy().breakBlock(player, block1);
|
||||
ProxyUtils.getProxy(BlockBreakProxy.class).breakBlock(player, block1);
|
||||
block1.removeMetadata("block-ignore", this.plugin);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
@ -24,7 +24,7 @@ public class Dullness extends EcoEnchant {
|
||||
@Override
|
||||
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
|
||||
if(attacker instanceof Player) {
|
||||
if (new ProxyFactory<>(CooldownProxy.class).getProxy().getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
if (ProxyUtils.getProxy(CooldownProxy.class).getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
@ -25,7 +25,7 @@ public class Famine extends EcoEnchant {
|
||||
@Override
|
||||
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
|
||||
if (attacker instanceof Player) {
|
||||
if (new ProxyFactory<>(CooldownProxy.class).getProxy().getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
if (ProxyUtils.getProxy(CooldownProxy.class).getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.eco.util.VectorUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
@ -27,7 +27,7 @@ public class Fury extends EcoEnchant {
|
||||
@Override
|
||||
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
|
||||
if (attacker instanceof Player) {
|
||||
if (new ProxyFactory<>(CooldownProxy.class).getProxy().getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
if (ProxyUtils.getProxy(CooldownProxy.class).getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
@ -25,7 +25,7 @@ public class IllusionAspect extends EcoEnchant {
|
||||
@Override
|
||||
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
|
||||
if(attacker instanceof Player) {
|
||||
if (new ProxyFactory<>(CooldownProxy.class).getProxy().getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
if (ProxyUtils.getProxy(CooldownProxy.class).getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.BlockBreakProxy;
|
||||
import com.willfp.eco.util.BlockUtils;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
@ -53,7 +53,7 @@ public class Lumberjack extends EcoEnchant {
|
||||
treeBlock.setMetadata("block-ignore", new FixedMetadataValue(this.plugin, true));
|
||||
if(!AntigriefManager.canBreakBlock(player, treeBlock)) continue;
|
||||
|
||||
new ProxyFactory<>(BlockBreakProxy.class).getProxy().breakBlock(player, treeBlock);
|
||||
ProxyUtils.getProxy(BlockBreakProxy.class).breakBlock(player, treeBlock);
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(this.plugin, () -> treeBlock.removeMetadata("block-ignore", this.plugin),1);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.TridentStackProxy;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.eco.util.bukkit.scheduling.EcoBukkitRunnable;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
@ -36,7 +36,7 @@ public class Shockwave extends EcoEnchant {
|
||||
AbstractArrow entity = (AbstractArrow) event.getEntity();
|
||||
ItemStack item = player.getInventory().getItemInMainHand();
|
||||
if(entity instanceof Trident) {
|
||||
item = new ProxyFactory<>(TridentStackProxy.class).getProxy().getTridentStack((Trident) entity);
|
||||
item = ProxyUtils.getProxy(TridentStackProxy.class).getTridentStack((Trident) entity);
|
||||
}
|
||||
|
||||
if (!EnchantChecks.item(item, this)) return;
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.TridentStackProxy;
|
||||
import com.willfp.eco.util.NumberUtils;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.eco.util.drops.DropQueue;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
@ -48,7 +48,7 @@ public class Spearfishing extends EcoEnchant {
|
||||
Player player = (Player) event.getEntity().getShooter();
|
||||
if(this.getDisabledWorlds().contains(player.getWorld())) return;
|
||||
|
||||
ItemStack item = new ProxyFactory<>(TridentStackProxy.class).getProxy().getTridentStack(trident);
|
||||
ItemStack item = ProxyUtils.getProxy(TridentStackProxy.class).getTridentStack(trident);
|
||||
|
||||
if (!EnchantChecks.item(item, this)) return;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.TridentStackProxy;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
@ -42,7 +42,7 @@ public class Splash extends EcoEnchant {
|
||||
Trident trident = (Trident) event.getEntity();
|
||||
Player player = (Player) event.getEntity().getShooter();
|
||||
|
||||
ItemStack item = new ProxyFactory<>(TridentStackProxy.class).getProxy().getTridentStack(trident);
|
||||
ItemStack item = ProxyUtils.getProxy(TridentStackProxy.class).getTridentStack(trident);
|
||||
|
||||
if (!EnchantChecks.item(item, this)) return;
|
||||
if(this.getDisabledWorlds().contains(player.getWorld())) return;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
@ -25,7 +25,7 @@ public class StrayAspect extends EcoEnchant {
|
||||
@Override
|
||||
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
|
||||
if(attacker instanceof Player) {
|
||||
if (new ProxyFactory<>(CooldownProxy.class).getProxy().getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
if (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))
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
@ -23,7 +23,7 @@ public class Supercritical extends EcoEnchant {
|
||||
@Override
|
||||
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
|
||||
if(attacker instanceof Player) {
|
||||
if (new ProxyFactory<>(CooldownProxy.class).getProxy().getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
if (ProxyUtils.getProxy(CooldownProxy.class).getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.TridentStackProxy;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.eco.util.config.Configs;
|
||||
import com.willfp.eco.util.drops.DropQueue;
|
||||
import com.willfp.eco.util.events.entitydeathbyentity.EntityDeathByEntityEvent;
|
||||
@ -119,7 +119,7 @@ public class Telekinesis extends EcoEnchant {
|
||||
} else if(event.getKiller() instanceof Trident) {
|
||||
if(((Trident) event.getKiller()).getShooter() instanceof Player) {
|
||||
player = (Player) ((Trident) event.getKiller()).getShooter();
|
||||
item = new ProxyFactory<>(TridentStackProxy.class).getProxy().getTridentStack((Trident) event.getKiller());
|
||||
item = ProxyUtils.getProxy(TridentStackProxy.class).getTridentStack((Trident) event.getKiller());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
||||
import com.willfp.eco.util.LightningUtils;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
@ -24,7 +24,7 @@ public class Thor extends EcoEnchant {
|
||||
@Override
|
||||
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
|
||||
if (attacker instanceof Player) {
|
||||
if (new ProxyFactory<>(CooldownProxy.class).getProxy().getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
if (ProxyUtils.getProxy(CooldownProxy.class).getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
@ -25,7 +25,7 @@ public class Toxic extends EcoEnchant {
|
||||
@Override
|
||||
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
|
||||
if (attacker instanceof Player) {
|
||||
if (new ProxyFactory<>(CooldownProxy.class).getProxy().getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
if (ProxyUtils.getProxy(CooldownProxy.class).getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
@ -25,7 +25,7 @@ public class VampireAspect extends EcoEnchant {
|
||||
@Override
|
||||
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
|
||||
if(attacker instanceof Player) {
|
||||
if (new ProxyFactory<>(CooldownProxy.class).getProxy().getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
if (ProxyUtils.getProxy(CooldownProxy.class).getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.BlockBreakProxy;
|
||||
import com.willfp.eco.util.BlockUtils;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
@ -53,7 +53,7 @@ public class Vein extends EcoEnchant {
|
||||
veinBlock.setMetadata("block-ignore", new FixedMetadataValue(this.plugin, true));
|
||||
if (!AntigriefManager.canBreakBlock(player, veinBlock)) continue;
|
||||
|
||||
new ProxyFactory<>(BlockBreakProxy.class).getProxy().breakBlock(player, veinBlock);
|
||||
ProxyUtils.getProxy(BlockBreakProxy.class).breakBlock(player, veinBlock);
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(this.plugin, () -> veinBlock.removeMetadata("block-ignore", this.plugin), 1);
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.special;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
||||
import com.willfp.eco.util.LightningUtils;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
@ -24,7 +24,7 @@ public class Bolt extends EcoEnchant {
|
||||
@Override
|
||||
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
|
||||
if(attacker instanceof Player) {
|
||||
if (new ProxyFactory<>(CooldownProxy.class).getProxy().getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
if (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))
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.special;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
@ -32,7 +32,7 @@ public class Carve extends EcoEnchant {
|
||||
final double radius = radiusPerLevel * level;
|
||||
|
||||
if(attacker instanceof Player) {
|
||||
if (new ProxyFactory<>(CooldownProxy.class).getProxy().getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
if (ProxyUtils.getProxy(CooldownProxy.class).getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.special;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
@ -30,7 +30,7 @@ public class Confusion extends EcoEnchant {
|
||||
Player victim = (Player) uncastVictim;
|
||||
|
||||
if(attacker instanceof Player) {
|
||||
if (new ProxyFactory<>(CooldownProxy.class).getProxy().getAttackCooldown((Player) attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
if (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))
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.special;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
@ -26,7 +26,7 @@ public class Razor extends EcoEnchant {
|
||||
double extra = level*perLevelMultiplier + baseDamage;
|
||||
if(this.getConfig().getBool((EcoEnchants.CONFIG_LOCATION) + "decrease-if-cooldown")) {
|
||||
if(attacker instanceof Player) {
|
||||
extra *= new ProxyFactory<>(CooldownProxy.class).getProxy().getAttackCooldown((Player) attacker);
|
||||
extra *= ProxyUtils.getProxy(CooldownProxy.class).getAttackCooldown((Player) attacker);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.special;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||
@ -28,7 +28,7 @@ public class Volatile extends EcoEnchant {
|
||||
|
||||
Player attacker = (Player) uncastAttacker;
|
||||
|
||||
if (new ProxyFactory<>(CooldownProxy.class).getProxy().getAttackCooldown(attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
if (ProxyUtils.getProxy(CooldownProxy.class).getAttackCooldown(attacker) != 1.0f && !this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"))
|
||||
return;
|
||||
if(!EnchantmentUtils.passedChance(this, level))
|
||||
return;
|
||||
|
@ -1,8 +1,7 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.spell;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.BlockBreakProxy;
|
||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.itemtypes.Spell;
|
||||
import com.willfp.ecoenchants.integrations.anticheat.AnticheatManager;
|
||||
@ -68,7 +67,7 @@ public class Dynamite extends Spell {
|
||||
|
||||
toBreak.forEach((block1 -> {
|
||||
block1.setMetadata("block-ignore", new FixedMetadataValue(this.plugin, true));
|
||||
new ProxyFactory<>(BlockBreakProxy.class).getProxy().breakBlock(player, block1);
|
||||
ProxyUtils.getProxy(BlockBreakProxy.class).breakBlock(player, block1);
|
||||
block1.removeMetadata("block-ignore", this.plugin);
|
||||
}));
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.willfp.ecoenchants.enchantments.itemtypes;
|
||||
|
||||
import com.google.common.util.concurrent.AtomicDouble;
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.TridentStackProxy;
|
||||
import com.willfp.eco.util.NumberUtils;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.eco.util.optional.Prerequisite;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
@ -134,7 +134,7 @@ public abstract class Artifact extends EcoEnchant {
|
||||
AbstractArrow entity = (AbstractArrow) event.getEntity();
|
||||
ItemStack item = player.getInventory().getItemInMainHand();
|
||||
if (entity instanceof Trident) {
|
||||
item = new ProxyFactory<>(TridentStackProxy.class).getProxy().getTridentStack((Trident) entity);
|
||||
item = ProxyUtils.getProxy(TridentStackProxy.class).getTridentStack((Trident) entity);
|
||||
}
|
||||
|
||||
if (!EnchantChecks.item(item, this)) return;
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.willfp.ecoenchants.enchantments.support.merging.anvil;
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyConstants;
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.OpenInventoryProxy;
|
||||
import com.willfp.eco.core.proxy.proxies.RepairCostProxy;
|
||||
import com.willfp.eco.util.NumberUtils;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.eco.util.config.Configs;
|
||||
import com.willfp.eco.util.injection.PluginDependent;
|
||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||
@ -43,7 +43,7 @@ public class AnvilListeners extends PluginDependent implements Listener {
|
||||
if (event.getViewers().isEmpty()) return; // Prevent ArrayIndexOutOfBoundsException when using AnvilGUI
|
||||
|
||||
Player player = (Player) event.getViewers().get(0);
|
||||
if (new ProxyFactory<>(OpenInventoryProxy.class).getProxy().getOpenInventory(player).getClass().toString().equals(ANVIL_GUI_CLASS))
|
||||
if (ProxyUtils.getProxy(OpenInventoryProxy.class).getOpenInventory(player).getClass().toString().equals(ANVIL_GUI_CLASS))
|
||||
return;
|
||||
|
||||
Pair<ItemStack, Integer> newOut = AnvilMerge.doMerge(left, right, out, name, player);
|
||||
@ -84,12 +84,12 @@ public class AnvilListeners extends PluginDependent implements Listener {
|
||||
if (!Objects.requireNonNull(event.getInventory().getItem(0)).getType().equals(item.getType())) return;
|
||||
|
||||
if (Configs.CONFIG.getBool("anvil.rework-cost")) {
|
||||
int repairCost = new ProxyFactory<>(RepairCostProxy.class).getProxy().getRepairCost(item);
|
||||
int repairCost = ProxyUtils.getProxy(RepairCostProxy.class).getRepairCost(item);
|
||||
int reworkCount = NumberUtils.log2(repairCost + 1);
|
||||
if (repairCost == 0) reworkCount = 0;
|
||||
reworkCount++;
|
||||
repairCost = (int) Math.pow(2, reworkCount) - 1;
|
||||
item = new ProxyFactory<>(RepairCostProxy.class).getProxy().setRepairCost(item, repairCost);
|
||||
item = ProxyUtils.getProxy(RepairCostProxy.class).setRepairCost(item, repairCost);
|
||||
}
|
||||
|
||||
int cost;
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.willfp.ecoenchants.enchantments.util;
|
||||
|
||||
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.FastGetEnchantsProxy;
|
||||
import com.willfp.eco.util.DurabilityUtils;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import org.bukkit.Material;
|
||||
@ -25,7 +25,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class EnchantChecks {
|
||||
private static final FastGetEnchantsProxy PROXY = new ProxyFactory<>(FastGetEnchantsProxy.class).getProxy();
|
||||
private static final FastGetEnchantsProxy PROXY = ProxyUtils.getProxy(FastGetEnchantsProxy.class);
|
||||
|
||||
/**
|
||||
* Does the specified ItemStack have a certain Enchantment present?
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.willfp.ecoenchants.enchantments.util;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
import com.willfp.eco.core.proxy.proxies.TridentStackProxy;
|
||||
import com.willfp.eco.util.ProxyUtils;
|
||||
import com.willfp.eco.util.events.armorequip.ArmorEquipEvent;
|
||||
import com.willfp.eco.util.injection.PluginDependent;
|
||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||
@ -93,7 +93,7 @@ public class WatcherTriggers extends PluginDependent implements Listener {
|
||||
|
||||
LivingEntity attacker = (LivingEntity) ((Trident) event.getDamager()).getShooter();
|
||||
Trident trident = (Trident) event.getDamager();
|
||||
ItemStack item = new ProxyFactory<>(TridentStackProxy.class).getProxy().getTridentStack(trident);
|
||||
ItemStack item = ProxyUtils.getProxy(TridentStackProxy.class).getTridentStack(trident);
|
||||
|
||||
LivingEntity victim = (LivingEntity) event.getEntity();
|
||||
|
||||
@ -246,7 +246,7 @@ public class WatcherTriggers extends PluginDependent implements Listener {
|
||||
if (!(event.getEntity() instanceof Trident)) return;
|
||||
|
||||
Trident trident = (Trident) event.getEntity();
|
||||
ItemStack item = new ProxyFactory<>(TridentStackProxy.class).getProxy().getTridentStack(trident);
|
||||
ItemStack item = ProxyUtils.getProxy(TridentStackProxy.class).getTridentStack(trident);
|
||||
LivingEntity shooter = (LivingEntity) event.getEntity().getShooter();
|
||||
|
||||
EnchantChecks.getEnchantsOnItem(item).forEach(((enchant, level) -> {
|
||||
@ -341,7 +341,7 @@ public class WatcherTriggers extends PluginDependent implements Listener {
|
||||
|
||||
Trident trident = (Trident) event.getEntity();
|
||||
LivingEntity shooter = (LivingEntity) trident.getShooter();
|
||||
ItemStack item = new ProxyFactory<>(TridentStackProxy.class).getProxy().getTridentStack(trident);
|
||||
ItemStack item = ProxyUtils.getProxy(TridentStackProxy.class).getTridentStack(trident);
|
||||
|
||||
EnchantChecks.getEnchantsOnItem(item).forEach((enchant, level) -> {
|
||||
if (event.isCancelled()) return;
|
||||
|
@ -0,0 +1,10 @@
|
||||
package com.willfp.eco.util;
|
||||
|
||||
import com.willfp.eco.core.proxy.AbstractProxy;
|
||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||
|
||||
public class ProxyUtils {
|
||||
public static <T extends AbstractProxy> T getProxy(Class<T> proxyClass) {
|
||||
return new ProxyFactory<>(proxyClass).getProxy();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user