Get the player who caused a explosion chain

Discussion in 'Plugin Development' started by blackwolf12333, Aug 9, 2013.

Thread Status:
Not open for further replies.
  1. So I want a way to get the name of the player who causes multiple tnt explosions that are ignited by a previous explosion, aka an explosion chain.

    I have tried using the ExplosionPrimeEvent for this, but it didn't work because the location of the tnt entity would change after that event so I had no way of comparing the location from the EntityExplodeEvent and the location of the Entity in the ExplosionPrimeEvent.
    I kept those locations in a HashMap<Location, String> with the String being the name of the player and the Location being the location of the entity from the ExplosionPrimeEvent. (The location class was a custom one since the bukkit Location class doesn't work in this way for some reason :/)

    Here is a part of the code that is relevant: http://hastebin.com/hitaponixu.avrasm

    Thanks in advance,
    blackwolf12333
     
  2. Offline

    Dyprex

    The location would change either way if you think about the ignited TNT would fall down. So comparing locations is a generally not working idea. You could try to save the Block object combined with the Player object and compare the Block object when exploding.
     
  3. I looked up the equals method for CraftBlocks, they compare the locations too...
     
Thread Status:
Not open for further replies.

Share This Page