mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-27 21:15:57 +01:00
Make liquid flow checking for regions optional.
This commit is contained in:
parent
ef56a32f00
commit
24f72cb07f
@ -130,6 +130,7 @@ public class WorldConfiguration {
|
||||
public boolean disableMobDamage;
|
||||
public boolean useRegions;
|
||||
public boolean highFreqFlags;
|
||||
public boolean checkLiquidFlow;
|
||||
public int regionWand;
|
||||
public Set<EntityType> blockCreatureSpawn;
|
||||
public boolean allowTamedSpawns;
|
||||
@ -415,6 +416,7 @@ private void loadConfiguration() {
|
||||
regionInvinciblityRemovesMobs = getBoolean("regions.invincibility-removes-mobs", false);
|
||||
explosionFlagCancellation = getBoolean("regions.explosion-flags-block-entity-damage", true);
|
||||
highFreqFlags = getBoolean("regions.high-frequency-flags", false);
|
||||
checkLiquidFlow = getBoolean("regions.protect-against-liquid-flow", false);
|
||||
regionWand = getInt("regions.wand", 334);
|
||||
maxClaimVolume = getInt("regions.max-claim-volume", 30000);
|
||||
claimOnlyInsideExistingRegions = getBoolean("regions.claim-only-inside-existing-regions", false);
|
||||
|
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldguard.bukkit.listener;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.sk89q.worldguard.bukkit.WorldConfiguration;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.bukkit.cause.Cause;
|
||||
import com.sk89q.worldguard.bukkit.event.block.BreakBlockEvent;
|
||||
@ -51,7 +52,6 @@
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Event.Result;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockBurnEvent;
|
||||
@ -108,7 +108,7 @@
|
||||
import static com.sk89q.worldguard.bukkit.util.Materials.isBlockModifiedOnClick;
|
||||
import static com.sk89q.worldguard.bukkit.util.Materials.isItemAppliedToBlock;
|
||||
|
||||
public class EventAbstractionListener implements Listener {
|
||||
public class EventAbstractionListener extends AbstractListener {
|
||||
|
||||
/**
|
||||
* Abstract {@link BlockFromToEvent}s into break and place events.
|
||||
@ -116,14 +116,17 @@ public class EventAbstractionListener implements Listener {
|
||||
*/
|
||||
public static final boolean ABSTRACT_FROM_TO_EVENTS = false;
|
||||
|
||||
private final WorldGuardPlugin plugin;
|
||||
|
||||
/**
|
||||
* Construct the listener.
|
||||
*
|
||||
* @param plugin an instance of WorldGuardPlugin
|
||||
*/
|
||||
public EventAbstractionListener(WorldGuardPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
public void registerEvents() {
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
getPlugin().getServer().getPluginManager().registerEvents(this, getPlugin());
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
@ -382,6 +385,14 @@ public void onPlayerBucketFill(PlayerBucketFillEvent event) {
|
||||
|
||||
@EventHandler
|
||||
public void onBlockFromTo(BlockFromToEvent event) {
|
||||
WorldConfiguration config = getWorldConfig(event.getBlock().getWorld());
|
||||
|
||||
// This only applies to regions but nothing else cares about high
|
||||
// frequency events at the moment
|
||||
if (!config.useRegions || (!config.highFreqFlags && !config.checkLiquidFlow)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Block from = event.getBlock();
|
||||
Block to = event.getToBlock();
|
||||
Material fromType = from.getType();
|
||||
|
@ -113,6 +113,11 @@ public void onPlaceBlock(final PlaceBlockEvent event) {
|
||||
final RegionQuery query = getPlugin().getRegionContainer().createQuery();
|
||||
final RegionAssociable associable = createRegionAssociable(event.getCause());
|
||||
|
||||
// Don't check liquid flow unless it's enabled
|
||||
if (Materials.isLiquid(type) && !getWorldConfig(event.getWorld()).checkLiquidFlow) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.filter(new Predicate<Location>() {
|
||||
@Override
|
||||
public boolean apply(Location target) {
|
||||
|
Loading…
Reference in New Issue
Block a user