Skip to content

Commit

Permalink
[Velocity] Use new listOrder API (and bump required velocity build nu…
Browse files Browse the repository at this point in the history
…mber to 450)
  • Loading branch information
NEZNAMY committed Nov 10, 2024
1 parent 96a39d7 commit 07f5dc6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions velocity/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ dependencies {
implementation(projects.shared)
implementation("org.bstats:bstats-velocity:3.1.0")
compileOnly("com.github.limework.redisbungee:RedisBungee-Velocity:0.11.0")
compileOnly("com.velocitypowered:velocity-api:3.2.0-SNAPSHOT")
annotationProcessor("com.velocitypowered:velocity-api:3.2.0-SNAPSHOT")
compileOnly("com.velocitypowered:velocity-api:3.4.0-SNAPSHOT")
annotationProcessor("com.velocitypowered:velocity-api:3.4.0-SNAPSHOT")
compileOnly("com.github.LeonMangler:PremiumVanishAPI:2.9.0-4")
compileOnly("net.william278:velocityscoreboardapi:1.0.1")
}

tasks.compileJava {
options.release.set(11)
options.release.set(17)
}
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public boolean supportsNumberFormat() {

@Override
public boolean supportsListOrder() {
return false; // TODO when they add API
return true;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import com.velocitypowered.api.plugin.Plugin;
import com.velocitypowered.api.plugin.annotation.DataDirectory;
import com.velocitypowered.api.proxy.ProxyServer;
import com.velocitypowered.api.proxy.player.TabListEntry;
import lombok.Getter;
import me.neznamy.tab.shared.TAB;
import me.neznamy.tab.shared.TabConstants;
import me.neznamy.tab.shared.chat.EnumChatFormat;
import me.neznamy.tab.shared.util.ReflectionUtils;
import org.bstats.velocity.Metrics;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -54,8 +54,8 @@ public class VelocityTAB {
*/
@Subscribe
public void onProxyInitialization(@Nullable ProxyInitializeEvent event) {
if (!ReflectionUtils.classExists("net.kyori.adventure.text.logger.slf4j.ComponentLogger")) {
logger.warn(EnumChatFormat.RED + "The plugin requires Velocity build #274 (released on October 12th, 2023) and up to work.");
if (!ReflectionUtils.methodExists(TabListEntry.class, "setListOrder", int.class)) {
logger.warn("The plugin requires Velocity build #450 (released on November 10th, 2024) and up to work.");
return;
}
TAB.create(new VelocityPlatform(this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void updateListed(@NonNull UUID entry, boolean listed) {

@Override
public void updateListOrder(@NonNull UUID entry, int listOrder) {
// TODO once velocity adds it
player.getPlayer().getTabList().getEntry(entry).ifPresent(e -> e.setListOrder(listOrder));
}

@Override
Expand All @@ -75,8 +75,8 @@ public void addEntry(@NonNull UUID id, @NonNull String name, @Nullable Skin skin
.latency(latency)
.gameMode(gameMode)
.listed(listed)
.listOrder(listOrder)
.build();
// TODO listOrder once velocity adds it
// TODO showHat once velocity adds it

// Remove entry because:
Expand Down

0 comments on commit 07f5dc6

Please sign in to comment.