forked from github-mirror/CoreProtect
Formatting fixes
This commit is contained in:
1 parent
80a0f24e10
commit
b83b39feae
2 files changed
+15
-15
No files matched your search
@@ -25,6 +25,7 @@ To disable logging for specific users, blocks or commands, simply do the followi
|
||||
3. Either restart your server, or type "/co reload" in-game.
|
||||
|
||||
The blacklist supports disabling logs for:
|
||||
|
||||
- Users, which includes Players and non-player users, such as "#creeper"
|
||||
- Commands, such as `/help`
|
||||
- Blocks, such as minecraft:stone. Only `block` actions are affected.
|
||||
|
||||
@@ -159,20 +159,20 @@ public class ConfigHandler extends Queue {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isBlacklisted(String user){
|
||||
public static boolean isBlacklisted(String user) {
|
||||
return ConfigHandler.blacklist.containsKey(user.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
public static boolean isBlacklisted(String user, String object){
|
||||
if (ConfigHandler.blacklist.containsKey(object) || ConfigHandler.blacklist.containsKey(user.toLowerCase(Locale.ROOT))){
|
||||
public static boolean isBlacklisted(String user, String object) {
|
||||
if (ConfigHandler.blacklist.containsKey(object) || ConfigHandler.blacklist.containsKey(user.toLowerCase(Locale.ROOT))) {
|
||||
return true;
|
||||
}
|
||||
return isFilterBlacklisted(user, object);
|
||||
}
|
||||
|
||||
public static boolean isFilterBlacklisted(String user, String object){
|
||||
HashSet <String> blUserSet = FilteredBlacklist.get(object);
|
||||
if (blUserSet == null){
|
||||
public static boolean isFilterBlacklisted(String user, String object) {
|
||||
HashSet<String> blUserSet = FilteredBlacklist.get(object);
|
||||
if (blUserSet == null) {
|
||||
return false;
|
||||
}
|
||||
return blUserSet.contains(user.toLowerCase(Locale.ROOT));
|
||||
@@ -184,26 +184,25 @@ public class ConfigHandler extends Queue {
|
||||
ConfigHandler.FilteredBlacklist.clear();
|
||||
|
||||
File file = new File(ConfigHandler.path, BLACKLIST_FILENAME);
|
||||
if (!file.exists()){
|
||||
if (!file.exists()) {
|
||||
return;
|
||||
}
|
||||
try (RandomAccessFile blfile = new RandomAccessFile(file, "r")){
|
||||
if (blfile.length() == 0){
|
||||
try (RandomAccessFile blfile = new RandomAccessFile(file, "r")) {
|
||||
if (blfile.length() == 0) {
|
||||
return;
|
||||
}
|
||||
String blLine;
|
||||
while (( blLine = blfile.readLine()) != null ) {
|
||||
while ((blLine = blfile.readLine()) != null) {
|
||||
blLine = blLine.replace(" ", "").toLowerCase(Locale.ROOT).split(BLACKLIST_COMMENT_SEPARATOR)[0];
|
||||
if (blLine.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
String[] blSplit = blLine.split(BLACKLIST_FILTER_SEPARATOR);
|
||||
if (blSplit.length == 1){
|
||||
if (blSplit.length == 1) {
|
||||
ConfigHandler.blacklist.put(blLine, true);
|
||||
} else {
|
||||
ConfigHandler.FilteredBlacklist.
|
||||
computeIfAbsent(blSplit[0], k-> new HashSet<>())
|
||||
.add(blSplit[1]);
|
||||
}
|
||||
else {
|
||||
ConfigHandler.FilteredBlacklist.computeIfAbsent(blSplit[0], k -> new HashSet<>()).add(blSplit[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user