separate unblocking commands from bcmd

This commit is contained in:
speedxx 2020-07-24 23:24:14 -04:00
parent aef85b2120
commit 4ad7fd874f
2 changed files with 55 additions and 7 deletions

View File

@ -73,12 +73,16 @@ public class Command_blockcmd extends FreedomCommand
}
FPlayer playerdata = plugin.pl.getPlayer(player);
playerdata.setCommandsBlocked(!playerdata.allCommandsBlocked());
FUtil.adminAction(sender.getName(), (playerdata.allCommandsBlocked() ? "B" : "Unb") + "locking all commands for " + player.getName(), true);
msg((playerdata.allCommandsBlocked() ? "B" : "Unb") + "locked all commands.");
if (!playerdata.allCommandsBlocked())
{
playerdata.setCommandsBlocked(true);
FUtil.adminAction(sender.getName(), "Blocking all commands for " + player.getName(), true);
msg("Blocked commands for " + player.getName() + ".");
}
else
{
msg("That players commands are already blocked.", ChatColor.RED);
}
return true;
}
}
}

View File

@ -0,0 +1,44 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Unblocks commands for a player.", usage = "/<command> <player>", aliases = "unblockcommand,unblockcommands,ubcmds,unblockcmds,ubc")
public class Command_unblockcmd extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length == 0)
{
return false;
}
Player player = getPlayer(args[0]);
if (player == null)
{
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
return true;
}
FPlayer fPlayer = plugin.pl.getPlayer(player);
if (fPlayer.allCommandsBlocked())
{
fPlayer.setCommandsBlocked(false);
FUtil.adminAction(sender.getName(), "Unblocking all commands for " + player.getName(), true);
msg("Unblocked commands for " + player.getName() + ".");
}
else
{
msg("That players commands aren't blocked.", ChatColor.RED);
}
return true;
}
}