Merge remote-tracking branch 'origin/1.6.x' into 1.6.x

This commit is contained in:
prosavage 2019-07-20 11:20:22 -05:00
commit e121d49762
5 changed files with 161 additions and 166 deletions

View File

@ -405,7 +405,7 @@ public class Conf {
defaultFactionPermissions.put("LEADER", new DefaultPermissions(true)); defaultFactionPermissions.put("LEADER", new DefaultPermissions(true));
defaultFactionPermissions.put("COLEADER", new DefaultPermissions(true)); defaultFactionPermissions.put("COLEADER", new DefaultPermissions(true));
defaultFactionPermissions.put("MODERATOR", 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)); defaultFactionPermissions.put("RECRUIT", new DefaultPermissions(false));
} }

View File

@ -479,10 +479,6 @@ public class SaberFactions extends MPlugin {
MCommand<?> commandEx = cmdBase; MCommand<?> commandEx = cmdBase;
List<MCommand<?>> commandsList = cmdBase.subCommands; List<MCommand<?>> commandsList = cmdBase.subCommands;
if (Board.getInstance().getFactionAt(new FLocation(fPlayer.getPlayer().getLocation())).isWarZone()) {
return new ArrayList<>();
}
for (; !commandsList.isEmpty() && !argsList.isEmpty(); argsList.remove(0)) { for (; !commandsList.isEmpty() && !argsList.isEmpty(); argsList.remove(0)) {
String cmdName = argsList.get(0).toLowerCase(); String cmdName = argsList.get(0).toLowerCase();
MCommand<?> commandFounded = commandsList.stream() MCommand<?> commandFounded = commandsList.stream()

View File

@ -1,152 +1,152 @@
package com.massivecraft.factions.zcore.fperms; package com.massivecraft.factions.zcore.fperms;
public class DefaultPermissions { public class DefaultPermissions {
public boolean ban; public boolean ban;
public boolean build; public boolean build;
public boolean destroy; public boolean destroy;
public boolean frostwalk; public boolean frostwalk;
public boolean painbuild; public boolean painbuild;
public boolean door; public boolean door;
public boolean button; public boolean button;
public boolean lever; public boolean lever;
public boolean container; public boolean container;
public boolean invite; public boolean invite;
public boolean kick; public boolean kick;
public boolean items; public boolean items;
public boolean sethome; public boolean sethome;
public boolean territory; public boolean territory;
public boolean access; public boolean access;
public boolean home; public boolean home;
public boolean disband; public boolean disband;
public boolean promote; public boolean promote;
public boolean setwarp; public boolean setwarp;
public boolean warp; public boolean warp;
public boolean fly; public boolean fly;
public boolean vault; public boolean vault;
public boolean tntbank; public boolean tntbank;
public boolean tntfill; public boolean tntfill;
public boolean withdraw; public boolean withdraw;
public boolean chest; public boolean chest;
public boolean spawner; public boolean spawner;
public DefaultPermissions() { public DefaultPermissions() {
} }
public DefaultPermissions(boolean def) { public DefaultPermissions(boolean def) {
this.ban = def; this.ban = def;
this.build = def; this.build = def;
this.destroy = def; this.destroy = def;
this.frostwalk = def; this.frostwalk = def;
this.painbuild = def; this.painbuild = def;
this.door = def; this.door = def;
this.button = def; this.button = def;
this.lever = def; this.lever = def;
this.container = def; this.container = def;
this.invite = def; this.invite = def;
this.kick = def; this.kick = def;
this.items = def; this.items = def;
this.sethome = def; this.sethome = def;
this.territory = def; this.territory = def;
this.access = def; this.access = def;
this.home = def; this.home = def;
this.disband = def; this.disband = def;
this.promote = def; this.promote = def;
this.setwarp = def; this.setwarp = def;
this.warp = def; this.warp = def;
this.fly = def; this.fly = def;
this.vault = def; this.vault = def;
this.tntbank = def; this.tntbank = def;
this.tntfill = def; this.tntfill = def;
this.withdraw = def; this.withdraw = def;
this.chest = def; this.chest = def;
this.spawner = def; this.spawner = def;
} }
public DefaultPermissions(boolean canBan, public DefaultPermissions(boolean canBan,
boolean canBuild, boolean canBuild,
boolean canDestory, boolean canDestory,
boolean canFrostwalk, boolean canFrostwalk,
boolean canPainbuild, boolean canPainbuild,
boolean canDoor, boolean canDoor,
boolean canButton, boolean canButton,
boolean canLever, boolean canLever,
boolean canContainer, boolean canContainer,
boolean canInvite, boolean canInvite,
boolean canKick, boolean canKick,
boolean canItems, boolean canItems,
boolean canSethome, boolean canSethome,
boolean canTerritory, boolean canTerritory,
boolean canAccess, boolean canAccess,
boolean canHome, boolean canHome,
boolean canDisband, boolean canDisband,
boolean canPromote, boolean canPromote,
boolean canSetwarp, boolean canSetwarp,
boolean canWarp, boolean canWarp,
boolean canFly, boolean canFly,
boolean canVault, boolean canVault,
boolean canTntbank, boolean canTntbank,
boolean canTntfill, boolean canTntfill,
boolean canWithdraw, boolean canWithdraw,
boolean canChest, boolean canChest,
boolean canSpawners) { boolean canSpawners) {
this.ban = canBan; this.ban = canBan;
this.build = canBuild; this.build = canBuild;
this.destroy = canDestory; this.destroy = canDestory;
this.frostwalk = canFrostwalk; this.frostwalk = canFrostwalk;
this.painbuild = canPainbuild; this.painbuild = canPainbuild;
this.door = canDoor; this.door = canDoor;
this.button = canButton; this.button = canButton;
this.lever = canLever; this.lever = canLever;
this.container = canContainer; this.container = canContainer;
this.invite = canInvite; this.invite = canInvite;
this.kick = canKick; this.kick = canKick;
this.items = canItems; this.items = canItems;
this.sethome = canSethome; this.sethome = canSethome;
this.territory = canTerritory; this.territory = canTerritory;
this.access = canAccess; this.access = canAccess;
this.home = canHome; this.home = canHome;
this.disband = canDisband; this.disband = canDisband;
this.promote = canPromote; this.promote = canPromote;
this.setwarp = canSetwarp; this.setwarp = canSetwarp;
this.warp = canWarp; this.warp = canWarp;
this.fly = canFly; this.fly = canFly;
this.vault = canVault; this.vault = canVault;
this.tntbank = canTntbank; this.tntbank = canTntbank;
this.tntfill = canTntfill; this.tntfill = canTntfill;
this.withdraw = canWithdraw; this.withdraw = canWithdraw;
this.chest = canChest; this.chest = canChest;
this.spawner = canSpawners; this.spawner = canSpawners;
} }
@Deprecated @Deprecated
public boolean getbyName(String name) { public boolean getbyName(String name) {
if (name == "ban") return this.ban; if (name == "ban") return this.ban;
else if (name == "build") return this.build; else if (name == "build") return this.build;
else if (name == "destroy") return this.destroy; else if (name == "destroy") return this.destroy;
else if (name == "frostwalk") return this.frostwalk; else if (name == "frostwalk") return this.frostwalk;
else if (name == "painbuild") return this.painbuild; else if (name == "painbuild") return this.painbuild;
else if (name == "door") return this.door; else if (name == "door") return this.door;
else if (name == "button") return this.button; else if (name == "button") return this.button;
else if (name == "lever") return this.lever; else if (name == "lever") return this.lever;
else if (name == "home") return this.home; else if (name == "container") return this.container;
else if (name == "container") return this.container; else if (name == "invite") return this.invite;
else if (name == "invite") return this.invite; else if (name == "kick") return this.kick;
else if (name == "kick") return this.kick; else if (name == "items") return this.items;
else if (name == "items") return this.items; else if (name == "sethome") return this.sethome;
else if (name == "sethome") return this.sethome; else if (name == "territory") return this.territory;
else if (name == "territory") return this.territory; else if (name == "access") return this.access;
else if (name == "access") return this.access; else if (name == "home") return this.home;
else if (name == "disband") return this.disband; else if (name == "disband") return this.disband;
else if (name == "promote") return this.promote; else if (name == "promote") return this.promote;
else if (name == "setwarp") return this.setwarp; else if (name == "setwarp") return this.setwarp;
else if (name == "warp") return this.warp; else if (name == "warp") return this.warp;
else if (name == "fly") return this.fly; else if (name == "fly") return this.fly;
else if (name == "vault") return this.vault; else if (name == "vault") return this.vault;
else if (name == "tntbank") return this.tntbank; else if (name == "tntbank") return this.tntbank;
else if (name == "tntfill") return this.tntfill; else if (name == "tntfill") return this.tntfill;
else if (name == "withdraw") return this.withdraw; else if (name == "withdraw") return this.withdraw;
else if (name == "chest") return this.chest; else if (name == "chest") return this.chest;
else if (name == "spawner") return this.spawner; else if (name == "spawner") return this.spawner;
else return false; else return false;
} }
} }

View File

@ -102,15 +102,13 @@ public enum PermissableAction {
String displayName = replacePlaceholders(section.getString("placeholder-item.name"), fme, permissable); String displayName = replacePlaceholders(section.getString("placeholder-item.name"), fme, permissable);
List<String> lore = new ArrayList<>(); List<String> lore = new ArrayList<>();
if (section.getString("materials." + name().toLowerCase().replace('_', '-')) == null) { if (section.getString("materials." + name().toLowerCase().replace('_', '-')) == null) return null;
return null;
}
Material material = XMaterial.matchXMaterial(section.getString("materials." + name().toLowerCase().replace('_', '-'))).parseMaterial(); Material material = XMaterial.matchXMaterial(section.getString("materials." + name().toLowerCase().replace('_', '-'))).parseMaterial();
Access access = fme.getFaction().getAccess(permissable, this); Access access = fme.getFaction().getAccess(permissable, this);
if (access == null) { if (access == null) access = Access.UNDEFINED;
access = Access.UNDEFINED;
}
ItemStack item = new ItemStack(material); ItemStack item = new ItemStack(material);
ItemMeta itemMeta = item.getItemMeta(); ItemMeta itemMeta = item.getItemMeta();
@ -129,29 +127,30 @@ public enum PermissableAction {
} }
// If under the 1.13 version we will use the colorable option. // 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; DyeColor dyeColor = null;
try { try {
dyeColor = DyeColor.valueOf(section.getString("access." + access.name().toLowerCase())); dyeColor = DyeColor.valueOf(section.getString("access." + access.name().toLowerCase()));
} catch (Exception exception) { } catch (Exception exception) {
} }
accessValue = "deny";
if (dyeColor != null) { if (dyeColor != null) {
item.setDurability(dyeColor.getWoolData()); item.setDurability(dyeColor.getWoolData());
} }
} else { } 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 Material mat = XMaterial.CYAN_GLAZED_TERRACOTTA.parseMaterial();
item.setType(XMaterial.matchXMaterial(SaberFactions.plugin.getConfig().getString("fperm-gui.action.access.") + accessValue).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")) { for (String loreLine : section.getStringList("placeholder-item.lore")) lore.add(replacePlaceholders(loreLine, fme, permissable));
lore.add(replacePlaceholders(loreLine, fme, permissable)); if (!SaberFactions.plugin.mc17) itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES);
}
if (!SaberFactions.plugin.mc17) {
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES);
}
itemMeta.setDisplayName(displayName); itemMeta.setDisplayName(displayName);
itemMeta.setLore(lore); itemMeta.setLore(lore);

View File

@ -100,7 +100,7 @@ public class Persist {
} }
public boolean save(Object instance, File file) { 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 // LOAD BY CLASS