NameChanger is a plugin that essentially makes the server believe that players are named differently than they actually are, without actually performing the name changing process on Mojang’s end.
/name set <name> [target] - Sets
target’s name (Or your own, if target isn’t specified)
/name reset [target] - Resets
target’s name (Or your own, if target isn’t specified) to the actual name of their account.
/name realname <player> - Gets the original, or real name of the target player.
NameChanger works by essentially hijacking server files using mixins, add adding custom checks for nicknames. The actual code can be found here, but in short what it does is check if there is a nickname stored for a user with the id provided by the proper method, and if there is creates a new GameProfile, identical in all ways but name, and returns that from the method.