Updating lobby signs

Discussion in 'Plugin Development' started by ano95, Dec 20, 2014.

Thread Status:
Not open for further replies.
  1. Offline


    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!
  2. Offline


    @ano95 Get the block at that location, get the state, cast it to Sign (after checking), edit the sign, update the sign.
  3. Offline


    I know, but I want lopp, that will do it for every registred sign

    Also, my actual 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)
               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");
    Config file:
        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.
    Last edited by a moderator: Jun 29, 2016
  4. Offline


    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.
  5. Offline


    @ano95 Just gotta say. you need to cancel the event when the chunk where the signs are in gets unloaded.
Thread Status:
Not open for further replies.

Share This Page