Compare commits

..
8 Commits
7 changed files with 145 additions and 84 deletions

No files matched your search

+10
View File
@@ -1,3 +1,13 @@
5.6.1:
- Added a mycelium-spread region flag.
- Added a dynamics.disable-mycelium-spread configuration setting.
- Added new gameplay.block-potions option. For example:
gameplay:
block-potions: [invisibility, speed]
- Fixed a bug in the entity explosion event handler that caused a NullPointerException.
Thank you for gabizou for his contribution in this release.
5.6:
- Added official support for Minecraft 1.4. Support for 1.3.2 (and below) is still
provided in this release.
+2 -2
View File
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.sk89q</groupId>
<artifactId>worldguard</artifactId>
<version>5.6</version>
<version>5.6.1</version>
<name>WorldGuard</name>
<description>WorldGuard protects your Minecraft servers.</description>
<licenses>
@@ -46,7 +46,7 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.4.2-R0.2-SNAPSHOT</version>
<version>1.4.2-R0.3-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
@@ -31,6 +31,7 @@ import com.sk89q.worldguard.chest.SignChestProtection;
import org.bukkit.block.Block;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
import java.io.File;
import java.io.FileNotFoundException;
@@ -74,6 +75,7 @@ public class WorldConfiguration {
public boolean simulateSponge;
public int spongeRadius;
public boolean disableExpDrops;
public Set<PotionEffectType> blockPotions;
public boolean pumpkinScuba;
public boolean redstoneSponges;
public boolean noPhysicsGravel;
@@ -143,6 +145,7 @@ public class WorldConfiguration {
public boolean disableIceFormation;
public boolean disableLeafDecay;
public boolean disableGrassGrowth;
public boolean disableMyceliumSpread;
public boolean disableEndermanGriefing;
public boolean regionInvinciblityRemovesMobs;
public boolean disableDeathMessages;
@@ -287,6 +290,17 @@ public class WorldConfiguration {
disableExpDrops = getBoolean("protection.disable-xp-orb-drops", false);
disableObsidianGenerators = getBoolean("protection.disable-obsidian-generators", false);
blockPotions = new HashSet<PotionEffectType>();
for (String potionName : getStringList("gameplay.block-potions", null)) {
PotionEffectType effect = PotionEffectType.getByName(potionName);
if (effect == null) {
plugin.getLogger().warning("Unknown potion effect type '" + potionName + "'");
} else {
blockPotions.add(effect);
}
}
simulateSponge = getBoolean("simulation.sponge.enable", true);
spongeRadius = Math.max(1, getInt("simulation.sponge.radius", 3)) - 1;
redstoneSponges = getBoolean("simulation.sponge.redstone", false);
@@ -359,6 +373,7 @@ public class WorldConfiguration {
disableIceFormation = getBoolean("dynamics.disable-ice-formation", false);
disableLeafDecay = getBoolean("dynamics.disable-leaf-decay", false);
disableGrassGrowth = getBoolean("dynamics.disable-grass-growth", false);
disableMyceliumSpread = getBoolean("dynamics.disable-mycelium-spread", false);
useRegions = getBoolean("regions.enable", true);
regionInvinciblityRemovesMobs = getBoolean("regions.invincibility-removes-mobs", false);
@@ -726,6 +726,20 @@ public class WorldGuardBlockListener implements Listener {
return;
}
}
if (fromType == BlockID.MYCELIUM) {
if (wcfg.disableMyceliumSpread) {
event.setCancelled(true);
return;
}
if (wcfg.useRegions
&& !plugin.getGlobalRegionManager().allows(
DefaultFlag.MYCELIUM_SPREAD, event.getBlock().getLocation())) {
event.setCancelled(true);
return;
}
}
}
/*
@@ -496,108 +496,111 @@ public class WorldGuardEntityListener implements Listener {
return;
}
if (ent.getType() == witherType) {
if (wcfg.blockWitherBlockDamage) {
event.blockList().clear();
return;
// Not all explosions come from an entity
if (ent != null) {
if (ent.getType() == witherType) {
if (wcfg.blockWitherBlockDamage) {
event.blockList().clear();
return;
}
if (wcfg.blockWitherExplosions) {
event.setCancelled(true);
return;
}
}
if (wcfg.blockWitherExplosions) {
event.setCancelled(true);
return;
}
}
if (ent.getType() == witherSkullType) {
if (wcfg.blockWitherSkullBlockDamage) {
event.blockList().clear();
return;
}
if (ent.getType() == witherSkullType) {
if (wcfg.blockWitherSkullBlockDamage) {
event.blockList().clear();
return;
if (wcfg.blockWitherSkullExplosions) {
event.setCancelled(true);
return;
}
}
if (wcfg.blockWitherSkullExplosions) {
event.setCancelled(true);
return;
}
}
if (ent instanceof Creeper) {
if (wcfg.blockCreeperBlockDamage) {
event.blockList().clear();
return;
}
if (ent instanceof Creeper) {
if (wcfg.blockCreeperBlockDamage) {
event.blockList().clear();
return;
}
if (wcfg.blockCreeperExplosions) {
event.setCancelled(true);
return;
}
if (wcfg.blockCreeperExplosions) {
event.setCancelled(true);
return;
}
if (wcfg.useRegions) {
if (wcfg.useRegions) {
RegionManager mgr = plugin.getGlobalRegionManager().get(world);
for (Block block : event.blockList()) {
if (!mgr.getApplicableRegions(toVector(block)).allows(DefaultFlag.CREEPER_EXPLOSION)) {
event.blockList().clear();
return;
}
}
}
}
} else if (ent instanceof EnderDragon) {
if (wcfg.blockEnderDragonBlockDamage) {
event.blockList().clear();
return;
}
if (wcfg.useRegions) {
if (wcfg.useRegions) {
RegionManager mgr = plugin.getGlobalRegionManager().get(world);
for (Block block : event.blockList()) {
if (!mgr.getApplicableRegions(toVector(block)).allows(DefaultFlag.CREEPER_EXPLOSION)) {
if (!mgr.getApplicableRegions(toVector(block)).allows(DefaultFlag.ENDERDRAGON_BLOCK_DAMAGE)) {
event.blockList().clear();
return;
}
}
}
}
} else if (ent instanceof EnderDragon) {
if (wcfg.blockEnderDragonBlockDamage) {
event.blockList().clear();
return;
}
} else if (ent instanceof TNTPrimed) {
if (wcfg.blockTNTBlockDamage) {
event.blockList().clear();
return;
}
if (wcfg.useRegions) {
RegionManager mgr = plugin.getGlobalRegionManager().get(world);
if (wcfg.blockTNTExplosions) {
event.setCancelled(true);
return;
}
for (Block block : event.blockList()) {
if (!mgr.getApplicableRegions(toVector(block)).allows(DefaultFlag.ENDERDRAGON_BLOCK_DAMAGE)) {
event.blockList().clear();
return;
if (wcfg.useRegions) {
RegionManager mgr = plugin.getGlobalRegionManager().get(world);
for (Block block : event.blockList()) {
if (!mgr.getApplicableRegions(toVector(block)).allows(DefaultFlag.TNT)) {
event.blockList().clear();
return;
}
}
}
}
} else if (ent instanceof TNTPrimed) {
if (wcfg.blockTNTBlockDamage) {
event.blockList().clear();
return;
}
if (wcfg.blockTNTExplosions) {
event.setCancelled(true);
return;
}
if (wcfg.useRegions) {
RegionManager mgr = plugin.getGlobalRegionManager().get(world);
for (Block block : event.blockList()) {
if (!mgr.getApplicableRegions(toVector(block)).allows(DefaultFlag.TNT)) {
event.blockList().clear();
return;
}
} else if (ent instanceof Fireball) {
if (wcfg.blockFireballBlockDamage) {
event.blockList().clear();
return;
}
}
} else if (ent instanceof Fireball) {
if (wcfg.blockFireballBlockDamage) {
event.blockList().clear();
return;
}
if (wcfg.blockFireballExplosions) {
event.setCancelled(true);
return;
}
if (wcfg.blockFireballExplosions) {
event.setCancelled(true);
return;
}
if (wcfg.useRegions) {
RegionManager mgr = plugin.getGlobalRegionManager().get(world);
if (wcfg.useRegions) {
RegionManager mgr = plugin.getGlobalRegionManager().get(world);
for (Block block : event.blockList()) {
if (!mgr.getApplicableRegions(toVector(block)).allows(DefaultFlag.GHAST_FIREBALL)) {
event.blockList().clear();
return;
for (Block block : event.blockList()) {
if (!mgr.getApplicableRegions(toVector(block)).allows(DefaultFlag.GHAST_FIREBALL)) {
event.blockList().clear();
return;
}
}
}
}
@@ -628,7 +631,7 @@ public class WorldGuardEntityListener implements Listener {
event.setCancelled(true);
return;
}
if (event.getEntityType() == witherType) {
if (wcfg.blockWitherExplosions) {
event.setCancelled(true);
@@ -788,7 +791,7 @@ public class WorldGuardEntityListener implements Listener {
} else if (ent.getType() == witherType) {
ConfigurationManager cfg = plugin.getGlobalStateManager();
WorldConfiguration wcfg = cfg.get(ent.getWorld());
if (wcfg.blockWitherBlockDamage || wcfg.blockWitherExplosions) {
event.setCancelled(true);
return;
@@ -27,6 +27,7 @@ import com.sk89q.worldedit.blocks.ItemID;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
@@ -54,7 +55,8 @@ import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.PluginManager;
import org.bukkit.potion.Potion;
import org.bukkit.potion.PotionEffect;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BlockType;
import com.sk89q.worldguard.LocalPlayer;
@@ -420,6 +422,22 @@ public class WorldGuardPlayerListener implements Listener {
player.sendMessage(ChatColor.RED + "Infinite stack removed.");
}
}
if (wcfg.blockPotions.size() > 0
&& !plugin.hasPermission(player, "worldguard.override.potions")) {
ItemStack item = event.getItem();
if (item.getType() == Material.POTION) {
Potion potion = Potion.fromItemStack(item);
for (PotionEffect effect : potion.getEffects()) {
if (wcfg.blockPotions.contains(effect.getType())) {
player.sendMessage(ChatColor.RED + "Sorry, potions with "
+ effect.getType().getName() + " are presently disabled.");
event.setUseItemInHand(Result.DENY);
break;
}
}
}
}
}
/**
@@ -57,6 +57,7 @@ public final class DefaultFlag {
public static final StateFlag MUSHROOMS = new StateFlag("mushroom-growth", true);
public static final StateFlag LEAF_DECAY = new StateFlag("leaf-decay", true);
public static final StateFlag GRASS_SPREAD = new StateFlag("grass-growth", true);
public static final StateFlag MYCELIUM_SPREAD = new StateFlag("mycelium-spread", true);
public static final StateFlag ENDER_BUILD = new StateFlag("enderman-grief", true);
public static final StateFlag INVINCIBILITY = new StateFlag("invincible", false, RegionGroup.ALL);
public static final StateFlag EXP_DROPS = new StateFlag("exp-drops", true, RegionGroup.ALL);
@@ -100,8 +101,8 @@ public final class DefaultFlag {
HEAL_AMOUNT, HEAL_DELAY, MIN_HEAL, MAX_HEAL,
FEED_DELAY, FEED_AMOUNT, MIN_FOOD, MAX_FOOD,
SNOW_FALL, SNOW_MELT, ICE_FORM, ICE_MELT, GAME_MODE,
MUSHROOMS, LEAF_DECAY, GRASS_SPREAD, SEND_CHAT, RECEIVE_CHAT,
FIRE_SPREAD, LAVA_FIRE, LAVA_FLOW, WATER_FLOW,
MUSHROOMS, LEAF_DECAY, GRASS_SPREAD, MYCELIUM_SPREAD, SEND_CHAT,
RECEIVE_CHAT, FIRE_SPREAD, LAVA_FIRE, LAVA_FLOW, WATER_FLOW,
TELE_LOC, SPAWN_LOC, POTION_SPLASH,
BLOCKED_CMDS, ALLOWED_CMDS, PRICE, BUYABLE,
};