From 49e3a425505a390fa533bb95e78a1c935e6ffe55 Mon Sep 17 00:00:00 2001 From: Eric Stokes Date: Wed, 17 Aug 2011 16:49:24 -0600 Subject: [PATCH] Give an easy way of using cannons without portals Behold: /mvtp cannon-2 --- .../MultiverseCore/commands/TeleportCommand.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/TeleportCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/TeleportCommand.java index 75831f41..0c1d14dd 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/TeleportCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/TeleportCommand.java @@ -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) {