From dc2d6c9a898160e69c46ef286e3f585123e0db35 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 26 Jul 2020 15:26:26 +0200 Subject: [PATCH] Hotfix leaving BE players --- .../de/steamwar/core/events/ChunkListener.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/core/events/ChunkListener.java b/SpigotCore_Main/src/de/steamwar/core/events/ChunkListener.java index fe7d74f..733e316 100644 --- a/SpigotCore_Main/src/de/steamwar/core/events/ChunkListener.java +++ b/SpigotCore_Main/src/de/steamwar/core/events/ChunkListener.java @@ -5,12 +5,16 @@ import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.events.PacketAdapter; import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.events.PacketEvent; +import com.comphenix.protocol.injector.server.TemporaryPlayer; import com.comphenix.protocol.reflect.StructureModifier; import de.steamwar.chunk.*; import de.steamwar.core.Core; import de.steamwar.sql.SteamwarUser; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; +import java.util.logging.Level; + public class ChunkListener { private ChunkListener(){} @@ -19,10 +23,18 @@ public class ChunkListener { @Override public void onPacketSending(PacketEvent e) { Player p = e.getPlayer(); - SteamwarUser user = SteamwarUser.get(p.getUniqueId()); - if(!user.isBedrock()) + if(p instanceof TemporaryPlayer) return; + try{ + SteamwarUser user = SteamwarUser.get(p.getUniqueId()); + if(!user.isBedrock()) + return; + }catch(UnsupportedOperationException ex){ + Bukkit.getLogger().log(Level.SEVERE, "Could not get uuid", ex); + return; + } + PacketContainer packet = e.getPacket(); StructureModifier fullChunk = packet.getBooleans(); if(fullChunk.read(0))