Fixed modern forwarding support and kick handling
This commit is contained in:
parent
fd8fb5ae37
commit
14d5d9fc07
|
|
@ -4,7 +4,7 @@ plugins {
|
|||
}
|
||||
|
||||
group 'org.adde0109'
|
||||
version '1.0.4-alpha'
|
||||
version '1.0.5-alpha'
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import org.slf4j.Logger;
|
|||
|
||||
import java.nio.file.Path;
|
||||
|
||||
@Plugin(id = "ambassador", name = "Ambassador", version = "1.0.4-alpha", authors = {"adde0109"})
|
||||
@Plugin(id = "ambassador", name = "Ambassador", version = "1.0.5-alpha", authors = {"adde0109"})
|
||||
public class Ambassador {
|
||||
|
||||
public ProxyServer server;
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ public class ForgeFML2ClientConnectionPhase implements VelocityForgeClientConnec
|
|||
if (player.getConnectedServer() != null) {
|
||||
backupServer = player.getConnectedServer().getServer();
|
||||
player.getConnectedServer().disconnect();
|
||||
player.setConnectedServer(null);
|
||||
}
|
||||
MinecraftConnection connection = player.getConnection();
|
||||
connection.setSessionHandler(new VelocityForgeHandshakeSessionHandler(connection.getSessionHandler(),player));
|
||||
|
|
@ -112,6 +113,7 @@ public class ForgeFML2ClientConnectionPhase implements VelocityForgeClientConnec
|
|||
if (backupServer != null && !(event.getResult() instanceof KickedFromServerEvent.RedirectPlayer)) {
|
||||
net.kyori.adventure.text.Component reason = event.getServerKickReason().orElse(null);
|
||||
event.setResult(KickedFromServerEvent.RedirectPlayer.create(backupServer,reason));
|
||||
backupServer = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@ public class ForgeFML2ConnectionType implements ConnectionType {
|
|||
|
||||
@Override
|
||||
public GameProfile addGameProfileTokensIfRequired(GameProfile original, PlayerInfoForwarding forwardingType) {
|
||||
original.addProperties(Collections.singleton(new GameProfile.Property("extraData", "\1FML2\1", "")));
|
||||
if (forwardingType == PlayerInfoForwarding.LEGACY)
|
||||
original.addProperties(Collections.singleton(new GameProfile.Property("extraData", "\1FML2\1", "")));
|
||||
return original;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user