Workaround for Ghost Item Glitch

Discussion in 'Plugin Development' started by Acer_Mortem, Dec 10, 2013.

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

    Acer_Mortem

    Ever since the 1.7.2 dev release, there has been a single glitch plaguing my custom plugins:

    Whenever you cancel an InventoryClickEvent, a Ghost Item is created, and isn't removed until the inventory is refreshed (closed, and then reopened).

    Does anyone know a workaround for this glitch, or would it be best to wait for the bug to be fixed?

    Atlassian bug report link:

    https://bukkit.atlassian.net/browse/BUKKIT-4962
     
  2. Offline

    L33m4n123

    What I do is, when I block the InventoryClickEvent update the players inventory at the same time. Not the best solution but at least a solution
     
  3. Offline

    Acer_Mortem

    L33m4n123

    Yeah, I've tried that, both by setting the players contents to their contents, and also using the updateInventory method, but to no avail.
     
  4. Offline

    L33m4n123

    Nope. got that bug with craftbukkit 1.7.2 not using spigot

    try setting the item on the cursor to air

    setCursor(new ItemStack(Material.Air, 1));
     
  5. Offline

    Acer_Mortem

    L33m4n123

    Doesn't seem to be working =/ It just deletes the original item.

    Code:
                    p.sendMessage(ChatColor.RED + "Please do not interact with skill items while having a container open!");
                    event.setCancelled(true);
                    event.setCurrentItem(new ItemStack(Material.AIR, 1));
     
  6. Offline

    sgavster

  7. Offline

    L33m4n123

    Think I got 2938 if I understand that line correctly

     
  8. Offline

    Acer_Mortem

    sgavster

    I'm using 2952 and I'm getting the error.
     
  9. Offline

    L33m4n123

    Acer_Mortem sgavster ok using newest Dev Build works perfectly fine without needing any workarround
     
  10. Offline

    Acer_Mortem

    L33m4n123

    I'm still getting a ghost item whenever I cancel the event =/ The (ghost) item remains in the cursor, and the legit item goes back into the inventory.

    Code:
                if(event.getCurrentItem().getItemMeta().getDisplayName().contains("Buff")){
                    p.sendMessage(ChatColor.RED + "Please do not interact with skill items while having a container open!");
                    event.setCancelled(true);
                    return;
                }
     
  11. Offline

    L33m4n123


    then you have something else interfering in some way. I checked it with a different displayname but worked perfectly fine for me
     
  12. Offline

    Acer_Mortem

    L33m4n123

    I tried using this code, with no other plugins enabled, and the error still persisted:

    Code:
        @EventHandler
        public void stuff(InventoryClickEvent event){
            event.setCancelled(true);
        }
     
  13. Offline

    L33m4n123


    You sure you are using CB 2952?
     
  14. Offline

    Acer_Mortem

    L33m4n123

    Yep:

    Code:
    git-Bukkit-1.6.4-R2.0-38-g4b4e2cc-b2952jnks (MC: 1.7.2)
     
  15. Offline

    L33m4n123


    No Idea what 2952 you are running. but thats from the newest 2952 .. see the difference?

    It says Bukkit-1.6.4 not Bukkit -1.7.4 nice try ;)
     
  16. Offline

    Acer_Mortem

    L33m4n123

    I don't understand your reasoning for the last line of your previous post, as your startup log is the same as mine apart from the version we're running.

    Yours:
    Code:
    [00:38:13 INFO]: This server is running CraftBukkit version git-Bukkit-1.6.4-R2.
    0-21-gcf51e92-b2938jnks (MC: 1.7.2) (Implementing API version 1.7.2-R0.1-SNAPSHO
    T)
    Mine:
    Code:
    [19:20:19] [Server thread/INFO]: This server is running CraftBukkit version git-Bukkit-1.6.4-R2.0-38-g4b4e2cc-b2952jnks (MC: 1.7.2) (Implementing API version 1.7.2-R0.1-SNAPSHOT)
     
  17. Offline

    L33m4n123


    you clearly have in there

    git-Bukkit-1.7.4

    now you say

    See why I am suspicious
     
    AoH_Ruthless likes this.
  18. Offline

    Acer_Mortem

    L33m4n123

    That's because I hand wrote it from the console, and didn't CTRL + C/CTRL + V it from the exact log. Regardless, I'm using the newest API for my builds, and the newest Craftbukkit for my server.
     
  19. Offline

    L33m4n123

    Then I have no clue why it doesn't work for you
     
  20. Offline

    Acer_Mortem

    L33m4n123

    Oh =/ Well, thanks for your help anyway :)
     
Thread Status:
Not open for further replies.

Share This Page