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:
parent
260d6e57fd
commit
5bc4bd4bb2
25
src/cn/citycraft/CTZLoginServer/CTZLoginQueue.java
Normal file
25
src/cn/citycraft/CTZLoginServer/CTZLoginQueue.java
Normal 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);
|
||||
}
|
||||
|
||||
}
|
25
src/cn/citycraft/CTZLoginServer/listen/PlayerListen.java
Normal file
25
src/cn/citycraft/CTZLoginServer/listen/PlayerListen.java
Normal 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请从服务器专用启动器进入游戏!");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user