Unvanish, remove commandspy & set fuckoff radius to 0 for removed admins

This commit is contained in:
Business Goose 2022-05-03 08:58:14 +01:00
parent 78654eb5e8
commit 0326171e85
No known key found for this signature in database
GPG Key ID: 77DCA801362E9645

View File

@ -6,6 +6,7 @@ import java.util.Collections;
import java.util.Date;
import java.util.List;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.admin.AdminList;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.discord.Discord;
import me.totalfreedom.totalfreedommod.player.FPlayer;
@ -240,7 +241,9 @@ public class Command_saconfig extends FreedomCommand
checkRank(Rank.ADMIN);
Player player = getPlayer(args[1]);
FPlayer freedomPlayer = plugin.pl.getPlayer(player);
Admin admin = player != null ? plugin.al.getAdmin(player) : plugin.al.getEntryByName(args[1]);
String adminName = admin.getName();
if (admin == null)
{
@ -255,13 +258,27 @@ public class Command_saconfig extends FreedomCommand
plugin.al.updateTables();
if (player != null)
{
// Update tab name
plugin.rm.updateDisplay(player);
plugin.pl.getPlayer(player).setAdminChat(false);
// Ensure admins don't have admin functionality when removed (FS-222)
freedomPlayer.setAdminChat(false);
freedomPlayer.setCommandSpy(false);
freedomPlayer.setFuckoffRadius(0);
// Disable vanish
plugin.esb.setVanished(adminName, false);
AdminList.vanished.remove(adminName);
for (Player player1 : server.getOnlinePlayers())
{
player1.showPlayer(plugin, player);
}
}
if (plugin.dc.enabled && ConfigEntry.DISCORD_ROLE_SYNC.getBoolean())
{
Discord.syncRoles(admin, plugin.pl.getData(admin.getName()).getDiscordID());
Discord.syncRoles(admin, plugin.pl.getData(adminName).getDiscordID());
}
plugin.ptero.updateAccountStatus(admin);