Major f perm fix; Fix sethome permission check (#1079)
This commit is contained in:
parent
693c831327
commit
819cb542cd
@ -108,17 +108,14 @@ public class CmdPerm extends FCommand {
|
||||
}
|
||||
|
||||
private Permissable getPermissable(String name) {
|
||||
try {
|
||||
return Relation.valueOf(name.toUpperCase());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
try {
|
||||
return Role.valueOf(name.toUpperCase());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
if (Role.fromString(name.toUpperCase()) != null) {
|
||||
return Role.fromString(name.toUpperCase());
|
||||
} else if (Relation.fromString(name.toUpperCase()) != null) {
|
||||
return Relation.fromString(name.toUpperCase());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
|
@ -45,10 +45,10 @@ public class CmdSethome extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
// Can the player set the home for this faction?
|
||||
// Check for ALLOW access as well before we check for role.
|
||||
if (faction == myFaction && access != Access.ALLOW) {
|
||||
if (!Permission.SETHOME_ANY.has(sender, true) || !assertMinRole(Role.MODERATOR)) {
|
||||
// If player does not have allow run extra permission checks
|
||||
if (access != Access.ALLOW) {
|
||||
if (faction == myFaction) {
|
||||
if (!assertMinRole(Role.MODERATOR)) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@ -56,6 +56,7 @@ public class CmdSethome extends FCommand {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Can the player set the faction home HERE?
|
||||
if (!Permission.BYPASS.has(me) &&
|
||||
|
@ -104,7 +104,6 @@ public enum Role implements Permissable {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
// Utility method to build items for F Perm GUI
|
||||
@Override
|
||||
public ItemStack buildItem() {
|
||||
@ -113,7 +112,7 @@ public enum Role implements Permissable {
|
||||
String displayName = replacePlaceholders(RELATION_CONFIG.getString("placeholder-item.name", ""));
|
||||
List<String> lore = new ArrayList<>();
|
||||
|
||||
Material material = Material.matchMaterial(RELATION_CONFIG.getString("materials." + name().toLowerCase()));
|
||||
Material material = Material.matchMaterial(RELATION_CONFIG.getString("materials." + name().toLowerCase(), "STAINED_CLAY"));
|
||||
if (material == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -96,17 +96,14 @@ public class PermissableRelationGUI implements InventoryHolder, FactionGUI {
|
||||
}
|
||||
|
||||
private Permissable getPermissable(String name) {
|
||||
try {
|
||||
return Relation.valueOf(name.toUpperCase());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
try {
|
||||
return Role.valueOf(name.toUpperCase());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
if (Role.fromString(name.toUpperCase()) != null) {
|
||||
return Role.fromString(name.toUpperCase());
|
||||
} else if (Relation.fromString(name.toUpperCase()) != null) {
|
||||
return Relation.fromString(name.toUpperCase());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void buildItems() {
|
||||
for (Map.Entry<Integer, Permissable> entry : relationSlots.entrySet()) {
|
||||
|
@ -419,8 +419,10 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
||||
|
||||
// Put the map in there for each relation.
|
||||
for (Relation relation : Relation.values()) {
|
||||
if (relation != Relation.MEMBER) {
|
||||
permissions.put(relation, new HashMap<>(freshMap));
|
||||
}
|
||||
}
|
||||
|
||||
// And each role.
|
||||
for (Role role : Role.values()) {
|
||||
|
@ -379,7 +379,7 @@ fperm-gui:
|
||||
# Note: Slots start at 0 and end at one less that GUI size
|
||||
slots:
|
||||
recruit: 10
|
||||
member: 11
|
||||
normal: 11
|
||||
moderator: 12
|
||||
truce: 13
|
||||
ally: 14
|
||||
@ -388,7 +388,7 @@ fperm-gui:
|
||||
# Material to be displayed
|
||||
materials:
|
||||
recruit: WOOD_SWORD
|
||||
member: STONE_SWORD
|
||||
normal: STONE_SWORD
|
||||
moderator: IRON_SWORD
|
||||
truce: IRON_AXE
|
||||
ally: DIAMOND_SWORD
|
||||
|
Loading…
Reference in New Issue
Block a user