mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-18 08:35:44 +01:00
Clean up exception types.
This commit is contained in:
parent
aa6c6b4d48
commit
52ba151b81
@ -115,7 +115,7 @@ public class Commandexp extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showMatch(final Server server, final CommandSender sender, final String match) throws NotEnoughArgumentsException
|
private void showMatch(final Server server, final CommandSender sender, final String match) throws PlayerNotFoundException
|
||||||
{
|
{
|
||||||
boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact");
|
boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact");
|
||||||
boolean foundUser = false;
|
boolean foundUser = false;
|
||||||
@ -132,11 +132,11 @@ public class Commandexp extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
if (!foundUser)
|
if (!foundUser)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException(_("playerNotFound"));
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void expMatch(final Server server, final CommandSender sender, final String match, String amount, final boolean give) throws NotEnoughArgumentsException
|
private void expMatch(final Server server, final CommandSender sender, final String match, String amount, final boolean give) throws NotEnoughArgumentsException, PlayerNotFoundException
|
||||||
{
|
{
|
||||||
boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact");
|
boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact");
|
||||||
boolean foundUser = false;
|
boolean foundUser = false;
|
||||||
@ -153,7 +153,7 @@ public class Commandexp extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
if (!foundUser)
|
if (!foundUser)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException(_("playerNotFound"));
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public class Commandext extends EssentialsCommand
|
|||||||
|
|
||||||
if (args[0].trim().length() < 2)
|
if (args[0].trim().length() < 2)
|
||||||
{
|
{
|
||||||
throw new Exception(_("playerNotFound"));
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
extinguishPlayers(server, user, args[0]);
|
extinguishPlayers(server, user, args[0]);
|
||||||
@ -62,7 +62,7 @@ public class Commandext extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
if (!foundUser)
|
if (!foundUser)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException(_("playerNotFound"));
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ public class Commandfeed extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
if (args[0].trim().length() < 2)
|
if (args[0].trim().length() < 2)
|
||||||
{
|
{
|
||||||
throw new Exception(_("playerNotFound"));
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
if (!user.isAuthorized("essentials.heal.cooldown.bypass"))
|
if (!user.isAuthorized("essentials.heal.cooldown.bypass"))
|
||||||
{
|
{
|
||||||
@ -60,7 +60,7 @@ public class Commandfeed extends EssentialsCommand
|
|||||||
feedOtherPlayers(server, sender, args[0]);
|
feedOtherPlayers(server, sender, args[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void feedOtherPlayers(final Server server, final CommandSender sender, final String name) throws NotEnoughArgumentsException
|
private void feedOtherPlayers(final Server server, final CommandSender sender, final String name) throws PlayerNotFoundException
|
||||||
{
|
{
|
||||||
boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact");
|
boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact");
|
||||||
boolean foundUser = false;
|
boolean foundUser = false;
|
||||||
@ -84,7 +84,7 @@ public class Commandfeed extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
if (!foundUser)
|
if (!foundUser)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException(_("playerNotFound"));
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ public class Commandgamemode extends EssentialsCommand
|
|||||||
user.sendMessage(_("gameMode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName()));
|
user.sendMessage(_("gameMode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void gamemodeOtherPlayers(final Server server, final CommandSender sender, final GameMode gameMode, final String name) throws NotEnoughArgumentsException
|
private void gamemodeOtherPlayers(final Server server, final CommandSender sender, final GameMode gameMode, final String name) throws NotEnoughArgumentsException, PlayerNotFoundException
|
||||||
{
|
{
|
||||||
//TODO: TL this
|
//TODO: TL this
|
||||||
if (name.trim().length() < 2 || gameMode == null)
|
if (name.trim().length() < 2 || gameMode == null)
|
||||||
@ -101,7 +101,7 @@ public class Commandgamemode extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
if (!foundUser)
|
if (!foundUser)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException(_("playerNotFound"));
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ public class Commandheal extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
if (args[0].trim().length() < 2)
|
if (args[0].trim().length() < 2)
|
||||||
{
|
{
|
||||||
throw new Exception(_("playerNotFound"));
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
if (!user.isAuthorized("essentials.heal.cooldown.bypass"))
|
if (!user.isAuthorized("essentials.heal.cooldown.bypass"))
|
||||||
{
|
{
|
||||||
@ -79,7 +79,7 @@ public class Commandheal extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
if (!foundUser)
|
if (!foundUser)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException(_("playerNotFound"));
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ public class Commandignore extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
throw new Exception(_("playerNotFound"));
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
if (user.isIgnoredPlayer(player))
|
if (user.isIgnoredPlayer(player))
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ public class Commandlightning extends EssentialsCommand
|
|||||||
|
|
||||||
if (args[0].trim().length() < 2)
|
if (args[0].trim().length() < 2)
|
||||||
{
|
{
|
||||||
throw new Exception(_("playerNotFound"));
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Player> matchedPlayers = server.matchPlayer(args[0]);
|
final List<Player> matchedPlayers = server.matchPlayer(args[0]);
|
||||||
|
@ -87,7 +87,7 @@ public class Commandmsg extends EssentialsCommand
|
|||||||
|
|
||||||
if (!foundUser)
|
if (!foundUser)
|
||||||
{
|
{
|
||||||
throw new Exception(_("playerNotFound"));
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ public class Commandpay extends EssentialsCommand
|
|||||||
|
|
||||||
if (!foundUser)
|
if (!foundUser)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException(_("playerNotFound"));
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ public class Commandptime extends EssentialsCommand
|
|||||||
// We failed to understand the world target...
|
// We failed to understand the world target...
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception(_("playerNotFound"));
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
return users;
|
return users;
|
||||||
|
@ -175,7 +175,7 @@ public class Commandpweather extends EssentialsCommand
|
|||||||
// We failed to understand the world target...
|
// We failed to understand the world target...
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception(_("playerNotFound"));
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
return users;
|
return users;
|
||||||
|
@ -43,7 +43,7 @@ public class Commandrealname extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
if (!foundUser)
|
if (!foundUser)
|
||||||
{
|
{
|
||||||
throw new NoSuchFieldException(_("playerNotFound"));
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ public class Commandseen extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception(_("playerNotFound"));
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
seenOffline(server, sender, player, showBan, extra);
|
seenOffline(server, sender, player, showBan, extra);
|
||||||
|
@ -42,7 +42,7 @@ public class Commandsethome extends EssentialsCommand
|
|||||||
usersHome = ess.getUser(args[0]);
|
usersHome = ess.getUser(args[0]);
|
||||||
if (usersHome == null)
|
if (usersHome == null)
|
||||||
{
|
{
|
||||||
throw new NoSuchFieldException(_("playerNotFound"));
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
name = args[1].toLowerCase(Locale.ENGLISH);
|
name = args[1].toLowerCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ public class Commandspeed extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
if (args[2].trim().length() < 2)
|
if (args[2].trim().length() < 2)
|
||||||
{
|
{
|
||||||
throw new Exception(_("playerNotFound"));
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
speedOtherPlayers(server, user, isFly, isBypass, speed, args[2]);
|
speedOtherPlayers(server, user, isFly, isBypass, speed, args[2]);
|
||||||
return;
|
return;
|
||||||
@ -70,7 +70,7 @@ public class Commandspeed extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void speedOtherPlayers(final Server server, final CommandSender sender, final boolean isFly, final boolean isBypass, final float speed, final String name) throws NotEnoughArgumentsException
|
private void speedOtherPlayers(final Server server, final CommandSender sender, final boolean isFly, final boolean isBypass, final float speed, final String name) throws PlayerNotFoundException
|
||||||
{
|
{
|
||||||
boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact");
|
boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact");
|
||||||
boolean foundUser = false;
|
boolean foundUser = false;
|
||||||
@ -96,7 +96,7 @@ public class Commandspeed extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
if (!foundUser)
|
if (!foundUser)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException(_("playerNotFound"));
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,11 +31,11 @@ public abstract class EssentialsToggleCommand extends EssentialsCommand
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void toggleOtherPlayers(final Server server, final CommandSender sender, final String[] args) throws NotEnoughArgumentsException
|
protected void toggleOtherPlayers(final Server server, final CommandSender sender, final String[] args) throws PlayerNotFoundException, NotEnoughArgumentsException
|
||||||
{
|
{
|
||||||
if (args.length < 1 || args[0].trim().length() < 2)
|
if (args.length < 1 || args[0].trim().length() < 2)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException(_("playerNotFound"));
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact");
|
boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact");
|
||||||
@ -68,7 +68,7 @@ public abstract class EssentialsToggleCommand extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
if (!foundUser)
|
if (!foundUser)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException(_("playerNotFound"));
|
throw new PlayerNotFoundException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user