Renaming with a Packet

Discussion in 'Plugin Development' started by Hoolean, Feb 8, 2013.

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

    Hoolean

    I would like to rename an item in a player's inventory with packets, so as not to modify their actual inventory server-side. Which packet should I use and how should I use it for renaming ;)
     
  2. Offline

    Comphenix

    Take a look at ItemRenamer - it should give you an idea of how to do this.
     
  3. Offline

    Hoolean

    That looks like it listens to and modifies packets; I need to send packets!
     
  4. Offline

    Comphenix

    Just call "updateInventory".

    But yes, you can send a packet manually as well. Look up Packet103SetSlot - for ProtocolLib, you can use this wrapper class (slot indexes are explained here):
    Code:java
    1.  
    2. Packet67SetSlot updateSlot = new Packet67SetSlot();
    3. updateSlot.setWindowID(0); // player inventory
    4. updateSlot.setSlot(36);
    5. updateSlot.setSlotData(new ItemStack(Material.GOLD_AXE, 1));
    6. ProtocolLibrary.getProtocolManager().sendServerPacket(player, updateSlot);
    7.  
     
Thread Status:
Not open for further replies.

Share This Page