summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2011-08-30 03:42:31 +0100
committerKHobbits <rob@khobbits.co.uk>2011-08-30 03:42:31 +0100
commitafb951461c6458546f6398a0d993b6415d2ff149 (patch)
tree1667a69fbae9bb7c0f3ca4625aae17e467b8bfa4
parente9a14b204f1e7991d3b990c7f120ee2b02880fb1 (diff)
downloadEssentials-afb951461c6458546f6398a0d993b6415d2ff149.tar
Essentials-afb951461c6458546f6398a0d993b6415d2ff149.tar.gz
Essentials-afb951461c6458546f6398a0d993b6415d2ff149.tar.lz
Essentials-afb951461c6458546f6398a0d993b6415d2ff149.tar.xz
Essentials-afb951461c6458546f6398a0d993b6415d2ff149.zip
Adding throw to prevent double charge.
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtp.java5
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtphere.java1
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtppos.java1
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandwarp.java14
4 files changed, 11 insertions, 10 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
index c3cc8f7e5..480fb6153 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
@@ -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;
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java
index 036c4be27..bba8d8743 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java
@@ -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();
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java
index 805aefaca..0786f9cb9 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java
@@ -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();
}
} \ No newline at end of file
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java
index b93355f5a..36d1d0df0 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java
@@ -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);
}