i need help makeing a config.yml i want it so you can change the x y z here is the code i want you to be able to change Code: { case 0: loc = new Location(target.getWorld(), 100, 60, 100); break; case 2: loc = new Location(target.getWorld(), 160, 60, 160); break; case 1: loc = new Location(target.getWorld(), 120, 60, 120); break; } How would i be able to do this or add more to
aidenkrz What Lactem was telling you about is the method to set things in config.yml. The only thing is that Location objects are not configuration serializable. Thus you either need to create a String from the location and save that (which you later retrieve, and parse back into a Location object), or you save the worldname and location.toVector() (as org.bukkit.util.Vector is configuration serializable). In that case you retrieve your Vector object by using getConfig().getVector("some.path"), and get the world name with getConfig().getString("some.path", ""), and call Bukkit.getWorld(thatWorldName) to load the World. Finally you would need to call vectorObject.toLocation(justLoadedWorldObject). While I think the second one is a bit cleaner (less error catching and such), I would recommend the first one for new programmers. Code:java public String locToStr(Location loc){ StringBuilder sb = new StringBuilder(loc.getWorld().getName()); sb.append(",").append(loc.getX()); sb.append(",").append(loc.getY()); sb.append(",").append(loc.getZ); return sb.toString();} Returning this into a Location object would be getting that String from the config, splitting around the ',', using Bukkit.getWorld(name) to get the World object, and parsing the rest to doubles for x, y and z.
How Would i add this into my config.yml Code:java // Notify target.sendMessage(ChatColor.BLUE + "You Have Been Teleported To A Random Spot!"); return true; Bump. Can Some One Plzz Help EDIT by Moderator: merged posts, please use the edit button instead of double posting.