2020-07-25 03:24:14 +00:00
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 ;
2020-09-28 03:17:01 +00:00
@CommandPermissions ( level = Rank . ADMIN , source = SourceType . BOTH )
2020-07-25 03:24:14 +00:00
@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 )
{
2021-04-05 23:13:26 +00:00
msg ( PLAYER_NOT_FOUND ) ;
2020-07-25 03:24:14 +00:00
return true ;
}
FPlayer fPlayer = plugin . pl . getPlayer ( player ) ;
if ( fPlayer . allCommandsBlocked ( ) )
{
fPlayer . setCommandsBlocked ( false ) ;
2020-12-04 00:28:53 +00:00
FUtil . adminAction ( sender . getName ( ) , " Unblocking all commands for " + player . getName ( ) , true ) ;
2020-07-25 03:24:14 +00:00
msg ( " Unblocked commands for " + player . getName ( ) + " . " ) ;
}
else
{
msg ( " That players commands aren't blocked. " , ChatColor . RED ) ;
}
return true ;
}
}