Fixes an issue with temporary players created in ProtocolLib

This commit is contained in:
NavidK0 2016-03-19 18:43:58 -04:00
parent f30f5dfcf2
commit 12ea8ee35e
2 changed files with 11 additions and 0 deletions

View File

@ -83,6 +83,8 @@ public class PacketsManager {
if (event.isCancelled()) if (event.isCancelled())
return; return;
try { try {
if (event.getPlayer().getName().contains("UNKNOWN[")) //If the player is temporary
return;
Player observer = event.getPlayer(); Player observer = event.getPlayer();
StructureModifier<Entity> entityModifer = event.getPacket().getEntityModifier(observer.getWorld()); StructureModifier<Entity> entityModifer = event.getPacket().getEntityModifier(observer.getWorld());
Entity entity = entityModifer.read(0); Entity entity = entityModifer.read(0);
@ -522,6 +524,8 @@ public class PacketsManager {
if (event.isAsync()) { if (event.isAsync()) {
return; return;
} }
if (event.getPlayer().getName().contains("UNKNOWN[")) //If the player is temporary
return;
event.setPacket(event.getPacket().deepClone()); event.setPacket(event.getPacket().deepClone());
StructureModifier<Object> mods = event.getPacket().getModifier(); StructureModifier<Object> mods = event.getPacket().getModifier();
Player observer = event.getPlayer(); Player observer = event.getPlayer();
@ -753,6 +757,8 @@ public class PacketsManager {
public void onPacketSending(PacketEvent event) { public void onPacketSending(PacketEvent event) {
if (event.isCancelled()) if (event.isCancelled())
return; return;
if (event.getPlayer().getName().contains("UNKNOWN[")) //If the player is temporary
return;
final Player observer = event.getPlayer(); final Player observer = event.getPlayer();
if (event.getPacket().getIntegers().read(0) == observer.getEntityId()) { if (event.getPacket().getIntegers().read(0) == observer.getEntityId()) {
if (DisguiseAPI.isSelfDisguised(observer)) { if (DisguiseAPI.isSelfDisguised(observer)) {
@ -848,6 +854,8 @@ public class PacketsManager {
public void onPacketReceiving(final PacketEvent event) { public void onPacketReceiving(final PacketEvent event) {
if (event.isCancelled()) if (event.isCancelled())
return; return;
if (event.getPlayer().getName().contains("UNKNOWN[")) //If the player is temporary
return;
if (!(event.getPlayer() instanceof com.comphenix.net.sf.cglib.proxy.Factory) if (!(event.getPlayer() instanceof com.comphenix.net.sf.cglib.proxy.Factory)
&& event.getPlayer().getVehicle() == null) { && event.getPlayer().getVehicle() == null) {
Disguise disguise = DisguiseAPI.getDisguise(event.getPlayer(), event.getPlayer()); Disguise disguise = DisguiseAPI.getDisguise(event.getPlayer(), event.getPlayer());
@ -1180,6 +1188,8 @@ public class PacketsManager {
public void onPacketSending(PacketEvent event) { public void onPacketSending(PacketEvent event) {
if (event.isCancelled()) if (event.isCancelled())
return; return;
if (event.getPlayer().getName().contains("UNKNOWN[")) //If the player is temporary
return;
final Player observer = event.getPlayer(); final Player observer = event.getPlayer();
// First get the entity, the one sending this packet // First get the entity, the one sending this packet
StructureModifier<Entity> entityModifer = event.getPacket().getEntityModifier(observer.getWorld()); StructureModifier<Entity> entityModifer = event.getPacket().getEntityModifier(observer.getWorld());

View File

@ -1,5 +1,6 @@
name: LibsDisguises name: LibsDisguises
main: me.libraryaddict.disguise.LibsDisguises main: me.libraryaddict.disguise.LibsDisguises
description: A disguise plugin with various disguises.
version: 9.0 version: 9.0
author: libraryaddict author: libraryaddict
authors: [Byteflux, Navid K.] authors: [Byteflux, Navid K.]