Hello! I have a few variables of the WE Selection class stored in my plugin. But i would like to use them after the plugin has closed/restarted. It would therefor require me to save the Selection vars to a YAML file, and then load them in again in the onEnable. I've tried for hours and i can't figure it out. Code (Text): private Selection sboss; private Selection s1; private Selection s2; private Selection s3; private Selection s4; I hope you guys will be able to help me. Thanks!
This works, and then how do i get it? I can't do getConfig().getString() or something, because it isn't a string.
Perhaps something along the lines of Code (Text): WorldEditPlugin worldEdit = (WorldEditPlugin) Bukkit.getServer().getPluginManager().getPlugin("WorldEdit"); Selection selection = worldEditPlugin.getSelection(getConfig().get("path"));
I actually changed the type, i now need just a Location, not a Selection. How would i do this?? I need org.bukkit.Location, but getConfig().get("path") returns java.lang.Object
Im not sure how you saved it... if you save a location you only need to save the World name, x y and z values. Possibly pitch and yaw as well. Once you do that you can load it with Code (Text): Location location = new Location(worldName, X, Y, Z);
I saved it like this: Code (Text): s2 = getWorldEdit().getSelection(p); Location min = s2.getMinimumPoint(); Location max = s2.getMaximumPoint(); total2 = min.add(max).multiply(0.5).add(0, 10, 0); getConfig().set("2", total2); saveConfig();
Yes correct. I just saved it using getConfig.set("1", total2) But i need to know how to load it back in after restart
Well in that case, you can save the world name etc... like I previously mentioned. Location#getWorld#getName Location#getBlockX etc... however, if you want to have it saved like that, then try Code (Text): Location location = getConfig().get("2");
My apologies, cast it... You should learn Java, seriously you would benefit and not have to ask such basic questions. Code (Text): Location location = (Location) getConfig().get("2"); Sent from my iPhone using Tapatalk