use of com.github.dirtpowered.dirtmv.network.versions.Release47To5.entity.PlayerMovementTracker in project DirtMultiversion by DirtPowered.
the class ViaPlugin method tick.
@Override
public void tick() {
for (UserData userData : api.getAllConnections()) {
ProtocolStorage s = userData.getProtocolStorage();
if (!s.hasObject(PlayerMovementTracker.class))
return;
PlayerMovementTracker movementTracker = s.get(PlayerMovementTracker.class);
if ((System.currentTimeMillis() - movementTracker.getLastLocationUpdate()) >= 50) {
if (userData.getUniqueId() == null)
return;
UserConnection userConnection = connectionManager.getConnectedClient(userData.getUniqueId());
if (userConnection == null)
return;
ProtocolInfo protocolInfo = userConnection.getProtocolInfo();
if (protocolInfo == null)
return;
if (protocolInfo.getPipeline().contains(Protocol1_9To1_8.class) && protocolInfo.getState() == State.PLAY) {
PacketWrapper wrapper = new PacketWrapperImpl(0x03, null, userConnection);
wrapper.write(Type.BOOLEAN, true);
try {
wrapper.sendToServer(Protocol1_9To1_8.class, true);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
use of com.github.dirtpowered.dirtmv.network.versions.Release47To5.entity.PlayerMovementTracker in project DirtMultiversion by DirtPowered.
the class ProtocolRelease47To5 method onConnect.
@Override
public void onConnect(ServerSession session) {
ProtocolStorage storage = session.getStorage();
storage.set(OnGroundTracker.class, new OnGroundTracker());
storage.set(WindowTypeTracker.class, new WindowTypeTracker());
storage.set(QuickBarTracker.class, new QuickBarTracker());
// additional block storage (for nether portal rotation fix)
storage.set(PortalFrameCache.class, new PortalFrameCache());
if (session.getMain().getConfiguration().enableViaVersion()) {
// it's not needed for 1.8->1.7, but ViaVersion will need that to fix issues
// with eating, entering portals, effects (potions)
storage.set(PlayerMovementTracker.class, new PlayerMovementTracker());
}
// check if 1.6 entity tracker exists - if not, create one
if (!storage.hasObject(EntityTracker.class)) {
storage.set(V1_7EntityTracker.class, new V1_7EntityTracker());
}
// fixes block hardness inconsistencies
if (session.getMain().getConfiguration().getServerVersion() == MinecraftVersion.B1_7_3) {
storage.set(BlockMiningTimeFixer.class, new BlockMiningTimeFixer(session));
}
}
Aggregations