chat message place holder

Discussion in 'Plugin Development' started by robrobk, Aug 5, 2014.

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

    robrobk

    hi

    i have a plugin that has a string that it wants to put in players' chat messages.

    in essentials chat config, i have added {mystringplaceholder} and i want to replace it with a string

    how do i do this


    its exactly like plugins such as factions
     
  2. Offline

    xXMaTTHDXx

    Code:java
    1. getConfig().getString("path.to.string").replace("{PLAYERNAME}", p.getName());

    Now remember robrobk this is just some quick code, make sure to replace the variables with your own so it fits your code.
     
  3. Offline

    robrobk

    what i mean is
    player sends a chat message
    essentials intercepts it and changes it to include the placeholder
    my plugin intercepts it and replaces the placeholder with my string
     
  4. Offline

    _Filip

    Onplayerchat on the highest priority
     
  5. Offline

    xXMaTTHDXx

    Listen for the chat event, hook into essentials to see it the message contains the place holder, if it does replace the place holder with your string via config.

    In you chat event just do something like if(e.get message().contains(placeholder)) do somthing
     
Thread Status:
Not open for further replies.

Share This Page