Is there anyway to chenge player.getName()

Discussion in 'Spigot Plugin Development' started by HunteR, Feb 28, 2015.

  1. Is there anyway to change player.getName(). There is no player.setName I know.
    So is there anyway to do that. I want to change it on player login event.
    Don't tell me to use setCustomName or setDisplayName.

    I just want to make other plugins to work with that new name.
     
  2. You mean stuff like TagAPI or NametagsAPI?
     
  3. No.
    I want to change player.getName() (with net.minecraft.server or something like that) so when some other plugin uses player.getName() to return that new name. Is it possible?
     
  4. I dont think you can modify minecraft's logic not sure.
    Maybe someone else could answer this?
    @md_5 (im sorry but i needed to mention you md_5)
     
  5. Correct me if im wrong but if you change the real playername it would be the same as Mojangs name change, isnt it ? Because of that, you cant change the Mojang Minecraft name which player.getName() takes. So I think no, you cant change the real playername of a player on the Server
     
  6. The easiest and possibly only method to do this is by getting their display name and dealing with that string appropriately to fit your needs.
     
  7. Ok, I will be honest.
    I have an offline server (I hope there is no problem here unlike Bukkit forum). After 1.8 every permission plugin uses UUIDs instead usernames which is normal.
    I have custom login plugin which is integrated with my website and my players still authorize with their usernames.

    However the problem is that offline servers uses UUIDs based of player's usernames.
    So, if player is logged with username "Player" he would have one UUID but if that player logs with "player" (small P) he would have different UUID.
    So the permissions would be screwed up too and actually everything too - Essentials and every plugin which uses UUIDs.

    In this moment I made to kick players if their usernames aren't exactly the same with usernames which they registered in my website.
    This works at all but I think I'll lost small percent from my players.

    So my idea was to change their getName() in player login event to usernames which they registered in my website.
    In that way they will use everytime the same offline UUID.


    And btw, that UUIDs was the stupidest thing that Mojang integrated. :D