Block entity from being removed by another plugin.

Discussion in 'Spigot Plugin Development' started by woutwoot, May 2, 2015.

  1. My plugin ItemFrameShops, uses Item Frames (duh) but some users are complaining that the frames get removed when they do /killall. Is there a way I can block my shops from being removed?
     
  2. Use a regen method
     
  3. What? No idea what you mean. I'm looking for code here, no abstract idea's :) As far as I can tell, what I'm trying to do is not possible.
     
  4. minelazz

    Supporter

    Create a new nms entity and override the die() method to do nothing
     
  5. That would be possible, but wouldn't that cause a bunch of trouble when you really want to remove the entity? Also, I have no knowledge of NMS at all.
     
  6. Use an event listener (onEntityDeath or summut?) on the highest event priority.
    Check if the entity is spawned by your plugin. If it is, setCancelled(false). This may work?
     
  7. I don't think that would work, as when someone uses /killall, no entitydeath event is called. Not sure though, I'll test.
     
  8. minelazz

    Supporter

    Yupp, it will. Tho you can easy find some work arounds. Eg removing it on special circumstances when the entity is damaged. You can do so by overriding damage method and then check the damage cause.