This commit is contained in:
Telesphoreo 2020-11-09 20:11:21 -06:00
parent 0adee3582b
commit a3837a0e06
2 changed files with 27 additions and 28 deletions

View File

@ -47,43 +47,40 @@ public class Command_mbconfig extends FreedomCommand
final Player player = getPlayer(args[1]); final Player player = getPlayer(args[1]);
PlayerData data; PlayerData data = player != null ? plugin.pl.getData(player) : plugin.pl.getData(args[1]);
if (player == null)
{
data = plugin.pl.getData(args[1]);
if (data == null) if (data == null)
{ {
msg(PLAYER_NOT_FOUND); msg(PLAYER_NOT_FOUND, ChatColor.RED);
return true; return true;
} }
}
else
{
data = plugin.pl.getData(player);
}
if (data.isMasterBuilder() && plugin.pl.isPlayerImpostor(player)) if (data.isMasterBuilder() && plugin.pl.isPlayerImpostor(player))
{ {
FUtil.staffAction(sender.getName(), "Re-adding " + player.getName() + " to the Master Builder list", true); FUtil.staffAction(sender.getName(), "Re-adding " + data.getName() + " to the Master Builder list", true);
player.setOp(true);
player.sendMessage(YOU_ARE_OP);
if (plugin.pl.getPlayer(player).getFreezeData().isFrozen()) if (plugin.pl.getPlayer(player).getFreezeData().isFrozen())
{ {
plugin.pl.getPlayer(player).getFreezeData().setFrozen(false); plugin.pl.getPlayer(player).getFreezeData().setFrozen(false);
player.sendMessage(ChatColor.GRAY + "You have been unfrozen.");
} }
if (player != null)
{
plugin.pl.verify(player, null); plugin.pl.verify(player, null);
plugin.rm.updateDisplay(player); plugin.rm.updateDisplay(player);
player.setOp(true);
player.sendMessage(YOU_ARE_OP);
}
} }
else if (!data.isMasterBuilder()) else if (!data.isMasterBuilder())
{ {
FUtil.staffAction(sender.getName(), "Adding " + player.getName() + " to the Master Builder list", true); FUtil.staffAction(sender.getName(), "Adding " + data.getName() + " to the Master Builder list", true);
data.setMasterBuilder(true); data.setMasterBuilder(true);
data.setVerification(true); data.setVerification(true);
plugin.pl.save(data); plugin.pl.save(data);
if (player != null)
{
plugin.rm.updateDisplay(player); plugin.rm.updateDisplay(player);
}
return true; return true;
} }
else else
@ -105,9 +102,9 @@ public class Command_mbconfig extends FreedomCommand
} }
Player player = getPlayer(args[1]); Player player = getPlayer(args[1]);
PlayerData data = plugin.pl.getData(player); PlayerData data = player != null ? plugin.pl.getData(player) : plugin.pl.getData(args[1]);
if (!data.isMasterBuilder()) if (data == null || !data.isMasterBuilder())
{ {
msg("Master Builder not found: " + args[1]); msg("Master Builder not found: " + args[1]);
return true; return true;
@ -120,7 +117,10 @@ public class Command_mbconfig extends FreedomCommand
data.setVerification(false); data.setVerification(false);
} }
plugin.pl.save(data); plugin.pl.save(data);
if (player != null)
{
plugin.rm.updateDisplay(player); plugin.rm.updateDisplay(player);
}
return true; return true;
} }
@ -130,6 +130,7 @@ public class Command_mbconfig extends FreedomCommand
} }
} }
} }
@Override @Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{ {
@ -139,17 +140,15 @@ public class Command_mbconfig extends FreedomCommand
} }
else if (args.length == 2) else if (args.length == 2)
{ {
if (args[0].equals("add")) if (args[0].equalsIgnoreCase("add"))
{ {
return FUtil.getPlayerList(); return FUtil.getPlayerList();
} }
else if (args[0].equals("remove")) else if (args[0].equalsIgnoreCase("remove") || args[0].equalsIgnoreCase("list"))
{ {
return plugin.pl.getMasterBuilderNames(); return plugin.pl.getMasterBuilderNames();
} }
} }
return Collections.emptyList(); return Collections.emptyList();
} }
} }

View File

@ -109,7 +109,7 @@ public class Command_slconfig extends FreedomCommand
if (plugin.dc.enabled && ConfigEntry.DISCORD_ROLE_SYNC.getBoolean()) if (plugin.dc.enabled && ConfigEntry.DISCORD_ROLE_SYNC.getBoolean())
{ {
plugin.dc.syncRoles(staffMember, plugin.pl.getData(staffMember.getName()).getDiscordID()); Discord.syncRoles(staffMember, plugin.pl.getData(staffMember.getName()).getDiscordID());
} }
plugin.ptero.updateAccountStatus(staffMember); plugin.ptero.updateAccountStatus(staffMember);