Added protection.disable-obsidian-generators option

This commit is contained in:
Eric Puidokas 2011-09-27 09:50:46 -07:00 committed by Wizjany
parent b4f2188f72
commit ef8eb76b16
2 changed files with 10 additions and 1 deletions

View File

@ -152,6 +152,7 @@ public class WorldConfiguration {
public boolean disableEndermanGriefing;
public boolean regionInvinciblityRemovesMobs;
public boolean disableDeathMessages;
public boolean disableObsidianGenerators;
/* Configuration data end */
@ -259,6 +260,7 @@ private void loadConfiguration() {
itemDurability = getBoolean("protection.item-durability", true);
removeInfiniteStacks = getBoolean("protection.remove-infinite-stacks", false);
disableExpDrops = getBoolean("protection.disable-xp-orb-drops", false);
disableObsidianGenerators = getBoolean("protection.disable-obsidian-generators", false);
// classicWater = getBoolean("simulation.classic-water", false);
simulateSponge = getBoolean("simulation.sponge.enable", true);

View File

@ -231,6 +231,7 @@ public void onBlockFromTo(BlockFromToEvent event) {
boolean isWater = blockFrom.getTypeId() == 8 || blockFrom.getTypeId() == 9;
boolean isLava = blockFrom.getTypeId() == 10 || blockFrom.getTypeId() == 11;
boolean isAir = blockFrom.getTypeId() == 0;
ConfigurationManager cfg = plugin.getGlobalStateManager();
WorldConfiguration wcfg = cfg.get(event.getBlock().getWorld());
@ -275,7 +276,7 @@ public void onBlockFromTo(BlockFromToEvent event) {
if (wcfg.preventWaterDamage.size() > 0) {
int targetId = blockTo.getTypeId();
if ((blockFrom.getTypeId() == 0 || isWater) &&
if ((isAir || isWater) &&
wcfg.preventWaterDamage.contains(targetId)) {
event.setCancelled(true);
return;
@ -304,6 +305,12 @@ public void onBlockFromTo(BlockFromToEvent event) {
event.setCancelled(true);
return;
}
if (wcfg.disableObsidianGenerators && (isAir || isLava)
&& blockTo.getTypeId() == 55) {
blockTo.setTypeId(0);
return;
}
}
/**