Clean up exception types.

This commit is contained in:
KHobbits 2013-06-22 16:33:22 +01:00
parent aa6c6b4d48
commit 52ba151b81
16 changed files with 28 additions and 28 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -30,7 +30,7 @@ public class Commandignore extends EssentialsCommand
}
if (player == null)
{
throw new Exception(_("playerNotFound"));
throw new PlayerNotFoundException();
}
if (user.isIgnoredPlayer(player))
{

View File

@ -45,7 +45,7 @@ public class Commandlightning extends EssentialsCommand
if (args[0].trim().length() < 2)
{
throw new Exception(_("playerNotFound"));
throw new PlayerNotFoundException();
}
final List<Player> matchedPlayers = server.matchPlayer(args[0]);

View File

@ -87,7 +87,7 @@ public class Commandmsg extends EssentialsCommand
if (!foundUser)
{
throw new Exception(_("playerNotFound"));
throw new PlayerNotFoundException();
}
}
}

View File

@ -49,7 +49,7 @@ public class Commandpay extends EssentialsCommand
if (!foundUser)
{
throw new NotEnoughArgumentsException(_("playerNotFound"));
throw new PlayerNotFoundException();
}
}
}

View File

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

View File

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

View File

@ -43,7 +43,7 @@ public class Commandrealname extends EssentialsCommand
}
if (!foundUser)
{
throw new NoSuchFieldException(_("playerNotFound"));
throw new PlayerNotFoundException();
}
}
}

View File

@ -56,7 +56,7 @@ public class Commandseen extends EssentialsCommand
}
else
{
throw new Exception(_("playerNotFound"));
throw new PlayerNotFoundException();
}
}
seenOffline(server, sender, player, showBan, extra);

View File

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

View File

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

View File

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