use of com.viaversion.viaversion.api.connection.StorableObject in project ViaVersion by ViaVersion.
the class BungeeServerHandler method onServerSwitch.
@EventHandler(priority = -120)
public void onServerSwitch(ServerSwitchEvent e) {
// Update entity id
UserConnection userConnection = Via.getManager().getConnectionManager().getConnectedClient(e.getPlayer().getUniqueId());
if (userConnection == null)
return;
int playerId;
try {
playerId = Via.getManager().getProviders().get(EntityIdProvider.class).getEntityId(userConnection);
} catch (Exception ex) {
// Ignored
return;
}
for (EntityTracker tracker : userConnection.getEntityTrackers()) {
tracker.setClientEntityId(playerId);
}
// For ViaRewind
for (StorableObject object : userConnection.getStoredObjects().values()) {
if (object instanceof ClientEntityIdChangeListener) {
((ClientEntityIdChangeListener) object).setClientEntityId(playerId);
}
}
}
Aggregations