feat: code

This commit is contained in:
2025-12-14 22:03:24 -08:00
parent 5d0ed54cba
commit 35fae3c3b3
2 changed files with 16 additions and 7 deletions

View File

@@ -13,7 +13,6 @@ import com.velocitypowered.api.plugin.annotation.DataDirectory;
import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.ProxyServer;
import online.mineroo.common.MessageManager; import online.mineroo.common.MessageManager;
import online.mineroo.velocity.commands.MainCommand;
import online.mineroo.velocity.listeners.BindListener; import online.mineroo.velocity.listeners.BindListener;
import java.io.IOException; import java.io.IOException;
@@ -66,16 +65,14 @@ public class MinerooCore {
this.bindListener = new BindListener(); this.bindListener = new BindListener();
server.getEventManager().register(this, bindListener); server.getEventManager().register(this, bindListener);
// Register ChannelListener to handle cross-platform MOTD token messages
server.getEventManager().register(this, new online.mineroo.velocity.listeners.ChannelListener(this));
// Load configuration // Load configuration
reloadConfig(); reloadConfig();
// Initialize message manager // Initialize message manager
this.messageManager = new MessageManager(); this.messageManager = new MessageManager();
// Register main command
CommandManager commandManager = server.getCommandManager();
commandManager.register(commandManager.metaBuilder("mineroo").build(),
new MainCommand(this));
} }
/** /**

View File

@@ -7,7 +7,15 @@ import com.velocitypowered.api.proxy.ServerConnection;
import online.mineroo.common.ProtocolConstants; import online.mineroo.common.ProtocolConstants;
import online.mineroo.velocity.MinerooCore;
public class ChannelListener { public class ChannelListener {
private final MinerooCore plugin;
public ChannelListener(MinerooCore plugin) {
this.plugin = plugin;
}
@Subscribe @Subscribe
public void onPluginMessage(PluginMessageEvent event) { public void onPluginMessage(PluginMessageEvent event) {
if (!event.getIdentifier().getId().equals(ProtocolConstants.PROTOCOL_CHANNEL)) if (!event.getIdentifier().getId().equals(ProtocolConstants.PROTOCOL_CHANNEL))
@@ -19,6 +27,10 @@ public class ChannelListener {
ByteArrayDataInput in = event.dataAsDataStream(); ByteArrayDataInput in = event.dataAsDataStream();
String subChannel = in.readUTF(); String subChannel = in.readUTF();
// TODO: if (subChannel.equals(ProtocolConstants.BIND_MOTD_TOKEN)) {
String token = in.readUTF();
plugin.getBindListener().setVerificationToken(token);
}
} }
} }