mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-10-05 02:57:27 +02:00
Give an easy way of using cannons without portals
Behold: /mvtp cannon-2
This commit is contained in:
parent
1ab56096f8
commit
49e3a42550
@ -72,7 +72,17 @@ public class TeleportCommand extends MultiverseCommand {
|
|||||||
teleporter = (Player) sender;
|
teleporter = (Player) sender;
|
||||||
teleportee = (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);
|
DestinationFactory df = this.plugin.getDestinationFactory();// .parseDestination(worldName, (MultiverseCore) this.plugin);
|
||||||
MVDestination d = df.getDestination(destinationName);
|
MVDestination d = df.getDestination(destinationName);
|
||||||
if (d != null && d instanceof InvalidDestination) {
|
if (d != null && d instanceof InvalidDestination) {
|
||||||
|
Loading…
Reference in New Issue
Block a user