bugfix: error spawning fake player

This commit is contained in:
tanyaofei 2025-08-14 19:23:00 +08:00
parent 07eaa9774a
commit d4bc411536

View File

@ -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;
} }