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
97
98
|
package net.minecraft.server;
import java.io.File;
import java.util.UUID;
import net.minecraft.util.com.mojang.authlib.GameProfile;
import net.minecraft.util.com.mojang.authlib.ProfileLookupCallback;
import net.minecraft.util.com.mojang.authlib.yggdrasil.ProfileNotFoundException;
final class PlayerDatFileConverter implements ProfileLookupCallback {
final DedicatedServer a;
final File b;
final File c;
final File d;
final String[] e;
PlayerDatFileConverter(DedicatedServer dedicatedserver, File file1, File file2, File file3, String[] astring) {
this.a = dedicatedserver;
this.b = file1;
this.c = file2;
this.d = file3;
this.e = astring;
}
public void onProfileLookupSucceeded(GameProfile gameprofile) {
this.a.getUserCache().a(gameprofile);
UUID uuid = gameprofile.getId();
if (uuid == null) {
throw new FileConversionException("Missing UUID for user profile " + gameprofile.getName(), (PredicateEmptyList) null);
} else {
this.a(this.b, this.a(gameprofile), uuid.toString());
}
}
public void onProfileLookupFailed(GameProfile gameprofile, Exception exception) {
NameReferencingFileConverter.a().warn("Could not lookup user uuid for " + gameprofile.getName(), exception);
if (exception instanceof ProfileNotFoundException) {
String s = this.a(gameprofile);
this.a(this.c, s, s);
} else {
throw new FileConversionException("Could not request user " + gameprofile.getName() + " from backend systems", exception, (PredicateEmptyList) null);
}
}
private void a(File file1, String s, String s1) {
File file2 = new File(this.d, s + ".dat");
File file3 = new File(file1, s1 + ".dat");
// CraftBukkit start - Use old file name to seed lastKnownName
NBTTagCompound root = null;
try {
root = NBTCompressedStreamTools.a(new java.io.FileInputStream(file2));
} 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.a(file1);
if (!file2.renameTo(file3)) {
throw new FileConversionException("Could not convert file for " + s, (PredicateEmptyList) null);
}
}
private String a(GameProfile gameprofile) {
String s = null;
for (int i = 0; i < this.e.length; ++i) {
if (this.e[i] != null && this.e[i].equalsIgnoreCase(gameprofile.getName())) {
s = this.e[i];
break;
}
}
if (s == null) {
throw new FileConversionException("Could not find the filename for " + gameprofile.getName() + " anymore", (PredicateEmptyList) null);
} else {
return s;
}
}
}
|