This commit is contained in:
speedxx 2020-07-16 18:46:57 -04:00
parent 39643b7019
commit ca0e2e2c62
8 changed files with 28 additions and 18 deletions

View file

@ -27,7 +27,7 @@
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.0" level="project" /> <orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
<orderEntry type="library" name="Maven: net.md-5:bungeecord-chat:1.16-R0.2" level="project" /> <orderEntry type="library" name="Maven: net.md-5:bungeecord-chat:1.16-R0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.26" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.26" level="project" />
<orderEntry type="library" name="Maven: com.github.TFPatches:TotalFreedomMod:development-eea17a24bc-1" level="project" /> <orderEntry type="library" name="Maven: com.github.TFPatches:TotalFreedomMod:server-2ca57c9b39-1" level="project" />
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.10" level="project" /> <orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.10" level="project" />
<orderEntry type="library" name="Maven: com.github.TFPatches:TF-LibsDisguises:0cfa32159a" level="project" /> <orderEntry type="library" name="Maven: com.github.TFPatches:TF-LibsDisguises:0cfa32159a" level="project" />
<orderEntry type="library" name="Maven: org.ow2.asm:asm:7.3.1" level="project" /> <orderEntry type="library" name="Maven: org.ow2.asm:asm:7.3.1" level="project" />

View file

@ -6,7 +6,7 @@
<groupId>me.totalfreedom</groupId> <groupId>me.totalfreedom</groupId>
<artifactId>TFGuilds</artifactId> <artifactId>TFGuilds</artifactId>
<version>0.2.3</version> <version>0.2.4</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>TFGuilds</name> <name>TFGuilds</name>

View file

@ -12,8 +12,6 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender; import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -22,9 +20,6 @@ public class CreateSubcommand extends Common implements CommandExecutor
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{ {
List<String> BLACKLISTED_NAMES = Arrays.asList(
"admin", "owner", "moderator", "developer", "console", "dev", "staff", "mod", "sra", "sta", "sa", "super admin", "telnet admin", "senior admin");
if (sender instanceof ConsoleCommandSender) if (sender instanceof ConsoleCommandSender)
{ {
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
@ -65,7 +60,7 @@ public class CreateSubcommand extends Common implements CommandExecutor
return true; return true;
} }
for (String blacklisted : BLACKLISTED_NAMES) for (String blacklisted : GUtil.BLACKLISTED_NAMES_AND_TAGS)
{ {
if (name.equalsIgnoreCase(blacklisted)) if (name.equalsIgnoreCase(blacklisted))
{ {

View file

@ -22,7 +22,7 @@ public class HelpSubcommand extends Common implements CommandExecutor
sender.sendMessage(tl("%s% - %p%kick <guild <player> | player>")); sender.sendMessage(tl("%s% - %p%kick <guild <player> | player>"));
sender.sendMessage(tl("%s% - %p%leave")); sender.sendMessage(tl("%s% - %p%leave"));
sender.sendMessage(tl("%s% - %p%tp <player>")); sender.sendMessage(tl("%s% - %p%tp <player>"));
sender.sendMessage(tl("%s% - %p%info [guild]")); sender.sendMessage(tl("%s% - %p%info [guild | player]"));
sender.sendMessage(tl("%s% - %p%tag <set <tag> | clear>")); sender.sendMessage(tl("%s% - %p%tag <set <tag> | clear>"));
sender.sendMessage(tl("%s% - %p%rename <name>")); sender.sendMessage(tl("%s% - %p%rename <name>"));
sender.sendMessage(tl("%s% - %p%createrank <name>")); sender.sendMessage(tl("%s% - %p%createrank <name>"));

View file

@ -15,9 +15,6 @@ public class ListSubcommand extends Common implements CommandExecutor
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{ {
if (args.length != 1)
return false;
List<String> guilds = Guild.getGuildList(); List<String> guilds = Guild.getGuildList();
if (guilds.isEmpty()) if (guilds.isEmpty())

View file

@ -3,7 +3,7 @@ package me.totalfreedom.tfguilds.command;
import me.totalfreedom.tfguilds.Common; import me.totalfreedom.tfguilds.Common;
import me.totalfreedom.tfguilds.guild.Guild; import me.totalfreedom.tfguilds.guild.Guild;
import me.totalfreedom.tfguilds.util.GUtil; import me.totalfreedom.tfguilds.util.GUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@ -11,8 +11,6 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender; import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -21,8 +19,6 @@ public class RenameSubcommand extends Common implements CommandExecutor
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{ {
List<String> BLACKLISTED_NAMES = Arrays.asList(
"admin", "owner", "moderator", "developer", "console", "dev", "staff", "mod", "sra", "tca", "sta", "sa");
if (args.length < 2) if (args.length < 2)
return false; return false;
if (sender instanceof ConsoleCommandSender) if (sender instanceof ConsoleCommandSender)
@ -60,7 +56,7 @@ public class RenameSubcommand extends Common implements CommandExecutor
return true; return true;
} }
for (String blacklisted : BLACKLISTED_NAMES) for (String blacklisted : GUtil.BLACKLISTED_NAMES_AND_TAGS)
{ {
if (args[0].equalsIgnoreCase(blacklisted)) if (args[0].equalsIgnoreCase(blacklisted))
{ {

View file

@ -21,8 +21,10 @@ public class TagSubcommand extends Common implements CommandExecutor
sender.sendMessage(NO_PERMS); sender.sendMessage(NO_PERMS);
return true; return true;
} }
if (args.length < 2) if (args.length < 2)
return false; return false;
Player player = (Player) sender; Player player = (Player) sender;
Guild guild = Guild.getGuild(player); Guild guild = Guild.getGuild(player);
if (guild == null) if (guild == null)
@ -30,11 +32,13 @@ public class TagSubcommand extends Common implements CommandExecutor
sender.sendMessage(ChatColor.RED + "You aren't in a guild!"); sender.sendMessage(ChatColor.RED + "You aren't in a guild!");
return true; return true;
} }
if (!guild.getOwner().equals(player.getName())) if (!guild.getOwner().equals(player.getName()))
{ {
sender.sendMessage(ChatColor.RED + "You can't modify your guild's tag!"); sender.sendMessage(ChatColor.RED + "You can't modify your guild's tag!");
return true; return true;
} }
if (args.length >= 3) if (args.length >= 3)
{ {
if (args[1].toLowerCase().equals("set")) if (args[1].toLowerCase().equals("set"))
@ -43,6 +47,18 @@ public class TagSubcommand extends Common implements CommandExecutor
tag = tag.replace("%tag%", guild.getName()); tag = tag.replace("%tag%", guild.getName());
for (String blacklisted : GUtil.BLACKLISTED_NAMES_AND_TAGS)
{
if (tag.equalsIgnoreCase(blacklisted))
{
if (!plugin.bridge.isAdmin(player))
{
player.sendMessage(ChatColor.RED + "You may not use that name.");
return true;
}
}
}
guild.setTag(tag); guild.setTag(tag);
guild.save(); guild.save();
sender.sendMessage(tl("%p%Your guild tag has been changed to be \"" + GUtil.colorize(tag) + "%p%\".")); sender.sendMessage(tl("%p%Your guild tag has been changed to be \"" + GUtil.colorize(tag) + "%p%\"."));
@ -50,6 +66,7 @@ public class TagSubcommand extends Common implements CommandExecutor
} }
return false; return false;
} }
if (args[1].toLowerCase().equals("clear")) if (args[1].toLowerCase().equals("clear"))
{ {
guild.setTag(null); guild.setTag(null);

View file

@ -4,7 +4,9 @@ import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -40,4 +42,7 @@ public class GUtil
Date date = new Date(time); Date date = new Date(time);
return STANDARD.format(date); return STANDARD.format(date);
} }
public static List<String> BLACKLISTED_NAMES_AND_TAGS = Arrays.asList(
"admin", "owner", "moderator", "developer", "console", "dev", "staff", "mod", "sra", "sta", "sa", "super admin", "telnet admin", "senior admin");
} }