3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-07-06 07:18:03 +02:00

Don’t support older versions if protocol support is installed, fixes #615

Dieser Commit ist enthalten in:
Myles 2017-01-30 17:15:47 +00:00
Ursprung 5e437d26d9
Commit 0388f340cc
5 geänderte Dateien mit 36 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -253,4 +253,9 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform {
return platformSpecific;
}
@Override
public boolean isOldClientsAllowed() {
return !protocolSupport; // Use protocolsupport for older clients
}
}

Datei anzeigen

@ -155,6 +155,11 @@ public class BungeePlugin extends Plugin implements ViaPlatform, Listener {
return platformSpecific;
}
@Override
public boolean isOldClientsAllowed() {
return true;
}
@EventHandler
public void onQuit(PlayerDisconnectEvent e) {
Via.getManager().removePortedClient(e.getPlayer().getUniqueId());

Datei anzeigen

@ -140,4 +140,12 @@ public interface ViaPlatform<T> {
* @return The json data
*/
JsonObject getDump();
/**
* Get if older clients are allowed to be used using ViaVersion.
* (Only 1.9 on 1.9.2 server is supported by ViaVersion alone)
*
* @return True if allowed
*/
boolean isOldClientsAllowed();
}

Datei anzeigen

@ -72,7 +72,12 @@ public class BaseProtocol extends Protocol {
ProtocolRegistry.SERVER_PROTOCOL = protocolVersion;
int protocol = Via.getManager().getProviders().get(VersionProvider.class).getServerProtocol(wrapper.user());
List<Pair<Integer, Protocol>> protocols = ProtocolRegistry.getProtocolPath(info.getProtocolVersion(), protocol);
List<Pair<Integer, Protocol>> protocols = null;
// Only allow newer clients or (1.9.2 on 1.9.4 server if the server supports it)
if (info.getProtocolVersion() >= protocol || Via.getPlatform().isOldClientsAllowed()) {
protocols = ProtocolRegistry.getProtocolPath(info.getProtocolVersion(), protocol);
}
if (protocols != null) {
if (protocolVersion != 9999) {
@ -163,7 +168,13 @@ public class BaseProtocol extends Protocol {
info.setProtocolVersion(protVer);
// Choose the pipe
int protocol = Via.getManager().getProviders().get(VersionProvider.class).getServerProtocol(wrapper.user());
List<Pair<Integer, Protocol>> protocols = ProtocolRegistry.getProtocolPath(info.getProtocolVersion(), protocol);
List<Pair<Integer, Protocol>> protocols = null;
// Only allow newer clients or (1.9.2 on 1.9.4 server if the server supports it)
if (info.getProtocolVersion() >= protocol || Via.getPlatform().isOldClientsAllowed()) {
protocols = ProtocolRegistry.getProtocolPath(info.getProtocolVersion(), protocol);
}
ProtocolPipeline pipeline = wrapper.user().get(ProtocolInfo.class).getPipeline();
if (protocols != null) {
for (Pair<Integer, Protocol> prot : protocols) {

Datei anzeigen

@ -199,4 +199,9 @@ public class SpongePlugin implements ViaPlatform {
return platformSpecific;
}
@Override
public boolean isOldClientsAllowed() {
return true;
}
}