2023-10-12 22:17:34 +08:00

48 lines
2.0 KiB
Java

package com.frontleaves.bungeecross;
import com.frontleaves.bungeecross.commands.PluginInfoCommand;
import com.frontleaves.bungeecross.commands.ProxyServerListCommand;
import com.frontleaves.bungeecross.commands.ReturnHubCommand;
import com.frontleaves.bungeecross.commands.SendToServerCommand;
import com.frontleaves.bungeecross.configuration.ServerEnable;
import com.frontleaves.bungeecross.configuration.VariableStorage;
import com.frontleaves.bungeecross.events.PlayerJoinProxyEvent;
import com.frontleaves.bungeecross.events.PlayerLeaveProxyEvent;
import lombok.Getter;
import net.md_5.bungee.api.plugin.Plugin;
/**
* @author 筱锋xiao_lfeng
* @version 见 final VERSION 变量
*/
public final class BungeeCross extends Plugin {
@Getter
private final static String VERSION = "v1.0-SNAPSHOT";
@Getter
private final static String AUTHOR = "筱锋xiao_lfeng";
@Override
public void onEnable() {
// 加载配置文件
ServerEnable serverEnable = new ServerEnable(this);
serverEnable.serverStart();
// 注册指令
getProxy().getPluginManager().registerCommand(this, new PluginInfoCommand("bungeecross", this));
getProxy().getPluginManager().registerCommand(this, new ProxyServerListCommand("server-list"));
getProxy().getPluginManager().registerCommand(this, new ReturnHubCommand("lobby", this));
getProxy().getPluginManager().registerCommand(this, new SendToServerCommand("serverTo", this));
getProxy().getPluginManager().registerCommand(this, new SendToServerCommand("sto", this));
// 注册监听器
getProxy().getPluginManager().registerListener(this, new PlayerJoinProxyEvent(this));
getProxy().getPluginManager().registerListener(this, new PlayerLeaveProxyEvent(this));
}
@Override
public void onDisable() {
VariableStorage.setLobbyServer(null);
VariableStorage.setLoginServer(null);
VariableStorage.setPrefix(null);
VariableStorage.setProxyServer(null);
}
}