Set Inventory title

Discussion in 'Plugin Development' started by MartinPL, Nov 17, 2017.

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


    Hi! I have command /inv [PLAYER], to see player inventory. How do i change title of it?

    2. if(cmd.getName().equalsIgnoreCase("inv")) {
    3. if(sender.hasPermission("mAll.inv")) {
    4. if(sender instanceof Player) {
    5. if(args.length == 1) {
    6. Player p = (Player) sender;
    7. Player f = (Player) Bukkit.getPlayer(args[0]);
    8. Inventory inv = f.getInventory();
    9. //I want to change the title of inventory
    10. p.openInventory(inv);
    11. return true;
    12. }
    13. } else {
    14. sender.sendMessage("§cMr. Console, it's only for players :D");
    15. return true;
    16. }
    17. }
    18. }
  2. Offline


    You cant change a players inventory name! the inventory name is his uuid(i think) so when he lets say changes his name, he still has his stuff! But you cant change the name or else it is no longer his. You have to make a new inventory and name that one.
  3. Offline

    timtower Moderator Moderator

    @JustRendering You can rename the one you are opening when you are making one.

    @MartinPL Not sure if you can see everything that way.
    Might want to make a new inventory that also adds the armor and offhand to the visible items.
  4. Offline


    In the start i don't want to see player armor, offhand, i want to change the title which is Inventory. Can i make it by creating new Inventory?

    EDIT: @timtower Okay, how to copy player inventory to example Inventory inv?
    Last edited: Nov 18, 2017
  5. Offline

    timtower Moderator Moderator

  6. Offline


    How to copy Player Inventory into ex. Inventory int?
  7. Offline

    timtower Moderator Moderator

    @MartinPL Don't edit your post asking a new question after somebody responded, they will never see it.
Thread Status:
Not open for further replies.

Share This Page