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("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));
}

View File

@ -479,10 +479,6 @@ public class SaberFactions extends MPlugin {
MCommand<?> commandEx = cmdBase;
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)) {
String cmdName = argsList.get(0).toLowerCase();
MCommand<?> commandFounded = commandsList.stream()

View File

@ -128,7 +128,6 @@ public class DefaultPermissions {
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;
@ -136,6 +135,7 @@ public class DefaultPermissions {
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;

View File

@ -102,15 +102,13 @@ public enum PermissableAction {
String displayName = replacePlaceholders(section.getString("placeholder-item.name"), fme, permissable);
List<String> 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);

View File

@ -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