Skip to content

[1.14.4] NickChangeEvent returns incorrect player object #3043

@SwankyNoodle

Description

@SwankyNoodle

Information

Full output of /ess version:

[16:06:12 INFO]: Server version: 1.14.4-R0.1-SNAPSHOT git-Paper-243 (MC: 1.14.4)
[16:06:12 INFO]: EssentialsX version: 2.17.1.0
[16:06:12 INFO]: EssentialsXProtect version: 2.17.1.0

Server log: https://gist.github.com/SwankyNoodle/5c30d437307d79e950a94b601f398fcc#file-latest_log

EssentialsX config: https://gist.github.com/SwankyNoodle/5c30d437307d79e950a94b601f398fcc#file-essentials_config

Details

Description
When implementing the NickChangeEvent event, the player returned through e.getAffected().getBase(); is not the player that triggered the event (the affected player), but the one that issued the command that initially triggered the event.

Steps to reproduce
Create a method that implements the NickChangeEvent event in a test plugin with the player affected being returned.
An example of such a function is:

@EventHandler
   	public void GetPlayerExample(final NickChangeEvent e) {
    	Player p = e.getAffected().getBase();
    	p.sendMessage(p.getName().toString());
    }

Then trigger the event by updating the nickname of another player (not the one issuing the command)

Expected behavior
e.getAffected().getBase() should return the player who triggered the event, not the one who issued the command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug: confirmedConfirmed bugs in EssentialsX.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions