mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-09-29 15:07:29 +02:00
Ensure that the player is online.
This commit is contained in:
parent
057ab050ea
commit
acb7372eb7
@ -70,6 +70,7 @@ public class ViaIdleThread extends BukkitRunnable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (UserConnection info : portedPlayers.values()) {
|
||||
@ -79,16 +80,20 @@ public class ViaIdleThread extends BukkitRunnable {
|
||||
if (info.getChannel().isOpen()) {
|
||||
if (USE_NMS) {
|
||||
Player player = Bukkit.getPlayer(info.get(ProtocolInfo.class).getUuid());
|
||||
if (player != null) {
|
||||
try {
|
||||
// Tick player
|
||||
Object entityPlayer = getHandle.invoke(player);
|
||||
Object pc = connection.get(entityPlayer);
|
||||
if (pc != null) {
|
||||
handleFlying.invoke(pc, (info.get(MovementTracker.class).isGround() ? idlePacket2 : idlePacket));
|
||||
// Tick world
|
||||
info.get(MovementTracker.class).incrementIdlePacket();
|
||||
}
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Old method using packets.
|
||||
ChannelHandlerContext context = PipelineUtil.getContextBefore("decoder", info.getChannel().pipeline());
|
||||
|
Loading…
Reference in New Issue
Block a user