Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-03 14:50:30 +01:00
Ensure that the player is online.
Dieser Commit ist enthalten in:
Ursprung
057ab050ea
Commit
acb7372eb7
@ -50,7 +50,7 @@ public class ViaIdleThread extends BukkitRunnable {
|
|||||||
} catch (NoSuchFieldException | InstantiationException | IllegalArgumentException | IllegalAccessException e) {
|
} catch (NoSuchFieldException | InstantiationException | IllegalArgumentException | IllegalAccessException e) {
|
||||||
throw new RuntimeException("Couldn't make player idle packet, help!", e);
|
throw new RuntimeException("Couldn't make player idle packet, help!", e);
|
||||||
}
|
}
|
||||||
if(USE_NMS) {
|
if (USE_NMS) {
|
||||||
try {
|
try {
|
||||||
getHandle = ReflectionUtil.obc("entity.CraftPlayer").getDeclaredMethod("getHandle");
|
getHandle = ReflectionUtil.obc("entity.CraftPlayer").getDeclaredMethod("getHandle");
|
||||||
} catch (NoSuchMethodException | ClassNotFoundException e) {
|
} catch (NoSuchMethodException | ClassNotFoundException e) {
|
||||||
@ -70,6 +70,7 @@ public class ViaIdleThread extends BukkitRunnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (UserConnection info : portedPlayers.values()) {
|
for (UserConnection info : portedPlayers.values()) {
|
||||||
@ -79,15 +80,19 @@ public class ViaIdleThread extends BukkitRunnable {
|
|||||||
if (info.getChannel().isOpen()) {
|
if (info.getChannel().isOpen()) {
|
||||||
if (USE_NMS) {
|
if (USE_NMS) {
|
||||||
Player player = Bukkit.getPlayer(info.get(ProtocolInfo.class).getUuid());
|
Player player = Bukkit.getPlayer(info.get(ProtocolInfo.class).getUuid());
|
||||||
try {
|
if (player != null) {
|
||||||
// Tick player
|
try {
|
||||||
Object entityPlayer = getHandle.invoke(player);
|
// Tick player
|
||||||
Object pc = connection.get(entityPlayer);
|
Object entityPlayer = getHandle.invoke(player);
|
||||||
handleFlying.invoke(pc, (info.get(MovementTracker.class).isGround() ? idlePacket2 : idlePacket));
|
Object pc = connection.get(entityPlayer);
|
||||||
// Tick world
|
if (pc != null) {
|
||||||
info.get(MovementTracker.class).incrementIdlePacket();
|
handleFlying.invoke(pc, (info.get(MovementTracker.class).isGround() ? idlePacket2 : idlePacket));
|
||||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
// Tick world
|
||||||
e.printStackTrace();
|
info.get(MovementTracker.class).incrementIdlePacket();
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Old method using packets.
|
// Old method using packets.
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren