From 52ba151b81ca60ca70439426a547bc8587d86879 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sat, 22 Jun 2013 16:33:22 +0100 Subject: Clean up exception types. --- Essentials/src/com/earth2me/essentials/commands/Commandexp.java | 8 ++++---- Essentials/src/com/earth2me/essentials/commands/Commandext.java | 4 ++-- Essentials/src/com/earth2me/essentials/commands/Commandfeed.java | 6 +++--- .../src/com/earth2me/essentials/commands/Commandgamemode.java | 4 ++-- Essentials/src/com/earth2me/essentials/commands/Commandheal.java | 4 ++-- .../src/com/earth2me/essentials/commands/Commandignore.java | 2 +- .../src/com/earth2me/essentials/commands/Commandlightning.java | 2 +- Essentials/src/com/earth2me/essentials/commands/Commandmsg.java | 2 +- Essentials/src/com/earth2me/essentials/commands/Commandpay.java | 2 +- Essentials/src/com/earth2me/essentials/commands/Commandptime.java | 2 +- .../src/com/earth2me/essentials/commands/Commandpweather.java | 2 +- .../src/com/earth2me/essentials/commands/Commandrealname.java | 2 +- Essentials/src/com/earth2me/essentials/commands/Commandseen.java | 2 +- .../src/com/earth2me/essentials/commands/Commandsethome.java | 2 +- Essentials/src/com/earth2me/essentials/commands/Commandspeed.java | 6 +++--- .../com/earth2me/essentials/commands/EssentialsToggleCommand.java | 6 +++--- 16 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java index 7013d7db9..b4535414e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java @@ -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 foundUser = false; @@ -132,11 +132,11 @@ public class Commandexp extends EssentialsCommand } 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 foundUser = false; @@ -153,7 +153,7 @@ public class Commandexp extends EssentialsCommand } if (!foundUser) { - throw new NotEnoughArgumentsException(_("playerNotFound")); + throw new PlayerNotFoundException(); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandext.java b/Essentials/src/com/earth2me/essentials/commands/Commandext.java index 16190f7ee..30601d659 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandext.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandext.java @@ -38,7 +38,7 @@ public class Commandext extends EssentialsCommand if (args[0].trim().length() < 2) { - throw new Exception(_("playerNotFound")); + throw new PlayerNotFoundException(); } extinguishPlayers(server, user, args[0]); @@ -62,7 +62,7 @@ public class Commandext extends EssentialsCommand } if (!foundUser) { - throw new NotEnoughArgumentsException(_("playerNotFound")); + throw new PlayerNotFoundException(); } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java b/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java index 167bfccef..f73e43a25 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java @@ -23,7 +23,7 @@ public class Commandfeed extends EssentialsCommand { if (args[0].trim().length() < 2) { - throw new Exception(_("playerNotFound")); + throw new PlayerNotFoundException(); } if (!user.isAuthorized("essentials.heal.cooldown.bypass")) { @@ -60,7 +60,7 @@ public class Commandfeed extends EssentialsCommand 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 foundUser = false; @@ -84,7 +84,7 @@ public class Commandfeed extends EssentialsCommand } if (!foundUser) { - throw new NotEnoughArgumentsException(_("playerNotFound")); + throw new PlayerNotFoundException(); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java index 9707c8403..96248b196 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java @@ -77,7 +77,7 @@ public class Commandgamemode extends EssentialsCommand 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 if (name.trim().length() < 2 || gameMode == null) @@ -101,7 +101,7 @@ public class Commandgamemode extends EssentialsCommand } if (!foundUser) { - throw new NotEnoughArgumentsException(_("playerNotFound")); + throw new PlayerNotFoundException(); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandheal.java b/Essentials/src/com/earth2me/essentials/commands/Commandheal.java index a3c80b512..7a1ede603 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandheal.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandheal.java @@ -26,7 +26,7 @@ public class Commandheal extends EssentialsCommand { if (args[0].trim().length() < 2) { - throw new Exception(_("playerNotFound")); + throw new PlayerNotFoundException(); } if (!user.isAuthorized("essentials.heal.cooldown.bypass")) { @@ -79,7 +79,7 @@ public class Commandheal extends EssentialsCommand } if (!foundUser) { - throw new NotEnoughArgumentsException(_("playerNotFound")); + throw new PlayerNotFoundException(); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandignore.java b/Essentials/src/com/earth2me/essentials/commands/Commandignore.java index 090903c96..b83d89066 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandignore.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandignore.java @@ -30,7 +30,7 @@ public class Commandignore extends EssentialsCommand } if (player == null) { - throw new Exception(_("playerNotFound")); + throw new PlayerNotFoundException(); } if (user.isIgnoredPlayer(player)) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java b/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java index ff22051e7..50d764652 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java @@ -45,7 +45,7 @@ public class Commandlightning extends EssentialsCommand if (args[0].trim().length() < 2) { - throw new Exception(_("playerNotFound")); + throw new PlayerNotFoundException(); } final List matchedPlayers = server.matchPlayer(args[0]); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java index 5488dcbfb..b6a1c641f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java @@ -87,7 +87,7 @@ public class Commandmsg extends EssentialsCommand if (!foundUser) { - throw new Exception(_("playerNotFound")); + throw new PlayerNotFoundException(); } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpay.java b/Essentials/src/com/earth2me/essentials/commands/Commandpay.java index ae56b3cea..859d34c0d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpay.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpay.java @@ -49,7 +49,7 @@ public class Commandpay extends EssentialsCommand if (!foundUser) { - throw new NotEnoughArgumentsException(_("playerNotFound")); + throw new PlayerNotFoundException(); } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandptime.java b/Essentials/src/com/earth2me/essentials/commands/Commandptime.java index 44e9bbc64..a0c0deb8c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandptime.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandptime.java @@ -225,7 +225,7 @@ public class Commandptime extends EssentialsCommand // We failed to understand the world target... else { - throw new Exception(_("playerNotFound")); + throw new PlayerNotFoundException(); } return users; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpweather.java b/Essentials/src/com/earth2me/essentials/commands/Commandpweather.java index be5fa114a..c410bcdfa 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpweather.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpweather.java @@ -175,7 +175,7 @@ public class Commandpweather extends EssentialsCommand // We failed to understand the world target... else { - throw new Exception(_("playerNotFound")); + throw new PlayerNotFoundException(); } return users; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java index 9eb91730e..cadc0e652 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java @@ -43,7 +43,7 @@ public class Commandrealname extends EssentialsCommand } if (!foundUser) { - throw new NoSuchFieldException(_("playerNotFound")); + throw new PlayerNotFoundException(); } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java index 655886e83..9e7d2df01 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java @@ -56,7 +56,7 @@ public class Commandseen extends EssentialsCommand } else { - throw new Exception(_("playerNotFound")); + throw new PlayerNotFoundException(); } } seenOffline(server, sender, player, showBan, extra); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java index 390ab6507..e9907b515 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java @@ -42,7 +42,7 @@ public class Commandsethome extends EssentialsCommand usersHome = ess.getUser(args[0]); if (usersHome == null) { - throw new NoSuchFieldException(_("playerNotFound")); + throw new PlayerNotFoundException(); } name = args[1].toLowerCase(Locale.ENGLISH); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java b/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java index a13ba60c1..700e7eab7 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java @@ -51,7 +51,7 @@ public class Commandspeed extends EssentialsCommand { if (args[2].trim().length() < 2) { - throw new Exception(_("playerNotFound")); + throw new PlayerNotFoundException(); } speedOtherPlayers(server, user, isFly, isBypass, speed, args[2]); 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 foundUser = false; @@ -96,7 +96,7 @@ public class Commandspeed extends EssentialsCommand } if (!foundUser) { - throw new NotEnoughArgumentsException(_("playerNotFound")); + throw new PlayerNotFoundException(); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/EssentialsToggleCommand.java b/Essentials/src/com/earth2me/essentials/commands/EssentialsToggleCommand.java index 022bc2fcc..9fe317b21 100644 --- a/Essentials/src/com/earth2me/essentials/commands/EssentialsToggleCommand.java +++ b/Essentials/src/com/earth2me/essentials/commands/EssentialsToggleCommand.java @@ -31,11 +31,11 @@ public abstract class EssentialsToggleCommand extends EssentialsCommand 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) { - throw new NotEnoughArgumentsException(_("playerNotFound")); + throw new PlayerNotFoundException(); } boolean skipHidden = sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.vanish.interact"); @@ -68,7 +68,7 @@ public abstract class EssentialsToggleCommand extends EssentialsCommand } if (!foundUser) { - throw new NotEnoughArgumentsException(_("playerNotFound")); + throw new PlayerNotFoundException(); } } -- cgit v1.2.3