Solved Signs colored text.

Discussion in 'Plugin Development' started by zakkinu2, Sep 22, 2013.

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

    zakkinu2

    I am having a problem where signs dont change colors when i do "#1" or another number or a letter, I know its going to be somethign stupid im doing but here is the code:
    Code:
        @EventHandler
        public void onSingChnage(SignChangeEvent e){
            Block b = e.getBlock();
            Sign s = (Sign) b.getState();
            s.getLine(0).replaceAll("#", "§");
            s.getLine(1).replaceAll("#", "§");
            s.getLine(2).replaceAll("#", "§");
            s.getLine(3).replaceAll("#", "§");
        }
     
  2. Offline

    chasechocolate

    Update the BlockState: s.update().
     
  3. Offline

    zakkinu2

    chasechocolate i did this but it still wont work:
    Code:
        @EventHandler
        public void onSingChnage(SignChangeEvent e){
            Block b = e.getBlock();
            Sign s = (Sign) b.getState();
            s.getLine(0).replaceAll("#", "§");
            s.getLine(1).replaceAll("#", "§");
            s.getLine(2).replaceAll("#", "§");
            s.getLine(3).replaceAll("#", "§");
            s.update();
        }
     
  4. Offline

    chasechocolate

    zakkinu2 do this:
    Code:java
    1. for(int i = 0; i <= 3; i++){
    2. e.setLine(i, ChatColor.translateAlternateColorCodes('#', e.getLine(i)));
    3. }
     
  5. Offline

    zakkinu2

  6. Offline

    The_Doctor_123

    zakkinu2
    You never set the lines, you just got them.
     
  7. Offline

    zakkinu2

Thread Status:
Not open for further replies.

Share This Page