feat: code
This commit is contained in:
@@ -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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user