mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-09-06 12:18:09 +02:00
Add entity-painting-destroy flag to prevent entities from destroying paintings
This commit is contained in:
parent
583ea76e4b
commit
fe1e09289f
4
pom.xml
4
pom.xml
@ -40,14 +40,14 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sk89q</groupId>
|
<groupId>com.sk89q</groupId>
|
||||||
<artifactId>worldedit</artifactId>
|
<artifactId>worldedit</artifactId>
|
||||||
<version>5.3-SNAPSHOT</version>
|
<version>5.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Bukkit -->
|
<!-- Bukkit -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>bukkit</artifactId>
|
<artifactId>bukkit</artifactId>
|
||||||
<version>1.1-R6</version>
|
<version>1.2.5-R1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- CommandBook -->
|
<!-- CommandBook -->
|
||||||
|
@ -97,6 +97,7 @@ public class WorldConfiguration {
|
|||||||
public boolean blockEnderDragonBlockDamage;
|
public boolean blockEnderDragonBlockDamage;
|
||||||
public boolean blockFireballExplosions;
|
public boolean blockFireballExplosions;
|
||||||
public boolean blockFireballBlockDamage;
|
public boolean blockFireballBlockDamage;
|
||||||
|
public boolean blockEntityPaintingDestroy;
|
||||||
public boolean disableContactDamage;
|
public boolean disableContactDamage;
|
||||||
public boolean disableFallDamage;
|
public boolean disableFallDamage;
|
||||||
public boolean disableLavaDamage;
|
public boolean disableLavaDamage;
|
||||||
@ -313,6 +314,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);
|
||||||
|
blockEntityPaintingDestroy = getBoolean("mobs.block-painting-destroy", false);
|
||||||
|
|
||||||
disableFallDamage = getBoolean("player-damage.disable-fall-damage", false);
|
disableFallDamage = getBoolean("player-damage.disable-fall-damage", false);
|
||||||
disableLavaDamage = getBoolean("player-damage.disable-lava-damage", false);
|
disableLavaDamage = getBoolean("player-damage.disable-lava-damage", false);
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import com.sk89q.worldedit.blocks.BlockID;
|
import com.sk89q.worldedit.blocks.BlockID;
|
||||||
|
import com.sk89q.worldedit.blocks.ItemID;
|
||||||
import com.sk89q.worldguard.LocalPlayer;
|
import com.sk89q.worldguard.LocalPlayer;
|
||||||
import com.sk89q.worldguard.protection.GlobalRegionManager;
|
import com.sk89q.worldguard.protection.GlobalRegionManager;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -665,29 +666,48 @@ public void onPaintingBreak(PaintingBreakEvent breakEvent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PaintingBreakByEntityEvent event = (PaintingBreakByEntityEvent) breakEvent;
|
PaintingBreakByEntityEvent event = (PaintingBreakByEntityEvent) breakEvent;
|
||||||
if (!(event.getRemover() instanceof Player)) {
|
Painting painting = event.getPainting();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Painting painting= event.getPainting();
|
|
||||||
Player player = (Player) event.getRemover();
|
|
||||||
World world = painting.getWorld();
|
World world = painting.getWorld();
|
||||||
|
|
||||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||||
WorldConfiguration wcfg = cfg.get(world);
|
WorldConfiguration wcfg = cfg.get(world);
|
||||||
|
|
||||||
if (wcfg.getBlacklist() != null) {
|
if (event.getRemover() instanceof Player) {
|
||||||
if (!wcfg.getBlacklist().check(
|
Player player = (Player) event.getRemover();
|
||||||
new BlockBreakBlacklistEvent(plugin.wrapPlayer(player),
|
|
||||||
toVector(player.getLocation()), 321), false, false)) {
|
|
||||||
|
if (wcfg.getBlacklist() != null) {
|
||||||
|
if (!wcfg.getBlacklist().check(
|
||||||
|
new BlockBreakBlacklistEvent(plugin.wrapPlayer(player),
|
||||||
|
toVector(player.getLocation()), ItemID.PAINTING), false, false)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wcfg.useRegions) {
|
||||||
|
if (!plugin.getGlobalRegionManager().canBuild(player, painting.getLocation())) {
|
||||||
|
player.sendMessage(ChatColor.DARK_RED + "You don't have permission for this area.");
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (event.getRemover() instanceof Creeper) {
|
||||||
|
if (wcfg.blockCreeperBlockDamage || wcfg.blockCreeperExplosions) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (wcfg.useRegions && !plugin.getGlobalRegionManager().allows(DefaultFlag.CREEPER_EXPLOSION, painting.getLocation())) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wcfg.blockEntityPaintingDestroy) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
if (wcfg.useRegions && !plugin.getGlobalRegionManager().allows(DefaultFlag.ENTITY_PAINTING_DESTROY, painting.getLocation())) {
|
||||||
|
|
||||||
if (wcfg.useRegions) {
|
|
||||||
if (!plugin.getGlobalRegionManager().canBuild(player, painting.getLocation())) {
|
|
||||||
player.sendMessage(ChatColor.DARK_RED + "You don't have permission for this area.");
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -706,7 +726,7 @@ public void onPaintingPlace(PaintingPlaceEvent event) {
|
|||||||
if (wcfg.getBlacklist() != null) {
|
if (wcfg.getBlacklist() != null) {
|
||||||
if (!wcfg.getBlacklist().check(
|
if (!wcfg.getBlacklist().check(
|
||||||
new ItemUseBlacklistEvent(plugin.wrapPlayer(player),
|
new ItemUseBlacklistEvent(plugin.wrapPlayer(player),
|
||||||
toVector(player.getLocation()), 321), false, false)) {
|
toVector(player.getLocation()), ItemID.PAINTING), false, false)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,7 @@ public final class DefaultFlag {
|
|||||||
public static final StateFlag EXP_DROPS = new StateFlag("exp-drops", true, RegionGroup.ALL);
|
public static final StateFlag EXP_DROPS = new StateFlag("exp-drops", true, RegionGroup.ALL);
|
||||||
public static final StateFlag ENTRY = new StateFlag("entry", true);
|
public static final StateFlag ENTRY = new StateFlag("entry", true);
|
||||||
public static final StateFlag EXIT = new StateFlag("exit", true);
|
public static final StateFlag EXIT = new StateFlag("exit", true);
|
||||||
|
public static final StateFlag ENTITY_PAINTING_DESTROY = new StateFlag("entity-painting-destroy", true);
|
||||||
public static final StateFlag POTION_SPLASH = new StateFlag("potion-splash", true);
|
public static final StateFlag POTION_SPLASH = new StateFlag("potion-splash", true);
|
||||||
public static final StringFlag GREET_MESSAGE = new StringFlag("greeting", RegionGroup.ALL);
|
public static final StringFlag GREET_MESSAGE = new StringFlag("greeting", RegionGroup.ALL);
|
||||||
public static final StringFlag FAREWELL_MESSAGE = new StringFlag("farewell", RegionGroup.ALL);
|
public static final StringFlag FAREWELL_MESSAGE = new StringFlag("farewell", RegionGroup.ALL);
|
||||||
@ -88,7 +89,7 @@ public final class DefaultFlag {
|
|||||||
MOB_DAMAGE, MOB_SPAWNING, DENY_SPAWN, INVINCIBILITY, EXP_DROPS,
|
MOB_DAMAGE, MOB_SPAWNING, DENY_SPAWN, INVINCIBILITY, EXP_DROPS,
|
||||||
CREEPER_EXPLOSION, ENDERDRAGON_BLOCK_DAMAGE, GHAST_FIREBALL, ENDER_BUILD,
|
CREEPER_EXPLOSION, ENDERDRAGON_BLOCK_DAMAGE, GHAST_FIREBALL, ENDER_BUILD,
|
||||||
GREET_MESSAGE, FAREWELL_MESSAGE, NOTIFY_ENTER, NOTIFY_LEAVE,
|
GREET_MESSAGE, FAREWELL_MESSAGE, NOTIFY_ENTER, NOTIFY_LEAVE,
|
||||||
EXIT, ENTRY, LIGHTNING,
|
EXIT, ENTRY, LIGHTNING, ENTITY_PAINTING_DESTROY,
|
||||||
HEAL_AMOUNT, HEAL_DELAY, MIN_HEAL, MAX_HEAL,
|
HEAL_AMOUNT, HEAL_DELAY, MIN_HEAL, MAX_HEAL,
|
||||||
FEED_DELAY, FEED_AMOUNT, MIN_FOOD, MAX_FOOD,
|
FEED_DELAY, FEED_AMOUNT, MIN_FOOD, MAX_FOOD,
|
||||||
SNOW_FALL, SNOW_MELT, ICE_FORM, ICE_MELT,
|
SNOW_FALL, SNOW_MELT, ICE_FORM, ICE_MELT,
|
||||||
|
Loading…
Reference in New Issue
Block a user