1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
--- a/net/minecraft/server/players/OldUsersConverter.java
+++ b/net/minecraft/server/players/OldUsersConverter.java
@@ -63,9 +86,9 @@
if (OLD_USERBANLIST.exists() && OLD_USERBANLIST.isFile()) {
if (userBanList.getFile().exists()) {
try {
- userBanList.load();
- } catch (IOException var6) {
- LOGGER.warn("Could not load existing file {}", userBanList.getFile().getName(), var6);
+ gameprofilebanlist.load();
+ } catch (IOException ioexception) {
+ OldUsersConverter.LOGGER.warn("Could not load existing file {}", gameprofilebanlist.getFile().getName()); // CraftBukkit - don't print stacktrace
}
}
@@ -118,9 +144,9 @@
if (OLD_IPBANLIST.exists() && OLD_IPBANLIST.isFile()) {
if (ipBanList.getFile().exists()) {
try {
- ipBanList.load();
- } catch (IOException var11) {
- LOGGER.warn("Could not load existing file {}", ipBanList.getFile().getName(), var11);
+ ipbanlist.load();
+ } catch (IOException ioexception) {
+ OldUsersConverter.LOGGER.warn("Could not load existing file {}", ipbanlist.getFile().getName()); // CraftBukkit - don't print stacktrace
}
}
@@ -154,9 +185,9 @@
if (OLD_OPLIST.exists() && OLD_OPLIST.isFile()) {
if (serverOpList.getFile().exists()) {
try {
- serverOpList.load();
- } catch (IOException var6) {
- LOGGER.warn("Could not load existing file {}", serverOpList.getFile().getName(), var6);
+ oplist.load();
+ } catch (IOException ioexception) {
+ OldUsersConverter.LOGGER.warn("Could not load existing file {}", oplist.getFile().getName()); // CraftBukkit - don't print stacktrace
}
}
@@ -198,9 +229,9 @@
if (OLD_WHITELIST.exists() && OLD_WHITELIST.isFile()) {
if (userWhiteList.getFile().exists()) {
try {
- userWhiteList.load();
- } catch (IOException var6) {
- LOGGER.warn("Could not load existing file {}", userWhiteList.getFile().getName(), var6);
+ whitelist.load();
+ } catch (IOException ioexception) {
+ OldUsersConverter.LOGGER.warn("Could not load existing file {}", whitelist.getFile().getName()); // CraftBukkit - don't print stacktrace
}
}
@@ -310,11 +346,36 @@
}
}
- private void movePlayerFile(File file3, String oldFileName, String newFileName) {
- File file4 = new File(worldPlayersDirectory, oldFileName + ".dat");
- File file5 = new File(file3, newFileName + ".dat");
- OldUsersConverter.ensureDirectoryExists(file3);
- if (!file4.renameTo(file5)) {
+ private void movePlayerFile(File file, String oldFileName, String newFileName) {
+ File file5 = new File(file, oldFileName + ".dat");
+ File file6 = new File(file, newFileName + ".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", oldFileName);
+
+ try {
+ NbtIo.writeCompressed(root, new java.io.FileOutputStream(file2));
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ }
+ // CraftBukkit end
+
+ OldUsersConverter.ensureDirectoryExists(file);
+ if (!file5.renameTo(file6)) {
throw new OldUsersConverter.ConversionError("Could not convert file for " + oldFileName);
}
}
|