Skip to content
This repository was archived by the owner on Jul 7, 2023. It is now read-only.

Commit 207c4da

Browse files
committed
f perms now works in 1.13
1 parent 397775b commit 207c4da

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

src/main/java/com/massivecraft/factions/zcore/fperms/PermissableAction.java

+27-7
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,37 @@ public ItemStack buildItem(FPlayer fme, Permissable permissable) {
103103
if (access == null) {
104104
access = Access.UNDEFINED;
105105
}
106-
DyeColor dyeColor = null;
107-
try {
108-
dyeColor = DyeColor.valueOf(section.getString("access." + access.name().toLowerCase()));
109-
} catch (Exception exception) {
110-
}
111106

112107
ItemStack item = new ItemStack(material);
113108
ItemMeta itemMeta = item.getItemMeta();
114109

115-
if (dyeColor != null) {
116-
item.setDurability(dyeColor.getWoolData());
110+
111+
String accessValue = null;
112+
113+
if (access.equals(Access.ALLOW)) {
114+
accessValue = "allow";
115+
} else if (access.equals(Access.DENY)) {
116+
accessValue = "deny";
117+
} else if (access.equals(Access.UNDEFINED)) {
118+
accessValue = "undefined";
119+
}
120+
121+
122+
// If under the 1.13 version we will use the colorable option.
123+
if (!P.p.mc113) {
124+
DyeColor dyeColor = null;
125+
126+
try {
127+
dyeColor = DyeColor.valueOf(section.getString("access." + access.name().toLowerCase()));
128+
} catch (Exception exception) {
129+
}
130+
131+
if (dyeColor != null) {
132+
item.setDurability(dyeColor.getWoolData());
133+
}
134+
} else {
135+
// 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
136+
item.setType(Material.valueOf(P.p.getConfig().getString("fperm-gui.action.access." + accessValue)));
117137
}
118138

119139
for (String loreLine : section.getStringList("placeholder-item.lore")) {

src/main/resources/config.yml

+2
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ fperm-gui:
520520
tntfill: 41
521521
chest: 42
522522
spawner: 38
523+
home: 49
523524

524525
# Material to show, if the material is colorable eg: Wool, Stained Clay it will update with it's access color
525526
materials:
@@ -549,6 +550,7 @@ fperm-gui:
549550
tntfill: STAINED_GLASS
550551
chest: STAINED_GLASS
551552
spawner: STAINED_GLASS
553+
home: STAINED_GLASS
552554
# Same dummy items format as above
553555
dummy-items:
554556
'0':

0 commit comments

Comments
 (0)