Skip to content

Commit

Permalink
Quick Fix for ViaVersion plugins
Browse files Browse the repository at this point in the history
- Commands and chat messages were not working on older versions
  • Loading branch information
AndusDEV committed Oct 19, 2024
1 parent a02cce8 commit 9581321
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ plugins {
tasks.withType<Jar> {
manifest {
attributes["Main-Class"] = "dev.celestialfox.spectrumsurvival.Server"
archiveFileName.set("SpectrumSurvival.jar")
}
}

group = "dev.celestialfox.spectrumsurvival"
version = "1.0"
version = "1.1"

repositories {
mavenCentral()
Expand Down
Binary file modified server/SpectrumSurvival.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions src/main/java/dev/celestialfox/spectrumsurvival/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import net.minestom.server.MinecraftServer;
import net.minestom.server.adventure.audience.Audiences;
import net.minestom.server.command.CommandManager;
import net.minestom.server.network.packet.client.play.ClientCommandChatPacket;
import net.minestom.server.network.packet.client.play.ClientSignedCommandChatPacket;
import net.minestom.server.timer.TaskSchedule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -63,6 +65,11 @@ public static void registerCommands() {
commandManager.register(new AboutCommand());
commandManager.register(new CreditsCommand());
commandManager.register(new StopCommand());

// Fix for older Minecraft versions (when using ViaBackwards)
MinecraftServer.getPacketListenerManager().setPlayListener(ClientSignedCommandChatPacket.class, (packet, player) -> {
MinecraftServer.getPacketListenerManager().processClientPacket(new ClientCommandChatPacket(packet.message()), player.getPlayerConnection());
});
}

public static void tablist() {
Expand Down

0 comments on commit 9581321

Please sign in to comment.