Updated Code I forgot to commit
This commit is contained in:
@@ -221,7 +221,7 @@ public class Conf {
|
||||
/// This defines a set of materials which should always be allowed to use, regardless of factions permissions.
|
||||
/// Useful for HCF features.
|
||||
/// </summary>
|
||||
public static Set<Material> territoryBypasssProtectedMaterials = EnumSet.noneOf(Material.class);
|
||||
public static Set<Material> territoryBypassProtectedMaterials = EnumSet.noneOf(Material.class);
|
||||
|
||||
// Economy settings
|
||||
public static boolean econEnabled = false;
|
||||
@@ -325,6 +325,7 @@ public class Conf {
|
||||
// mainly for other plugins/mods that use a fake player to take actions, which shouldn't be subject to our protections
|
||||
public static Set<String> playersWhoBypassAllProtection = new LinkedHashSet<>();
|
||||
|
||||
public static boolean useWorldConfigurationsAsWhitelist = false;
|
||||
public static Set<String> worldsNoClaiming = new LinkedHashSet<>();
|
||||
public static Set<String> worldsNoPowerLoss = new LinkedHashSet<>();
|
||||
public static Set<String> worldsIgnorePvP = new LinkedHashSet<>();
|
||||
@@ -343,9 +344,7 @@ public class Conf {
|
||||
|
||||
|
||||
// Default Options - Is this even shown on the Conf.json?
|
||||
public static boolean useCustomDefaultPermissions = false;
|
||||
public static boolean usePermissionHints = false;
|
||||
public static HashMap<String, DefaultPermissions> defaultFactionPermissions = new HashMap<>();
|
||||
public static transient HashMap<String, DefaultPermissions> defaultFactionPermissions = new HashMap<>();
|
||||
// Custom Ranks - Oof I forgot I was doing this _SvenjaReissaus_
|
||||
//public static boolean enableCustomRanks = false; // We will disable it by default to avoid any migration error
|
||||
//public static int maxCustomRanks = 2; // Setting this to -1 will allow unlimited custom ranks
|
||||
@@ -369,7 +368,7 @@ public class Conf {
|
||||
territoryProtectedMaterials.add(Material.BEACON);
|
||||
|
||||
// Config is not loading if value is empty ???
|
||||
territoryBypasssProtectedMaterials.add(Material.COOKIE);
|
||||
territoryBypassProtectedMaterials.add(Material.COOKIE);
|
||||
|
||||
territoryDenyUseageMaterials.add(SaberFactions.plugin.FIREBALL);
|
||||
territoryDenyUseageMaterials.add(Material.FLINT_AND_STEEL);
|
||||
|
||||
@@ -117,11 +117,6 @@ public class CmdCreate extends FCommand {
|
||||
|
||||
fme.setCooldown("create", System.currentTimeMillis() + (SaberFactions.plugin.getConfig().getInt("fcooldowns.f-create") * 1000));
|
||||
|
||||
if (Conf.useCustomDefaultPermissions) {
|
||||
faction.setDefaultPerms();
|
||||
if (Conf.usePermissionHints)
|
||||
this.fme.msg(TL.COMMAND_HINT_PERMISSION);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -65,7 +65,7 @@ public class CmdDisband extends FCommand {
|
||||
}
|
||||
|
||||
|
||||
if (!fme.isAdminBypassing()) {
|
||||
if (fme != null && !fme.isAdminBypassing()) {
|
||||
Access access = faction.getAccess(fme, PermissableAction.DISBAND);
|
||||
if (fme.getRole() != Role.LEADER && faction.getFPlayerLeader() != fme && access != Access.ALLOW) {
|
||||
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "disband " + faction.getTag());
|
||||
@@ -84,7 +84,7 @@ public class CmdDisband extends FCommand {
|
||||
|
||||
// check for tnt before disbanding.
|
||||
|
||||
if (!disbandMap.containsKey(me.getUniqueId().toString()) && faction.getTnt() > 0) {
|
||||
if ((fme!= null && !disbandMap.containsKey(me.getUniqueId().toString())) && faction.getTnt() > 0) {
|
||||
msg(TL.COMMAND_DISBAND_CONFIRM.toString().replace("{tnt}", faction.getTnt() + ""));
|
||||
disbandMap.put(me.getUniqueId().toString(), faction.getId());
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(SaberFactions.plugin, () -> disbandMap.remove(me.getUniqueId().toString()), 200L);
|
||||
|
||||
@@ -642,8 +642,8 @@ public class FactionsPlayerListener implements Listener {
|
||||
Block block = event.getClickedBlock();
|
||||
Player player = event.getPlayer();
|
||||
// Check if the material is bypassing protection
|
||||
if (Conf.territoryBypasssProtectedMaterials.contains(block.getType())) return;
|
||||
if (block == null) return; // clicked in air, apparently
|
||||
if (Conf.territoryBypassProtectedMaterials.contains(block.getType())) return;
|
||||
if (GetPermissionFromUsableBlock(event.getClickedBlock().getType()) != null) {
|
||||
if (!canPlayerUseBlock(player, block, false)) {
|
||||
event.setCancelled(true);
|
||||
|
||||
@@ -790,7 +790,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
error = SaberFactions.plugin.txt.parse(TL.CLAIM_PROTECTED.toString());
|
||||
} else if (flocation.isOutsideWorldBorder(SaberFactions.plugin.getConfig().getInt("world-border.buffer", 0))) {
|
||||
error = SaberFactions.plugin.txt.parse(TL.CLAIM_OUTSIDEWORLDBORDER.toString());
|
||||
} else if (Conf.worldsNoClaiming.contains(flocation.getWorldName())) {
|
||||
} else if (Conf.useWorldConfigurationsAsWhitelist != Conf.worldsNoClaiming.contains(flocation.getWorldName())) {
|
||||
error = SaberFactions.plugin.txt.parse(TL.CLAIM_DISABLED.toString());
|
||||
} else if (this.isAdminBypassing()) {
|
||||
return true;
|
||||
|
||||
@@ -707,7 +707,6 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
||||
}
|
||||
|
||||
public void setDefaultPerms() {
|
||||
if (!Conf.useCustomDefaultPermissions) return;
|
||||
Map<PermissableAction, Access> defaultMap = new HashMap<>();
|
||||
for (PermissableAction permissableAction : PermissableAction.values()) {
|
||||
defaultMap.put(permissableAction, Access.UNDEFINED);
|
||||
|
||||
Reference in New Issue
Block a user