diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/BatController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/BatController.java index 7331e5913..5025dd191 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/BatController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/BatController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Bat; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class BatController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/BlazeController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/BlazeController.java index e37ec1315..12fb12b8d 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/BlazeController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/BlazeController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Blaze; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -96,24 +95,10 @@ public class BlazeController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/CaveSpiderController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/CaveSpiderController.java index 1af53bd95..6b635b6ba 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/CaveSpiderController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/CaveSpiderController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.CaveSpider; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -112,24 +111,10 @@ public class CaveSpiderController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/ChickenController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/ChickenController.java index 88b7a5829..4fdc23862 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/ChickenController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/ChickenController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Chicken; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -123,24 +122,10 @@ public class ChickenController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/CowController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/CowController.java index 2fe7202d8..977300dd4 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/CowController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/CowController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Cow; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -139,24 +138,10 @@ public class CowController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/CreeperController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/CreeperController.java index eff0788fe..1cc0d0546 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/CreeperController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/CreeperController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Creeper; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -123,25 +122,10 @@ public class CreeperController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.g(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/EnderDragonController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/EnderDragonController.java index d95d57527..0d97ff734 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/EnderDragonController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/EnderDragonController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.EnderDragon; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -95,24 +94,10 @@ public class EnderDragonController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/EndermanController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/EndermanController.java index d5483c93a..ebedc8427 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/EndermanController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/EndermanController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Enderman; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -111,24 +110,10 @@ public class EndermanController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/EndermiteController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/EndermiteController.java index 26dec1d24..9b1102f7f 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/EndermiteController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/EndermiteController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Endermite; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -111,24 +110,10 @@ public class EndermiteController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/EntityHumanNPC.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/EntityHumanNPC.java index 064dbe124..c076ca1ef 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/EntityHumanNPC.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/EntityHumanNPC.java @@ -20,7 +20,6 @@ import com.mojang.authlib.GameProfile; import net.citizensnpcs.Settings.Setting; import net.citizensnpcs.api.CitizensAPI; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.trait.trait.Inventory; import net.citizensnpcs.nms.v1_10_R1.network.EmptyNetHandler; @@ -173,25 +172,10 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.g(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/GhastController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/GhastController.java index 43e5af70d..1bb4f991e 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/GhastController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/GhastController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Ghast; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -87,24 +86,10 @@ public class GhastController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/GiantController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/GiantController.java index 19450bf70..654566781 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/GiantController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/GiantController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Giant; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class GiantController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/GuardianController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/GuardianController.java index f2a9673a7..4be68c12f 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/GuardianController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/GuardianController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Guardian; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -98,24 +97,10 @@ public class GuardianController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/HorseController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/HorseController.java index 19724868d..daccc7df4 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/HorseController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/HorseController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Horse; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -127,24 +126,10 @@ public class HorseController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/IronGolemController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/IronGolemController.java index 1dd1e3cef..a0af6a558 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/IronGolemController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/IronGolemController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.IronGolem; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class IronGolemController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/MagmaCubeController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/MagmaCubeController.java index 5fcb76d48..a71e86bd2 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/MagmaCubeController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/MagmaCubeController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.MagmaCube; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.nms.v1_10_R1.util.PlayerControllerMove; @@ -108,24 +107,10 @@ public class MagmaCubeController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/MushroomCowController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/MushroomCowController.java index a9f6996c0..ab1ec441e 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/MushroomCowController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/MushroomCowController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.MushroomCow; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -119,24 +118,10 @@ public class MushroomCowController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/OcelotController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/OcelotController.java index c2fc564ca..20ca3795d 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/OcelotController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/OcelotController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Ocelot; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -115,24 +114,10 @@ public class OcelotController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/PigController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/PigController.java index ee0a0175a..ac2f10b9e 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/PigController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/PigController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Pig; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -118,24 +117,10 @@ public class PigController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/PigZombieController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/PigZombieController.java index 666d25ab8..90d8e8089 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/PigZombieController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/PigZombieController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.PigZombie; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -98,25 +97,10 @@ public class PigZombieController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.g(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/PolarBearController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/PolarBearController.java index fe4e4ff50..00bc3ae24 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/PolarBearController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/PolarBearController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.PolarBear; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -93,24 +92,10 @@ public class PolarBearController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/RabbitController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/RabbitController.java index a18094995..c11a91bb4 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/RabbitController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/RabbitController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Rabbit; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -110,24 +109,10 @@ public class RabbitController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SheepController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SheepController.java index 60e74ac40..7cfa3fb07 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SheepController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SheepController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Sheep; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -108,24 +107,10 @@ public class SheepController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/ShulkerController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/ShulkerController.java index 83b147973..3c3fa9ea7 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/ShulkerController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/ShulkerController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Shulker; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -98,24 +97,10 @@ public class ShulkerController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SilverfishController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SilverfishController.java index f6803546f..1ef92d001 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SilverfishController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SilverfishController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Silverfish; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class SilverfishController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SkeletonController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SkeletonController.java index a616b5b6b..0fd7ed504 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SkeletonController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SkeletonController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Skeleton; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class SkeletonController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SlimeController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SlimeController.java index 5cf68fddf..f82e280a6 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SlimeController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SlimeController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Slime; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.nms.v1_10_R1.util.PlayerControllerMove; @@ -109,24 +108,10 @@ public class SlimeController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SnowmanController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SnowmanController.java index 1ecde660e..49b6b4d86 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SnowmanController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SnowmanController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Snowman; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class SnowmanController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SpiderController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SpiderController.java index daca055c0..718d21ce5 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SpiderController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SpiderController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Spider; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class SpiderController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SquidController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SquidController.java index ba69f6ab6..4e835d6bd 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SquidController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/SquidController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Squid; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class SquidController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/VillagerController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/VillagerController.java index 027da1e94..f0a54fc40 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/VillagerController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/VillagerController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Villager; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -16,6 +15,7 @@ import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; import net.minecraft.server.v1_10_R1.BlockPosition; import net.minecraft.server.v1_10_R1.EntityHuman; +import net.minecraft.server.v1_10_R1.EntityLightning; import net.minecraft.server.v1_10_R1.EntityVillager; import net.minecraft.server.v1_10_R1.EnumHand; import net.minecraft.server.v1_10_R1.IBlockData; @@ -23,7 +23,6 @@ import net.minecraft.server.v1_10_R1.ItemStack; import net.minecraft.server.v1_10_R1.NBTTagCompound; import net.minecraft.server.v1_10_R1.SoundEffect; import net.minecraft.server.v1_10_R1.World; -import net.minecraft.server.v1_10_R1.EntityLightning; public class VillagerController extends MobEntityController { public VillagerController() { @@ -132,24 +131,10 @@ public class VillagerController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/WitchController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/WitchController.java index 7c33e17ef..9a4c32c8d 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/WitchController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/WitchController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Witch; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class WitchController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/WitherController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/WitherController.java index 91f72db44..091e5acda 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/WitherController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/WitherController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Wither; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -81,24 +80,10 @@ public class WitherController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/WolfController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/WolfController.java index b9619d8e7..9f62b874d 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/WolfController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/WolfController.java @@ -9,7 +9,6 @@ import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -111,24 +110,10 @@ public class WolfController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/ZombieController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/ZombieController.java index c604562c0..a844bb78d 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/ZombieController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/ZombieController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Zombie; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class ZombieController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/AreaEffectCloudController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/AreaEffectCloudController.java index 09c7e54a4..343fd406d 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/AreaEffectCloudController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/AreaEffectCloudController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; import org.bukkit.entity.AreaEffectCloud; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -70,24 +69,10 @@ public class AreaEffectCloudController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ArmorStandController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ArmorStandController.java index 794d1003f..286820c61 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ArmorStandController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ArmorStandController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; @@ -89,24 +88,10 @@ public class ArmorStandController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/BoatController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/BoatController.java index 231bc6563..4cbab3dfc 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/BoatController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/BoatController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; import org.bukkit.entity.Boat; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; @@ -71,24 +70,10 @@ public class BoatController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/DragonFireballController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/DragonFireballController.java index 90c159001..94ffc0d17 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/DragonFireballController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/DragonFireballController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; import org.bukkit.entity.DragonFireball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; @@ -71,24 +70,10 @@ public class DragonFireballController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/EggController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/EggController.java index 34ef8c2b4..39b560b1f 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/EggController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/EggController.java @@ -1,16 +1,5 @@ package net.citizensnpcs.nms.v1_10_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; -import net.citizensnpcs.api.npc.NPC; -import net.citizensnpcs.npc.AbstractEntityController; -import net.citizensnpcs.npc.CitizensNPC; -import net.citizensnpcs.npc.ai.NPCHolder; -import net.citizensnpcs.util.Util; -import net.minecraft.server.v1_10_R1.EntityEgg; -import net.minecraft.server.v1_10_R1.NBTTagCompound; -import net.minecraft.server.v1_10_R1.World; -import net.minecraft.server.v1_10_R1.WorldServer; - import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_10_R1.CraftServer; @@ -21,6 +10,16 @@ import org.bukkit.entity.Egg; import org.bukkit.entity.Entity; import org.bukkit.util.Vector; +import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.npc.AbstractEntityController; +import net.citizensnpcs.npc.CitizensNPC; +import net.citizensnpcs.npc.ai.NPCHolder; +import net.citizensnpcs.util.Util; +import net.minecraft.server.v1_10_R1.EntityEgg; +import net.minecraft.server.v1_10_R1.NBTTagCompound; +import net.minecraft.server.v1_10_R1.World; +import net.minecraft.server.v1_10_R1.WorldServer; + public class EggController extends AbstractEntityController { public EggController() { super(EntityEggNPC.class); @@ -86,24 +85,10 @@ public class EggController extends AbstractEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/EnderCrystalController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/EnderCrystalController.java index 8e196d48f..602fde13c 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/EnderCrystalController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/EnderCrystalController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_10_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_10_R1.CraftServer; +import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEnderCrystal; +import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; +import org.bukkit.entity.EnderCrystal; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_10_R1.EntityEnderCrystal; import net.minecraft.server.v1_10_R1.NBTTagCompound; import net.minecraft.server.v1_10_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_10_R1.CraftServer; -import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEnderCrystal; -import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; -import org.bukkit.entity.EnderCrystal; -import org.bukkit.util.Vector; - public class EnderCrystalController extends MobEntityController { public EnderCrystalController() { super(EntityEnderCrystalNPC.class); @@ -70,24 +69,10 @@ public class EnderCrystalController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/EnderPearlController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/EnderPearlController.java index 0649336a1..185f04e29 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/EnderPearlController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/EnderPearlController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; import org.bukkit.entity.EnderPearl; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -70,24 +69,10 @@ public class EnderPearlController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/EnderSignalController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/EnderSignalController.java index fc237f114..dace808a5 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/EnderSignalController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/EnderSignalController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_10_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_10_R1.CraftServer; +import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEnderSignal; +import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; +import org.bukkit.entity.EnderSignal; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_10_R1.EntityEnderSignal; import net.minecraft.server.v1_10_R1.NBTTagCompound; import net.minecraft.server.v1_10_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_10_R1.CraftServer; -import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEnderSignal; -import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; -import org.bukkit.entity.EnderSignal; -import org.bukkit.util.Vector; - public class EnderSignalController extends MobEntityController { public EnderSignalController() { super(EntityEnderSignalNPC.class); @@ -70,24 +69,10 @@ public class EnderSignalController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ExperienceOrbController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ExperienceOrbController.java index e6417ceef..8e63cd0c2 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ExperienceOrbController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ExperienceOrbController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_10_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_10_R1.CraftServer; +import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_10_R1.entity.CraftExperienceOrb; +import org.bukkit.entity.ExperienceOrb; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_10_R1.EntityExperienceOrb; import net.minecraft.server.v1_10_R1.NBTTagCompound; import net.minecraft.server.v1_10_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_10_R1.CraftServer; -import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_10_R1.entity.CraftExperienceOrb; -import org.bukkit.entity.ExperienceOrb; -import org.bukkit.util.Vector; - public class ExperienceOrbController extends MobEntityController { public ExperienceOrbController() { super(EntityExperienceOrbNPC.class); @@ -56,24 +55,10 @@ public class ExperienceOrbController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/FallingBlockController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/FallingBlockController.java index 85fbac90d..938530d48 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/FallingBlockController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/FallingBlockController.java @@ -13,7 +13,6 @@ import org.bukkit.entity.FallingBlock; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; @@ -87,24 +86,10 @@ public class FallingBlockController extends AbstractEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/FireworkController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/FireworkController.java index 8e3b7faf6..370377f7e 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/FireworkController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/FireworkController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_10_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_10_R1.CraftServer; +import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_10_R1.entity.CraftFirework; +import org.bukkit.entity.Firework; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_10_R1.EntityFireworks; import net.minecraft.server.v1_10_R1.NBTTagCompound; import net.minecraft.server.v1_10_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_10_R1.CraftServer; -import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_10_R1.entity.CraftFirework; -import org.bukkit.entity.Firework; -import org.bukkit.util.Vector; - public class FireworkController extends MobEntityController { public FireworkController() { super(EntityFireworkNPC.class); @@ -56,24 +55,10 @@ public class FireworkController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/FishingHookController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/FishingHookController.java index f64ca89c2..0732871ed 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/FishingHookController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/FishingHookController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_10_R1.entity.CraftFish; import org.bukkit.entity.FishHook; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -56,24 +55,10 @@ public class FishingHookController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ItemController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ItemController.java index f96590cf7..6b5b1abff 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ItemController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ItemController.java @@ -13,7 +13,6 @@ import org.bukkit.entity.Item; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.AbstractEntityController; @@ -87,24 +86,10 @@ public class ItemController extends AbstractEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ItemFrameController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ItemFrameController.java index 91d46d1e0..a6007d013 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ItemFrameController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ItemFrameController.java @@ -11,7 +11,6 @@ import org.bukkit.entity.ItemFrame; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; @@ -72,24 +71,10 @@ public class ItemFrameController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/LargeFireballController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/LargeFireballController.java index e18450a59..6240f9375 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/LargeFireballController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/LargeFireballController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_10_R1.entity.CraftLargeFireball; import org.bukkit.entity.LargeFireball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; @@ -57,24 +56,10 @@ public class LargeFireballController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/LeashController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/LeashController.java index 239434c7a..e9b28a06e 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/LeashController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/LeashController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_10_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_10_R1.CraftServer; +import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_10_R1.entity.CraftLeash; +import org.bukkit.entity.LeashHitch; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_10_R1.EntityLeash; import net.minecraft.server.v1_10_R1.NBTTagCompound; import net.minecraft.server.v1_10_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_10_R1.CraftServer; -import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_10_R1.entity.CraftLeash; -import org.bukkit.entity.LeashHitch; -import org.bukkit.util.Vector; - public class LeashController extends MobEntityController { public LeashController() { super(EntityLeashNPC.class); @@ -56,24 +55,10 @@ public class LeashController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartChestController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartChestController.java index 084d74aaa..1fbbacc95 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartChestController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartChestController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_10_R1.entity.CraftMinecartChest; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; @@ -57,24 +56,10 @@ public class MinecartChestController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartCommandController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartCommandController.java index da90746c0..d61f0aa93 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartCommandController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartCommandController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_10_R1.entity.CraftMinecartCommand; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; @@ -57,24 +56,10 @@ public class MinecartCommandController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartFurnaceController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartFurnaceController.java index 246506a64..f7216533b 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartFurnaceController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartFurnaceController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_10_R1.entity.CraftMinecartFurnace; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; @@ -57,24 +56,10 @@ public class MinecartFurnaceController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartHopperController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartHopperController.java index d54018c44..5c24557fb 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartHopperController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartHopperController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_10_R1.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; @@ -53,24 +52,10 @@ public class MinecartHopperController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartRideableController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartRideableController.java index a29d4b971..3c9fde03b 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartRideableController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartRideableController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_10_R1.entity.CraftMinecartRideable; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; @@ -57,24 +56,10 @@ public class MinecartRideableController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartSpawnerController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartSpawnerController.java index 8c591d1d7..f0f9de980 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartSpawnerController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartSpawnerController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_10_R1.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; @@ -53,24 +52,10 @@ public class MinecartSpawnerController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartTNTController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartTNTController.java index 9aa133da2..9ebdce06a 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartTNTController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/MinecartTNTController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_10_R1.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_10_R1.util.NMSImpl; @@ -53,24 +52,10 @@ public class MinecartTNTController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/PaintingController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/PaintingController.java index 432ddaa43..25ad11857 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/PaintingController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/PaintingController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_10_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_10_R1.CraftServer; +import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPainting; +import org.bukkit.entity.Painting; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_10_R1.EntityPainting; import net.minecraft.server.v1_10_R1.NBTTagCompound; import net.minecraft.server.v1_10_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_10_R1.CraftServer; -import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPainting; -import org.bukkit.entity.Painting; -import org.bukkit.util.Vector; - public class PaintingController extends MobEntityController { public PaintingController() { super(EntityPaintingNPC.class); @@ -56,24 +55,10 @@ public class PaintingController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ShulkerBulletController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ShulkerBulletController.java index 6a4528b42..22f6f439c 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ShulkerBulletController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ShulkerBulletController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_10_R1.entity.CraftShulkerBullet; import org.bukkit.entity.ShulkerBullet; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -56,24 +55,10 @@ public class ShulkerBulletController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/SmallFireballController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/SmallFireballController.java index f5a3cdd29..4c7a11ef7 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/SmallFireballController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/SmallFireballController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_10_R1.entity.CraftSmallFireball; import org.bukkit.entity.SmallFireball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -56,24 +55,10 @@ public class SmallFireballController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/SnowballController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/SnowballController.java index 0471dfa4b..4a9f86cc4 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/SnowballController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/SnowballController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_10_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_10_R1.CraftServer; +import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_10_R1.entity.CraftSnowball; +import org.bukkit.entity.Snowball; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_10_R1.EntitySnowball; import net.minecraft.server.v1_10_R1.NBTTagCompound; import net.minecraft.server.v1_10_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_10_R1.CraftServer; -import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_10_R1.entity.CraftSnowball; -import org.bukkit.entity.Snowball; -import org.bukkit.util.Vector; - public class SnowballController extends MobEntityController { public SnowballController() { super(EntitySnowballNPC.class); @@ -70,24 +69,10 @@ public class SnowballController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/SpectralArrowController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/SpectralArrowController.java index b318c3ca3..99994fb53 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/SpectralArrowController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/SpectralArrowController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; import org.bukkit.entity.Arrow; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -56,24 +55,10 @@ public class SpectralArrowController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/TNTPrimedController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/TNTPrimedController.java index 7804e105d..3a350e2ad 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/TNTPrimedController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/TNTPrimedController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_10_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_10_R1.CraftServer; +import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_10_R1.entity.CraftTNTPrimed; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_10_R1.EntityTNTPrimed; import net.minecraft.server.v1_10_R1.NBTTagCompound; import net.minecraft.server.v1_10_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_10_R1.CraftServer; -import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_10_R1.entity.CraftTNTPrimed; -import org.bukkit.entity.TNTPrimed; -import org.bukkit.util.Vector; - public class TNTPrimedController extends MobEntityController { public TNTPrimedController() { super(EntityTNTPrimedNPC.class); @@ -56,24 +55,10 @@ public class TNTPrimedController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ThrownExpBottleController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ThrownExpBottleController.java index eef6c2198..01cd70d16 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ThrownExpBottleController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ThrownExpBottleController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_10_R1.entity.CraftThrownExpBottle; import org.bukkit.entity.ThrownExpBottle; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -56,24 +55,10 @@ public class ThrownExpBottleController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ThrownPotionController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ThrownPotionController.java index 0d06f994e..7cb43922f 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ThrownPotionController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/ThrownPotionController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_10_R1.entity.CraftLingeringPotion; import org.bukkit.entity.ThrownPotion; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -57,24 +56,10 @@ public class ThrownPotionController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/TippedArrowController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/TippedArrowController.java index 466d4a8ad..2477e3ddf 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/TippedArrowController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/TippedArrowController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_10_R1.entity.CraftTippedArrow; import org.bukkit.entity.Arrow; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -56,24 +55,10 @@ public class TippedArrowController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/WitherSkullController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/WitherSkullController.java index 038d4fd54..7fa5e9ebd 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/WitherSkullController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/nonliving/WitherSkullController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_10_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_10_R1.CraftServer; +import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_10_R1.entity.CraftWitherSkull; +import org.bukkit.entity.WitherSkull; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_10_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_10_R1.EntityWitherSkull; import net.minecraft.server.v1_10_R1.NBTTagCompound; import net.minecraft.server.v1_10_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_10_R1.CraftServer; -import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_10_R1.entity.CraftWitherSkull; -import org.bukkit.entity.WitherSkull; -import org.bukkit.util.Vector; - public class WitherSkullController extends MobEntityController { public WitherSkullController() { super(EntityWitherSkullNPC.class); @@ -56,24 +55,10 @@ public class WitherSkullController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/BatController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/BatController.java index 1cc6bf7cc..c3d5355c1 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/BatController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/BatController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Bat; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class BatController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/BlazeController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/BlazeController.java index 48f3727a5..8b8792fd8 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/BlazeController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/BlazeController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Blaze; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -96,24 +95,10 @@ public class BlazeController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/CaveSpiderController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/CaveSpiderController.java index 97a679146..a24c9ac2b 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/CaveSpiderController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/CaveSpiderController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.CaveSpider; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -112,24 +111,10 @@ public class CaveSpiderController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/ChickenController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/ChickenController.java index bf4694624..5f717ee88 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/ChickenController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/ChickenController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Chicken; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -123,24 +122,10 @@ public class ChickenController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/CowController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/CowController.java index 815fd00f4..14bdbb8b8 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/CowController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/CowController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Cow; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -139,24 +138,10 @@ public class CowController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/CreeperController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/CreeperController.java index 8598e4557..d57cb5ff7 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/CreeperController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/CreeperController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Creeper; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -113,25 +112,10 @@ public class CreeperController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.f(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EnderDragonController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EnderDragonController.java index bc33be278..823267c37 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EnderDragonController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EnderDragonController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.EnderDragon; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -95,24 +94,10 @@ public class EnderDragonController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EndermanController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EndermanController.java index 006fcf0d3..f1ede0ace 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EndermanController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EndermanController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Enderman; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -111,24 +110,10 @@ public class EndermanController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EndermiteController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EndermiteController.java index 292ece8bb..cb7ec5f8f 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EndermiteController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EndermiteController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Endermite; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -111,24 +110,10 @@ public class EndermiteController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EntityHumanNPC.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EntityHumanNPC.java index b4871aed3..8953a8a55 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EntityHumanNPC.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EntityHumanNPC.java @@ -20,7 +20,6 @@ import com.mojang.authlib.GameProfile; import net.citizensnpcs.Settings.Setting; import net.citizensnpcs.api.CitizensAPI; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.trait.trait.Inventory; import net.citizensnpcs.nms.v1_11_R1.network.EmptyNetHandler; @@ -196,25 +195,10 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.f(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EvokerController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EvokerController.java index bb68b2009..fba6bbb02 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EvokerController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/EvokerController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Evoker; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -98,24 +97,10 @@ public class EvokerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/GhastController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/GhastController.java index 2af749a93..e29771470 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/GhastController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/GhastController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Ghast; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -87,24 +86,10 @@ public class GhastController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/GiantController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/GiantController.java index ab180bf96..ef6c8d78d 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/GiantController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/GiantController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Giant; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class GiantController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/GuardianController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/GuardianController.java index efefee82d..d9b02ff6f 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/GuardianController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/GuardianController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Guardian; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -98,24 +97,10 @@ public class GuardianController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/GuardianElderController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/GuardianElderController.java index 96c3889f6..ec1c65388 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/GuardianElderController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/GuardianElderController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.ElderGuardian; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -98,24 +97,10 @@ public class GuardianElderController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HorseController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HorseController.java index e3383fca5..b98c27633 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HorseController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HorseController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Horse; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -119,24 +118,10 @@ public class HorseController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HorseDonkeyController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HorseDonkeyController.java index 03a70563a..4f2814d78 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HorseDonkeyController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HorseDonkeyController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Donkey; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -119,24 +118,10 @@ public class HorseDonkeyController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HorseMuleController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HorseMuleController.java index a339d3628..8c9f3b3fa 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HorseMuleController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HorseMuleController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Mule; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -119,24 +118,10 @@ public class HorseMuleController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HorseSkeletonController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HorseSkeletonController.java index c87e9eaf7..d8261b609 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HorseSkeletonController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HorseSkeletonController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.SkeletonHorse; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -120,24 +119,10 @@ public class HorseSkeletonController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HorseZombieController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HorseZombieController.java index 850587662..3399d3b91 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HorseZombieController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/HorseZombieController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.ZombieHorse; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -120,24 +119,10 @@ public class HorseZombieController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/IronGolemController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/IronGolemController.java index c94a76343..2ce37fa04 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/IronGolemController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/IronGolemController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.IronGolem; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class IronGolemController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/LlamaController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/LlamaController.java index d8271a24e..f425e1ab6 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/LlamaController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/LlamaController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Llama; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -119,24 +118,10 @@ public class LlamaController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/MagmaCubeController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/MagmaCubeController.java index 785571d22..376a6f0e1 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/MagmaCubeController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/MagmaCubeController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.MagmaCube; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.nms.v1_11_R1.util.PlayerControllerMove; @@ -116,24 +115,10 @@ public class MagmaCubeController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/MushroomCowController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/MushroomCowController.java index 5a5fcad5e..089d6fda9 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/MushroomCowController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/MushroomCowController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.MushroomCow; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -118,24 +117,10 @@ public class MushroomCowController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/OcelotController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/OcelotController.java index 52bf431f4..901e9a3a7 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/OcelotController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/OcelotController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Ocelot; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -115,24 +114,10 @@ public class OcelotController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/PigController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/PigController.java index d11a8dc2b..312fa6c37 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/PigController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/PigController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Pig; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -116,24 +115,10 @@ public class PigController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/PigZombieController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/PigZombieController.java index e0c687af1..94060855d 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/PigZombieController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/PigZombieController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.PigZombie; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -98,25 +97,10 @@ public class PigZombieController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.f(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/PolarBearController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/PolarBearController.java index 54369034f..52437acda 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/PolarBearController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/PolarBearController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.PolarBear; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -93,24 +92,10 @@ public class PolarBearController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/RabbitController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/RabbitController.java index fa8749f89..41224b424 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/RabbitController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/RabbitController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Rabbit; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -110,24 +109,10 @@ public class RabbitController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SheepController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SheepController.java index ff14adde7..a52d56100 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SheepController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SheepController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Sheep; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -108,24 +107,10 @@ public class SheepController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/ShulkerController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/ShulkerController.java index 650b4d47b..bb8f9ee4a 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/ShulkerController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/ShulkerController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Shulker; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -108,24 +107,10 @@ public class ShulkerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SilverfishController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SilverfishController.java index 7f2ed6edf..237a0ef23 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SilverfishController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SilverfishController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Silverfish; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class SilverfishController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SkeletonController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SkeletonController.java index 05bbb70a4..b1edc0cb8 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SkeletonController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SkeletonController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Skeleton; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class SkeletonController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SkeletonStrayController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SkeletonStrayController.java index f6b0e2af6..8ba52687c 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SkeletonStrayController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SkeletonStrayController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Stray; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class SkeletonStrayController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SkeletonWitherController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SkeletonWitherController.java index 9222425a1..fa4252feb 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SkeletonWitherController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SkeletonWitherController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.WitherSkeleton; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class SkeletonWitherController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SlimeController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SlimeController.java index c2dc626ee..27e9abfbc 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SlimeController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SlimeController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Slime; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.nms.v1_11_R1.util.PlayerControllerMove; @@ -117,24 +116,10 @@ public class SlimeController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SnowmanController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SnowmanController.java index c76150537..988ca4313 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SnowmanController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SnowmanController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Snowman; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class SnowmanController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SpiderController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SpiderController.java index b2fbce9eb..5fac9c3bf 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SpiderController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SpiderController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Spider; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class SpiderController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SquidController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SquidController.java index 492c44362..c78613712 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SquidController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/SquidController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Squid; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class SquidController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/VexController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/VexController.java index d4a3edfa7..96ef75f31 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/VexController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/VexController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Vex; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -83,24 +82,10 @@ public class VexController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/VillagerController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/VillagerController.java index 8236ae845..e407f961c 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/VillagerController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/VillagerController.java @@ -10,7 +10,6 @@ import org.bukkit.entity.Villager; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -18,6 +17,7 @@ import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; import net.minecraft.server.v1_11_R1.BlockPosition; import net.minecraft.server.v1_11_R1.EntityHuman; +import net.minecraft.server.v1_11_R1.EntityLightning; import net.minecraft.server.v1_11_R1.EntityVillager; import net.minecraft.server.v1_11_R1.EnumHand; import net.minecraft.server.v1_11_R1.IBlockData; @@ -25,7 +25,6 @@ import net.minecraft.server.v1_11_R1.MerchantRecipe; import net.minecraft.server.v1_11_R1.NBTTagCompound; import net.minecraft.server.v1_11_R1.SoundEffect; import net.minecraft.server.v1_11_R1.World; -import net.minecraft.server.v1_11_R1.EntityLightning; public class VillagerController extends MobEntityController { public VillagerController() { @@ -138,24 +137,10 @@ public class VillagerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/VindicatorController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/VindicatorController.java index 63c579ea6..94669fce2 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/VindicatorController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/VindicatorController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Vindicator; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -109,24 +108,10 @@ public class VindicatorController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/WitchController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/WitchController.java index 838eae70f..87ba81fe1 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/WitchController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/WitchController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Witch; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class WitchController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/WitherController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/WitherController.java index c5f0815ff..1e801b6fe 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/WitherController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/WitherController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Wither; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -81,24 +80,10 @@ public class WitherController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/WolfController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/WolfController.java index b764124d7..f458590d5 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/WolfController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/WolfController.java @@ -9,7 +9,6 @@ import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -111,24 +110,10 @@ public class WolfController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/ZombieController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/ZombieController.java index d428f7d4c..c65d49d10 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/ZombieController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/ZombieController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Zombie; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class ZombieController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/ZombieHuskController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/ZombieHuskController.java index 6f3c036e1..a20d82421 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/ZombieHuskController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/ZombieHuskController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Husk; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class ZombieHuskController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/ZombieVillagerController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/ZombieVillagerController.java index 186cb9b45..9eb38d4ae 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/ZombieVillagerController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/ZombieVillagerController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.ZombieVillager; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class ZombieVillagerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/AreaEffectCloudController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/AreaEffectCloudController.java index 3a8f33a26..966c0ab97 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/AreaEffectCloudController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/AreaEffectCloudController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity; import org.bukkit.entity.AreaEffectCloud; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -79,24 +78,10 @@ public class AreaEffectCloudController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ArmorStandController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ArmorStandController.java index 6b22cafea..7dc27a5af 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ArmorStandController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ArmorStandController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -95,24 +94,10 @@ public class ArmorStandController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/BoatController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/BoatController.java index 4bb3b07ca..5a0127fa1 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/BoatController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/BoatController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity; import org.bukkit.entity.Boat; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; @@ -80,24 +79,10 @@ public class BoatController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/DragonFireballController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/DragonFireballController.java index 1ee5cc9e1..a43afb44d 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/DragonFireballController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/DragonFireballController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity; import org.bukkit.entity.DragonFireball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; @@ -71,24 +70,10 @@ public class DragonFireballController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/EggController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/EggController.java index 188e241fb..91e3b5f10 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/EggController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/EggController.java @@ -1,16 +1,5 @@ package net.citizensnpcs.nms.v1_11_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; -import net.citizensnpcs.api.npc.NPC; -import net.citizensnpcs.npc.AbstractEntityController; -import net.citizensnpcs.npc.CitizensNPC; -import net.citizensnpcs.npc.ai.NPCHolder; -import net.citizensnpcs.util.Util; -import net.minecraft.server.v1_11_R1.EntityEgg; -import net.minecraft.server.v1_11_R1.NBTTagCompound; -import net.minecraft.server.v1_11_R1.World; -import net.minecraft.server.v1_11_R1.WorldServer; - import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_11_R1.CraftServer; @@ -21,6 +10,16 @@ import org.bukkit.entity.Egg; import org.bukkit.entity.Entity; import org.bukkit.util.Vector; +import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.npc.AbstractEntityController; +import net.citizensnpcs.npc.CitizensNPC; +import net.citizensnpcs.npc.ai.NPCHolder; +import net.citizensnpcs.util.Util; +import net.minecraft.server.v1_11_R1.EntityEgg; +import net.minecraft.server.v1_11_R1.NBTTagCompound; +import net.minecraft.server.v1_11_R1.World; +import net.minecraft.server.v1_11_R1.WorldServer; + public class EggController extends AbstractEntityController { public EggController() { super(EntityEggNPC.class); @@ -86,24 +85,10 @@ public class EggController extends AbstractEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/EnderCrystalController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/EnderCrystalController.java index 281e859a8..54d3bbd4b 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/EnderCrystalController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/EnderCrystalController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_11_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_11_R1.CraftServer; +import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEnderCrystal; +import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity; +import org.bukkit.entity.EnderCrystal; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_11_R1.EntityEnderCrystal; import net.minecraft.server.v1_11_R1.NBTTagCompound; import net.minecraft.server.v1_11_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_11_R1.CraftServer; -import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEnderCrystal; -import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity; -import org.bukkit.entity.EnderCrystal; -import org.bukkit.util.Vector; - public class EnderCrystalController extends MobEntityController { public EnderCrystalController() { super(EntityEnderCrystalNPC.class); @@ -70,24 +69,10 @@ public class EnderCrystalController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/EnderPearlController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/EnderPearlController.java index ead78bc35..b40c5e72b 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/EnderPearlController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/EnderPearlController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity; import org.bukkit.entity.EnderPearl; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -70,24 +69,10 @@ public class EnderPearlController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/EnderSignalController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/EnderSignalController.java index 82ac1197d..ce4d343e8 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/EnderSignalController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/EnderSignalController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_11_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_11_R1.CraftServer; +import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEnderSignal; +import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity; +import org.bukkit.entity.EnderSignal; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_11_R1.EntityEnderSignal; import net.minecraft.server.v1_11_R1.NBTTagCompound; import net.minecraft.server.v1_11_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_11_R1.CraftServer; -import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEnderSignal; -import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity; -import org.bukkit.entity.EnderSignal; -import org.bukkit.util.Vector; - public class EnderSignalController extends MobEntityController { public EnderSignalController() { super(EntityEnderSignalNPC.class); @@ -70,24 +69,10 @@ public class EnderSignalController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/EvokerFangsController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/EvokerFangsController.java index 607ffc6f8..b7ea75602 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/EvokerFangsController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/EvokerFangsController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -81,24 +80,10 @@ public class EvokerFangsController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ExperienceOrbController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ExperienceOrbController.java index 45d4eb1ed..04821f5db 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ExperienceOrbController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ExperienceOrbController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_11_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_11_R1.CraftServer; +import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_11_R1.entity.CraftExperienceOrb; +import org.bukkit.entity.ExperienceOrb; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_11_R1.EntityExperienceOrb; import net.minecraft.server.v1_11_R1.NBTTagCompound; import net.minecraft.server.v1_11_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_11_R1.CraftServer; -import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_11_R1.entity.CraftExperienceOrb; -import org.bukkit.entity.ExperienceOrb; -import org.bukkit.util.Vector; - public class ExperienceOrbController extends MobEntityController { public ExperienceOrbController() { super(EntityExperienceOrbNPC.class); @@ -56,24 +55,10 @@ public class ExperienceOrbController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/FallingBlockController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/FallingBlockController.java index 8df2f9f7b..33100e80f 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/FallingBlockController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/FallingBlockController.java @@ -13,7 +13,6 @@ import org.bukkit.entity.FallingBlock; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; @@ -103,24 +102,10 @@ public class FallingBlockController extends AbstractEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/FireworkController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/FireworkController.java index 79ac07bfb..c1da454d9 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/FireworkController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/FireworkController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_11_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_11_R1.CraftServer; +import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_11_R1.entity.CraftFirework; +import org.bukkit.entity.Firework; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_11_R1.EntityFireworks; import net.minecraft.server.v1_11_R1.NBTTagCompound; import net.minecraft.server.v1_11_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_11_R1.CraftServer; -import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_11_R1.entity.CraftFirework; -import org.bukkit.entity.Firework; -import org.bukkit.util.Vector; - public class FireworkController extends MobEntityController { public FireworkController() { super(EntityFireworkNPC.class); @@ -56,24 +55,10 @@ public class FireworkController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/FishingHookController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/FishingHookController.java index 2ca3ea07d..061bf9e07 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/FishingHookController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/FishingHookController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_11_R1.entity.CraftFish; import org.bukkit.entity.FishHook; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -65,24 +64,10 @@ public class FishingHookController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ItemController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ItemController.java index f13c72c7c..f6a9d956f 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ItemController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ItemController.java @@ -13,7 +13,6 @@ import org.bukkit.entity.Item; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.AbstractEntityController; @@ -96,24 +95,10 @@ public class ItemController extends AbstractEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ItemFrameController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ItemFrameController.java index fbce9ef17..f47a54c5a 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ItemFrameController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ItemFrameController.java @@ -11,7 +11,6 @@ import org.bukkit.entity.ItemFrame; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; @@ -81,24 +80,10 @@ public class ItemFrameController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/LargeFireballController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/LargeFireballController.java index ca7241bd4..d9033cb24 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/LargeFireballController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/LargeFireballController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_11_R1.entity.CraftLargeFireball; import org.bukkit.entity.LargeFireball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; @@ -57,24 +56,10 @@ public class LargeFireballController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/LeashController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/LeashController.java index cf19327b0..f591aa021 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/LeashController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/LeashController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_11_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_11_R1.CraftServer; +import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_11_R1.entity.CraftLeash; +import org.bukkit.entity.LeashHitch; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_11_R1.EntityLeash; import net.minecraft.server.v1_11_R1.NBTTagCompound; import net.minecraft.server.v1_11_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_11_R1.CraftServer; -import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_11_R1.entity.CraftLeash; -import org.bukkit.entity.LeashHitch; -import org.bukkit.util.Vector; - public class LeashController extends MobEntityController { public LeashController() { super(EntityLeashNPC.class); @@ -56,24 +55,10 @@ public class LeashController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/LlamaSpitController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/LlamaSpitController.java index 3b13cfd06..8337bdac5 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/LlamaSpitController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/LlamaSpitController.java @@ -10,7 +10,6 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.LlamaSpit; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.AbstractEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -86,24 +85,10 @@ public class LlamaSpitController extends AbstractEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartChestController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartChestController.java index a194c2a45..f79fd6fc7 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartChestController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartChestController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_11_R1.entity.CraftMinecartChest; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; @@ -66,24 +65,10 @@ public class MinecartChestController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartCommandController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartCommandController.java index 92f929d6e..3b0a544ea 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartCommandController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartCommandController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_11_R1.entity.CraftMinecartCommand; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; @@ -66,24 +65,10 @@ public class MinecartCommandController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartFurnaceController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartFurnaceController.java index d38e73bdf..cd02a6ef4 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartFurnaceController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartFurnaceController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_11_R1.entity.CraftMinecartFurnace; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; @@ -66,24 +65,10 @@ public class MinecartFurnaceController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartHopperController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartHopperController.java index ca76d38f6..7579f46b7 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartHopperController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartHopperController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_11_R1.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; @@ -62,24 +61,10 @@ public class MinecartHopperController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartRideableController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartRideableController.java index b8baf2368..a7349b144 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartRideableController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartRideableController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_11_R1.entity.CraftMinecartRideable; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; @@ -66,24 +65,10 @@ public class MinecartRideableController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartSpawnerController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartSpawnerController.java index d22b8edfa..91aa6c95e 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartSpawnerController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartSpawnerController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_11_R1.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; @@ -62,24 +61,10 @@ public class MinecartSpawnerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartTNTController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartTNTController.java index e401954fd..d28b9c577 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartTNTController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/MinecartTNTController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_11_R1.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_11_R1.util.NMSImpl; @@ -62,24 +61,10 @@ public class MinecartTNTController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/PaintingController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/PaintingController.java index c087d86a3..d9e276ace 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/PaintingController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/PaintingController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_11_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_11_R1.CraftServer; +import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPainting; +import org.bukkit.entity.Painting; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_11_R1.EntityPainting; import net.minecraft.server.v1_11_R1.NBTTagCompound; import net.minecraft.server.v1_11_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_11_R1.CraftServer; -import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPainting; -import org.bukkit.entity.Painting; -import org.bukkit.util.Vector; - public class PaintingController extends MobEntityController { public PaintingController() { super(EntityPaintingNPC.class); @@ -56,24 +55,10 @@ public class PaintingController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ShulkerBulletController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ShulkerBulletController.java index 337f8bd9b..efbc31c95 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ShulkerBulletController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ShulkerBulletController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_11_R1.entity.CraftShulkerBullet; import org.bukkit.entity.ShulkerBullet; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -56,24 +55,10 @@ public class ShulkerBulletController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/SmallFireballController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/SmallFireballController.java index 20d447faf..6ae7c4f31 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/SmallFireballController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/SmallFireballController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_11_R1.entity.CraftSmallFireball; import org.bukkit.entity.SmallFireball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -56,24 +55,10 @@ public class SmallFireballController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/SnowballController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/SnowballController.java index fa7ff5a49..099d978d6 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/SnowballController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/SnowballController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_11_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_11_R1.CraftServer; +import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_11_R1.entity.CraftSnowball; +import org.bukkit.entity.Snowball; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_11_R1.EntitySnowball; import net.minecraft.server.v1_11_R1.NBTTagCompound; import net.minecraft.server.v1_11_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_11_R1.CraftServer; -import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_11_R1.entity.CraftSnowball; -import org.bukkit.entity.Snowball; -import org.bukkit.util.Vector; - public class SnowballController extends MobEntityController { public SnowballController() { super(EntitySnowballNPC.class); @@ -70,24 +69,10 @@ public class SnowballController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/SpectralArrowController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/SpectralArrowController.java index 57264f39a..7fe09c61e 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/SpectralArrowController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/SpectralArrowController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity; import org.bukkit.entity.Arrow; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -56,24 +55,10 @@ public class SpectralArrowController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/TNTPrimedController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/TNTPrimedController.java index a2e72d0f5..19d09cc16 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/TNTPrimedController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/TNTPrimedController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_11_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_11_R1.CraftServer; +import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_11_R1.entity.CraftTNTPrimed; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_11_R1.EntityTNTPrimed; import net.minecraft.server.v1_11_R1.NBTTagCompound; import net.minecraft.server.v1_11_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_11_R1.CraftServer; -import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_11_R1.entity.CraftTNTPrimed; -import org.bukkit.entity.TNTPrimed; -import org.bukkit.util.Vector; - public class TNTPrimedController extends MobEntityController { public TNTPrimedController() { super(EntityTNTPrimedNPC.class); @@ -56,24 +55,10 @@ public class TNTPrimedController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ThrownExpBottleController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ThrownExpBottleController.java index 129c216d2..78fa1494a 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ThrownExpBottleController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ThrownExpBottleController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_11_R1.entity.CraftThrownExpBottle; import org.bukkit.entity.ThrownExpBottle; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -56,24 +55,10 @@ public class ThrownExpBottleController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ThrownPotionController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ThrownPotionController.java index a4e4d6bb6..7c4af86d3 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ThrownPotionController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/ThrownPotionController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_11_R1.entity.CraftLingeringPotion; import org.bukkit.entity.ThrownPotion; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -57,24 +56,10 @@ public class ThrownPotionController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/TippedArrowController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/TippedArrowController.java index 593a68505..891983468 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/TippedArrowController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/TippedArrowController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_11_R1.entity.CraftTippedArrow; import org.bukkit.entity.Arrow; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -65,24 +64,10 @@ public class TippedArrowController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/WitherSkullController.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/WitherSkullController.java index 9871ac2f6..b501ecca8 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/WitherSkullController.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/entity/nonliving/WitherSkullController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_11_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_11_R1.CraftServer; +import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_11_R1.entity.CraftWitherSkull; +import org.bukkit.entity.WitherSkull; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_11_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_11_R1.EntityWitherSkull; import net.minecraft.server.v1_11_R1.NBTTagCompound; import net.minecraft.server.v1_11_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_11_R1.CraftServer; -import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_11_R1.entity.CraftWitherSkull; -import org.bukkit.entity.WitherSkull; -import org.bukkit.util.Vector; - public class WitherSkullController extends MobEntityController { public WitherSkullController() { super(EntityWitherSkullNPC.class); @@ -56,24 +55,10 @@ public class WitherSkullController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/BatController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/BatController.java index a4fde210c..cc5028896 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/BatController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/BatController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Bat; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -100,24 +99,10 @@ public class BatController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/BlazeController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/BlazeController.java index e51a8ea75..34dd59c8f 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/BlazeController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/BlazeController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Blaze; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -99,24 +98,10 @@ public class BlazeController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/CaveSpiderController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/CaveSpiderController.java index 7d47ddcf5..66dff7d3e 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/CaveSpiderController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/CaveSpiderController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.CaveSpider; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -124,24 +123,10 @@ public class CaveSpiderController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ChickenController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ChickenController.java index 4b68c5d78..8ca540877 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ChickenController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ChickenController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Chicken; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -135,24 +134,10 @@ public class ChickenController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/CowController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/CowController.java index ee21080c3..21fa7b19a 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/CowController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/CowController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Cow; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -151,24 +150,10 @@ public class CowController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/CreeperController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/CreeperController.java index f74dbe5bb..ffa5c7026 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/CreeperController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/CreeperController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Creeper; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -125,25 +124,10 @@ public class CreeperController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.f(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EnderDragonController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EnderDragonController.java index b0fcc89ac..4399dec4c 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EnderDragonController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EnderDragonController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.EnderDragon; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -98,24 +97,10 @@ public class EnderDragonController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EndermanController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EndermanController.java index ac354e9fd..b04db18d1 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EndermanController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EndermanController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Enderman; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -123,24 +122,10 @@ public class EndermanController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EndermiteController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EndermiteController.java index f0b9eb03a..0f0cf3529 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EndermiteController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EndermiteController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Endermite; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -123,24 +122,10 @@ public class EndermiteController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EntityHumanNPC.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EntityHumanNPC.java index e0be636a3..02b1ba96f 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EntityHumanNPC.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EntityHumanNPC.java @@ -21,7 +21,6 @@ import com.mojang.authlib.GameProfile; import net.citizensnpcs.Settings.Setting; import net.citizensnpcs.api.CitizensAPI; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.trait.trait.Inventory; import net.citizensnpcs.nms.v1_12_R1.network.EmptyNetHandler; @@ -217,25 +216,10 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.f(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EvokerController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EvokerController.java index 1ab103eee..99e6e04b1 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EvokerController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EvokerController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Evoker; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -110,24 +109,10 @@ public class EvokerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/GhastController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/GhastController.java index 48d9fd574..18c376f89 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/GhastController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/GhastController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Ghast; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -90,24 +89,10 @@ public class GhastController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/GiantController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/GiantController.java index 41a5b3403..a373980be 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/GiantController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/GiantController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Giant; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -109,24 +108,10 @@ public class GiantController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/GuardianController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/GuardianController.java index 239b88065..8b030b362 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/GuardianController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/GuardianController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Guardian; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -110,24 +109,10 @@ public class GuardianController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/GuardianElderController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/GuardianElderController.java index 71cc379bb..219698964 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/GuardianElderController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/GuardianElderController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.ElderGuardian; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -110,24 +109,10 @@ public class GuardianElderController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HorseController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HorseController.java index c9476a3ac..e92688e7a 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HorseController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HorseController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Horse; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -144,24 +143,10 @@ public class HorseController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HorseDonkeyController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HorseDonkeyController.java index 6ba766bb1..e2dfca2b7 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HorseDonkeyController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HorseDonkeyController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Donkey; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -144,24 +143,10 @@ public class HorseDonkeyController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HorseMuleController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HorseMuleController.java index 9cee2244d..eb9a178f0 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HorseMuleController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HorseMuleController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Mule; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -144,24 +143,10 @@ public class HorseMuleController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HorseSkeletonController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HorseSkeletonController.java index 099ac5c3a..521db95ab 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HorseSkeletonController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HorseSkeletonController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.SkeletonHorse; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -147,24 +146,10 @@ public class HorseSkeletonController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HorseZombieController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HorseZombieController.java index df3d3894d..157f3b4a1 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HorseZombieController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/HorseZombieController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.ZombieHorse; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -147,24 +146,10 @@ public class HorseZombieController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/IllusionerController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/IllusionerController.java index 0dbc303e2..892f00117 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/IllusionerController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/IllusionerController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Illusioner; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -110,24 +109,10 @@ public class IllusionerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/IronGolemController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/IronGolemController.java index f993fa2f2..f9828ae1b 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/IronGolemController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/IronGolemController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.IronGolem; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -109,24 +108,10 @@ public class IronGolemController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/LlamaController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/LlamaController.java index 58674fe7a..905987399 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/LlamaController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/LlamaController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Llama; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -131,24 +130,10 @@ public class LlamaController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/MagmaCubeController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/MagmaCubeController.java index b380a5418..856a03276 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/MagmaCubeController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/MagmaCubeController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.MagmaCube; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.nms.v1_12_R1.util.PlayerControllerMove; @@ -128,24 +127,10 @@ public class MagmaCubeController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/MushroomCowController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/MushroomCowController.java index cbcb0c257..ad710fd87 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/MushroomCowController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/MushroomCowController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.MushroomCow; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -130,24 +129,10 @@ public class MushroomCowController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/OcelotController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/OcelotController.java index 267751daf..8bc5f1fb9 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/OcelotController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/OcelotController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Ocelot; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -128,24 +127,10 @@ public class OcelotController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ParrotController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ParrotController.java index 3bec59ef5..7317eb2da 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ParrotController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ParrotController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Parrot; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -96,24 +95,10 @@ public class ParrotController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/PigController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/PigController.java index d90a964c5..edaa46665 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/PigController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/PigController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Pig; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -128,24 +127,10 @@ public class PigController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/PigZombieController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/PigZombieController.java index a991d2143..ecca61896 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/PigZombieController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/PigZombieController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.PigZombie; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -110,25 +109,10 @@ public class PigZombieController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.f(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/PolarBearController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/PolarBearController.java index be579bb54..52e24b36b 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/PolarBearController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/PolarBearController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.PolarBear; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -96,24 +95,10 @@ public class PolarBearController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/RabbitController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/RabbitController.java index 33ca96ddd..a36544599 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/RabbitController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/RabbitController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Rabbit; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -122,24 +121,10 @@ public class RabbitController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SheepController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SheepController.java index a3fcf30e5..b67b7314a 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SheepController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SheepController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Sheep; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -120,24 +119,10 @@ public class SheepController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ShulkerController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ShulkerController.java index 702d9a07d..902f5e689 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ShulkerController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ShulkerController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Shulker; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -119,24 +118,10 @@ public class ShulkerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SilverfishController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SilverfishController.java index 877816c1f..76c5ccc3d 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SilverfishController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SilverfishController.java @@ -1,7 +1,5 @@ package net.citizensnpcs.nms.v1_12_R1.entity; -import net.minecraft.server.v1_12_R1.DamageSource; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_12_R1.CraftServer; import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; @@ -10,13 +8,13 @@ import org.bukkit.entity.Silverfish; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; import net.minecraft.server.v1_12_R1.BlockPosition; +import net.minecraft.server.v1_12_R1.DamageSource; import net.minecraft.server.v1_12_R1.EntitySilverfish; import net.minecraft.server.v1_12_R1.IBlockData; import net.minecraft.server.v1_12_R1.NBTTagCompound; @@ -99,24 +97,10 @@ public class SilverfishController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SkeletonController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SkeletonController.java index 75a13fa65..de3b60af3 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SkeletonController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SkeletonController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Skeleton; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -109,24 +108,10 @@ public class SkeletonController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SkeletonStrayController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SkeletonStrayController.java index 0e2b81ff5..caf1444f4 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SkeletonStrayController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SkeletonStrayController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Stray; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -109,24 +108,10 @@ public class SkeletonStrayController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SkeletonWitherController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SkeletonWitherController.java index 440a3db81..6826d4616 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SkeletonWitherController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SkeletonWitherController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.WitherSkeleton; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -109,24 +108,10 @@ public class SkeletonWitherController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SlimeController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SlimeController.java index 75af7a08f..1eec37b75 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SlimeController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SlimeController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Slime; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.nms.v1_12_R1.util.PlayerControllerMove; @@ -129,24 +128,10 @@ public class SlimeController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SnowmanController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SnowmanController.java index 04140eeaa..438c4ef72 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SnowmanController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SnowmanController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Snowman; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -109,24 +108,10 @@ public class SnowmanController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SpiderController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SpiderController.java index c4663bb1c..2341d39fe 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SpiderController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SpiderController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Spider; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -109,24 +108,10 @@ public class SpiderController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SquidController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SquidController.java index 752f6a8e9..abca1b8c4 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SquidController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/SquidController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Squid; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -109,24 +108,10 @@ public class SquidController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/VexController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/VexController.java index 54adb0e6c..5fa8e121c 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/VexController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/VexController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Vex; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -86,24 +85,10 @@ public class VexController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/VillagerController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/VillagerController.java index 75cb79aca..5e26c392d 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/VillagerController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/VillagerController.java @@ -10,7 +10,6 @@ import org.bukkit.entity.Villager; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -19,6 +18,7 @@ import net.citizensnpcs.util.Util; import net.minecraft.server.v1_12_R1.BlockPosition; import net.minecraft.server.v1_12_R1.DamageSource; import net.minecraft.server.v1_12_R1.EntityHuman; +import net.minecraft.server.v1_12_R1.EntityLightning; import net.minecraft.server.v1_12_R1.EntityVillager; import net.minecraft.server.v1_12_R1.EnumHand; import net.minecraft.server.v1_12_R1.IBlockData; @@ -26,7 +26,6 @@ import net.minecraft.server.v1_12_R1.MerchantRecipe; import net.minecraft.server.v1_12_R1.NBTTagCompound; import net.minecraft.server.v1_12_R1.SoundEffect; import net.minecraft.server.v1_12_R1.World; -import net.minecraft.server.v1_12_R1.EntityLightning; public class VillagerController extends MobEntityController { public VillagerController() { @@ -150,24 +149,10 @@ public class VillagerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/VindicatorController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/VindicatorController.java index a7d0ba82a..7d278b1a2 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/VindicatorController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/VindicatorController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Vindicator; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -121,24 +120,10 @@ public class VindicatorController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/WitchController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/WitchController.java index 7d54cc6c9..b35f247fc 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/WitchController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/WitchController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Witch; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -109,24 +108,10 @@ public class WitchController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/WitherController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/WitherController.java index cfafc2186..09deff36d 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/WitherController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/WitherController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Wither; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -84,24 +83,10 @@ public class WitherController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/WolfController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/WolfController.java index 4be2a15b5..9e3cbd202 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/WolfController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/WolfController.java @@ -9,7 +9,6 @@ import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -123,24 +122,10 @@ public class WolfController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ZombieController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ZombieController.java index 003070929..5c86c2d57 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ZombieController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ZombieController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Zombie; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -109,24 +108,10 @@ public class ZombieController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ZombieHuskController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ZombieHuskController.java index 546c582f5..3d7c42ed4 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ZombieHuskController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ZombieHuskController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Husk; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -109,24 +108,10 @@ public class ZombieHuskController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ZombieVillagerController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ZombieVillagerController.java index 1023d0723..cd39efa63 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ZombieVillagerController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/ZombieVillagerController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.ZombieVillager; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -109,24 +108,10 @@ public class ZombieVillagerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/AreaEffectCloudController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/AreaEffectCloudController.java index c801f4ffc..5dc3204df 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/AreaEffectCloudController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/AreaEffectCloudController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; import org.bukkit.entity.AreaEffectCloud; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -79,24 +78,10 @@ public class AreaEffectCloudController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ArmorStandController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ArmorStandController.java index 9adf6d78e..97e0bb69f 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ArmorStandController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ArmorStandController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -95,24 +94,10 @@ public class ArmorStandController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/BoatController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/BoatController.java index a423987f4..5be859dcc 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/BoatController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/BoatController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; import org.bukkit.entity.Boat; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; @@ -80,24 +79,10 @@ public class BoatController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/DragonFireballController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/DragonFireballController.java index f53e0aefc..1b7f5c4de 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/DragonFireballController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/DragonFireballController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; import org.bukkit.entity.DragonFireball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; @@ -71,24 +70,10 @@ public class DragonFireballController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/EggController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/EggController.java index 972a9d3df..649679dea 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/EggController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/EggController.java @@ -1,16 +1,5 @@ package net.citizensnpcs.nms.v1_12_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; -import net.citizensnpcs.api.npc.NPC; -import net.citizensnpcs.npc.AbstractEntityController; -import net.citizensnpcs.npc.CitizensNPC; -import net.citizensnpcs.npc.ai.NPCHolder; -import net.citizensnpcs.util.Util; -import net.minecraft.server.v1_12_R1.EntityEgg; -import net.minecraft.server.v1_12_R1.NBTTagCompound; -import net.minecraft.server.v1_12_R1.World; -import net.minecraft.server.v1_12_R1.WorldServer; - import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_12_R1.CraftServer; @@ -21,6 +10,16 @@ import org.bukkit.entity.Egg; import org.bukkit.entity.Entity; import org.bukkit.util.Vector; +import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.npc.AbstractEntityController; +import net.citizensnpcs.npc.CitizensNPC; +import net.citizensnpcs.npc.ai.NPCHolder; +import net.citizensnpcs.util.Util; +import net.minecraft.server.v1_12_R1.EntityEgg; +import net.minecraft.server.v1_12_R1.NBTTagCompound; +import net.minecraft.server.v1_12_R1.World; +import net.minecraft.server.v1_12_R1.WorldServer; + public class EggController extends AbstractEntityController { public EggController() { super(EntityEggNPC.class); @@ -86,24 +85,10 @@ public class EggController extends AbstractEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/EnderCrystalController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/EnderCrystalController.java index 05fc681bb..e458aec4a 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/EnderCrystalController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/EnderCrystalController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_12_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_12_R1.CraftServer; +import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEnderCrystal; +import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; +import org.bukkit.entity.EnderCrystal; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_12_R1.EntityEnderCrystal; import net.minecraft.server.v1_12_R1.NBTTagCompound; import net.minecraft.server.v1_12_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_12_R1.CraftServer; -import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEnderCrystal; -import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; -import org.bukkit.entity.EnderCrystal; -import org.bukkit.util.Vector; - public class EnderCrystalController extends MobEntityController { public EnderCrystalController() { super(EntityEnderCrystalNPC.class); @@ -70,24 +69,10 @@ public class EnderCrystalController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/EnderPearlController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/EnderPearlController.java index 10b5bab2f..85122e9b8 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/EnderPearlController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/EnderPearlController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; import org.bukkit.entity.EnderPearl; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -70,24 +69,10 @@ public class EnderPearlController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/EnderSignalController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/EnderSignalController.java index b614da4b4..d82db8cbb 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/EnderSignalController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/EnderSignalController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_12_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_12_R1.CraftServer; +import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEnderSignal; +import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; +import org.bukkit.entity.EnderSignal; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_12_R1.EntityEnderSignal; import net.minecraft.server.v1_12_R1.NBTTagCompound; import net.minecraft.server.v1_12_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_12_R1.CraftServer; -import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEnderSignal; -import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; -import org.bukkit.entity.EnderSignal; -import org.bukkit.util.Vector; - public class EnderSignalController extends MobEntityController { public EnderSignalController() { super(EntityEnderSignalNPC.class); @@ -70,24 +69,10 @@ public class EnderSignalController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/EvokerFangsController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/EvokerFangsController.java index efdd3fa50..1abeec083 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/EvokerFangsController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/EvokerFangsController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -81,24 +80,10 @@ public class EvokerFangsController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ExperienceOrbController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ExperienceOrbController.java index fdbea0622..714494106 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ExperienceOrbController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ExperienceOrbController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_12_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_12_R1.CraftServer; +import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_12_R1.entity.CraftExperienceOrb; +import org.bukkit.entity.ExperienceOrb; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_12_R1.EntityExperienceOrb; import net.minecraft.server.v1_12_R1.NBTTagCompound; import net.minecraft.server.v1_12_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_12_R1.CraftServer; -import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_12_R1.entity.CraftExperienceOrb; -import org.bukkit.entity.ExperienceOrb; -import org.bukkit.util.Vector; - public class ExperienceOrbController extends MobEntityController { public ExperienceOrbController() { super(EntityExperienceOrbNPC.class); @@ -56,24 +55,10 @@ public class ExperienceOrbController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/FallingBlockController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/FallingBlockController.java index e0373772b..3df5281af 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/FallingBlockController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/FallingBlockController.java @@ -13,7 +13,6 @@ import org.bukkit.entity.FallingBlock; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; @@ -103,24 +102,10 @@ public class FallingBlockController extends AbstractEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/FireworkController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/FireworkController.java index 54b5f98a4..2aeadc290 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/FireworkController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/FireworkController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_12_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_12_R1.CraftServer; +import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_12_R1.entity.CraftFirework; +import org.bukkit.entity.Firework; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_12_R1.EntityFireworks; import net.minecraft.server.v1_12_R1.NBTTagCompound; import net.minecraft.server.v1_12_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_12_R1.CraftServer; -import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_12_R1.entity.CraftFirework; -import org.bukkit.entity.Firework; -import org.bukkit.util.Vector; - public class FireworkController extends MobEntityController { public FireworkController() { super(EntityFireworkNPC.class); @@ -56,24 +55,10 @@ public class FireworkController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/FishingHookController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/FishingHookController.java index afbe88ca1..0a1a3402c 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/FishingHookController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/FishingHookController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_12_R1.entity.CraftFish; import org.bukkit.entity.FishHook; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -65,24 +64,10 @@ public class FishingHookController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ItemController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ItemController.java index 6ee84e12d..db19d8b66 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ItemController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ItemController.java @@ -13,7 +13,6 @@ import org.bukkit.entity.Item; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.AbstractEntityController; @@ -96,24 +95,10 @@ public class ItemController extends AbstractEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ItemFrameController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ItemFrameController.java index 2b8b1161f..9af235a7e 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ItemFrameController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ItemFrameController.java @@ -11,7 +11,6 @@ import org.bukkit.entity.ItemFrame; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; @@ -81,24 +80,10 @@ public class ItemFrameController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/LargeFireballController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/LargeFireballController.java index c04449663..c0501840c 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/LargeFireballController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/LargeFireballController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_12_R1.entity.CraftLargeFireball; import org.bukkit.entity.LargeFireball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; @@ -57,24 +56,10 @@ public class LargeFireballController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/LeashController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/LeashController.java index 23194ccac..10ad9808c 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/LeashController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/LeashController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_12_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_12_R1.CraftServer; +import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_12_R1.entity.CraftLeash; +import org.bukkit.entity.LeashHitch; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_12_R1.EntityLeash; import net.minecraft.server.v1_12_R1.NBTTagCompound; import net.minecraft.server.v1_12_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_12_R1.CraftServer; -import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_12_R1.entity.CraftLeash; -import org.bukkit.entity.LeashHitch; -import org.bukkit.util.Vector; - public class LeashController extends MobEntityController { public LeashController() { super(EntityLeashNPC.class); @@ -56,24 +55,10 @@ public class LeashController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/LlamaSpitController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/LlamaSpitController.java index 17f821952..ba696e2db 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/LlamaSpitController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/LlamaSpitController.java @@ -10,7 +10,6 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.LlamaSpit; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.AbstractEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -86,24 +85,10 @@ public class LlamaSpitController extends AbstractEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartChestController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartChestController.java index b66ca3aea..e9c0b4022 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartChestController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartChestController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_12_R1.entity.CraftMinecartChest; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; @@ -66,24 +65,10 @@ public class MinecartChestController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartCommandController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartCommandController.java index ed6d1c0a4..ef5ac0a14 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartCommandController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartCommandController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_12_R1.entity.CraftMinecartCommand; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; @@ -66,24 +65,10 @@ public class MinecartCommandController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartFurnaceController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartFurnaceController.java index 12bcac62c..7889388e9 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartFurnaceController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartFurnaceController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_12_R1.entity.CraftMinecartFurnace; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; @@ -66,24 +65,10 @@ public class MinecartFurnaceController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartHopperController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartHopperController.java index ae2f6dfd8..71acf79b4 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartHopperController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartHopperController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_12_R1.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; @@ -62,24 +61,10 @@ public class MinecartHopperController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartRideableController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartRideableController.java index ad42a3b13..e5c0716ab 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartRideableController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartRideableController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_12_R1.entity.CraftMinecartRideable; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; @@ -66,24 +65,10 @@ public class MinecartRideableController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartSpawnerController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartSpawnerController.java index dd38e4821..fbc782d08 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartSpawnerController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartSpawnerController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_12_R1.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; @@ -62,24 +61,10 @@ public class MinecartSpawnerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartTNTController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartTNTController.java index e0a37a25f..f146a5e92 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartTNTController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/MinecartTNTController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_12_R1.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_12_R1.util.NMSImpl; @@ -62,24 +61,10 @@ public class MinecartTNTController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/PaintingController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/PaintingController.java index 9a26d0155..9fa3b1733 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/PaintingController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/PaintingController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_12_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_12_R1.CraftServer; +import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPainting; +import org.bukkit.entity.Painting; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_12_R1.EntityPainting; import net.minecraft.server.v1_12_R1.NBTTagCompound; import net.minecraft.server.v1_12_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_12_R1.CraftServer; -import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPainting; -import org.bukkit.entity.Painting; -import org.bukkit.util.Vector; - public class PaintingController extends MobEntityController { public PaintingController() { super(EntityPaintingNPC.class); @@ -56,24 +55,10 @@ public class PaintingController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ShulkerBulletController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ShulkerBulletController.java index 3dd1169b1..3d1e49ccf 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ShulkerBulletController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ShulkerBulletController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_12_R1.entity.CraftShulkerBullet; import org.bukkit.entity.ShulkerBullet; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -56,24 +55,10 @@ public class ShulkerBulletController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/SmallFireballController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/SmallFireballController.java index b4b3ab750..bddd2d025 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/SmallFireballController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/SmallFireballController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_12_R1.entity.CraftSmallFireball; import org.bukkit.entity.SmallFireball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -56,24 +55,10 @@ public class SmallFireballController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/SnowballController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/SnowballController.java index 25b064001..13f16968a 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/SnowballController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/SnowballController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_12_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_12_R1.CraftServer; +import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_12_R1.entity.CraftSnowball; +import org.bukkit.entity.Snowball; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_12_R1.EntitySnowball; import net.minecraft.server.v1_12_R1.NBTTagCompound; import net.minecraft.server.v1_12_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_12_R1.CraftServer; -import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_12_R1.entity.CraftSnowball; -import org.bukkit.entity.Snowball; -import org.bukkit.util.Vector; - public class SnowballController extends MobEntityController { public SnowballController() { super(EntitySnowballNPC.class); @@ -70,24 +69,10 @@ public class SnowballController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/SpectralArrowController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/SpectralArrowController.java index 3c844cdc1..7000540ef 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/SpectralArrowController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/SpectralArrowController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; import org.bukkit.entity.Arrow; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -56,24 +55,10 @@ public class SpectralArrowController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/TNTPrimedController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/TNTPrimedController.java index 0a358c65a..7bb2bf727 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/TNTPrimedController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/TNTPrimedController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_12_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_12_R1.CraftServer; +import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_12_R1.entity.CraftTNTPrimed; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_12_R1.EntityTNTPrimed; import net.minecraft.server.v1_12_R1.NBTTagCompound; import net.minecraft.server.v1_12_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_12_R1.CraftServer; -import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_12_R1.entity.CraftTNTPrimed; -import org.bukkit.entity.TNTPrimed; -import org.bukkit.util.Vector; - public class TNTPrimedController extends MobEntityController { public TNTPrimedController() { super(EntityTNTPrimedNPC.class); @@ -56,24 +55,10 @@ public class TNTPrimedController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ThrownExpBottleController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ThrownExpBottleController.java index 80f14d047..9f827ef74 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ThrownExpBottleController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ThrownExpBottleController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_12_R1.entity.CraftThrownExpBottle; import org.bukkit.entity.ThrownExpBottle; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -56,24 +55,10 @@ public class ThrownExpBottleController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ThrownPotionController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ThrownPotionController.java index 5c9c9b2b3..596942a1b 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ThrownPotionController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/ThrownPotionController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_12_R1.entity.CraftLingeringPotion; import org.bukkit.entity.ThrownPotion; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -57,24 +56,10 @@ public class ThrownPotionController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/TippedArrowController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/TippedArrowController.java index 1ac720e47..9b9380e0a 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/TippedArrowController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/TippedArrowController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_12_R1.entity.CraftTippedArrow; import org.bukkit.entity.Arrow; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -65,24 +64,10 @@ public class TippedArrowController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/WitherSkullController.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/WitherSkullController.java index a03095494..b8e8e88c1 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/WitherSkullController.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/nonliving/WitherSkullController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_12_R1.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_12_R1.CraftServer; +import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_12_R1.entity.CraftWitherSkull; +import org.bukkit.entity.WitherSkull; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_12_R1.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_12_R1.EntityWitherSkull; import net.minecraft.server.v1_12_R1.NBTTagCompound; import net.minecraft.server.v1_12_R1.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_12_R1.CraftServer; -import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_12_R1.entity.CraftWitherSkull; -import org.bukkit.entity.WitherSkull; -import org.bukkit.util.Vector; - public class WitherSkullController extends MobEntityController { public WitherSkullController() { super(EntityWitherSkullNPC.class); @@ -56,24 +55,10 @@ public class WitherSkullController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/BatController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/BatController.java index 5eef70512..39004880c 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/BatController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/BatController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Bat; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -108,24 +107,10 @@ public class BatController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/BlazeController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/BlazeController.java index ea090ce73..bba1dcbc4 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/BlazeController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/BlazeController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Blaze; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -107,24 +106,10 @@ public class BlazeController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/CaveSpiderController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/CaveSpiderController.java index 3585df9ce..860ff9971 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/CaveSpiderController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/CaveSpiderController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.CaveSpider; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -132,24 +131,10 @@ public class CaveSpiderController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ChickenController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ChickenController.java index 402d9cd5c..0c9c14458 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ChickenController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ChickenController.java @@ -10,7 +10,6 @@ import org.bukkit.entity.Chicken; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -146,24 +145,10 @@ public class ChickenController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/CodController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/CodController.java index 1d85f1d87..50af15e72 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/CodController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/CodController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Cod; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -148,24 +147,10 @@ public class CodController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/CowController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/CowController.java index 963a50c0e..6751b9249 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/CowController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/CowController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Cow; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -159,24 +158,10 @@ public class CowController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/CreeperController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/CreeperController.java index 37763528e..b8d51f7fa 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/CreeperController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/CreeperController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Creeper; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -133,25 +132,10 @@ public class CreeperController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.f(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/DolphinController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/DolphinController.java index 45d525b3a..ba512d9e1 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/DolphinController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/DolphinController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Dolphin; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -132,24 +131,10 @@ public class DolphinController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/DrownedController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/DrownedController.java index 77eb0fa58..9fba36a4c 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/DrownedController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/DrownedController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Drowned; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -131,24 +130,10 @@ public class DrownedController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EnderDragonController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EnderDragonController.java index c7956abcd..80d6395b5 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EnderDragonController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EnderDragonController.java @@ -10,7 +10,6 @@ import org.bukkit.entity.EnderDragon; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -109,24 +108,10 @@ public class EnderDragonController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EndermanController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EndermanController.java index bb6937300..6b20e6ba2 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EndermanController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EndermanController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Enderman; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -131,24 +130,10 @@ public class EndermanController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EndermiteController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EndermiteController.java index b79261542..1e73ea5db 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EndermiteController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EndermiteController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Endermite; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -131,24 +130,10 @@ public class EndermiteController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EntityHumanNPC.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EntityHumanNPC.java index 80351afd3..99cc9292c 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EntityHumanNPC.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EntityHumanNPC.java @@ -21,7 +21,6 @@ import com.mojang.authlib.GameProfile; import net.citizensnpcs.Settings.Setting; import net.citizensnpcs.api.CitizensAPI; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.trait.trait.Inventory; import net.citizensnpcs.nms.v1_13_R2.network.EmptyNetHandler; @@ -196,25 +195,10 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.f(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EvokerController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EvokerController.java index 52486107b..0cd1c341c 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EvokerController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/EvokerController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Evoker; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -118,24 +117,10 @@ public class EvokerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/GhastController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/GhastController.java index 9fd9478a6..b08440d20 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/GhastController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/GhastController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Ghast; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -93,24 +92,10 @@ public class GhastController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/GiantController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/GiantController.java index f41ececa4..f65b4c8d4 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/GiantController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/GiantController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Giant; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -117,24 +116,10 @@ public class GiantController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/GuardianController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/GuardianController.java index f5b0da038..d586101b2 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/GuardianController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/GuardianController.java @@ -10,7 +10,6 @@ import org.bukkit.entity.Guardian; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -121,24 +120,10 @@ public class GuardianController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/GuardianElderController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/GuardianElderController.java index 20aa970fe..fd9a50dd6 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/GuardianElderController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/GuardianElderController.java @@ -10,7 +10,6 @@ import org.bukkit.entity.ElderGuardian; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -121,24 +120,10 @@ public class GuardianElderController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HorseController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HorseController.java index dc3796aad..ea0c6586e 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HorseController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HorseController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Horse; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -152,24 +151,10 @@ public class HorseController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HorseDonkeyController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HorseDonkeyController.java index b7bbc021f..862141662 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HorseDonkeyController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HorseDonkeyController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Donkey; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -152,24 +151,10 @@ public class HorseDonkeyController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HorseMuleController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HorseMuleController.java index 1e67d6d1d..9568bd627 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HorseMuleController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HorseMuleController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Mule; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -152,24 +151,10 @@ public class HorseMuleController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HorseSkeletonController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HorseSkeletonController.java index 1cbb51f03..2be137f29 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HorseSkeletonController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HorseSkeletonController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.SkeletonHorse; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -153,24 +152,10 @@ public class HorseSkeletonController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HorseZombieController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HorseZombieController.java index df734cb21..31ded89bb 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HorseZombieController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/HorseZombieController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.ZombieHorse; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -153,24 +152,10 @@ public class HorseZombieController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/IllusionerController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/IllusionerController.java index 22de603eb..174ec8773 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/IllusionerController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/IllusionerController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Illusioner; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -118,24 +117,10 @@ public class IllusionerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/IronGolemController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/IronGolemController.java index 7d693b578..1d2eb61ee 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/IronGolemController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/IronGolemController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.IronGolem; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -117,24 +116,10 @@ public class IronGolemController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/LlamaController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/LlamaController.java index 8a9c947ba..37c157355 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/LlamaController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/LlamaController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Llama; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -139,24 +138,10 @@ public class LlamaController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/MagmaCubeController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/MagmaCubeController.java index c3ebaa9a4..65172bde6 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/MagmaCubeController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/MagmaCubeController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.MagmaCube; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.nms.v1_13_R2.util.PlayerControllerMove; @@ -128,24 +127,10 @@ public class MagmaCubeController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/MushroomCowController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/MushroomCowController.java index 7d09e04fc..614e558ec 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/MushroomCowController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/MushroomCowController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.MushroomCow; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -138,24 +137,10 @@ public class MushroomCowController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/OcelotController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/OcelotController.java index 23d791927..f2ffdf9b3 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/OcelotController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/OcelotController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Ocelot; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -136,24 +135,10 @@ public class OcelotController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ParrotController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ParrotController.java index b8cad8889..0b45489d2 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ParrotController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ParrotController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Parrot; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -104,24 +103,10 @@ public class ParrotController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/PhantomController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/PhantomController.java index ba9a84fa7..9ba6e5b0e 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/PhantomController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/PhantomController.java @@ -10,7 +10,6 @@ import org.bukkit.entity.Phantom; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -134,24 +133,10 @@ public class PhantomController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/PigController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/PigController.java index c6150770f..ee213b0a9 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/PigController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/PigController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Pig; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -136,24 +135,10 @@ public class PigController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/PigZombieController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/PigZombieController.java index 62948cc1e..21a8047b8 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/PigZombieController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/PigZombieController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.PigZombie; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -118,25 +117,10 @@ public class PigZombieController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.f(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/PolarBearController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/PolarBearController.java index 65a9cac47..377e3b984 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/PolarBearController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/PolarBearController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.PolarBear; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -104,24 +103,10 @@ public class PolarBearController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/PufferFishController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/PufferFishController.java index 6372d2fb4..df1998aee 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/PufferFishController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/PufferFishController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.PufferFish; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -136,24 +135,10 @@ public class PufferFishController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/RabbitController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/RabbitController.java index c491bc7da..cf2c20fb7 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/RabbitController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/RabbitController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Rabbit; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -131,24 +130,10 @@ public class RabbitController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SalmonController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SalmonController.java index e06a71810..6386c9d00 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SalmonController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SalmonController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Salmon; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -134,24 +133,10 @@ public class SalmonController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SheepController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SheepController.java index 47863153f..155c46a5d 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SheepController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SheepController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Sheep; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -128,24 +127,10 @@ public class SheepController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ShulkerController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ShulkerController.java index 8ba155953..26be7318f 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ShulkerController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ShulkerController.java @@ -10,7 +10,6 @@ import org.bukkit.entity.Shulker; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -121,24 +120,10 @@ public class ShulkerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SilverfishController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SilverfishController.java index 3498e6876..2651c9efe 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SilverfishController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SilverfishController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Silverfish; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -115,24 +114,10 @@ public class SilverfishController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SkeletonController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SkeletonController.java index ee711982f..15588296e 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SkeletonController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SkeletonController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Skeleton; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -117,24 +116,10 @@ public class SkeletonController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SkeletonStrayController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SkeletonStrayController.java index 0067c789a..6d346e5c3 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SkeletonStrayController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SkeletonStrayController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Stray; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -117,24 +116,10 @@ public class SkeletonStrayController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SkeletonWitherController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SkeletonWitherController.java index 7936d96f2..45c42ff52 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SkeletonWitherController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SkeletonWitherController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.WitherSkeleton; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -117,24 +116,10 @@ public class SkeletonWitherController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SlimeController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SlimeController.java index 74331ee05..994f6cc5a 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SlimeController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SlimeController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Slime; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.nms.v1_13_R2.util.PlayerControllerMove; @@ -129,24 +128,10 @@ public class SlimeController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SnowmanController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SnowmanController.java index bef999c54..ae7b771c5 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SnowmanController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SnowmanController.java @@ -10,7 +10,6 @@ import org.bukkit.entity.Snowman; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -120,24 +119,10 @@ public class SnowmanController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SpiderController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SpiderController.java index 5c73b31e1..d5e0533e4 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SpiderController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SpiderController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Spider; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -117,24 +116,10 @@ public class SpiderController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SquidController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SquidController.java index 8962beb2c..409ec797a 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SquidController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/SquidController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Squid; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -117,24 +116,10 @@ public class SquidController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/TropicalFishController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/TropicalFishController.java index a32bcb827..b803b112a 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/TropicalFishController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/TropicalFishController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.TropicalFish; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -134,24 +133,10 @@ public class TropicalFishController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/TurtleController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/TurtleController.java index fa0138ad3..ea991240d 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/TurtleController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/TurtleController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Turtle; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -132,24 +131,10 @@ public class TurtleController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/VexController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/VexController.java index 89eada64a..77eda4082 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/VexController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/VexController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Vex; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -94,24 +93,10 @@ public class VexController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/VillagerController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/VillagerController.java index e0ba2898f..c77cdb460 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/VillagerController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/VillagerController.java @@ -10,7 +10,6 @@ import org.bukkit.entity.Villager; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -158,24 +157,10 @@ public class VillagerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/VindicatorController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/VindicatorController.java index cad9bbf3d..3bc542b3a 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/VindicatorController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/VindicatorController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Vindicator; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -129,24 +128,10 @@ public class VindicatorController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/WitchController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/WitchController.java index 75154acdc..ca495c66a 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/WitchController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/WitchController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Witch; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -117,24 +116,10 @@ public class WitchController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/WitherController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/WitherController.java index 716dfa5d9..ecf6999e8 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/WitherController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/WitherController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Wither; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -92,24 +91,10 @@ public class WitherController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/WolfController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/WolfController.java index 14b7afc28..abd2b09cf 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/WolfController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/WolfController.java @@ -9,7 +9,6 @@ import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -131,24 +130,10 @@ public class WolfController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ZombieController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ZombieController.java index ccb071d16..2002003d7 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ZombieController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ZombieController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Zombie; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -117,24 +116,10 @@ public class ZombieController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ZombieHuskController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ZombieHuskController.java index a154fb7e4..5ff087b34 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ZombieHuskController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ZombieHuskController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Husk; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -117,24 +116,10 @@ public class ZombieHuskController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ZombieVillagerController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ZombieVillagerController.java index a3d5b7d15..32e948925 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ZombieVillagerController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/ZombieVillagerController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.ZombieVillager; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -117,24 +116,10 @@ public class ZombieVillagerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/AreaEffectCloudController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/AreaEffectCloudController.java index c6e2a3564..7f376a25c 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/AreaEffectCloudController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/AreaEffectCloudController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity; import org.bukkit.entity.AreaEffectCloud; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -79,24 +78,10 @@ public class AreaEffectCloudController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ArmorStandController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ArmorStandController.java index e77a678eb..f99f9d08d 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ArmorStandController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ArmorStandController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -95,24 +94,10 @@ public class ArmorStandController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/BoatController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/BoatController.java index 57678bd1c..0822338ff 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/BoatController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/BoatController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity; import org.bukkit.entity.Boat; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; @@ -80,24 +79,10 @@ public class BoatController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/DragonFireballController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/DragonFireballController.java index a65fdff61..640292050 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/DragonFireballController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/DragonFireballController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity; import org.bukkit.entity.DragonFireball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; @@ -71,24 +70,10 @@ public class DragonFireballController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/EggController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/EggController.java index 276bf0e3f..1680766b4 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/EggController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/EggController.java @@ -1,16 +1,5 @@ package net.citizensnpcs.nms.v1_13_R2.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; -import net.citizensnpcs.api.npc.NPC; -import net.citizensnpcs.npc.AbstractEntityController; -import net.citizensnpcs.npc.CitizensNPC; -import net.citizensnpcs.npc.ai.NPCHolder; -import net.citizensnpcs.util.Util; -import net.minecraft.server.v1_13_R2.EntityEgg; -import net.minecraft.server.v1_13_R2.NBTTagCompound; -import net.minecraft.server.v1_13_R2.World; -import net.minecraft.server.v1_13_R2.WorldServer; - import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_13_R2.CraftServer; @@ -21,6 +10,16 @@ import org.bukkit.entity.Egg; import org.bukkit.entity.Entity; import org.bukkit.util.Vector; +import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.npc.AbstractEntityController; +import net.citizensnpcs.npc.CitizensNPC; +import net.citizensnpcs.npc.ai.NPCHolder; +import net.citizensnpcs.util.Util; +import net.minecraft.server.v1_13_R2.EntityEgg; +import net.minecraft.server.v1_13_R2.NBTTagCompound; +import net.minecraft.server.v1_13_R2.World; +import net.minecraft.server.v1_13_R2.WorldServer; + public class EggController extends AbstractEntityController { public EggController() { super(EntityEggNPC.class); @@ -86,24 +85,10 @@ public class EggController extends AbstractEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/EnderCrystalController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/EnderCrystalController.java index 45d0731f8..9cd45053c 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/EnderCrystalController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/EnderCrystalController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_13_R2.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_13_R2.CraftServer; +import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEnderCrystal; +import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity; +import org.bukkit.entity.EnderCrystal; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_13_R2.EntityEnderCrystal; import net.minecraft.server.v1_13_R2.NBTTagCompound; import net.minecraft.server.v1_13_R2.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_13_R2.CraftServer; -import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEnderCrystal; -import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity; -import org.bukkit.entity.EnderCrystal; -import org.bukkit.util.Vector; - public class EnderCrystalController extends MobEntityController { public EnderCrystalController() { super(EntityEnderCrystalNPC.class); @@ -70,24 +69,10 @@ public class EnderCrystalController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/EnderPearlController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/EnderPearlController.java index f937f7eb3..27053b97b 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/EnderPearlController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/EnderPearlController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity; import org.bukkit.entity.EnderPearl; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -70,24 +69,10 @@ public class EnderPearlController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/EnderSignalController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/EnderSignalController.java index d0d6aa2cb..e5d906ab9 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/EnderSignalController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/EnderSignalController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_13_R2.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_13_R2.CraftServer; +import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEnderSignal; +import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity; +import org.bukkit.entity.EnderSignal; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_13_R2.EntityEnderSignal; import net.minecraft.server.v1_13_R2.NBTTagCompound; import net.minecraft.server.v1_13_R2.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_13_R2.CraftServer; -import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEnderSignal; -import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity; -import org.bukkit.entity.EnderSignal; -import org.bukkit.util.Vector; - public class EnderSignalController extends MobEntityController { public EnderSignalController() { super(EntityEnderSignalNPC.class); @@ -70,24 +69,10 @@ public class EnderSignalController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/EvokerFangsController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/EvokerFangsController.java index a64dd4ee7..592a496df 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/EvokerFangsController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/EvokerFangsController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -81,24 +80,10 @@ public class EvokerFangsController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ExperienceOrbController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ExperienceOrbController.java index 3b7468742..b51734384 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ExperienceOrbController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ExperienceOrbController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_13_R2.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_13_R2.CraftServer; +import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_13_R2.entity.CraftExperienceOrb; +import org.bukkit.entity.ExperienceOrb; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_13_R2.EntityExperienceOrb; import net.minecraft.server.v1_13_R2.NBTTagCompound; import net.minecraft.server.v1_13_R2.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_13_R2.CraftServer; -import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_13_R2.entity.CraftExperienceOrb; -import org.bukkit.entity.ExperienceOrb; -import org.bukkit.util.Vector; - public class ExperienceOrbController extends MobEntityController { public ExperienceOrbController() { super(EntityExperienceOrbNPC.class); @@ -56,24 +55,10 @@ public class ExperienceOrbController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/FallingBlockController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/FallingBlockController.java index 8e4c000fd..2967f7cf1 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/FallingBlockController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/FallingBlockController.java @@ -13,7 +13,6 @@ import org.bukkit.entity.FallingBlock; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; @@ -89,24 +88,10 @@ public class FallingBlockController extends AbstractEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/FireworkController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/FireworkController.java index c4814db7d..7831a23d2 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/FireworkController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/FireworkController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_13_R2.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_13_R2.CraftServer; +import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_13_R2.entity.CraftFirework; +import org.bukkit.entity.Firework; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_13_R2.EntityFireworks; import net.minecraft.server.v1_13_R2.NBTTagCompound; import net.minecraft.server.v1_13_R2.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_13_R2.CraftServer; -import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_13_R2.entity.CraftFirework; -import org.bukkit.entity.Firework; -import org.bukkit.util.Vector; - public class FireworkController extends MobEntityController { public FireworkController() { super(EntityFireworkNPC.class); @@ -56,24 +55,10 @@ public class FireworkController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/FishingHookController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/FishingHookController.java index 781a8af12..d1ecb63a2 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/FishingHookController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/FishingHookController.java @@ -11,7 +11,6 @@ import org.bukkit.util.Vector; import com.mojang.authlib.GameProfile; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -65,24 +64,10 @@ public class FishingHookController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ItemController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ItemController.java index 732f4a7ca..f4cc7d39e 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ItemController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ItemController.java @@ -13,7 +13,6 @@ import org.bukkit.entity.Item; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.AbstractEntityController; @@ -87,24 +86,10 @@ public class ItemController extends AbstractEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ItemFrameController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ItemFrameController.java index f61f97f18..e21c6e2b5 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ItemFrameController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ItemFrameController.java @@ -11,7 +11,6 @@ import org.bukkit.entity.ItemFrame; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; @@ -72,24 +71,10 @@ public class ItemFrameController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/LargeFireballController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/LargeFireballController.java index 31fff89a7..f46ccb62b 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/LargeFireballController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/LargeFireballController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_13_R2.entity.CraftLargeFireball; import org.bukkit.entity.LargeFireball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; @@ -57,24 +56,10 @@ public class LargeFireballController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/LeashController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/LeashController.java index 3ec265d11..341b65e67 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/LeashController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/LeashController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_13_R2.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_13_R2.CraftServer; +import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_13_R2.entity.CraftLeash; +import org.bukkit.entity.LeashHitch; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_13_R2.EntityLeash; import net.minecraft.server.v1_13_R2.NBTTagCompound; import net.minecraft.server.v1_13_R2.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_13_R2.CraftServer; -import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_13_R2.entity.CraftLeash; -import org.bukkit.entity.LeashHitch; -import org.bukkit.util.Vector; - public class LeashController extends MobEntityController { public LeashController() { super(EntityLeashNPC.class); @@ -56,24 +55,10 @@ public class LeashController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/LlamaSpitController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/LlamaSpitController.java index dfe6a3e50..e6df864e3 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/LlamaSpitController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/LlamaSpitController.java @@ -10,7 +10,6 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.LlamaSpit; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.AbstractEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -86,24 +85,10 @@ public class LlamaSpitController extends AbstractEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartChestController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartChestController.java index 553e8c19e..254bc23cc 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartChestController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartChestController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_13_R2.entity.CraftMinecartChest; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; @@ -57,24 +56,10 @@ public class MinecartChestController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartCommandController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartCommandController.java index 4152f4e06..d9fd5f075 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartCommandController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartCommandController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_13_R2.entity.CraftMinecartCommand; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; @@ -57,24 +56,10 @@ public class MinecartCommandController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartFurnaceController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartFurnaceController.java index 197fef189..a02677508 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartFurnaceController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartFurnaceController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_13_R2.entity.CraftMinecartFurnace; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; @@ -57,24 +56,10 @@ public class MinecartFurnaceController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartHopperController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartHopperController.java index 8b2c07ace..cb9f31d00 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartHopperController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartHopperController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_13_R2.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; @@ -53,24 +52,10 @@ public class MinecartHopperController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartRideableController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartRideableController.java index 15bc259f0..28ffed3dd 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartRideableController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartRideableController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_13_R2.entity.CraftMinecartRideable; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; @@ -57,24 +56,10 @@ public class MinecartRideableController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartSpawnerController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartSpawnerController.java index 01958bb46..48b71bdb0 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartSpawnerController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartSpawnerController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_13_R2.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; @@ -53,24 +52,10 @@ public class MinecartSpawnerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartTNTController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartTNTController.java index 10f5548f0..7cf172e2f 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartTNTController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/MinecartTNTController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_13_R2.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl; @@ -53,24 +52,10 @@ public class MinecartTNTController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/PaintingController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/PaintingController.java index 5f8debef5..5348a4eaa 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/PaintingController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/PaintingController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_13_R2.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_13_R2.CraftServer; +import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_13_R2.entity.CraftPainting; +import org.bukkit.entity.Painting; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_13_R2.EntityPainting; import net.minecraft.server.v1_13_R2.NBTTagCompound; import net.minecraft.server.v1_13_R2.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_13_R2.CraftServer; -import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_13_R2.entity.CraftPainting; -import org.bukkit.entity.Painting; -import org.bukkit.util.Vector; - public class PaintingController extends MobEntityController { public PaintingController() { super(EntityPaintingNPC.class); @@ -56,24 +55,10 @@ public class PaintingController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ShulkerBulletController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ShulkerBulletController.java index 1c8bcbe58..16e3a467d 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ShulkerBulletController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ShulkerBulletController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_13_R2.entity.CraftShulkerBullet; import org.bukkit.entity.ShulkerBullet; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -56,24 +55,10 @@ public class ShulkerBulletController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/SmallFireballController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/SmallFireballController.java index 7c40a8e1e..6dda1860c 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/SmallFireballController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/SmallFireballController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_13_R2.entity.CraftSmallFireball; import org.bukkit.entity.SmallFireball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -56,24 +55,10 @@ public class SmallFireballController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/SnowballController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/SnowballController.java index fd2ec1e75..8bbe0c1f6 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/SnowballController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/SnowballController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_13_R2.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_13_R2.CraftServer; +import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_13_R2.entity.CraftSnowball; +import org.bukkit.entity.Snowball; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_13_R2.EntitySnowball; import net.minecraft.server.v1_13_R2.NBTTagCompound; import net.minecraft.server.v1_13_R2.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_13_R2.CraftServer; -import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_13_R2.entity.CraftSnowball; -import org.bukkit.entity.Snowball; -import org.bukkit.util.Vector; - public class SnowballController extends MobEntityController { public SnowballController() { super(EntitySnowballNPC.class); @@ -70,24 +69,10 @@ public class SnowballController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/SpectralArrowController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/SpectralArrowController.java index de7197c36..d0a36840f 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/SpectralArrowController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/SpectralArrowController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity; import org.bukkit.entity.Arrow; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -56,24 +55,10 @@ public class SpectralArrowController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/TNTPrimedController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/TNTPrimedController.java index 94c1c353f..c75fb6085 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/TNTPrimedController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/TNTPrimedController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_13_R2.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_13_R2.CraftServer; +import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_13_R2.entity.CraftTNTPrimed; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_13_R2.EntityTNTPrimed; import net.minecraft.server.v1_13_R2.NBTTagCompound; import net.minecraft.server.v1_13_R2.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_13_R2.CraftServer; -import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_13_R2.entity.CraftTNTPrimed; -import org.bukkit.entity.TNTPrimed; -import org.bukkit.util.Vector; - public class TNTPrimedController extends MobEntityController { public TNTPrimedController() { super(EntityTNTPrimedNPC.class); @@ -56,24 +55,10 @@ public class TNTPrimedController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ThrownExpBottleController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ThrownExpBottleController.java index c700b41e3..a5635b945 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ThrownExpBottleController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ThrownExpBottleController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_13_R2.entity.CraftThrownExpBottle; import org.bukkit.entity.ThrownExpBottle; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -56,24 +55,10 @@ public class ThrownExpBottleController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ThrownPotionController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ThrownPotionController.java index 8a6a860fa..e32bb31a6 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ThrownPotionController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ThrownPotionController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_13_R2.entity.CraftLingeringPotion; import org.bukkit.entity.ThrownPotion; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -57,24 +56,10 @@ public class ThrownPotionController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ThrownTridentController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ThrownTridentController.java index 84257baa6..9a95434f3 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ThrownTridentController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/ThrownTridentController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_13_R2.entity.CraftTrident; import org.bukkit.entity.Trident; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -56,24 +55,10 @@ public class ThrownTridentController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/TippedArrowController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/TippedArrowController.java index 06a894202..ba5fc24d5 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/TippedArrowController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/TippedArrowController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_13_R2.entity.CraftTippedArrow; import org.bukkit.entity.Arrow; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -56,24 +55,10 @@ public class TippedArrowController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/WitherSkullController.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/WitherSkullController.java index 92fa62fec..fa438de95 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/WitherSkullController.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/entity/nonliving/WitherSkullController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_13_R2.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_13_R2.CraftServer; +import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_13_R2.entity.CraftWitherSkull; +import org.bukkit.entity.WitherSkull; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_13_R2.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_13_R2.EntityWitherSkull; import net.minecraft.server.v1_13_R2.NBTTagCompound; import net.minecraft.server.v1_13_R2.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_13_R2.CraftServer; -import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_13_R2.entity.CraftWitherSkull; -import org.bukkit.entity.WitherSkull; -import org.bukkit.util.Vector; - public class WitherSkullController extends MobEntityController { public WitherSkullController() { super(EntityWitherSkullNPC.class); @@ -56,24 +55,10 @@ public class WitherSkullController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/BatController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/BatController.java index 016cb2d4a..b1d9393c3 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/BatController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/BatController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Bat; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -101,24 +100,10 @@ public class BatController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/BlazeController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/BlazeController.java index 7dc9c6a13..e819df684 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/BlazeController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/BlazeController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Blaze; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -100,24 +99,10 @@ public class BlazeController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/CatController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/CatController.java index d679b1331..02e732b7a 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/CatController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/CatController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Cat; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -139,24 +138,10 @@ public class CatController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/CaveSpiderController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/CaveSpiderController.java index ad56f1afb..669547557 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/CaveSpiderController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/CaveSpiderController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.CaveSpider; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -126,24 +125,10 @@ public class CaveSpiderController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ChickenController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ChickenController.java index 9cbd75a4c..cc331fc78 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ChickenController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ChickenController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Chicken; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -139,24 +138,10 @@ public class ChickenController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/CodController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/CodController.java index feb24a196..17f6797f4 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/CodController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/CodController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Cod; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -142,24 +141,10 @@ public class CodController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/CowController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/CowController.java index c24be8535..2ce0d04c1 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/CowController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/CowController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Cow; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -153,24 +152,10 @@ public class CowController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/CreeperController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/CreeperController.java index 9f9cf4299..e6802d4f1 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/CreeperController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/CreeperController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Creeper; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -127,25 +126,10 @@ public class CreeperController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.f(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/DolphinController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/DolphinController.java index 2fcf67203..3c7396b4d 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/DolphinController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/DolphinController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Dolphin; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -139,24 +138,10 @@ public class DolphinController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/DrownedController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/DrownedController.java index 6235ad082..7d2de59eb 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/DrownedController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/DrownedController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Drowned; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -125,24 +124,10 @@ public class DrownedController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EnderDragonController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EnderDragonController.java index fd0e5ae11..5ac4d2c35 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EnderDragonController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EnderDragonController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.EnderDragon; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -100,24 +99,10 @@ public class EnderDragonController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EndermanController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EndermanController.java index 027dba47d..59c44dcb1 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EndermanController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EndermanController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Enderman; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -133,24 +132,10 @@ public class EndermanController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EndermiteController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EndermiteController.java index 0be3dc219..74a43cdd3 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EndermiteController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EndermiteController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Endermite; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -125,24 +124,10 @@ public class EndermiteController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EntityHumanNPC.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EntityHumanNPC.java index 8a5384886..37a230ec4 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EntityHumanNPC.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EntityHumanNPC.java @@ -20,7 +20,6 @@ import com.mojang.authlib.GameProfile; import net.citizensnpcs.Settings.Setting; import net.citizensnpcs.api.CitizensAPI; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.trait.trait.Inventory; import net.citizensnpcs.nms.v1_14_R1.network.EmptyNetHandler; @@ -195,25 +194,10 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.f(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EvokerController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EvokerController.java index d3cd0932b..acdb0eb1c 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EvokerController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/EvokerController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Evoker; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -112,24 +111,10 @@ public class EvokerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/FoxController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/FoxController.java index bd385f1c1..015b6fc70 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/FoxController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/FoxController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Fox; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -125,24 +124,10 @@ public class FoxController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/GhastController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/GhastController.java index 097b59ca3..5f02a1c1d 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/GhastController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/GhastController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Ghast; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -86,24 +85,10 @@ public class GhastController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/GiantController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/GiantController.java index 3e76642cb..0bf7ca940 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/GiantController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/GiantController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Giant; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -111,24 +110,10 @@ public class GiantController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/GuardianController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/GuardianController.java index 6d62c22f6..d9798a50a 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/GuardianController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/GuardianController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Guardian; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -112,24 +111,10 @@ public class GuardianController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/GuardianElderController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/GuardianElderController.java index d58500f81..018f6aefd 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/GuardianElderController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/GuardianElderController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.ElderGuardian; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -112,24 +111,10 @@ public class GuardianElderController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HorseController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HorseController.java index ae2761c00..53199cb93 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HorseController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HorseController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Horse; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -154,24 +153,10 @@ public class HorseController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HorseDonkeyController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HorseDonkeyController.java index 5b6e67ac8..a978f3447 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HorseDonkeyController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HorseDonkeyController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Donkey; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -153,24 +152,10 @@ public class HorseDonkeyController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HorseMuleController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HorseMuleController.java index eaf1636cb..bdf7899f1 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HorseMuleController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HorseMuleController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Mule; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -153,24 +152,10 @@ public class HorseMuleController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HorseSkeletonController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HorseSkeletonController.java index 598ba6ec3..73f7acd8a 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HorseSkeletonController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HorseSkeletonController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.SkeletonHorse; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -154,24 +153,10 @@ public class HorseSkeletonController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HorseZombieController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HorseZombieController.java index f38ce4b05..f00ef8560 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HorseZombieController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/HorseZombieController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.ZombieHorse; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -154,24 +153,10 @@ public class HorseZombieController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/IllusionerController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/IllusionerController.java index 6a0b9deee..966d1d5b9 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/IllusionerController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/IllusionerController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Illusioner; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -112,24 +111,10 @@ public class IllusionerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/IronGolemController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/IronGolemController.java index 58319bd78..19406a499 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/IronGolemController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/IronGolemController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.IronGolem; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -111,24 +110,10 @@ public class IronGolemController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/LlamaController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/LlamaController.java index 36c8d194e..7aee7b100 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/LlamaController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/LlamaController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Llama; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -136,24 +135,10 @@ public class LlamaController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/MagmaCubeController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/MagmaCubeController.java index 9636b9b6c..6240d99c8 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/MagmaCubeController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/MagmaCubeController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.MagmaCube; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.nms.v1_14_R1.util.PlayerControllerMove; @@ -115,24 +114,10 @@ public class MagmaCubeController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/MushroomCowController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/MushroomCowController.java index dfc2048ca..ec6bfc3a4 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/MushroomCowController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/MushroomCowController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.MushroomCow; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -134,24 +133,10 @@ public class MushroomCowController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/OcelotController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/OcelotController.java index 0359e5775..67ddb998c 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/OcelotController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/OcelotController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Ocelot; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -132,24 +131,10 @@ public class OcelotController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PandaController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PandaController.java index 4f9a7706a..6ed61b9ad 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PandaController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PandaController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Panda; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -125,24 +124,10 @@ public class PandaController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ParrotController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ParrotController.java index bdc695702..76bd32136 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ParrotController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ParrotController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Parrot; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -97,24 +96,10 @@ public class ParrotController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PhantomController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PhantomController.java index 70557f5ba..c2b4d8d99 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PhantomController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PhantomController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Phantom; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -125,24 +124,10 @@ public class PhantomController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PigController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PigController.java index 28c65f1b3..153e54a62 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PigController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PigController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Pig; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -132,24 +131,10 @@ public class PigController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PigZombieController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PigZombieController.java index 6fe7941ce..4772f610a 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PigZombieController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PigZombieController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.PigZombie; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -112,25 +111,10 @@ public class PigZombieController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.f(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PillagerController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PillagerController.java index 1ed1eeed0..ccaa0fed5 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PillagerController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PillagerController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Pillager; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -125,24 +124,10 @@ public class PillagerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PolarBearController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PolarBearController.java index 2d3dbdd33..81e4ce25d 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PolarBearController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PolarBearController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.PolarBear; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -100,24 +99,10 @@ public class PolarBearController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PufferFishController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PufferFishController.java index ec0b07c16..367943897 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PufferFishController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/PufferFishController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.PufferFish; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -140,24 +139,10 @@ public class PufferFishController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/RabbitController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/RabbitController.java index 1381b777c..72192402f 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/RabbitController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/RabbitController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Rabbit; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -128,24 +127,10 @@ public class RabbitController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/RavagerController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/RavagerController.java index fb4617fe0..f67309fe4 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/RavagerController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/RavagerController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Ravager; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -125,24 +124,10 @@ public class RavagerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SalmonController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SalmonController.java index 0234327e7..af8e53e0f 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SalmonController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SalmonController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Salmon; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -128,24 +127,10 @@ public class SalmonController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SheepController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SheepController.java index 5f15ce288..a113c2fbc 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SheepController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SheepController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Sheep; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -125,24 +124,10 @@ public class SheepController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ShulkerController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ShulkerController.java index 94a04c755..0b56f2309 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ShulkerController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ShulkerController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Shulker; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -112,24 +111,10 @@ public class ShulkerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SilverfishController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SilverfishController.java index eb6089049..807ef8d06 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SilverfishController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SilverfishController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Silverfish; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -109,24 +108,10 @@ public class SilverfishController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SkeletonController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SkeletonController.java index 2d3b37315..f64a19b55 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SkeletonController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SkeletonController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Skeleton; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -111,24 +110,10 @@ public class SkeletonController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SkeletonStrayController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SkeletonStrayController.java index 521966050..895c9122d 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SkeletonStrayController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SkeletonStrayController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Stray; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -111,24 +110,10 @@ public class SkeletonStrayController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SkeletonWitherController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SkeletonWitherController.java index dd14a6676..07c4defaa 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SkeletonWitherController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SkeletonWitherController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.WitherSkeleton; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -111,24 +110,10 @@ public class SkeletonWitherController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SlimeController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SlimeController.java index 42accadf0..e2299dd7e 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SlimeController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SlimeController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Slime; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.nms.v1_14_R1.util.PlayerControllerMove; @@ -116,24 +115,10 @@ public class SlimeController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SnowmanController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SnowmanController.java index 41540ffe1..34ef70745 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SnowmanController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SnowmanController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Snowman; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -112,24 +111,10 @@ public class SnowmanController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SpiderController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SpiderController.java index f3a3a46a7..8ef13b72f 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SpiderController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SpiderController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Spider; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -111,24 +110,10 @@ public class SpiderController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SquidController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SquidController.java index f0463f64c..6faa1398c 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SquidController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/SquidController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Squid; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -111,24 +110,10 @@ public class SquidController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/TraderLlamaController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/TraderLlamaController.java index 85314b397..d40e660a7 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/TraderLlamaController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/TraderLlamaController.java @@ -11,7 +11,6 @@ import org.bukkit.entity.TraderLlama; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -139,24 +138,10 @@ public class TraderLlamaController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/TropicalFishController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/TropicalFishController.java index cda2819a4..331b2992a 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/TropicalFishController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/TropicalFishController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.TropicalFish; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -128,24 +127,10 @@ public class TropicalFishController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/TurtleController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/TurtleController.java index a2fe03300..b631b47aa 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/TurtleController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/TurtleController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Turtle; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -126,24 +125,10 @@ public class TurtleController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/VexController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/VexController.java index 1222c7bd5..548a44cbb 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/VexController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/VexController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Vex; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -87,24 +86,10 @@ public class VexController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/VillagerController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/VillagerController.java index 0e18525d8..ea0b82fa6 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/VillagerController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/VillagerController.java @@ -11,7 +11,6 @@ import org.bukkit.entity.Villager; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -158,24 +157,10 @@ public class VillagerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/VindicatorController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/VindicatorController.java index e7e07b3ff..13a2fe1f0 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/VindicatorController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/VindicatorController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Vindicator; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -126,24 +125,10 @@ public class VindicatorController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/WanderingTraderController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/WanderingTraderController.java index ddcdbdb68..b7f9ec7a8 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/WanderingTraderController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/WanderingTraderController.java @@ -11,7 +11,6 @@ import org.bukkit.entity.WanderingTrader; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -156,24 +155,10 @@ public class WanderingTraderController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/WitchController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/WitchController.java index f8e585c60..d4cefc42b 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/WitchController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/WitchController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Witch; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -111,24 +110,10 @@ public class WitchController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/WitherController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/WitherController.java index 3d18ce462..4f4b45ce5 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/WitherController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/WitherController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Wither; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -85,24 +84,10 @@ public class WitherController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/WolfController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/WolfController.java index bcede6986..e665e153d 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/WolfController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/WolfController.java @@ -9,7 +9,6 @@ import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -128,24 +127,10 @@ public class WolfController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ZombieController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ZombieController.java index 8b5e3295e..e0bb2bd7b 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ZombieController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ZombieController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Zombie; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -111,24 +110,10 @@ public class ZombieController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ZombieHuskController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ZombieHuskController.java index 0a49c0cce..0f7661c84 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ZombieHuskController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ZombieHuskController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Husk; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -111,24 +110,10 @@ public class ZombieHuskController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ZombieVillagerController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ZombieVillagerController.java index 1047458d0..20b6d81e0 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ZombieVillagerController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/ZombieVillagerController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.ZombieVillager; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -111,24 +110,10 @@ public class ZombieVillagerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/AreaEffectCloudController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/AreaEffectCloudController.java index 155fc14c6..1f16315b6 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/AreaEffectCloudController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/AreaEffectCloudController.java @@ -1,6 +1,5 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftAreaEffectCloud; @@ -8,9 +7,9 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; import org.bukkit.entity.AreaEffectCloud; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -72,24 +71,10 @@ public class AreaEffectCloudController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ArmorStandController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ArmorStandController.java index 51367eb26..ed3bf1a89 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ArmorStandController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ArmorStandController.java @@ -1,6 +1,5 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftArmorStand; @@ -10,9 +9,9 @@ import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -89,24 +88,10 @@ public class ArmorStandController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/BoatController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/BoatController.java index cded3bc74..d4c938680 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/BoatController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/BoatController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; import org.bukkit.entity.Boat; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; @@ -72,24 +71,10 @@ public class BoatController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/DragonFireballController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/DragonFireballController.java index f95ada412..60e5ae3fc 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/DragonFireballController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/DragonFireballController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; import org.bukkit.entity.DragonFireball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; @@ -72,24 +71,10 @@ public class DragonFireballController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/EggController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/EggController.java index bbe82e1fd..b9a3cd010 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/EggController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/EggController.java @@ -1,6 +1,5 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_14_R1.CraftServer; @@ -11,8 +10,8 @@ import org.bukkit.entity.Egg; import org.bukkit.entity.Entity; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.AbstractEntityController; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -88,24 +87,10 @@ public class EggController extends AbstractEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/EnderCrystalController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/EnderCrystalController.java index 2a6caebca..18b5165db 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/EnderCrystalController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/EnderCrystalController.java @@ -1,6 +1,5 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEnderCrystal; @@ -8,9 +7,9 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; import org.bukkit.entity.EnderCrystal; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -72,24 +71,10 @@ public class EnderCrystalController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/EnderPearlController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/EnderPearlController.java index a5ec0d432..5292e1713 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/EnderPearlController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/EnderPearlController.java @@ -1,6 +1,5 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEnderPearl; @@ -8,9 +7,9 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; import org.bukkit.entity.EnderPearl; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -72,24 +71,10 @@ public class EnderPearlController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/EnderSignalController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/EnderSignalController.java index eec1db72e..7b2027bfd 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/EnderSignalController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/EnderSignalController.java @@ -1,6 +1,5 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEnderSignal; @@ -8,9 +7,9 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; import org.bukkit.entity.EnderSignal; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -72,24 +71,10 @@ public class EnderSignalController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/EvokerFangsController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/EvokerFangsController.java index a861b9677..ec3f7d926 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/EvokerFangsController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/EvokerFangsController.java @@ -1,6 +1,5 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; @@ -10,9 +9,9 @@ import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -75,24 +74,10 @@ public class EvokerFangsController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ExperienceOrbController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ExperienceOrbController.java index 2262b5442..ba5504f0d 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ExperienceOrbController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ExperienceOrbController.java @@ -1,6 +1,5 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; @@ -8,9 +7,9 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftExperienceOrb; import org.bukkit.entity.ExperienceOrb; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -58,24 +57,10 @@ public class ExperienceOrbController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/FallingBlockController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/FallingBlockController.java index 48cd291ce..a84aec9f1 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/FallingBlockController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/FallingBlockController.java @@ -13,7 +13,6 @@ import org.bukkit.entity.FallingBlock; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; @@ -91,24 +90,10 @@ public class FallingBlockController extends AbstractEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/FireworkController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/FireworkController.java index 007301b1a..b5353bbb4 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/FireworkController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/FireworkController.java @@ -1,6 +1,5 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; @@ -8,9 +7,9 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftFirework; import org.bukkit.entity.Firework; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -58,24 +57,10 @@ public class FireworkController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/FishingHookController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/FishingHookController.java index 3829e9bef..6ae8a5391 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/FishingHookController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/FishingHookController.java @@ -2,7 +2,6 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; import java.util.UUID; -import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; @@ -12,9 +11,9 @@ import org.bukkit.util.Vector; import com.mojang.authlib.GameProfile; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.NMS; @@ -72,24 +71,10 @@ public class FishingHookController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ItemController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ItemController.java index ecaebbb06..dd3dcab80 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ItemController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ItemController.java @@ -1,6 +1,5 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -14,9 +13,9 @@ import org.bukkit.entity.Item; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.AbstractEntityController; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -82,24 +81,10 @@ public class ItemController extends AbstractEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ItemFrameController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ItemFrameController.java index 7d9746d79..c163b8db5 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ItemFrameController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ItemFrameController.java @@ -1,6 +1,5 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -12,10 +11,10 @@ import org.bukkit.entity.ItemFrame; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -74,24 +73,10 @@ public class ItemFrameController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/LargeFireballController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/LargeFireballController.java index 27d1e834a..3a51c1105 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/LargeFireballController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/LargeFireballController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftLargeFireball; import org.bukkit.entity.LargeFireball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; @@ -58,24 +57,10 @@ public class LargeFireballController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/LeashController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/LeashController.java index 415a5ed04..e3eb6c119 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/LeashController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/LeashController.java @@ -1,6 +1,5 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; @@ -8,9 +7,9 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftLeash; import org.bukkit.entity.LeashHitch; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -58,24 +57,10 @@ public class LeashController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/LlamaSpitController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/LlamaSpitController.java index 6f5daf288..ce53f79b2 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/LlamaSpitController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/LlamaSpitController.java @@ -10,7 +10,6 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.LlamaSpit; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.AbstractEntityController; @@ -77,24 +76,10 @@ public class LlamaSpitController extends AbstractEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartChestController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartChestController.java index 69ab08889..977bf0901 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartChestController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartChestController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftMinecartChest; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; @@ -58,24 +57,10 @@ public class MinecartChestController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartCommandController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartCommandController.java index 00d6230c9..efe3a2dfb 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartCommandController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartCommandController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftMinecartCommand; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; @@ -58,24 +57,10 @@ public class MinecartCommandController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartFurnaceController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartFurnaceController.java index 49255a025..fc19b191d 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartFurnaceController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartFurnaceController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftMinecartFurnace; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; @@ -58,24 +57,10 @@ public class MinecartFurnaceController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartHopperController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartHopperController.java index 5cba99ac3..7fff0fee3 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartHopperController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartHopperController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; @@ -54,24 +53,10 @@ public class MinecartHopperController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartRideableController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartRideableController.java index 69dc0d30e..86fec3bf9 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartRideableController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartRideableController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftMinecartRideable; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; @@ -58,24 +57,10 @@ public class MinecartRideableController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartSpawnerController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartSpawnerController.java index 15c6d2cbd..d33aacd93 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartSpawnerController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartSpawnerController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; @@ -54,24 +53,10 @@ public class MinecartSpawnerController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartTNTController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartTNTController.java index d8a1c6c34..34fac3ea7 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartTNTController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/MinecartTNTController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; @@ -54,24 +53,10 @@ public class MinecartTNTController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/PaintingController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/PaintingController.java index b321500c6..20d208e1c 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/PaintingController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/PaintingController.java @@ -1,6 +1,5 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; @@ -8,9 +7,9 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPainting; import org.bukkit.entity.Painting; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -58,24 +57,10 @@ public class PaintingController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ShulkerBulletController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ShulkerBulletController.java index 35cbd4344..572dc4329 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ShulkerBulletController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ShulkerBulletController.java @@ -1,6 +1,5 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; @@ -8,9 +7,9 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftShulkerBullet; import org.bukkit.entity.ShulkerBullet; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -58,24 +57,10 @@ public class ShulkerBulletController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/SmallFireballController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/SmallFireballController.java index 1f8f8ffc5..a36b6f718 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/SmallFireballController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/SmallFireballController.java @@ -1,6 +1,5 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; @@ -8,9 +7,9 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftSmallFireball; import org.bukkit.entity.SmallFireball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -58,24 +57,10 @@ public class SmallFireballController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/SnowballController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/SnowballController.java index d5782f78c..489c3207e 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/SnowballController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/SnowballController.java @@ -1,6 +1,5 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; @@ -8,9 +7,9 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftSnowball; import org.bukkit.entity.Snowball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -58,24 +57,10 @@ public class SnowballController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/SpectralArrowController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/SpectralArrowController.java index 2684e4773..29aa87904 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/SpectralArrowController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/SpectralArrowController.java @@ -1,6 +1,5 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftArrow; @@ -8,9 +7,9 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; import org.bukkit.entity.Arrow; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -58,24 +57,10 @@ public class SpectralArrowController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/TNTPrimedController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/TNTPrimedController.java index f87e21098..61e883663 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/TNTPrimedController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/TNTPrimedController.java @@ -1,6 +1,5 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; @@ -8,9 +7,9 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftTNTPrimed; import org.bukkit.entity.TNTPrimed; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -58,24 +57,10 @@ public class TNTPrimedController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ThrownExpBottleController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ThrownExpBottleController.java index 58fb21a69..f84f95d9d 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ThrownExpBottleController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ThrownExpBottleController.java @@ -1,6 +1,5 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; @@ -8,9 +7,9 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftThrownExpBottle; import org.bukkit.entity.ThrownExpBottle; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -58,24 +57,10 @@ public class ThrownExpBottleController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ThrownPotionController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ThrownPotionController.java index cf43fc3ec..0ffd298bf 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ThrownPotionController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ThrownPotionController.java @@ -1,6 +1,5 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; @@ -8,9 +7,9 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftThrownPotion; import org.bukkit.entity.ThrownPotion; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -59,24 +58,10 @@ public class ThrownPotionController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ThrownTridentController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ThrownTridentController.java index a313bd3b3..40852b5e4 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ThrownTridentController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/ThrownTridentController.java @@ -1,6 +1,5 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; @@ -8,9 +7,9 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftTrident; import org.bukkit.entity.Trident; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -58,24 +57,10 @@ public class ThrownTridentController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/TippedArrowController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/TippedArrowController.java index 482558b1b..d5fd3f94d 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/TippedArrowController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/TippedArrowController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftTippedArrow; import org.bukkit.entity.Arrow; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; @@ -58,24 +57,10 @@ public class TippedArrowController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/WitherSkullController.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/WitherSkullController.java index ef345b0dc..13c89c1f0 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/WitherSkullController.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/entity/nonliving/WitherSkullController.java @@ -1,6 +1,5 @@ package net.citizensnpcs.nms.v1_14_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; @@ -8,9 +7,9 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftWitherSkull; import org.bukkit.entity.WitherSkull; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_14_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -58,24 +57,10 @@ public class WitherSkullController extends MobEntityController { @Override public void f(double x, double y, double z) { - if (npc == null) { - super.f(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.f(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.f(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/BatController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/BatController.java index 7172a33f8..e2af35ab4 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/BatController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/BatController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftBat; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -9,7 +8,6 @@ import org.bukkit.entity.Bat; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -19,6 +17,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBat; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.NBTTagCompound; import net.minecraft.server.v1_15_R1.SoundEffect; @@ -129,24 +128,10 @@ public class BatController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/BeeController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/BeeController.java index d1e608a7c..bcfaa07f1 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/BeeController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/BeeController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftBee; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -9,7 +8,6 @@ import org.bukkit.entity.Bee; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -19,6 +17,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBee; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.NBTTagCompound; import net.minecraft.server.v1_15_R1.SoundEffect; @@ -128,24 +127,10 @@ public class BeeController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/BlazeController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/BlazeController.java index 2b44ab93e..86eaef663 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/BlazeController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/BlazeController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftBlaze; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -9,7 +8,6 @@ import org.bukkit.entity.Blaze; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -19,6 +17,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBlaze; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.NBTTagCompound; import net.minecraft.server.v1_15_R1.SoundEffect; @@ -128,25 +127,10 @@ public class BlazeController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.h(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/CatController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/CatController.java index 5efaf07d6..0b49a39a4 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/CatController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/CatController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftCat; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -9,7 +8,6 @@ import org.bukkit.entity.Cat; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -21,6 +19,7 @@ import net.minecraft.server.v1_15_R1.DataWatcherObject; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityCat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; import net.minecraft.server.v1_15_R1.NBTTagCompound; @@ -167,24 +166,10 @@ public class CatController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/CaveSpiderController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/CaveSpiderController.java index 52f96e900..88436b1f2 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/CaveSpiderController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/CaveSpiderController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftCaveSpider; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -9,7 +8,6 @@ import org.bukkit.entity.CaveSpider; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -20,6 +18,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityCaveSpider; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; import net.minecraft.server.v1_15_R1.NBTTagCompound; @@ -155,24 +154,10 @@ public class CaveSpiderController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ChickenController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ChickenController.java index 7c5bd96e2..706934d03 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ChickenController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ChickenController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftChicken; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -9,7 +8,6 @@ import org.bukkit.entity.Chicken; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -21,6 +19,7 @@ import net.minecraft.server.v1_15_R1.DataWatcherObject; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityChicken; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; import net.minecraft.server.v1_15_R1.NBTTagCompound; @@ -168,24 +167,10 @@ public class ChickenController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/CodController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/CodController.java index 4483bda5c..e6f292c21 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/CodController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/CodController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Cod; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.nms.v1_15_R1.util.PlayerControllerMove; @@ -174,24 +173,10 @@ public class CodController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/CowController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/CowController.java index fd8b1de92..9fc68a464 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/CowController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/CowController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftCow; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -9,7 +8,6 @@ import org.bukkit.entity.Cow; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -22,6 +20,7 @@ import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityCow; import net.minecraft.server.v1_15_R1.EntityHuman; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.EnumHand; import net.minecraft.server.v1_15_R1.IBlockData; @@ -182,24 +181,10 @@ public class CowController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/CreeperController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/CreeperController.java index c7014944d..1c8042aee 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/CreeperController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/CreeperController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftCreeper; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -9,7 +8,6 @@ import org.bukkit.entity.Creeper; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -21,6 +19,7 @@ import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityCreeper; import net.minecraft.server.v1_15_R1.EntityLightning; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; import net.minecraft.server.v1_15_R1.NBTTagCompound; @@ -156,25 +155,10 @@ public class CreeperController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.h(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/DolphinController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/DolphinController.java index e0d3b5591..fba529e14 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/DolphinController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/DolphinController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftDolphin; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -9,7 +8,6 @@ import org.bukkit.entity.Dolphin; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.nms.v1_15_R1.util.PlayerControllerMove; @@ -22,6 +20,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityDolphin; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; import net.minecraft.server.v1_15_R1.NBTTagCompound; @@ -171,24 +170,10 @@ public class DolphinController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/DrownedController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/DrownedController.java index e5ea712af..9722afc21 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/DrownedController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/DrownedController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftDrowned; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -9,7 +8,6 @@ import org.bukkit.entity.Drowned; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -20,6 +18,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityDrowned; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; import net.minecraft.server.v1_15_R1.NBTTagCompound; @@ -154,24 +153,10 @@ public class DrownedController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EnderDragonController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EnderDragonController.java index 6e8635b4e..14a2b5bf5 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EnderDragonController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EnderDragonController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEnderDragon; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -9,7 +8,6 @@ import org.bukkit.entity.EnderDragon; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -19,6 +17,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityEnderDragon; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.NBTTagCompound; import net.minecraft.server.v1_15_R1.SoundEffect; @@ -137,24 +136,10 @@ public class EnderDragonController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EndermanController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EndermanController.java index 0f98fb1b0..82db3e272 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EndermanController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EndermanController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEnderman; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -9,7 +8,6 @@ import org.bukkit.entity.Enderman; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -20,6 +18,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityEnderman; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; import net.minecraft.server.v1_15_R1.NBTTagCompound; @@ -162,24 +161,10 @@ public class EndermanController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EndermiteController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EndermiteController.java index 9818e9d93..9aba6d4ee 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EndermiteController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EndermiteController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEndermite; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -9,7 +8,6 @@ import org.bukkit.entity.Endermite; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -20,6 +18,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityEndermite; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; import net.minecraft.server.v1_15_R1.NBTTagCompound; @@ -154,24 +153,10 @@ public class EndermiteController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EntityHumanNPC.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EntityHumanNPC.java index a43495ae7..7c742e3a0 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EntityHumanNPC.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EntityHumanNPC.java @@ -20,7 +20,6 @@ import com.mojang.authlib.GameProfile; import net.citizensnpcs.Settings.Setting; import net.citizensnpcs.api.CitizensAPI; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.trait.trait.Inventory; import net.citizensnpcs.nms.v1_15_R1.network.EmptyNetHandler; @@ -243,25 +242,10 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.h(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EvokerController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EvokerController.java index bc111ae19..bff2a0c78 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EvokerController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/EvokerController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEvoker; @@ -9,7 +8,6 @@ import org.bukkit.entity.Evoker; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -20,6 +18,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityEvoker; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; import net.minecraft.server.v1_15_R1.NBTTagCompound; @@ -141,24 +140,10 @@ public class EvokerController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/FoxController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/FoxController.java index 77091345a..9e3ccd401 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/FoxController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/FoxController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftFox; @@ -9,7 +8,6 @@ import org.bukkit.entity.Fox; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -21,6 +19,7 @@ import net.minecraft.server.v1_15_R1.DataWatcherObject; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityFox; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; import net.minecraft.server.v1_15_R1.NBTTagCompound; @@ -153,24 +152,10 @@ public class FoxController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/GhastController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/GhastController.java index 4696251ec..6e4181631 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/GhastController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/GhastController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftGhast; @@ -9,7 +8,6 @@ import org.bukkit.entity.Ghast; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -19,6 +17,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityGhast; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.NBTTagCompound; import net.minecraft.server.v1_15_R1.SoundEffect; @@ -114,24 +113,10 @@ public class GhastController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/GiantController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/GiantController.java index 1b7cde802..23530f111 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/GiantController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/GiantController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftGiant; @@ -9,7 +8,6 @@ import org.bukkit.entity.Giant; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -20,6 +18,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityGiantZombie; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; import net.minecraft.server.v1_15_R1.NBTTagCompound; @@ -140,24 +139,10 @@ public class GiantController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/GuardianController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/GuardianController.java index 000649d45..6ffd3aff9 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/GuardianController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/GuardianController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftGuardian; @@ -9,7 +8,6 @@ import org.bukkit.entity.Guardian; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -20,6 +18,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityGuardian; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; import net.minecraft.server.v1_15_R1.NBTTagCompound; @@ -141,24 +140,10 @@ public class GuardianController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/GuardianElderController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/GuardianElderController.java index 99a19b661..0f674bef4 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/GuardianElderController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/GuardianElderController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftElderGuardian; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -9,7 +8,6 @@ import org.bukkit.entity.ElderGuardian; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -20,6 +18,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityGuardianElder; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; import net.minecraft.server.v1_15_R1.NBTTagCompound; @@ -141,24 +140,10 @@ public class GuardianElderController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HorseController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HorseController.java index 7ce6b6706..bb26d7a21 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HorseController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HorseController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -10,7 +9,6 @@ import org.bukkit.entity.Horse; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -25,6 +23,7 @@ import net.minecraft.server.v1_15_R1.DataWatcherObject; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityHorse; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.GenericAttributes; import net.minecraft.server.v1_15_R1.IBlockData; @@ -183,24 +182,10 @@ public class HorseController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HorseDonkeyController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HorseDonkeyController.java index 178b29129..2217ee672 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HorseDonkeyController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HorseDonkeyController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftDonkey; @@ -10,7 +9,6 @@ import org.bukkit.entity.Donkey; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -25,6 +23,7 @@ import net.minecraft.server.v1_15_R1.DataWatcherObject; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityHorseDonkey; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.GenericAttributes; import net.minecraft.server.v1_15_R1.IBlockData; @@ -182,24 +181,10 @@ public class HorseDonkeyController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HorseMuleController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HorseMuleController.java index b95c36bbe..aaccc8fc4 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HorseMuleController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HorseMuleController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -10,7 +9,6 @@ import org.bukkit.entity.Mule; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -25,6 +23,7 @@ import net.minecraft.server.v1_15_R1.DataWatcherObject; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityHorseMule; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.GenericAttributes; import net.minecraft.server.v1_15_R1.IBlockData; @@ -182,24 +181,10 @@ public class HorseMuleController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HorseSkeletonController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HorseSkeletonController.java index 894c4a417..38d8d0965 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HorseSkeletonController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HorseSkeletonController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -10,7 +9,6 @@ import org.bukkit.entity.SkeletonHorse; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -25,6 +23,7 @@ import net.minecraft.server.v1_15_R1.DataWatcherObject; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityHorseSkeleton; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.GenericAttributes; import net.minecraft.server.v1_15_R1.IBlockData; @@ -183,24 +182,10 @@ public class HorseSkeletonController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HorseZombieController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HorseZombieController.java index 27539c67c..ffb49b598 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HorseZombieController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/HorseZombieController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -10,7 +9,6 @@ import org.bukkit.entity.ZombieHorse; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -25,6 +23,7 @@ import net.minecraft.server.v1_15_R1.DataWatcherObject; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityHorseZombie; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.GenericAttributes; import net.minecraft.server.v1_15_R1.IBlockData; @@ -183,24 +182,10 @@ public class HorseZombieController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/IllusionerController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/IllusionerController.java index e61baf4ad..fbea9417c 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/IllusionerController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/IllusionerController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftIllusioner; @@ -9,7 +8,6 @@ import org.bukkit.entity.Illusioner; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -20,6 +18,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityIllagerIllusioner; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; import net.minecraft.server.v1_15_R1.NBTTagCompound; @@ -141,24 +140,10 @@ public class IllusionerController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/IronGolemController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/IronGolemController.java index 7c4ae1ec7..e2cfa2346 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/IronGolemController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/IronGolemController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftIronGolem; @@ -9,7 +8,6 @@ import org.bukkit.entity.IronGolem; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -20,6 +18,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityIronGolem; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; import net.minecraft.server.v1_15_R1.NBTTagCompound; @@ -140,24 +139,10 @@ public class IronGolemController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/LlamaController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/LlamaController.java index 2a3958501..d94a7d4c4 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/LlamaController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/LlamaController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -10,7 +9,6 @@ import org.bukkit.entity.Llama; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -24,6 +22,7 @@ import net.minecraft.server.v1_15_R1.DataWatcherObject; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityLlama; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; import net.minecraft.server.v1_15_R1.NBTTagCompound; @@ -164,24 +163,10 @@ public class LlamaController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/MagmaCubeController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/MagmaCubeController.java index 68ad3e200..1f3dc57c0 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/MagmaCubeController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/MagmaCubeController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftMagmaCube; @@ -9,7 +8,6 @@ import org.bukkit.entity.MagmaCube; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.nms.v1_15_R1.util.PlayerControllerMove; @@ -23,6 +21,7 @@ import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityHuman; import net.minecraft.server.v1_15_R1.EntityMagmaCube; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; import net.minecraft.server.v1_15_R1.NBTTagCompound; @@ -147,24 +146,10 @@ public class MagmaCubeController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/MushroomCowController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/MushroomCowController.java index 5ba128893..e70f3eff0 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/MushroomCowController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/MushroomCowController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftMushroomCow; @@ -9,7 +8,6 @@ import org.bukkit.entity.MushroomCow; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -21,6 +19,7 @@ import net.minecraft.server.v1_15_R1.DataWatcherObject; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityHuman; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityMushroomCow; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.EnumHand; @@ -163,24 +162,10 @@ public class MushroomCowController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/OcelotController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/OcelotController.java index efb36f6a2..d9552b28c 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/OcelotController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/OcelotController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftOcelot; @@ -9,7 +8,6 @@ import org.bukkit.entity.Ocelot; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -20,6 +18,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.DataWatcherObject; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityOcelot; import net.minecraft.server.v1_15_R1.EntityPose; import net.minecraft.server.v1_15_R1.EntityTypes; @@ -155,24 +154,10 @@ public class OcelotController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PandaController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PandaController.java index adc03a1fd..0a71c3c55 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PandaController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PandaController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPanda; @@ -9,7 +8,6 @@ import org.bukkit.entity.Panda; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -20,6 +18,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.DataWatcherObject; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityPanda; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; @@ -153,24 +152,10 @@ public class PandaController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ParrotController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ParrotController.java index 4200ee84d..00e14d801 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ParrotController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ParrotController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftParrot; @@ -9,7 +8,6 @@ import org.bukkit.entity.Parrot; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -19,6 +17,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityHuman; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityParrot; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.EnumHand; @@ -125,24 +124,10 @@ public class ParrotController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PhantomController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PhantomController.java index c8feaac4e..3c7c66627 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PhantomController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PhantomController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPhantom; @@ -9,7 +8,6 @@ import org.bukkit.entity.Phantom; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.nms.v1_15_R1.util.PlayerControllerMove; @@ -22,6 +20,7 @@ import net.minecraft.server.v1_15_R1.ControllerMove; import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityPhantom; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.EnumDifficulty; @@ -159,24 +158,10 @@ public class PhantomController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PigController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PigController.java index 1b17aa799..a47650bb4 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PigController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PigController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPig; @@ -9,7 +8,6 @@ import org.bukkit.entity.Pig; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -21,6 +19,7 @@ import net.minecraft.server.v1_15_R1.DataWatcherObject; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityLightning; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityPig; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; @@ -161,24 +160,10 @@ public class PigController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PigZombieController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PigZombieController.java index 314bd89a0..e32d75bbc 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PigZombieController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PigZombieController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPigZombie; @@ -9,7 +8,6 @@ import org.bukkit.entity.PigZombie; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -19,6 +17,7 @@ import net.minecraft.server.v1_15_R1.BlockPosition; import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityPigZombie; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; @@ -141,25 +140,10 @@ public class PigZombieController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.h(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PillagerController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PillagerController.java index bde52aa49..4d3f3171d 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PillagerController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PillagerController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPillager; @@ -9,7 +8,6 @@ import org.bukkit.entity.Pillager; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -20,6 +18,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.DataWatcherObject; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityPillager; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; @@ -153,24 +152,10 @@ public class PillagerController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PolarBearController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PolarBearController.java index 07056ce66..b877a9231 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PolarBearController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PolarBearController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPolarBear; @@ -9,7 +8,6 @@ import org.bukkit.entity.PolarBear; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -19,6 +17,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.DataWatcherObject; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityPolarBear; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.NBTTagCompound; @@ -128,24 +127,10 @@ public class PolarBearController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PufferFishController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PufferFishController.java index 26d181c46..3642b15ce 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PufferFishController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/PufferFishController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.PufferFish; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.nms.v1_15_R1.util.PlayerControllerMove; @@ -177,24 +176,10 @@ public class PufferFishController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/RabbitController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/RabbitController.java index 882288b49..e67699c66 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/RabbitController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/RabbitController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftRabbit; @@ -9,7 +8,6 @@ import org.bukkit.entity.Rabbit; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -22,6 +20,7 @@ import net.minecraft.server.v1_15_R1.DataWatcherObject; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityLiving; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityRabbit; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; @@ -162,24 +161,10 @@ public class RabbitController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/RavagerController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/RavagerController.java index 172b91f7c..c04fdb663 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/RavagerController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/RavagerController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftRavager; @@ -9,7 +8,6 @@ import org.bukkit.entity.Ravager; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -20,6 +18,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.DataWatcherObject; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityRavager; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; @@ -153,24 +152,10 @@ public class RavagerController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SalmonController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SalmonController.java index cfe5ea8c8..6686cb45f 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SalmonController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SalmonController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Salmon; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.nms.v1_15_R1.util.PlayerControllerMove; @@ -160,24 +159,10 @@ public class SalmonController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SheepController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SheepController.java index 0ad52bf7f..fdd0c3584 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SheepController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SheepController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftSheep; @@ -9,7 +8,6 @@ import org.bukkit.entity.Sheep; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -20,6 +18,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.DataWatcherObject; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntitySheep; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; @@ -154,24 +153,10 @@ public class SheepController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ShulkerController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ShulkerController.java index c5500fba1..a2f4080cf 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ShulkerController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ShulkerController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftShulker; @@ -9,7 +8,6 @@ import org.bukkit.entity.Shulker; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -20,6 +18,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityAIBodyControl; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityShulker; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; @@ -141,24 +140,10 @@ public class ShulkerController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SilverfishController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SilverfishController.java index 64391710f..38733489b 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SilverfishController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SilverfishController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftSilverfish; @@ -9,7 +8,6 @@ import org.bukkit.entity.Silverfish; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -19,6 +17,7 @@ import net.minecraft.server.v1_15_R1.BlockPosition; import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntitySilverfish; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; @@ -138,24 +137,10 @@ public class SilverfishController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SkeletonController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SkeletonController.java index 8648fdb98..3139e0d50 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SkeletonController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SkeletonController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftSkeleton; @@ -9,7 +8,6 @@ import org.bukkit.entity.Skeleton; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -19,6 +17,7 @@ import net.minecraft.server.v1_15_R1.BlockPosition; import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntitySkeleton; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; @@ -140,24 +139,10 @@ public class SkeletonController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SkeletonStrayController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SkeletonStrayController.java index 1e1bf5008..19a96afa0 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SkeletonStrayController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SkeletonStrayController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftStray; @@ -9,7 +8,6 @@ import org.bukkit.entity.Stray; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -19,6 +17,7 @@ import net.minecraft.server.v1_15_R1.BlockPosition; import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntitySkeletonStray; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; @@ -140,24 +139,10 @@ public class SkeletonStrayController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SkeletonWitherController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SkeletonWitherController.java index 0dff2e140..085d66dcb 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SkeletonWitherController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SkeletonWitherController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftWitherSkeleton; @@ -9,7 +8,6 @@ import org.bukkit.entity.WitherSkeleton; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -19,6 +17,7 @@ import net.minecraft.server.v1_15_R1.BlockPosition; import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntitySkeletonWither; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; @@ -140,24 +139,10 @@ public class SkeletonWitherController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SlimeController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SlimeController.java index 7d400bb41..ce5d951ab 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SlimeController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SlimeController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftSlime; @@ -9,7 +8,6 @@ import org.bukkit.entity.Slime; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.nms.v1_15_R1.util.PlayerControllerMove; @@ -22,6 +20,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityHuman; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntitySlime; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; @@ -148,24 +147,10 @@ public class SlimeController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SnowmanController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SnowmanController.java index 753368c7a..f88c644c4 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SnowmanController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SnowmanController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftSnowman; @@ -9,7 +8,6 @@ import org.bukkit.entity.Snowman; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -19,6 +17,7 @@ import net.minecraft.server.v1_15_R1.BlockPosition; import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntitySnowman; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.GameRules; @@ -141,24 +140,10 @@ public class SnowmanController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SpiderController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SpiderController.java index 61f776f8e..22ab9fc55 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SpiderController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SpiderController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftSpider; @@ -9,7 +8,6 @@ import org.bukkit.entity.Spider; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -19,6 +17,7 @@ import net.minecraft.server.v1_15_R1.BlockPosition; import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntitySpider; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; @@ -140,24 +139,10 @@ public class SpiderController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SquidController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SquidController.java index 635633a17..9b3e94d3a 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SquidController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/SquidController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftSquid; @@ -9,7 +8,6 @@ import org.bukkit.entity.Squid; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -19,6 +17,7 @@ import net.minecraft.server.v1_15_R1.BlockPosition; import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntitySquid; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; @@ -140,24 +139,10 @@ public class SquidController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/TraderLlamaController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/TraderLlamaController.java index 72e4dc7bd..59a403bcb 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/TraderLlamaController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/TraderLlamaController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import java.lang.invoke.MethodHandle; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -12,7 +11,6 @@ import org.bukkit.entity.TraderLlama; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -26,6 +24,7 @@ import net.minecraft.server.v1_15_R1.DataWatcherObject; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityLlamaTrader; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; import net.minecraft.server.v1_15_R1.NBTTagCompound; @@ -167,24 +166,10 @@ public class TraderLlamaController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/TropicalFishController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/TropicalFishController.java index ab83dc17b..8aefdc40b 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/TropicalFishController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/TropicalFishController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.TropicalFish; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.nms.v1_15_R1.util.PlayerControllerMove; @@ -160,24 +159,10 @@ public class TropicalFishController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/TurtleController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/TurtleController.java index cfc2e2110..3b08b8d1c 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/TurtleController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/TurtleController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftTurtle; @@ -9,7 +8,6 @@ import org.bukkit.entity.Turtle; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.nms.v1_15_R1.util.PlayerControllerMove; @@ -23,6 +21,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityInsentient; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTurtle; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.IBlockData; @@ -160,24 +159,10 @@ public class TurtleController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/VexController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/VexController.java index f6a506490..e95fa5684 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/VexController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/VexController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftVex; @@ -9,7 +8,6 @@ import org.bukkit.entity.Vex; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -18,6 +16,7 @@ import net.citizensnpcs.util.Util; import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.EntityVex; import net.minecraft.server.v1_15_R1.NBTTagCompound; @@ -115,24 +114,10 @@ public class VexController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/VillagerController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/VillagerController.java index 6e87b4f1a..c37ed5a92 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/VillagerController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/VillagerController.java @@ -10,7 +10,6 @@ import org.bukkit.entity.Villager; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -185,24 +184,10 @@ public class VillagerController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } public boolean isBlockingTrades() { diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/VindicatorController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/VindicatorController.java index d8b7b2ae7..80bb09b02 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/VindicatorController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/VindicatorController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftVindicator; @@ -9,7 +8,6 @@ import org.bukkit.entity.Vindicator; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -20,6 +18,7 @@ import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.DataWatcherObject; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.EntityVindicator; import net.minecraft.server.v1_15_R1.IBlockData; @@ -155,24 +154,10 @@ public class VindicatorController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/WanderingTraderController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/WanderingTraderController.java index df2ac634c..3091aeff8 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/WanderingTraderController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/WanderingTraderController.java @@ -10,7 +10,6 @@ import org.bukkit.entity.WanderingTrader; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -183,24 +182,10 @@ public class WanderingTraderController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } public boolean isBlockingTrades() { diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/WitchController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/WitchController.java index 4c2e08151..ef8c955d4 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/WitchController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/WitchController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftWitch; @@ -9,7 +8,6 @@ import org.bukkit.entity.Witch; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -19,6 +17,7 @@ import net.minecraft.server.v1_15_R1.BlockPosition; import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.EntityWitch; import net.minecraft.server.v1_15_R1.IBlockData; @@ -140,24 +139,10 @@ public class WitchController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/WitherController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/WitherController.java index 9ade80538..cd9bdf6c0 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/WitherController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/WitherController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftWither; @@ -9,7 +8,6 @@ import org.bukkit.entity.Wither; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -18,6 +16,7 @@ import net.citizensnpcs.util.Util; import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.EntityWither; import net.minecraft.server.v1_15_R1.NBTTagCompound; @@ -113,24 +112,10 @@ public class WitherController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/WolfController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/WolfController.java index 0f79e1915..8907db07d 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/WolfController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/WolfController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftWolf; @@ -10,7 +9,6 @@ import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -22,6 +20,7 @@ import net.minecraft.server.v1_15_R1.DataWatcherObject; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; import net.minecraft.server.v1_15_R1.EntityLiving; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.EntityWolf; import net.minecraft.server.v1_15_R1.IBlockData; @@ -157,24 +156,10 @@ public class WolfController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ZombieController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ZombieController.java index 328e353a0..df242fea6 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ZombieController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ZombieController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftZombie; @@ -9,7 +8,6 @@ import org.bukkit.entity.Zombie; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -19,6 +17,7 @@ import net.minecraft.server.v1_15_R1.BlockPosition; import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.EntityZombie; import net.minecraft.server.v1_15_R1.IBlockData; @@ -140,24 +139,10 @@ public class ZombieController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ZombieHuskController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ZombieHuskController.java index 23b007b51..691f4eddf 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ZombieHuskController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ZombieHuskController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftHusk; @@ -9,7 +8,6 @@ import org.bukkit.entity.Husk; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -19,6 +17,7 @@ import net.minecraft.server.v1_15_R1.BlockPosition; import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.EntityZombieHusk; import net.minecraft.server.v1_15_R1.IBlockData; @@ -140,24 +139,10 @@ public class ZombieHuskController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ZombieVillagerController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ZombieVillagerController.java index 567f584ee..3753985c3 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ZombieVillagerController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ZombieVillagerController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftVillagerZombie; @@ -9,7 +8,6 @@ import org.bukkit.entity.ZombieVillager; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -19,6 +17,7 @@ import net.minecraft.server.v1_15_R1.BlockPosition; import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; +import net.minecraft.server.v1_15_R1.EntityMinecartAbstract; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.EntityZombieVillager; import net.minecraft.server.v1_15_R1.IBlockData; @@ -140,24 +139,10 @@ public class ZombieVillagerController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/AreaEffectCloudController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/AreaEffectCloudController.java index fe61cabfe..b804984a4 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/AreaEffectCloudController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/AreaEffectCloudController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; -import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftAreaEffectCloud; @@ -10,8 +7,9 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.entity.AreaEffectCloud; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -73,24 +71,10 @@ public class AreaEffectCloudController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ArmorStandController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ArmorStandController.java index 799f249e0..fe10c49ea 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ArmorStandController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ArmorStandController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; -import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftArmorStand; @@ -12,8 +9,9 @@ import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -90,24 +88,10 @@ public class ArmorStandController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/BoatController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/BoatController.java index 6cb7a55b6..0b7c16c53 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/BoatController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/BoatController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.entity.Boat; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; @@ -99,24 +98,10 @@ public class BoatController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } private EnumStatus s() { diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/DragonFireballController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/DragonFireballController.java index a8d86ef6d..014702786 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/DragonFireballController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/DragonFireballController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.entity.DragonFireball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; @@ -72,24 +71,10 @@ public class DragonFireballController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/EggController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/EggController.java index caef47f9b..16aaf4854 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/EggController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/EggController.java @@ -10,7 +10,6 @@ import org.bukkit.entity.Egg; import org.bukkit.entity.Entity; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.AbstractEntityController; @@ -88,24 +87,10 @@ public class EggController extends AbstractEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/EnderCrystalController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/EnderCrystalController.java index bebf7b722..c9187dfb2 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/EnderCrystalController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/EnderCrystalController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; -import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEnderCrystal; @@ -10,8 +7,9 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.entity.EnderCrystal; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -73,24 +71,10 @@ public class EnderCrystalController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/EnderPearlController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/EnderPearlController.java index a712c8a7e..9f854f123 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/EnderPearlController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/EnderPearlController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; -import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEnderPearl; @@ -10,8 +7,9 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.entity.EnderPearl; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -73,24 +71,10 @@ public class EnderPearlController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/EnderSignalController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/EnderSignalController.java index b763aa04c..f4d3731d8 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/EnderSignalController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/EnderSignalController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; -import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEnderSignal; @@ -10,8 +7,9 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.entity.EnderSignal; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -73,24 +71,10 @@ public class EnderSignalController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/EvokerFangsController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/EvokerFangsController.java index d631da5c8..9cf4906cf 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/EvokerFangsController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/EvokerFangsController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; -import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -12,8 +9,9 @@ import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -76,24 +74,10 @@ public class EvokerFangsController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ExperienceOrbController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ExperienceOrbController.java index 1ca116827..b415d451c 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ExperienceOrbController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ExperienceOrbController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; -import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -10,8 +7,9 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftExperienceOrb; import org.bukkit.entity.ExperienceOrb; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -59,24 +57,10 @@ public class ExperienceOrbController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/FallingBlockController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/FallingBlockController.java index 9c9cfe2a7..cc28996fa 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/FallingBlockController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/FallingBlockController.java @@ -13,7 +13,6 @@ import org.bukkit.entity.FallingBlock; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; @@ -91,24 +90,10 @@ public class FallingBlockController extends AbstractEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/FireworkController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/FireworkController.java index 377760684..505107522 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/FireworkController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/FireworkController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; -import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -10,8 +7,9 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftFirework; import org.bukkit.entity.Firework; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -59,24 +57,10 @@ public class FireworkController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/FishingHookController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/FishingHookController.java index b593b99e6..4e7d10950 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/FishingHookController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/FishingHookController.java @@ -2,9 +2,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; import java.util.UUID; -import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; -import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -14,8 +11,9 @@ import org.bukkit.util.Vector; import com.mojang.authlib.GameProfile; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.NMS; @@ -73,24 +71,10 @@ public class FishingHookController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ItemController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ItemController.java index 9b476b64b..8a9e9ca6f 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ItemController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ItemController.java @@ -13,7 +13,6 @@ import org.bukkit.entity.Item; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; @@ -82,24 +81,10 @@ public class ItemController extends AbstractEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ItemFrameController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ItemFrameController.java index 036a8a4fe..35c7c62d5 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ItemFrameController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ItemFrameController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; -import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -14,9 +11,10 @@ import org.bukkit.entity.ItemFrame; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -75,24 +73,10 @@ public class ItemFrameController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/LargeFireballController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/LargeFireballController.java index 0e16c9304..fa251bbbb 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/LargeFireballController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/LargeFireballController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftLargeFireball; import org.bukkit.entity.LargeFireball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; @@ -58,24 +57,10 @@ public class LargeFireballController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/LeashController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/LeashController.java index 2cd16190e..87253db40 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/LeashController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/LeashController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; -import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -10,8 +7,9 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftLeash; import org.bukkit.entity.LeashHitch; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -59,24 +57,10 @@ public class LeashController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/LlamaSpitController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/LlamaSpitController.java index ade8f3be2..2e2a039da 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/LlamaSpitController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/LlamaSpitController.java @@ -10,7 +10,6 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.LlamaSpit; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.AbstractEntityController; @@ -77,24 +76,10 @@ public class LlamaSpitController extends AbstractEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartChestController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartChestController.java index 7daba2216..76b802af1 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartChestController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartChestController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftMinecartChest; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; @@ -71,24 +70,10 @@ public class MinecartChestController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartCommandController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartCommandController.java index 536c52cf6..378f493e6 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartCommandController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartCommandController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftMinecartCommand; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; @@ -71,24 +70,10 @@ public class MinecartCommandController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartFurnaceController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartFurnaceController.java index 348b20d0f..660a74a02 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartFurnaceController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartFurnaceController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftMinecartFurnace; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; @@ -71,24 +70,10 @@ public class MinecartFurnaceController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartHopperController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartHopperController.java index c7ca7889f..21665b796 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartHopperController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartHopperController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; @@ -59,24 +58,10 @@ public class MinecartHopperController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartRideableController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartRideableController.java index 2d2f7f87f..bd1cad9c3 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartRideableController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartRideableController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftMinecartRideable; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; @@ -71,24 +70,10 @@ public class MinecartRideableController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartSpawnerController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartSpawnerController.java index 43d0e4348..4a6f81c26 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartSpawnerController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartSpawnerController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; @@ -59,24 +58,10 @@ public class MinecartSpawnerController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartTNTController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartTNTController.java index f34978cfd..8824bda18 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartTNTController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/MinecartTNTController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; @@ -59,24 +58,10 @@ public class MinecartTNTController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/PaintingController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/PaintingController.java index 143c0d207..2d8289e74 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/PaintingController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/PaintingController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; -import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -10,8 +7,9 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPainting; import org.bukkit.entity.Painting; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -59,24 +57,10 @@ public class PaintingController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ShulkerBulletController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ShulkerBulletController.java index a350f54af..e31d7c6c6 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ShulkerBulletController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ShulkerBulletController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; -import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -10,8 +7,9 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftShulkerBullet; import org.bukkit.entity.ShulkerBullet; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -59,24 +57,10 @@ public class ShulkerBulletController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/SmallFireballController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/SmallFireballController.java index 616f82ac6..eaaa2299b 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/SmallFireballController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/SmallFireballController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; -import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -10,8 +7,9 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftSmallFireball; import org.bukkit.entity.SmallFireball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -59,24 +57,10 @@ public class SmallFireballController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/SnowballController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/SnowballController.java index ff61f47c8..a30803d06 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/SnowballController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/SnowballController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; -import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -10,8 +7,9 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftSnowball; import org.bukkit.entity.Snowball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -59,24 +57,10 @@ public class SnowballController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/SpectralArrowController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/SpectralArrowController.java index 88b438106..d3b535e22 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/SpectralArrowController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/SpectralArrowController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; -import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftArrow; @@ -10,8 +7,9 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.entity.Arrow; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -59,24 +57,10 @@ public class SpectralArrowController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/TNTPrimedController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/TNTPrimedController.java index b40567a23..7459a105b 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/TNTPrimedController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/TNTPrimedController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; -import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -10,8 +7,9 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftTNTPrimed; import org.bukkit.entity.TNTPrimed; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -59,24 +57,10 @@ public class TNTPrimedController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ThrownExpBottleController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ThrownExpBottleController.java index 7cd69bf02..b3c302821 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ThrownExpBottleController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ThrownExpBottleController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; -import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -10,8 +7,9 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftThrownExpBottle; import org.bukkit.entity.ThrownExpBottle; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -59,24 +57,10 @@ public class ThrownExpBottleController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ThrownPotionController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ThrownPotionController.java index eab0a71e8..6129d062a 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ThrownPotionController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ThrownPotionController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; -import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -10,8 +7,9 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftThrownPotion; import org.bukkit.entity.ThrownPotion; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -60,24 +58,10 @@ public class ThrownPotionController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ThrownTridentController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ThrownTridentController.java index 75142b1f4..5654d8bc4 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ThrownTridentController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/ThrownTridentController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; -import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -10,8 +7,9 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftTrident; import org.bukkit.entity.Trident; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -59,24 +57,10 @@ public class ThrownTridentController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/TippedArrowController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/TippedArrowController.java index ff30f4312..75533395c 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/TippedArrowController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/TippedArrowController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftTippedArrow; import org.bukkit.entity.Arrow; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; @@ -71,24 +70,10 @@ public class TippedArrowController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/WitherSkullController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/WitherSkullController.java index 215f84daa..f5daf249b 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/WitherSkullController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/nonliving/WitherSkullController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_15_R1.entity.nonliving; -import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; -import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -10,8 +7,9 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftWitherSkull; import org.bukkit.entity.WitherSkull; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_15_R1.entity.MobEntityController; +import net.citizensnpcs.nms.v1_15_R1.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -59,24 +57,10 @@ public class WitherSkullController extends MobEntityController { @Override public void h(double x, double y, double z) { - if (npc == null) { - super.h(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.h(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.h(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/BatController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/BatController.java index 7eaa9d8d9..5bc117c24 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/BatController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/BatController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftBat; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -9,8 +8,8 @@ import org.bukkit.entity.Bat; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -19,6 +18,7 @@ import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBat; import net.minecraft.server.v1_16_R3.EntityBoat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.NBTTagCompound; import net.minecraft.server.v1_16_R3.SoundEffect; @@ -34,17 +34,9 @@ public class BatController extends MobEntityController { return (Bat) super.getBukkitEntity(); } - public static class BatNPC extends CraftBat implements NPCHolder { - private final CitizensNPC npc; - + public static class BatNPC extends CraftBat implements ForwardingNPCHolder { public BatNPC(EntityBatNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } @@ -129,24 +121,10 @@ public class BatController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/BeeController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/BeeController.java index 53530c207..7d28c2063 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/BeeController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/BeeController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftBee; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -9,8 +8,8 @@ import org.bukkit.entity.Bee; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -19,6 +18,7 @@ import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBee; import net.minecraft.server.v1_16_R3.EntityBoat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.NBTTagCompound; import net.minecraft.server.v1_16_R3.SoundEffect; @@ -34,17 +34,9 @@ public class BeeController extends MobEntityController { return (Bee) super.getBukkitEntity(); } - public static class BeeNPC extends CraftBee implements NPCHolder { - private final CitizensNPC npc; - + public static class BeeNPC extends CraftBee implements ForwardingNPCHolder { public BeeNPC(EntityBeeNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } @@ -128,24 +120,10 @@ public class BeeController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/BlazeController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/BlazeController.java index e826890eb..1a5ca777d 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/BlazeController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/BlazeController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftBlaze; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -9,8 +8,8 @@ import org.bukkit.entity.Blaze; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -19,6 +18,7 @@ import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBlaze; import net.minecraft.server.v1_16_R3.EntityBoat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.NBTTagCompound; import net.minecraft.server.v1_16_R3.SoundEffect; @@ -34,17 +34,9 @@ public class BlazeController extends MobEntityController { return (Blaze) super.getBukkitEntity(); } - public static class BlazeNPC extends CraftBlaze implements NPCHolder { - private final CitizensNPC npc; - + public static class BlazeNPC extends CraftBlaze implements ForwardingNPCHolder { public BlazeNPC(EntityBlazeNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } @@ -128,25 +120,10 @@ public class BlazeController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.i(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/CatController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/CatController.java index efc4efcfb..984628e91 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/CatController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/CatController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftCat; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -9,8 +8,8 @@ import org.bukkit.entity.Cat; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -21,6 +20,7 @@ import net.minecraft.server.v1_16_R3.DataWatcherObject; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; import net.minecraft.server.v1_16_R3.EntityCat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; import net.minecraft.server.v1_16_R3.NBTTagCompound; @@ -38,17 +38,9 @@ public class CatController extends MobEntityController { return (Cat) super.getBukkitEntity(); } - public static class CatNPC extends CraftCat implements NPCHolder { - private final CitizensNPC npc; - + public static class CatNPC extends CraftCat implements ForwardingNPCHolder { public CatNPC(EntityCatNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } @@ -115,15 +107,6 @@ public class CatController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -137,6 +120,15 @@ public class CatController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -167,24 +159,10 @@ public class CatController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/CaveSpiderController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/CaveSpiderController.java index 6e1cff2c2..9c49da955 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/CaveSpiderController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/CaveSpiderController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftCaveSpider; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -9,8 +8,8 @@ import org.bukkit.entity.CaveSpider; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -20,6 +19,7 @@ import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; import net.minecraft.server.v1_16_R3.EntityCaveSpider; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; import net.minecraft.server.v1_16_R3.NBTTagCompound; @@ -37,17 +37,9 @@ public class CaveSpiderController extends MobEntityController { return (CaveSpider) super.getBukkitEntity(); } - public static class CaveSpiderNPC extends CraftCaveSpider implements NPCHolder { - private final CitizensNPC npc; - + public static class CaveSpiderNPC extends CraftCaveSpider implements ForwardingNPCHolder { public CaveSpiderNPC(EntityCaveSpiderNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } @@ -103,15 +95,6 @@ public class CaveSpiderController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -125,6 +108,15 @@ public class CaveSpiderController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -155,24 +147,10 @@ public class CaveSpiderController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ChickenController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ChickenController.java index a7f57683c..40e050781 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ChickenController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ChickenController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftChicken; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -9,8 +8,8 @@ import org.bukkit.entity.Chicken; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -21,6 +20,7 @@ import net.minecraft.server.v1_16_R3.DataWatcherObject; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; import net.minecraft.server.v1_16_R3.EntityChicken; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; import net.minecraft.server.v1_16_R3.NBTTagCompound; @@ -38,17 +38,9 @@ public class ChickenController extends MobEntityController { return (Chicken) super.getBukkitEntity(); } - public static class ChickenNPC extends CraftChicken implements NPCHolder { - private final CitizensNPC npc; - + public static class ChickenNPC extends CraftChicken implements ForwardingNPCHolder { public ChickenNPC(EntityChickenNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } @@ -116,15 +108,6 @@ public class ChickenController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -138,6 +121,15 @@ public class ChickenController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -168,24 +160,10 @@ public class ChickenController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/CodController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/CodController.java index 4d9a45901..a1407bc6c 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/CodController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/CodController.java @@ -8,8 +8,8 @@ import org.bukkit.entity.Cod; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.nms.v1_16_R3.util.PlayerControllerMove; import net.citizensnpcs.npc.CitizensNPC; @@ -44,17 +44,9 @@ public class CodController extends MobEntityController { return (Cod) super.getBukkitEntity(); } - public static class CodNPC extends CraftCod implements NPCHolder { - private final CitizensNPC npc; - + public static class CodNPC extends CraftCod implements ForwardingNPCHolder { public CodNPC(EntityCodNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } @@ -175,24 +167,10 @@ public class CodController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/CowController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/CowController.java index b31f2b5a7..4f7429159 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/CowController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/CowController.java @@ -8,8 +8,8 @@ import org.bukkit.entity.Cow; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -43,17 +43,9 @@ public class CowController extends MobEntityController { return (Cow) super.getBukkitEntity(); } - public static class CowNPC extends CraftCow implements NPCHolder { - private final CitizensNPC npc; - + public static class CowNPC extends CraftCow implements ForwardingNPCHolder { public CowNPC(EntityCowNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } @@ -183,24 +175,10 @@ public class CowController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/CreeperController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/CreeperController.java index 30a605bdb..b55f874b0 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/CreeperController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/CreeperController.java @@ -8,8 +8,8 @@ import org.bukkit.entity.Creeper; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -39,17 +39,9 @@ public class CreeperController extends MobEntityController { return (Creeper) super.getBukkitEntity(); } - public static class CreeperNPC extends CraftCreeper implements NPCHolder { - private final CitizensNPC npc; - + public static class CreeperNPC extends CraftCreeper implements ForwardingNPCHolder { public CreeperNPC(EntityCreeperNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } @@ -157,25 +149,10 @@ public class CreeperController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.i(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/DolphinController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/DolphinController.java index eb2130ad7..f52252452 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/DolphinController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/DolphinController.java @@ -8,8 +8,8 @@ import org.bukkit.entity.Dolphin; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.nms.v1_16_R3.util.PlayerControllerMove; import net.citizensnpcs.npc.CitizensNPC; @@ -41,17 +41,9 @@ public class DolphinController extends MobEntityController { return (Dolphin) super.getBukkitEntity(); } - public static class DolphinNPC extends CraftDolphin implements NPCHolder { - private final CitizensNPC npc; - + public static class DolphinNPC extends CraftDolphin implements ForwardingNPCHolder { public DolphinNPC(EntityDolphinNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } @@ -171,24 +163,10 @@ public class DolphinController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/DrownedController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/DrownedController.java index c877a6ce0..b49e97f3d 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/DrownedController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/DrownedController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftDrowned; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -9,8 +8,8 @@ import org.bukkit.entity.Drowned; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -20,6 +19,7 @@ import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; import net.minecraft.server.v1_16_R3.EntityDrowned; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; import net.minecraft.server.v1_16_R3.NBTTagCompound; @@ -37,17 +37,9 @@ public class DrownedController extends MobEntityController { return (Drowned) super.getBukkitEntity(); } - public static class DrownedNPC extends CraftDrowned implements NPCHolder { - private final CitizensNPC npc; - + public static class DrownedNPC extends CraftDrowned implements ForwardingNPCHolder { public DrownedNPC(EntityDrownedNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } @@ -102,15 +94,6 @@ public class DrownedController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -124,6 +107,15 @@ public class DrownedController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -154,24 +146,10 @@ public class DrownedController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/EnderDragonController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/EnderDragonController.java index 5b303e2c9..59d449d5f 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/EnderDragonController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/EnderDragonController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEnderDragon; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -9,8 +8,8 @@ import org.bukkit.entity.EnderDragon; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -19,6 +18,7 @@ import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; import net.minecraft.server.v1_16_R3.EntityEnderDragon; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.NBTTagCompound; import net.minecraft.server.v1_16_R3.SoundEffect; @@ -35,17 +35,9 @@ public class EnderDragonController extends MobEntityController { return (EnderDragon) super.getBukkitEntity(); } - public static class EnderDragonNPC extends CraftEnderDragon implements NPCHolder { - private final CitizensNPC npc; - + public static class EnderDragonNPC extends CraftEnderDragon implements ForwardingNPCHolder { public EnderDragonNPC(EntityEnderDragonNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } @@ -137,24 +129,10 @@ public class EnderDragonController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/EndermanController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/EndermanController.java index 4e718ea62..13e224fef 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/EndermanController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/EndermanController.java @@ -8,8 +8,8 @@ import org.bukkit.entity.Enderman; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -37,17 +37,9 @@ public class EndermanController extends MobEntityController { return (Enderman) super.getBukkitEntity(); } - public static class EndermanNPC extends CraftEnderman implements NPCHolder { - private final CitizensNPC npc; - + public static class EndermanNPC extends CraftEnderman implements ForwardingNPCHolder { public EndermanNPC(EntityEndermanNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } @@ -162,24 +154,10 @@ public class EndermanController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/EndermiteController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/EndermiteController.java index 543b3cec7..f4062fe8a 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/EndermiteController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/EndermiteController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEndermite; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -9,8 +8,8 @@ import org.bukkit.entity.Endermite; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -20,6 +19,7 @@ import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; import net.minecraft.server.v1_16_R3.EntityEndermite; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; import net.minecraft.server.v1_16_R3.NBTTagCompound; @@ -37,17 +37,9 @@ public class EndermiteController extends MobEntityController { return (Endermite) super.getBukkitEntity(); } - public static class EndermiteNPC extends CraftEndermite implements NPCHolder { - private final CitizensNPC npc; - + public static class EndermiteNPC extends CraftEndermite implements ForwardingNPCHolder { public EndermiteNPC(EntityEndermiteNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } @@ -102,15 +94,6 @@ public class EndermiteController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -124,6 +107,15 @@ public class EndermiteController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -154,24 +146,10 @@ public class EndermiteController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/EvokerController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/EvokerController.java index aea5e2f93..33a979db6 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/EvokerController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/EvokerController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEvoker; @@ -9,8 +8,8 @@ import org.bukkit.entity.Evoker; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -20,6 +19,7 @@ import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; import net.minecraft.server.v1_16_R3.EntityEvoker; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; import net.minecraft.server.v1_16_R3.NBTTagCompound; @@ -89,15 +89,6 @@ public class EvokerController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -111,6 +102,15 @@ public class EvokerController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -141,24 +141,10 @@ public class EvokerController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -201,17 +187,9 @@ public class EvokerController extends MobEntityController { } } - public static class EvokerNPC extends CraftEvoker implements NPCHolder { - private final CitizensNPC npc; - + public static class EvokerNPC extends CraftEvoker implements ForwardingNPCHolder { public EvokerNPC(EntityEvokerNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/FoxController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/FoxController.java index acc49f6ee..bab7b3d4a 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/FoxController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/FoxController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftFox; @@ -9,8 +8,8 @@ import org.bukkit.entity.Fox; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -21,6 +20,7 @@ import net.minecraft.server.v1_16_R3.DataWatcherObject; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; import net.minecraft.server.v1_16_R3.EntityFox; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; import net.minecraft.server.v1_16_R3.NBTTagCompound; @@ -101,15 +101,6 @@ public class FoxController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -123,6 +114,15 @@ public class FoxController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -153,24 +153,10 @@ public class FoxController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -213,17 +199,9 @@ public class FoxController extends MobEntityController { } } - public static class FoxNPC extends CraftFox implements NPCHolder { - private final CitizensNPC npc; - + public static class FoxNPC extends CraftFox implements ForwardingNPCHolder { public FoxNPC(EntityFoxNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/GhastController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/GhastController.java index 20c7a0c46..469124a41 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/GhastController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/GhastController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftGhast; @@ -9,8 +8,8 @@ import org.bukkit.entity.Ghast; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -19,6 +18,7 @@ import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; import net.minecraft.server.v1_16_R3.EntityGhast; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.NBTTagCompound; import net.minecraft.server.v1_16_R3.SoundEffect; @@ -114,24 +114,10 @@ public class GhastController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -173,17 +159,9 @@ public class GhastController extends MobEntityController { } } - public static class GhastNPC extends CraftGhast implements NPCHolder { - private final CitizensNPC npc; - + public static class GhastNPC extends CraftGhast implements ForwardingNPCHolder { public GhastNPC(EntityGhastNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/GiantController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/GiantController.java index a92721111..f059bdcd3 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/GiantController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/GiantController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftGiant; @@ -9,8 +8,8 @@ import org.bukkit.entity.Giant; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -20,6 +19,7 @@ import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; import net.minecraft.server.v1_16_R3.EntityGiantZombie; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; import net.minecraft.server.v1_16_R3.NBTTagCompound; @@ -88,15 +88,6 @@ public class GiantController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -110,6 +101,15 @@ public class GiantController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -140,24 +140,10 @@ public class GiantController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -209,17 +195,9 @@ public class GiantController extends MobEntityController { } } - public static class GiantNPC extends CraftGiant implements NPCHolder { - private final CitizensNPC npc; - + public static class GiantNPC extends CraftGiant implements ForwardingNPCHolder { public GiantNPC(EntityGiantNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/GuardianController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/GuardianController.java index 7ce4b6431..fdbb74821 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/GuardianController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/GuardianController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftGuardian; @@ -9,8 +8,8 @@ import org.bukkit.entity.Guardian; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -20,6 +19,7 @@ import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; import net.minecraft.server.v1_16_R3.EntityGuardian; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; import net.minecraft.server.v1_16_R3.NBTTagCompound; @@ -89,15 +89,6 @@ public class GuardianController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -111,6 +102,15 @@ public class GuardianController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -141,24 +141,10 @@ public class GuardianController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -216,17 +202,9 @@ public class GuardianController extends MobEntityController { } } - public static class GuardianNPC extends CraftGuardian implements NPCHolder { - private final CitizensNPC npc; - + public static class GuardianNPC extends CraftGuardian implements ForwardingNPCHolder { public GuardianNPC(EntityGuardianNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/GuardianElderController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/GuardianElderController.java index a36833d78..146c76ce2 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/GuardianElderController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/GuardianElderController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftElderGuardian; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -9,8 +8,8 @@ import org.bukkit.entity.ElderGuardian; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -20,6 +19,7 @@ import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; import net.minecraft.server.v1_16_R3.EntityGuardianElder; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; import net.minecraft.server.v1_16_R3.NBTTagCompound; @@ -89,15 +89,6 @@ public class GuardianElderController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -111,6 +102,15 @@ public class GuardianElderController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -141,24 +141,10 @@ public class GuardianElderController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -216,17 +202,9 @@ public class GuardianElderController extends MobEntityController { } } - public static class GuardianElderNPC extends CraftElderGuardian implements NPCHolder { - private final CitizensNPC npc; - + public static class GuardianElderNPC extends CraftElderGuardian implements ForwardingNPCHolder { public GuardianElderNPC(EntityGuardianElderNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HoglinController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HoglinController.java index 3bab6bef9..0adb1b6e5 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HoglinController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HoglinController.java @@ -8,8 +8,8 @@ import org.bukkit.entity.Hoglin; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -140,25 +140,10 @@ public class HoglinController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.i(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -204,17 +189,9 @@ public class HoglinController extends MobEntityController { } } - public static class HoglinNPC extends CraftHoglin implements NPCHolder { - private final CitizensNPC npc; - + public static class HoglinNPC extends CraftHoglin implements ForwardingNPCHolder { public HoglinNPC(EntityHoglinNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HorseController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HorseController.java index 173de5329..5d2c815e6 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HorseController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HorseController.java @@ -9,8 +9,8 @@ import org.bukkit.entity.Horse; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -183,24 +183,10 @@ public class HorseController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -259,17 +245,9 @@ public class HorseController extends MobEntityController { } } - public static class HorseNPC extends CraftHorse implements NPCHolder { - private final CitizensNPC npc; - + public static class HorseNPC extends CraftHorse implements ForwardingNPCHolder { public HorseNPC(EntityHorseNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HorseDonkeyController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HorseDonkeyController.java index 11d810acf..931071fcf 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HorseDonkeyController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HorseDonkeyController.java @@ -9,8 +9,8 @@ import org.bukkit.entity.Donkey; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -182,24 +182,10 @@ public class HorseDonkeyController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -257,17 +243,9 @@ public class HorseDonkeyController extends MobEntityController { } } - public static class HorseDonkeyNPC extends CraftDonkey implements NPCHolder { - private final CitizensNPC npc; - + public static class HorseDonkeyNPC extends CraftDonkey implements ForwardingNPCHolder { public HorseDonkeyNPC(EntityHorseDonkeyNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HorseMuleController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HorseMuleController.java index 07699c6c7..691cfa866 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HorseMuleController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HorseMuleController.java @@ -9,8 +9,8 @@ import org.bukkit.entity.Mule; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -182,24 +182,10 @@ public class HorseMuleController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -257,17 +243,9 @@ public class HorseMuleController extends MobEntityController { } } - public static class HorseMuleNPC extends CraftMule implements NPCHolder { - private final CitizensNPC npc; - + public static class HorseMuleNPC extends CraftMule implements ForwardingNPCHolder { public HorseMuleNPC(EntityHorseMuleNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HorseSkeletonController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HorseSkeletonController.java index ef370669f..7ff30c53b 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HorseSkeletonController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HorseSkeletonController.java @@ -9,8 +9,8 @@ import org.bukkit.entity.SkeletonHorse; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -183,24 +183,10 @@ public class HorseSkeletonController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -258,17 +244,9 @@ public class HorseSkeletonController extends MobEntityController { } } - public static class HorseSkeletonNPC extends CraftSkeletonHorse implements NPCHolder { - private final CitizensNPC npc; - + public static class HorseSkeletonNPC extends CraftSkeletonHorse implements ForwardingNPCHolder { public HorseSkeletonNPC(EntityHorseSkeletonNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HorseZombieController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HorseZombieController.java index 9cf50ddea..5f8111c2b 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HorseZombieController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HorseZombieController.java @@ -9,8 +9,8 @@ import org.bukkit.entity.ZombieHorse; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -183,24 +183,10 @@ public class HorseZombieController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -258,17 +244,9 @@ public class HorseZombieController extends MobEntityController { } } - public static class HorseZombieNPC extends CraftZombieHorse implements NPCHolder { - private final CitizensNPC npc; - + public static class HorseZombieNPC extends CraftZombieHorse implements ForwardingNPCHolder { public HorseZombieNPC(EntityHorseZombieNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/IllusionerController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/IllusionerController.java index ed0333d3a..cc25e5e53 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/IllusionerController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/IllusionerController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftIllusioner; @@ -9,8 +8,8 @@ import org.bukkit.entity.Illusioner; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -20,6 +19,7 @@ import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; import net.minecraft.server.v1_16_R3.EntityIllagerIllusioner; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; import net.minecraft.server.v1_16_R3.NBTTagCompound; @@ -89,15 +89,6 @@ public class IllusionerController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -111,6 +102,15 @@ public class IllusionerController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -141,24 +141,10 @@ public class IllusionerController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -201,17 +187,9 @@ public class IllusionerController extends MobEntityController { } } - public static class IllusionerNPC extends CraftIllusioner implements NPCHolder { - private final CitizensNPC npc; - + public static class IllusionerNPC extends CraftIllusioner implements ForwardingNPCHolder { public IllusionerNPC(EntityIllusionerNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/IronGolemController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/IronGolemController.java index 55935e212..6ef4caaf7 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/IronGolemController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/IronGolemController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftIronGolem; @@ -9,8 +8,8 @@ import org.bukkit.entity.IronGolem; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -20,6 +19,7 @@ import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; import net.minecraft.server.v1_16_R3.EntityIronGolem; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; import net.minecraft.server.v1_16_R3.NBTTagCompound; @@ -88,15 +88,6 @@ public class IronGolemController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -110,6 +101,15 @@ public class IronGolemController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -140,24 +140,10 @@ public class IronGolemController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -209,17 +195,9 @@ public class IronGolemController extends MobEntityController { } } - public static class IronGolemNPC extends CraftIronGolem implements NPCHolder { - private final CitizensNPC npc; - + public static class IronGolemNPC extends CraftIronGolem implements ForwardingNPCHolder { public IronGolemNPC(EntityIronGolemNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/LlamaController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/LlamaController.java index 7751fb73e..b319b5861 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/LlamaController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/LlamaController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -10,8 +9,8 @@ import org.bukkit.entity.Llama; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -24,6 +23,7 @@ import net.minecraft.server.v1_16_R3.DataWatcherObject; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; import net.minecraft.server.v1_16_R3.EntityLlama; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; import net.minecraft.server.v1_16_R3.NBTTagCompound; @@ -112,15 +112,6 @@ public class LlamaController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -134,6 +125,15 @@ public class LlamaController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -164,24 +164,10 @@ public class LlamaController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -229,17 +215,9 @@ public class LlamaController extends MobEntityController { } } - public static class LlamaNPC extends CraftLlama implements NPCHolder { - private final CitizensNPC npc; - + public static class LlamaNPC extends CraftLlama implements ForwardingNPCHolder { public LlamaNPC(EntityLlamaNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/MagmaCubeController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/MagmaCubeController.java index 1becbf567..a2f25f850 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/MagmaCubeController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/MagmaCubeController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftMagmaCube; @@ -9,8 +8,8 @@ import org.bukkit.entity.MagmaCube; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.nms.v1_16_R3.util.PlayerControllerMove; import net.citizensnpcs.npc.CitizensNPC; @@ -23,6 +22,7 @@ import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; import net.minecraft.server.v1_16_R3.EntityHuman; import net.minecraft.server.v1_16_R3.EntityMagmaCube; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; import net.minecraft.server.v1_16_R3.NBTTagCompound; @@ -95,15 +95,6 @@ public class MagmaCubeController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -117,6 +108,15 @@ public class MagmaCubeController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -147,24 +147,10 @@ public class MagmaCubeController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -229,17 +215,9 @@ public class MagmaCubeController extends MobEntityController { } } - public static class MagmaCubeNPC extends CraftMagmaCube implements NPCHolder { - private final CitizensNPC npc; - + public static class MagmaCubeNPC extends CraftMagmaCube implements ForwardingNPCHolder { public MagmaCubeNPC(EntityMagmaCubeNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/MushroomCowController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/MushroomCowController.java index bd30413a6..e3e75d221 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/MushroomCowController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/MushroomCowController.java @@ -8,8 +8,8 @@ import org.bukkit.entity.MushroomCow; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -164,24 +164,10 @@ public class MushroomCowController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -224,17 +210,9 @@ public class MushroomCowController extends MobEntityController { } } - public static class MushroomCowNPC extends CraftMushroomCow implements NPCHolder { - private final CitizensNPC npc; - + public static class MushroomCowNPC extends CraftMushroomCow implements ForwardingNPCHolder { public MushroomCowNPC(EntityMushroomCowNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/OcelotController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/OcelotController.java index 6457e7797..02309c072 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/OcelotController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/OcelotController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftOcelot; @@ -9,8 +8,8 @@ import org.bukkit.entity.Ocelot; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -20,6 +19,7 @@ import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.DataWatcherObject; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityOcelot; import net.minecraft.server.v1_16_R3.EntityPose; import net.minecraft.server.v1_16_R3.EntityTypes; @@ -103,15 +103,6 @@ public class OcelotController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -125,6 +116,15 @@ public class OcelotController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -155,24 +155,10 @@ public class OcelotController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -220,17 +206,9 @@ public class OcelotController extends MobEntityController { } } - public static class OcelotNPC extends CraftOcelot implements NPCHolder { - private final CitizensNPC npc; - + public static class OcelotNPC extends CraftOcelot implements ForwardingNPCHolder { public OcelotNPC(EntityOcelotNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PandaController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PandaController.java index dd4b36b62..654e5734c 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PandaController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PandaController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPanda; @@ -9,8 +8,8 @@ import org.bukkit.entity.Panda; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -20,6 +19,7 @@ import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.DataWatcherObject; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityPanda; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; @@ -101,15 +101,6 @@ public class PandaController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -123,6 +114,15 @@ public class PandaController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -153,24 +153,10 @@ public class PandaController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -213,17 +199,9 @@ public class PandaController extends MobEntityController { } } - public static class PandaNPC extends CraftPanda implements NPCHolder { - private final CitizensNPC npc; - + public static class PandaNPC extends CraftPanda implements ForwardingNPCHolder { public PandaNPC(EntityPandaNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ParrotController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ParrotController.java index f89ef0afb..e099b2733 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ParrotController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ParrotController.java @@ -8,8 +8,8 @@ import org.bukkit.entity.Parrot; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -126,24 +126,10 @@ public class ParrotController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -184,17 +170,9 @@ public class ParrotController extends MobEntityController { } } - public static class ParrotNPC extends CraftParrot implements NPCHolder { - private final CitizensNPC npc; - + public static class ParrotNPC extends CraftParrot implements ForwardingNPCHolder { public ParrotNPC(EntityParrotNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PhantomController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PhantomController.java index 34e41fe27..9b7078575 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PhantomController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PhantomController.java @@ -8,8 +8,8 @@ import org.bukkit.entity.Phantom; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.nms.v1_16_R3.util.PlayerControllerMove; import net.citizensnpcs.npc.CitizensNPC; @@ -160,24 +160,10 @@ public class PhantomController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -246,17 +232,9 @@ public class PhantomController extends MobEntityController { } } - public static class PhantomNPC extends CraftPhantom implements NPCHolder { - private final CitizensNPC npc; - + public static class PhantomNPC extends CraftPhantom implements ForwardingNPCHolder { public PhantomNPC(EntityPhantomNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PigController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PigController.java index af0b199c0..905eb0660 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PigController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PigController.java @@ -8,8 +8,8 @@ import org.bukkit.entity.Pig; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -162,24 +162,10 @@ public class PigController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -229,17 +215,9 @@ public class PigController extends MobEntityController { } } - public static class PigNPC extends CraftPig implements NPCHolder { - private final CitizensNPC npc; - + public static class PigNPC extends CraftPig implements ForwardingNPCHolder { public PigNPC(EntityPigNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PigZombieController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PigZombieController.java index b4d3e16eb..f463facae 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PigZombieController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PigZombieController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPigZombie; @@ -9,8 +8,8 @@ import org.bukkit.entity.PigZombie; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -19,6 +18,7 @@ import net.minecraft.server.v1_16_R3.BlockPosition; import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityPigZombie; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; @@ -89,15 +89,6 @@ public class PigZombieController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -111,6 +102,15 @@ public class PigZombieController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -141,25 +141,10 @@ public class PigZombieController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.i(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -202,17 +187,9 @@ public class PigZombieController extends MobEntityController { } } - public static class PigZombieNPC extends CraftPigZombie implements NPCHolder { - private final CitizensNPC npc; - + public static class PigZombieNPC extends CraftPigZombie implements ForwardingNPCHolder { public PigZombieNPC(EntityPigZombieNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PiglinBruteController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PiglinBruteController.java index 31d2007cf..c0fd66a7e 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PiglinBruteController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PiglinBruteController.java @@ -10,8 +10,8 @@ import org.bukkit.entity.PiglinBrute; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -145,25 +145,10 @@ public class PiglinBruteController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.i(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -209,17 +194,9 @@ public class PiglinBruteController extends MobEntityController { } } - public static class PiglinBruteNPC extends CraftPiglinBrute implements NPCHolder { - private final CitizensNPC npc; - + public static class PiglinBruteNPC extends CraftPiglinBrute implements ForwardingNPCHolder { public PiglinBruteNPC(EntityPiglinBruteNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PiglinController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PiglinController.java index eedb093ea..9828b76c5 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PiglinController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PiglinController.java @@ -8,8 +8,8 @@ import org.bukkit.entity.Piglin; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -140,25 +140,10 @@ public class PiglinController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.i(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -204,17 +189,9 @@ public class PiglinController extends MobEntityController { } } - public static class PiglinNPC extends CraftPiglin implements NPCHolder { - private final CitizensNPC npc; - + public static class PiglinNPC extends CraftPiglin implements ForwardingNPCHolder { public PiglinNPC(EntityPiglinNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PillagerController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PillagerController.java index b42c06bf6..4f9615086 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PillagerController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PillagerController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPillager; @@ -9,8 +8,8 @@ import org.bukkit.entity.Pillager; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -20,6 +19,7 @@ import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.DataWatcherObject; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityPillager; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; @@ -101,15 +101,6 @@ public class PillagerController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -123,6 +114,15 @@ public class PillagerController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -153,24 +153,10 @@ public class PillagerController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -213,17 +199,9 @@ public class PillagerController extends MobEntityController { } } - public static class PillagerNPC extends CraftPillager implements NPCHolder { - private final CitizensNPC npc; - + public static class PillagerNPC extends CraftPillager implements ForwardingNPCHolder { public PillagerNPC(EntityPillagerNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PolarBearController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PolarBearController.java index 9cd7a7f10..c624cb02a 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PolarBearController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PolarBearController.java @@ -8,8 +8,8 @@ import org.bukkit.entity.PolarBear; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -128,24 +128,10 @@ public class PolarBearController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -180,17 +166,9 @@ public class PolarBearController extends MobEntityController { } } - public static class PolarBearNPC extends CraftPolarBear implements NPCHolder { - private final CitizensNPC npc; - + public static class PolarBearNPC extends CraftPolarBear implements ForwardingNPCHolder { public PolarBearNPC(EntityPolarBearNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PufferFishController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PufferFishController.java index 5d1a1c9d7..282dbeeb1 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PufferFishController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/PufferFishController.java @@ -8,8 +8,8 @@ import org.bukkit.entity.PufferFish; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.nms.v1_16_R3.util.PlayerControllerMove; import net.citizensnpcs.npc.CitizensNPC; @@ -178,24 +178,10 @@ public class PufferFishController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -264,8 +250,9 @@ public class PufferFishController extends MobEntityController { NMSImpl.resetPuffTicks(this); } super.tick(); - if (npc != null && npc.hasTrait(PufferFishTrait.class)) { - setPuffState(npc.getOrAddTrait(PufferFishTrait.class).getPuffState()); + PufferFishTrait trait = null; + if (npc != null && (trait = npc.getTraitNullable(PufferFishTrait.class)) != null) { + setPuffState(trait.getPuffState()); } } @@ -281,17 +268,9 @@ public class PufferFishController extends MobEntityController { } } - public static class PufferFishNPC extends CraftPufferFish implements NPCHolder { - private final CitizensNPC npc; - + public static class PufferFishNPC extends CraftPufferFish implements ForwardingNPCHolder { public PufferFishNPC(EntityPufferFishNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/RabbitController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/RabbitController.java index d9c5e14aa..8ae0569e3 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/RabbitController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/RabbitController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftRabbit; @@ -9,8 +8,8 @@ import org.bukkit.entity.Rabbit; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -22,6 +21,7 @@ import net.minecraft.server.v1_16_R3.DataWatcherObject; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; import net.minecraft.server.v1_16_R3.EntityLiving; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityRabbit; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; @@ -105,15 +105,6 @@ public class RabbitController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -127,6 +118,15 @@ public class RabbitController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -162,24 +162,10 @@ public class RabbitController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -236,17 +222,9 @@ public class RabbitController extends MobEntityController { } } - public static class RabbitNPC extends CraftRabbit implements NPCHolder { - private final CitizensNPC npc; - + public static class RabbitNPC extends CraftRabbit implements ForwardingNPCHolder { public RabbitNPC(EntityRabbitNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/RavagerController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/RavagerController.java index b9489d1a9..ea1b57aaf 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/RavagerController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/RavagerController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftRavager; @@ -9,8 +8,8 @@ import org.bukkit.entity.Ravager; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -20,6 +19,7 @@ import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.DataWatcherObject; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityRavager; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; @@ -101,15 +101,6 @@ public class RavagerController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -123,6 +114,15 @@ public class RavagerController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -153,24 +153,10 @@ public class RavagerController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -213,17 +199,9 @@ public class RavagerController extends MobEntityController { } } - public static class RavagerNPC extends CraftRavager implements NPCHolder { - private final CitizensNPC npc; - + public static class RavagerNPC extends CraftRavager implements ForwardingNPCHolder { public RavagerNPC(EntityRavagerNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SalmonController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SalmonController.java index 427f81603..86b588006 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SalmonController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SalmonController.java @@ -8,8 +8,8 @@ import org.bukkit.entity.Salmon; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.nms.v1_16_R3.util.PlayerControllerMove; import net.citizensnpcs.npc.CitizensNPC; @@ -161,24 +161,10 @@ public class SalmonController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -242,17 +228,9 @@ public class SalmonController extends MobEntityController { } } - public static class SalmonNPC extends CraftSalmon implements NPCHolder { - private final CitizensNPC npc; - + public static class SalmonNPC extends CraftSalmon implements ForwardingNPCHolder { public SalmonNPC(EntitySalmonNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SheepController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SheepController.java index 9de8a99ff..755387506 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SheepController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SheepController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftSheep; @@ -9,8 +8,8 @@ import org.bukkit.entity.Sheep; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -20,6 +19,7 @@ import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.DataWatcherObject; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntitySheep; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; @@ -102,15 +102,6 @@ public class SheepController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -124,6 +115,15 @@ public class SheepController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -154,24 +154,10 @@ public class SheepController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -214,17 +200,9 @@ public class SheepController extends MobEntityController { } } - public static class SheepNPC extends CraftSheep implements NPCHolder { - private final CitizensNPC npc; - + public static class SheepNPC extends CraftSheep implements ForwardingNPCHolder { public SheepNPC(EntitySheepNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ShulkerController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ShulkerController.java index cf2b33a10..4195b8d88 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ShulkerController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ShulkerController.java @@ -8,8 +8,8 @@ import org.bukkit.entity.Shulker; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -141,24 +141,10 @@ public class ShulkerController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -226,17 +212,9 @@ public class ShulkerController extends MobEntityController { } } - public static class ShulkerNPC extends CraftShulker implements NPCHolder { - private final CitizensNPC npc; - + public static class ShulkerNPC extends CraftShulker implements ForwardingNPCHolder { public ShulkerNPC(EntityShulkerNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SilverfishController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SilverfishController.java index f600915ab..19cdbb74b 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SilverfishController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SilverfishController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftSilverfish; @@ -9,8 +8,8 @@ import org.bukkit.entity.Silverfish; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -19,6 +18,7 @@ import net.minecraft.server.v1_16_R3.BlockPosition; import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntitySilverfish; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; @@ -88,15 +88,6 @@ public class SilverfishController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) @@ -108,6 +99,15 @@ public class SilverfishController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -138,24 +138,10 @@ public class SilverfishController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -207,17 +193,9 @@ public class SilverfishController extends MobEntityController { } } - public static class SilverfishNPC extends CraftSilverfish implements NPCHolder { - private final CitizensNPC npc; - + public static class SilverfishNPC extends CraftSilverfish implements ForwardingNPCHolder { public SilverfishNPC(EntitySilverfishNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SkeletonController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SkeletonController.java index 90b5e7542..e1bbe5c1f 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SkeletonController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SkeletonController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftSkeleton; @@ -9,8 +8,8 @@ import org.bukkit.entity.Skeleton; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -19,6 +18,7 @@ import net.minecraft.server.v1_16_R3.BlockPosition; import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntitySkeleton; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; @@ -88,15 +88,6 @@ public class SkeletonController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -110,6 +101,15 @@ public class SkeletonController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -140,24 +140,10 @@ public class SkeletonController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -209,17 +195,9 @@ public class SkeletonController extends MobEntityController { } } - public static class SkeletonNPC extends CraftSkeleton implements NPCHolder { - private final CitizensNPC npc; - + public static class SkeletonNPC extends CraftSkeleton implements ForwardingNPCHolder { public SkeletonNPC(EntitySkeletonNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SkeletonStrayController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SkeletonStrayController.java index 7a9f5a3c6..a5f302a2f 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SkeletonStrayController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SkeletonStrayController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftStray; @@ -9,8 +8,8 @@ import org.bukkit.entity.Stray; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -19,6 +18,7 @@ import net.minecraft.server.v1_16_R3.BlockPosition; import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntitySkeletonStray; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; @@ -88,15 +88,6 @@ public class SkeletonStrayController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -110,6 +101,15 @@ public class SkeletonStrayController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -140,24 +140,10 @@ public class SkeletonStrayController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -209,17 +195,9 @@ public class SkeletonStrayController extends MobEntityController { } } - public static class StrayNPC extends CraftStray implements NPCHolder { - private final CitizensNPC npc; - + public static class StrayNPC extends CraftStray implements ForwardingNPCHolder { public StrayNPC(EntityStrayNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SkeletonWitherController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SkeletonWitherController.java index 0a7c70c17..a18b95c92 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SkeletonWitherController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SkeletonWitherController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftWitherSkeleton; @@ -9,8 +8,8 @@ import org.bukkit.entity.WitherSkeleton; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -19,6 +18,7 @@ import net.minecraft.server.v1_16_R3.BlockPosition; import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntitySkeletonWither; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; @@ -88,15 +88,6 @@ public class SkeletonWitherController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -110,6 +101,15 @@ public class SkeletonWitherController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -140,24 +140,10 @@ public class SkeletonWitherController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -209,17 +195,9 @@ public class SkeletonWitherController extends MobEntityController { } } - public static class SkeletonWitherNPC extends CraftWitherSkeleton implements NPCHolder { - private final CitizensNPC npc; - + public static class SkeletonWitherNPC extends CraftWitherSkeleton implements ForwardingNPCHolder { public SkeletonWitherNPC(EntitySkeletonWitherNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SlimeController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SlimeController.java index e37a36ce4..ee2c56ddb 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SlimeController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SlimeController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftSlime; @@ -9,8 +8,8 @@ import org.bukkit.entity.Slime; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.nms.v1_16_R3.util.PlayerControllerMove; import net.citizensnpcs.npc.CitizensNPC; @@ -22,6 +21,7 @@ import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; import net.minecraft.server.v1_16_R3.EntityHuman; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntitySlime; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; @@ -96,15 +96,6 @@ public class SlimeController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -118,6 +109,15 @@ public class SlimeController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -148,24 +148,10 @@ public class SlimeController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -230,17 +216,9 @@ public class SlimeController extends MobEntityController { } } - public static class SlimeNPC extends CraftSlime implements NPCHolder { - private final CitizensNPC npc; - + public static class SlimeNPC extends CraftSlime implements ForwardingNPCHolder { public SlimeNPC(EntitySlimeNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SnowmanController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SnowmanController.java index 0b9015666..33d4c46c3 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SnowmanController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SnowmanController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftSnowman; @@ -9,8 +8,8 @@ import org.bukkit.entity.Snowman; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -19,6 +18,7 @@ import net.minecraft.server.v1_16_R3.BlockPosition; import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntitySnowman; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.GameRules; @@ -89,15 +89,6 @@ public class SnowmanController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -111,6 +102,15 @@ public class SnowmanController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -141,24 +141,10 @@ public class SnowmanController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -222,17 +208,9 @@ public class SnowmanController extends MobEntityController { } } - public static class SnowmanNPC extends CraftSnowman implements NPCHolder { - private final CitizensNPC npc; - + public static class SnowmanNPC extends CraftSnowman implements ForwardingNPCHolder { public SnowmanNPC(EntitySnowmanNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SpiderController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SpiderController.java index a6bce517d..8ab7e389e 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SpiderController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SpiderController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftSpider; @@ -9,8 +8,8 @@ import org.bukkit.entity.Spider; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -19,6 +18,7 @@ import net.minecraft.server.v1_16_R3.BlockPosition; import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntitySpider; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; @@ -88,15 +88,6 @@ public class SpiderController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -110,6 +101,15 @@ public class SpiderController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -140,24 +140,10 @@ public class SpiderController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -210,17 +196,9 @@ public class SpiderController extends MobEntityController { } - public static class SpiderNPC extends CraftSpider implements NPCHolder { - private final CitizensNPC npc; - + public static class SpiderNPC extends CraftSpider implements ForwardingNPCHolder { public SpiderNPC(EntitySpiderNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SquidController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SquidController.java index a6b0f6b45..02572655d 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SquidController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/SquidController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftSquid; @@ -9,8 +8,8 @@ import org.bukkit.entity.Squid; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -19,6 +18,7 @@ import net.minecraft.server.v1_16_R3.BlockPosition; import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntitySquid; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; @@ -88,15 +88,6 @@ public class SquidController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -110,6 +101,15 @@ public class SquidController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -140,24 +140,10 @@ public class SquidController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -209,17 +195,9 @@ public class SquidController extends MobEntityController { } } - public static class SquidNPC extends CraftSquid implements NPCHolder { - private final CitizensNPC npc; - + public static class SquidNPC extends CraftSquid implements ForwardingNPCHolder { public SquidNPC(EntitySquidNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/StriderController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/StriderController.java index 9c898f33d..145dfdb3c 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/StriderController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/StriderController.java @@ -8,8 +8,8 @@ import org.bukkit.entity.Strider; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -140,25 +140,10 @@ public class StriderController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.i(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -201,17 +186,9 @@ public class StriderController extends MobEntityController { } } - public static class StriderNPC extends CraftStrider implements NPCHolder { - private final CitizensNPC npc; - + public static class StriderNPC extends CraftStrider implements ForwardingNPCHolder { public StriderNPC(EntityStriderNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/TraderLlamaController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/TraderLlamaController.java index 70532e068..a68088f1e 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/TraderLlamaController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/TraderLlamaController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import java.lang.invoke.MethodHandle; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -12,8 +11,8 @@ import org.bukkit.entity.TraderLlama; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -26,6 +25,7 @@ import net.minecraft.server.v1_16_R3.DataWatcherObject; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; import net.minecraft.server.v1_16_R3.EntityLlamaTrader; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.IBlockData; import net.minecraft.server.v1_16_R3.NBTTagCompound; @@ -115,15 +115,6 @@ public class TraderLlamaController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -137,6 +128,15 @@ public class TraderLlamaController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -167,24 +167,10 @@ public class TraderLlamaController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -240,17 +226,10 @@ public class TraderLlamaController extends MobEntityController { private static final MethodHandle bF = NMS.getSetter(EntityLlamaTrader.class, "bF"); } - public static class TraderLlamaNPC extends CraftTraderLlama implements NPCHolder { - private final CitizensNPC npc; + public static class TraderLlamaNPC extends CraftTraderLlama implements ForwardingNPCHolder { public TraderLlamaNPC(EntityTraderLlamaNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/TropicalFishController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/TropicalFishController.java index feb7f7fe0..cace03cac 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/TropicalFishController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/TropicalFishController.java @@ -8,8 +8,8 @@ import org.bukkit.entity.TropicalFish; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.nms.v1_16_R3.util.PlayerControllerMove; import net.citizensnpcs.npc.CitizensNPC; @@ -161,24 +161,10 @@ public class TropicalFishController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -244,17 +230,9 @@ public class TropicalFishController extends MobEntityController { } } - public static class TropicalFishNPC extends CraftTropicalFish implements NPCHolder { - private final CitizensNPC npc; - + public static class TropicalFishNPC extends CraftTropicalFish implements ForwardingNPCHolder { public TropicalFishNPC(EntityTropicalFishNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/TurtleController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/TurtleController.java index 90de644e9..fcaa9dc05 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/TurtleController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/TurtleController.java @@ -8,8 +8,8 @@ import org.bukkit.entity.Turtle; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.nms.v1_16_R3.util.PlayerControllerMove; import net.citizensnpcs.npc.CitizensNPC; @@ -160,24 +160,10 @@ public class TurtleController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -239,17 +225,9 @@ public class TurtleController extends MobEntityController { } } - public static class TurtleNPC extends CraftTurtle implements NPCHolder { - private final CitizensNPC npc; - + public static class TurtleNPC extends CraftTurtle implements ForwardingNPCHolder { public TurtleNPC(EntityTurtleNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/VexController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/VexController.java index cd0652ebc..89dc268ac 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/VexController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/VexController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftVex; @@ -9,8 +8,8 @@ import org.bukkit.entity.Vex; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -18,6 +17,7 @@ import net.citizensnpcs.util.Util; import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.EntityVex; import net.minecraft.server.v1_16_R3.NBTTagCompound; @@ -115,24 +115,10 @@ public class VexController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -167,17 +153,9 @@ public class VexController extends MobEntityController { } } - public static class VexNPC extends CraftVex implements NPCHolder { - private final CitizensNPC npc; - + public static class VexNPC extends CraftVex implements ForwardingNPCHolder { public VexNPC(EntityVexNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/VillagerController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/VillagerController.java index 589789a42..75a339451 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/VillagerController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/VillagerController.java @@ -10,8 +10,8 @@ import org.bukkit.entity.Villager; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -187,24 +187,10 @@ public class VillagerController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } public boolean isBlockingTrades() { @@ -264,17 +250,9 @@ public class VillagerController extends MobEntityController { } } - public static class VillagerNPC extends CraftVillager implements NPCHolder { - private final CitizensNPC npc; - + public static class VillagerNPC extends CraftVillager implements ForwardingNPCHolder { public VillagerNPC(EntityVillagerNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/VindicatorController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/VindicatorController.java index 4b797cc1e..f3c432f28 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/VindicatorController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/VindicatorController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftVindicator; @@ -9,8 +8,8 @@ import org.bukkit.entity.Vindicator; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -20,6 +19,7 @@ import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.DataWatcherObject; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.EntityVindicator; import net.minecraft.server.v1_16_R3.IBlockData; @@ -103,15 +103,6 @@ public class VindicatorController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -125,6 +116,15 @@ public class VindicatorController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -155,24 +155,10 @@ public class VindicatorController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -215,17 +201,9 @@ public class VindicatorController extends MobEntityController { } } - public static class VindicatorNPC extends CraftVindicator implements NPCHolder { - private final CitizensNPC npc; - + public static class VindicatorNPC extends CraftVindicator implements ForwardingNPCHolder { public VindicatorNPC(EntityVindicatorNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/WanderingTraderController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/WanderingTraderController.java index 5a5fd4743..11621dd64 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/WanderingTraderController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/WanderingTraderController.java @@ -10,8 +10,8 @@ import org.bukkit.entity.WanderingTrader; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -185,24 +185,10 @@ public class WanderingTraderController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } public boolean isBlockingTrades() { @@ -262,17 +248,9 @@ public class WanderingTraderController extends MobEntityController { } } - public static class WanderingTraderNPC extends CraftWanderingTrader implements NPCHolder { - private final CitizensNPC npc; - + public static class WanderingTraderNPC extends CraftWanderingTrader implements ForwardingNPCHolder { public WanderingTraderNPC(EntityWanderingTraderNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/WitchController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/WitchController.java index e79efccfa..1f2e650ae 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/WitchController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/WitchController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftWitch; @@ -9,8 +8,8 @@ import org.bukkit.entity.Witch; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -19,6 +18,7 @@ import net.minecraft.server.v1_16_R3.BlockPosition; import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.EntityWitch; import net.minecraft.server.v1_16_R3.IBlockData; @@ -88,15 +88,6 @@ public class WitchController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -110,6 +101,15 @@ public class WitchController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -140,24 +140,10 @@ public class WitchController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -209,17 +195,9 @@ public class WitchController extends MobEntityController { } } - public static class WitchNPC extends CraftWitch implements NPCHolder { - private final CitizensNPC npc; - + public static class WitchNPC extends CraftWitch implements ForwardingNPCHolder { public WitchNPC(EntityWitchNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/WitherController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/WitherController.java index d94e8dbf5..f7956b33d 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/WitherController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/WitherController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftWither; @@ -9,8 +8,8 @@ import org.bukkit.entity.Wither; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -18,6 +17,7 @@ import net.citizensnpcs.util.Util; import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.EntityWither; import net.minecraft.server.v1_16_R3.NBTTagCompound; @@ -113,24 +113,10 @@ public class WitherController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -173,17 +159,9 @@ public class WitherController extends MobEntityController { } } - public static class WitherNPC extends CraftWither implements NPCHolder { - private final CitizensNPC npc; - + public static class WitherNPC extends CraftWither implements ForwardingNPCHolder { public WitherNPC(EntityWitherNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/WolfController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/WolfController.java index bdba669cf..ae74775f9 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/WolfController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/WolfController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftWolf; @@ -10,8 +9,8 @@ import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -22,6 +21,7 @@ import net.minecraft.server.v1_16_R3.DataWatcherObject; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; import net.minecraft.server.v1_16_R3.EntityLiving; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.EntityWolf; import net.minecraft.server.v1_16_R3.IBlockData; @@ -105,15 +105,6 @@ public class WolfController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -127,6 +118,15 @@ public class WolfController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -157,24 +157,10 @@ public class WolfController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -222,17 +208,9 @@ public class WolfController extends MobEntityController { } } - public static class WolfNPC extends CraftWolf implements NPCHolder { - private final CitizensNPC npc; - + public static class WolfNPC extends CraftWolf implements ForwardingNPCHolder { public WolfNPC(EntityWolfNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } @Override diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ZoglinController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ZoglinController.java index 441c788f8..de87de3ab 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ZoglinController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ZoglinController.java @@ -8,8 +8,8 @@ import org.bukkit.entity.Zoglin; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -140,25 +140,10 @@ public class ZoglinController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.i(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -203,17 +188,9 @@ public class ZoglinController extends MobEntityController { } } - public static class ZoglinNPC extends CraftZoglin implements NPCHolder { - private final CitizensNPC npc; - + public static class ZoglinNPC extends CraftZoglin implements ForwardingNPCHolder { public ZoglinNPC(EntityZoglinNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ZombieController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ZombieController.java index 4e520edd2..af2f10074 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ZombieController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ZombieController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftZombie; @@ -9,8 +8,8 @@ import org.bukkit.entity.Zombie; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -19,6 +18,7 @@ import net.minecraft.server.v1_16_R3.BlockPosition; import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.EntityZombie; import net.minecraft.server.v1_16_R3.IBlockData; @@ -88,15 +88,6 @@ public class ZombieController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -110,6 +101,15 @@ public class ZombieController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -140,24 +140,10 @@ public class ZombieController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -200,17 +186,9 @@ public class ZombieController extends MobEntityController { } } - public static class ZombieNPC extends CraftZombie implements NPCHolder { - private final CitizensNPC npc; - + public static class ZombieNPC extends CraftZombie implements ForwardingNPCHolder { public ZombieNPC(EntityZombieNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ZombieHuskController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ZombieHuskController.java index 8880fd965..5dcadcc27 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ZombieHuskController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ZombieHuskController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftHusk; @@ -9,8 +8,8 @@ import org.bukkit.entity.Husk; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -19,6 +18,7 @@ import net.minecraft.server.v1_16_R3.BlockPosition; import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.EntityZombieHusk; import net.minecraft.server.v1_16_R3.IBlockData; @@ -88,15 +88,6 @@ public class ZombieHuskController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -110,6 +101,15 @@ public class ZombieHuskController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -140,24 +140,10 @@ public class ZombieHuskController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -200,17 +186,9 @@ public class ZombieHuskController extends MobEntityController { } } - public static class ZombieHuskNPC extends CraftHusk implements NPCHolder { - private final CitizensNPC npc; - + public static class ZombieHuskNPC extends CraftHusk implements ForwardingNPCHolder { public ZombieHuskNPC(EntityZombieHuskNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ZombieVillagerController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ZombieVillagerController.java index 3ddd6512e..8b0a4916c 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ZombieVillagerController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ZombieVillagerController.java @@ -1,7 +1,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity; import org.bukkit.Bukkit; -import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftVillagerZombie; @@ -9,8 +8,8 @@ import org.bukkit.entity.ZombieVillager; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -19,6 +18,7 @@ import net.minecraft.server.v1_16_R3.BlockPosition; import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; +import net.minecraft.server.v1_16_R3.EntityMinecartAbstract; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.EntityZombieVillager; import net.minecraft.server.v1_16_R3.IBlockData; @@ -88,15 +88,6 @@ public class ZombieVillagerController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void g(Vec3D vec3d) { - if (npc == null || !npc.isFlyable()) { - super.g(vec3d); - } else { - NMSImpl.flyingMoveLogic(this, vec3d); - } - } - @Override public void enderTeleportTo(double d0, double d1, double d2) { if (npc == null) { @@ -110,6 +101,15 @@ public class ZombieVillagerController extends MobEntityController { } } + @Override + public void g(Vec3D vec3d) { + if (npc == null || !npc.isFlyable()) { + super.g(vec3d); + } else { + NMSImpl.flyingMoveLogic(this, vec3d); + } + } + @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -140,24 +140,10 @@ public class ZombieVillagerController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -200,17 +186,9 @@ public class ZombieVillagerController extends MobEntityController { } } - public static class ZombieVillagerNPC extends CraftVillagerZombie implements NPCHolder { - private final CitizensNPC npc; - + public static class ZombieVillagerNPC extends CraftVillagerZombie implements ForwardingNPCHolder { public ZombieVillagerNPC(EntityZombieVillagerNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/AreaEffectCloudController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/AreaEffectCloudController.java index d3b8ba23c..35e8239a2 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/AreaEffectCloudController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/AreaEffectCloudController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_16_R3.entity.nonliving; -import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; -import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftAreaEffectCloud; @@ -10,8 +7,10 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.entity.AreaEffectCloud; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; +import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -30,17 +29,9 @@ public class AreaEffectCloudController extends MobEntityController { return (AreaEffectCloud) super.getBukkitEntity(); } - public static class AreaEffectCloudNPC extends CraftAreaEffectCloud implements NPCHolder { - private final CitizensNPC npc; - + public static class AreaEffectCloudNPC extends CraftAreaEffectCloud implements ForwardingNPCHolder { public AreaEffectCloudNPC(EntityAreaEffectCloudNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } @@ -71,28 +62,6 @@ public class AreaEffectCloudController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -106,6 +75,14 @@ public class AreaEffectCloudController extends MobEntityController { return npc; } + @Override + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); + } + } + @Override public void tick() { if (npc != null) { diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ArmorStandController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ArmorStandController.java index 9940d8e9b..d88dd6d3e 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ArmorStandController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ArmorStandController.java @@ -9,9 +9,9 @@ import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -35,17 +35,9 @@ public class ArmorStandController extends MobEntityController { return (ArmorStand) super.getBukkitEntity(); } - public static class ArmorStandNPC extends CraftArmorStand implements NPCHolder { - private final CitizensNPC npc; - + public static class ArmorStandNPC extends CraftArmorStand implements ForwardingNPCHolder { public ArmorStandNPC(EntityArmorStandNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } @@ -102,24 +94,10 @@ public class ArmorStandController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/BoatController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/BoatController.java index 5de6c7765..2d1287e9b 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/BoatController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/BoatController.java @@ -7,9 +7,9 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.entity.Boat; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -37,17 +37,9 @@ public class BoatController extends MobEntityController { return (Boat) super.getBukkitEntity(); } - public static class BoatNPC extends CraftBoat implements NPCHolder { - private final CitizensNPC npc; - + public static class BoatNPC extends CraftBoat implements ForwardingNPCHolder { public BoatNPC(EntityBoatNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } @@ -115,24 +107,10 @@ public class BoatController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } private boolean t() { diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/DragonFireballController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/DragonFireballController.java index f40fa1a35..b471984fd 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/DragonFireballController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/DragonFireballController.java @@ -7,9 +7,9 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.entity.DragonFireball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -29,17 +29,9 @@ public class DragonFireballController extends MobEntityController { return (DragonFireball) super.getBukkitEntity(); } - public static class DragonFireballNPC extends CraftDragonFireball implements NPCHolder { - private final CitizensNPC npc; - + public static class DragonFireballNPC extends CraftDragonFireball implements ForwardingNPCHolder { public DragonFireballNPC(EntityDragonFireballNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } @@ -70,28 +62,6 @@ public class DragonFireballController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -106,11 +76,10 @@ public class DragonFireballController extends MobEntityController { } @Override - public void updateSize() { - if (npc == null) { - super.updateSize(); - } else { - NMSImpl.setSize(this, justCreated); + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); } } @@ -125,5 +94,14 @@ public class DragonFireballController extends MobEntityController { super.tick(); } } + + @Override + public void updateSize() { + if (npc == null) { + super.updateSize(); + } else { + NMSImpl.setSize(this, justCreated); + } + } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/EggController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/EggController.java index b84fc40fc..d64501436 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/EggController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/EggController.java @@ -10,8 +10,8 @@ import org.bukkit.entity.Egg; import org.bukkit.entity.Entity; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.AbstractEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -40,17 +40,9 @@ public class EggController extends AbstractEntityController { return (Egg) super.getBukkitEntity(); } - public static class EggNPC extends CraftEgg implements NPCHolder { - private final CitizensNPC npc; - + public static class EggNPC extends CraftEgg implements ForwardingNPCHolder { public EggNPC(EntityEggNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } @@ -86,28 +78,6 @@ public class EggController extends AbstractEntityController { return npc == null ? super.d(save) : false; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -121,6 +91,14 @@ public class EggController extends AbstractEntityController { return npc; } + @Override + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); + } + } + @Override public void tick() { if (npc != null) { diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/EnderCrystalController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/EnderCrystalController.java index 2bb3bbe68..19ef0e21f 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/EnderCrystalController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/EnderCrystalController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_16_R3.entity.nonliving; -import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; -import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEnderCrystal; @@ -10,8 +7,10 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.entity.EnderCrystal; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; +import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -30,17 +29,9 @@ public class EnderCrystalController extends MobEntityController { return (EnderCrystal) super.getBukkitEntity(); } - public static class EnderCrystalNPC extends CraftEnderCrystal implements NPCHolder { - private final CitizensNPC npc; - + public static class EnderCrystalNPC extends CraftEnderCrystal implements ForwardingNPCHolder { public EnderCrystalNPC(EntityEnderCrystalNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } @@ -71,28 +62,6 @@ public class EnderCrystalController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -106,6 +75,14 @@ public class EnderCrystalController extends MobEntityController { return npc; } + @Override + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); + } + } + @Override public void tick() { if (npc != null) { diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/EnderPearlController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/EnderPearlController.java index e34f18763..1d5278cba 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/EnderPearlController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/EnderPearlController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_16_R3.entity.nonliving; -import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; -import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEnderPearl; @@ -10,8 +7,10 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.entity.EnderPearl; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; +import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -30,17 +29,9 @@ public class EnderPearlController extends MobEntityController { return (EnderPearl) super.getBukkitEntity(); } - public static class EnderPearlNPC extends CraftEnderPearl implements NPCHolder { - private final CitizensNPC npc; - + public static class EnderPearlNPC extends CraftEnderPearl implements ForwardingNPCHolder { public EnderPearlNPC(EntityEnderPearlNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } @@ -71,28 +62,6 @@ public class EnderPearlController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -106,6 +75,14 @@ public class EnderPearlController extends MobEntityController { return npc; } + @Override + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); + } + } + @Override public void tick() { if (npc != null) { diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/EnderSignalController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/EnderSignalController.java index 97c0644d8..a859244bd 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/EnderSignalController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/EnderSignalController.java @@ -7,9 +7,9 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.entity.EnderSignal; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -29,17 +29,9 @@ public class EnderSignalController extends MobEntityController { return (EnderSignal) super.getBukkitEntity(); } - public static class EnderSignalNPC extends CraftEnderSignal implements NPCHolder { - private final CitizensNPC npc; - + public static class EnderSignalNPC extends CraftEnderSignal implements ForwardingNPCHolder { public EnderSignalNPC(EntityEnderSignalNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } @@ -85,24 +77,10 @@ public class EnderSignalController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/EvokerFangsController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/EvokerFangsController.java index 7f947af78..628febd26 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/EvokerFangsController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/EvokerFangsController.java @@ -9,9 +9,9 @@ import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -88,24 +88,10 @@ public class EvokerFangsController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -117,17 +103,9 @@ public class EvokerFangsController extends MobEntityController { } } - public static class EvokerFangsNPC extends CraftEvokerFangs implements NPCHolder { - private final CitizensNPC npc; - + public static class EvokerFangsNPC extends CraftEvokerFangs implements ForwardingNPCHolder { public EvokerFangsNPC(EntityEvokerFangsNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ExperienceOrbController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ExperienceOrbController.java index 0b3ac74f9..46b7e1916 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ExperienceOrbController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ExperienceOrbController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_16_R3.entity.nonliving; -import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; -import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -10,8 +7,10 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftExperienceOrb; import org.bukkit.entity.ExperienceOrb; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; +import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -57,28 +56,6 @@ public class ExperienceOrbController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -92,6 +69,14 @@ public class ExperienceOrbController extends MobEntityController { return npc; } + @Override + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); + } + } + @Override public void tick() { if (npc != null) { @@ -102,17 +87,9 @@ public class ExperienceOrbController extends MobEntityController { } } - public static class ExperienceOrbNPC extends CraftExperienceOrb implements NPCHolder { - private final CitizensNPC npc; - + public static class ExperienceOrbNPC extends CraftExperienceOrb implements ForwardingNPCHolder { public ExperienceOrbNPC(EntityExperienceOrbNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/FallingBlockController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/FallingBlockController.java index 149e140ab..7709c7312 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/FallingBlockController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/FallingBlockController.java @@ -13,7 +13,6 @@ import org.bukkit.entity.FallingBlock; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; @@ -89,28 +88,6 @@ public class FallingBlockController extends AbstractEntityController { return npc == null ? super.d(save) : false; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -124,6 +101,14 @@ public class FallingBlockController extends AbstractEntityController { return npc; } + @Override + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); + } + } + @Override public void tick() { if (npc != null) { diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/FireworkController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/FireworkController.java index e15d24db2..d7313dd51 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/FireworkController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/FireworkController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_16_R3.entity.nonliving; -import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; -import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -10,8 +7,10 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftFirework; import org.bukkit.entity.Firework; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; +import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -57,28 +56,6 @@ public class FireworkController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -92,6 +69,14 @@ public class FireworkController extends MobEntityController { return npc; } + @Override + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); + } + } + @Override public void tick() { if (npc != null) { @@ -102,17 +87,9 @@ public class FireworkController extends MobEntityController { } } - public static class FireworkNPC extends CraftFirework implements NPCHolder { - private final CitizensNPC npc; - + public static class FireworkNPC extends CraftFirework implements ForwardingNPCHolder { public FireworkNPC(EntityFireworkNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/FishingHookController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/FishingHookController.java index f3bf8c293..eb3449340 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/FishingHookController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/FishingHookController.java @@ -12,9 +12,9 @@ import org.bukkit.util.Vector; import com.mojang.authlib.GameProfile; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -85,28 +85,6 @@ public class FishingHookController extends MobEntityController { return npc; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public double h(Entity entity) { // distance check in k() @@ -116,6 +94,14 @@ public class FishingHookController extends MobEntityController { return super.h(entity); } + @Override + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); + } + } + @Override public void tick() { if (npc != null) { @@ -137,17 +123,9 @@ public class FishingHookController extends MobEntityController { private static MethodHandle D = NMS.getSetter(EntityFishingHook.class, "d"); } - public static class FishingHookNPC extends CraftFishHook implements NPCHolder { - private final CitizensNPC npc; - + public static class FishingHookNPC extends CraftFishHook implements ForwardingNPCHolder { public FishingHookNPC(EntityFishingHookNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ItemController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ItemController.java index 46d786246..0f9dc228a 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ItemController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ItemController.java @@ -13,7 +13,6 @@ import org.bukkit.entity.Item; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; @@ -80,28 +79,6 @@ public class ItemController extends AbstractEntityController { return npc == null ? super.d(save) : false; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -115,6 +92,14 @@ public class ItemController extends AbstractEntityController { return npc; } + @Override + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); + } + } + @Override public void pickup(EntityHuman entityhuman) { if (npc == null) { diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ItemFrameController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ItemFrameController.java index 6d458cb3e..5a717d179 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ItemFrameController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ItemFrameController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_16_R3.entity.nonliving; -import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; -import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -14,9 +11,10 @@ import org.bukkit.entity.ItemFrame; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -73,28 +71,6 @@ public class ItemFrameController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -108,6 +84,14 @@ public class ItemFrameController extends MobEntityController { return npc; } + @Override + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); + } + } + @Override public boolean survives() { return npc == null || !npc.isProtected() ? super.survives() : true; diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/LargeFireballController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/LargeFireballController.java index 01acc920c..f17b80797 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/LargeFireballController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/LargeFireballController.java @@ -7,9 +7,9 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftLargeFireball; import org.bukkit.entity.LargeFireball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -56,28 +56,6 @@ public class LargeFireballController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -92,11 +70,10 @@ public class LargeFireballController extends MobEntityController { } @Override - public void updateSize() { - if (npc == null) { - super.updateSize(); - } else { - NMSImpl.setSize(this, justCreated); + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); } } @@ -111,19 +88,20 @@ public class LargeFireballController extends MobEntityController { super.tick(); } } - } - - public static class LargeFireballNPC extends CraftLargeFireball implements NPCHolder { - private final CitizensNPC npc; - - public LargeFireballNPC(EntityLargeFireballNPC entity) { - super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } @Override - public NPC getNPC() { - return npc; + public void updateSize() { + if (npc == null) { + super.updateSize(); + } else { + NMSImpl.setSize(this, justCreated); + } + } + } + + public static class LargeFireballNPC extends CraftLargeFireball implements ForwardingNPCHolder { + public LargeFireballNPC(EntityLargeFireballNPC entity) { + super((CraftServer) Bukkit.getServer(), entity); } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/LeashController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/LeashController.java index b58e54927..5c2406e94 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/LeashController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/LeashController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_16_R3.entity.nonliving; -import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; -import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -10,8 +7,10 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftLeash; import org.bukkit.entity.LeashHitch; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; +import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -57,28 +56,6 @@ public class LeashController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -92,6 +69,14 @@ public class LeashController extends MobEntityController { return npc; } + @Override + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); + } + } + @Override public boolean survives() { return npc == null || !npc.isProtected() ? super.survives() : true; @@ -107,17 +92,9 @@ public class LeashController extends MobEntityController { } } - public static class LeashNPC extends CraftLeash implements NPCHolder { - private final CitizensNPC npc; - + public static class LeashNPC extends CraftLeash implements ForwardingNPCHolder { public LeashNPC(EntityLeashNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/LlamaSpitController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/LlamaSpitController.java index 95f2bddc4..3d7ed0e5f 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/LlamaSpitController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/LlamaSpitController.java @@ -10,8 +10,8 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.LlamaSpit; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.AbstractEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -75,28 +75,6 @@ public class LlamaSpitController extends AbstractEntityController { return npc == null ? super.d(save) : false; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -110,6 +88,14 @@ public class LlamaSpitController extends AbstractEntityController { return npc; } + @Override + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); + } + } + @Override public void tick() { if (npc != null) { @@ -123,17 +109,9 @@ public class LlamaSpitController extends AbstractEntityController { } } - public static class LlamaSpitNPC extends CraftLlamaSpit implements NPCHolder { - private final CitizensNPC npc; - + public static class LlamaSpitNPC extends CraftLlamaSpit implements ForwardingNPCHolder { public LlamaSpitNPC(EntityLlamaSpitNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartChestController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartChestController.java index 6b27a2980..e392a8adf 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartChestController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartChestController.java @@ -7,9 +7,9 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftMinecartChest; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -71,24 +71,10 @@ public class MinecartChestController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -102,17 +88,9 @@ public class MinecartChestController extends MobEntityController { } - public static class MinecartChestNPC extends CraftMinecartChest implements NPCHolder { - private final CitizensNPC npc; - + public static class MinecartChestNPC extends CraftMinecartChest implements ForwardingNPCHolder { public MinecartChestNPC(EntityMinecartChestNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartCommandController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartCommandController.java index 4b6e5f37e..09789ba3c 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartCommandController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartCommandController.java @@ -7,9 +7,9 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftMinecartCommand; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -71,24 +71,10 @@ public class MinecartCommandController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -101,17 +87,9 @@ public class MinecartCommandController extends MobEntityController { } } - public static class MinecartCommandNPC extends CraftMinecartCommand implements NPCHolder { - private final CitizensNPC npc; - + public static class MinecartCommandNPC extends CraftMinecartCommand implements ForwardingNPCHolder { public MinecartCommandNPC(EntityMinecartCommandNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartFurnaceController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartFurnaceController.java index c92b912af..80901c5cd 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartFurnaceController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartFurnaceController.java @@ -7,9 +7,9 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftMinecartFurnace; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -71,24 +71,10 @@ public class MinecartFurnaceController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -101,17 +87,9 @@ public class MinecartFurnaceController extends MobEntityController { } } - public static class MinecartFurnaceNPC extends CraftMinecartFurnace implements NPCHolder { - private final CitizensNPC npc; - + public static class MinecartFurnaceNPC extends CraftMinecartFurnace implements ForwardingNPCHolder { public MinecartFurnaceNPC(EntityMinecartFurnaceNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartHopperController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartHopperController.java index 4b70842f8..d84a8e269 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartHopperController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartHopperController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; @@ -59,24 +58,10 @@ public class MinecartHopperController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartRideableController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartRideableController.java index 0a22178eb..0a6cc1f43 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartRideableController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartRideableController.java @@ -7,9 +7,9 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftMinecartRideable; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -71,24 +71,10 @@ public class MinecartRideableController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -101,17 +87,9 @@ public class MinecartRideableController extends MobEntityController { } } - public static class MinecartRideableNPC extends CraftMinecartRideable implements NPCHolder { - private final CitizensNPC npc; - + public static class MinecartRideableNPC extends CraftMinecartRideable implements ForwardingNPCHolder { public MinecartRideableNPC(EntityMinecartRideableNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartSpawnerController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartSpawnerController.java index 38f058813..f114aa126 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartSpawnerController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartSpawnerController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; @@ -59,24 +58,10 @@ public class MinecartSpawnerController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartTNTController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartTNTController.java index 55b9cc057..36c0f7d15 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartTNTController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/MinecartTNTController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_16_R3.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; @@ -59,24 +58,10 @@ public class MinecartTNTController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/PaintingController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/PaintingController.java index 51524768d..6d9efe64a 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/PaintingController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/PaintingController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_16_R3.entity.nonliving; -import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; -import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -10,8 +7,10 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPainting; import org.bukkit.entity.Painting; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; +import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -57,28 +56,6 @@ public class PaintingController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -92,6 +69,14 @@ public class PaintingController extends MobEntityController { return npc; } + @Override + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); + } + } + @Override public boolean survives() { return npc == null || !npc.isProtected() ? super.survives() : true; @@ -107,17 +92,9 @@ public class PaintingController extends MobEntityController { } } - public static class PaintingNPC extends CraftPainting implements NPCHolder { - private final CitizensNPC npc; - + public static class PaintingNPC extends CraftPainting implements ForwardingNPCHolder { public PaintingNPC(EntityPaintingNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ShulkerBulletController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ShulkerBulletController.java index 6de45813f..f04930cd8 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ShulkerBulletController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ShulkerBulletController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_16_R3.entity.nonliving; -import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; -import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -10,8 +7,10 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftShulkerBullet; import org.bukkit.entity.ShulkerBullet; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; +import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -57,28 +56,6 @@ public class ShulkerBulletController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -92,6 +69,14 @@ public class ShulkerBulletController extends MobEntityController { return npc; } + @Override + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); + } + } + @Override public void tick() { if (npc != null) { @@ -102,17 +87,9 @@ public class ShulkerBulletController extends MobEntityController { } } - public static class ShulkerBulletNPC extends CraftShulkerBullet implements NPCHolder { - private final CitizensNPC npc; - + public static class ShulkerBulletNPC extends CraftShulkerBullet implements ForwardingNPCHolder { public ShulkerBulletNPC(EntityShulkerBulletNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/SmallFireballController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/SmallFireballController.java index ba7e7a71c..70ca42b9e 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/SmallFireballController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/SmallFireballController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_16_R3.entity.nonliving; -import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; -import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -10,8 +7,10 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftSmallFireball; import org.bukkit.entity.SmallFireball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; +import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -57,28 +56,6 @@ public class SmallFireballController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -92,6 +69,14 @@ public class SmallFireballController extends MobEntityController { return npc; } + @Override + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); + } + } + @Override public void tick() { if (npc != null) { @@ -105,17 +90,9 @@ public class SmallFireballController extends MobEntityController { } } - public static class SmallFireballNPC extends CraftSmallFireball implements NPCHolder { - private final CitizensNPC npc; - + public static class SmallFireballNPC extends CraftSmallFireball implements ForwardingNPCHolder { public SmallFireballNPC(EntitySmallFireballNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/SnowballController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/SnowballController.java index 63ecb1f01..5b78ed465 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/SnowballController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/SnowballController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_16_R3.entity.nonliving; -import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; -import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -10,8 +7,10 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftSnowball; import org.bukkit.entity.Snowball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; +import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -57,28 +56,6 @@ public class SnowballController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -92,6 +69,14 @@ public class SnowballController extends MobEntityController { return npc; } + @Override + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); + } + } + @Override public void tick() { if (npc != null) { @@ -102,17 +87,9 @@ public class SnowballController extends MobEntityController { } } - public static class SnowballNPC extends CraftSnowball implements NPCHolder { - private final CitizensNPC npc; - + public static class SnowballNPC extends CraftSnowball implements ForwardingNPCHolder { public SnowballNPC(EntitySnowballNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/SpectralArrowController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/SpectralArrowController.java index 73ff9c066..eb993a958 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/SpectralArrowController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/SpectralArrowController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_16_R3.entity.nonliving; -import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; -import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftArrow; @@ -10,8 +7,10 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; import org.bukkit.entity.Arrow; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; +import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -57,28 +56,6 @@ public class SpectralArrowController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -92,6 +69,14 @@ public class SpectralArrowController extends MobEntityController { return npc; } + @Override + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); + } + } + @Override public void tick() { if (npc != null) { @@ -102,17 +87,9 @@ public class SpectralArrowController extends MobEntityController { } } - public static class SpectralArrowNPC extends CraftArrow implements NPCHolder { - private final CitizensNPC npc; - + public static class SpectralArrowNPC extends CraftArrow implements ForwardingNPCHolder { public SpectralArrowNPC(EntitySpectralArrowNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/TNTPrimedController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/TNTPrimedController.java index 0510efafb..287f7644a 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/TNTPrimedController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/TNTPrimedController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_16_R3.entity.nonliving; -import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; -import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -10,8 +7,10 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftTNTPrimed; import org.bukkit.entity.TNTPrimed; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; +import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -57,28 +56,6 @@ public class TNTPrimedController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -92,6 +69,14 @@ public class TNTPrimedController extends MobEntityController { return npc; } + @Override + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); + } + } + @Override public void tick() { if (npc != null) { @@ -102,17 +87,9 @@ public class TNTPrimedController extends MobEntityController { } } - public static class TNTPrimedNPC extends CraftTNTPrimed implements NPCHolder { - private final CitizensNPC npc; - + public static class TNTPrimedNPC extends CraftTNTPrimed implements ForwardingNPCHolder { public TNTPrimedNPC(EntityTNTPrimedNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ThrownExpBottleController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ThrownExpBottleController.java index 3aa2bc5b2..aa2bd503c 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ThrownExpBottleController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ThrownExpBottleController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_16_R3.entity.nonliving; -import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; -import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -10,8 +7,10 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftThrownExpBottle; import org.bukkit.entity.ThrownExpBottle; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; +import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -57,28 +56,6 @@ public class ThrownExpBottleController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -92,6 +69,14 @@ public class ThrownExpBottleController extends MobEntityController { return npc; } + @Override + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); + } + } + @Override public void tick() { if (npc != null) { @@ -105,17 +90,9 @@ public class ThrownExpBottleController extends MobEntityController { } } - public static class ThrownExpBottleNPC extends CraftThrownExpBottle implements NPCHolder { - private final CitizensNPC npc; - + public static class ThrownExpBottleNPC extends CraftThrownExpBottle implements ForwardingNPCHolder { public ThrownExpBottleNPC(EntityThrownExpBottleNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ThrownPotionController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ThrownPotionController.java index fdf9a0e2c..52097641a 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ThrownPotionController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ThrownPotionController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_16_R3.entity.nonliving; -import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; -import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -10,8 +7,10 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftThrownPotion; import org.bukkit.entity.ThrownPotion; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; +import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -58,28 +57,6 @@ public class ThrownPotionController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -97,6 +74,14 @@ public class ThrownPotionController extends MobEntityController { return npc; } + @Override + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); + } + } + @Override public void tick() { if (npc != null) { @@ -121,17 +106,9 @@ public class ThrownPotionController extends MobEntityController { } } - public static class SplashThrownPotionNPC extends CraftThrownPotion implements NPCHolder { - private final CitizensNPC npc; - + public static class SplashThrownPotionNPC extends CraftThrownPotion implements ForwardingNPCHolder { public SplashThrownPotionNPC(EntityThrownPotionNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ThrownTridentController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ThrownTridentController.java index 41fe30670..264e101f4 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ThrownTridentController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/ThrownTridentController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_16_R3.entity.nonliving; -import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; -import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -10,8 +7,10 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftTrident; import org.bukkit.entity.Trident; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; +import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -57,28 +56,6 @@ public class ThrownTridentController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -92,6 +69,14 @@ public class ThrownTridentController extends MobEntityController { return npc; } + @Override + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); + } + } + @Override public void tick() { if (npc != null) { @@ -102,17 +87,9 @@ public class ThrownTridentController extends MobEntityController { } } - public static class ThrownTridentNPC extends CraftTrident implements NPCHolder { - private final CitizensNPC npc; - + public static class ThrownTridentNPC extends CraftTrident implements ForwardingNPCHolder { public ThrownTridentNPC(EntityThrownTridentNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/TippedArrowController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/TippedArrowController.java index 6b22d20da..f742e2678 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/TippedArrowController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/TippedArrowController.java @@ -7,9 +7,9 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftTippedArrow; import org.bukkit.entity.Arrow; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; @@ -71,24 +71,10 @@ public class TippedArrowController extends MobEntityController { @Override public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.i(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override @@ -101,17 +87,9 @@ public class TippedArrowController extends MobEntityController { } } - public static class TippedArrowNPC extends CraftTippedArrow implements NPCHolder { - private final CitizensNPC npc; - + public static class TippedArrowNPC extends CraftTippedArrow implements ForwardingNPCHolder { public TippedArrowNPC(EntityTippedArrowNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/WitherSkullController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/WitherSkullController.java index bbf00e01d..d2c50c9bf 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/WitherSkullController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/nonliving/WitherSkullController.java @@ -1,8 +1,5 @@ package net.citizensnpcs.nms.v1_16_R3.entity.nonliving; -import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; -import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; @@ -10,8 +7,10 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftWitherSkull; import org.bukkit.entity.WitherSkull; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.nms.v1_16_R3.entity.MobEntityController; +import net.citizensnpcs.nms.v1_16_R3.util.ForwardingNPCHolder; +import net.citizensnpcs.nms.v1_16_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.Util; @@ -57,28 +56,6 @@ public class WitherSkullController extends MobEntityController { return npc == null ? super.d(save) : false; } - @Override - public void i(double x, double y, double z) { - if (npc == null) { - super.i(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.i(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); - super.i(vector.getX(), vector.getY(), vector.getZ()); - } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. - } - @Override public CraftEntity getBukkitEntity() { if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) { @@ -92,6 +69,14 @@ public class WitherSkullController extends MobEntityController { return npc; } + @Override + public void i(double x, double y, double z) { + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { + super.i(vector.getX(), vector.getY(), vector.getZ()); + } + } + @Override public void tick() { if (npc != null) { @@ -102,17 +87,9 @@ public class WitherSkullController extends MobEntityController { } } - public static class WitherSkullNPC extends CraftWitherSkull implements NPCHolder { - private final CitizensNPC npc; - + public static class WitherSkullNPC extends CraftWitherSkull implements ForwardingNPCHolder { public WitherSkullNPC(EntityWitherSkullNPC entity) { super((CraftServer) Bukkit.getServer(), entity); - this.npc = entity.npc; - } - - @Override - public NPC getNPC() { - return npc; } } } diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/ForwardingNPCHolder.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/ForwardingNPCHolder.java new file mode 100644 index 000000000..d7f3cec4b --- /dev/null +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/ForwardingNPCHolder.java @@ -0,0 +1,13 @@ +package net.citizensnpcs.nms.v1_16_R3.util; + +import org.bukkit.entity.Entity; + +import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.npc.ai.NPCHolder; + +public interface ForwardingNPCHolder extends NPCHolder, Entity { + @Override + default NPC getNPC() { + return ((NPCHolder) NMSImpl.getHandle(this)).getNPC(); + } +} diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/NMSImpl.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/NMSImpl.java index ffbe46520..344af23ff 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/NMSImpl.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/NMSImpl.java @@ -1863,7 +1863,6 @@ public class NMSImpl implements NMSBridge { EntityType.SILVERFISH, EntityType.SHULKER, EntityType.ENDERMITE, EntityType.ENDER_DRAGON, EntityType.BAT, EntityType.SLIME, EntityType.DOLPHIN, EntityType.MAGMA_CUBE, EntityType.HORSE, EntityType.GHAST, EntityType.SHULKER, EntityType.PHANTOM); - private static final MethodHandle BEHAVIOR_MAP = NMS.getGetter(BehaviorController.class, "e"); private static final MethodHandle BUKKITENTITY_FIELD_SETTER = NMS.getSetter(Entity.class, "bukkitEntity"); private static final Map, EntityTypes> CITIZENS_ENTITY_TYPES = Maps.newHashMap(); diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/PlayerControllerLook.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/PlayerControllerLook.java index 203033f95..6c5398afa 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/PlayerControllerLook.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/PlayerControllerLook.java @@ -29,13 +29,33 @@ public class PlayerControllerLook { this.d = false; this.a.pitch = this.a(this.a.pitch, this.g(), this.c); this.a.aC = this.a(this.a.aC, this.h(), this.b); - this.a.yaw = this.a(this.a.aC, this.h(), this.b); while (this.a.aC >= 180F) { this.a.aC -= 360F; } while (this.a.aC < -180F) { this.a.aC += 360F; } + double d = this.a.aC - 45; + while (d >= 180F) { + d -= 360F; + } + while (d < -180F) { + d += 360F; + } + if (d > this.a.yaw) { + this.a.yaw = (float) d; + } + d = this.a.aC + 45; + while (d >= 180F) { + d -= 360F; + } + while (d < -180F) { + d += 360F; + } + if (d < this.a.yaw) { + this.a.yaw = (float) d; + } + // this.a.yaw = this.a(this.a.aC, this.h(), this.b); } else { // this.a.yaw = MathHelper.b(this.a.yaw, this.a.aC, 40F); // this.a.aK = this.a(this.a.aC, this.a.aA, 10.0F); diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/BatController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/BatController.java index 30015e28e..918edddcd 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/BatController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/BatController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Bat; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -127,24 +126,10 @@ public class BatController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/BlazeController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/BlazeController.java index c96ba22db..13c168bb8 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/BlazeController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/BlazeController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Blaze; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -122,24 +121,10 @@ public class BlazeController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/CaveSpiderController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/CaveSpiderController.java index 4c4ffcc72..e87e06fda 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/CaveSpiderController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/CaveSpiderController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.CaveSpider; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -141,24 +140,10 @@ public class CaveSpiderController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/ChickenController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/ChickenController.java index 7c3f4e12c..6b9a81103 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/ChickenController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/ChickenController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Chicken; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -150,24 +149,10 @@ public class ChickenController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/CowController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/CowController.java index 2cdf67b49..1a1bdec59 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/CowController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/CowController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Cow; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -166,24 +165,10 @@ public class CowController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/CreeperController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/CreeperController.java index 2884f6758..e64bddb4d 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/CreeperController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/CreeperController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Creeper; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -146,25 +145,10 @@ public class CreeperController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.g(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/EnderDragonController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/EnderDragonController.java index 07cb4e8e5..6b4556379 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/EnderDragonController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/EnderDragonController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.EnderDragon; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -94,24 +93,10 @@ public class EnderDragonController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/EndermanController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/EndermanController.java index f7d1175f4..77ffd5d36 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/EndermanController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/EndermanController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Enderman; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -138,24 +137,10 @@ public class EndermanController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/EndermiteController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/EndermiteController.java index 40f5644b6..9a7ccf4de 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/EndermiteController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/EndermiteController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Endermite; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -137,24 +136,10 @@ public class EndermiteController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/EntityHumanNPC.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/EntityHumanNPC.java index 04774911b..b7acbad3b 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/EntityHumanNPC.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/EntityHumanNPC.java @@ -18,7 +18,6 @@ import com.mojang.authlib.GameProfile; import net.citizensnpcs.Settings.Setting; import net.citizensnpcs.api.CitizensAPI; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.trait.trait.Inventory; import net.citizensnpcs.nms.v1_8_R3.network.EmptyNetHandler; @@ -166,25 +165,10 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.g(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/GhastController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/GhastController.java index 05939875c..bb2617552 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/GhastController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/GhastController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Ghast; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -114,24 +113,10 @@ public class GhastController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/GiantController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/GiantController.java index f76de74b2..a44b8f686 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/GiantController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/GiantController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Giant; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -124,24 +123,10 @@ public class GiantController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/GuardianController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/GuardianController.java index 018630027..845319ae7 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/GuardianController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/GuardianController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Guardian; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -117,24 +116,10 @@ public class GuardianController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/HorseController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/HorseController.java index 77389e70b..79abee6dd 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/HorseController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/HorseController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Horse; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -156,24 +155,10 @@ public class HorseController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/IronGolemController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/IronGolemController.java index a70b1a8ab..503f69ca5 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/IronGolemController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/IronGolemController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.IronGolem; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -124,24 +123,10 @@ public class IronGolemController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/MagmaCubeController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/MagmaCubeController.java index 60d5d28c3..158abd66f 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/MagmaCubeController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/MagmaCubeController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.MagmaCube; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.nms.v1_8_R3.util.PlayerControllerMove; @@ -127,24 +126,10 @@ public class MagmaCubeController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/MushroomCowController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/MushroomCowController.java index 27f4c8952..c112aa891 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/MushroomCowController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/MushroomCowController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.MushroomCow; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -143,24 +142,10 @@ public class MushroomCowController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/OcelotController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/OcelotController.java index c9ed00421..1d390f3de 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/OcelotController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/OcelotController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Ocelot; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -141,24 +140,10 @@ public class OcelotController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/PigController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/PigController.java index 87c998e46..113db3fef 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/PigController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/PigController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Pig; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -145,24 +144,10 @@ public class PigController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/PigZombieController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/PigZombieController.java index 66fe189de..735951b0e 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/PigZombieController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/PigZombieController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.PigZombie; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -124,25 +123,10 @@ public class PigZombieController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) { - super.g(x, y, z); - } - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/RabbitController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/RabbitController.java index b53fb9f9e..5f741701e 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/RabbitController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/RabbitController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Rabbit; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -140,24 +139,10 @@ public class RabbitController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SheepController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SheepController.java index d0d2a0ff1..55564a339 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SheepController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SheepController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Sheep; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -134,24 +133,10 @@ public class SheepController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SilverfishController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SilverfishController.java index 45f5eda48..f20b27ecb 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SilverfishController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SilverfishController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Silverfish; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -123,24 +122,10 @@ public class SilverfishController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SkeletonController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SkeletonController.java index ea35e385b..83c6c21d9 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SkeletonController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SkeletonController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Skeleton; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -124,24 +123,10 @@ public class SkeletonController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SlimeController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SlimeController.java index 98de31431..b90b4a41f 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SlimeController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SlimeController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Slime; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.nms.v1_8_R3.util.PlayerControllerMove; @@ -128,24 +127,10 @@ public class SlimeController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SnowmanController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SnowmanController.java index 866b2a065..6ba12135e 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SnowmanController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SnowmanController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Snowman; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -124,24 +123,10 @@ public class SnowmanController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SpiderController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SpiderController.java index 436528116..58a1f3421 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SpiderController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SpiderController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Spider; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -123,24 +122,10 @@ public class SpiderController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SquidController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SquidController.java index ed111441a..c2d40242c 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SquidController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/SquidController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Squid; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -116,24 +115,10 @@ public class SquidController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/VillagerController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/VillagerController.java index b7cf471fb..ce44d1f73 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/VillagerController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/VillagerController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Villager; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -17,10 +16,10 @@ import net.citizensnpcs.util.Util; import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.EntityHuman; +import net.minecraft.server.v1_8_R3.EntityLightning; import net.minecraft.server.v1_8_R3.EntityVillager; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import net.minecraft.server.v1_8_R3.EntityLightning; public class VillagerController extends MobEntityController { public VillagerController() { @@ -157,24 +156,10 @@ public class VillagerController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/WitchController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/WitchController.java index 70f8a8fdd..955ad6e02 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/WitchController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/WitchController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Witch; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -123,24 +122,10 @@ public class WitchController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/WitherController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/WitherController.java index 12b954fe2..412a5b1e0 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/WitherController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/WitherController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Wither; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -109,24 +108,10 @@ public class WitherController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/WolfController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/WolfController.java index 9b2e998cf..9b60ea5ff 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/WolfController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/WolfController.java @@ -9,7 +9,6 @@ import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -138,24 +137,10 @@ public class WolfController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/ZombieController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/ZombieController.java index c33b12d62..10e2c5983 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/ZombieController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/ZombieController.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Zombie; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.NPCEnderTeleportEvent; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; import net.citizensnpcs.npc.CitizensNPC; @@ -124,24 +123,10 @@ public class ZombieController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/ArmorStandController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/ArmorStandController.java index d8d01238b..51a5c9f7e 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/ArmorStandController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/ArmorStandController.java @@ -9,7 +9,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; @@ -86,24 +85,10 @@ public class ArmorStandController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/BoatController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/BoatController.java index b6fa47ee8..4be7ca586 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/BoatController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/BoatController.java @@ -8,7 +8,6 @@ import org.bukkit.craftbukkit.v1_8_R3.event.CraftEventFactory; import org.bukkit.entity.Boat; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; @@ -81,24 +80,10 @@ public class BoatController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/EggController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/EggController.java index 7c803ed7f..1fca2338b 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/EggController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/EggController.java @@ -1,16 +1,5 @@ package net.citizensnpcs.nms.v1_8_R3.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; -import net.citizensnpcs.api.npc.NPC; -import net.citizensnpcs.npc.AbstractEntityController; -import net.citizensnpcs.npc.CitizensNPC; -import net.citizensnpcs.npc.ai.NPCHolder; -import net.citizensnpcs.util.Util; -import net.minecraft.server.v1_8_R3.EntityEgg; -import net.minecraft.server.v1_8_R3.NBTTagCompound; -import net.minecraft.server.v1_8_R3.World; -import net.minecraft.server.v1_8_R3.WorldServer; - import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_8_R3.CraftServer; @@ -21,6 +10,16 @@ import org.bukkit.entity.Egg; import org.bukkit.entity.Entity; import org.bukkit.util.Vector; +import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.npc.AbstractEntityController; +import net.citizensnpcs.npc.CitizensNPC; +import net.citizensnpcs.npc.ai.NPCHolder; +import net.citizensnpcs.util.Util; +import net.minecraft.server.v1_8_R3.EntityEgg; +import net.minecraft.server.v1_8_R3.NBTTagCompound; +import net.minecraft.server.v1_8_R3.World; +import net.minecraft.server.v1_8_R3.WorldServer; + public class EggController extends AbstractEntityController { public EggController() { super(EntityEggNPC.class); @@ -86,24 +85,10 @@ public class EggController extends AbstractEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/EnderCrystalController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/EnderCrystalController.java index 59fb147cd..3b5358c57 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/EnderCrystalController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/EnderCrystalController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_8_R3.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderCrystal; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.entity.EnderCrystal; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_8_R3.EntityEnderCrystal; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderCrystal; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.entity.EnderCrystal; -import org.bukkit.util.Vector; - public class EnderCrystalController extends MobEntityController { public EnderCrystalController() { super(EntityEnderCrystalNPC.class); @@ -70,24 +69,10 @@ public class EnderCrystalController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/EnderPearlController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/EnderPearlController.java index e6af5489d..a08bdd741 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/EnderPearlController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/EnderPearlController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.entity.EnderPearl; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -70,24 +69,10 @@ public class EnderPearlController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/EnderSignalController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/EnderSignalController.java index b691b13a3..02758331d 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/EnderSignalController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/EnderSignalController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_8_R3.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderSignal; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.entity.EnderSignal; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_8_R3.EntityEnderSignal; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderSignal; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.entity.EnderSignal; -import org.bukkit.util.Vector; - public class EnderSignalController extends MobEntityController { public EnderSignalController() { super(EntityEnderSignalNPC.class); @@ -70,24 +69,10 @@ public class EnderSignalController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/ExperienceOrbController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/ExperienceOrbController.java index e1bdf4aa4..910f1a629 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/ExperienceOrbController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/ExperienceOrbController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_8_R3.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftExperienceOrb; +import org.bukkit.entity.ExperienceOrb; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_8_R3.EntityExperienceOrb; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftExperienceOrb; -import org.bukkit.entity.ExperienceOrb; -import org.bukkit.util.Vector; - public class ExperienceOrbController extends MobEntityController { public ExperienceOrbController() { super(EntityExperienceOrbNPC.class); @@ -56,24 +55,10 @@ public class ExperienceOrbController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/FallingBlockController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/FallingBlockController.java index e4807752e..0fd3719ba 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/FallingBlockController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/FallingBlockController.java @@ -13,7 +13,6 @@ import org.bukkit.entity.FallingBlock; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; @@ -87,24 +86,10 @@ public class FallingBlockController extends AbstractEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/FireworkController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/FireworkController.java index c11ba10f4..9ce6e3800 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/FireworkController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/FireworkController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_8_R3.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFirework; +import org.bukkit.entity.Firework; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_8_R3.EntityFireworks; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFirework; -import org.bukkit.entity.Firework; -import org.bukkit.util.Vector; - public class FireworkController extends MobEntityController { public FireworkController() { super(EntityFireworkNPC.class); @@ -56,24 +55,10 @@ public class FireworkController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/FishingHookController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/FishingHookController.java index 4f88600a6..cac274117 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/FishingHookController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/FishingHookController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFish; import org.bukkit.entity.FishHook; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -56,24 +55,10 @@ public class FishingHookController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/ItemController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/ItemController.java index 333ab8466..1abc059a9 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/ItemController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/ItemController.java @@ -13,7 +13,6 @@ import org.bukkit.entity.Item; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.AbstractEntityController; @@ -87,24 +86,10 @@ public class ItemController extends AbstractEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/ItemFrameController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/ItemFrameController.java index 13f2c4a81..28abd2c1b 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/ItemFrameController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/ItemFrameController.java @@ -11,7 +11,6 @@ import org.bukkit.entity.ItemFrame; import org.bukkit.util.Vector; import net.citizensnpcs.api.event.DespawnReason; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; @@ -72,24 +71,10 @@ public class ItemFrameController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/LargeFireballController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/LargeFireballController.java index 34b8598ce..d633ee7c9 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/LargeFireballController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/LargeFireballController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLargeFireball; import org.bukkit.entity.LargeFireball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; @@ -57,24 +56,10 @@ public class LargeFireballController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/LeashController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/LeashController.java index 537f05afa..e90f89091 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/LeashController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/LeashController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_8_R3.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLeash; +import org.bukkit.entity.LeashHitch; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_8_R3.EntityLeash; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLeash; -import org.bukkit.entity.LeashHitch; -import org.bukkit.util.Vector; - public class LeashController extends MobEntityController { public LeashController() { super(EntityLeashNPC.class); @@ -56,24 +55,10 @@ public class LeashController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartChestController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartChestController.java index 48bbd9378..1442a5561 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartChestController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartChestController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftMinecartChest; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; @@ -57,24 +56,10 @@ public class MinecartChestController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartCommandController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartCommandController.java index e0822e090..c94fb1d31 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartCommandController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartCommandController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftMinecartCommand; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; @@ -57,24 +56,10 @@ public class MinecartCommandController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartFurnaceController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartFurnaceController.java index 39b0c1740..13e17488e 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartFurnaceController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartFurnaceController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftMinecartFurnace; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; @@ -57,24 +56,10 @@ public class MinecartFurnaceController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartHopperController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartHopperController.java index a575351da..44f47032e 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartHopperController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartHopperController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_8_R3.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; @@ -53,24 +52,10 @@ public class MinecartHopperController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartRideableController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartRideableController.java index 91731a667..02a6c7856 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartRideableController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartRideableController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftMinecartRideable; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; @@ -57,24 +56,10 @@ public class MinecartRideableController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartSpawnerController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartSpawnerController.java index a58068e84..b86631244 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartSpawnerController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartSpawnerController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_8_R3.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; @@ -53,24 +52,10 @@ public class MinecartSpawnerController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartTNTController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartTNTController.java index ee81a27e1..ce9f30b3d 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartTNTController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/MinecartTNTController.java @@ -3,7 +3,6 @@ package net.citizensnpcs.nms.v1_8_R3.entity.nonliving; import org.bukkit.entity.Minecart; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; import net.citizensnpcs.nms.v1_8_R3.util.NMSImpl; @@ -53,24 +52,10 @@ public class MinecartTNTController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/PaintingController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/PaintingController.java index b72ec359a..93e7ded0f 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/PaintingController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/PaintingController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_8_R3.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPainting; +import org.bukkit.entity.Painting; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_8_R3.EntityPainting; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPainting; -import org.bukkit.entity.Painting; -import org.bukkit.util.Vector; - public class PaintingController extends MobEntityController { public PaintingController() { super(EntityPaintingNPC.class); @@ -56,24 +55,10 @@ public class PaintingController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/SmallFireballController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/SmallFireballController.java index a7b660bc6..5755cb6fd 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/SmallFireballController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/SmallFireballController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSmallFireball; import org.bukkit.entity.SmallFireball; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -56,24 +55,10 @@ public class SmallFireballController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/SnowballController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/SnowballController.java index 0c65fc7d2..3187ba66f 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/SnowballController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/SnowballController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_8_R3.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSnowball; +import org.bukkit.entity.Snowball; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_8_R3.EntitySnowball; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSnowball; -import org.bukkit.entity.Snowball; -import org.bukkit.util.Vector; - public class SnowballController extends MobEntityController { public SnowballController() { super(EntitySnowballNPC.class); @@ -70,24 +69,10 @@ public class SnowballController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/TNTPrimedController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/TNTPrimedController.java index 35efb984f..7691d2754 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/TNTPrimedController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/TNTPrimedController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_8_R3.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftTNTPrimed; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_8_R3.EntityTNTPrimed; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftTNTPrimed; -import org.bukkit.entity.TNTPrimed; -import org.bukkit.util.Vector; - public class TNTPrimedController extends MobEntityController { public TNTPrimedController() { super(EntityTNTPrimedNPC.class); @@ -56,24 +55,10 @@ public class TNTPrimedController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/ThrownExpBottleController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/ThrownExpBottleController.java index 61e31fdc3..45e59d972 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/ThrownExpBottleController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/ThrownExpBottleController.java @@ -7,7 +7,6 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftThrownExpBottle; import org.bukkit.entity.ThrownExpBottle; import org.bukkit.util.Vector; -import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -56,24 +55,10 @@ public class ThrownExpBottleController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/WitherSkullController.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/WitherSkullController.java index c892c8250..84ce03c52 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/WitherSkullController.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/entity/nonliving/WitherSkullController.java @@ -1,6 +1,12 @@ package net.citizensnpcs.nms.v1_8_R3.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftWitherSkull; +import org.bukkit.entity.WitherSkull; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.nms.v1_8_R3.entity.MobEntityController; import net.citizensnpcs.npc.CitizensNPC; @@ -10,13 +16,6 @@ import net.minecraft.server.v1_8_R3.EntityWitherSkull; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftWitherSkull; -import org.bukkit.entity.WitherSkull; -import org.bukkit.util.Vector; - public class WitherSkullController extends MobEntityController { public WitherSkullController() { super(EntityWitherSkullNPC.class); @@ -56,24 +55,10 @@ public class WitherSkullController extends MobEntityController { @Override public void g(double x, double y, double z) { - if (npc == null) { - super.g(x, y, z); - return; - } - if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) { - if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) - super.g(x, y, z); - return; - } - Vector vector = new Vector(x, y, z); - NPCPushEvent event = Util.callPushEvent(npc, vector); - if (!event.isCancelled()) { - vector = event.getCollisionVector(); + Vector vector = Util.callPushEvent(npc, x, y, z); + if (vector != null) { super.g(vector.getX(), vector.getY(), vector.getZ()); } - // when another entity collides, this method is called to push the - // NPC so we prevent it from doing anything if the event is - // cancelled. } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/util/PlayerlistTrackerEntry.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/util/PlayerlistTrackerEntry.java index 5fef1e864..0f8159b57 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/util/PlayerlistTrackerEntry.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/util/PlayerlistTrackerEntry.java @@ -12,6 +12,7 @@ import net.citizensnpcs.util.NMS; import net.minecraft.server.v1_8_R3.Entity; import net.minecraft.server.v1_8_R3.EntityPlayer; import net.minecraft.server.v1_8_R3.EntityTrackerEntry; +import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation; public class PlayerlistTrackerEntry extends EntityTrackerEntry { private EntityPlayer lastUpdatedPlayer; @@ -40,6 +41,7 @@ public class PlayerlistTrackerEntry extends EntityTrackerEntry { Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() { @Override public void run() { + NMSImpl.sendPacket(entityplayer.getBukkitEntity(), new PacketPlayOutAnimation(tracker, 0)); NMS.sendTabListRemove(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity()); } }, Setting.TABLIST_REMOVE_PACKET_DELAY.asInt());