mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-10-03 09:07:29 +02:00
Implements WORLDGUARD-2315 Enderdragon portal blocking
This commit is contained in:
parent
2e7ecc59c0
commit
0b3c40dc3e
@ -18,6 +18,15 @@
|
|||||||
*/
|
*/
|
||||||
package com.sk89q.worldguard.bukkit;
|
package com.sk89q.worldguard.bukkit;
|
||||||
|
|
||||||
|
import com.sk89q.commandbook.CommandBook;
|
||||||
|
import com.sk89q.commandbook.GodComponent;
|
||||||
|
import com.sk89q.util.yaml.YAMLFormat;
|
||||||
|
import com.sk89q.util.yaml.YAMLProcessor;
|
||||||
|
import com.sk89q.worldguard.LocalPlayer;
|
||||||
|
import com.sk89q.worldguard.blacklist.Blacklist;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -27,16 +36,6 @@
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
|
||||||
import com.sk89q.commandbook.CommandBook;
|
|
||||||
import com.sk89q.commandbook.GodComponent;
|
|
||||||
import com.sk89q.util.yaml.YAMLFormat;
|
|
||||||
import com.sk89q.util.yaml.YAMLProcessor;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.sk89q.worldguard.LocalPlayer;
|
|
||||||
import com.sk89q.worldguard.blacklist.Blacklist;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the global configuration and also delegates configuration
|
* Represents the global configuration and also delegates configuration
|
||||||
* for individual worlds.
|
* for individual worlds.
|
||||||
@ -140,20 +139,14 @@ public void load() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
config.removeProperty("suppress-tick-sync-warnings");
|
config.removeProperty("suppress-tick-sync-warnings");
|
||||||
useRegionsScheduler = config.getBoolean(
|
useRegionsScheduler = config.getBoolean("regions.use-scheduler", true);
|
||||||
"regions.use-scheduler", true);
|
useRegionsCreatureSpawnEvent = config.getBoolean("regions.use-creature-spawn-event", true);
|
||||||
useRegionsCreatureSpawnEvent = config.getBoolean(
|
autoGodMode = config.getBoolean("auto-invincible", config.getBoolean("auto-invincible-permission", false));
|
||||||
"regions.use-creature-spawn-event", true);
|
|
||||||
autoGodMode = config.getBoolean(
|
|
||||||
"auto-invincible", config.getBoolean("auto-invincible-permission", false));
|
|
||||||
config.removeProperty("auto-invincible-permission");
|
config.removeProperty("auto-invincible-permission");
|
||||||
usePlayerMove = config.getBoolean(
|
usePlayerMove = config.getBoolean("use-player-move-event", true);
|
||||||
"use-player-move-event", true);
|
|
||||||
|
|
||||||
deopOnJoin = config.getBoolean(
|
deopOnJoin = config.getBoolean("security.deop-everyone-on-join", false);
|
||||||
"security.deop-everyone-on-join", false);
|
blockInGameOp = config.getBoolean("security.block-in-game-op-command", false);
|
||||||
blockInGameOp = config.getBoolean(
|
|
||||||
"security.block-in-game-op-command", false);
|
|
||||||
|
|
||||||
hostKeys = new HashMap<String, String>();
|
hostKeys = new HashMap<String, String>();
|
||||||
Object hostKeysRaw = config.getProperty("host-keys");
|
Object hostKeysRaw = config.getProperty("host-keys");
|
||||||
|
@ -98,6 +98,7 @@ public class WorldConfiguration {
|
|||||||
public boolean blockWitherSkullExplosions;
|
public boolean blockWitherSkullExplosions;
|
||||||
public boolean blockWitherSkullBlockDamage;
|
public boolean blockWitherSkullBlockDamage;
|
||||||
public boolean blockEnderDragonBlockDamage;
|
public boolean blockEnderDragonBlockDamage;
|
||||||
|
public boolean blockEnderDragonPortalCreation;
|
||||||
public boolean blockFireballExplosions;
|
public boolean blockFireballExplosions;
|
||||||
public boolean blockFireballBlockDamage;
|
public boolean blockFireballBlockDamage;
|
||||||
public boolean blockEntityPaintingDestroy;
|
public boolean blockEntityPaintingDestroy;
|
||||||
@ -334,6 +335,7 @@ private void loadConfiguration() {
|
|||||||
blockWitherSkullExplosions = getBoolean("mobs.block-wither-skull-explosions", false);
|
blockWitherSkullExplosions = getBoolean("mobs.block-wither-skull-explosions", false);
|
||||||
blockWitherSkullBlockDamage = getBoolean("mobs.block-wither-skull-block-damage", false);
|
blockWitherSkullBlockDamage = getBoolean("mobs.block-wither-skull-block-damage", false);
|
||||||
blockEnderDragonBlockDamage = getBoolean("mobs.block-enderdragon-block-damage", false);
|
blockEnderDragonBlockDamage = getBoolean("mobs.block-enderdragon-block-damage", false);
|
||||||
|
blockEnderDragonPortalCreation = getBoolean("mobs.block-enderdragon-portal-creation", false);
|
||||||
blockFireballExplosions = getBoolean("mobs.block-fireball-explosions", false);
|
blockFireballExplosions = getBoolean("mobs.block-fireball-explosions", false);
|
||||||
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);
|
||||||
|
@ -27,10 +27,7 @@
|
|||||||
import com.sk89q.worldguard.protection.events.DisallowedPVPEvent;
|
import com.sk89q.worldguard.protection.events.DisallowedPVPEvent;
|
||||||
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
||||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.*;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -688,6 +685,18 @@ public void onCreatureSpawn(CreatureSpawnEvent event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||||
|
public void onCreatePortal(EntityCreatePortalEvent event) {
|
||||||
|
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||||
|
WorldConfiguration wcfg = cfg.get(event.getEntity().getWorld());
|
||||||
|
|
||||||
|
switch (event.getEntityType()) {
|
||||||
|
case ENDER_DRAGON:
|
||||||
|
if (wcfg.blockEnderDragonBlockDamage) event.setCancelled(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||||
public void onPigZap(PigZapEvent event) {
|
public void onPigZap(PigZapEvent event) {
|
||||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||||
|
Loading…
Reference in New Issue
Block a user