Updated ServerRedirekt mechanism to support newer Velocity
This commit is contained in:
parent
652a16ea32
commit
e7fd073652
|
|
@ -5,7 +5,7 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "org.adde0109"
|
group = "org.adde0109"
|
||||||
version = "1.4.0"
|
version = "1.4.1"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_19;
|
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_19;
|
||||||
import static com.velocitypowered.proxy.protocol.packet.brigadier.ArgumentIdentifier.mapSet;
|
import static com.velocitypowered.proxy.protocol.packet.brigadier.ArgumentIdentifier.mapSet;
|
||||||
|
|
||||||
@Plugin(id = "ambassador", name = "Ambassador", version = "1.4.0", authors = {"adde0109"})
|
@Plugin(id = "ambassador", name = "Ambassador", version = "1.4.1", authors = {"adde0109"})
|
||||||
public class Ambassador {
|
public class Ambassador {
|
||||||
|
|
||||||
public ProxyServer server;
|
public ProxyServer server;
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,11 @@ public enum VelocityForgeBackendConnectionPhase implements BackendConnectionPhas
|
||||||
VelocityForgeClientConnectionPhase clientPhase = (VelocityForgeClientConnectionPhase) player.getPhase();
|
VelocityForgeClientConnectionPhase clientPhase = (VelocityForgeClientConnectionPhase) player.getPhase();
|
||||||
if (clientPhase != VelocityForgeClientConnectionPhase.NOT_STARTED) {
|
if (clientPhase != VelocityForgeClientConnectionPhase.NOT_STARTED) {
|
||||||
clientPhase.resetConnectionPhase(player);
|
clientPhase.resetConnectionPhase(player);
|
||||||
|
if (clientPhase == VelocityForgeClientConnectionPhase.COMPLETE)
|
||||||
|
{
|
||||||
|
//Do not continue if the client can't reset.
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
message.retain();
|
message.retain();
|
||||||
player.getConnection().write(message);
|
player.getConnection().write(message);
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,9 @@ public enum VelocityForgeClientConnectionPhase implements ClientConnectionPhase
|
||||||
Ambassador.getTemporaryForced().put(player.getUsername(), player.getConnectionInFlight().getServer(),
|
Ambassador.getTemporaryForced().put(player.getUsername(), player.getConnectionInFlight().getServer(),
|
||||||
Ambassador.getInstance().config.getServerSwitchCancellationTime(), TimeUnit.SECONDS);
|
Ambassador.getInstance().config.getServerSwitchCancellationTime(), TimeUnit.SECONDS);
|
||||||
//Disconnect - Reset
|
//Disconnect - Reset
|
||||||
if(player.getKnownChannels().contains("srvredirect:red") && player.getVirtualHost().isPresent()) {
|
if(player.getModInfo().isPresent()
|
||||||
|
&& player.getModInfo().get().getMods().stream().anyMatch((mod -> mod.getId().equals("serverredirect")))
|
||||||
|
&& player.getVirtualHost().isPresent()) {
|
||||||
ByteBuf buf = Unpooled.buffer();
|
ByteBuf buf = Unpooled.buffer();
|
||||||
ProtocolUtils.writeVarInt(buf, 0);
|
ProtocolUtils.writeVarInt(buf, 0);
|
||||||
buf.writeBytes((player.getVirtualHost().get().getHostName() + ":"
|
buf.writeBytes((player.getVirtualHost().get().getHostName() + ":"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user