diff --git a/src/main/java/com/massivecraft/factions/Conf.java b/src/main/java/com/massivecraft/factions/Conf.java index 31c85584..8def02dd 100644 --- a/src/main/java/com/massivecraft/factions/Conf.java +++ b/src/main/java/com/massivecraft/factions/Conf.java @@ -405,7 +405,7 @@ public class Conf { defaultFactionPermissions.put("LEADER", new DefaultPermissions(true)); defaultFactionPermissions.put("COLEADER", new DefaultPermissions(true)); defaultFactionPermissions.put("MODERATOR", new DefaultPermissions(true)); - defaultFactionPermissions.put("MEMBER", new DefaultPermissions(false)); + defaultFactionPermissions.put("NORMAL MEMBER", new DefaultPermissions(false)); defaultFactionPermissions.put("RECRUIT", new DefaultPermissions(false)); } diff --git a/src/main/java/com/massivecraft/factions/SaberFactions.java b/src/main/java/com/massivecraft/factions/SaberFactions.java index e8e2b839..b3db0cf1 100644 --- a/src/main/java/com/massivecraft/factions/SaberFactions.java +++ b/src/main/java/com/massivecraft/factions/SaberFactions.java @@ -479,10 +479,6 @@ public class SaberFactions extends MPlugin { MCommand commandEx = cmdBase; List> commandsList = cmdBase.subCommands; - if (Board.getInstance().getFactionAt(new FLocation(fPlayer.getPlayer().getLocation())).isWarZone()) { - return new ArrayList<>(); - } - for (; !commandsList.isEmpty() && !argsList.isEmpty(); argsList.remove(0)) { String cmdName = argsList.get(0).toLowerCase(); MCommand commandFounded = commandsList.stream() diff --git a/src/main/java/com/massivecraft/factions/zcore/fperms/DefaultPermissions.java b/src/main/java/com/massivecraft/factions/zcore/fperms/DefaultPermissions.java index 9adbecfa..74748b4e 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fperms/DefaultPermissions.java +++ b/src/main/java/com/massivecraft/factions/zcore/fperms/DefaultPermissions.java @@ -1,152 +1,152 @@ package com.massivecraft.factions.zcore.fperms; public class DefaultPermissions { - public boolean ban; - public boolean build; - public boolean destroy; - public boolean frostwalk; - public boolean painbuild; - public boolean door; - public boolean button; - public boolean lever; - public boolean container; - public boolean invite; - public boolean kick; - public boolean items; - public boolean sethome; - public boolean territory; - public boolean access; - public boolean home; - public boolean disband; - public boolean promote; - public boolean setwarp; - public boolean warp; - public boolean fly; - public boolean vault; - public boolean tntbank; - public boolean tntfill; - public boolean withdraw; - public boolean chest; - public boolean spawner; + public boolean ban; + public boolean build; + public boolean destroy; + public boolean frostwalk; + public boolean painbuild; + public boolean door; + public boolean button; + public boolean lever; + public boolean container; + public boolean invite; + public boolean kick; + public boolean items; + public boolean sethome; + public boolean territory; + public boolean access; + public boolean home; + public boolean disband; + public boolean promote; + public boolean setwarp; + public boolean warp; + public boolean fly; + public boolean vault; + public boolean tntbank; + public boolean tntfill; + public boolean withdraw; + public boolean chest; + public boolean spawner; - public DefaultPermissions() { - } + public DefaultPermissions() { + } - public DefaultPermissions(boolean def) { - this.ban = def; - this.build = def; - this.destroy = def; - this.frostwalk = def; - this.painbuild = def; - this.door = def; - this.button = def; - this.lever = def; - this.container = def; - this.invite = def; - this.kick = def; - this.items = def; - this.sethome = def; - this.territory = def; - this.access = def; - this.home = def; - this.disband = def; - this.promote = def; - this.setwarp = def; - this.warp = def; - this.fly = def; - this.vault = def; - this.tntbank = def; - this.tntfill = def; - this.withdraw = def; - this.chest = def; - this.spawner = def; - } + public DefaultPermissions(boolean def) { + this.ban = def; + this.build = def; + this.destroy = def; + this.frostwalk = def; + this.painbuild = def; + this.door = def; + this.button = def; + this.lever = def; + this.container = def; + this.invite = def; + this.kick = def; + this.items = def; + this.sethome = def; + this.territory = def; + this.access = def; + this.home = def; + this.disband = def; + this.promote = def; + this.setwarp = def; + this.warp = def; + this.fly = def; + this.vault = def; + this.tntbank = def; + this.tntfill = def; + this.withdraw = def; + this.chest = def; + this.spawner = def; + } - public DefaultPermissions(boolean canBan, - boolean canBuild, - boolean canDestory, - boolean canFrostwalk, - boolean canPainbuild, - boolean canDoor, - boolean canButton, - boolean canLever, - boolean canContainer, - boolean canInvite, - boolean canKick, - boolean canItems, - boolean canSethome, - boolean canTerritory, - boolean canAccess, - boolean canHome, - boolean canDisband, - boolean canPromote, - boolean canSetwarp, - boolean canWarp, - boolean canFly, - boolean canVault, - boolean canTntbank, - boolean canTntfill, - boolean canWithdraw, - boolean canChest, - boolean canSpawners) { - this.ban = canBan; - this.build = canBuild; - this.destroy = canDestory; - this.frostwalk = canFrostwalk; - this.painbuild = canPainbuild; - this.door = canDoor; - this.button = canButton; - this.lever = canLever; - this.container = canContainer; - this.invite = canInvite; - this.kick = canKick; - this.items = canItems; - this.sethome = canSethome; - this.territory = canTerritory; - this.access = canAccess; - this.home = canHome; - this.disband = canDisband; - this.promote = canPromote; - this.setwarp = canSetwarp; - this.warp = canWarp; - this.fly = canFly; - this.vault = canVault; - this.tntbank = canTntbank; - this.tntfill = canTntfill; - this.withdraw = canWithdraw; - this.chest = canChest; - this.spawner = canSpawners; - } + public DefaultPermissions(boolean canBan, + boolean canBuild, + boolean canDestory, + boolean canFrostwalk, + boolean canPainbuild, + boolean canDoor, + boolean canButton, + boolean canLever, + boolean canContainer, + boolean canInvite, + boolean canKick, + boolean canItems, + boolean canSethome, + boolean canTerritory, + boolean canAccess, + boolean canHome, + boolean canDisband, + boolean canPromote, + boolean canSetwarp, + boolean canWarp, + boolean canFly, + boolean canVault, + boolean canTntbank, + boolean canTntfill, + boolean canWithdraw, + boolean canChest, + boolean canSpawners) { + this.ban = canBan; + this.build = canBuild; + this.destroy = canDestory; + this.frostwalk = canFrostwalk; + this.painbuild = canPainbuild; + this.door = canDoor; + this.button = canButton; + this.lever = canLever; + this.container = canContainer; + this.invite = canInvite; + this.kick = canKick; + this.items = canItems; + this.sethome = canSethome; + this.territory = canTerritory; + this.access = canAccess; + this.home = canHome; + this.disband = canDisband; + this.promote = canPromote; + this.setwarp = canSetwarp; + this.warp = canWarp; + this.fly = canFly; + this.vault = canVault; + this.tntbank = canTntbank; + this.tntfill = canTntfill; + this.withdraw = canWithdraw; + this.chest = canChest; + this.spawner = canSpawners; + } - @Deprecated - public boolean getbyName(String name) { - if (name == "ban") return this.ban; - else if (name == "build") return this.build; - else if (name == "destroy") return this.destroy; - else if (name == "frostwalk") return this.frostwalk; - else if (name == "painbuild") return this.painbuild; - else if (name == "door") return this.door; - else if (name == "button") return this.button; - else if (name == "lever") return this.lever; - else if (name == "home") return this.home; - else if (name == "container") return this.container; - else if (name == "invite") return this.invite; - else if (name == "kick") return this.kick; - else if (name == "items") return this.items; - else if (name == "sethome") return this.sethome; - else if (name == "territory") return this.territory; - else if (name == "access") return this.access; - else if (name == "disband") return this.disband; - else if (name == "promote") return this.promote; - else if (name == "setwarp") return this.setwarp; - else if (name == "warp") return this.warp; - else if (name == "fly") return this.fly; - else if (name == "vault") return this.vault; - else if (name == "tntbank") return this.tntbank; - else if (name == "tntfill") return this.tntfill; - else if (name == "withdraw") return this.withdraw; - else if (name == "chest") return this.chest; - else if (name == "spawner") return this.spawner; - else return false; - } + @Deprecated + public boolean getbyName(String name) { + if (name == "ban") return this.ban; + else if (name == "build") return this.build; + else if (name == "destroy") return this.destroy; + else if (name == "frostwalk") return this.frostwalk; + else if (name == "painbuild") return this.painbuild; + else if (name == "door") return this.door; + else if (name == "button") return this.button; + else if (name == "lever") return this.lever; + else if (name == "container") return this.container; + else if (name == "invite") return this.invite; + else if (name == "kick") return this.kick; + else if (name == "items") return this.items; + else if (name == "sethome") return this.sethome; + else if (name == "territory") return this.territory; + else if (name == "access") return this.access; + else if (name == "home") return this.home; + else if (name == "disband") return this.disband; + else if (name == "promote") return this.promote; + else if (name == "setwarp") return this.setwarp; + else if (name == "warp") return this.warp; + else if (name == "fly") return this.fly; + else if (name == "vault") return this.vault; + else if (name == "tntbank") return this.tntbank; + else if (name == "tntfill") return this.tntfill; + else if (name == "withdraw") return this.withdraw; + else if (name == "chest") return this.chest; + else if (name == "spawner") return this.spawner; + else return false; + } } diff --git a/src/main/java/com/massivecraft/factions/zcore/fperms/PermissableAction.java b/src/main/java/com/massivecraft/factions/zcore/fperms/PermissableAction.java index 490d559b..4646f7b8 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fperms/PermissableAction.java +++ b/src/main/java/com/massivecraft/factions/zcore/fperms/PermissableAction.java @@ -102,15 +102,13 @@ public enum PermissableAction { String displayName = replacePlaceholders(section.getString("placeholder-item.name"), fme, permissable); List lore = new ArrayList<>(); - if (section.getString("materials." + name().toLowerCase().replace('_', '-')) == null) { - return null; - } + if (section.getString("materials." + name().toLowerCase().replace('_', '-')) == null) return null; + Material material = XMaterial.matchXMaterial(section.getString("materials." + name().toLowerCase().replace('_', '-'))).parseMaterial(); Access access = fme.getFaction().getAccess(permissable, this); - if (access == null) { - access = Access.UNDEFINED; - } + if (access == null) access = Access.UNDEFINED; + ItemStack item = new ItemStack(material); ItemMeta itemMeta = item.getItemMeta(); @@ -129,29 +127,30 @@ public enum PermissableAction { } // If under the 1.13 version we will use the colorable option. - if (!SaberFactions.plugin.mc113) { + if (!SaberFactions.plugin.mc113 && !SaberFactions.plugin.mc114) { //TODO see if it's working in other version than 1.13 and 1.14 DyeColor dyeColor = null; try { dyeColor = DyeColor.valueOf(section.getString("access." + access.name().toLowerCase())); } catch (Exception exception) { } + accessValue = "deny"; if (dyeColor != null) { item.setDurability(dyeColor.getWoolData()); } } else { - // so this is in 1.13 mode, our config will automatically be updated to a material instead of color because of it being removed in the new api - item.setType(XMaterial.matchXMaterial(SaberFactions.plugin.getConfig().getString("fperm-gui.action.access.") + accessValue).parseMaterial()); + Material mat = XMaterial.CYAN_GLAZED_TERRACOTTA.parseMaterial(); + switch (accessValue) { + case "deny": mat = XMaterial.RED_GLAZED_TERRACOTTA.parseMaterial(); break; + case "allow": mat = XMaterial.GREEN_GLAZED_TERRACOTTA.parseMaterial(); break; + case "undefined": mat = XMaterial.CYAN_GLAZED_TERRACOTTA.parseMaterial(); break; + } + item.setType(mat); } - for (String loreLine : section.getStringList("placeholder-item.lore")) { - lore.add(replacePlaceholders(loreLine, fme, permissable)); - } - - if (!SaberFactions.plugin.mc17) { - itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES); - } + for (String loreLine : section.getStringList("placeholder-item.lore")) lore.add(replacePlaceholders(loreLine, fme, permissable)); + if (!SaberFactions.plugin.mc17) itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES); itemMeta.setDisplayName(displayName); itemMeta.setLore(lore); diff --git a/src/main/java/com/massivecraft/factions/zcore/util/Persist.java b/src/main/java/com/massivecraft/factions/zcore/util/Persist.java index 21d3027a..d7f038d0 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/Persist.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/Persist.java @@ -100,7 +100,7 @@ public class Persist { } public boolean save(Object instance, File file) { - return DiscUtil.writeCatch(file, p.gson.toJson(instance), true); + return DiscUtil.writeCatch(file, p.gson.toJson(instance), false); } // LOAD BY CLASS