Skip to content

Commit 685e11e

Browse files
author
UserNugget
committed
Dirty fixes for Velocity-CTD
1 parent b845d00 commit 685e11e

6 files changed

Lines changed: 12 additions & 14 deletions

File tree

22.8 MB
Binary file not shown.

plugin/build.gradle

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,8 @@ dependencies() {
2727
implementation(libs.elytrium.fastprepare)
2828
compileOnly(libs.minecraft.velocity.api)
2929
annotationProcessor(libs.minecraft.velocity.api)
30-
compileOnly(libs.minecraft.velocity.proxy) // From Elytrium Repo.
31-
compileOnly(libs.minecraft.velocity.native)
32-
33-
// Needs for some velocity methods.
34-
compileOnly(libs.tool.netty.codec)
35-
compileOnly(libs.tool.netty.handler)
36-
compileOnly(libs.tool.fastutil)
30+
compileOnly(files("../libs/velocity-proxy-3.5.0-SNAPSHOT-all.jar"))
31+
compileOnly("it.unimi.dsi:fastutil:8.5.18") // not able to compile without it
3732

3833
implementation(libs.minecraft.bstats.velocity)
3934

plugin/src/main/java/net/elytrium/limboapi/injection/event/EventManagerHook.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ public EventTask onGameProfileRequest(GameProfileRequestEvent event) {
7777
this.plugin.getLoginListener().hookLoginSession(modifiedEvent);
7878
hookFuture.complete(modifiedEvent);
7979
} catch (Throwable e) {
80+
e.printStackTrace();
8081
throw new ReflectionException(e);
8182
}
8283
});

plugin/src/main/java/net/elytrium/limboapi/injection/tablist/RewritingKeyedVelocityTabList.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import com.velocitypowered.api.proxy.ProxyServer;
2121
import com.velocitypowered.api.proxy.player.TabListEntry;
22+
import com.velocitypowered.proxy.VelocityServer;
2223
import com.velocitypowered.proxy.connection.MinecraftConnection;
2324
import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
2425
import com.velocitypowered.proxy.tablist.KeyedVelocityTabList;
@@ -36,7 +37,7 @@ public class RewritingKeyedVelocityTabList extends KeyedVelocityTabList implemen
3637
protected final Map<UUID, KeyedVelocityTabListEntry> entries;
3738

3839
public RewritingKeyedVelocityTabList(ConnectedPlayer player, ProxyServer proxyServer) {
39-
super(player, proxyServer);
40+
super(player, (VelocityServer) proxyServer);
4041
this.player = super.player;
4142
this.connection = super.connection;
4243
this.proxyServer = super.proxyServer;

plugin/src/main/java/net/elytrium/limboapi/injection/tablist/RewritingVelocityTabListLegacy.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import com.velocitypowered.api.proxy.ProxyServer;
2121
import com.velocitypowered.api.proxy.player.TabListEntry;
22+
import com.velocitypowered.proxy.VelocityServer;
2223
import com.velocitypowered.proxy.connection.MinecraftConnection;
2324
import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
2425
import com.velocitypowered.proxy.tablist.KeyedVelocityTabListEntry;
@@ -36,7 +37,7 @@ public class RewritingVelocityTabListLegacy extends VelocityTabListLegacy implem
3637
protected final Map<UUID, KeyedVelocityTabListEntry> entries;
3738

3839
public RewritingVelocityTabListLegacy(ConnectedPlayer player, ProxyServer proxyServer) {
39-
super(player, proxyServer);
40+
super(player, (VelocityServer) proxyServer);
4041
this.player = super.player;
4142
this.connection = super.connection;
4243
this.proxyServer = super.proxyServer;

plugin/src/main/java/net/elytrium/limboapi/utils/OverlayObject2IntMap.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
package net.elytrium.limboapi.utils;
1919

2020
import com.google.common.collect.Streams;
21-
import it.unimi.dsi.fastutil.ints.IntArrayList;
2221
import it.unimi.dsi.fastutil.ints.IntCollection;
2322
import it.unimi.dsi.fastutil.objects.Object2IntMap;
23+
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
2424
import it.unimi.dsi.fastutil.objects.ObjectSet;
2525
import java.util.stream.Collectors;
2626
import net.elytrium.limboapi.api.utils.OverlayMap;
@@ -77,10 +77,10 @@ public ObjectSet<K> keySet() {
7777

7878
@Override
7979
public IntCollection values() {
80-
return Streams
81-
.concat(((Object2IntMap<K>) this.parent).values().intStream(), ((Object2IntMap<K>) this.overlay).values().intStream())
82-
.boxed()
83-
.collect(Collectors.toCollection(IntArrayList::new));
80+
Object2IntOpenHashMap<Object> hashMap = new Object2IntOpenHashMap<>();
81+
Streams.concat(((Object2IntMap<K>) this.parent).values().intStream(), ((Object2IntMap<K>) this.overlay).values().intStream())
82+
.forEach(value -> hashMap.put(new Object(), value));
83+
return hashMap.values();
8484
}
8585

8686
@Override

0 commit comments

Comments
 (0)