/** * Checks if the UUID is on the selected pipe * * @param uuid UUID Object * @return True if on pipe */ protected boolean isOnPipe(UUID uuid) { UserConnection userConnection = getUserConnection(uuid); return userConnection != null && userConnection.get(ProtocolInfo.class).getPipeline().contains(requiredPipeline); }
@Override public void run() { for (UserConnection info : Via.getManager().getPortedPlayers().values()) { if (info.has(ProtocolInfo.class) && info.get(ProtocolInfo.class).getPipeline().contains(Protocol1_9TO1_8.class)) { long nextIdleUpdate = info.get(MovementTracker.class).getNextIdlePacket(); if (nextIdleUpdate <= System.currentTimeMillis()) { if (info.getChannel().isOpen()) { Via.getManager().getProviders().get(MovementTransmitterProvider.class).sendPlayer(info); } } } } } }
@Override public Chunk read(ByteBuf input, ClientChunks param) throws Exception { boolean replacePistons = param.getUser().get(ProtocolInfo.class).getPipeline().contains(Protocol1_10To1_9_3_4.class) && Via.getConfig().isReplacePistons(); int replacementId = Via.getConfig().getPistonReplacementId();
@EventHandler public void onServerConnect(ServerConnectEvent event) { // Ignore if it doesn't exist (Like BungeeCord 1.8) if (setMainHand == null || getSettings == null) return; UserConnection user = Via.getManager().getConnection(event.getPlayer().getUniqueId()); if (user == null) return; try { if (user.get(ProtocolInfo.class).getPipeline().contains(Protocol1_9TO1_8.class)) { Object settings = getSettings.invoke(event.getPlayer()); if (settings != null) { if (user.has(EntityTracker.class)) { setMainHand.invoke(settings, user.get(EntityTracker.class).getMainHand()); } } } } catch (Exception e) { e.printStackTrace(); } } }
@Override public Chunk read(ByteBuf input, ClientWorld world) throws Exception { boolean replacePistons = world.getUser().get(ProtocolInfo.class).getPipeline().contains(Protocol1_10To1_9_3_4.class) && Via.getConfig().isReplacePistons(); int replacementId = Via.getConfig().getPistonReplacementId();
@Subscribe(order = PostOrder.LAST) public void onServerConnected(ServerConnectedEvent event) { UserConnection user = Via.getManager().getConnection(event.getPlayer().getUniqueId()); if (user == null) return; try { if (user.get(ProtocolInfo.class).getPipeline().contains(Protocol1_9TO1_8.class)) { int entityId = user.get(EntityTracker.class).getProvidedEntityId(); PacketWrapper wrapper = new PacketWrapper(0x39, null, user); wrapper.write(Type.VAR_INT, entityId); wrapper.write(Types1_9.METADATA_LIST, Collections.singletonList(new Metadata(0, MetaType1_9.Byte, (byte) 0))); wrapper.send(Protocol1_9TO1_8.class); } } catch (Exception e) { e.printStackTrace(); } } }
@EventHandler(priority = EventPriority.HIGH) public void onServerConnected(ServerConnectedEvent event) { UserConnection user = Via.getManager().getConnection(event.getPlayer().getUniqueId()); if (user == null) return; try { if (user.get(ProtocolInfo.class).getPipeline().contains(Protocol1_9TO1_8.class)) { int entityId = user.get(EntityTracker.class).getProvidedEntityId(); PacketWrapper wrapper = new PacketWrapper(0x39, null, user); wrapper.write(Type.VAR_INT, entityId); wrapper.write(Types1_9.METADATA_LIST, Collections.singletonList(new Metadata(0, MetaType1_9.Byte, (byte) 0))); wrapper.send(Protocol1_9TO1_8.class); } } catch (Exception e) { e.printStackTrace(); } } }
@Subscribe public void onServerConnect(ServerConnectedEvent event) { UserConnection user = Via.getManager().getConnection(event.getPlayer().getUniqueId()); if (user == null || setSettings == null) return; try { if (user.get(ProtocolInfo.class).getPipeline().contains(Protocol1_9TO1_8.class)) { PlayerSettings settings = event.getPlayer().getPlayerSettings(); if (user.has(EntityTracker.class)) { Object clientSettings = ReflectionUtil.get(settings, "settings", Object.class); ReflectionUtil.set(clientSettings, "mainHand", user.get(EntityTracker.class).getMainHand()); setSettings.invoke(event.getPlayer(), clientSettings); } } } catch (Exception e) { e.printStackTrace(); } } }