Carry On

Carry On

112M Downloads

Unable to cancel CarryOn action

Sir-Will opened this issue · 5 comments

commented

CarryOn should fire Forge's BlockEvent.Break before attempting to pickup a tile to allow mods like protection mods to cancel this action.

commented

All plugins that require SpongeForge are loaded as mods in Forge.

Regardless of what is “well known”, Forge’s break event was added for this very reason.

Update: I just took a look at FTBUtils source code and noticed it does indeed listen to Forge's Break event.

https://github.com/LatvianModder/FTBUtilities/blob/master/src/main/java/com/feed_the_beast/ftbutilities/handlers/FTBUtilitiesPlayerEventHandler.java#L147-L157

So all you have to do is remove the hardcoded check and fire a break event. This will support any protection mod including FTBUtils.

commented

Alright yeah will do

commented

This mod seems to have a hardcoded check for FTBUtils protection yet ignores other protection mods such as GriefPrevention.

https://github.com/Tschipp/CarryOn/blob/master/src/main/java/tschipp/carryon/common/handler/PickupHandler.java#L194-L202

I'm assuming this check was added due to FTBUtils not listening to Forge's BlockEvent.Break even though it should be. To fix other protection mods that listen to Forge's break event, simply call the event and ignore the pickup if cancelled.

https://github.com/MinecraftForge/MinecraftForge/blob/1.12.x/src/main/java/net/minecraftforge/event/world/BlockEvent.java#L115

commented

Interesting. Will definitely look into it.

Also, correct me if I'm wrong, but is GriefPrevention not a Plugin? Are there any other well known Grief Protection mods apart from FTBUtils?

commented

Thanks, this is added in the next release, I also added protections for entities using this method!