public static void register(@NonNull ProtocolVersion protocol) { versions.put(protocol.getId(), protocol); versionList.add(protocol); }
@Override public String toString() { return String.format("%s(%d)", this.getName(), this.getId()); } }
default void init(ViaRewindConfig config) { ViaRewind.init(this, config); ProtocolRegistry.registerProtocol(new Protocol1_8TO1_9(), Collections.singletonList(ProtocolVersion.v1_8.getId()), ProtocolVersion.v1_9.getId()); ProtocolRegistry.registerProtocol(new Protocol1_7_6_10TO1_8(), Collections.singletonList(ProtocolVersion.v1_7_6.getId()), ProtocolVersion.v1_8.getId()); ProtocolRegistry.registerProtocol(new Protocol1_7_0_5to1_7_6_10(), Collections.singletonList(ProtocolVersion.v1_7_1.getId()), ProtocolVersion.v1_7_6.getId()); }
public static void refreshVersions() { supportedVersions.clear(); supportedVersions.add(ProtocolRegistry.SERVER_PROTOCOL); for (ProtocolVersion versions : ProtocolVersion.getProtocols()) { List<Pair<Integer, Protocol>> paths = getProtocolPath(versions.getId(), ProtocolRegistry.SERVER_PROTOCOL); if (paths == null) continue; supportedVersions.add(versions.getId()); for (Pair<Integer, Protocol> path : paths) supportedVersions.add(path.getKey()); } }
/** * Initialize ViaBackwards */ default void init() { ViaBackwards.init(this); if (!isOutdated()) { ProtocolRegistry.registerProtocol(new Protocol1_9_4To1_10(), Collections.singletonList(ProtocolVersion.v1_9_3.getId()), ProtocolVersion.v1_10.getId()); ProtocolRegistry.registerProtocol(new Protocol1_10To1_11(), Collections.singletonList(ProtocolVersion.v1_10.getId()), ProtocolVersion.v1_11.getId()); ProtocolRegistry.registerProtocol(new Protocol1_11To1_11_1(), Collections.singletonList(ProtocolVersion.v1_11.getId()), ProtocolVersion.v1_11_1.getId()); ProtocolRegistry.registerProtocol(new Protocol1_11_1To1_12(), Collections.singletonList(ProtocolVersion.v1_11_1.getId()), ProtocolVersion.v1_12.getId()); ProtocolRegistry.registerProtocol(new Protocol1_12To1_12_1(), Collections.singletonList(ProtocolVersion.v1_12.getId()), ProtocolVersion.v1_12_1.getId()); ProtocolRegistry.registerProtocol(new Protocol1_12_1To1_12_2(), Collections.singletonList(ProtocolVersion.v1_12_1.getId()), ProtocolVersion.v1_12_2.getId()); } }
ProtocolVersion found = ProtocolVersion.getClosest((String) entry.getValue()); if (found != null) { servers.put(entry.getKey(), found.getId()); } else {
ProtocolVersion found = ProtocolVersion.getClosest((String) entry.getValue()); if (found != null) { servers.put(entry.getKey(), found.getId()); } else {
private void sendPacket(UUID uuid, PacketWrapper wrapper) { if (!Via.getAPI().isPorted(uuid) || !(Via.getAPI().getPlayerVersion(uuid) >= ProtocolVersion.v1_9.getId())) { players.remove(uuid); return; } try { wrapper.send(Protocol1_9TO1_8.class); } catch (Exception e) { e.printStackTrace(); } }
this.windowClickPacketClass = NMSUtil.nms("PacketPlayInWindowClick"); int protocolId = ProtocolRegistry.SERVER_PROTOCOL; if (protocolId >= ProtocolVersion.v1_9.getId()) { Class<?> eclassz = NMSUtil.nms("InventoryClickType"); Object[] constants = eclassz.getEnumConstants();
public static Integer getProtocolId(String serverName) { // Step 1. Check Config Map<String, Integer> servers = ((VelocityViaConfig) Via.getConfig()).getVelocityServerProtocols(); Integer protocol = servers.get(serverName); if (protocol != null) { return protocol; } // Step 2. Check Detected Integer detectedProtocol = detectedProtocolIds.get(serverName); if (detectedProtocol != null) { return detectedProtocol; } // Step 3. Use Default Integer defaultProtocol = servers.get("default"); if (defaultProtocol != null) { return defaultProtocol; } // Step 4: Use bungee lowest supported... *cries* try { return Via.getManager().getInjector().getServerProtocolVersion(); } catch (Exception e) { e.printStackTrace(); return ProtocolVersion.v1_8.getId(); } }
int protocolId = ProtocolRegistry.SERVER_PROTOCOL; if (protocolId == ProtocolVersion.v1_8.getId()) { return false;
if (protocolId == ProtocolVersion.v1_8.getId()) { if (tinvtype == InventoryType.BREWING) { ReflectionUtil.set(packet, "item", nmsItem); int protocolId = ProtocolRegistry.SERVER_PROTOCOL; if (protocolId == ProtocolVersion.v1_8.getId()) { ReflectionUtil.set(packet, "shift", 1); } else if (protocolId >= ProtocolVersion.v1_9.getId()) { // 1.9+ ReflectionUtil.set(packet, "shift", clickTypeEnum);
if (protocolId <= ProtocolVersion.v1_8.getId()) { // 1.8 doesn't have BossBar packet if (storage.getBossbar() != null) { for (UUID uuid : storage.getBossbar()) { PluginMessage plMsg = (PluginMessage) message; String channel = plMsg.getTag(); int id1_13 = ProtocolVersion.v1_13.getId(); if (previousServerProtocol != -1) { if (previousServerProtocol < id1_13 && protocolId >= id1_13) {
|| Bukkit.getVersion().toLowerCase().contains("taco") || Bukkit.getVersion().toLowerCase().contains("torch")) && ProtocolRegistry.SERVER_PROTOCOL < ProtocolVersion.v1_12.getId()) { plugin.getLogger().info("Enabling Paper/TacoSpigot/Torch patch: Fixes block placement."); storeListener(new PaperPatch(plugin)).register();