Adding throw to prevent double charge.

This commit is contained in:
KHobbits 2011-08-30 03:42:31 +01:00
parent e9a14b204f
commit afb951461c
4 changed files with 11 additions and 10 deletions

View file

@ -33,7 +33,7 @@ public class Commandtp extends EssentialsCommand
Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user);
user.getTeleport().teleport(p, charge);
break;
throw new NoChargeException();
case 2:
if (!user.isAuthorized("essentials.tpohere"))
@ -46,7 +46,7 @@ public class Commandtp extends EssentialsCommand
target.getTeleport().now(toPlayer, false);
target.sendMessage(Util.format("teleportAtoB", user.getDisplayName(), toPlayer.getDisplayName()));
break;
}
}
}
@Override
@ -62,5 +62,6 @@ public class Commandtp extends EssentialsCommand
User toPlayer = getPlayer(server, args, 1);
target.getTeleport().now(toPlayer, false);
target.sendMessage(Util.format("teleportAtoB", Console.NAME, toPlayer.getDisplayName()));
return;
}
}

View file

@ -24,5 +24,6 @@ public class Commandtphere extends EssentialsCommand
p.getTeleport().teleport(user, new Trade(this.getName(), ess));
user.sendMessage(Util.i18n("teleporting"));
p.sendMessage(Util.i18n("teleporting"));
throw new NoChargeException();
}
}

View file

@ -30,5 +30,6 @@ public class Commandtppos extends EssentialsCommand
charge.isAffordableFor(user);
user.sendMessage(Util.i18n("teleporting"));
user.getTeleport().teleport(l, charge);
throw new NoChargeException();
}
}

View file

@ -26,8 +26,7 @@ public class Commandwarp extends EssentialsCommand
{
if (!user.isAuthorized("essentials.warp.list"))
{
user.sendMessage(Util.i18n("warpListPermission"));
return;
throw new Exception(Util.i18n("warpListPermission"));
}
Warps warps = ess.getWarps();
@ -56,7 +55,7 @@ public class Commandwarp extends EssentialsCommand
}
final int warpPage = (page - 1) * WARPS_PER_PAGE;
user.sendMessage(Util.joinList(warpNameList.subList(warpPage, warpPage+Math.min(warpNameList.size() - warpPage, WARPS_PER_PAGE))));
return;
throw new NoChargeException();
}
if (args.length > 0)
{
@ -66,13 +65,13 @@ public class Commandwarp extends EssentialsCommand
otherUser = ess.getUser(server.getPlayer(args[1]));
if (otherUser == null)
{
user.sendMessage(Util.i18n("playerNotFound"));
return;
throw new Exception(Util.i18n("playerNotFound"));
}
warpUser(otherUser, args[0]);
return;
throw new NoChargeException();
}
warpUser(user, args[0]);
throw new NoChargeException();
}
}
@ -87,8 +86,7 @@ public class Commandwarp extends EssentialsCommand
user.getTeleport().warp(name, charge);
return;
}
user.sendMessage(Util.i18n("warpUsePermission"));
return;
throw new Exception(Util.i18n("warpUsePermission"));
}
user.getTeleport().warp(name, charge);
}