Block Op's from using bad codes

This will block a op from using a set of colour codes you to not want them to use, like &k
This commit is contained in:
Ryan 2013-08-12 17:10:08 +01:00
parent 4e3c9a6b9e
commit 4603dc5613

View File

@ -19,6 +19,11 @@ public class Command_tag extends TFM_Command
"admin", "owner", "moderator", "developer" "admin", "owner", "moderator", "developer"
}); });
public static final List<String> FORBIDDEN_CODE = Arrays.asList(new String[]
{
"&k"
});
@Override @Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{ {
@ -80,6 +85,19 @@ public class Command_tag extends TFM_Command
} }
} }
if (!TFM_SuperadminList.isUserSuperadmin(sender))
{
for (String word : FORBIDDEN_CODE)
{
if (args[0].toLowerCase().contains(word))
{
playerMsg("You may not include the colour code you have attempted to use in your tag")
return true;
}
}
}
TFM_PlayerData.getPlayerData(sender_p).setTag(args[0]); TFM_PlayerData.getPlayerData(sender_p).setTag(args[0]);
playerMsg("Tag set."); playerMsg("Tag set.");