mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-18 07:07:43 +01:00
Added option to prevent block damage created by flowing water (Minecart tracks, Redstone wire, etc.)
This commit is contained in:
parent
d13f0b9191
commit
0e1e92df13
@ -19,15 +19,14 @@ use or not:
|
||||
- Restrict lava spreading to only some block types.
|
||||
- Simulate classic-esque water by letting water infinitely expand in
|
||||
area (only if there is a block underneath).
|
||||
- Prevent water from destroying blocks like Redstone wire and flowers.
|
||||
- Simulate the function of the sponge from Minecraft Classic.
|
||||
- Notify admins, block, log, kick or ban for the use of certain block types
|
||||
or items.
|
||||
- Temporarily stop fire globally with some commands.
|
||||
- Destroy tools on drop to alleviate the durability cheat.
|
||||
- OR just fix the durability bug. *Requires special version of hMod
|
||||
- Prevent gravel and sand from falling. *Requires special version of hMod
|
||||
- Prevent gravel and sand from falling.
|
||||
- Allow portal blocks to be placed anywhere.
|
||||
*Requires special version of hMod
|
||||
|
||||
hMod is required as WorldGuard is a plugin for hMod.
|
||||
|
||||
@ -113,6 +112,10 @@ unsupported by your version of hMod.
|
||||
to disable this feature. Enabling disable-all-fire-spread will
|
||||
override this function.
|
||||
|
||||
- disable-water-damage-blocks (no default)
|
||||
List of blocks that should not be destroyed by water (Redstone wire,
|
||||
minecart tracks, flowers, etc.).
|
||||
|
||||
- item-drop-blacklist (no default)
|
||||
List of block names/IDs to destroy on drop. This can alleviate the
|
||||
durability cheat that allows you to drop your tools to fix their
|
||||
|
@ -106,6 +106,9 @@ public void initialize() {
|
||||
if (!registerHook("DAMAGE", PluginListener.Priority.MEDIUM)) {
|
||||
missingFeatures.add("disabling fall, water, lava, and fire damage");
|
||||
}
|
||||
if (!registerHook("LIQUID_DESTROY", PluginListener.Priority.MEDIUM)) {
|
||||
missingFeatures.add("disabling water damage");
|
||||
}
|
||||
|
||||
if (missingFeatures.size() > 0) {
|
||||
logger.log(Level.WARNING, "WorldGuard: Your version of hMod does not support "
|
||||
|
@ -85,6 +85,7 @@ public class WorldGuardListener extends PluginListener {
|
||||
private Set<Integer> fireNoSpreadBlocks;
|
||||
private Set<Integer> allowedLavaSpreadOver;
|
||||
private Set<Integer> itemDropBlacklist;
|
||||
private Set<Integer> preventWaterDamage;
|
||||
private boolean classicWater;
|
||||
private boolean noPhysicsGravel;
|
||||
private boolean noPhysicsSand;
|
||||
@ -177,6 +178,7 @@ public void loadConfiguration() {
|
||||
blockLighter = properties.getBoolean("block-lighter", false);
|
||||
preventLavaFire = properties.getBoolean("disable-lava-fire", true);
|
||||
disableAllFire = properties.getBoolean("disable-all-fire-spread", false);
|
||||
preventWaterDamage = toBlockIDSet(properties.getString("disable-water-damage-blocks", ""));
|
||||
itemDropBlacklist = toBlockIDSet(properties.getString("item-drop-blacklist", ""));
|
||||
fireNoSpreadBlocks = toBlockIDSet(properties.getString("disallowed-fire-spread-blocks", ""));
|
||||
allowedLavaSpreadOver = toBlockIDSet(properties.getString("allowed-lava-spread-blocks", ""));
|
||||
@ -1041,6 +1043,28 @@ public boolean onDamage(PluginLoader.DamageType type, BaseEntity attacker,
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when water or lava tries to populate a block, you can prevent
|
||||
* crushing of torches, railways, flowers etc. You can alternatively allow
|
||||
* to let normally solid blocks be crushed.
|
||||
*
|
||||
* @param currentState the current tristate, once it's set to a non DEFAULT_ACTION it is final.
|
||||
* @param liquidBlock the type of the attacking block
|
||||
* @param targetBlock the block to be destroyed
|
||||
* @return final after a non DEFAULT_ACTION
|
||||
*/
|
||||
@Override
|
||||
public PluginLoader.HookResult onLiquidDestroy(PluginLoader.HookResult currentState,
|
||||
int liquidBlockId, Block targetBlock) {
|
||||
if (preventWaterDamage != null && liquidBlockId <= 9) {
|
||||
if (preventWaterDamage.contains(targetBlock.getType())) {
|
||||
return PluginLoader.HookResult.PREVENT_ACTION;
|
||||
}
|
||||
}
|
||||
|
||||
return PluginLoader.HookResult.DEFAULT_ACTION;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on player disconnect
|
||||
*
|
||||
|
@ -80,6 +80,10 @@ disable-lava-fire=true
|
||||
# List of blocks that lava is allowed to spread onto.
|
||||
allowed-lava-spread-blocks=
|
||||
|
||||
# List of blocks that should not be destroyed by water (Redstone wire,
|
||||
# minecart tracks, flowers, etc.).
|
||||
disable-water-damage-blocks=
|
||||
|
||||
# Control where to log blacklist events to. You can use multiple log
|
||||
# methods as you please.
|
||||
log-console=true
|
||||
|
Loading…
Reference in New Issue
Block a user