Solved Anyone know a event for Player Displayname Change

Discussion in 'Plugin Help/Development/Requests' started by john12345brown, Feb 14, 2016.

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

    john12345brown

    Im looking for a event that will listen for players Displayname changes so if like someones name changes by lets say a /nick or some other commands that change there Displayname then this listener will catch that Because i need to do something to the players when this happens but i have no idea which events does this im starting to think none of the events do and i started to look into custom events but all the tutorials i have seen havent show something similar to the output of what im trying to get here is a list of what i have seen so far
     
  2. Offline

    MisterErwin

    @john12345brown Afaik there is no such event.

    But you can listen to the PlayerCommandPreprocessEvent and if the command is the /nick one (or others that do it) (and the displayname was changed - maybe use a delayed task for that), fire a custom event or just do what you have to do.
     
  3. Offline

    john12345brown

    @MisterErwin could you show me something like it listening for PlayerCommandPreprocessEvent and if the displayname is changed the it will output something that will allow me to catch the event and run some things.
     
  4. Offline

    MisterErwin

    @john12345brown
    Listen to it
    Detect if it is one of the commands that could change it (e.g. /nick)
    Store the current name,
    schedule a delayed task (e.g. 1 sec)
    in that task: check if the current displayname is not equals to the previously stored one.
    If the last condition is met: Do you stuff
     
  5. Offline

    john12345brown

    @MisterErwin I Have found a solution bascially since im just trying to detect change of displayname i just did when Players join i made a event so it for loops through everyone on the server grabs there current displayname puts it into a config file and then when someone does a command of course only people with the permission node would be listening to them only since they most likely have the nick command it will for loop through server and check all online players see who display name is not the same as the one in the config and runs things from there and saves there new display name into the config Bada bing bada bong it works :) probably not the best way but it works so its fine :).

    Thanks for your time and help seriously.
     
    MisterErwin likes this.
Thread Status:
Not open for further replies.

Share This Page