mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-12-26 20:27:38 +01:00
Continued 6.0.0 rework
This commit is contained in:
parent
1f4b54daca
commit
11561529f6
@ -16,7 +16,7 @@ public class Alchemy extends EcoEnchant {
|
|||||||
super("alchemy", EnchantmentType.NORMAL);
|
super("alchemy", EnchantmentType.NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final FixedMetadataValue TRUE = new FixedMetadataValue(EcoEnchantsPlugin.getInstance(), true);
|
private static final FixedMetadataValue TRUE = new FixedMetadataValue(this.plugin, true);
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPotionEffect(EntityPotionEffectEvent event) {
|
public void onPotionEffect(EntityPotionEffectEvent event) {
|
||||||
@ -50,8 +50,8 @@ public class Alchemy extends EcoEnchant {
|
|||||||
|
|
||||||
entity.removePotionEffect(effect.getType());
|
entity.removePotionEffect(effect.getType());
|
||||||
|
|
||||||
Bukkit.getScheduler().runTask(EcoEnchantsPlugin.getInstance(), () -> newEffect.apply(entity));
|
Bukkit.getScheduler().runTask(this.plugin, () -> newEffect.apply(entity));
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> entity.removeMetadata(newEffect.toString(), EcoEnchantsPlugin.getInstance()), 1);
|
Bukkit.getScheduler().runTaskLater(this.plugin, () -> entity.removeMetadata(newEffect.toString(), this.plugin), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,16 +21,16 @@ public class BiomesMain extends Extension {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
Bukkit.getPluginManager().registerEvents(ELEVATION, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(ELEVATION, this.plugin);
|
||||||
Bukkit.getPluginManager().registerEvents(GLACIAL, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(GLACIAL, this.plugin);
|
||||||
Bukkit.getPluginManager().registerEvents(HEAT_TREATED, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(HEAT_TREATED, this.plugin);
|
||||||
Bukkit.getPluginManager().registerEvents(OCEANIC, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(OCEANIC, this.plugin);
|
||||||
Bukkit.getPluginManager().registerEvents(TROPICAL, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(TROPICAL, this.plugin);
|
||||||
Bukkit.getPluginManager().registerEvents(ALTITUDE, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(ALTITUDE, this.plugin);
|
||||||
Bukkit.getPluginManager().registerEvents(AQUAMARINE, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(AQUAMARINE, this.plugin);
|
||||||
Bukkit.getPluginManager().registerEvents(DEHYDRATION, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(DEHYDRATION, this.plugin);
|
||||||
Bukkit.getPluginManager().registerEvents(ICELORD, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(ICELORD, this.plugin);
|
||||||
Bukkit.getPluginManager().registerEvents(RAINFOREST, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(RAINFOREST, this.plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,7 +22,7 @@ public abstract class EffectsEnchantment extends EcoEnchant {
|
|||||||
public void onEquip(ArmorEquipEvent event) {
|
public void onEquip(ArmorEquipEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskLater(this.plugin, () -> {
|
||||||
if (player.hasPotionEffect(this.getPotionEffect())) {
|
if (player.hasPotionEffect(this.getPotionEffect())) {
|
||||||
if (player.getPotionEffect(this.getPotionEffect()).getDuration() >= 1639) {
|
if (player.getPotionEffect(this.getPotionEffect()).getDuration() >= 1639) {
|
||||||
player.removePotionEffect(this.getPotionEffect());
|
player.removePotionEffect(this.getPotionEffect());
|
||||||
|
@ -15,11 +15,11 @@ public class EffectsMain extends Extension {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
Bukkit.getPluginManager().registerEvents(JUMP_BOOST, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(JUMP_BOOST, this.plugin);
|
||||||
Bukkit.getPluginManager().registerEvents(NIGHT_VISION, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(NIGHT_VISION, this.plugin);
|
||||||
Bukkit.getPluginManager().registerEvents(REGENERATION, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(REGENERATION, this.plugin);
|
||||||
Bukkit.getPluginManager().registerEvents(SPEED, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(SPEED, this.plugin);
|
||||||
Bukkit.getPluginManager().registerEvents(WATER_BREATHING, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(WATER_BREATHING, this.plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -10,7 +10,7 @@ public class EndershotMain extends Extension {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
Bukkit.getPluginManager().registerEvents(ENDERSHOT, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(ENDERSHOT, this.plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -21,9 +21,9 @@ public class Firewand extends Spell {
|
|||||||
public void onUse(Player player, int level, PlayerInteractEvent event) {
|
public void onUse(Player player, int level, PlayerInteractEvent event) {
|
||||||
SmallFireball fireball = player.launchProjectile(SmallFireball.class, player.getEyeLocation().getDirection().multiply(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity")));
|
SmallFireball fireball = player.launchProjectile(SmallFireball.class, player.getEyeLocation().getDirection().multiply(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity")));
|
||||||
fireball.setIsIncendiary(this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "fire"));
|
fireball.setIsIncendiary(this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "fire"));
|
||||||
fireball.setMetadata("eco-damage", new FixedMetadataValue(EcoEnchantsPlugin.getInstance(), this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level") * level));
|
fireball.setMetadata("eco-damage", new FixedMetadataValue(this.plugin, this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level") * level));
|
||||||
if(this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "no-explode")) {
|
if(this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "no-explode")) {
|
||||||
fireball.setMetadata("nobreak", new FixedMetadataValue(EcoEnchantsPlugin.getInstance(), true));
|
fireball.setMetadata("nobreak", new FixedMetadataValue(this.plugin, true));
|
||||||
}
|
}
|
||||||
fireball.setShooter(player);
|
fireball.setShooter(player);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ public class FirewandMain extends Extension {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
Bukkit.getPluginManager().registerEvents(FIREWAND, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(FIREWAND, this.plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,7 +42,7 @@ public class MMOMain extends Extension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MMOEnchant.REGISTRY.forEach(mmoEnchant -> {
|
MMOEnchant.REGISTRY.forEach(mmoEnchant -> {
|
||||||
Bukkit.getPluginManager().registerEvents((EcoEnchant) mmoEnchant, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents((EcoEnchant) mmoEnchant, this.plugin);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,8 +93,8 @@ public class Precision extends EcoEnchant {
|
|||||||
checksPerformed.addAndGet(1);
|
checksPerformed.addAndGet(1);
|
||||||
if(checksPerformed.get() > checks) this.cancel();
|
if(checksPerformed.get() > checks) this.cancel();
|
||||||
if(trident.isDead() || trident.isInBlock() || trident.isOnGround()) this.cancel();
|
if(trident.isDead() || trident.isInBlock() || trident.isOnGround()) this.cancel();
|
||||||
Bukkit.getScheduler().runTask(EcoEnchantsPlugin.getInstance(), runnable);
|
Bukkit.getScheduler().runTask(this.plugin, runnable);
|
||||||
}
|
}
|
||||||
}.runTaskTimer(EcoEnchantsPlugin.getInstance(), 3, period);
|
}.runTaskTimer(this.plugin, 3, period);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ public class PrecisionMain extends Extension {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
Bukkit.getPluginManager().registerEvents(PRECISION, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(PRECISION, this.plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -7,7 +7,7 @@ import org.bukkit.Bukkit;
|
|||||||
public class SprintArtifactsMain extends Extension {
|
public class SprintArtifactsMain extends Extension {
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
Bukkit.getPluginManager().registerEvents(new SprintArtifactsListener(), EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(new SprintArtifactsListener(), this.plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -84,9 +84,9 @@ public abstract class SummoningEnchantment extends EcoEnchant {
|
|||||||
entity.setTarget(victim);
|
entity.setTarget(victim);
|
||||||
if(health > entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) health = entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
|
if(health > entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) health = entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
|
||||||
entity.setHealth(health);
|
entity.setHealth(health);
|
||||||
entity.setMetadata("eco-target", new FixedMetadataValue(EcoEnchantsPlugin.getInstance(), victim));
|
entity.setMetadata("eco-target", new FixedMetadataValue(this.plugin, victim));
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), entity::remove, ticksToLive);
|
Bukkit.getScheduler().runTaskLater(this.plugin, entity::remove, ticksToLive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,11 +15,11 @@ public class SummoningMain extends Extension {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
Bukkit.getPluginManager().registerEvents(FIRESTORM, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(FIRESTORM, this.plugin);
|
||||||
Bukkit.getPluginManager().registerEvents(METALLIC, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(METALLIC, this.plugin);
|
||||||
Bukkit.getPluginManager().registerEvents(MORTALITY, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(MORTALITY, this.plugin);
|
||||||
Bukkit.getPluginManager().registerEvents(GHOUL, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(GHOUL, this.plugin);
|
||||||
Bukkit.getPluginManager().registerEvents(CRAWLER, EcoEnchantsPlugin.getInstance());
|
Bukkit.getPluginManager().registerEvents(CRAWLER, this.plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,10 +2,31 @@ package com.willfp.ecoenchants;
|
|||||||
|
|
||||||
import com.willfp.eco.util.command.AbstractCommand;
|
import com.willfp.eco.util.command.AbstractCommand;
|
||||||
import com.willfp.eco.util.integrations.IntegrationLoader;
|
import com.willfp.eco.util.integrations.IntegrationLoader;
|
||||||
|
import com.willfp.eco.util.interfaces.EcoRunnable;
|
||||||
|
import com.willfp.eco.util.packets.AbstractPacketAdapter;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||||
import com.willfp.ecoenchants.command.commands.CommandEcodebug;
|
import com.willfp.ecoenchants.command.commands.CommandEcodebug;
|
||||||
import com.willfp.ecoenchants.command.commands.CommandEcoreload;
|
import com.willfp.ecoenchants.command.commands.CommandEcoreload;
|
||||||
import com.willfp.ecoenchants.command.commands.CommandEnchantinfo;
|
import com.willfp.ecoenchants.command.commands.CommandEnchantinfo;
|
||||||
|
import com.willfp.ecoenchants.command.tabcompleters.TabCompleterEnchantinfo;
|
||||||
|
import com.willfp.ecoenchants.config.EcoEnchantsConfigs;
|
||||||
|
import com.willfp.ecoenchants.display.EnchantDisplay;
|
||||||
|
import com.willfp.ecoenchants.display.EnchantmentCache;
|
||||||
|
import com.willfp.ecoenchants.display.packets.PacketChat;
|
||||||
|
import com.willfp.ecoenchants.display.packets.PacketOpenWindowMerchant;
|
||||||
|
import com.willfp.ecoenchants.display.packets.PacketSetCreativeSlot;
|
||||||
|
import com.willfp.ecoenchants.display.packets.PacketSetSlot;
|
||||||
|
import com.willfp.ecoenchants.display.packets.PacketWindowItems;
|
||||||
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
|
import com.willfp.ecoenchants.enchantments.support.merging.anvil.AnvilListeners;
|
||||||
|
import com.willfp.ecoenchants.enchantments.support.merging.grindstone.GrindstoneListeners;
|
||||||
|
import com.willfp.ecoenchants.enchantments.support.obtaining.EnchantingListeners;
|
||||||
|
import com.willfp.ecoenchants.enchantments.support.obtaining.LootPopulator;
|
||||||
|
import com.willfp.ecoenchants.enchantments.support.obtaining.VillagerListeners;
|
||||||
|
import com.willfp.ecoenchants.enchantments.util.WatcherTriggers;
|
||||||
import com.willfp.ecoenchants.integrations.anticheat.AnticheatManager;
|
import com.willfp.ecoenchants.integrations.anticheat.AnticheatManager;
|
||||||
import com.willfp.ecoenchants.integrations.anticheat.plugins.AnticheatAAC;
|
import com.willfp.ecoenchants.integrations.anticheat.plugins.AnticheatAAC;
|
||||||
import com.willfp.ecoenchants.integrations.anticheat.plugins.AnticheatMatrix;
|
import com.willfp.ecoenchants.integrations.anticheat.plugins.AnticheatMatrix;
|
||||||
@ -24,9 +45,15 @@ import com.willfp.ecoenchants.integrations.mcmmo.McmmoManager;
|
|||||||
import com.willfp.ecoenchants.integrations.mcmmo.plugins.McmmoIntegrationImpl;
|
import com.willfp.ecoenchants.integrations.mcmmo.plugins.McmmoIntegrationImpl;
|
||||||
import com.willfp.ecoenchants.integrations.worldguard.WorldguardManager;
|
import com.willfp.ecoenchants.integrations.worldguard.WorldguardManager;
|
||||||
import com.willfp.ecoenchants.integrations.worldguard.plugins.WorldguardIntegrationImpl;
|
import com.willfp.ecoenchants.integrations.worldguard.plugins.WorldguardIntegrationImpl;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.generator.BlockPopulator;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class EcoEnchantsPlugin extends AbstractEcoPlugin {
|
public class EcoEnchantsPlugin extends AbstractEcoPlugin {
|
||||||
public EcoEnchantsPlugin() {
|
public EcoEnchantsPlugin() {
|
||||||
@ -35,12 +62,45 @@ public class EcoEnchantsPlugin extends AbstractEcoPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enable() {
|
public void enable() {
|
||||||
|
this.getExtensionLoader().loadExtensions();
|
||||||
|
|
||||||
|
if(this.getExtensionLoader().getLoadedExtensions().isEmpty()) {
|
||||||
|
this.getLog().info("&cNo extensions found");
|
||||||
|
} else {
|
||||||
|
this.getLog().info("Extensions Loaded:");
|
||||||
|
EcoEnchantsPlugin.getInstance().getExtensionLoader().getLoadedExtensions().forEach((extension) -> {
|
||||||
|
this.getLog().info("- " + extension.getName() + " v" + extension.getVersion());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getLog().info("");
|
||||||
|
|
||||||
|
EcoEnchants.values().forEach(enchant -> {
|
||||||
|
if(enchant.isEnabled()) {
|
||||||
|
this.getEventManager().registerEvents(enchant);
|
||||||
|
if(enchant instanceof EcoRunnable) {
|
||||||
|
this.getScheduler().syncRepeating((EcoRunnable) enchant, 5, ((EcoRunnable) enchant).getTime());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.getLog().info(EcoEnchants.values().size() + " Enchantments Loaded:");
|
||||||
|
this.getLog().info(EcoEnchants.values().stream().map(ecoEnchant -> ecoEnchant.getType().getColor() + ecoEnchant.getName()).collect(Collectors.joining(", ")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disable() {
|
public void disable() {
|
||||||
|
Bukkit.getServer().getWorlds().forEach((world -> {
|
||||||
|
List<BlockPopulator> populators = new ArrayList<>(world.getPopulators());
|
||||||
|
populators.forEach((blockPopulator -> {
|
||||||
|
if (blockPopulator instanceof LootPopulator) {
|
||||||
|
world.getPopulators().remove(blockPopulator);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
this.getExtensionLoader().unloadExtensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -50,7 +110,30 @@ public class EcoEnchantsPlugin extends AbstractEcoPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reload() {
|
public void reload() {
|
||||||
|
EcoEnchantsConfigs.updateConfigs();
|
||||||
|
EnchantmentCache.update();
|
||||||
|
EnchantmentRarity.update();
|
||||||
|
EnchantmentTarget.update();
|
||||||
|
EcoEnchants.update();
|
||||||
|
EnchantDisplay.update();
|
||||||
|
TabCompleterEnchantinfo.reload();
|
||||||
|
EnchantmentType.update();
|
||||||
|
|
||||||
|
EcoEnchants.values().forEach((ecoEnchant -> {
|
||||||
|
HandlerList.unregisterAll(ecoEnchant);
|
||||||
|
|
||||||
|
this.getScheduler().runLater(() -> {
|
||||||
|
if(ecoEnchant.isEnabled()) this.getEventManager().registerEvents(ecoEnchant);
|
||||||
|
}, 1);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postLoad() {
|
||||||
|
Bukkit.getServer().getWorlds().forEach(world -> {
|
||||||
|
world.getPopulators().add(new LootPopulator());
|
||||||
|
});
|
||||||
|
EssentialsManager.registerEnchantments();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -64,7 +147,7 @@ public class EcoEnchantsPlugin extends AbstractEcoPlugin {
|
|||||||
new IntegrationLoader("GriefPrevention", () -> AntigriefManager.register(new AntigriefGriefPrevention())),
|
new IntegrationLoader("GriefPrevention", () -> AntigriefManager.register(new AntigriefGriefPrevention())),
|
||||||
new IntegrationLoader("FactionsUUID", () -> AntigriefManager.register(new AntigriefFactionsUUID())),
|
new IntegrationLoader("FactionsUUID", () -> AntigriefManager.register(new AntigriefFactionsUUID())),
|
||||||
new IntegrationLoader("Towny", () -> AntigriefManager.register(new AntigriefTowny())),
|
new IntegrationLoader("Towny", () -> AntigriefManager.register(new AntigriefTowny())),
|
||||||
new IntegrationLoader("Lands", () -> AntigriefManager.register(new AntigriefLands())),
|
new IntegrationLoader("Lands", () -> AntigriefManager.register(new AntigriefLands(this))),
|
||||||
new IntegrationLoader("Kingdoms", () -> AntigriefManager.register(new AntigriefKingdoms())),
|
new IntegrationLoader("Kingdoms", () -> AntigriefManager.register(new AntigriefKingdoms())),
|
||||||
|
|
||||||
// AntiCheat
|
// AntiCheat
|
||||||
@ -87,4 +170,26 @@ public class EcoEnchantsPlugin extends AbstractEcoPlugin {
|
|||||||
new CommandEnchantinfo(this)
|
new CommandEnchantinfo(this)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AbstractPacketAdapter> getPacketAdapters() {
|
||||||
|
return Arrays.asList(
|
||||||
|
new PacketChat(this),
|
||||||
|
new PacketOpenWindowMerchant(this),
|
||||||
|
new PacketSetCreativeSlot(this),
|
||||||
|
new PacketSetSlot(this),
|
||||||
|
new PacketWindowItems(this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Listener> getListeners() {
|
||||||
|
return Arrays.asList(
|
||||||
|
new EnchantingListeners(this),
|
||||||
|
new GrindstoneListeners(this),
|
||||||
|
new AnvilListeners(this),
|
||||||
|
new WatcherTriggers(this),
|
||||||
|
new VillagerListeners()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import com.willfp.eco.core.proxy.ProxyConstants;
|
|||||||
import com.willfp.eco.util.command.AbstractCommand;
|
import com.willfp.eco.util.command.AbstractCommand;
|
||||||
import com.willfp.eco.util.drops.internal.DropManager;
|
import com.willfp.eco.util.drops.internal.DropManager;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
|
||||||
import com.willfp.ecoenchants.display.EnchantmentCache;
|
import com.willfp.ecoenchants.display.EnchantmentCache;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
@ -42,13 +41,13 @@ public class CommandEcodebug extends AbstractCommand {
|
|||||||
this.plugin.getLog().info("");
|
this.plugin.getLog().info("");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.plugin.getLog().info("Running Version: " + EcoEnchantsPlugin.getInstance().getDescription().getVersion());
|
this.plugin.getLog().info("Running Version: " + this.plugin.getDescription().getVersion());
|
||||||
this.plugin.getLog().info("");
|
this.plugin.getLog().info("");
|
||||||
|
|
||||||
this.plugin.getLog().info("Loaded Extensions: " + EcoEnchantsPlugin.getInstance().getExtensionLoader().getLoadedExtensions().stream().map(extension -> extension.getName() + " v" + extension.getVersion()).collect(Collectors.joining()));
|
this.plugin.getLog().info("Loaded Extensions: " + this.plugin.getExtensionLoader().getLoadedExtensions().stream().map(extension -> extension.getName() + " v" + extension.getVersion()).collect(Collectors.joining()));
|
||||||
this.plugin.getLog().info("");
|
this.plugin.getLog().info("");
|
||||||
|
|
||||||
this.plugin.getLog().info("EcoEnchants.getAll(): " + EcoEnchants.getAll().toString());
|
this.plugin.getLog().info("EcoEnchants.getAll(): " + EcoEnchants.values().toString());
|
||||||
this.plugin.getLog().info("");
|
this.plugin.getLog().info("");
|
||||||
|
|
||||||
this.plugin.getLog().info("Enchantment.values(): " + Arrays.toString(Enchantment.values()));
|
this.plugin.getLog().info("Enchantment.values(): " + Arrays.toString(Enchantment.values()));
|
||||||
@ -69,7 +68,7 @@ public class CommandEcodebug extends AbstractCommand {
|
|||||||
|
|
||||||
|
|
||||||
List<Enchantment> extern = Arrays.stream(Enchantment.values()).collect(Collectors.toList());
|
List<Enchantment> extern = Arrays.stream(Enchantment.values()).collect(Collectors.toList());
|
||||||
extern.removeAll(EcoEnchants.getAll().stream().map(EcoEnchant::getEnchantment).collect(Collectors.toList()));
|
extern.removeAll(EcoEnchants.values().stream().map(EcoEnchant::getEnchantment).collect(Collectors.toList()));
|
||||||
this.plugin.getLog().info("External/Vanilla Enchantments: " + extern.toString());
|
this.plugin.getLog().info("External/Vanilla Enchantments: " + extern.toString());
|
||||||
this.plugin.getLog().info("");
|
this.plugin.getLog().info("");
|
||||||
|
|
||||||
@ -90,7 +89,7 @@ public class CommandEcodebug extends AbstractCommand {
|
|||||||
this.plugin.getLog().info("");
|
this.plugin.getLog().info("");
|
||||||
|
|
||||||
Set<EcoEnchant> withIssues = new HashSet<>();
|
Set<EcoEnchant> withIssues = new HashSet<>();
|
||||||
EcoEnchants.getAll().forEach(enchant -> {
|
EcoEnchants.values().forEach(enchant -> {
|
||||||
if (enchant.getRarity() == null) withIssues.add(enchant);
|
if (enchant.getRarity() == null) withIssues.add(enchant);
|
||||||
if (enchant.getRawTargets().isEmpty()) withIssues.add(enchant);
|
if (enchant.getRawTargets().isEmpty()) withIssues.add(enchant);
|
||||||
});
|
});
|
||||||
|
@ -16,7 +16,7 @@ import java.util.List;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class TabCompleterEnchantinfo extends AbstractTabCompleter {
|
public class TabCompleterEnchantinfo extends AbstractTabCompleter {
|
||||||
private static final List<String> enchantsNames = EcoEnchants.getAll().stream().filter(EcoEnchant::isEnabled).map(EcoEnchant::getName).collect(Collectors.toList());
|
private static final List<String> enchantsNames = EcoEnchants.values().stream().filter(EcoEnchant::isEnabled).map(EcoEnchant::getName).collect(Collectors.toList());
|
||||||
|
|
||||||
public TabCompleterEnchantinfo(AbstractEcoPlugin plugin) {
|
public TabCompleterEnchantinfo(AbstractEcoPlugin plugin) {
|
||||||
super(plugin, (AbstractCommand) Bukkit.getPluginCommand("enchantinfo").getExecutor());
|
super(plugin, (AbstractCommand) Bukkit.getPluginCommand("enchantinfo").getExecutor());
|
||||||
@ -24,7 +24,7 @@ public class TabCompleterEnchantinfo extends AbstractTabCompleter {
|
|||||||
|
|
||||||
public static void reload() {
|
public static void reload() {
|
||||||
enchantsNames.clear();
|
enchantsNames.clear();
|
||||||
enchantsNames.addAll(EcoEnchants.getAll().stream().filter(EcoEnchant::isEnabled).map(EcoEnchant::getName).collect(Collectors.toList()));
|
enchantsNames.addAll(EcoEnchants.values().stream().filter(EcoEnchant::isEnabled).map(EcoEnchant::getName).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -7,7 +7,7 @@ import com.willfp.ecoenchants.config.configs.Target;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class ConfigManager {
|
public class EcoEnchantsConfigs {
|
||||||
private static final Target TARGET = new Target();
|
private static final Target TARGET = new Target();
|
||||||
private static final Rarity RARITY = new Rarity();
|
private static final Rarity RARITY = new Rarity();
|
||||||
private static final Set<EnchantmentConfig> enchantmentConfigs = new HashSet<>();
|
private static final Set<EnchantmentConfig> enchantmentConfigs = new HashSet<>();
|
@ -1,7 +1,8 @@
|
|||||||
package com.willfp.ecoenchants.config;
|
package com.willfp.ecoenchants.config;
|
||||||
|
|
||||||
|
import com.willfp.eco.util.injection.PluginDependent;
|
||||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
@ -17,28 +18,28 @@ import java.nio.charset.StandardCharsets;
|
|||||||
/**
|
/**
|
||||||
* Class implemented by enchantment configs
|
* Class implemented by enchantment configs
|
||||||
*/
|
*/
|
||||||
public abstract class EnchantmentYamlConfig {
|
public abstract class EnchantmentYamlConfig extends PluginDependent {
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
public YamlConfiguration config;
|
public YamlConfiguration config;
|
||||||
protected File configFile;
|
protected File configFile;
|
||||||
private final File directory;
|
private final File directory;
|
||||||
private final Class<?> source;
|
private final Class<?> source;
|
||||||
private final EcoEnchant.EnchantmentType type;
|
private final EnchantmentType type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new config yml
|
* Create new config yml
|
||||||
*
|
*
|
||||||
* @param name The config name
|
* @param name The config name
|
||||||
* @param plugin The class of the main class of plugin or extension
|
* @param source The class of the main class of source or extension
|
||||||
* @param type The enchantment type
|
* @param type The enchantment type
|
||||||
*/
|
*/
|
||||||
public EnchantmentYamlConfig(String name, Class<?> plugin, EcoEnchant.EnchantmentType type) {
|
public EnchantmentYamlConfig(String name, Class<?> source, EnchantmentType type) {
|
||||||
|
super(EcoEnchantsPlugin.getInstance());
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.source = plugin;
|
this.source = source;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
||||||
File basedir = new File(EcoEnchantsPlugin.getInstance().getDataFolder(), "enchants/");
|
File basedir = new File(this.plugin.getDataFolder(), "enchants/");
|
||||||
if (!basedir.exists()) basedir.mkdirs();
|
if (!basedir.exists()) basedir.mkdirs();
|
||||||
|
|
||||||
File dir = new File(basedir, type.getName() + "/");
|
File dir = new File(basedir, type.getName() + "/");
|
||||||
@ -66,9 +67,9 @@ public abstract class EnchantmentYamlConfig {
|
|||||||
|
|
||||||
InputStream in = source.getResourceAsStream(resourcePath);
|
InputStream in = source.getResourceAsStream(resourcePath);
|
||||||
|
|
||||||
File outFile = new File(EcoEnchantsPlugin.getInstance().getDataFolder(), resourcePath);
|
File outFile = new File(this.plugin.getDataFolder(), resourcePath);
|
||||||
int lastIndex = resourcePath.lastIndexOf('/');
|
int lastIndex = resourcePath.lastIndexOf('/');
|
||||||
File outDir = new File(EcoEnchantsPlugin.getInstance().getDataFolder(), resourcePath.substring(0, Math.max(lastIndex, 0)));
|
File outDir = new File(this.plugin.getDataFolder(), resourcePath.substring(0, Math.max(lastIndex, 0)));
|
||||||
|
|
||||||
if (!outDir.exists()) {
|
if (!outDir.exists()) {
|
||||||
outDir.mkdirs();
|
outDir.mkdirs();
|
||||||
|
@ -2,10 +2,10 @@ package com.willfp.ecoenchants.config.configs;
|
|||||||
|
|
||||||
import com.willfp.eco.util.config.Configs;
|
import com.willfp.eco.util.config.Configs;
|
||||||
import com.willfp.ecoenchants.config.EnchantmentYamlConfig;
|
import com.willfp.ecoenchants.config.EnchantmentYamlConfig;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity;
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity;
|
||||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -21,7 +21,7 @@ import java.util.Set;
|
|||||||
public class EnchantmentConfig extends EnchantmentYamlConfig {
|
public class EnchantmentConfig extends EnchantmentYamlConfig {
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
public EnchantmentConfig(String name, Class<?> plugin, EcoEnchant.EnchantmentType type) {
|
public EnchantmentConfig(String name, Class<?> plugin, EnchantmentType type) {
|
||||||
super(name, plugin, type);
|
super(name, plugin, type);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.display;
|
|||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.willfp.eco.util.NumberUtils;
|
import com.willfp.eco.util.NumberUtils;
|
||||||
|
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||||
import com.willfp.ecoenchants.display.options.DisplayOptions;
|
import com.willfp.ecoenchants.display.options.DisplayOptions;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
@ -25,6 +26,8 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("DeprecatedIsStillUsed")
|
@SuppressWarnings("DeprecatedIsStillUsed")
|
||||||
public class EnchantDisplay {
|
public class EnchantDisplay {
|
||||||
|
private static final AbstractEcoPlugin plugin = EcoEnchantsPlugin.getInstance();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The meta key to hide enchantments in lore
|
* The meta key to hide enchantments in lore
|
||||||
* <p>
|
* <p>
|
||||||
@ -34,14 +37,14 @@ public class EnchantDisplay {
|
|||||||
* @deprecated Temporary fix
|
* @deprecated Temporary fix
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static final NamespacedKey KEY_SKIP = new NamespacedKey(EcoEnchantsPlugin.getInstance(), "ecoenchantlore-skip");
|
public static final NamespacedKey KEY_SKIP = plugin.getNamespacedKeyFactory().create("ecoenchantlore-skip");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The meta key to notify the server that an item is from a villager trade
|
* The meta key to notify the server that an item is from a villager trade
|
||||||
* <p>
|
* <p>
|
||||||
* Bit of a bodge - plan on making it better.
|
* Bit of a bodge - plan on making it better.
|
||||||
*/
|
*/
|
||||||
public static final NamespacedKey KEY_V = new NamespacedKey(EcoEnchantsPlugin.getInstance(), "ecoenchantlore-v");
|
public static final NamespacedKey KEY_V = plugin.getNamespacedKeyFactory().create("ecoenchantlore-v");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The prefix for all enchantment lines to have in lore
|
* The prefix for all enchantment lines to have in lore
|
||||||
|
@ -4,6 +4,7 @@ import com.willfp.eco.util.config.Configs;
|
|||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity;
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.apache.commons.lang.WordUtils;
|
import org.apache.commons.lang.WordUtils;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
|
||||||
@ -21,7 +22,7 @@ public class EnchantmentCache {
|
|||||||
@SuppressWarnings("OptionalGetWithoutIsPresent")
|
@SuppressWarnings("OptionalGetWithoutIsPresent")
|
||||||
public static CacheEntry getEntry(Enchantment enchantment) {
|
public static CacheEntry getEntry(Enchantment enchantment) {
|
||||||
Optional<CacheEntry> matching = CACHE.stream().filter(entry -> entry.getEnchantment().getKey().getKey().equals(enchantment.getKey().getKey())).findFirst();
|
Optional<CacheEntry> matching = CACHE.stream().filter(entry -> entry.getEnchantment().getKey().getKey().equals(enchantment.getKey().getKey())).findFirst();
|
||||||
return matching.orElse(new CacheEntry(enchantment, EnchantDisplay.PREFIX + "§7" + enchantment.getKey().getKey(), enchantment.getKey().getKey(), Collections.singletonList(EnchantDisplay.PREFIX + "No Description Found"), EcoEnchant.EnchantmentType.NORMAL, EnchantmentRarity.values().stream().findFirst().get()));
|
return matching.orElse(new CacheEntry(enchantment, EnchantDisplay.PREFIX + "§7" + enchantment.getKey().getKey(), enchantment.getKey().getKey(), Collections.singletonList(EnchantDisplay.PREFIX + "No Description Found"), EnchantmentType.NORMAL, EnchantmentRarity.values().stream().findFirst().get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Set<CacheEntry> getCache() {
|
public static Set<CacheEntry> getCache() {
|
||||||
@ -33,7 +34,7 @@ public class EnchantmentCache {
|
|||||||
Arrays.asList(Enchantment.values()).parallelStream().forEach(enchantment -> {
|
Arrays.asList(Enchantment.values()).parallelStream().forEach(enchantment -> {
|
||||||
String name;
|
String name;
|
||||||
String color;
|
String color;
|
||||||
EcoEnchant.EnchantmentType type;
|
EnchantmentType type;
|
||||||
EnchantmentRarity rarity;
|
EnchantmentRarity rarity;
|
||||||
List<String> description;
|
List<String> description;
|
||||||
if (EcoEnchants.getFromEnchantment(enchantment) != null) {
|
if (EcoEnchants.getFromEnchantment(enchantment) != null) {
|
||||||
@ -51,14 +52,14 @@ public class EnchantmentCache {
|
|||||||
).split("\\r?\\n")
|
).split("\\r?\\n")
|
||||||
);
|
);
|
||||||
name = String.valueOf(Configs.LANG.getString("enchantments." + enchantment.getKey().getKey().toLowerCase() + ".name"));
|
name = String.valueOf(Configs.LANG.getString("enchantments." + enchantment.getKey().getKey().toLowerCase() + ".name"));
|
||||||
type = enchantment.isCursed() ? EcoEnchant.EnchantmentType.CURSE : EcoEnchant.EnchantmentType.NORMAL;
|
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"));
|
rarity = enchantment.isTreasure() ? EnchantmentRarity.getByName(Configs.CONFIG.getString("rarity.vanilla-treasure-rarity")) : EnchantmentRarity.getByName(Configs.CONFIG.getString("rarity.vanilla-rarity"));
|
||||||
}
|
}
|
||||||
|
|
||||||
color = type.getColor();
|
color = type.getColor();
|
||||||
|
|
||||||
if (rarity != null) {
|
if (rarity != null) {
|
||||||
if (rarity.hasCustomColor() && type != EcoEnchant.EnchantmentType.CURSE) {
|
if (rarity.hasCustomColor() && type != EnchantmentType.CURSE) {
|
||||||
color = rarity.getCustomColor();
|
color = rarity.getCustomColor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,10 +78,10 @@ public class EnchantmentCache {
|
|||||||
private final String rawName;
|
private final String rawName;
|
||||||
private final List<String> description;
|
private final List<String> description;
|
||||||
private final String stringDescription;
|
private final String stringDescription;
|
||||||
private final EcoEnchant.EnchantmentType type;
|
private final EnchantmentType type;
|
||||||
private final EnchantmentRarity rarity;
|
private final EnchantmentRarity rarity;
|
||||||
|
|
||||||
public CacheEntry(Enchantment enchantment, String name, String rawName, List<String> description, EcoEnchant.EnchantmentType type, EnchantmentRarity rarity) {
|
public CacheEntry(Enchantment enchantment, String name, String rawName, List<String> description, EnchantmentType type, EnchantmentRarity rarity) {
|
||||||
this.enchantment = enchantment;
|
this.enchantment = enchantment;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.rawName = rawName;
|
this.rawName = rawName;
|
||||||
@ -120,7 +121,7 @@ public class EnchantmentCache {
|
|||||||
return stringDescription;
|
return stringDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EcoEnchant.EnchantmentType getType() {
|
public EnchantmentType getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@ import com.willfp.eco.util.config.Configs;
|
|||||||
import com.willfp.ecoenchants.display.options.sorting.EnchantmentSorter;
|
import com.willfp.ecoenchants.display.options.sorting.EnchantmentSorter;
|
||||||
import com.willfp.ecoenchants.display.options.sorting.SortParameters;
|
import com.willfp.ecoenchants.display.options.sorting.SortParameters;
|
||||||
import com.willfp.ecoenchants.display.options.sorting.SorterManager;
|
import com.willfp.ecoenchants.display.options.sorting.SorterManager;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
|
||||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity;
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -19,7 +19,7 @@ public class DisplayOptions {
|
|||||||
private final DescriptionOptions descriptionOptions = new DescriptionOptions();
|
private final DescriptionOptions descriptionOptions = new DescriptionOptions();
|
||||||
private final NumbersOptions numbersOptions = new NumbersOptions();
|
private final NumbersOptions numbersOptions = new NumbersOptions();
|
||||||
private final ShrinkOptions shrinkOptions = new ShrinkOptions();
|
private final ShrinkOptions shrinkOptions = new ShrinkOptions();
|
||||||
private final List<EcoEnchant.EnchantmentType> sortedTypes = new ArrayList<>();
|
private final List<EnchantmentType> sortedTypes = new ArrayList<>();
|
||||||
private final List<EnchantmentRarity> sortedRarities = new ArrayList<>();
|
private final List<EnchantmentRarity> sortedRarities = new ArrayList<>();
|
||||||
|
|
||||||
public DisplayOptions() {
|
public DisplayOptions() {
|
||||||
@ -58,7 +58,7 @@ public class DisplayOptions {
|
|||||||
return shrinkOptions.isEnabled();
|
return shrinkOptions.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<EcoEnchant.EnchantmentType> getSortedTypes() {
|
public List<EnchantmentType> getSortedTypes() {
|
||||||
return sortedTypes;
|
return sortedTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,10 +77,10 @@ public class DisplayOptions {
|
|||||||
|
|
||||||
sortedTypes.clear();
|
sortedTypes.clear();
|
||||||
sortedTypes.addAll(Configs.CONFIG.getStrings("lore.type-ordering").stream()
|
sortedTypes.addAll(Configs.CONFIG.getStrings("lore.type-ordering").stream()
|
||||||
.map(typeName -> EcoEnchant.EnchantmentType.values().stream().filter(type -> type.getName().equalsIgnoreCase(typeName)).findFirst().orElse(null))
|
.map(typeName -> EnchantmentType.values().stream().filter(type -> type.getName().equalsIgnoreCase(typeName)).findFirst().orElse(null))
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
sortedTypes.addAll(EcoEnchant.EnchantmentType.values().stream().filter(enchantmentType -> !sortedTypes.contains(enchantmentType)).collect(Collectors.toList()));
|
sortedTypes.addAll(EnchantmentType.values().stream().filter(enchantmentType -> !sortedTypes.contains(enchantmentType)).collect(Collectors.toList()));
|
||||||
|
|
||||||
sortedRarities.clear();
|
sortedRarities.clear();
|
||||||
sortedRarities.addAll(Configs.CONFIG.getStrings("lore.rarity-ordering").stream()
|
sortedRarities.addAll(Configs.CONFIG.getStrings("lore.rarity-ordering").stream()
|
||||||
|
@ -7,11 +7,11 @@ import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
|||||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||||
import com.willfp.eco.core.proxy.proxies.ChatComponentProxy;
|
import com.willfp.eco.core.proxy.proxies.ChatComponentProxy;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||||
import com.willfp.ecoenchants.display.AbstractPacketAdapter;
|
import com.willfp.eco.util.packets.AbstractPacketAdapter;
|
||||||
|
|
||||||
public class PacketChat extends AbstractPacketAdapter {
|
public class PacketChat extends AbstractPacketAdapter {
|
||||||
public PacketChat(AbstractEcoPlugin plugin) {
|
public PacketChat(AbstractEcoPlugin plugin) {
|
||||||
super(plugin, PacketType.Play.Server.CHAT, ListenerPriority.MONITOR);
|
super(plugin, PacketType.Play.Server.CHAT, ListenerPriority.MONITOR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -4,7 +4,7 @@ import com.comphenix.protocol.PacketType;
|
|||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.willfp.eco.core.proxy.ProxyConstants;
|
import com.willfp.eco.core.proxy.ProxyConstants;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||||
import com.willfp.ecoenchants.display.AbstractPacketAdapter;
|
import com.willfp.eco.util.packets.AbstractPacketAdapter;
|
||||||
import com.willfp.ecoenchants.display.EnchantDisplay;
|
import com.willfp.ecoenchants.display.EnchantDisplay;
|
||||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -18,7 +18,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
public class PacketOpenWindowMerchant extends AbstractPacketAdapter {
|
public class PacketOpenWindowMerchant extends AbstractPacketAdapter {
|
||||||
public PacketOpenWindowMerchant(AbstractEcoPlugin plugin) {
|
public PacketOpenWindowMerchant(AbstractEcoPlugin plugin) {
|
||||||
super(plugin, PacketType.Play.Server.OPEN_WINDOW_MERCHANT);
|
super(plugin, PacketType.Play.Server.OPEN_WINDOW_MERCHANT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -3,12 +3,12 @@ package com.willfp.ecoenchants.display.packets;
|
|||||||
import com.comphenix.protocol.PacketType;
|
import com.comphenix.protocol.PacketType;
|
||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||||
import com.willfp.ecoenchants.display.AbstractPacketAdapter;
|
import com.willfp.eco.util.packets.AbstractPacketAdapter;
|
||||||
import com.willfp.ecoenchants.display.EnchantDisplay;
|
import com.willfp.ecoenchants.display.EnchantDisplay;
|
||||||
|
|
||||||
public class PacketSetCreativeSlot extends AbstractPacketAdapter {
|
public class PacketSetCreativeSlot extends AbstractPacketAdapter {
|
||||||
public PacketSetCreativeSlot(AbstractEcoPlugin plugin) {
|
public PacketSetCreativeSlot(AbstractEcoPlugin plugin) {
|
||||||
super(plugin, PacketType.Play.Client.SET_CREATIVE_SLOT);
|
super(plugin, PacketType.Play.Client.SET_CREATIVE_SLOT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -3,13 +3,13 @@ package com.willfp.ecoenchants.display.packets;
|
|||||||
import com.comphenix.protocol.PacketType;
|
import com.comphenix.protocol.PacketType;
|
||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||||
import com.willfp.ecoenchants.display.AbstractPacketAdapter;
|
import com.willfp.eco.util.packets.AbstractPacketAdapter;
|
||||||
import com.willfp.ecoenchants.display.EnchantDisplay;
|
import com.willfp.ecoenchants.display.EnchantDisplay;
|
||||||
import org.bukkit.inventory.ItemFlag;
|
import org.bukkit.inventory.ItemFlag;
|
||||||
|
|
||||||
public class PacketSetSlot extends AbstractPacketAdapter {
|
public class PacketSetSlot extends AbstractPacketAdapter {
|
||||||
public PacketSetSlot(AbstractEcoPlugin plugin) {
|
public PacketSetSlot(AbstractEcoPlugin plugin) {
|
||||||
super(plugin, PacketType.Play.Server.SET_SLOT);
|
super(plugin, PacketType.Play.Server.SET_SLOT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -3,13 +3,13 @@ package com.willfp.ecoenchants.display.packets;
|
|||||||
import com.comphenix.protocol.PacketType;
|
import com.comphenix.protocol.PacketType;
|
||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||||
import com.willfp.ecoenchants.display.AbstractPacketAdapter;
|
import com.willfp.eco.util.packets.AbstractPacketAdapter;
|
||||||
import com.willfp.ecoenchants.display.EnchantDisplay;
|
import com.willfp.ecoenchants.display.EnchantDisplay;
|
||||||
import org.bukkit.inventory.ItemFlag;
|
import org.bukkit.inventory.ItemFlag;
|
||||||
|
|
||||||
public class PacketWindowItems extends AbstractPacketAdapter {
|
public class PacketWindowItems extends AbstractPacketAdapter {
|
||||||
public PacketWindowItems(AbstractEcoPlugin plugin) {
|
public PacketWindowItems(AbstractEcoPlugin plugin) {
|
||||||
super(plugin, PacketType.Play.Server.WINDOW_ITEMS);
|
super(plugin, PacketType.Play.Server.WINDOW_ITEMS, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -4,14 +4,13 @@ package com.willfp.ecoenchants.enchantments;
|
|||||||
import com.willfp.eco.util.StringUtils;
|
import com.willfp.eco.util.StringUtils;
|
||||||
import com.willfp.eco.util.config.Configs;
|
import com.willfp.eco.util.config.Configs;
|
||||||
import com.willfp.eco.util.interfaces.Registerable;
|
import com.willfp.eco.util.interfaces.Registerable;
|
||||||
import com.willfp.eco.util.lambda.ObjectCallable;
|
|
||||||
import com.willfp.eco.util.optional.Prerequisite;
|
import com.willfp.eco.util.optional.Prerequisite;
|
||||||
import com.willfp.ecoenchants.config.ConfigManager;
|
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||||
|
import com.willfp.ecoenchants.config.EcoEnchantsConfigs;
|
||||||
import com.willfp.ecoenchants.config.configs.EnchantmentConfig;
|
import com.willfp.ecoenchants.config.configs.EnchantmentConfig;
|
||||||
import com.willfp.ecoenchants.enchantments.itemtypes.Artifact;
|
|
||||||
import com.willfp.ecoenchants.enchantments.itemtypes.Spell;
|
|
||||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity;
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity;
|
||||||
import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import com.willfp.ecoenchants.enchantments.util.Watcher;
|
import com.willfp.ecoenchants.enchantments.util.Watcher;
|
||||||
import org.apache.commons.lang.WordUtils;
|
import org.apache.commons.lang.WordUtils;
|
||||||
@ -39,6 +38,8 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
@SuppressWarnings({"unchecked", "deprecation"})
|
@SuppressWarnings({"unchecked", "deprecation"})
|
||||||
public abstract class EcoEnchant extends Enchantment implements Listener, Registerable, Watcher {
|
public abstract class EcoEnchant extends Enchantment implements Listener, Registerable, Watcher {
|
||||||
|
protected final AbstractEcoPlugin plugin = AbstractEcoPlugin.getInstance();
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private String description;
|
private String description;
|
||||||
private final String permissionName;
|
private final String permissionName;
|
||||||
@ -73,8 +74,8 @@ public abstract class EcoEnchant extends Enchantment implements Listener, Regist
|
|||||||
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.permissionName = key.replaceAll("_", "");
|
this.permissionName = key.replaceAll("_", "");
|
||||||
ConfigManager.addEnchantmentConfig(new EnchantmentConfig(this.permissionName, this.getClass(), this.type));
|
EcoEnchantsConfigs.addEnchantmentConfig(new EnchantmentConfig(this.permissionName, this.getClass(), this.type));
|
||||||
this.config = ConfigManager.getEnchantmentConfig(this.permissionName);
|
this.config = EcoEnchantsConfigs.getEnchantmentConfig(this.permissionName);
|
||||||
|
|
||||||
if (Bukkit.getPluginManager().getPermission("ecoenchants.fromtable." + permissionName) == null) {
|
if (Bukkit.getPluginManager().getPermission("ecoenchants.fromtable." + permissionName) == null) {
|
||||||
Permission permission = new Permission(
|
Permission permission = new Permission(
|
||||||
@ -418,118 +419,4 @@ public abstract class EcoEnchant extends Enchantment implements Listener, Regist
|
|||||||
return targetMaterials.contains(itemStack.getType()) || itemStack.getType().equals(Material.BOOK) || itemStack.getType().equals(Material.ENCHANTED_BOOK);
|
return targetMaterials.contains(itemStack.getType()) || itemStack.getType().equals(Material.BOOK) || itemStack.getType().equals(Material.ENCHANTED_BOOK);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EnchantmentType {
|
|
||||||
private static final List<EnchantmentType> values = new ArrayList<>();
|
|
||||||
|
|
||||||
public static final EnchantmentType NORMAL = new EnchantmentType("normal", false, () -> Configs.LANG.getString("not-curse-color"));
|
|
||||||
public static final EnchantmentType CURSE = new EnchantmentType("curse", false, () -> Configs.LANG.getString("curse-color"));
|
|
||||||
public static final EnchantmentType SPECIAL = new EnchantmentType("special", () -> !Configs.CONFIG.getBool("types.special.allow-multiple"), () -> Configs.LANG.getString("special-color"));
|
|
||||||
public static final EnchantmentType ARTIFACT = new EnchantmentType("artifact", () -> !Configs.CONFIG.getBool("types.artifact.allow-multiple"), () -> Configs.LANG.getString("artifact-color"), Artifact.class);
|
|
||||||
public static final EnchantmentType SPELL = new EnchantmentType("spell", true, () -> Configs.LANG.getString("spell-color"), Spell.class);
|
|
||||||
|
|
||||||
private boolean singular;
|
|
||||||
private String color;
|
|
||||||
private final String name;
|
|
||||||
private final ObjectCallable<String> colorCallable;
|
|
||||||
private final ObjectCallable<Boolean> singularCallable;
|
|
||||||
private final Class<? extends EcoEnchant> requiredToExtend;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create simple EnchantmentType
|
|
||||||
* <p>
|
|
||||||
* Singularity and Color will not be updated using this constructor
|
|
||||||
*
|
|
||||||
* @param name The name of the type
|
|
||||||
* @param singular Whether an item can have several enchantments of this type
|
|
||||||
* @param color The color for enchantments with this type in lore to have
|
|
||||||
*/
|
|
||||||
public EnchantmentType(String name, boolean singular, String color) {
|
|
||||||
this(name, () -> singular, () -> color);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create EnchantmentType with updatable color
|
|
||||||
* <p>
|
|
||||||
* Singularity will not be updated using this constructor
|
|
||||||
*
|
|
||||||
* @param name The name of the type
|
|
||||||
* @param singular Whether an item can have several enchantments of this type
|
|
||||||
* @param colorCallable Lambda to fetch the color of enchantments with this type to have. Updates on /ecoreload
|
|
||||||
*/
|
|
||||||
public EnchantmentType(String name, boolean singular, ObjectCallable<String> colorCallable) {
|
|
||||||
this(name, () -> singular, colorCallable);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create EnchantmentType with updatable color that <b>must</b> extend a specified class
|
|
||||||
* <p>
|
|
||||||
* Singularity will not be updated using this constructor
|
|
||||||
*
|
|
||||||
* @param name The name of the type
|
|
||||||
* @param singular Whether an item can have several enchantments of this type
|
|
||||||
* @param colorCallable Lambda to fetch the color of enchantments with this type to have. Updates on /ecoreload
|
|
||||||
* @param requiredToExtend Class that all enchantments of this type must extend - or null if not required
|
|
||||||
*/
|
|
||||||
public EnchantmentType(String name, boolean singular, ObjectCallable<String> colorCallable, Class<? extends EcoEnchant> requiredToExtend) {
|
|
||||||
this(name, () -> singular, colorCallable, requiredToExtend);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create EnchantmentType with updatable color and singularity
|
|
||||||
*
|
|
||||||
* @param name The name of the type
|
|
||||||
* @param singularCallable Lambda to fetch whether an item can have several enchantments of this type. Updates on /ecoreload
|
|
||||||
* @param colorCallable Lambda to fetch the color of enchantments with this type to have. Updates on /ecoreload
|
|
||||||
*/
|
|
||||||
public EnchantmentType(String name, ObjectCallable<Boolean> singularCallable, ObjectCallable<String> colorCallable) {
|
|
||||||
this(name, singularCallable, colorCallable, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create EnchantmentType with updatable color and singularity that <b>must</b> extend a specified class
|
|
||||||
*
|
|
||||||
* @param name The name of the type
|
|
||||||
* @param singularCallable Lambda to fetch whether an item can have several enchantments of this type. Updates on /ecoreload
|
|
||||||
* @param colorCallable Lambda to fetch the color of enchantments with this type to have. Updates on /ecoreload
|
|
||||||
* @param requiredToExtend Class that all enchantments of this type must extend - or null if not required
|
|
||||||
*/
|
|
||||||
public EnchantmentType(String name, ObjectCallable<Boolean> singularCallable, ObjectCallable<String> colorCallable, Class<? extends EcoEnchant> requiredToExtend) {
|
|
||||||
this.name = name;
|
|
||||||
this.singularCallable = singularCallable;
|
|
||||||
this.colorCallable = colorCallable;
|
|
||||||
this.requiredToExtend = requiredToExtend;
|
|
||||||
color = colorCallable.call();
|
|
||||||
singular = singularCallable.call();
|
|
||||||
values.add(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void refresh() {
|
|
||||||
this.color = colorCallable.call();
|
|
||||||
this.singular = singularCallable.call();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getColor() {
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSingular() {
|
|
||||||
return singular;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Class<? extends EcoEnchant> getRequiredToExtend() {
|
|
||||||
return requiredToExtend;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void update() {
|
|
||||||
values.forEach(EnchantmentType::refresh);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<EnchantmentType> values() {
|
|
||||||
return new ArrayList<>(values);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -222,6 +222,7 @@ import com.willfp.ecoenchants.enchantments.ecoenchants.spell.Dynamite;
|
|||||||
import com.willfp.ecoenchants.enchantments.ecoenchants.spell.Missile;
|
import com.willfp.ecoenchants.enchantments.ecoenchants.spell.Missile;
|
||||||
import com.willfp.ecoenchants.enchantments.ecoenchants.spell.Quake;
|
import com.willfp.ecoenchants.enchantments.ecoenchants.spell.Quake;
|
||||||
import com.willfp.ecoenchants.enchantments.ecoenchants.spell.Vitalize;
|
import com.willfp.ecoenchants.enchantments.ecoenchants.spell.Vitalize;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -473,7 +474,7 @@ public class EcoEnchants {
|
|||||||
*
|
*
|
||||||
* @return A list of all {@link EcoEnchant}s
|
* @return A list of all {@link EcoEnchant}s
|
||||||
*/
|
*/
|
||||||
public static List<EcoEnchant> getAll() {
|
public static List<EcoEnchant> values() {
|
||||||
return ImmutableList.copyOf(ecoEnchants);
|
return ImmutableList.copyOf(ecoEnchants);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,7 +497,7 @@ public class EcoEnchants {
|
|||||||
* @return The matching {@link EcoEnchant}, or null if not found.
|
* @return The matching {@link EcoEnchant}, or null if not found.
|
||||||
*/
|
*/
|
||||||
public static EcoEnchant getByName(String name) {
|
public static EcoEnchant getByName(String name) {
|
||||||
Optional<EcoEnchant> matching = getAll().stream().filter(enchant -> enchant.getName().equalsIgnoreCase(name)).findFirst();
|
Optional<EcoEnchant> matching = values().stream().filter(enchant -> enchant.getName().equalsIgnoreCase(name)).findFirst();
|
||||||
return matching.orElse(null);
|
return matching.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,7 +509,7 @@ public class EcoEnchants {
|
|||||||
* @return The matching {@link EcoEnchant}, or null if not found.
|
* @return The matching {@link EcoEnchant}, or null if not found.
|
||||||
*/
|
*/
|
||||||
public static EcoEnchant getByPermission(String permissionName) {
|
public static EcoEnchant getByPermission(String permissionName) {
|
||||||
Optional<EcoEnchant> matching = getAll().stream().filter(enchant -> enchant.getPermissionName().equalsIgnoreCase(permissionName)).findFirst();
|
Optional<EcoEnchant> matching = values().stream().filter(enchant -> enchant.getPermissionName().equalsIgnoreCase(permissionName)).findFirst();
|
||||||
return matching.orElse(null);
|
return matching.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -524,14 +525,14 @@ public class EcoEnchants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if {@link ItemStack} has any {@link EcoEnchant} matching specified {@link EcoEnchant.EnchantmentType}
|
* Get if {@link ItemStack} has any {@link EcoEnchant} matching specified {@link EnchantmentType}
|
||||||
*
|
*
|
||||||
* @param item The {@link ItemStack} to check
|
* @param item The {@link ItemStack} to check
|
||||||
* @param type The {@link EcoEnchant.EnchantmentType} to match
|
* @param type The {@link EnchantmentType} to match
|
||||||
*
|
*
|
||||||
* @return True if has, false if doesn't have.
|
* @return True if has, false if doesn't have.
|
||||||
*/
|
*/
|
||||||
public static boolean hasAnyOfType(ItemStack item, EcoEnchant.EnchantmentType type) {
|
public static boolean hasAnyOfType(ItemStack item, EnchantmentType type) {
|
||||||
if (item == null) return false;
|
if (item == null) return false;
|
||||||
|
|
||||||
AtomicBoolean hasOfType = new AtomicBoolean(false);
|
AtomicBoolean hasOfType = new AtomicBoolean(false);
|
||||||
@ -557,7 +558,7 @@ public class EcoEnchants {
|
|||||||
* Called on /ecoreload
|
* Called on /ecoreload
|
||||||
*/
|
*/
|
||||||
public static void update() {
|
public static void update() {
|
||||||
for (EcoEnchant ecoEnchant : new HashSet<>(getAll())) {
|
for (EcoEnchant ecoEnchant : new HashSet<>(values())) {
|
||||||
ecoEnchant.update();
|
ecoEnchant.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.willfp.ecoenchants.enchantments.ecoenchants.curse;
|
package com.willfp.ecoenchants.enchantments.ecoenchants.curse;
|
||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -3,9 +3,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.curse;
|
|||||||
import com.willfp.eco.util.VectorUtils;
|
import com.willfp.eco.util.VectorUtils;
|
||||||
import com.willfp.eco.util.events.armorequip.ArmorEquipEvent;
|
import com.willfp.eco.util.events.armorequip.ArmorEquipEvent;
|
||||||
import com.willfp.eco.util.interfaces.EcoRunnable;
|
import com.willfp.eco.util.interfaces.EcoRunnable;
|
||||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Monster;
|
import org.bukkit.entity.Monster;
|
||||||
@ -44,7 +44,7 @@ public class CallingCurse extends EcoEnchant implements EcoRunnable {
|
|||||||
|
|
||||||
private void refresh() {
|
private void refresh() {
|
||||||
players.clear();
|
players.clear();
|
||||||
EcoEnchantsPlugin.getInstance().getServer().getOnlinePlayers().forEach(player -> {
|
this.plugin.getServer().getOnlinePlayers().forEach(player -> {
|
||||||
int level = EnchantChecks.getArmorPoints(player, this, 0);
|
int level = EnchantChecks.getArmorPoints(player, this, 0);
|
||||||
if (level > 0) {
|
if (level > 0) {
|
||||||
players.put(player, level);
|
players.put(player, level);
|
||||||
|
@ -2,9 +2,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.curse;
|
|||||||
|
|
||||||
import com.willfp.eco.util.DurabilityUtils;
|
import com.willfp.eco.util.DurabilityUtils;
|
||||||
import com.willfp.eco.util.interfaces.EcoRunnable;
|
import com.willfp.eco.util.interfaces.EcoRunnable;
|
||||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -63,7 +63,7 @@ public class DecayCurse extends EcoEnchant implements EcoRunnable {
|
|||||||
|
|
||||||
private void refresh() {
|
private void refresh() {
|
||||||
players.clear();
|
players.clear();
|
||||||
EcoEnchantsPlugin.getInstance().getServer().getOnlinePlayers().forEach(player -> {
|
this.plugin.getServer().getOnlinePlayers().forEach(player -> {
|
||||||
if (Arrays.stream(player.getInventory().getContents()).parallel().anyMatch(item -> EnchantChecks.item(item, this)))
|
if (Arrays.stream(player.getInventory().getContents()).parallel().anyMatch(item -> EnchantChecks.item(item, this)))
|
||||||
players.add(player);
|
players.add(player);
|
||||||
});
|
});
|
||||||
|
@ -3,6 +3,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.curse;
|
|||||||
import com.willfp.eco.util.NumberUtils;
|
import com.willfp.eco.util.NumberUtils;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.PlayerItemDamageEvent;
|
import org.bukkit.event.player.PlayerItemDamageEvent;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.willfp.ecoenchants.enchantments.ecoenchants.curse;
|
package com.willfp.ecoenchants.enchantments.ecoenchants.curse;
|
||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.curse;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
@ -3,6 +3,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.curse;
|
|||||||
import com.willfp.eco.util.NumberUtils;
|
import com.willfp.eco.util.NumberUtils;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.willfp.ecoenchants.enchantments.ecoenchants.curse;
|
package com.willfp.ecoenchants.enchantments.ecoenchants.curse;
|
||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.willfp.ecoenchants.enchantments.ecoenchants.curse;
|
package com.willfp.ecoenchants.enchantments.ecoenchants.curse;
|
||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
|
|
||||||
public class PermanenceCurse extends EcoEnchant {
|
public class PermanenceCurse extends EcoEnchant {
|
||||||
public PermanenceCurse() {
|
public PermanenceCurse() {
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Monster;
|
import org.bukkit.entity.Monster;
|
||||||
import org.bukkit.entity.Trident;
|
import org.bukkit.entity.Trident;
|
||||||
|
@ -5,6 +5,7 @@ import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
|||||||
import com.willfp.eco.util.DurabilityUtils;
|
import com.willfp.eco.util.DurabilityUtils;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
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;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||||
|
|
||||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
@ -25,7 +25,7 @@ public class Aerial extends EcoEnchant {
|
|||||||
|
|
||||||
if (shooter.isOnGround()) return;
|
if (shooter.isOnGround()) return;
|
||||||
|
|
||||||
event.getProjectile().setMetadata("shot-in-air", new FixedMetadataValue(EcoEnchantsPlugin.getInstance(), true));
|
event.getProjectile().setMetadata("shot-in-air", new FixedMetadataValue(this.plugin, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Trident;
|
import org.bukkit.entity.Trident;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Spider;
|
import org.bukkit.entity.Spider;
|
||||||
import org.bukkit.entity.Trident;
|
import org.bukkit.entity.Trident;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||||
|
|
||||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Trident;
|
import org.bukkit.entity.Trident;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
@ -22,7 +22,7 @@ public class Atmospheric extends EcoEnchant {
|
|||||||
public void onTridentLaunch(LivingEntity shooter, Trident trident, int level, ProjectileLaunchEvent event) {
|
public void onTridentLaunch(LivingEntity shooter, Trident trident, int level, ProjectileLaunchEvent event) {
|
||||||
if(shooter.isOnGround()) return;
|
if(shooter.isOnGround()) return;
|
||||||
|
|
||||||
trident.setMetadata("shot-in-air", new FixedMetadataValue(EcoEnchantsPlugin.getInstance(), true));
|
trident.setMetadata("shot-in-air", new FixedMetadataValue(this.plugin, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.eco.util.drops.DropQueue;
|
import com.willfp.eco.util.drops.DropQueue;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
@ -2,9 +2,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||||
import com.willfp.eco.core.proxy.proxies.BlockBreakProxy;
|
import com.willfp.eco.core.proxy.proxies.BlockBreakProxy;
|
||||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.integrations.anticheat.AnticheatManager;
|
import com.willfp.ecoenchants.integrations.anticheat.AnticheatManager;
|
||||||
import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
|
import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
|
||||||
import org.bukkit.Particle;
|
import org.bukkit.Particle;
|
||||||
@ -33,13 +33,10 @@ public class BlastMining extends EcoEnchant {
|
|||||||
|
|
||||||
if(player.isSneaking() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-sneak")) return;
|
if(player.isSneaking() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-sneak")) return;
|
||||||
|
|
||||||
boolean hasExploded = false;
|
|
||||||
|
|
||||||
AnticheatManager.exemptPlayer(player);
|
AnticheatManager.exemptPlayer(player);
|
||||||
|
|
||||||
Set<Block> toBreak = new HashSet<>();
|
Set<Block> toBreak = new HashSet<>();
|
||||||
|
|
||||||
|
|
||||||
for(int x = -1; x <= 1; x++) {
|
for(int x = -1; x <= 1; x++) {
|
||||||
for(int y = -1; y <= 1; y++) {
|
for(int y = -1; y <= 1; y++) {
|
||||||
for (int z = -1; z <= 1; z++) {
|
for (int z = -1; z <= 1; z++) {
|
||||||
@ -67,9 +64,9 @@ public class BlastMining extends EcoEnchant {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toBreak.forEach((block1 -> {
|
toBreak.forEach((block1 -> {
|
||||||
block1.setMetadata("block-ignore", new FixedMetadataValue(EcoEnchantsPlugin.getInstance(), true));
|
block1.setMetadata("block-ignore", new FixedMetadataValue(this.plugin, true));
|
||||||
new ProxyFactory<>(BlockBreakProxy.class).getProxy().breakBlock(player, block1);
|
new ProxyFactory<>(BlockBreakProxy.class).getProxy().breakBlock(player, block1);
|
||||||
block1.removeMetadata("block-ignore", EcoEnchantsPlugin.getInstance());
|
block1.removeMetadata("block-ignore", this.plugin);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
AnticheatManager.unexemptPlayer(player);
|
AnticheatManager.unexemptPlayer(player);
|
||||||
|
@ -2,9 +2,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||||
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
||||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -48,6 +48,6 @@ public class Bleed extends EcoEnchant {
|
|||||||
|
|
||||||
if (currentBleedCount.get() >= finalBleedCount) this.cancel();
|
if (currentBleedCount.get() >= finalBleedCount) this.cancel();
|
||||||
}
|
}
|
||||||
}.runTaskTimer(EcoEnchantsPlugin.getInstance(), 0, 10);
|
}.runTaskTimer(this.plugin, 0, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
import org.bukkit.entity.Boss;
|
import org.bukkit.entity.Boss;
|
||||||
import org.bukkit.entity.ElderGuardian;
|
import org.bukkit.entity.ElderGuardian;
|
||||||
|
@ -3,6 +3,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
import com.willfp.eco.util.NumberUtils;
|
import com.willfp.eco.util.NumberUtils;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.SoundCategory;
|
import org.bukkit.SoundCategory;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Monster;
|
import org.bukkit.entity.Monster;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||||
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
||||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -39,9 +39,9 @@ public class Cleave extends EcoEnchant {
|
|||||||
.filter(entity -> entity instanceof LivingEntity)
|
.filter(entity -> entity instanceof LivingEntity)
|
||||||
.filter(entity -> !entity.equals(attacker))
|
.filter(entity -> !entity.equals(attacker))
|
||||||
.forEach(entity -> {
|
.forEach(entity -> {
|
||||||
entity.setMetadata("cleaved", new FixedMetadataValue(EcoEnchantsPlugin.getInstance(), true));
|
entity.setMetadata("cleaved", new FixedMetadataValue(this.plugin, true));
|
||||||
((LivingEntity) entity).damage(damage, attacker);
|
((LivingEntity) entity).damage(damage, attacker);
|
||||||
Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> entity.removeMetadata("cleaved", EcoEnchantsPlugin.getInstance()), 5);
|
Bukkit.getScheduler().runTaskLater(this.plugin, () -> entity.removeMetadata("cleaved", this.plugin), 5);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Trident;
|
import org.bukkit.entity.Trident;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.eco.util.DurabilityUtils;
|
import com.willfp.eco.util.DurabilityUtils;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.entity.Arrow;
|
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;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Trident;
|
import org.bukkit.entity.Trident;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
public class Criticals extends EcoEnchant {
|
public class Criticals extends EcoEnchant {
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Slime;
|
import org.bukkit.entity.Slime;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Tameable;
|
import org.bukkit.entity.Tameable;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
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;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.entity.Creeper;
|
import org.bukkit.entity.Creeper;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -4,6 +4,7 @@ import com.willfp.eco.core.proxy.ProxyFactory;
|
|||||||
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||||
|
|
||||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
@ -19,7 +19,7 @@ public class Disappear extends EcoEnchant {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDamageWearingArmor(LivingEntity victim, int level, EntityDamageEvent event) {
|
public void onDamageWearingArmor(LivingEntity victim, int level, EntityDamageEvent event) {
|
||||||
Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskLater(this.plugin, () -> {
|
||||||
if(victim.getHealth() > EcoEnchants.DISAPPEAR.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "threshold"))
|
if(victim.getHealth() > EcoEnchants.DISAPPEAR.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "threshold"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
public class Diverse extends EcoEnchant {
|
public class Diverse extends EcoEnchant {
|
||||||
|
@ -3,9 +3,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
import com.willfp.eco.core.proxy.ProxyFactory;
|
import com.willfp.eco.core.proxy.ProxyFactory;
|
||||||
import com.willfp.eco.core.proxy.proxies.BlockBreakProxy;
|
import com.willfp.eco.core.proxy.proxies.BlockBreakProxy;
|
||||||
import com.willfp.eco.util.VectorUtils;
|
import com.willfp.eco.util.VectorUtils;
|
||||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.integrations.anticheat.AnticheatManager;
|
import com.willfp.ecoenchants.integrations.anticheat.AnticheatManager;
|
||||||
import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
|
import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -37,7 +37,7 @@ public class Drill extends EcoEnchant {
|
|||||||
for (int i = 1; i <= blocks; i++) {
|
for (int i = 1; i <= blocks; i++) {
|
||||||
Vector simplified = VectorUtils.simplifyVector(player.getLocation().getDirection().normalize()).multiply(i);
|
Vector simplified = VectorUtils.simplifyVector(player.getLocation().getDirection().normalize()).multiply(i);
|
||||||
Block block1 = block.getWorld().getBlockAt(block.getLocation().clone().add(simplified));
|
Block block1 = block.getWorld().getBlockAt(block.getLocation().clone().add(simplified));
|
||||||
block1.setMetadata("block-ignore", new FixedMetadataValue(EcoEnchantsPlugin.getInstance(), true));
|
block1.setMetadata("block-ignore", new FixedMetadataValue(this.plugin, true));
|
||||||
|
|
||||||
if (this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks").contains(block1.getType().name().toLowerCase())) {
|
if (this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks").contains(block1.getType().name().toLowerCase())) {
|
||||||
continue;
|
continue;
|
||||||
@ -49,7 +49,7 @@ public class Drill extends EcoEnchant {
|
|||||||
if (!AntigriefManager.canBreakBlock(player, block1)) continue;
|
if (!AntigriefManager.canBreakBlock(player, block1)) continue;
|
||||||
|
|
||||||
new ProxyFactory<>(BlockBreakProxy.class).getProxy().breakBlock(player, block1);
|
new ProxyFactory<>(BlockBreakProxy.class).getProxy().breakBlock(player, block1);
|
||||||
block1.removeMetadata("block-ignore", EcoEnchantsPlugin.getInstance());
|
block1.removeMetadata("block-ignore", this.plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
AnticheatManager.unexemptPlayer(player);
|
AnticheatManager.unexemptPlayer(player);
|
||||||
|
@ -4,6 +4,7 @@ import com.willfp.eco.core.proxy.ProxyFactory;
|
|||||||
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.entity.Illager;
|
import org.bukkit.entity.Illager;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
@ -3,6 +3,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
import com.destroystokyo.paper.event.player.PlayerElytraBoostEvent;
|
import com.destroystokyo.paper.event.player.PlayerElytraBoostEvent;
|
||||||
import com.willfp.eco.util.optional.Prerequisite;
|
import com.willfp.eco.util.optional.Prerequisite;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
@ -3,6 +3,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
import com.willfp.eco.util.LightningUtils;
|
import com.willfp.eco.util.LightningUtils;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Trident;
|
import org.bukkit.entity.Trident;
|
||||||
|
@ -4,6 +4,7 @@ import com.willfp.eco.core.proxy.ProxyFactory;
|
|||||||
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -4,6 +4,7 @@ import com.willfp.eco.util.DurabilityUtils;
|
|||||||
import com.willfp.eco.util.VectorUtils;
|
import com.willfp.eco.util.VectorUtils;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||||
import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
|
import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
@ -4,6 +4,7 @@ import com.willfp.eco.util.drops.DropQueue;
|
|||||||
import com.willfp.eco.util.events.entitydeathbyentity.EntityDeathByEntityEvent;
|
import com.willfp.eco.util.events.entitydeathbyentity.EntityDeathByEntityEvent;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
public class FireAffinity extends EcoEnchant {
|
public class FireAffinity extends EcoEnchant {
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -3,9 +3,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
import com.willfp.eco.util.NumberUtils;
|
import com.willfp.eco.util.NumberUtils;
|
||||||
import com.willfp.eco.util.events.armorequip.ArmorEquipEvent;
|
import com.willfp.eco.util.events.armorequip.ArmorEquipEvent;
|
||||||
import com.willfp.eco.util.interfaces.EcoRunnable;
|
import com.willfp.eco.util.interfaces.EcoRunnable;
|
||||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Monster;
|
import org.bukkit.entity.Monster;
|
||||||
@ -42,7 +42,7 @@ public class Forcefield extends EcoEnchant implements EcoRunnable {
|
|||||||
|
|
||||||
private void refresh() {
|
private void refresh() {
|
||||||
players.clear();
|
players.clear();
|
||||||
EcoEnchantsPlugin.getInstance().getServer().getOnlinePlayers().forEach(player -> {
|
this.plugin.getServer().getOnlinePlayers().forEach(player -> {
|
||||||
int level = EnchantChecks.getArmorPoints(player, this, 0);
|
int level = EnchantChecks.getArmorPoints(player, this, 0);
|
||||||
if(level > 0) {
|
if(level > 0) {
|
||||||
players.put(player, level);
|
players.put(player, level);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||||
|
|
||||||
import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -46,7 +46,7 @@ public class Frozen extends EcoEnchant {
|
|||||||
int divisor = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "points-per-level");
|
int divisor = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "points-per-level");
|
||||||
final int level = (int) Math.ceil((double) points / divisor);
|
final int level = (int) Math.ceil((double) points / divisor);
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskLater(this.plugin, () -> {
|
||||||
victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, points * 5, level));
|
victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, points * 5, level));
|
||||||
victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, points * 5, level));
|
victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, points * 5, level));
|
||||||
}, 1);
|
}, 1);
|
||||||
|
@ -5,6 +5,7 @@ import com.willfp.eco.core.proxy.proxies.CooldownProxy;
|
|||||||
import com.willfp.eco.util.VectorUtils;
|
import com.willfp.eco.util.VectorUtils;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
@ -3,6 +3,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
import com.willfp.eco.util.VectorUtils;
|
import com.willfp.eco.util.VectorUtils;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
@ -3,6 +3,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
import com.willfp.eco.util.DurabilityUtils;
|
import com.willfp.eco.util.DurabilityUtils;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||||
import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
|
import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
@ -3,6 +3,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
import com.willfp.eco.util.DurabilityUtils;
|
import com.willfp.eco.util.DurabilityUtils;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
import com.willfp.ecoenchants.enchantments.util.EnchantChecks;
|
||||||
import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
|
import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
|
|||||||
|
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
|
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Trident;
|
import org.bukkit.entity.Trident;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user