mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-01-12 11:21:34 +01:00
Added protection.disable-obsidian-generators option
This commit is contained in:
parent
b4f2188f72
commit
ef8eb76b16
@ -152,6 +152,7 @@ public class WorldConfiguration {
|
|||||||
public boolean disableEndermanGriefing;
|
public boolean disableEndermanGriefing;
|
||||||
public boolean regionInvinciblityRemovesMobs;
|
public boolean regionInvinciblityRemovesMobs;
|
||||||
public boolean disableDeathMessages;
|
public boolean disableDeathMessages;
|
||||||
|
public boolean disableObsidianGenerators;
|
||||||
|
|
||||||
/* Configuration data end */
|
/* Configuration data end */
|
||||||
|
|
||||||
@ -259,6 +260,7 @@ private void loadConfiguration() {
|
|||||||
itemDurability = getBoolean("protection.item-durability", true);
|
itemDurability = getBoolean("protection.item-durability", true);
|
||||||
removeInfiniteStacks = getBoolean("protection.remove-infinite-stacks", false);
|
removeInfiniteStacks = getBoolean("protection.remove-infinite-stacks", false);
|
||||||
disableExpDrops = getBoolean("protection.disable-xp-orb-drops", false);
|
disableExpDrops = getBoolean("protection.disable-xp-orb-drops", false);
|
||||||
|
disableObsidianGenerators = getBoolean("protection.disable-obsidian-generators", false);
|
||||||
|
|
||||||
// classicWater = getBoolean("simulation.classic-water", false);
|
// classicWater = getBoolean("simulation.classic-water", false);
|
||||||
simulateSponge = getBoolean("simulation.sponge.enable", true);
|
simulateSponge = getBoolean("simulation.sponge.enable", true);
|
||||||
|
@ -231,6 +231,7 @@ public void onBlockFromTo(BlockFromToEvent event) {
|
|||||||
|
|
||||||
boolean isWater = blockFrom.getTypeId() == 8 || blockFrom.getTypeId() == 9;
|
boolean isWater = blockFrom.getTypeId() == 8 || blockFrom.getTypeId() == 9;
|
||||||
boolean isLava = blockFrom.getTypeId() == 10 || blockFrom.getTypeId() == 11;
|
boolean isLava = blockFrom.getTypeId() == 10 || blockFrom.getTypeId() == 11;
|
||||||
|
boolean isAir = blockFrom.getTypeId() == 0;
|
||||||
|
|
||||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||||
WorldConfiguration wcfg = cfg.get(event.getBlock().getWorld());
|
WorldConfiguration wcfg = cfg.get(event.getBlock().getWorld());
|
||||||
@ -275,7 +276,7 @@ public void onBlockFromTo(BlockFromToEvent event) {
|
|||||||
if (wcfg.preventWaterDamage.size() > 0) {
|
if (wcfg.preventWaterDamage.size() > 0) {
|
||||||
int targetId = blockTo.getTypeId();
|
int targetId = blockTo.getTypeId();
|
||||||
|
|
||||||
if ((blockFrom.getTypeId() == 0 || isWater) &&
|
if ((isAir || isWater) &&
|
||||||
wcfg.preventWaterDamage.contains(targetId)) {
|
wcfg.preventWaterDamage.contains(targetId)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
@ -304,6 +305,12 @@ public void onBlockFromTo(BlockFromToEvent event) {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (wcfg.disableObsidianGenerators && (isAir || isLava)
|
||||||
|
&& blockTo.getTypeId() == 55) {
|
||||||
|
blockTo.setTypeId(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user