sender.sendMessage("Looks like you forgot or added an extra parameter.");
sender.sendMessage("Please try again, or see our Wiki for help!");
return;
}
String portalName = extractPortalName(args);
MVPortal selectedPortal = null;
// If they provided -p PORTALNAME, try to retrieve it
if (portalName != null) {
selectedPortal = this.plugin.getPortalManager().getPortal(portalName);
if (selectedPortal == null) {
sender.sendMessage("Sorry, the portal " + ChatColor.RED + portalName + ChatColor.WHITE + " did not exist!");
return;
}
}
// If they didn't provide -p, then try to use their selected portal
if (selectedPortal == null) {
selectedPortal = this.getUserSelectedPortal(player);
}
if (selectedPortal == null) {
sender.sendMessage("You need to select a portal using " + ChatColor.AQUA + "/mvp select {NAME}");
sender.sendMessage("or append " + ChatColor.DARK_AQUA + "-p {PORTAL}" + ChatColor.WHITE + " to this command.");
return;
} else {
portalName = selectedPortal.getName();
}
if (portalName != null) {
// Simply chop off the rest, if they have loc, that's good enough!
if (SetProperties.valueOf(args.get(0)) == SetProperties.loc || SetProperties.valueOf(args.get(0)) == SetProperties.location) {
this.setLocation(selectedPortal, player);
return;
}
if (SetProperties.valueOf(args.get(0)) == SetProperties.dest || SetProperties.valueOf(args.get(0)) == SetProperties.destination) {
if (args.get(1).equalsIgnoreCase("here")) {
PortalPlayerSession ps = this.plugin.getPortalSession(player);
MVPortal standingIn = ps.getUncachedStandingInPortal();
Location l = player.getLocation();
if (standingIn != null) {
String cardinal = LocationManipulation.getDirection(l);
args.set(1, "p:" + standingIn.getName() + ":" + cardinal);
} else {
args.set(1, "e:" + l.getWorld().getName() + ":" + l.getX() + "," + l.getY() + "," + l.getZ() + ":" + l.getPitch() + ":" + l.getYaw());
}
} else if (args.get(1).matches("(i?)cannon-[\\d]+(\\.[\\d]+)?")) {
// We found a Cannon Destination!