Towny icon indicating copy to clipboard operation
Towny copied to clipboard

Suggestion: Equivalent to TownBlockPVPTestEvent for Explosions

Open galacticwarrior9 opened this issue 2 years ago • 3 comments

Please explain your feature request to the best of your abilities:

The documentation for TownBlockPVPTestEvent states that it is "thrown when Towny will determine the PVP status of a townblock, or plot, in a town." I am looking for an equivalent for explosions - an event thrown when Towny determines whether explosions will be enabled in a townblock/plot in a town. My personal use-case would using it to enable explosions everywhere inside a SiegeWar siege zone, but there are of course others.

galacticwarrior9 avatar Jun 14 '22 23:06 galacticwarrior9

They don't modify the townblock or town itself but I think you will find the TownyExplodingBlocksEvent and TownyExplosionDamagesEntityEvent up to spec here. Let me know if you have any questions.

LlmDl avatar Jun 14 '22 23:06 LlmDl

My understanding - and please do correct me if I'm wrong - is that I can use TownyExplodingBlocksEvent to remove blocks from an explosion's block list, but I can't use it to enable explosions in a plot in the first place. That's a scenario where I think this hypothetical new event could be useful (in my case, I specifically want to enable explosions in a plot if it located inside a SiegeWar siege zone)

galacticwarrior9 avatar Jul 01 '22 02:07 galacticwarrior9

Yep, the event will be added after I assess it soon.

LlmDl avatar Jul 01 '22 02:07 LlmDl

I just took a quick look into where this could be implemented — explosions are handled a bit more differently than I thought when making this suggestion, but I think TownyActionEventExecutor#isAllowedExplosion could be a good place to fire this event?

galacticwarrior9 avatar Oct 07 '22 23:10 galacticwarrior9