Remove offline vanished players & check if the player is online before attempting to get the FPlayer

This commit is contained in:
Business Goose 2022-05-03 09:23:37 +01:00
parent 0326171e85
commit 54df28022f
No known key found for this signature in database
GPG Key ID: 77DCA801362E9645

View File

@ -241,7 +241,8 @@ public class Command_saconfig extends FreedomCommand
checkRank(Rank.ADMIN); checkRank(Rank.ADMIN);
Player player = getPlayer(args[1]); Player player = getPlayer(args[1]);
FPlayer freedomPlayer = plugin.pl.getPlayer(player);
FPlayer freedomPlayer = player != null ? plugin.pl.getPlayer(player) : null;
Admin admin = player != null ? plugin.al.getAdmin(player) : plugin.al.getEntryByName(args[1]); Admin admin = player != null ? plugin.al.getAdmin(player) : plugin.al.getEntryByName(args[1]);
String adminName = admin.getName(); String adminName = admin.getName();
@ -256,6 +257,10 @@ public class Command_saconfig extends FreedomCommand
plugin.al.save(admin); plugin.al.save(admin);
plugin.al.updateTables(); plugin.al.updateTables();
AdminList.vanished.remove(adminName);
plugin.esb.setVanished(adminName, false);
if (player != null) if (player != null)
{ {
// Update tab name // Update tab name
@ -267,9 +272,6 @@ public class Command_saconfig extends FreedomCommand
freedomPlayer.setFuckoffRadius(0); freedomPlayer.setFuckoffRadius(0);
// Disable vanish // Disable vanish
plugin.esb.setVanished(adminName, false);
AdminList.vanished.remove(adminName);
for (Player player1 : server.getOnlinePlayers()) for (Player player1 : server.getOnlinePlayers())
{ {
player1.showPlayer(plugin, player); player1.showPlayer(plugin, player);