Avoid drops on .breakNaturally()

Discussion in 'Plugin Development' started by AmShaegar, Mar 8, 2013.

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

    AmShaegar

    Hey,

    how do I avoid drops when I use breakNaturally()? I have to remove some chests with my code but replacing them by air causes the client to crash occasionally. This is why I need to use breakNaturally(). But I do not want the chests to get dropped. I know I have to cancel the ItemSpawnEvent or remove the item from it but how do I detect that it is my chest?

    Chests are at random positions and I do not want every chest to drop nothing. Just those which are broken by my plugin.
     
  2. Offline

    Tirelessly

    Get the chest and clear it's contents, then use breakNaturally? Or if you also don't want the actual chest to drop, see if setting it to air without any items still crashes the client.
     
  3. Offline

    AmShaegar

    It does crash the clients occasionally. Let me make this clear: I already clear the content. I am talking just about the chests which are dropped not about the content.

    This is the bug: https://bukkit.atlassian.net/browse/BUKKIT-346
     
  4. Offline

    AmShaegar

    This issue is still unsolved for me. Is there no native way to do this?
     
  5. Offline

    Barinade

    Block break event? Pretty sure it's called, not sure though
     
  6. Offline

    AmShaegar

    breakNaturally() does not trigger any events afaik. BlockBreakEvent and ItemSpawnEvent already tested.
     
  7. Offline

    Barinade

    Could just get items within a block and remove it if it's a chest...

    Other than that, just find another way to remove chests.
     
  8. Offline

    AmShaegar

    Okay so a possible solution should be removing all ItemStacks of type Chest within a certain radius - 1 block is not enough, I've seen them spawning at least 2 blocks aways.

    Well, which one? If I knew of one, I wouldn't ask. :D Replacing them by another block occasionally crashes clients...
     
Thread Status:
Not open for further replies.

Share This Page