1
0
mirror of https://e.coding.net/circlecloud/CTZLoginServer.git synced 2024-12-11 05:18:48 +00:00

xiugai dengluliucheng...

This commit is contained in:
j502647092 2015-08-10 20:42:02 +08:00
parent 5106fa61f7
commit 41998638d7
3 changed files with 42 additions and 27 deletions

View File

@ -30,12 +30,6 @@ class Area {
public void setServers(List<Server> servers) {
this.servers = servers;
}
@Override
public String toString() {
return String.format("\"name\":\"{0}\",\"servers\":\"{1}\"", name, servers.toString());
}
}
class CTZServer {
@ -76,6 +70,7 @@ public class CTZServers {
server.version = cs.getString(a + ".servers." + s + ".version");
server.info = cs.getString(a + ".servers." + s + ".info");
server.url = cs.getString(a + ".servers." + s + ".url");
server.depend = cs.getString(a + ".servers." + s + ".depend");
area.servers.add(server);
}
sl.areas.add(area);
@ -137,6 +132,16 @@ class Server {
public String url;
public String depend;
public String getDepend() {
return depend;
}
public void setDepend(String depend) {
this.depend = depend;
}
public String getAddress() {
return address;
}

View File

@ -6,7 +6,9 @@ package cn.citycraft.CTZLoginServer.listen;
import java.util.HashMap;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerLoginEvent.Result;
import org.bukkit.event.player.PlayerQuitEvent;
@ -31,27 +33,33 @@ public class PlayerListen implements Listener {
long lasttime = lastquittime.get(name) == null ? 0 : lastquittime.get(name);
e.setKickMessage("§6[§bCTZLS§6] §c禁止入服 请使用服务器专用启动器进入游戏!");
if (getNowTime() - lasttime < Config.getInstance().getInt("server.timeout")) {
return;
}
if (CTZLoginQueue.canLogin(name, e.getAddress().getHostAddress())) {
return;
} else {
if (CTZLoginQueue.canLogin(name))
if (CTZLoginQueue.isCheckIP())
e.setKickMessage("§6[§bCTZLS§6] §c禁止入服 申请登录的IP与客户端IP不同!");
else
return;
}
if (!Config.getInstance().getBoolean("config.forceclient"))
return;
e.setResult(Result.KICK_WHITELIST);
}
@EventHandler(
priority = EventPriority.LOWEST)
public void PlayerJoin(PlayerJoinEvent e) {
String name = e.getPlayer().getName().toLowerCase();
if (lastquittime.containsKey(name)) {
API.forceLogin(e.getPlayer());
return;
}
if (CTZLoginQueue.canLogin(name)) {
if (CTZLoginQueue.isCheckIP()) {
if (CTZLoginQueue.canLogin(name, e.getAddress().getHostAddress())) {
API.forceLogin(e.getPlayer());
return;
}
e.setKickMessage("§6[§bCTZLS§6] §c禁止入服 申请登录的IP与客户端IP不同!");
} else {
if (CTZLoginQueue.Login(name)) {
API.forceLogin(e.getPlayer());
return;
}
}
} else {
if (!Config.getInstance().getBoolean("forceclient"))
return;
if (CTZLoginQueue.Login(name)) {
API.forceLogin(e.getPlayer());
}
e.setResult(Result.KICK_WHITELIST);
}
@EventHandler

View File

@ -19,10 +19,11 @@ areas:
name: '纯净大区'
servers:
1:
name: "光板小镇"
address: "CityCraft.cn"
name: "InfinityZone"
address: "four.mengcraft.com"
port: 25565
info: "纯净服务器"
info: "InfinityZone \u000d 稳定 声誉 生存 地皮 小游戏"
depend: "1.8"
version: "1.8-Forge"
url: "CityCraft.cn"
2:
@ -31,7 +32,8 @@ areas:
1:
name: "光板小镇"
address: "CityCraft.cn"
port: 25565
port: 25573
info: "MOD服务器: 豆腐 家具 "
depend: ""
version: "1.7.10-Forge"
url: "CityCraft.cn"