mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-16 20:36:12 +00:00
separate unblocking commands from bcmd
This commit is contained in:
parent
aef85b2120
commit
4ad7fd874f
@ -73,12 +73,16 @@ public class Command_blockcmd extends FreedomCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
FPlayer playerdata = plugin.pl.getPlayer(player);
|
FPlayer playerdata = plugin.pl.getPlayer(player);
|
||||||
|
if (!playerdata.allCommandsBlocked())
|
||||||
playerdata.setCommandsBlocked(!playerdata.allCommandsBlocked());
|
{
|
||||||
|
playerdata.setCommandsBlocked(true);
|
||||||
FUtil.adminAction(sender.getName(), (playerdata.allCommandsBlocked() ? "B" : "Unb") + "locking all commands for " + player.getName(), true);
|
FUtil.adminAction(sender.getName(), "Blocking all commands for " + player.getName(), true);
|
||||||
msg((playerdata.allCommandsBlocked() ? "B" : "Unb") + "locked all commands.");
|
msg("Blocked commands for " + player.getName() + ".");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg("That players commands are already blocked.", ChatColor.RED);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user