Update push event handling

This commit is contained in:
fullwall 2012-09-07 18:25:54 +08:00
parent 073ee8a65f
commit be84708f90
26 changed files with 156 additions and 52 deletions

View File

@ -59,7 +59,8 @@ public class CitizensBlazeNPC extends CitizensMobNPC {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -68,8 +69,11 @@ public class CitizensBlazeNPC extends CitizensMobNPC {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -66,7 +66,8 @@ public class CitizensCaveSpiderNPC extends CitizensMobNPC {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -75,8 +76,11 @@ public class CitizensCaveSpiderNPC extends CitizensMobNPC {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -51,7 +51,8 @@ public class CitizensChickenNPC extends CitizensMobNPC {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -60,8 +61,11 @@ public class CitizensChickenNPC extends CitizensMobNPC {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -51,7 +51,8 @@ public class CitizensCowNPC extends CitizensMobNPC {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -60,8 +61,11 @@ public class CitizensCowNPC extends CitizensMobNPC {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -65,7 +65,8 @@ public class CitizensCreeperNPC extends CitizensMobNPC {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -74,8 +75,11 @@ public class CitizensCreeperNPC extends CitizensMobNPC {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -53,7 +53,8 @@ public class CitizensEnderDragonNPC extends CitizensMobNPC {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -70,8 +71,11 @@ public class CitizensEnderDragonNPC extends CitizensMobNPC {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -106,7 +106,8 @@ public class CitizensEndermanNPC extends CitizensMobNPC implements Equipable {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -125,8 +126,11 @@ public class CitizensEndermanNPC extends CitizensMobNPC implements Equipable {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -59,7 +59,8 @@ public class CitizensGhastNPC extends CitizensMobNPC {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -68,8 +69,11 @@ public class CitizensGhastNPC extends CitizensMobNPC {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -55,7 +55,8 @@ public class CitizensGiantNPC extends CitizensMobNPC {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -64,8 +65,11 @@ public class CitizensGiantNPC extends CitizensMobNPC {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -54,7 +54,8 @@ public class CitizensIronGolemNPC extends CitizensMobNPC {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -63,8 +64,11 @@ public class CitizensIronGolemNPC extends CitizensMobNPC {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -69,7 +69,8 @@ public class CitizensMagmaCubeNPC extends CitizensMobNPC {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -78,8 +79,11 @@ public class CitizensMagmaCubeNPC extends CitizensMobNPC {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -51,7 +51,8 @@ public class CitizensMushroomCowNPC extends CitizensMobNPC {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -60,8 +61,11 @@ public class CitizensMushroomCowNPC extends CitizensMobNPC {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -58,7 +58,8 @@ public class CitizensOcelotNPC extends CitizensMobNPC {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -67,8 +68,11 @@ public class CitizensOcelotNPC extends CitizensMobNPC {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -84,7 +84,8 @@ public class CitizensPigNPC extends CitizensMobNPC implements Equipable {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -93,8 +94,11 @@ public class CitizensPigNPC extends CitizensMobNPC implements Equipable {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -68,7 +68,8 @@ public class CitizensPigZombieNPC extends CitizensMobNPC {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -77,8 +78,11 @@ public class CitizensPigZombieNPC extends CitizensMobNPC {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -89,7 +89,8 @@ public class CitizensSheepNPC extends CitizensMobNPC implements Equipable {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -98,8 +99,11 @@ public class CitizensSheepNPC extends CitizensMobNPC implements Equipable {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -68,7 +68,8 @@ public class CitizensSilverfishNPC extends CitizensMobNPC {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -77,8 +78,11 @@ public class CitizensSilverfishNPC extends CitizensMobNPC {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -58,7 +58,8 @@ public class CitizensSkeletonNPC extends CitizensMobNPC {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -67,8 +68,11 @@ public class CitizensSkeletonNPC extends CitizensMobNPC {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -69,7 +69,8 @@ public class CitizensSlimeNPC extends CitizensMobNPC {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -78,8 +79,11 @@ public class CitizensSlimeNPC extends CitizensMobNPC {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -54,7 +54,8 @@ public class CitizensSnowmanNPC extends CitizensMobNPC {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -63,8 +64,11 @@ public class CitizensSnowmanNPC extends CitizensMobNPC {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -67,7 +67,8 @@ public class CitizensSpiderNPC extends CitizensMobNPC {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -76,8 +77,11 @@ public class CitizensSpiderNPC extends CitizensMobNPC {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -59,7 +59,8 @@ public class CitizensSquidNPC extends CitizensMobNPC {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -68,8 +69,11 @@ public class CitizensSquidNPC extends CitizensMobNPC {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -66,7 +66,8 @@ public class CitizensVillagerNPC extends CitizensMobNPC {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -75,8 +76,11 @@ public class CitizensVillagerNPC extends CitizensMobNPC {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -58,7 +58,8 @@ public class CitizensWolfNPC extends CitizensMobNPC {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -67,8 +68,11 @@ public class CitizensWolfNPC extends CitizensMobNPC {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -58,7 +58,8 @@ public class CitizensZombieNPC extends CitizensMobNPC {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -67,8 +68,11 @@ public class CitizensZombieNPC extends CitizensMobNPC {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {

View File

@ -40,7 +40,8 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
// this method is called by both the entities involved - cancelling
// it will not stop the NPC from moving.
super.collide(entity);
Util.callCollisionEvent(npc, entity);
if (npc != null)
Util.callCollisionEvent(npc, entity);
}
@Override
@ -49,8 +50,11 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
super.g(x, y, z);
return;
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
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()) {