Modifying Essentials Sell Sign

Discussion in 'Spigot Plugin Development' started by Spedwards, May 29, 2016.

  1. So a server owner came to me and requested a plugin be done. Part of it included having a boolean value that when true, modifies all Essentials' sell signs on the server with a multiplier. So for example, say the multiplier is 2x, if the boolean was true and you sold your stuff at a sign that'd normally be $10, you'd get $20 instead.

    The only way I can think of getting this done, is by editing the Essentials plugin and adding a check into the sell signs.

    Is there an easier way of handling this that I'm missing?
     
  2. You won't have to modify Essentails for this to work I think. Try something like

    Code (Text):
    if boolean is true {
        loop through all loaded chunks {
            loop through all possible coordinates of the chunk {//A chunk is 16x16x16 if I remember correctly
                Block b = get block at coordinates
                if b is an instance of a sign {
                    if sign's first line is equal to the [sell] {
                        modify the line that contains the price
                    }
                }
            }
        }
    }
    But as you can see this is probably pretty inefficient, it would be better if you had an arraylist with all the Essentials sell signs already.

    P.s Don't accept plugin requests if you don't have enough experience and you need to ask other people for help.
     
  3. If the chunk isn't loaded, this won't work. Best bet is to change it when the player right clicks the sign.