mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 12:23:59 +00:00
Adding throw to prevent double charge.
This commit is contained in:
parent
e9a14b204f
commit
afb951461c
4 changed files with 11 additions and 10 deletions
|
@ -33,7 +33,7 @@ public class Commandtp extends EssentialsCommand
|
||||||
Trade charge = new Trade(this.getName(), ess);
|
Trade charge = new Trade(this.getName(), ess);
|
||||||
charge.isAffordableFor(user);
|
charge.isAffordableFor(user);
|
||||||
user.getTeleport().teleport(p, charge);
|
user.getTeleport().teleport(p, charge);
|
||||||
break;
|
throw new NoChargeException();
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
if (!user.isAuthorized("essentials.tpohere"))
|
if (!user.isAuthorized("essentials.tpohere"))
|
||||||
|
@ -62,5 +62,6 @@ public class Commandtp extends EssentialsCommand
|
||||||
User toPlayer = getPlayer(server, args, 1);
|
User toPlayer = getPlayer(server, args, 1);
|
||||||
target.getTeleport().now(toPlayer, false);
|
target.getTeleport().now(toPlayer, false);
|
||||||
target.sendMessage(Util.format("teleportAtoB", Console.NAME, toPlayer.getDisplayName()));
|
target.sendMessage(Util.format("teleportAtoB", Console.NAME, toPlayer.getDisplayName()));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,5 +24,6 @@ public class Commandtphere extends EssentialsCommand
|
||||||
p.getTeleport().teleport(user, new Trade(this.getName(), ess));
|
p.getTeleport().teleport(user, new Trade(this.getName(), ess));
|
||||||
user.sendMessage(Util.i18n("teleporting"));
|
user.sendMessage(Util.i18n("teleporting"));
|
||||||
p.sendMessage(Util.i18n("teleporting"));
|
p.sendMessage(Util.i18n("teleporting"));
|
||||||
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,5 +30,6 @@ public class Commandtppos extends EssentialsCommand
|
||||||
charge.isAffordableFor(user);
|
charge.isAffordableFor(user);
|
||||||
user.sendMessage(Util.i18n("teleporting"));
|
user.sendMessage(Util.i18n("teleporting"));
|
||||||
user.getTeleport().teleport(l, charge);
|
user.getTeleport().teleport(l, charge);
|
||||||
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -26,8 +26,7 @@ public class Commandwarp extends EssentialsCommand
|
||||||
{
|
{
|
||||||
if (!user.isAuthorized("essentials.warp.list"))
|
if (!user.isAuthorized("essentials.warp.list"))
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.i18n("warpListPermission"));
|
throw new Exception(Util.i18n("warpListPermission"));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Warps warps = ess.getWarps();
|
Warps warps = ess.getWarps();
|
||||||
|
@ -56,7 +55,7 @@ public class Commandwarp extends EssentialsCommand
|
||||||
}
|
}
|
||||||
final int warpPage = (page - 1) * WARPS_PER_PAGE;
|
final int warpPage = (page - 1) * WARPS_PER_PAGE;
|
||||||
user.sendMessage(Util.joinList(warpNameList.subList(warpPage, warpPage+Math.min(warpNameList.size() - warpPage, 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)
|
if (args.length > 0)
|
||||||
{
|
{
|
||||||
|
@ -66,13 +65,13 @@ public class Commandwarp extends EssentialsCommand
|
||||||
otherUser = ess.getUser(server.getPlayer(args[1]));
|
otherUser = ess.getUser(server.getPlayer(args[1]));
|
||||||
if (otherUser == null)
|
if (otherUser == null)
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.i18n("playerNotFound"));
|
throw new Exception(Util.i18n("playerNotFound"));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
warpUser(otherUser, args[0]);
|
warpUser(otherUser, args[0]);
|
||||||
return;
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
warpUser(user, args[0]);
|
warpUser(user, args[0]);
|
||||||
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,8 +86,7 @@ public class Commandwarp extends EssentialsCommand
|
||||||
user.getTeleport().warp(name, charge);
|
user.getTeleport().warp(name, charge);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
user.sendMessage(Util.i18n("warpUsePermission"));
|
throw new Exception(Util.i18n("warpUsePermission"));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
user.getTeleport().warp(name, charge);
|
user.getTeleport().warp(name, charge);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue