@Override public RetVal execute(ArrayList<String> arg, String pName) { Log.debug("CommandEdit.execute"); RetVal r = new RetVal(); arg.remove(0); // Remove 'edit' from the arguments list. if (arg.isEmpty()) { Log.debug("arg is empty."); r.addAll(getFullHelp()); return r; } switch (arg.get(0)) { case "help": r.addAll(getFullHelp()); r.tru(); return r; case "entrance": arg.remove(0); return subEntrance(arg, pName); default: r.addAll(getFullHelp()); r.Err("Couldn't find command '" + arg.get(0) + "'!"); return r; } }
private RetVal subEntrance(ArrayList<String> arg, String pName) { Log.debug("CommandDungeon.subEntrance"); RetVal r = new RetVal(); if (arg.isEmpty()) { r.Err( Config.ecol + "Error - Invalid number of arguments! Command is /" + Config.command + " dungeon entrance <dungeon name> (while standing at the warp-in point)!"); return r; } DungeonData d = DungeonManager.getDungeon(arg.get(0)); if (d == null) { r.Err(Config.ecol + "Error - Invalid argument! '" + arg.get(0) + "' not a valid Dungeon!"); return r; } InstanceData i = InstanceManager.getEditInstanceForDungeon(d.name); if (i == null) { r.Err( Config.ecol + "Error - Invalid argument! '" + arg.get(0) + "' does not have an edit Instance!"); return r; } Location l = bridge.getPlayerLoc(pName); Vector v = l.getPosition(); Vector vOff = v.subtract(i.getBounds().getMinimumPoint()); d.setSpawn(vOff.getBlockX(), vOff.getBlockY(), vOff.getBlockZ(), l.getYaw(), l.getPitch()); r.add("Successfully added spawn in location to Dungeon '" + arg.get(0) + "'"); r.tru(); return r; }