Merge pull request #535 from PimvanderLoos/master

Improve checking if player is temporary
This commit is contained in:
libraryaddict 2021-01-06 02:39:24 +13:00 committed by GitHub
commit 35719f8317
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,6 @@ import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.reflect.StructureModifier; import com.comphenix.protocol.reflect.StructureModifier;
import com.comphenix.protocol.utility.ByteBuddyGenerated;
import me.libraryaddict.disguise.DisguiseAPI; import me.libraryaddict.disguise.DisguiseAPI;
import me.libraryaddict.disguise.LibsDisguises; import me.libraryaddict.disguise.LibsDisguises;
import me.libraryaddict.disguise.disguisetypes.Disguise; import me.libraryaddict.disguise.disguisetypes.Disguise;
@ -37,15 +36,12 @@ public class PacketListenerInventory extends PacketAdapter {
@Override @Override
public void onPacketReceiving(final PacketEvent event) { public void onPacketReceiving(final PacketEvent event) {
if (event.isCancelled()) if (event.isCancelled() || event.isPlayerTemporary())
return; return;
final Player player = event.getPlayer(); final Player player = event.getPlayer();
if (player.getName().contains("UNKNOWN[")) // If the player is temporary if (player.getVehicle() != null) {
return;
if (player instanceof ByteBuddyGenerated || player.getVehicle() != null) {
return; return;
} }
@ -251,7 +247,7 @@ public class PacketListenerInventory extends PacketAdapter {
Player player = event.getPlayer(); Player player = event.getPlayer();
// If the inventory is the players inventory // If the inventory is the players inventory
if (player instanceof ByteBuddyGenerated || player.getVehicle() != null || if (event.isPlayerTemporary() || player.getVehicle() != null ||
event.getPacket().getIntegers().read(0) != 0) { event.getPacket().getIntegers().read(0) != 0) {
return; return;
} }