1
0
mirror of https://e.coding.net/circlecloud/CTZLoginServer.git synced 2024-11-16 01:08:49 +00:00

add PlayerLoginQueue and add JoinListen...

Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
j502647092 2015-07-28 21:16:19 +08:00
parent 260d6e57fd
commit 5bc4bd4bb2
2 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,25 @@
/**
*
*/
package cn.citycraft.CTZLoginServer;
import java.util.ArrayList;
import java.util.List;
/**
* @author 蒋天蓓
* 2015年7月28日下午9:08:23
* TODO
*/
public class CTZLoginQueue {
protected static List<String> list = new ArrayList<String>();
public static boolean Login(String player) {
return list.remove(player);
}
public static void add(String player) {
list.add(player);
}
}

View File

@ -0,0 +1,25 @@
/**
*
*/
package cn.citycraft.CTZLoginServer.listen;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import cn.citycraft.CTZLoginServer.CTZLoginQueue;
/**
* @author 蒋天蓓
* 2015年7月28日下午9:05:20
* TODO
*/
public class PlayerListen implements Listener {
@EventHandler
public void PlayerLogin(PlayerJoinEvent e) {
if (!CTZLoginQueue.Login(e.getPlayer().getName())) {
e.getPlayer().kickPlayer("&c请从服务器专用启动器进入游戏!");
}
}
}