mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-29 11:59:17 +00:00
fix: remove dbg output, fix syncmatica
This commit is contained in:
@@ -274,7 +274,6 @@ public class BotList {
|
||||
}
|
||||
|
||||
public void loadBotInfo() {
|
||||
System.out.println(LeavesConfig.modify.fakeplayer.canResident);
|
||||
if (!LeavesConfig.modify.fakeplayer.enable || !LeavesConfig.modify.fakeplayer.canResident) return;
|
||||
CompoundTag savedBotList = this.getSavedBotList().copy();
|
||||
for (String realName : savedBotList.keySet()) {
|
||||
|
||||
@@ -28,12 +28,17 @@ public class ServerPlacement {
|
||||
|
||||
public ServerPlacement(final UUID id, final String fileName, final UUID hashValue, final PlayerIdentifier owner) {
|
||||
this.id = id;
|
||||
this.fileName = fileName;
|
||||
this.fileName = removeExtension(fileName);
|
||||
this.hashValue = hashValue;
|
||||
this.owner = owner;
|
||||
lastModifiedBy = owner;
|
||||
}
|
||||
|
||||
private static String removeExtension(final String fileName) {
|
||||
final int pos = fileName.lastIndexOf(".");
|
||||
return fileName.substring(0, pos);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static ServerPlacement fromJson(final @NotNull JsonObject obj) {
|
||||
if (obj.has("id")
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Arrays;
|
||||
@@ -81,11 +82,16 @@ public class SyncmaticaProtocol {
|
||||
|
||||
@NotNull
|
||||
public static String sanitizeFileName(final @NotNull String badFileName) {
|
||||
String input = badFileName;
|
||||
try {
|
||||
input = Paths.get(input).getFileName().toString();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
final StringBuilder sanitized = new StringBuilder();
|
||||
final int len = badFileName.codePointCount(0, badFileName.length());
|
||||
final int len = input.codePointCount(0, input.length());
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
final int c = badFileName.codePointAt(i);
|
||||
final int c = input.codePointAt(i);
|
||||
if (Arrays.binarySearch(ILLEGAL_CHARS, c) < 0) {
|
||||
sanitized.appendCodePoint(c);
|
||||
if (sanitized.length() == 255) {
|
||||
|
||||
Reference in New Issue
Block a user