Add config option for mask type
This commit is contained in:
parent
8796252c95
commit
3ee4ab1e73
@ -1,5 +1,6 @@
|
|||||||
package com.boydti.fawe.regions;
|
package com.boydti.fawe.regions;
|
||||||
|
|
||||||
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.object.FawePlayer;
|
import com.boydti.fawe.object.FawePlayer;
|
||||||
import com.boydti.fawe.regions.general.RegionFilter;
|
import com.boydti.fawe.regions.general.RegionFilter;
|
||||||
|
|
||||||
@ -8,6 +9,16 @@ public abstract class FaweMaskManager<T> {
|
|||||||
public enum MaskType {
|
public enum MaskType {
|
||||||
OWNER,
|
OWNER,
|
||||||
MEMBER
|
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;
|
private final String key;
|
||||||
@ -27,7 +38,7 @@ public abstract class FaweMaskManager<T> {
|
|||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public FaweMask getMask(final FawePlayer<T> player) {
|
public FaweMask getMask(final FawePlayer<T> player) {
|
||||||
return getMask(player, MaskType.MEMBER);
|
return getMask(player, MaskType.getDefaultMaskType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public FaweMask getMask(final FawePlayer<T> player, MaskType type) {
|
public FaweMask getMask(final FawePlayer<T> player, MaskType type) {
|
||||||
|
@ -69,7 +69,7 @@ public class WEManager {
|
|||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public Region[] getMask(final FawePlayer<?> player) {
|
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) {
|
public boolean isIn(int x, int y, int z, Region region) {
|
||||||
@ -131,7 +131,7 @@ public class WEManager {
|
|||||||
for (final FaweMaskManager manager : managers) {
|
for (final FaweMaskManager manager : managers) {
|
||||||
if (player.hasPermission("fawe." + manager.getKey())) {
|
if (player.hasPermission("fawe." + manager.getKey())) {
|
||||||
try {
|
try {
|
||||||
final FaweMask mask = manager.getMask(player, FaweMaskManager.MaskType.MEMBER);
|
final FaweMask mask = manager.getMask(player, FaweMaskManager.MaskType.getDefaultMaskType());
|
||||||
if (mask != null) {
|
if (mask != null) {
|
||||||
regions.add(mask.getRegion());
|
regions.add(mask.getRegion());
|
||||||
masks.add(mask);
|
masks.add(mask);
|
||||||
|
Loading…
Reference in New Issue
Block a user