How to change player names?

Started by Silky_Chillz on

Topic category: Help with modding (Java Edition)

Last seen on 14:28, 6. Aug 2019
Joined Nov 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to change player names?

Hey, I was wondering if there was a way to change a players name? Like if your real Minecraft username is one thing, you could make it look different in chat?

Last seen on 22:13, 3. Apr 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
There is an event…
Tue, 08/07/2018 - 00:54

There is an event PlayerEvent.NameFormat that you can use to this. First you have to have a working and registered event handler class (I have definitely described how to do so many times here on MCreator forum, so you can try to find these posts, however long story short - all you have to do is making a blank GUI overlay element - as it is already a working event handler).

So in the event handler just subscribe to the PlayerEvent.NameFormat event (again - take a look on the old posts or the GUI overlay element).

The event has many fields, including username and displayname. Username is the original name and displayname is the name that will be used for rendering. Depending on your needs just change the value displayname to whatever you want. Before version 1.9 you could do so directly, but as from 1.9 many fields in event classes have become private, you will maybe need to use some setter (and possible also getter) method.

Last seen on 02:54, 21. Feb 2021
Joined Dec 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Nuparu00 please show images…
Sat, 01/25/2020 - 23:16

Nuparu00 please show images. I am new in this and I want to change the username but I dont know how. Your message is the only information that I found about this. I was finding for hours. So please show how.

Last seen on 20:05, 1. Jun 2023
Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I have the same problem, I…
Thu, 06/01/2023 - 20:06

I have the same problem, I can't change my username and it is staying as "Dev". You might have to edit the code to change your playername.

Last seen on 13:02, 19. Apr 2024
Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
there is a set display name…
Thu, 04/18/2024 - 09:45

there is a set display name of [entity] to "Name" command