mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Fixes an OfflinePlayerUtil breakage caused by NMS Changes
This commit is contained in:
parent
01d2b0024f
commit
48d3c2105d
@ -97,6 +97,17 @@ public class OfflinePlayerUtil {
|
|||||||
return callConstructor(c, worldServer);
|
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() {
|
public static Object getWorldServerNew() {
|
||||||
Object server = getMinecraftServer();
|
Object server = getMinecraftServer();
|
||||||
Class<?> minecraftServerClass = getNmsClass("MinecraftServer");
|
Class<?> minecraftServerClass = getNmsClass("MinecraftServer");
|
||||||
@ -115,7 +126,11 @@ public class OfflinePlayerUtil {
|
|||||||
try {
|
try {
|
||||||
o = callMethod(getWorldServer, server, 0);
|
o = callMethod(getWorldServer, server, 0);
|
||||||
} catch (final RuntimeException e) {
|
} catch (final RuntimeException e) {
|
||||||
o = getWorldServerNew();
|
try {
|
||||||
|
o = getWorldServerNew();
|
||||||
|
} catch (final RuntimeException f) {
|
||||||
|
o = getWorldServer116();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user