Workaround for Ghost Item Glitch

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

  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. 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. 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 (Text):
    1.                 p.sendMessage(ChatColor.RED + "Please do not interact with skill items while having a container open!");
    2.                 event.setCancelled(true);
    3.                 event.setCurrentItem(new ItemStack(Material.AIR, 1));
     
  6. Think I got 2938 if I understand that line correctly

     
  7. Offline

    Acer_Mortem

    sgavster

    I'm using 2952 and I'm getting the error.
     
  8. Acer_Mortem sgavster ok using newest Dev Build works perfectly fine without needing any workarround
     
  9. 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 (Text):
    1.             if(event.getCurrentItem().getItemMeta().getDisplayName().contains("Buff")){
    2.                 p.sendMessage(ChatColor.RED + "Please do not interact with skill items while having a container open!");
    3.                 event.setCancelled(true);
    4.                 return;
    5.             }
     

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

    Acer_Mortem

    L33m4n123

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

    Code (Text):
    1.     @EventHandler
    2.     public void stuff(InventoryClickEvent event){
    3.         event.setCancelled(true);
    4.     }
     

  12. You sure you are using CB 2952?
     
  13. Offline

    Acer_Mortem

    L33m4n123

    Yep:

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

  14. 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 ;)
     
  15. 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 (Text):
    1. [00:38:13 INFO]: This server is running CraftBukkit version git-Bukkit-1.6.4-R2.
    2. 0-21-gcf51e92-b2938jnks (MC: 1.7.2) (Implementing API version 1.7.2-R0.1-SNAPSHO
    3. T)
    Mine:
    Code (Text):
    1. [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)
     

  16. you clearly have in there

    git-Bukkit-1.7.4

    now you say

    See why I am suspicious
     
    AoH_Ruthless likes this.
  17. 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.
     
  18. Then I have no clue why it doesn't work for you
     
  19. Offline

    Acer_Mortem

    L33m4n123

    Oh =/ Well, thanks for your help anyway :)
     

Share This Page