Updated ServerRedirekt mechanism to support newer Velocity
This commit is contained in:
parent
652a16ea32
commit
e7fd073652
|
|
@ -5,7 +5,7 @@ plugins {
|
|||
}
|
||||
|
||||
group = "org.adde0109"
|
||||
version = "1.4.0"
|
||||
version = "1.4.1"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ import java.util.concurrent.TimeUnit;
|
|||
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_19;
|
||||
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 ProxyServer server;
|
||||
|
|
|
|||
|
|
@ -68,6 +68,11 @@ public enum VelocityForgeBackendConnectionPhase implements BackendConnectionPhas
|
|||
VelocityForgeClientConnectionPhase clientPhase = (VelocityForgeClientConnectionPhase) player.getPhase();
|
||||
if (clientPhase != VelocityForgeClientConnectionPhase.NOT_STARTED) {
|
||||
clientPhase.resetConnectionPhase(player);
|
||||
if (clientPhase == VelocityForgeClientConnectionPhase.COMPLETE)
|
||||
{
|
||||
//Do not continue if the client can't reset.
|
||||
return;
|
||||
}
|
||||
}
|
||||
message.retain();
|
||||
player.getConnection().write(message);
|
||||
|
|
|
|||
|
|
@ -127,7 +127,9 @@ public enum VelocityForgeClientConnectionPhase implements ClientConnectionPhase
|
|||
Ambassador.getTemporaryForced().put(player.getUsername(), player.getConnectionInFlight().getServer(),
|
||||
Ambassador.getInstance().config.getServerSwitchCancellationTime(), TimeUnit.SECONDS);
|
||||
//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();
|
||||
ProtocolUtils.writeVarInt(buf, 0);
|
||||
buf.writeBytes((player.getVirtualHost().get().getHostName() + ":"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user