Now works with legacy forwarding on 1.18 and later
This commit is contained in:
parent
43e0ba91c7
commit
2aadd545cf
|
|
@ -4,7 +4,7 @@ plugins {
|
|||
}
|
||||
|
||||
group 'org.adde0109'
|
||||
version '0.3.1'
|
||||
version '0.3.2'
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.velocitypowered.api.plugin.Plugin;
|
|||
import com.velocitypowered.api.plugin.annotation.DataDirectory;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
|
||||
import com.velocitypowered.api.util.GameProfile;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.adde0109.ambassador.forge.ForgeConnection;
|
||||
|
|
@ -23,7 +24,7 @@ import org.slf4j.Logger;
|
|||
import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
|
||||
@Plugin(id = "ambassador", name = "Ambassador", version = "0.3.1", authors = {"adde0109"})
|
||||
@Plugin(id = "ambassador", name = "Ambassador", version = "0.3.2", authors = {"adde0109"})
|
||||
public class Ambassador {
|
||||
|
||||
private final ProxyServer server;
|
||||
|
|
@ -94,6 +95,12 @@ public class Ambassador {
|
|||
event.getPlayer().sendMessage(Component.text("This server requires Forge!", NamedTextColor.RED));
|
||||
continuation.resume();
|
||||
} else if (forgeConnection.isPresent()) {
|
||||
|
||||
//To make legacy forwarding work
|
||||
List<GameProfile.Property> properties = new ArrayList<>(event.getPlayer().getGameProfileProperties());
|
||||
properties.add(new GameProfile.Property("extraData", "\1FML2\1",""));
|
||||
event.getPlayer().setGameProfileProperties(properties);
|
||||
|
||||
if (forgeConnection.get().getTransmittedHandshake().isPresent()
|
||||
&& forgeConnection.get().getRecivedClientModlist().isPresent()
|
||||
&& msg.equals(forgeConnection.get().getTransmittedHandshake().get())) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user