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
This commit is contained in:
chris 2023-12-25 20:43:13 +01:00 committed by GitHub
parent b0ccf45cd4
commit 592a58a0c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -197,7 +197,11 @@ public class GeyserSpigotWorldManager extends WorldManager {
@Override @Override
public boolean hasPermission(GeyserSession session, String permission) { 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 @Override