feat: 支持仓鼠球 1.5+
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package cn.hamster3.service.bukkit;
|
||||
|
||||
import cn.hamster3.mc.plugin.ball.common.api.BallAPI;
|
||||
import cn.hamster3.service.bukkit.command.ServiceCommand;
|
||||
import cn.hamster3.service.bukkit.hook.ServicePlaceholderHook;
|
||||
import cn.hamster3.service.bukkit.listener.ServiceMainListener;
|
||||
import cn.hamster3.service.bukkit.listener.BridgeListener;
|
||||
import cn.hamster3.service.common.util.ServiceLogUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class BallBridgePlugin extends JavaPlugin {
|
||||
private static BallBridgePlugin instance;
|
||||
|
||||
public static BallBridgePlugin getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
instance = this;
|
||||
ServiceLogUtils.setLogger(getLogger());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
ServiceCommand.INSTANCE.register();
|
||||
BallAPI.getInstance().getEventBus().register(BridgeListener.INSTANCE);
|
||||
Bukkit.getPluginManager().registerEvents(ServiceMainListener.INSTANCE, this);
|
||||
Bukkit.getScheduler().runTask(this, () -> {
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
|
||||
ServicePlaceholderHook.INSTANCE.register();
|
||||
getLogger().info("已注册 PlaceholderAPI 占位符.");
|
||||
} else {
|
||||
getLogger().warning("未找到 PlaceholderAPI 插件, 取消注册占位符.");
|
||||
}
|
||||
});
|
||||
BallAPI.getInstance().subscribeIgnorePrefix("HamsterService");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user