diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java index 8d9fe626..4079846d 100644 --- a/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -32,10 +32,8 @@ import net.Indyuce.mmocore.command.QuestsCommand; import net.Indyuce.mmocore.command.SkillsCommand; import net.Indyuce.mmocore.command.WaypointsCommand; import net.Indyuce.mmocore.command.WithdrawCommand; -import net.Indyuce.mmocore.comp.ShopKeepersEntityHandler; import net.Indyuce.mmocore.comp.citizens.CitizenInteractEventListener; import net.Indyuce.mmocore.comp.citizens.CitizensMMOLoader; -import net.Indyuce.mmocore.comp.entity.MyPetEntityHandler; import net.Indyuce.mmocore.comp.holograms.CMIPlugin; import net.Indyuce.mmocore.comp.holograms.HologramSupport; import net.Indyuce.mmocore.comp.holograms.HologramsPlugin; @@ -72,7 +70,6 @@ import net.Indyuce.mmocore.manager.ConfigItemManager; import net.Indyuce.mmocore.manager.ConfigManager; import net.Indyuce.mmocore.manager.CustomBlockManager; import net.Indyuce.mmocore.manager.DropTableManager; -import net.Indyuce.mmocore.manager.EntityManager; import net.Indyuce.mmocore.manager.ExperienceManager; import net.Indyuce.mmocore.manager.InventoryManager; import net.Indyuce.mmocore.manager.LootChestManager; @@ -119,7 +116,6 @@ public class MMOCore extends JavaPlugin { public final PartyManager partyManager = new PartyManager(); public final QuestManager questManager = new QuestManager(); public final ProfessionManager professionManager = new ProfessionManager(); - public final EntityManager entities = new EntityManager(); public final ExperienceManager experience = new ExperienceManager(); public final LootChestManager lootChests = new LootChestManager(); @@ -190,21 +186,11 @@ public class MMOCore extends JavaPlugin { getLogger().log(Level.INFO, "Hooked onto Holograms"); } - if (Bukkit.getPluginManager().getPlugin("ShopKeepers") != null) { - entities.registerHandler(new ShopKeepersEntityHandler()); - getLogger().log(Level.INFO, "Hooked onto ShopKeepers"); - } - if (Bukkit.getPluginManager().getPlugin("MythicMobs") != null) { Bukkit.getServer().getPluginManager().registerEvents(new MythicMobsDrops(), this); MMOCore.plugin.getLogger().log(Level.INFO, "Hooked onto MythicMobs"); } - if (Bukkit.getPluginManager().getPlugin("MyPet") != null) { - entities.registerHandler(new MyPetEntityHandler()); - getLogger().log(Level.INFO, "Hooked onto MyPet"); - } - /* * resource regeneration. must check if entity is dead otherwise regen * will make the 'respawn' button glitched plus HURT entity effect bug diff --git a/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java b/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java index 28c10bfb..a637ca6a 100644 --- a/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java +++ b/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java @@ -19,7 +19,6 @@ import org.bukkit.util.io.BukkitObjectInputStream; import org.bukkit.util.io.BukkitObjectOutputStream; import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder; -import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; import net.mmogroup.mmolib.MMOLib; import net.mmogroup.mmolib.version.VersionMaterial; @@ -153,7 +152,7 @@ public class MMOCoreUtils { public static boolean canTarget(PlayerData player, Entity target) { // basic checks - if (!(target instanceof LivingEntity) || player.getPlayer().equals(target) || target.isDead() || MMOCore.plugin.entities.findCustom(target)) + if (!(target instanceof LivingEntity) || player.getPlayer().equals(target) || target.isDead() || MMOLib.plugin.getEntities().findCustom(target)) return false; // party check diff --git a/src/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEventListener.java b/src/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEventListener.java index 991656b9..07f4d0ac 100644 --- a/src/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEventListener.java +++ b/src/main/java/net/Indyuce/mmocore/comp/citizens/CitizenInteractEventListener.java @@ -6,19 +6,9 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerInteractEntityEvent; -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.comp.entity.EntityHandler; import net.citizensnpcs.api.CitizensAPI; -public class CitizenInteractEventListener implements Listener, EntityHandler { - - public CitizenInteractEventListener() { - - /* - * prevents NPCs from being skill targets. - */ - MMOCore.plugin.entities.registerHandler(this); - } +public class CitizenInteractEventListener implements Listener { @EventHandler public void a(PlayerInteractEntityEvent event) { @@ -26,9 +16,4 @@ public class CitizenInteractEventListener implements Listener, EntityHandler { if (CitizensAPI.getNPCRegistry().isNPC(entity)) Bukkit.getPluginManager().callEvent(new CitizenInteractEvent(event.getPlayer(), CitizensAPI.getNPCRegistry().getNPC(entity))); } - - @Override - public boolean isCustomEntity(Entity entity) { - return entity.hasMetadata("NPC"); - } } diff --git a/src/main/java/net/Indyuce/mmocore/manager/EntityManager.java b/src/main/java/net/Indyuce/mmocore/manager/EntityManager.java deleted file mode 100644 index 6aecfeaa..00000000 --- a/src/main/java/net/Indyuce/mmocore/manager/EntityManager.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.Indyuce.mmocore.manager; - -import java.util.ArrayList; -import java.util.List; - -import org.bukkit.entity.Entity; - -import net.Indyuce.mmocore.comp.entity.EntityHandler; - -public class EntityManager { - public final List handlers = new ArrayList<>(); - - public void registerHandler(EntityHandler handler) { - handlers.add(handler); - } - - /* - * determines if an entity is from another plugin and therefore cannot be - * target of skill or attack - */ - public boolean findCustom(Entity entity) { - - for (EntityHandler handler : handlers) - if (handler.isCustomEntity(entity)) - return true; - - return false; - } -}