mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-03-13 15:20:14 +01:00
Fix regression with teleportation commands where command cost gets charged twice (#3601)
This commit is contained in:
parent
bc52ca856e
commit
73d2457fea
@ -64,7 +64,7 @@ public class Commandhome extends EssentialsCommand {
|
|||||||
showError(user.getBase(), new Exception(tl("bedMissing")), commandLabel);
|
showError(user.getBase(), new Exception(tl("bedMissing")), commandLabel);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return;
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
goHome(user, player, homeName.toLowerCase(Locale.ENGLISH), charge, getNewExceptionFuture(user.getSource(), commandLabel));
|
goHome(user, player, homeName.toLowerCase(Locale.ENGLISH), charge, getNewExceptionFuture(user.getSource(), commandLabel));
|
||||||
} catch (NotEnoughArgumentsException e) {
|
} catch (NotEnoughArgumentsException e) {
|
||||||
@ -108,6 +108,7 @@ public class Commandhome extends EssentialsCommand {
|
|||||||
}
|
}
|
||||||
PaperLib.getBedSpawnLocationAsync(player.getBase(), true).thenAccept(message::complete);
|
PaperLib.getBedSpawnLocationAsync(player.getBase(), true).thenAccept(message::complete);
|
||||||
}
|
}
|
||||||
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getHomeLimit(final User player) {
|
private String getHomeLimit(final User player) {
|
||||||
|
@ -47,6 +47,8 @@ public class Commandjump extends EssentialsCommand {
|
|||||||
final Trade charge = new Trade(this.getName(), ess);
|
final Trade charge = new Trade(this.getName(), ess);
|
||||||
charge.isAffordableFor(user);
|
charge.isAffordableFor(user);
|
||||||
user.getAsyncTeleport().teleport(loc, charge, TeleportCause.COMMAND, getNewExceptionFuture(user.getSource(), commandLabel));
|
user.getAsyncTeleport().teleport(loc, charge, TeleportCause.COMMAND, getNewExceptionFuture(user.getSource(), commandLabel));
|
||||||
|
|
||||||
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -44,7 +44,7 @@ public class Commandtp extends EssentialsCommand {
|
|||||||
final Trade charge = new Trade(this.getName(), ess);
|
final Trade charge = new Trade(this.getName(), ess);
|
||||||
charge.isAffordableFor(user);
|
charge.isAffordableFor(user);
|
||||||
user.getAsyncTeleport().teleport(player.getBase(), charge, TeleportCause.COMMAND, future);
|
user.getAsyncTeleport().teleport(player.getBase(), charge, TeleportCause.COMMAND, future);
|
||||||
break;
|
throw new NoChargeException();
|
||||||
case 3:
|
case 3:
|
||||||
if (!user.isAuthorized("essentials.tp.position")) {
|
if (!user.isAuthorized("essentials.tp.position")) {
|
||||||
throw new Exception(tl("noPerm", "essentials.tp.position"));
|
throw new Exception(tl("noPerm", "essentials.tp.position"));
|
||||||
|
@ -72,6 +72,7 @@ public class Commandtpaccept extends EssentialsCommand {
|
|||||||
teleport.teleport(user.getBase(), charge, TeleportCause.COMMAND, future);
|
teleport.teleport(user.getBase(), charge, TeleportCause.COMMAND, future);
|
||||||
}
|
}
|
||||||
user.requestTeleport(null, false);
|
user.requestTeleport(null, false);
|
||||||
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ public class Commandtphere extends EssentialsCommand {
|
|||||||
throw new Exception(tl("noPerm", "essentials.worlds." + user.getWorld().getName()));
|
throw new Exception(tl("noPerm", "essentials.worlds." + user.getWorld().getName()));
|
||||||
}
|
}
|
||||||
user.getAsyncTeleport().teleportPlayer(player, user.getBase(), new Trade(this.getName(), ess), TeleportCause.COMMAND, getNewExceptionFuture(user.getSource(), commandLabel));
|
user.getAsyncTeleport().teleportPlayer(player, user.getBase(), new Trade(this.getName(), ess), TeleportCause.COMMAND, getNewExceptionFuture(user.getSource(), commandLabel));
|
||||||
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -56,6 +56,8 @@ public class Commandtppos extends EssentialsCommand {
|
|||||||
charge.isAffordableFor(user);
|
charge.isAffordableFor(user);
|
||||||
user.sendMessage(tl("teleporting", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
|
user.sendMessage(tl("teleporting", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
|
||||||
user.getAsyncTeleport().teleport(loc, charge, TeleportCause.COMMAND, getNewExceptionFuture(user.getSource(), commandLabel));
|
user.getAsyncTeleport().teleport(loc, charge, TeleportCause.COMMAND, getNewExceptionFuture(user.getSource(), commandLabel));
|
||||||
|
|
||||||
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -39,6 +39,7 @@ public class Commandtpr extends EssentialsCommand {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,9 +42,10 @@ public class Commandwarp extends EssentialsCommand {
|
|||||||
if (args.length == 2 && (user.isAuthorized("essentials.warp.otherplayers") || user.isAuthorized("essentials.warp.others"))) {
|
if (args.length == 2 && (user.isAuthorized("essentials.warp.otherplayers") || user.isAuthorized("essentials.warp.others"))) {
|
||||||
otherUser = getPlayer(server, user, args, 1);
|
otherUser = getPlayer(server, user, args, 1);
|
||||||
warpUser(user, otherUser, args[0], commandLabel);
|
warpUser(user, otherUser, args[0], commandLabel);
|
||||||
return;
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
warpUser(user, user, args[0], commandLabel);
|
warpUser(user, user, args[0], commandLabel);
|
||||||
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,6 +57,7 @@ public class Commandwarp extends EssentialsCommand {
|
|||||||
}
|
}
|
||||||
User otherUser = getPlayer(server, args, 1, true, false);
|
User otherUser = getPlayer(server, args, 1, true, false);
|
||||||
otherUser.getAsyncTeleport().warp(otherUser, args[0], null, TeleportCause.COMMAND, getNewExceptionFuture(sender, commandLabel));
|
otherUser.getAsyncTeleport().warp(otherUser, args[0], null, TeleportCause.COMMAND, getNewExceptionFuture(sender, commandLabel));
|
||||||
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Use one of the new text classes, like /help ?
|
//TODO: Use one of the new text classes, like /help ?
|
||||||
|
@ -67,6 +67,8 @@ public class Commandworld extends EssentialsCommand {
|
|||||||
final Trade charge = new Trade(this.getName(), ess);
|
final Trade charge = new Trade(this.getName(), ess);
|
||||||
charge.isAffordableFor(user);
|
charge.isAffordableFor(user);
|
||||||
user.getAsyncTeleport().teleport(target, charge, TeleportCause.COMMAND, getNewExceptionFuture(user.getSource(), commandLabel));
|
user.getAsyncTeleport().teleport(target, charge, TeleportCause.COMMAND, getNewExceptionFuture(user.getSource(), commandLabel));
|
||||||
|
|
||||||
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -5,6 +5,7 @@ import com.earth2me.essentials.Console;
|
|||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.commands.EssentialsCommand;
|
import com.earth2me.essentials.commands.EssentialsCommand;
|
||||||
|
import com.earth2me.essentials.commands.NoChargeException;
|
||||||
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
|
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@ -40,6 +41,8 @@ public class Commandspawn extends EssentialsCommand {
|
|||||||
} else {
|
} else {
|
||||||
respawn(user.getSource(), user, user, charge, commandLabel, new CompletableFuture<>());
|
respawn(user.getSource(), user, user, charge, commandLabel, new CompletableFuture<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user