Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-27 16:40:10 +01:00
Use existing ProtocolVersion#getProtocol when possible (#3720)
Dieser Commit ist enthalten in:
Ursprung
26a8e5fef1
Commit
3c0930c62f
@ -139,7 +139,7 @@ public interface ProtocolManager {
|
||||
|
||||
@Deprecated
|
||||
default @Nullable List<ProtocolPathEntry> getProtocolPath(int clientVersion, int serverVersion) {
|
||||
return getProtocolPath(ProtocolVersion.getProtocol(VersionType.RELEASE, clientVersion), ProtocolVersion.getProtocol(VersionType.RELEASE, serverVersion));
|
||||
return getProtocolPath(ProtocolVersion.getProtocol(clientVersion), ProtocolVersion.getProtocol(serverVersion));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -162,7 +162,7 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf
|
||||
private BlockedProtocolVersions loadBlockedProtocolVersions() {
|
||||
List<Integer> blockProtocols = getListSafe("block-protocols", Integer.class, "Invalid blocked version protocol found in config: '%s'");
|
||||
List<String> blockVersions = getListSafe("block-versions", String.class, "Invalid blocked version found in config: '%s'");
|
||||
ObjectSet<ProtocolVersion> blockedProtocols = blockProtocols.stream().map(integer -> ProtocolVersion.getProtocol(VersionType.RELEASE, integer)).collect(ObjectOpenHashSet::of, ObjectSet::add, ObjectSet::addAll);
|
||||
ObjectSet<ProtocolVersion> blockedProtocols = blockProtocols.stream().map(ProtocolVersion::getProtocol).collect(ObjectOpenHashSet::of, ObjectSet::add, ObjectSet::addAll);
|
||||
ProtocolVersion lowerBound = ProtocolVersion.unknown;
|
||||
ProtocolVersion upperBound = ProtocolVersion.unknown;
|
||||
for (String s : blockVersions) {
|
||||
|
@ -45,20 +45,20 @@ public abstract class AbstractProtocolDetectorService implements ProtocolDetecto
|
||||
lock.readLock().unlock();
|
||||
}
|
||||
if (detectedProtocol != -1) {
|
||||
return ProtocolVersion.getProtocol(VersionType.RELEASE, detectedProtocol);
|
||||
return ProtocolVersion.getProtocol(detectedProtocol);
|
||||
}
|
||||
|
||||
// Step 2. Check config (CME moment?)
|
||||
final Map<String, Integer> servers = configuredServers();
|
||||
final Integer protocol = servers.get(serverName);
|
||||
if (protocol != null) {
|
||||
return ProtocolVersion.getProtocol(VersionType.RELEASE, protocol);
|
||||
return ProtocolVersion.getProtocol(protocol);
|
||||
}
|
||||
|
||||
// Step 3. Use Default (CME moment intensifies?)
|
||||
final Integer defaultProtocol = servers.get("default");
|
||||
if (defaultProtocol != null) {
|
||||
return ProtocolVersion.getProtocol(VersionType.RELEASE, defaultProtocol);
|
||||
return ProtocolVersion.getProtocol(defaultProtocol);
|
||||
}
|
||||
|
||||
// Step 4: Use the proxy's lowest supported... *cries*
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren