mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2024-12-23 00:15:06 +00:00
Fixes an OfflinePlayerUtil breakage caused by NMS Changes
This commit is contained in:
parent
01d2b0024f
commit
48d3c2105d
1 changed files with 16 additions and 1 deletions
|
@ -97,6 +97,17 @@ public class OfflinePlayerUtil {
|
|||
return callConstructor(c, worldServer);
|
||||
}
|
||||
|
||||
public static Object getWorldServer116() {
|
||||
Object server = getMinecraftServer();
|
||||
Class<?> minecraftServerClass = getNmsClass("MinecraftServer");
|
||||
Class<?> dimensionManager = getNmsClass("DimensionManager");
|
||||
Class<?> genericResourceKey = getNmsClass("ResourceKey");
|
||||
Object overworld = getField(makeField(dimensionManager, "OVERWORLD"), null);
|
||||
Method getWorldServer =
|
||||
makeMethod(minecraftServerClass, "getWorldServer", genericResourceKey);
|
||||
return callMethod(getWorldServer, server, overworld);
|
||||
}
|
||||
|
||||
public static Object getWorldServerNew() {
|
||||
Object server = getMinecraftServer();
|
||||
Class<?> minecraftServerClass = getNmsClass("MinecraftServer");
|
||||
|
@ -115,7 +126,11 @@ public class OfflinePlayerUtil {
|
|||
try {
|
||||
o = callMethod(getWorldServer, server, 0);
|
||||
} catch (final RuntimeException e) {
|
||||
o = getWorldServerNew();
|
||||
try {
|
||||
o = getWorldServerNew();
|
||||
} catch (final RuntimeException f) {
|
||||
o = getWorldServer116();
|
||||
}
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue