Fixed the issue with the tax syntax as per #1768 and removed the original hard coded blocked tag list and moved to the config file

This commit is contained in:
Ryan Wild 2019-03-03 22:14:57 +01:00
parent a19f554838
commit 13ca59c7d5
No known key found for this signature in database
GPG key ID: 2561AB9E95B68C35
3 changed files with 16 additions and 7 deletions

View file

@ -1,7 +1,9 @@
package me.totalfreedom.totalfreedommod.command; package me.totalfreedom.totalfreedommod.command;
import java.util.Arrays; import com.google.common.collect.Lists;
import java.util.Collection;
import java.util.List; import java.util.List;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.util.FUtil;
@ -12,18 +14,17 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH) @CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Sets yourself a prefix", usage = "/<command> <set <tag..> | off | clear <player> | clearall>") @CommandParameters(description = "Sets yourself a prefix", usage = "/<command> <set <tag> | off | clear <player> | clearall | list>")
public class Command_tag extends FreedomCommand public class Command_tag extends FreedomCommand
{ {
public static final List<String> FORBIDDEN_WORDS = Arrays.asList(new String[] public static final List<String> FORBIDDEN_WORDS = Lists.newArrayList();
{
"admin", "owner", "moderator", "developer", "console"
});
@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)
{ {
FORBIDDEN_WORDS.addAll((Collection<? extends String>) ConfigEntry.BLOCKED_TAGS.getList());
if (args.length == 1) if (args.length == 1)
{ {
if ("list".equalsIgnoreCase(args[0])) if ("list".equalsIgnoreCase(args[0]))

View file

@ -83,6 +83,7 @@ public enum ConfigEntry
FAMOUS_PLAYERS(List.class, "famous_players"), FAMOUS_PLAYERS(List.class, "famous_players"),
OVERLORD_IPS(List.class, "overlord_ips"), OVERLORD_IPS(List.class, "overlord_ips"),
NOADMIN_IPS(List.class, "noadmin_ips"), NOADMIN_IPS(List.class, "noadmin_ips"),
BLOCKED_TAGS(List.class, "blocked_tags"),
ADMIN_ONLY_MODE(Boolean.class, "admin_only_mode"), ADMIN_ONLY_MODE(Boolean.class, "admin_only_mode"),
AUTO_ENTITY_WIPE(Boolean.class, "auto_wipe"); AUTO_ENTITY_WIPE(Boolean.class, "auto_wipe");
// //

View file

@ -336,4 +336,11 @@ overlord_ips:
- 107.191.101.27 - 107.191.101.27
- 178.62.117.94 - 178.62.117.94
- 141.101.104.243 - 141.101.104.243
# Tags that may not be set by players
blocked_tags:
- admin
- moderator
- owner
- developer
- console