Search code examples
javaeclipsepluginsserverbukkit

The method sign.setline is not working


im haveing a problem running a setline command witch i want to set the line of a sign with.. it isn't doing anything

This is the part of the code that has the setline method in it it will run with a few other things when the player will give the input (the "if (SignEvent.isNumericArray(times))" is true for sure and the code is running i did check that )

  if (SignEvent.isNumericArray(times)){

                double uses = Double.parseDouble(times);
                uses = uses -1;


                sign.setLine(2 , uses + "/" + str[1] + parts[1]);


                if (uses <= 0){
                sign.setLine(0, ChatColor.STRIKETHROUGH + "StartPayment");  
                }
            }

i did check a few things :

  • no errors in console or eclipse error list
  • object sign is type Sign imported from import org.bukkit.block.Sign
  • object sign is the right sign (checked by doing e.getPlayer().sendMessage(sign.getLine(0)); it worked..
  • no matter what the string is it isn't working
  • no matter where i put this line of code its not working
  • the this line is running

i just have no idea what could i do to fix it i tried a lot of things and im pretty sure the problem is in the sign.setLine(2 , uses + "/" + str[1] + parts[1]); line

any one have any idea for what did i do wrong ?

Note: no matter where in this method i put the setline method or with what string/lineIndex ,it isn't doing anything


Solution

  • I think you have to execute sign.update(); after a modification to apply changes.