mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-06 10:44:39 +01:00
3d4c222263
* Provides support for IP forwarding via BungeeCord. * Treats Bungee as Online Mode. By: md_5 <git@md-5.net>
88 lines
4.2 KiB
Diff
88 lines
4.2 KiB
Diff
--- a/net/minecraft/server/players/OldUsersConverter.java
|
|
+++ b/net/minecraft/server/players/OldUsersConverter.java
|
|
@@ -21,6 +21,9 @@
|
|
import java.util.UUID;
|
|
import javax.annotation.Nullable;
|
|
import net.minecraft.core.UUIDUtil;
|
|
+import net.minecraft.nbt.CompoundTag;
|
|
+import net.minecraft.nbt.NbtAccounter;
|
|
+import net.minecraft.nbt.NbtIo;
|
|
import net.minecraft.server.MinecraftServer;
|
|
import net.minecraft.server.dedicated.DedicatedServer;
|
|
import net.minecraft.util.StringUtil;
|
|
@@ -62,7 +65,7 @@
|
|
return new String[i];
|
|
});
|
|
|
|
- if (server.usesAuthentication()) {
|
|
+ if (server.usesAuthentication() || org.spigotmc.SpigotConfig.bungee) { // Spigot: bungee = online mode, for now.
|
|
server.getProfileRepository().findProfilesByNames(astring, callback);
|
|
} else {
|
|
String[] astring1 = astring;
|
|
@@ -85,7 +88,7 @@
|
|
try {
|
|
gameprofilebanlist.load();
|
|
} catch (IOException ioexception) {
|
|
- OldUsersConverter.LOGGER.warn("Could not load existing file {}", gameprofilebanlist.getFile().getName(), ioexception);
|
|
+ OldUsersConverter.LOGGER.warn("Could not load existing file {}", gameprofilebanlist.getFile().getName()); // CraftBukkit - don't print stacktrace
|
|
}
|
|
}
|
|
|
|
@@ -143,7 +146,7 @@
|
|
try {
|
|
ipbanlist.load();
|
|
} catch (IOException ioexception) {
|
|
- OldUsersConverter.LOGGER.warn("Could not load existing file {}", ipbanlist.getFile().getName(), ioexception);
|
|
+ OldUsersConverter.LOGGER.warn("Could not load existing file {}", ipbanlist.getFile().getName()); // CraftBukkit - don't print stacktrace
|
|
}
|
|
}
|
|
|
|
@@ -184,7 +187,7 @@
|
|
try {
|
|
oplist.load();
|
|
} catch (IOException ioexception) {
|
|
- OldUsersConverter.LOGGER.warn("Could not load existing file {}", oplist.getFile().getName(), ioexception);
|
|
+ OldUsersConverter.LOGGER.warn("Could not load existing file {}", oplist.getFile().getName()); // CraftBukkit - don't print stacktrace
|
|
}
|
|
}
|
|
|
|
@@ -228,7 +231,7 @@
|
|
try {
|
|
whitelist.load();
|
|
} catch (IOException ioexception) {
|
|
- OldUsersConverter.LOGGER.warn("Could not load existing file {}", whitelist.getFile().getName(), ioexception);
|
|
+ OldUsersConverter.LOGGER.warn("Could not load existing file {}", whitelist.getFile().getName()); // CraftBukkit - don't print stacktrace
|
|
}
|
|
}
|
|
|
|
@@ -347,6 +350,30 @@
|
|
File file5 = new File(file, fileName + ".dat");
|
|
File file6 = new File(playerDataFolder, uuid + ".dat");
|
|
|
|
+ // CraftBukkit start - Use old file name to seed lastKnownName
|
|
+ CompoundTag root = null;
|
|
+
|
|
+ try {
|
|
+ root = NbtIo.readCompressed(new java.io.FileInputStream(file5), NbtAccounter.unlimitedHeap());
|
|
+ } catch (Exception exception) {
|
|
+ exception.printStackTrace();
|
|
+ }
|
|
+
|
|
+ if (root != null) {
|
|
+ if (!root.contains("bukkit")) {
|
|
+ root.put("bukkit", new CompoundTag());
|
|
+ }
|
|
+ CompoundTag data = root.getCompound("bukkit");
|
|
+ data.putString("lastKnownName", fileName);
|
|
+
|
|
+ try {
|
|
+ NbtIo.writeCompressed(root, new java.io.FileOutputStream(file2));
|
|
+ } catch (Exception exception) {
|
|
+ exception.printStackTrace();
|
|
+ }
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
OldUsersConverter.ensureDirectoryExists(playerDataFolder);
|
|
if (!file5.renameTo(file6)) {
|
|
throw new OldUsersConverter.ConversionError("Could not convert file for " + fileName);
|