public static BlockConnectionProvider getProvider() { return Via.getManager().getProviders().get(BlockConnectionProvider.class); }
public void removeEntity(Integer entityID) { clientEntityTypes.remove(entityID); vehicleMap.remove(entityID); uuidMap.remove(entityID); validBlocking.remove(entityID); knownHolograms.remove(entityID); metadataBuffer.remove(entityID); BossBar bar = bossBarMap.remove(entityID); if (bar != null) { bar.hide(); // Send to provider Via.getManager().getProviders().get(BossBarProvider.class).handleRemove(getUser(), bar.getId()); } }
public int getBlockData(UserConnection user, Position position) { return Via.getManager().getProviders().get(BlockConnectionProvider.class).getBlockdata(user, position); }
public List<Object> transformMapChunkBulk(Object packet) throws Exception { return Via.getManager().getProviders().get(BulkChunkTranslatorProvider.class).transformMapChunkBulk(packet, this); } }
@Override public boolean isFiltered(Class packetClass) { return Via.getManager().getProviders().get(BulkChunkTranslatorProvider.class).isFiltered(packetClass); }
public static Item getHandItem(final UserConnection info) { return Via.getManager().getProviders().get(HandItemProvider.class).getHandItem(info); }
public int getProvidedEntityId() { try { return Via.getManager().getProviders().get(EntityIdProvider.class).getEntityId(getUser()); } catch (Exception e) { return entityID; } } }
@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); } } } } } }
public static void update(UserConnection user, Position position) { for (int x = -1; x <= 1; x++) { for (int z = -1; z <= 1; z++) { for (int y = -1; y <= 1; y++) { if (Math.abs(x) + Math.abs(y) + Math.abs(z) != 1) continue; Position pos = new Position(position.getX() + x, position.getY() + y, position.getZ() + z); int blockState = Via.getManager().getProviders().get(BlockConnectionProvider.class).getBlockdata(user, pos); if (!connects(blockState)) continue; int newBlockState = connect(user, pos, blockState); if (newBlockState == blockState) continue; PacketWrapper blockUpdatePacket = new PacketWrapper(0x0B, null, user); blockUpdatePacket.write(Type.POSITION, pos); blockUpdatePacket.write(Type.VAR_INT, newBlockState); try { blockUpdatePacket.send(Protocol1_13To1_12_2.class, true, false); } catch (Exception ex) { ex.printStackTrace(); } } } } }
@Override public void init(UserConnection userConnection) { userConnection.put(new EntityTracker(userConnection)); userConnection.put(new TabCompleteTracker(userConnection)); if (!userConnection.has(ClientWorld.class)) userConnection.put(new ClientWorld(userConnection)); userConnection.put(new BlockStorage(userConnection)); if (Via.getConfig().isServersideBlockConnections()) { if (Via.getManager().getProviders().get(BlockConnectionProvider.class) instanceof PacketBlockConnectionProvider) { userConnection.put(new BlockConnectionStorage(userConnection)); } } }