mirror of
https://github.com/TotalFreedomMC/TFGuilds.git
synced 2024-12-22 16:05:00 +00:00
allow staff to toggle personal player tags
change a few naming limits too since they were way too high
This commit is contained in:
parent
49e8ae387c
commit
f4ba215e6c
7 changed files with 65 additions and 5 deletions
|
@ -56,6 +56,12 @@ public class CreateRankSubcommand extends Common implements CommandExecutor
|
|||
}
|
||||
}
|
||||
|
||||
if (rank.length() > 15)
|
||||
{
|
||||
sender.sendMessage(ChatColor.RED + "Guild rank names may not be over 15 characters.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (guild.hasRank(rank))
|
||||
{
|
||||
sender.sendMessage(ChatColor.RED + "A rank of that name already exists in the guild!");
|
||||
|
|
|
@ -51,9 +51,9 @@ public class CreateSubcommand extends Common implements CommandExecutor
|
|||
return true;
|
||||
}
|
||||
|
||||
if (name.length() > 64)
|
||||
if (name.length() > 30)
|
||||
{
|
||||
sender.sendMessage(ChatColor.RED + "Your guild name may not be over 64 characters.");
|
||||
sender.sendMessage(ChatColor.RED + "Your guild name may not be over 30 characters.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,6 +107,16 @@ public class GuildCommand extends Common implements CommandExecutor, TabComplete
|
|||
return Guild.getGuildList();
|
||||
}
|
||||
|
||||
case "toggletag":
|
||||
{
|
||||
if (!plugin.bridge.isAdmin(sender))
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return GUtil.getPlayerList();
|
||||
}
|
||||
|
||||
case "motd":
|
||||
case "tag":
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ public class HelpSubcommand extends Common implements CommandExecutor
|
|||
sender.sendMessage(tl("%s% - %p%setstate <open | invite | closed>"));
|
||||
sender.sendMessage(tl("%s% - %p%setdefaultrank <rank | none>"));
|
||||
sender.sendMessage(tl("%s% - %p%toggletags"));
|
||||
sender.sendMessage(tl("%s% - %p%toggletag"));
|
||||
sender.sendMessage(tl("%s% - %p%toggletag [player]"));
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -56,6 +56,12 @@ public class RenameSubcommand extends Common implements CommandExecutor
|
|||
return true;
|
||||
}
|
||||
|
||||
if (identifier.length() > 30)
|
||||
{
|
||||
sender.sendMessage(ChatColor.RED + "Your new guild name may not be over 30 characters.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Guild.guildExists(identifier))
|
||||
{
|
||||
sender.sendMessage(ChatColor.RED + "A guild with a name similar to yours already exists!");
|
||||
|
|
|
@ -50,9 +50,9 @@ public class TagSubcommand extends Common implements CommandExecutor
|
|||
|
||||
tag = tag.replace("%tag%", guild.getName());
|
||||
|
||||
if (tag.length() > 75)
|
||||
if (tag.length() > 30)
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "Your guild tag must not be over 75 characters.");
|
||||
player.sendMessage(ChatColor.RED + "Your guild tag must not be over 30 characters.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@ package me.totalfreedom.tfguilds.command;
|
|||
|
||||
import me.totalfreedom.tfguilds.Common;
|
||||
import me.totalfreedom.tfguilds.guild.Guild;
|
||||
import me.totalfreedom.tfguilds.util.GUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
|
@ -14,6 +16,42 @@ public class ToggleTagSubcommand extends Common implements CommandExecutor
|
|||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
||||
{
|
||||
if (args.length > 2)
|
||||
{
|
||||
sender.sendMessage(tl(PREFIX + "Proper usage: /g toggletag [player]"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length == 2)
|
||||
{
|
||||
if (!plugin.bridge.isAdmin(sender))
|
||||
{
|
||||
sender.sendMessage(NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = Bukkit.getPlayer(args[1]);
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(PNF);
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean enabled = plugin.players.getBoolean(player.getName() + ".tag");
|
||||
if (!plugin.players.contains(player.getName()) || enabled)
|
||||
{
|
||||
plugin.players.set(player.getName() + ".tag", false);
|
||||
plugin.players.save();
|
||||
sender.sendMessage(tl(PREFIX + "Disabled personal guild tag for " + player.getName() + "."));
|
||||
return true;
|
||||
}
|
||||
|
||||
plugin.players.set(player.getName() + ".tag", true);
|
||||
plugin.players.save();
|
||||
sender.sendMessage(tl(PREFIX + "Enabled personal guild tag for " + player.getName() + "."));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sender instanceof ConsoleCommandSender)
|
||||
{
|
||||
sender.sendMessage(NO_PERMS);
|
||||
|
|
Loading…
Reference in a new issue