mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-08 08:02:13 -07:00
Remap CraftBukkit to Mojang+Yarn Mappings
By: Initial Source <noreply+automated@papermc.io>
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
--- 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;
|
||||
@@ -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);
|
Reference in New Issue
Block a user