Added mobs.disable-snowman-trails.

This commit is contained in:
Albert Pham 2013-06-02 13:22:12 -07:00
parent a0d0ff0b92
commit 7e9bd49da2
2 changed files with 29 additions and 2 deletions

View File

@ -161,6 +161,7 @@ public class WorldConfiguration {
public boolean disableMyceliumSpread; public boolean disableMyceliumSpread;
public boolean disableVineGrowth; public boolean disableVineGrowth;
public boolean disableEndermanGriefing; public boolean disableEndermanGriefing;
public boolean disableSnowmanTrails;
public boolean regionInvinciblityRemovesMobs; public boolean regionInvinciblityRemovesMobs;
public boolean disableDeathMessages; public boolean disableDeathMessages;
public boolean disableObsidianGenerators; public boolean disableObsidianGenerators;
@ -353,6 +354,7 @@ private void loadConfiguration() {
blockFireballBlockDamage = getBoolean("mobs.block-fireball-block-damage", false); blockFireballBlockDamage = getBoolean("mobs.block-fireball-block-damage", false);
antiWolfDumbness = getBoolean("mobs.anti-wolf-dumbness", false); antiWolfDumbness = getBoolean("mobs.anti-wolf-dumbness", false);
disableEndermanGriefing = getBoolean("mobs.disable-enderman-griefing", false); disableEndermanGriefing = getBoolean("mobs.disable-enderman-griefing", false);
disableSnowmanTrails = getBoolean("mobs.disable-snowman-trails", false);
blockEntityPaintingDestroy = getBoolean("mobs.block-painting-destroy", false); blockEntityPaintingDestroy = getBoolean("mobs.block-painting-destroy", false);
blockEntityItemFrameDestroy = getBoolean("mobs.block-item-frame-destroy", false); blockEntityItemFrameDestroy = getBoolean("mobs.block-item-frame-destroy", false);
blockPluginSpawning = getBoolean("mobs.block-plugin-spawning", true); blockPluginSpawning = getBoolean("mobs.block-plugin-spawning", true);
@ -583,7 +585,9 @@ public int getMaxRegionCount(Player player) {
for (String group : plugin.getGroups(player)) { for (String group : plugin.getGroups(player)) {
if (maxRegionCounts.containsKey(group)) { if (maxRegionCounts.containsKey(group)) {
int groupMax = maxRegionCounts.get(group); int groupMax = maxRegionCounts.get(group);
if (max < groupMax) max = groupMax; if (max < groupMax) {
max = groupMax;
}
} }
} }
if (max <= -1) { if (max <= -1) {

View File

@ -18,7 +18,7 @@
*/ */
package com.sk89q.worldguard.bukkit; package com.sk89q.worldguard.bukkit;
import static com.sk89q.worldguard.bukkit.BukkitUtil.toVector; import static com.sk89q.worldguard.bukkit.BukkitUtil.*;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
@ -26,6 +26,7 @@
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Snowman;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@ -45,6 +46,7 @@
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.BlockRedstoneEvent; import org.bukkit.event.block.BlockRedstoneEvent;
import org.bukkit.event.block.BlockSpreadEvent; import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.block.EntityBlockFormEvent;
import org.bukkit.event.block.LeavesDecayEvent; import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.block.SignChangeEvent; import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -708,6 +710,27 @@ public void onBlockForm(BlockFormEvent event) {
} }
} }
/*
* Called when a block is formed by an entity.
*/
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onEntityBlockForm(EntityBlockFormEvent event) {
ConfigurationManager cfg = plugin.getGlobalStateManager();
WorldConfiguration wcfg = cfg.get(event.getBlock().getWorld());
if (cfg.activityHaltToggle) {
event.setCancelled(true);
return;
}
if (event.getEntity() instanceof Snowman) {
if (wcfg.disableSnowmanTrails) {
event.setCancelled(true);
return;
}
}
}
/* /*
* Called when a block spreads based on world conditions. * Called when a block spreads based on world conditions.
*/ */