Custom Anvil Inventory

Discussion in 'Spigot Plugin Development' started by Eliminator, May 9, 2015.

  1. Is there a way I can create a custom anvil inventory with its title changed?

    I tired:
    Code (Text):
    Inventory inv = this.getServer().createInventory(p, InventoryType.ANVIL, "Enter Name");
    But the name does not change.
     
  2. I am unsure of this but I imagine not. If you're trying to track the inventory, though, getTitle() still returns the title you set so although the player can't see your title, you can detect the inventory with it.
     
  3. I want to change the title...
     
  4. I fixed those errors, but the window that pops up has the normal name still, its not changed.
     
  5. Also I can not set the items in the inventory.

    I tried:
    Code (Text):

    player.getOpenInventory().setItem(0, st);
    container.getBukkitView().setItem(0, st);
    Inventory inv = container.getBukkitView().getTopInventory();
    inv.setItem(0, st);
    player.getOpenInventory().getTopInventory().setItem(0, st);
     
    But none work.
     
  6. Can anyone help?
     
  7. This might help you. As for changing anvil name, I don't think that can be done, sorry :/.
     
  8. OK, thanks, that worked.
     
  9. I'm using Spigot 1.8.8 and I always get the following error:

    java.util.concurrent.ExecutionException: java.lang.IndexOutOfBoundsException: In
    dex: 14, Size: 0
    at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_60]
    at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_60]
    at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:45) [craftbukki
    t-1.8.8.jar:git-Bukkit-9cd1111]
    at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:6
    72) [craftbukkit-1.8.8.jar:git-Bukkit-9cd1111]
    at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:3
    35) [craftbukkit-1.8.8.jar:git-Bukkit-9cd1111]
    at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:6
    28) [craftbukkit-1.8.8.jar:git-Bukkit-9cd1111]
    at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java
    :536) [craftbukkit-1.8.8.jar:git-Bukkit-9cd1111]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_60]
    Caused by: java.lang.IndexOutOfBoundsException: Index: 14, Size: 0
    at java.util.ArrayList.rangeCheck(Unknown Source) ~[?:1.8.0_60]
    at java.util.ArrayList.get(Unknown Source) ~[?:1.8.0_60]
    at net.minecraft.server.v1_8_R3.Container.clickItem(Container.java:266)
    ~[craftbukkit-1.8.8.jar:git-Bukkit-9cd1111]
    at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java
    :1569) ~[craftbukkit-1.8.8.jar:git-Bukkit-9cd1111]
    at net.minecraft.server.v1_8_R3.PacketPlayInWindowClick.a(SourceFile:31)
    ~[craftbukkit-1.8.8.jar:git-Bukkit-9cd1111]
    at net.minecraft.server.v1_8_R3.PacketPlayInWindowClick.a(SourceFile:9)
    ~[craftbukkit-1.8.8.jar:git-Bukkit-9cd1111]
    at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:1
    3) ~[craftbukkit-1.8.8.jar:git-Bukkit-9cd1111]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~
    [?:1.8.0_60]
    at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_60]
    at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) ~[craftbukk
    it-1.8.8.jar:git-Bukkit-9cd1111]
    ... 5 more

    I've tried 3 different versions of the code, with both spigot and craftbukkit latest version, and it all produces the same result. Is it outdated? What can I do to fix it?