Hi everyone, I am trying to create plugin, that will update Lobby signs, but I don't know how. I googled and tried everything, but it doesn't work. I saved X,Y,Z,World of the sign to the config, but I can't make loop, that will change text on every sign in that list. For example, I want to put text "Test" to last line. But I can't make a loop, that will work. If you want more info, just ask me. Thank you!
@ano95 Get the block at that location, get the state, cast it to Sign (after checking), edit the sign, update the sign.
I know, but I want lopp, that will do it for every registred sign Also, my actual code: Code: public static void updateSigns(Plugin mainplug){ List<String> signs = mainplug.getConfig().getStringList("hubsigns"); for(String sign : signs) { World w = Bukkit.getWorld(mainplug.getConfig().getString("hubsigns."+sign+".world", "world")); if(w == null) continue; int x,y,z; x = mainplug.getConfig().getInt("hubsigns."+sign+".x"); y = mainplug.getConfig().getInt("hubsigns."+sign+".y"); z = mainplug.getConfig().getInt("hubsigns."+sign+".z"); Block b = w.getBlockAt(x, y, z); if(b.getState() instanceof Sign){ Sign tsign = (Sign) b.getState(); tsign.setLine(3, ChatColor.GREEN+"Online"); tsign.update(); } } } Config file: Code: hubsigns: test: x: 15 y: 100 z: 3 world: hub FIXED: The hubsigns are not List Thank you, Skionz EDIT by Moderator: merged posts, please use the edit button instead of double posting.
1) If you fixed it, put solved 2) Heres a quick tip for saving multiple signs Use UUID.getRandom().toString() to get a random number every time. This is if you are going to have an unspecified number of signs. If every time your gonna name the sign, you don't need this.
@ano95 Just gotta say. you need to cancel the event when the chunk where the signs are in gets unloaded.