From 592a58a0c87bf0054610f5a7ec996e65f1c0c402 Mon Sep 17 00:00:00 2001 From: chris Date: Mon, 25 Dec 2023 20:43:13 +0100 Subject: [PATCH] Use uuid for bukkit api permission checks (#4363) * lookup players by uuid instead of name * Fix: look up Players by UUID for permissions, dont throw if a player can't be found (e.g. disconnected) * use api method --- .../spigot/world/manager/GeyserSpigotWorldManager.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java index 74f359e02..42f0d17f4 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java @@ -197,7 +197,11 @@ public class GeyserSpigotWorldManager extends WorldManager { @Override public boolean hasPermission(GeyserSession session, String permission) { - return Objects.requireNonNull(Bukkit.getPlayer(session.getPlayerEntity().getUsername())).hasPermission(permission); + Player player = Bukkit.getPlayer(session.javaUuid()); + if (player != null) { + return player.hasPermission(permission); + } + return false; } @Override