Merge d5354a8040 into fbf12f90e7
This commit is contained in:
commit
d457b29b3e
2
Velocity
2
Velocity
|
|
@ -1 +1 @@
|
||||||
Subproject commit c3583e182ca6585e40d1eef0da8c18547c0b1bc1
|
Subproject commit b6b6b20fe97cd9cb0d6b4e817d3e7db72aca2d8d
|
||||||
|
|
@ -37,3 +37,8 @@ tasks {
|
||||||
archiveBaseName.set("Ambassador-Velocity")
|
archiveBaseName.set("Ambassador-Velocity")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
|
targetCompatibility = JavaVersion.VERSION_17
|
||||||
|
}
|
||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package org.adde0109.ambassador;
|
package org.adde0109.ambassador;
|
||||||
|
|
||||||
|
import com.google.common.collect.ArrayListMultimap;
|
||||||
|
import com.google.common.collect.ListMultimap;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.velocitypowered.api.event.PostOrder;
|
import com.velocitypowered.api.event.PostOrder;
|
||||||
import com.velocitypowered.api.event.Subscribe;
|
import com.velocitypowered.api.event.Subscribe;
|
||||||
|
|
@ -14,8 +16,10 @@ import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
|
||||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||||
import com.velocitypowered.proxy.VelocityServer;
|
import com.velocitypowered.proxy.VelocityServer;
|
||||||
import com.velocitypowered.proxy.connection.MinecraftConnection;
|
import com.velocitypowered.proxy.connection.MinecraftConnection;
|
||||||
|
|
@ -50,7 +54,7 @@ import static com.velocitypowered.proxy.protocol.packet.brigadier.ArgumentIdenti
|
||||||
public class Ambassador {
|
public class Ambassador {
|
||||||
|
|
||||||
//Don't forget to update checkCompatibleVersion() when changing this value
|
//Don't forget to update checkCompatibleVersion() when changing this value
|
||||||
private static final String minVelocityVersion = "velocity-3.3.0-SNAPSHOT-330";
|
private static final String minVelocityVersion = "velocity-3.3.0-SNAPSHOT-490";
|
||||||
|
|
||||||
public ProxyServer server;
|
public ProxyServer server;
|
||||||
public final Logger logger;
|
public final Logger logger;
|
||||||
|
|
@ -79,11 +83,11 @@ public class Ambassador {
|
||||||
boolean checkCompatibleVersion() {
|
boolean checkCompatibleVersion() {
|
||||||
//Update this when changing minVelocityVersion
|
//Update this when changing minVelocityVersion
|
||||||
try {
|
try {
|
||||||
Class.forName("com.velocitypowered.proxy.protocol.packet.DisconnectPacket");
|
ConnectedPlayer.class.getMethod("getClientsideChannels");
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
throw new RuntimeException(e);
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(order = PostOrder.LAST)
|
@Subscribe(order = PostOrder.LAST)
|
||||||
|
|
|
||||||
|
|
@ -198,8 +198,8 @@ public enum VelocityForgeClientConnectionPhase implements ClientConnectionPhase
|
||||||
if (player.getModInfo().get().getMods().stream().anyMatch((mod -> mod.getId().equals("clientresetpacket")))) {
|
if (player.getModInfo().get().getMods().stream().anyMatch((mod -> mod.getId().equals("clientresetpacket")))) {
|
||||||
return ClientResetType.CRP;
|
return ClientResetType.CRP;
|
||||||
} else if (Ambassador.getInstance().config.getServerSwitchCancellationTime() >= 0 &&
|
} else if (Ambassador.getInstance().config.getServerSwitchCancellationTime() >= 0 &&
|
||||||
player.getModInfo().get().getMods().stream().anyMatch((mod -> mod.getId().equals("serverredirect")
|
(player.getModInfo().get().getMods().stream().anyMatch((mod -> mod.getId().equals("serverredirect")))
|
||||||
|| mod.getId().equals("srvredirect:red")))
|
|| player.getClientsideChannels().stream().anyMatch(identifier -> identifier.getId().equals("srvredirect:red")))
|
||||||
&& player.getVirtualHost().isPresent()) {
|
&& player.getVirtualHost().isPresent()) {
|
||||||
return ClientResetType.SR;
|
return ClientResetType.SR;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package org.adde0109.ambassador.velocity;
|
||||||
import com.velocitypowered.api.event.Continuation;
|
import com.velocitypowered.api.event.Continuation;
|
||||||
import com.velocitypowered.api.event.PostOrder;
|
import com.velocitypowered.api.event.PostOrder;
|
||||||
import com.velocitypowered.api.event.Subscribe;
|
import com.velocitypowered.api.event.Subscribe;
|
||||||
|
import com.velocitypowered.api.event.connection.DisconnectEvent;
|
||||||
import com.velocitypowered.api.event.connection.PostLoginEvent;
|
import com.velocitypowered.api.event.connection.PostLoginEvent;
|
||||||
import com.velocitypowered.api.event.player.*;
|
import com.velocitypowered.api.event.player.*;
|
||||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||||
|
|
@ -68,9 +69,12 @@ public class VelocityEventHandler {
|
||||||
if (!(player.getConnection().getType() instanceof ForgeFMLConnectionType)) {
|
if (!(player.getConnection().getType() instanceof ForgeFMLConnectionType)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Do not overwrite the mod info stored by the proxy or the server redirect based on Client Reset Packet will stop working
|
||||||
|
/*
|
||||||
player.setModInfo(new ModInfo("Channels", event.getChannels().stream().map((id) -> {
|
player.setModInfo(new ModInfo("Channels", event.getChannels().stream().map((id) -> {
|
||||||
return new ModInfo.Mod(id.getId(), "");
|
return new ModInfo.Mod(id.getId(), "");
|
||||||
}).toList()));
|
}).toList()));
|
||||||
|
*/
|
||||||
|
|
||||||
VelocityForgeClientConnectionPhase clientPhase = (VelocityForgeClientConnectionPhase) player.getPhase();
|
VelocityForgeClientConnectionPhase clientPhase = (VelocityForgeClientConnectionPhase) player.getPhase();
|
||||||
//If reset typ is still unknown, set it!
|
//If reset typ is still unknown, set it!
|
||||||
|
|
@ -78,5 +82,4 @@ public class VelocityEventHandler {
|
||||||
clientPhase.updateResetType(player);
|
clientPhase.updateResetType(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user