Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 08:10:09 +01:00
Don’t support older versions if protocol support is installed, fixes #615
Dieser Commit ist enthalten in:
Ursprung
5e437d26d9
Commit
0388f340cc
@ -253,4 +253,9 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform {
|
|||||||
|
|
||||||
return platformSpecific;
|
return platformSpecific;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOldClientsAllowed() {
|
||||||
|
return !protocolSupport; // Use protocolsupport for older clients
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,6 +155,11 @@ public class BungeePlugin extends Plugin implements ViaPlatform, Listener {
|
|||||||
return platformSpecific;
|
return platformSpecific;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOldClientsAllowed() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onQuit(PlayerDisconnectEvent e) {
|
public void onQuit(PlayerDisconnectEvent e) {
|
||||||
Via.getManager().removePortedClient(e.getPlayer().getUniqueId());
|
Via.getManager().removePortedClient(e.getPlayer().getUniqueId());
|
||||||
|
@ -140,4 +140,12 @@ public interface ViaPlatform<T> {
|
|||||||
* @return The json data
|
* @return The json data
|
||||||
*/
|
*/
|
||||||
JsonObject getDump();
|
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();
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,12 @@ public class BaseProtocol extends Protocol {
|
|||||||
ProtocolRegistry.SERVER_PROTOCOL = protocolVersion;
|
ProtocolRegistry.SERVER_PROTOCOL = protocolVersion;
|
||||||
|
|
||||||
int protocol = Via.getManager().getProviders().get(VersionProvider.class).getServerProtocol(wrapper.user());
|
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 (protocols != null) {
|
||||||
if (protocolVersion != 9999) {
|
if (protocolVersion != 9999) {
|
||||||
@ -163,7 +168,13 @@ public class BaseProtocol extends Protocol {
|
|||||||
info.setProtocolVersion(protVer);
|
info.setProtocolVersion(protVer);
|
||||||
// Choose the pipe
|
// Choose the pipe
|
||||||
int protocol = Via.getManager().getProviders().get(VersionProvider.class).getServerProtocol(wrapper.user());
|
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();
|
ProtocolPipeline pipeline = wrapper.user().get(ProtocolInfo.class).getPipeline();
|
||||||
if (protocols != null) {
|
if (protocols != null) {
|
||||||
for (Pair<Integer, Protocol> prot : protocols) {
|
for (Pair<Integer, Protocol> prot : protocols) {
|
||||||
|
@ -199,4 +199,9 @@ public class SpongePlugin implements ViaPlatform {
|
|||||||
|
|
||||||
return platformSpecific;
|
return platformSpecific;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOldClientsAllowed() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren