mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 17:17:37 +00:00
delete commandargumentexception and return usage instead
This commit is contained in:
parent
e328cf29e5
commit
282da7fdbb
@ -178,10 +178,8 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
|
||||
{
|
||||
send(sender, component);
|
||||
}
|
||||
} catch (CommandArgumentException ex)
|
||||
{
|
||||
send(sender, getUsage());
|
||||
} catch (PlayerNotFoundException | CommandFailException
|
||||
}
|
||||
catch (PlayerNotFoundException | CommandFailException
|
||||
| ConsoleOnlyException | ConsoleMustDefinePlayerException
|
||||
| PlayerNotBannedException ex)
|
||||
{
|
||||
|
@ -1,5 +0,0 @@
|
||||
package dev.plex.command.exception;
|
||||
|
||||
public class CommandArgumentException extends RuntimeException
|
||||
{
|
||||
} // lolololol
|
@ -4,7 +4,6 @@ import com.google.common.collect.ImmutableList;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.CommandArgumentException;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import java.util.List;
|
||||
@ -23,7 +22,7 @@ public class DeopCMD extends PlexCommand
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
throw new CommandArgumentException();
|
||||
return usage(getUsage());
|
||||
}
|
||||
Player player = getNonNullPlayer(args[0]);
|
||||
player.setOp(false);
|
||||
|
@ -5,7 +5,6 @@ import dev.plex.cache.PlayerCache;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.CommandArgumentException;
|
||||
import dev.plex.player.PunishedPlayer;
|
||||
import dev.plex.punishment.Punishment;
|
||||
import dev.plex.punishment.PunishmentType;
|
||||
@ -13,11 +12,9 @@ import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.apache.commons.lang.time.DateUtils;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -32,7 +29,7 @@ public class FreezeCMD extends PlexCommand
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
throw new CommandArgumentException();
|
||||
return usage(getUsage());
|
||||
}
|
||||
Player player = getNonNullPlayer(args[0]);
|
||||
PunishedPlayer punishedPlayer = PlayerCache.getPunishedPlayer(player.getUniqueId());
|
||||
|
@ -5,7 +5,6 @@ import com.google.common.collect.Lists;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.CommandArgumentException;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.MojangUtils;
|
||||
import dev.plex.util.PlexLog;
|
||||
@ -36,7 +35,7 @@ public class NameHistoryCMD extends PlexCommand
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
throw new CommandArgumentException();
|
||||
return usage(getUsage());
|
||||
}
|
||||
String username = args[0];
|
||||
|
||||
|
@ -4,7 +4,6 @@ import com.google.common.collect.ImmutableList;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.CommandArgumentException;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import java.util.List;
|
||||
@ -23,7 +22,7 @@ public class OpCMD extends PlexCommand
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
throw new CommandArgumentException();
|
||||
return usage(getUsage());
|
||||
}
|
||||
Player player = getNonNullPlayer(args[0]);
|
||||
player.setOp(true);
|
||||
|
@ -5,7 +5,6 @@ import dev.plex.Plex;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.CommandArgumentException;
|
||||
import dev.plex.command.exception.CommandFailException;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
@ -54,7 +53,7 @@ public class PlexCMD extends PlexCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new CommandArgumentException();
|
||||
return usage(getUsage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -5,18 +5,18 @@ import dev.plex.cache.PlayerCache;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.CommandArgumentException;
|
||||
import dev.plex.command.exception.CommandFailException;
|
||||
import dev.plex.player.PunishedPlayer;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import java.util.List;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = Rank.ADMIN, permission = "plex.unfreeze")
|
||||
@CommandParameters(name = "unfreeze", description = "Unfreeze a player", usage = "/<command> <player>")
|
||||
public class UnfreezeCMD extends PlexCommand
|
||||
@ -26,7 +26,7 @@ public class UnfreezeCMD extends PlexCommand
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
throw new CommandArgumentException();
|
||||
return usage(getUsage());
|
||||
}
|
||||
Player player = getNonNullPlayer(args[0]);
|
||||
PunishedPlayer punishedPlayer = PlayerCache.getPunishedPlayer(player.getUniqueId());
|
||||
|
@ -4,7 +4,6 @@ import com.google.common.collect.ImmutableList;
|
||||
import dev.plex.command.PlexCommand;
|
||||
import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.exception.CommandArgumentException;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import java.util.List;
|
||||
@ -27,7 +26,7 @@ public class WorldCMD extends PlexCommand
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
throw new CommandArgumentException();
|
||||
return usage(getUsage());
|
||||
}
|
||||
World world = getNonNullWorld(args[0]);
|
||||
playerSender.teleportAsync(new Location(world, 0, world.getHighestBlockYAt(0, 0) + 1, 0, 0, 0));
|
||||
|
Loading…
Reference in New Issue
Block a user