Give an easy way of using cannons without portals

Behold: /mvtp cannon-2
This commit is contained in:
Eric Stokes 2011-08-17 16:49:24 -06:00
parent 1ab56096f8
commit 49e3a42550

View File

@ -72,7 +72,17 @@ public class TeleportCommand extends MultiverseCommand {
teleporter = (Player) sender;
teleportee = (Player) sender;
}
// Special case for cannons:
if (destinationName.matches("(?i)cannon-[\\d]+(\\.[\\d]+)?")) {
String[] cannonSpeed = destinationName.split("-");
try {
double speed = Double.parseDouble(cannonSpeed[1]);
destinationName = "ca:" + teleportee.getWorld().getName() + ":" + teleportee.getLocation().getX() + "," + teleportee.getLocation().getY() + "," + teleportee.getLocation().getZ() + ":" + teleportee.getLocation().getPitch() + ":" + teleportee.getLocation().getYaw() + ":" + speed;
} catch (Exception e) {
destinationName = "i:invalid";
}
}
DestinationFactory df = this.plugin.getDestinationFactory();// .parseDestination(worldName, (MultiverseCore) this.plugin);
MVDestination d = df.getDestination(destinationName);
if (d != null && d instanceof InvalidDestination) {