diff --git a/API/pom.xml b/API/pom.xml index 2e477f4..beae594 100644 --- a/API/pom.xml +++ b/API/pom.xml @@ -5,7 +5,7 @@ PacketEntityAPI net.blitzcube.peapi - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT 4.0.0 diff --git a/Plugin/pom.xml b/Plugin/pom.xml index d4829a8..f479a52 100644 --- a/Plugin/pom.xml +++ b/Plugin/pom.xml @@ -6,7 +6,7 @@ PacketEntityAPI net.blitzcube.peapi - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT Plugin @@ -59,7 +59,7 @@ net.blitzcube.peapi API - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT diff --git a/Plugin/src/main/java/net/blitzcube/peapi/PacketEntityAPI.java b/Plugin/src/main/java/net/blitzcube/peapi/PacketEntityAPI.java index e1b19ec..b0a2d69 100644 --- a/Plugin/src/main/java/net/blitzcube/peapi/PacketEntityAPI.java +++ b/Plugin/src/main/java/net/blitzcube/peapi/PacketEntityAPI.java @@ -15,6 +15,7 @@ import net.blitzcube.peapi.api.entity.modifier.IEntityModifierRegistry; import net.blitzcube.peapi.api.entity.modifier.IModifiableEntity; import net.blitzcube.peapi.api.listener.IListener; +import net.blitzcube.peapi.api.packet.IEntityGroupPacket; import net.blitzcube.peapi.api.packet.IEntityPacket; import net.blitzcube.peapi.api.packet.IEntityPacketFactory; import net.blitzcube.peapi.entity.EntityIdentifier; @@ -209,6 +210,7 @@ public void dispatchPacket(IEntityPacket packet, Player target) { @Override public void dispatchPacket(IEntityPacket packet, Player target, int delay) { + if (packet instanceof IEntityGroupPacket) ((IEntityGroupPacket) packet).apply(); PacketContainer c = packet.getRawPacket(); if (c == null) return; if (delay > 0) { diff --git a/Plugin/src/main/java/net/blitzcube/peapi/event/engine/listeners/GenericListener.java b/Plugin/src/main/java/net/blitzcube/peapi/event/engine/listeners/GenericListener.java index 9373021..dc1aa3f 100644 --- a/Plugin/src/main/java/net/blitzcube/peapi/event/engine/listeners/GenericListener.java +++ b/Plugin/src/main/java/net/blitzcube/peapi/event/engine/listeners/GenericListener.java @@ -7,6 +7,7 @@ import net.blitzcube.peapi.PacketEntityAPI; import net.blitzcube.peapi.api.event.IEntityPacketEvent; import net.blitzcube.peapi.api.packet.IEntityClickPacket; +import net.blitzcube.peapi.api.packet.IEntityDestroyPacket; import net.blitzcube.peapi.api.packet.IEntityGroupPacket; import net.blitzcube.peapi.api.packet.IEntityPacket; import net.blitzcube.peapi.entity.fake.FakeEntity; @@ -68,14 +69,14 @@ public void onPacketSending(PacketEvent packetEvent) { if (w == null) return; IEntityPacketEvent e = new EntityPacketEvent(manager, w, eT, target); dispatcher.dispatch(e, null); - if (e.getPacket() instanceof IEntityGroupPacket) { - if ((e.getPacketType() == IEntityPacketEvent.EntityPacketType.DESTROY - && ((IEntityGroupPacket) e.getPacket()).getGroup().size() == 0) || e.isCancelled()) { + if (w instanceof IEntityGroupPacket) { + if (w instanceof IEntityDestroyPacket && ((IEntityDestroyPacket) w).getGroup().size() == 0) { packetEvent.setCancelled(true); return; } ((IEntityGroupPacket) e.getPacket()).apply(); - } else if (e.isCancelled()) { + } + if (e.isCancelled()) { packetEvent.setCancelled(true); } } diff --git a/pom.xml b/pom.xml index f362859..44e54f9 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ net.blitzcube.peapi PacketEntityAPI pom - 0.4.1-SNAPSHOT + 0.4.2-SNAPSHOT API Plugin