SteamWar/SpigotCore
Archiviert
13
0

Hotfix leaving BE players

Dieser Commit ist enthalten in:
Lixfel 2020-07-26 15:26:26 +02:00
Ursprung d74f08b179
Commit dc2d6c9a89

Datei anzeigen

@ -5,12 +5,16 @@ import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.events.PacketAdapter; 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.injector.server.TemporaryPlayer;
import com.comphenix.protocol.reflect.StructureModifier; import com.comphenix.protocol.reflect.StructureModifier;
import de.steamwar.chunk.*; import de.steamwar.chunk.*;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.logging.Level;
public class ChunkListener { public class ChunkListener {
private ChunkListener(){} private ChunkListener(){}
@ -19,10 +23,18 @@ public class ChunkListener {
@Override @Override
public void onPacketSending(PacketEvent e) { public void onPacketSending(PacketEvent e) {
Player p = e.getPlayer(); Player p = e.getPlayer();
SteamwarUser user = SteamwarUser.get(p.getUniqueId()); if(p instanceof TemporaryPlayer)
if(!user.isBedrock())
return; 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(); PacketContainer packet = e.getPacket();
StructureModifier<Boolean> fullChunk = packet.getBooleans(); StructureModifier<Boolean> fullChunk = packet.getBooleans();
if(fullChunk.read(0)) if(fullChunk.read(0))