fixed argument indexing

This commit is contained in:
Super_ 2020-07-14 20:20:25 -04:00
parent 54b31527fc
commit 15bb0adad1
15 changed files with 37 additions and 13 deletions

View file

@ -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))

View file

@ -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);

View file

@ -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))

View file

@ -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);

View file

@ -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);

View file

@ -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))

View file

@ -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)

View file

@ -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())

View file

@ -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);

View file

@ -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))

View file

@ -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);

View file

@ -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))

View file

@ -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);

View file

@ -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;
}
}

View file

@ -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)