AsyncPlayerChatEvent Not work

Discussion in 'Plugin Development' started by LimaSxD, May 28, 2013.

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

    LimaSxD

    On start i want to sorry about my English but i'm from Poland.
    Why when i want check message from player and String is "!=". When i sendMessage with this two Strings, Strings is same.
    Code:
    @EventHandler(priority = EventPriority.NORMAL)
    public void onPlayerChat(AsyncPlayerChatEvent event)
    {
    Player player = event.getPlayer();
    String getblocks = "get";
    String message = event.getMessage().toString();
    player.sendMessage("---"+message+"---");
    if(message == getblocks)
    {
    lintblocks.getblocks(player);
    player.sendMessage("GetBlocks used");
    }
    }
    And if anybody want function lintblocks.getblocks();
    Code:
    public static void getblocks(Player player)
    {
    player.sendMessage("Size of vector: "+blocklist.size());
    }
     
  2. Offline

    Jogy34

    You can't check Strings with the '==' or '!=' opperaters. You typically have to use string1.equals(string2) or string1.equalsIgnoreCase(string2)
     
  3. Offline

    LimaSxD

    Thank You now it's work ;d
     
Thread Status:
Not open for further replies.

Share This Page