From 3ee4ab1e73cc373244e16ec40fc88177aa6fb6ff Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sat, 7 Jul 2018 10:07:31 +1000 Subject: [PATCH] Add config option for mask type --- .../com/boydti/fawe/regions/FaweMaskManager.java | 13 ++++++++++++- .../main/java/com/boydti/fawe/util/WEManager.java | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/boydti/fawe/regions/FaweMaskManager.java b/core/src/main/java/com/boydti/fawe/regions/FaweMaskManager.java index be506a3a..48a42d74 100644 --- a/core/src/main/java/com/boydti/fawe/regions/FaweMaskManager.java +++ b/core/src/main/java/com/boydti/fawe/regions/FaweMaskManager.java @@ -1,5 +1,6 @@ package com.boydti.fawe.regions; +import com.boydti.fawe.config.Settings; import com.boydti.fawe.object.FawePlayer; import com.boydti.fawe.regions.general.RegionFilter; @@ -8,6 +9,16 @@ public abstract class FaweMaskManager { public enum MaskType { OWNER, MEMBER + + ; + + public static MaskType getDefaultMaskType() { + try { + return MaskType.valueOf(Settings.IMP.REGION_RESTRICTIONS_OPTIONS.MODE.toUpperCase()); + } catch (Exception ignore) { + return MEMBER; + } + } } private final String key; @@ -27,7 +38,7 @@ public abstract class FaweMaskManager { @Deprecated public FaweMask getMask(final FawePlayer player) { - return getMask(player, MaskType.MEMBER); + return getMask(player, MaskType.getDefaultMaskType()); } public FaweMask getMask(final FawePlayer player, MaskType type) { diff --git a/core/src/main/java/com/boydti/fawe/util/WEManager.java b/core/src/main/java/com/boydti/fawe/util/WEManager.java index 7a54591f..9d34e076 100644 --- a/core/src/main/java/com/boydti/fawe/util/WEManager.java +++ b/core/src/main/java/com/boydti/fawe/util/WEManager.java @@ -69,7 +69,7 @@ public class WEManager { @Deprecated public Region[] getMask(final FawePlayer player) { - return getMask(player, FaweMaskManager.MaskType.MEMBER); + return getMask(player, FaweMaskManager.MaskType.getDefaultMaskType()); } public boolean isIn(int x, int y, int z, Region region) { @@ -131,7 +131,7 @@ public class WEManager { for (final FaweMaskManager manager : managers) { if (player.hasPermission("fawe." + manager.getKey())) { try { - final FaweMask mask = manager.getMask(player, FaweMaskManager.MaskType.MEMBER); + final FaweMask mask = manager.getMask(player, FaweMaskManager.MaskType.getDefaultMaskType()); if (mask != null) { regions.add(mask.getRegion()); masks.add(mask);