How to protect when creeper explosion block damage in spongeforge 1.8.9-4.1.0-1330.
Thank you for every comment
How to protect when creeper explosion block damage in spongeforge 1.8.9-4.1.0-1330.
Thank you for every comment
/gamerule mobGriefing false
?
@Listener public void onBlockChange(ChangeBlockEvent e) { if (e.getCause().first(Creeper.class).isPresent()){ e.setCancelled(true); } }
Where file input code
@collller Your code can be shortened using filter annotations: https://docs.spongepowered.org/master/en/plugin/event/filters.html#parameter-source-annotations
@11115 You have to put your code in your plugin. You also can change this code a bit so it is compatible with Sponge javascript. Or just request such a plugin and wait until someone has done it.
thanks
like this?
@Listener @IsCancelled(Tristate.FALSE) public void antiexplosion(ChangeBlockEvent e,@First Explosive explo ) { e.setCancelled(true); }
I think your @IsCancelled behavior is the default behavior so you don’t have to specify that.
Now the event gets cancelled when an explosive has caused a block change. I thought you wanted to only do this when a Creeper is the first cause. So change to method(..., @First Creeper creeper){}
Doesn’t that effect the whole world? What if I want to turn off creepers in just 1 area like a town?
Correct … I’d suggest using some protection plugin then. FoxGuard should be capable of doing that
yea, I am using Pex 2.0 and haven’t gotten any where with that either. its like no one has ever wanted to turn mob griefing off in a specific are before- which I refuse to believe…
Uhm … Pex is a Permissions-Plugin, not a Protection-Plugin, is it?
Yes, it is a permissions program, I use it in combo with Grief Prevention. I will try Fox Guard in the next week or so if I cant get any help from the G.P. forums- which I anticipate no one will be able to offer any suggestions. The IRC channel is a joke…you can stay there all day and no one will reply. I asked the author of G.P. and haven’t gotten a reply either.
So, this is the last week I will wait for an answer. After that, I remove it and forget it.