76 lines
2.3 KiB
Java
76 lines
2.3 KiB
Java
package pw.yumc.MiaoLobby;
|
|
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.configuration.file.FileConfiguration;
|
|
import org.bukkit.entity.Player;
|
|
import org.bukkit.event.EventHandler;
|
|
import org.bukkit.event.Listener;
|
|
import org.bukkit.event.player.PlayerQuitEvent;
|
|
import org.bukkit.plugin.java.JavaPlugin;
|
|
import pw.yumc.MiaoLobby.config.Config;
|
|
import pw.yumc.MiaoLobby.hook.AuthMeHook;
|
|
import pw.yumc.MiaoLobby.hook.LoginHook;
|
|
import pw.yumc.YumCore.bukkit.Log;
|
|
import pw.yumc.YumCore.commands.CommandSub;
|
|
import pw.yumc.YumCore.commands.annotation.Cmd;
|
|
import pw.yumc.YumCore.commands.annotation.Help;
|
|
import pw.yumc.YumCore.commands.interfaces.Executor;
|
|
import pw.yumc.YumCore.statistic.Statistics;
|
|
import pw.yumc.YumCore.update.SubscribeTask;
|
|
|
|
public class MiaoLobby extends JavaPlugin implements Executor, Listener {
|
|
private Config config;
|
|
|
|
@EventHandler
|
|
public void onQuit(PlayerQuitEvent e) {
|
|
Util.cancel(e.getPlayer());
|
|
}
|
|
|
|
@Cmd(permission = "MiaoLobby.default", executor = Cmd.Executor.PLAYER)
|
|
@Help("进行随机服务器传送")
|
|
public boolean ml(final Player player) {
|
|
Util.delayTp(player, 0);
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public FileConfiguration getConfig() {
|
|
return config.getConfig();
|
|
}
|
|
|
|
public Config getMiaoLobbyConfig() {
|
|
return config;
|
|
}
|
|
|
|
@Override
|
|
public void onEnable() {
|
|
new CommandSub("MiaoLobby", this);
|
|
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
|
Bukkit.getPluginManager().registerEvents(this, this);
|
|
if (config.AutoTP) {
|
|
new LoginHook();
|
|
Log.i("已配置为自动传送模式!");
|
|
} else if (config.LoginAutoTP) {
|
|
if (Bukkit.getPluginManager().isPluginEnabled("AuthMe")) {
|
|
new AuthMeHook();
|
|
Log.i("已配置为AuthMe登录传送模式!");
|
|
}
|
|
}
|
|
new Statistics();
|
|
new SubscribeTask(true, SubscribeTask.UpdateType.MAVEN);
|
|
}
|
|
|
|
@Override
|
|
public void onLoad() {
|
|
config = new Config();
|
|
}
|
|
|
|
@Cmd(permission = "MiaoLobby.reload")
|
|
@Help("重载配置文件")
|
|
public void reload(final CommandSender e) {
|
|
config.reload();
|
|
Log.sender(e, "§a配置文件已重载!");
|
|
}
|
|
}
|