mirror of
https://e.coding.net/circlecloud/MiaoLobby.git
synced 2025-11-01 16:46:00 +00:00
@@ -1,11 +1,14 @@
|
||||
package pw.yumc.MiaoLobby;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import fr.xephi.authme.events.LoginEvent;
|
||||
import pw.yumc.YumCore.bukkit.P;
|
||||
import pw.yumc.YumCore.bukkit.compatible.C;
|
||||
|
||||
public class AuthMeHook implements Listener {
|
||||
MiaoLobby plugin = P.getPlugin();
|
||||
@@ -16,6 +19,21 @@ public class AuthMeHook implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onLogin(final LoginEvent e) {
|
||||
plugin.random(e.getPlayer());
|
||||
new BukkitRunnable() {
|
||||
Player player = e.getPlayer();
|
||||
int delay = plugin.config.AutoTPDelay;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (player.isOnline()) {
|
||||
if (delay > 0) {
|
||||
C.ActionBar.send(player, String.format(plugin.config.TPDelay, delay));
|
||||
return;
|
||||
}
|
||||
plugin.random(player);
|
||||
}
|
||||
cancel();
|
||||
}
|
||||
}.runTaskTimerAsynchronously(plugin, 0, 20);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ public class Config extends InjectConfig {
|
||||
public Integer WaitTime;
|
||||
public String Message;
|
||||
public String TimeOut;
|
||||
public String TPDelay;
|
||||
public String Unavailable;
|
||||
public Boolean AuthMeAutoTP;
|
||||
public Integer AutoTPDelay;
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ import pw.yumc.YumCore.commands.annotation.Cmd.Executor;
|
||||
import pw.yumc.YumCore.commands.annotation.Help;
|
||||
|
||||
public class MiaoLobby extends JavaPlugin implements CommandExecutor {
|
||||
public Config config;
|
||||
private final SecureRandom random = new SecureRandom();
|
||||
private Config config;
|
||||
|
||||
public void connect(final Player p, final String server) {
|
||||
final ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
#配置文件版本 请勿修改
|
||||
Version: 1.0
|
||||
Version: 1.1
|
||||
|
||||
#数据库信息
|
||||
Servers:
|
||||
- lobby1
|
||||
- lobby2
|
||||
#传送超时时间(单位: Tick)
|
||||
WaitTime: 20
|
||||
WaitTime: 35
|
||||
#AuthMe自动传送
|
||||
AuthMeAutoTP: true
|
||||
#自动登录延时(单位: Tick)
|
||||
AutoTPDelay: 10
|
||||
#传送提示
|
||||
Message: '&a请稍候 正在传送至服务器 %s ...'
|
||||
TimeOut: '&c传送超时 正在切换到服务器 %s ...'
|
||||
TPDelay: '&a登陆成功 正在为您匹配服务器 剩余 %s 秒...'
|
||||
Unavailable: '&4已尝试所有可用服务器 传送失败!'
|
||||
Reference in New Issue
Block a user