2020-04-22 08:25:00 +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.apache.commons.lang3.ArrayUtils;
|
|
|
|
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)
|
2020-05-29 10:14:21 +00:00
|
|
|
@CommandParameters(description = "Unmutes a player", usage = "/<command> [-q] <player>")
|
2020-04-22 08:25:00 +00:00
|
|
|
public class Command_unmute extends FreedomCommand
|
|
|
|
{
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
|
|
{
|
|
|
|
if (args.length == 0)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -q option (shadowmute)
|
|
|
|
boolean quiet = args[0].equals("-q");
|
|
|
|
if (quiet)
|
|
|
|
{
|
|
|
|
args = ArrayUtils.subarray(args, 1, args.length);
|
|
|
|
|
|
|
|
if (args.length < 1)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
final Player player = getPlayer(args[0]);
|
|
|
|
if (player == null)
|
|
|
|
{
|
|
|
|
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
FPlayer playerdata = plugin.pl.getPlayer(player);
|
|
|
|
if (playerdata.isMuted())
|
|
|
|
{
|
2020-04-23 11:18:03 +00:00
|
|
|
playerdata.setMuted(false);
|
|
|
|
player.sendTitle(ChatColor.RED + "You've been unmuted.", ChatColor.YELLOW + "Be sure to follow the rules!", 20, 100, 60);
|
2020-07-17 23:54:46 +00:00
|
|
|
|
|
|
|
if (quiet)
|
2020-04-22 08:25:00 +00:00
|
|
|
{
|
2020-07-17 23:54:46 +00:00
|
|
|
msg("Unmuted " + player.getName() + " quietly");
|
|
|
|
return true;
|
2020-04-22 08:25:00 +00:00
|
|
|
}
|
2020-07-17 23:54:46 +00:00
|
|
|
|
|
|
|
FUtil.adminAction(sender.getName(), "Unmuting " + player.getName(), true);
|
|
|
|
msg("Unmuted " + player.getName());
|
|
|
|
msg(player, "You have been unmuted.", ChatColor.RED);
|
2020-04-22 08:25:00 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
msg(ChatColor.RED + "That player is not muted.");
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2020-07-17 23:54:46 +00:00
|
|
|
}
|