mirror of
https://github.com/tanyaofei/minecraft-fakeplayer.git
synced 2025-09-14 03:06:46 +08:00
bugfix: error spawning fake player
This commit is contained in:
parent
07eaa9774a
commit
d4bc411536
@ -40,7 +40,11 @@ public class FakeServerGamePacketListenerImpl extends ServerGamePacketListenerIm
|
|||||||
private boolean addChannel(@NotNull Player player, @NotNull String channel) {
|
private boolean addChannel(@NotNull Player player, @NotNull String channel) {
|
||||||
try {
|
try {
|
||||||
var method = player.getClass().getMethod("addChannel", String.class);
|
var method = player.getClass().getMethod("addChannel", String.class);
|
||||||
return (boolean) method.invoke(player, channel);
|
var ret = method.invoke(player, channel);
|
||||||
|
if (ret instanceof Boolean success) {
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user