mirror of
https://github.com/TotalFreedomMC/TFGuilds.git
synced 2024-12-22 07:55:03 +00:00
fixed argument indexing
This commit is contained in:
parent
54b31527fc
commit
15bb0adad1
15 changed files with 37 additions and 13 deletions
|
@ -16,6 +16,8 @@ public class AddModSubcommand extends Common implements CommandExecutor
|
|||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
||||
{
|
||||
if (args.length == 1 || args.length > 3)
|
||||
return false;
|
||||
if (args.length == 3)
|
||||
{
|
||||
if (!plugin.bridge.isAdmin(sender))
|
||||
|
|
|
@ -31,6 +31,9 @@ public class CreateSubcommand extends Common implements CommandExecutor
|
|||
return true;
|
||||
}
|
||||
|
||||
if (args.length < 2)
|
||||
return false;
|
||||
|
||||
Player player = (Player) sender;
|
||||
String name = StringUtils.join(args, " ", 1, args.length);
|
||||
String identifier = GUtil.flatten(name);
|
||||
|
|
|
@ -17,6 +17,9 @@ public class DisbandSubcommand extends Common implements CommandExecutor
|
|||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
||||
{
|
||||
if (args.length > 2)
|
||||
return false;
|
||||
|
||||
if (args.length == 2)
|
||||
{
|
||||
if (!plugin.bridge.isAdmin(sender))
|
||||
|
|
|
@ -16,6 +16,8 @@ public class HomeSubcommand extends Common implements CommandExecutor
|
|||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
||||
{
|
||||
if (args.length > 2)
|
||||
return false;
|
||||
if (sender instanceof ConsoleCommandSender)
|
||||
{
|
||||
sender.sendMessage(NO_PERMS);
|
||||
|
|
|
@ -23,7 +23,7 @@ public class InviteSubcommand extends Common implements CommandExecutor
|
|||
sender.sendMessage(NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
if (args.length < 2)
|
||||
if (args.length != 2)
|
||||
return false;
|
||||
Player player = (Player) sender;
|
||||
Guild guild = Guild.getGuild(player);
|
||||
|
|
|
@ -16,6 +16,8 @@ public class KickSubcommand extends Common implements CommandExecutor
|
|||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
||||
{
|
||||
if (args.length > 3)
|
||||
return false;
|
||||
if (args.length == 3)
|
||||
{
|
||||
if (!plugin.bridge.isAdmin(sender))
|
||||
|
|
|
@ -14,13 +14,13 @@ public class LeaveSubcommand extends Common implements CommandExecutor
|
|||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
||||
{
|
||||
if (args.length > 1)
|
||||
return false;
|
||||
if (sender instanceof ConsoleCommandSender)
|
||||
{
|
||||
sender.sendMessage(NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
if (args.length > 1)
|
||||
return false;
|
||||
Player player = (Player) sender;
|
||||
Guild guild = Guild.getGuild(player);
|
||||
if (guild == null)
|
||||
|
|
|
@ -15,6 +15,9 @@ public class ListSubcommand extends Common implements CommandExecutor
|
|||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
||||
{
|
||||
if (args.length != 1)
|
||||
return false;
|
||||
|
||||
List<String> guilds = Guild.getGuildList();
|
||||
|
||||
if (guilds.isEmpty())
|
||||
|
|
|
@ -18,6 +18,8 @@ public class MOTDSubcommand extends Common implements CommandExecutor
|
|||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
||||
{
|
||||
if (args.length == 1)
|
||||
return false;
|
||||
if (sender instanceof ConsoleCommandSender)
|
||||
{
|
||||
sender.sendMessage(NO_PERMS);
|
||||
|
|
|
@ -16,6 +16,8 @@ public class RemoveModSubcommand extends Common implements CommandExecutor
|
|||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
||||
{
|
||||
if (args.length == 1 || args.length > 3)
|
||||
return false;
|
||||
if (args.length == 3)
|
||||
{
|
||||
if (!plugin.bridge.isAdmin(sender))
|
||||
|
|
|
@ -23,7 +23,8 @@ public class RenameSubcommand extends Common implements CommandExecutor
|
|||
{
|
||||
List<String> BLACKLISTED_NAMES = Arrays.asList(
|
||||
"admin", "owner", "moderator", "developer", "console", "dev", "staff", "mod", "sra", "tca", "sta", "sa");
|
||||
|
||||
if (args.length < 2)
|
||||
return false;
|
||||
if (sender instanceof ConsoleCommandSender)
|
||||
{
|
||||
sender.sendMessage(NO_PERMS);
|
||||
|
|
|
@ -16,6 +16,8 @@ public class SetOwnerSubcommand extends Common implements CommandExecutor
|
|||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
||||
{
|
||||
if (args.length == 1 || args.length > 3)
|
||||
return false;
|
||||
if (args.length == 3)
|
||||
{
|
||||
if (!plugin.bridge.isAdmin(sender))
|
||||
|
|
|
@ -17,6 +17,8 @@ public class SetRankSubcommand extends Common implements CommandExecutor
|
|||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
||||
{
|
||||
if (args.length == 1)
|
||||
return false;
|
||||
if (sender instanceof ConsoleCommandSender)
|
||||
{
|
||||
sender.sendMessage(NO_PERMS);
|
||||
|
|
|
@ -11,14 +11,8 @@ public class TFGuildsCommand extends Common implements CommandExecutor
|
|||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
sender.sendMessage(tl("%p%TFGuilds %s%is a plugin which allows for players to make their own guilds, providing guild chat, guild teleportation, and more."));
|
||||
sender.sendMessage(tl("%s%Version %p%v" + plugin.getDescription().getVersion()));
|
||||
sender.sendMessage(tl("%s%Developed by %p%speednt & supernt"));
|
||||
sender.sendMessage(tl("%s%https://github.com/TFPatches/TFGuilds"));
|
||||
return true;
|
||||
}
|
||||
if (args.length > 1)
|
||||
return false;
|
||||
|
||||
if (args[0].toLowerCase().equals("reload"))
|
||||
{
|
||||
|
@ -41,6 +35,10 @@ public class TFGuildsCommand extends Common implements CommandExecutor
|
|||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
sender.sendMessage(tl("%p%TFGuilds %s%is a plugin which allows for players to make their own guilds, providing guild chat, guild teleportation, and more."));
|
||||
sender.sendMessage(tl("%s%Version %p%v" + plugin.getDescription().getVersion()));
|
||||
sender.sendMessage(tl("%s%Developed by %p%speednt & supernt"));
|
||||
sender.sendMessage(tl("%s%https://github.com/TFPatches/TFGuilds"));
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -21,6 +21,8 @@ public class TagSubcommand extends Common implements CommandExecutor
|
|||
sender.sendMessage(NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
if (args.length < 2)
|
||||
return false;
|
||||
Player player = (Player) sender;
|
||||
Guild guild = Guild.getGuild(player);
|
||||
if (guild == null)
|
||||
|
|
Loading…
Reference in a new issue