name above head?

Discussion in 'Plugin Development' started by Abrupt, Jan 30, 2011.

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

    Abrupt

    is there any way to edit the name above your head with Bukkit?
    player.setDisplayName() seems to only change your name in chat.
     
  2. Offline

    dag10

    The name above the head cannot be changed mid-session. The name is only sent to the other clients when a client connects.

    To change the name above a player's head, you have to despawn the player from the world (and effectively despawn the player from all other clients) and then respawn him with a new name.

    I'm not entirely sure on how to easily broadcast the necessary despawn and spawn packet to all other clients, but you'll want to do that after you set the target player's display name.
     
  3. Offline

    TotempaaltJ

    Couldn't you do it pre-spawn, when the player sends the connection package-thing to the server?
     
  4. Offline

    Abrupt

    no, I need it to be changeable after login unfortunately.
     
  5. Offline

    dag10

    After looking through the Bukkit Docs, it seems that there is currently no documented way to send the despawn and spawn packets at the moment.
    --- merged: Jan 31, 2011 8:38 PM ---
    Unless you want to obtain the actual socket stream for every client that has the target player loaded, and manually build and send the de-spawn and spawn packets through them.

    You can find documentation on these packetes here:

    http://wiki.vg/Protocol#Destroy_Entity_.280x1D.29
    http://wiki.vg/Protocol#Named_Entity_Spawn_.280x14.29

    However, please make sure not to send any of these packets to a client if the target player isn't currently loaded for that client. Players are only spawned in clients when the come into sight--not when they spawn. The length and width of the square region of loaded chunks for each client at any given time is 22x22 chunks iirc. So only send these packets to another client if the client is within 11 chunks (176 blocks) of the player.
     
  6. Offline

    henryforprez

  7. Offline

    dag10

    I was writing an SMP server in C# a few months ago. Then Notch added server-side Inventory and, in combination with other side-projects, I became discouraged from working further.

    If you write a custom SMP server, keep in mind that it is unrealistic to assume that you will be able to properly emulate the various mobs, minecarts, and redstone without dedicating a huge amount of time to the project. It even took me a good week to get lighting down, and I didn't even get the chance to begin water/lava physics.
     
  8. Offline

    henryforprez

    Thanks, but trust me, I know what I am getting into.
     
Thread Status:
Not open for further replies.

Share This Page