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