mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-02-17 04:41:32 +01:00
Create a config option to enable portal protection.
Protection is off by default. Third-party portal plugins such as MV-NP may interfere with portal protection and cause problems. Fixes WORLDGUARD-3498.
This commit is contained in:
parent
2d28e8db6d
commit
5ff8b37ae8
@ -174,6 +174,7 @@ public class WorldConfiguration {
|
||||
public boolean disableSoilDehydration;
|
||||
public Set<Integer> allowedSnowFallOver;
|
||||
public boolean regionInvinciblityRemovesMobs;
|
||||
public boolean regionNetherPortalProtection;
|
||||
public boolean fakePlayerBuildOverride;
|
||||
public boolean explosionFlagCancellation;
|
||||
public boolean disableDeathMessages;
|
||||
@ -453,6 +454,7 @@ private void loadConfiguration() {
|
||||
|
||||
useRegions = getBoolean("regions.enable", true);
|
||||
regionInvinciblityRemovesMobs = getBoolean("regions.invincibility-removes-mobs", false);
|
||||
regionNetherPortalProtection = getBoolean("region.nether-portal-protection", false);
|
||||
fakePlayerBuildOverride = getBoolean("regions.fake-player-build-override", true);
|
||||
explosionFlagCancellation = getBoolean("regions.explosion-flags-block-entity-damage", true);
|
||||
highFreqFlags = getBoolean("regions.high-frequency-flags", false);
|
||||
|
@ -372,6 +372,9 @@ public void onPlayerTeleport(PlayerTeleportEvent event) {
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
|
||||
public void onPlayerPortal(PlayerPortalEvent event) {
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
WorldConfiguration wcfg = cfg.get(event.getTo().getWorld());
|
||||
if (!wcfg.regionNetherPortalProtection) return;
|
||||
if (event.getCause() != TeleportCause.NETHER_PORTAL) {
|
||||
return;
|
||||
}
|
||||
@ -398,8 +401,6 @@ public void onPlayerPortal(PlayerPortalEvent event) {
|
||||
World world = event.getTo().getWorld();
|
||||
|
||||
ProtectedRegion check = new ProtectedCuboidRegion("__portalcheck__", BukkitUtil.toVector(min.getBlock()), BukkitUtil.toVector(max.getBlock()));
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
WorldConfiguration wcfg = cfg.get(world);
|
||||
|
||||
if (wcfg.useRegions && !plugin.getGlobalRegionManager().hasBypass(event.getPlayer(), world)) {
|
||||
ApplicableRegionSet set = plugin.getRegionContainer().get(event.getTo().getWorld()).getApplicableRegions(check);
|
||||
|
Loading…
Reference in New Issue
Block a user