From a0fe858bfa2803d8efce6ac8817125094231b0ae Mon Sep 17 00:00:00 2001 From: Alex 'mcmonkey' Goodwin Date: Wed, 13 Jan 2021 09:12:44 -0800 Subject: [PATCH] remove very old deprecated EntityInfected This has been deprecated for years, and was missed from the deprecations list by accident --- .../objects/properties/PropertyRegistry.java | 1 - .../properties/entity/EntityInfected.java | 115 ------------------ 2 files changed, 116 deletions(-) delete mode 100644 plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityInfected.java diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/PropertyRegistry.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/PropertyRegistry.java index fddb1f85d2..e348d200ff 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/PropertyRegistry.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/PropertyRegistry.java @@ -64,7 +64,6 @@ public static void registermainProperties() { if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_16)) { PropertyParser.registerProperty(EntityImmune.class, EntityTag.class); } - PropertyParser.registerProperty(EntityInfected.class, EntityTag.class); PropertyParser.registerProperty(EntityInventory.class, EntityTag.class); PropertyParser.registerProperty(EntityIsShowingBottom.class, EntityTag.class); PropertyParser.registerProperty(EntityItem.class, EntityTag.class); diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityInfected.java b/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityInfected.java deleted file mode 100644 index eb0ea5c493..0000000000 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/properties/entity/EntityInfected.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.denizenscript.denizen.objects.properties.entity; - -import com.denizenscript.denizen.utilities.debugging.Debug; -import com.denizenscript.denizen.objects.EntityTag; -import com.denizenscript.denizencore.objects.core.ElementTag; -import com.denizenscript.denizencore.objects.Mechanism; -import com.denizenscript.denizencore.objects.ObjectTag; -import com.denizenscript.denizencore.objects.properties.Property; -import com.denizenscript.denizencore.tags.Attribute; -import net.citizensnpcs.api.npc.NPC; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Zombie; -import org.bukkit.entity.ZombieVillager; - -public class EntityInfected implements Property { - - public static boolean describes(ObjectTag entity) { - if (!(entity instanceof EntityTag)) { - return false; - } - // Check if a Villager or Zombie -- the only two EntityTypes that can be 'infected' - return ((EntityTag) entity).getBukkitEntityType() == EntityType.ZOMBIE - || ((EntityTag) entity).getBukkitEntityType() == EntityType.VILLAGER; - } - - public static EntityInfected getFrom(ObjectTag entity) { - if (!describes(entity)) { - return null; - } - else { - return new EntityInfected((EntityTag) entity); - } - } - - public static final String[] handledTags = new String[] { - "is_infected" - }; - - public static final String[] handledMechs = new String[] { - "is_infected" - }; - - private EntityInfected(EntityTag item) { - infected = item; - } - - EntityTag infected; - - public boolean isInfected() { - return infected.getBukkitEntity() instanceof Zombie - && infected.getBukkitEntityType() == EntityType.ZOMBIE_VILLAGER; - } - - public void setInfected(boolean bool) { - - if (bool) { - if (infected.isCitizensNPC()) { - NPC infected_npc = infected.getDenizenNPC().getCitizen(); - infected_npc.setBukkitEntityType(EntityType.ZOMBIE_VILLAGER); - } - LivingEntity entity = infected.getLivingEntity(); - // Make a new entity - ZombieVillager infect = (ZombieVillager) entity.getLocation().getWorld().spawnEntity(infected.getLocation(), EntityType.ZOMBIE_VILLAGER); - // Set health - infect.setHealth(entity.getHealth()); - // Set equipment - infect.getEquipment().setArmorContents(entity.getEquipment().getArmorContents()); - // Remove the Villager - entity.remove(); - // Set the EntityTag to the new entity - infected.setEntity(infect); - } - } - - @Override - public String getPropertyString() { - if (isInfected()) { - return "true"; - } - else { - return null; - } - } - - @Override - public String getPropertyId() { - return "infected"; - } - - @Override - public ObjectTag getObjectAttribute(Attribute attribute) { - - if (attribute == null) { - return null; - } - - if (attribute.startsWith("is_infected")) { - Debug.echoError("Different infection types are represented by different entity types. Please remove usage of the 'is_infected' tag."); - return new ElementTag(isInfected()) - .getObjectAttribute(attribute.fulfill(1)); - } - - return null; - } - - @Override - public void adjust(Mechanism mechanism) { - - if (mechanism.matches("is_infected") && mechanism.requireBoolean()) { - Debug.echoError("Different infection types are represented by different entity types. Please remove usage of the 'is_infected' mechanism."); - setInfected(mechanism.getValue().asBoolean()); - } - } -}