mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
fix nickclean not being registered
also allow for ops/non-ops to run /opme, there isn't any reason as to why this command should be limited to admins only
This commit is contained in:
parent
30085a7a52
commit
db414164dc
@ -16,15 +16,9 @@ import org.bukkit.entity.Player;
|
|||||||
public class Command_nickclean extends FreedomCommand
|
public class Command_nickclean extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final String[] BLOCK = ConfigEntry.BLOCKED_CHATCODES.getString().split(",");
|
|
||||||
|
|
||||||
private static final Pattern REGEX = Pattern.compile(FUtil.colorize(ChatColor.COLOR_CHAR + "[" + StringUtils.join(BLOCK, "") + "]"), Pattern.CASE_INSENSITIVE);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
FUtil.adminAction(sender.getName(), "Cleaning all nicknames", false);
|
|
||||||
|
|
||||||
if (args.length > 1)
|
if (args.length > 1)
|
||||||
{
|
{
|
||||||
Player player = getPlayer(args[0]);
|
Player player = getPlayer(args[0]);
|
||||||
@ -40,7 +34,6 @@ public class Command_nickclean extends FreedomCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FUtil.adminAction(sender.getName(), "Cleaning all nicknames", false);
|
FUtil.adminAction(sender.getName(), "Cleaning all nicknames", false);
|
||||||
for (final Player player : server.getOnlinePlayers())
|
for (final Player player : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
@ -53,6 +46,7 @@ public class Command_nickclean extends FreedomCommand
|
|||||||
{
|
{
|
||||||
final String playerName = player.getName();
|
final String playerName = player.getName();
|
||||||
final String nickName = plugin.esb.getNickname(playerName);
|
final String nickName = plugin.esb.getNickname(playerName);
|
||||||
|
final Pattern REGEX = Pattern.compile(FUtil.colorize(ChatColor.COLOR_CHAR + "[" + StringUtils.join(ConfigEntry.BLOCKED_CHATCODES.getString().split(","), "") + "]"), Pattern.CASE_INSENSITIVE);
|
||||||
if (nickName != null && !nickName.isEmpty() && !nickName.equalsIgnoreCase(playerName))
|
if (nickName != null && !nickName.isEmpty() && !nickName.equalsIgnoreCase(playerName))
|
||||||
{
|
{
|
||||||
final Matcher matcher = REGEX.matcher(nickName);
|
final Matcher matcher = REGEX.matcher(nickName);
|
||||||
@ -64,4 +58,4 @@ public class Command_nickclean extends FreedomCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,7 +6,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
|
@CommandPermissions(level = Rank.NON_OP, source = SourceType.ONLY_IN_GAME)
|
||||||
@CommandParameters(description = "OPs the command sender.", usage = "/<command>")
|
@CommandParameters(description = "OPs the command sender.", usage = "/<command>")
|
||||||
public class Command_opme extends FreedomCommand
|
public class Command_opme extends FreedomCommand
|
||||||
{
|
{
|
||||||
@ -17,7 +17,6 @@ public class Command_opme extends FreedomCommand
|
|||||||
FUtil.adminAction(sender.getName(), "Opping " + sender.getName(), false);
|
FUtil.adminAction(sender.getName(), "Opping " + sender.getName(), false);
|
||||||
sender.setOp(true);
|
sender.setOp(true);
|
||||||
sender.sendMessage(FreedomCommand.YOU_ARE_OP);
|
sender.sendMessage(FreedomCommand.YOU_ARE_OP);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user