SignChangeEvent

Discussion in 'Plugin Development' started by S7W, Apr 19, 2015.

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

    S7W

    Hello there, today I am having a bit of a problem and I don't understand why.

    Here is the code:
    Code:
        @EventHandler
        public void onChange(SignChangeEvent e) {
            Player p = e.getPlayer();
            if(e.getLine(0).equalsIgnoreCase("[ColorNick]")) {
                if(p.hasPermission("colornick.create")) {
                    if((!e.getLine(1).trim().isEmpty())) {
                        if((!e.getLine(2).trim().isEmpty())) {
                            e.setLine(1, ChatColor.RED + "[" + ChatColor.LIGHT_PURPLE + "Color" + ChatColor.DARK_PURPLE + "Nick" + ChatColor.RED + "]");
                            p.sendMessage("§aCreated a ColorNick sign.");
                        }
                    }
                }
            }
        }
    Here is the output in game:
    [​IMG]
     
  2. Offline

    SuperOriginal

    What is the problem?
     
  3. Offline

    pie_flavor

    @SuperOriginal Well, it obviously isn't putting what he set.
    @S7W What other plugins do you have installed?
    BTW, tip: Make a method named something short like c() that takes a String and returns a String, Make it return ChatColor.translateAlternateColorCodes('&',<input string>) and then call that so you can use & color codes, while retaining the usage of ChatColor and the ability to put normal &'s.
     
  4. Offline

    SuperOriginal

    @pie_flavor Am I missing something? Because the only thing I see is the sign running out of space.
     
  5. @SuperOriginal he shouldn't be running out of space, I tested it in game and I could fit [ColorNick] on a sign..

    It looks like there is something clashing with it.. I don't see a reason why it shouldn't be working.
     
  6. Offline

    SuperOriginal

  7. Offline

    S7W

    Yeah its the § characters, they take up space. Thanks anyway.
     
  8. Offline

    pie_flavor

    @S7W Hmm. That should be only 15 characters, which is the actual character limit.
     
Thread Status:
Not open for further replies.

Share This Page