Plugin to find text in what a player says

Discussion in 'Plugin Development' started by booingthetroll, Feb 12, 2012.

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

    booingthetroll

    I'm very sorry; I know this will make me sound like an idiot, but I am new to Bukkit and Minecraft.
    I know how to detect using /%s, but how would you make a plugin that detects it when someone says
    %stextgoeshere%s?
    e.i.
    magicalPONIESprincess
    would trigger it.

    ._. Is there no built in method?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 24, 2016
  2. Offline

    thehutch

    Use the PlayerChatEvent then use this:

    Code:
        public void onPlayerChat(PlayerChatEvent ev) {
            String message = ev.getMessage().toLowerCase();
            if (message.contains(" enter what you want it contain")) {
                // do stuff
            }
        }
     
Thread Status:
Not open for further replies.

Share This Page