diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/bot/BotList.java b/leaves-server/src/main/java/org/leavesmc/leaves/bot/BotList.java index abf7b14b..308fe30c 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/bot/BotList.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/bot/BotList.java @@ -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()) { diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/ServerPlacement.java b/leaves-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/ServerPlacement.java index 2c7ca6c1..a648cae1 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/ServerPlacement.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/ServerPlacement.java @@ -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") diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SyncmaticaProtocol.java b/leaves-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SyncmaticaProtocol.java index ed239bda..cee6e2c9 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SyncmaticaProtocol.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SyncmaticaProtocol.java @@ -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) {