feat: 支持新版仓鼠球

This commit is contained in:
2023-11-12 17:50:55 +08:00
parent d20259631a
commit 9a7a0c92af
17 changed files with 48 additions and 96 deletions

View File

@@ -7,7 +7,6 @@ import cn.hamster3.mc.plugin.tpa.command.TPDenyCommand;
import cn.hamster3.mc.plugin.tpa.config.ConfigManager;
import cn.hamster3.mc.plugin.tpa.core.DataManager;
import cn.hamster3.mc.plugin.tpa.listener.MainListener;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public class HamsterTPAPlugin extends JavaPlugin {
@@ -30,7 +29,7 @@ public class HamsterTPAPlugin extends JavaPlugin {
TPACommand.INSTANCE.register();
TPAcceptCommand.INSTANCE.register();
TPDenyCommand.INSTANCE.register();
Bukkit.getPluginManager().registerEvents(MainListener.INSTANCE, this);
BallAPI.getInstance().getEventBus().register(MainListener.INSTANCE);
BallAPI.getInstance().subscribe(BALL_CHANNEL);
}
}

View File

@@ -1,11 +1,11 @@
package cn.hamster3.mc.plugin.tpa.listener;
import cn.hamster3.mc.plugin.ball.bukkit.event.MessageReceiveEvent;
import cn.hamster3.mc.plugin.ball.common.data.BallMessage;
import cn.hamster3.mc.plugin.ball.common.event.message.MessageReceivedEvent;
import cn.hamster3.mc.plugin.tpa.HamsterTPAPlugin;
import cn.hamster3.mc.plugin.tpa.core.DataManager;
import com.google.common.eventbus.Subscribe;
import com.google.gson.JsonObject;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import java.util.UUID;
@@ -16,8 +16,8 @@ public final class MainListener implements Listener {
private MainListener() {
}
@EventHandler(ignoreCancelled = true)
public void onMessageReceive(MessageReceiveEvent event) {
@Subscribe
public void onMessageReceived(MessageReceivedEvent event) {
if (!HamsterTPAPlugin.BALL_CHANNEL.equals(event.getChannel())) {
return;
}