mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
merge
This commit is contained in:
@ -11,7 +11,6 @@ import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.RegionWrapper;
|
||||
import com.boydti.fawe.object.RunnableVal;
|
||||
import com.boydti.fawe.object.RunnableVal2;
|
||||
import com.boydti.fawe.object.changeset.CPUOptimizedChangeSet;
|
||||
import com.boydti.fawe.object.changeset.FaweStreamChangeSet;
|
||||
import com.boydti.fawe.object.io.AbstractDelegateOutputStream;
|
||||
import com.github.luben.zstd.ZstdInputStream;
|
||||
@ -93,7 +92,6 @@ public class MainUtil {
|
||||
* e.g. sending messages
|
||||
*/
|
||||
public static void sendMessage(final FawePlayer<?> player, String message) {
|
||||
message = BBC.color(message);
|
||||
if (player == null) {
|
||||
Fawe.debug(message);
|
||||
} else {
|
||||
@ -237,8 +235,8 @@ public class MainUtil {
|
||||
if (changeSet instanceof FaweStreamChangeSet) {
|
||||
FaweStreamChangeSet fscs = (FaweStreamChangeSet) changeSet;
|
||||
return fscs.getSizeOnDisk() + fscs.getSizeInMemory();
|
||||
} else if (changeSet instanceof CPUOptimizedChangeSet) {
|
||||
return changeSet.size() + 32;
|
||||
// } else if (changeSet instanceof CPUOptimizedChangeSet) {
|
||||
// return changeSet.size() + 32;
|
||||
} else if (changeSet != null) {
|
||||
return changeSet.size() * 128;
|
||||
} else {
|
||||
@ -631,7 +629,6 @@ public class MainUtil {
|
||||
boolean reading = false;
|
||||
int index = 1;
|
||||
int numIndex = 1;
|
||||
outer:
|
||||
for (int i = len; i >= 2; i--) {
|
||||
char c = fileName.charAt(i);
|
||||
if (!reading) {
|
||||
@ -644,7 +641,9 @@ public class MainUtil {
|
||||
break;
|
||||
case '.':
|
||||
res[index--] = val;
|
||||
if (index == -1) return res;
|
||||
if (index == -1) {
|
||||
return res;
|
||||
}
|
||||
val = 0;
|
||||
numIndex = 1;
|
||||
break;
|
||||
|
@ -28,8 +28,7 @@ public class MemUtil {
|
||||
}
|
||||
|
||||
public static long getUsedBytes() {
|
||||
long used = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
|
||||
return used;
|
||||
return Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
|
||||
}
|
||||
|
||||
public static long getFreeBytes() {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.boydti.fawe.util;
|
||||
|
||||
import com.sk89q.worldedit.util.auth.Subject;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public enum Permission {
|
||||
/*
|
||||
@ -17,11 +18,8 @@ public enum Permission {
|
||||
}
|
||||
|
||||
|
||||
public static boolean hasPermission(Subject player, String permission) {
|
||||
if (player == null || player.hasPermission(ADMIN.permission)) {
|
||||
return true;
|
||||
}
|
||||
if (player.hasPermission(permission)) {
|
||||
public static boolean hasPermission(@NotNull Subject player, String permission) {
|
||||
if (player.hasPermission(ADMIN.permission) || player.hasPermission(permission)) {
|
||||
return true;
|
||||
}
|
||||
final String[] nodes = permission.split("\\.");
|
||||
|
@ -6,33 +6,12 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class StringMan {
|
||||
public static String replaceFromMap(String string, Map<String, String> replacements) {
|
||||
final StringBuilder sb = new StringBuilder(string);
|
||||
int size = string.length();
|
||||
for (Entry<String, String> entry : replacements.entrySet()) {
|
||||
if (size == 0) {
|
||||
break;
|
||||
}
|
||||
final String key = entry.getKey();
|
||||
final String value = entry.getValue();
|
||||
int start = sb.indexOf(key, 0);
|
||||
while (start > -1) {
|
||||
final int end = start + key.length();
|
||||
final int nextSearchStart = start + value.length();
|
||||
sb.replace(start, end, value);
|
||||
size -= end - start;
|
||||
start = sb.indexOf(key, nextSearchStart);
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static boolean containsAny(CharSequence sequence, String any) {
|
||||
return IntStream.range(0, sequence.length())
|
||||
@ -516,10 +495,6 @@ public class StringMan {
|
||||
}
|
||||
|
||||
public static String repeat(String s, int n) {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < n; i++) {
|
||||
sb.append(s);
|
||||
}
|
||||
return sb.toString();
|
||||
return IntStream.range(0, n).mapToObj(i -> s).collect(Collectors.joining());
|
||||
}
|
||||
}
|
||||
|
@ -99,9 +99,9 @@ public class WEManager {
|
||||
synchronized (masks) {
|
||||
boolean removed = false;
|
||||
if (!masks.isEmpty()) {
|
||||
Iterator<FaweMask> iter = masks.iterator();
|
||||
while (iter.hasNext()) {
|
||||
FaweMask mask = iter.next();
|
||||
Iterator<FaweMask> iterator = masks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
FaweMask mask = iterator.next();
|
||||
if (mask.isValid(player, type)) {
|
||||
Region region = mask.getRegion();
|
||||
if (region.contains(loc.toBlockPoint())) {
|
||||
@ -112,7 +112,7 @@ public class WEManager {
|
||||
}
|
||||
} else {
|
||||
removed = true;
|
||||
iter.remove();
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user