3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-22 14:28:09 +01:00
Paper/nms-patches/NameReferencingFileConverter.patch

136 Zeilen
7.9 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/NameReferencingFileConverter.java
+++ b/net/minecraft/server/NameReferencingFileConverter.java
2018-07-15 02:00:00 +02:00
@@ -83,8 +83,9 @@
if (gameprofilebanlist.c().exists()) {
try {
gameprofilebanlist.load();
- } catch (FileNotFoundException filenotfoundexception) {
2017-05-14 04:00:00 +02:00
- NameReferencingFileConverter.e.warn("Could not load existing file {}", gameprofilebanlist.c().getName(), filenotfoundexception);
+ // CraftBukkit start - FileNotFoundException -> IOException, don't print stacktrace
+ } catch (IOException filenotfoundexception) {
2017-05-14 04:00:00 +02:00
+ NameReferencingFileConverter.e.warn("Could not load existing file {}", gameprofilebanlist.c().getName());
}
}
2018-12-13 01:00:00 +01:00
@@ -113,7 +114,7 @@
public void onProfileLookupFailed(GameProfile gameprofile, Exception exception) {
NameReferencingFileConverter.e.warn("Could not lookup user banlist entry for {}", gameprofile.getName(), exception);
if (!(exception instanceof ProfileNotFoundException)) {
- throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception, null);
+ throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception); // CraftBukkit - decompile error
}
}
};
2018-07-15 02:00:00 +02:00
@@ -141,8 +142,9 @@
if (ipbanlist.c().exists()) {
try {
ipbanlist.load();
- } catch (FileNotFoundException filenotfoundexception) {
2017-05-14 04:00:00 +02:00
- NameReferencingFileConverter.e.warn("Could not load existing file {}", ipbanlist.c().getName(), filenotfoundexception);
+ // CraftBukkit start - FileNotFoundException -> IOException, don't print stacktrace
+ } catch (IOException filenotfoundexception) {
2017-05-14 04:00:00 +02:00
+ NameReferencingFileConverter.e.warn("Could not load existing file {}", ipbanlist.c().getName());
}
}
2018-07-15 02:00:00 +02:00
@@ -182,8 +184,9 @@
if (oplist.c().exists()) {
try {
oplist.load();
- } catch (FileNotFoundException filenotfoundexception) {
2017-05-14 04:00:00 +02:00
- NameReferencingFileConverter.e.warn("Could not load existing file {}", oplist.c().getName(), filenotfoundexception);
+ // CraftBukkit start - FileNotFoundException -> IOException, don't print stacktrace
+ } catch (IOException filenotfoundexception) {
2017-05-14 04:00:00 +02:00
+ NameReferencingFileConverter.e.warn("Could not load existing file {}", oplist.c().getName());
}
}
2018-12-13 01:00:00 +01:00
@@ -198,7 +201,7 @@
public void onProfileLookupFailed(GameProfile gameprofile, Exception exception) {
NameReferencingFileConverter.e.warn("Could not lookup oplist entry for {}", gameprofile.getName(), exception);
if (!(exception instanceof ProfileNotFoundException)) {
- throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception, null);
+ throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception); // CraftBukkit - decompile error
}
}
};
2018-07-15 02:00:00 +02:00
@@ -226,8 +229,9 @@
if (whitelist.c().exists()) {
try {
whitelist.load();
- } catch (FileNotFoundException filenotfoundexception) {
2017-05-14 04:00:00 +02:00
- NameReferencingFileConverter.e.warn("Could not load existing file {}", whitelist.c().getName(), filenotfoundexception);
+ // CraftBukkit start - FileNotFoundException -> IOException, don't print stacktrace
+ } catch (IOException filenotfoundexception) {
2017-05-14 04:00:00 +02:00
+ NameReferencingFileConverter.e.warn("Could not load existing file {}", whitelist.c().getName());
}
}
2018-12-13 01:00:00 +01:00
@@ -242,7 +246,7 @@
public void onProfileLookupFailed(GameProfile gameprofile, Exception exception) {
NameReferencingFileConverter.e.warn("Could not lookup user whitelist entry for {}", gameprofile.getName(), exception);
if (!(exception instanceof ProfileNotFoundException)) {
- throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception, null);
+ throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception); // CraftBukkit - decompile error
}
}
};
@@ -337,7 +341,7 @@
this.a(file, s, s);
} else {
- throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception, null);
+ throw new NameReferencingFileConverter.FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception); // CraftBukkit - decompile error
}
}
2018-07-15 02:00:00 +02:00
@@ -345,6 +349,30 @@
2015-02-26 23:41:06 +01:00
File file1 = new File(file2, s + ".dat");
File file3 = new File(file, s1 + ".dat");
+ // CraftBukkit start - Use old file name to seed lastKnownName
+ NBTTagCompound root = null;
+
+ try {
+ root = NBTCompressedStreamTools.a(new java.io.FileInputStream(file1));
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+
+ if (root != null) {
+ if (!root.hasKey("bukkit")) {
+ root.set("bukkit", new NBTTagCompound());
+ }
+ NBTTagCompound data = root.getCompound("bukkit");
+ data.setString("lastKnownName", s);
+
+ try {
+ NBTCompressedStreamTools.a(root, new java.io.FileOutputStream(file2));
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ }
+ // CraftBukkit end
+
NameReferencingFileConverter.b(file);
if (!file1.renameTo(file3)) {
throw new NameReferencingFileConverter.FileConversionException("Could not convert file for " + s, null);
2018-07-15 02:00:00 +02:00
@@ -353,7 +381,7 @@
2016-06-09 03:43:49 +02:00
private String a(GameProfile gameprofile) {
String s = null;
- String[] astring = astring1;
+ // String[] astring = astring1; // CraftBukkit - decompile error
int i = astring.length;
for (int j = 0; j < i; ++j) {
2018-07-15 02:00:00 +02:00
@@ -466,7 +494,7 @@
private static File d(PropertyManager propertymanager) {
String s = propertymanager.getString("level-name", "world");
- File file = new File(s);
+ File file = new File(MinecraftServer.getServer().server.getWorldContainer(), s); // CraftBukkit - Respect container setting
return new File(file, "players");
}