Check for f perm in building
This commit is contained in:
@@ -4,7 +4,7 @@ import com.google.gson.*;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.zcore.fperms.Access;
|
||||
import com.massivecraft.factions.zcore.fperms.Action;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.HashMap;
|
||||
@@ -12,10 +12,10 @@ import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class PermissionsMapTypeAdapter implements JsonDeserializer<Map<Relation, Map<Action, Access>>> {
|
||||
public class PermissionsMapTypeAdapter implements JsonDeserializer<Map<Relation, Map<PermissableAction, Access>>> {
|
||||
|
||||
@Override
|
||||
public Map<Relation, Map<Action, Access>> deserialize(JsonElement json, Type type, JsonDeserializationContext context) throws JsonParseException {
|
||||
public Map<Relation, Map<PermissableAction, Access>> deserialize(JsonElement json, Type type, JsonDeserializationContext context) throws JsonParseException {
|
||||
|
||||
try {
|
||||
JsonObject obj = json.getAsJsonObject();
|
||||
@@ -23,7 +23,7 @@ public class PermissionsMapTypeAdapter implements JsonDeserializer<Map<Relation,
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<Relation, Map<Action, Access>> permissionsMap = new ConcurrentHashMap<>();
|
||||
Map<Relation, Map<PermissableAction, Access>> permissionsMap = new ConcurrentHashMap<>();
|
||||
|
||||
// Top level is Relation
|
||||
for (Map.Entry<String, JsonElement> entry : obj.entrySet()) {
|
||||
@@ -31,10 +31,10 @@ public class PermissionsMapTypeAdapter implements JsonDeserializer<Map<Relation,
|
||||
|
||||
// Second level is the map between action -> access
|
||||
for (Map.Entry<String, JsonElement> entry2 : entry.getValue().getAsJsonObject().entrySet()) {
|
||||
Map<Action, Access> accessMap = new HashMap<>();
|
||||
Action action = Action.fromString(entry2.getKey());
|
||||
Map<PermissableAction, Access> accessMap = new HashMap<>();
|
||||
PermissableAction permissableAction = PermissableAction.fromString(entry2.getKey());
|
||||
Access access = Access.fromString(entry2.getValue().getAsString());
|
||||
accessMap.put(action, access);
|
||||
accessMap.put(permissableAction, access);
|
||||
|
||||
permissionsMap.put(relation, accessMap);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user