From 190d17d1fec5b2a66e65950e36f184b8de5ecf98 Mon Sep 17 00:00:00 2001 From: gnembon Date: Sun, 22 Nov 2020 21:47:32 -0400 Subject: [PATCH] fixes NPE when summoning a player with a banned account. --- src/main/java/carpet/commands/PlayerCommand.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/carpet/commands/PlayerCommand.java b/src/main/java/carpet/commands/PlayerCommand.java index 7d060e33..0414acb4 100644 --- a/src/main/java/carpet/commands/PlayerCommand.java +++ b/src/main/java/carpet/commands/PlayerCommand.java @@ -186,12 +186,18 @@ public class PlayerCommand return true; } GameProfile profile = server.getUserCache().findByName(playerName); - if (manager.getUserBanList().contains(profile)) + if (profile == null) { - Messenger.m(context.getSource(), "r Player ", "rb " + playerName, "r is banned"); + Messenger.m(context.getSource(), "r Player "+playerName+" is either banned by Mojang, or auth servers are down. " + + "Banned players can only be summoned in Singleplayer and in servers in off-line mode."); return true; } - if (manager.isWhitelistEnabled() && profile != null && manager.isWhitelisted(profile) && !context.getSource().hasPermissionLevel(2)) + if (manager.getUserBanList().contains(profile)) + { + Messenger.m(context.getSource(), "r Player ", "rb " + playerName, "r is banned on this server"); + return true; + } + if (manager.isWhitelistEnabled() && manager.isWhitelisted(profile) && !context.getSource().hasPermissionLevel(2)) { Messenger.m(context.getSource(), "r Whitelisted players can only be spawned by operators"); return true;