Changed ownership mapping from HashMap to ConcurrentHashMap to hopefully take care of reported ConcurrentModificicationException error; bugfix for faction admin not being able to bypass ownership if "ownedAreaModeratorsBypass" was set
This commit is contained in:
parent
697e0cf466
commit
409f98e1e6
@ -3,6 +3,7 @@ package com.massivecraft.factions;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@ -28,7 +29,7 @@ public class Faction {
|
||||
|
||||
private transient int id;
|
||||
private Map<Integer, Relation> relationWish;
|
||||
private Map<FLocation, Set<String>> claimOwnership = new HashMap<FLocation, Set<String>>();
|
||||
private Map<FLocation, Set<String>> claimOwnership = new ConcurrentHashMap<FLocation, Set<String>>();
|
||||
private Set<String> invites; // Where string is a lowercase player name
|
||||
private boolean open;
|
||||
private boolean peaceful;
|
||||
@ -559,7 +560,7 @@ public class Faction {
|
||||
}
|
||||
|
||||
// sufficient role to bypass ownership?
|
||||
if (fplayer.getRole() == (Conf.ownedAreaModeratorsBypass ? Role.MODERATOR : Role.ADMIN)) {
|
||||
if (fplayer.getRole().isAtLeast(Conf.ownedAreaModeratorsBypass ? Role.MODERATOR : Role.ADMIN)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,14 @@ public enum Role {
|
||||
this.nicename = nicename;
|
||||
}
|
||||
|
||||
public boolean isAtLeast(Role role) {
|
||||
return this.value >= role.value;
|
||||
}
|
||||
|
||||
public boolean isAtMost(Role role) {
|
||||
return this.value <= role.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.nicename;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.massivecraft.factions.util;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
@ -32,7 +32,7 @@ public class MapFLocToStringSetTypeAdapter implements JsonDeserializer<Map<FLoca
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<FLocation, Set<String>> locationMap = new HashMap<FLocation, Set<String>>();
|
||||
Map<FLocation, Set<String>> locationMap = new ConcurrentHashMap<FLocation, Set<String>>();
|
||||
Set<String> nameSet;
|
||||
Iterator<JsonElement> iter;
|
||||
String worldName;
|
||||
|
Loading…
Reference in New Issue
Block a user