mirror of
https://e.coding.net/circlecloud/CTZLoginServer.git
synced 2024-12-12 05:28:48 +00:00
xiugai dengluliucheng...
This commit is contained in:
parent
5106fa61f7
commit
41998638d7
@ -30,12 +30,6 @@ class Area {
|
|||||||
public void setServers(List<Server> servers) {
|
public void setServers(List<Server> servers) {
|
||||||
this.servers = servers;
|
this.servers = servers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return String.format("\"name\":\"{0}\",\"servers\":\"{1}\"", name, servers.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CTZServer {
|
class CTZServer {
|
||||||
@ -76,6 +70,7 @@ public class CTZServers {
|
|||||||
server.version = cs.getString(a + ".servers." + s + ".version");
|
server.version = cs.getString(a + ".servers." + s + ".version");
|
||||||
server.info = cs.getString(a + ".servers." + s + ".info");
|
server.info = cs.getString(a + ".servers." + s + ".info");
|
||||||
server.url = cs.getString(a + ".servers." + s + ".url");
|
server.url = cs.getString(a + ".servers." + s + ".url");
|
||||||
|
server.depend = cs.getString(a + ".servers." + s + ".depend");
|
||||||
area.servers.add(server);
|
area.servers.add(server);
|
||||||
}
|
}
|
||||||
sl.areas.add(area);
|
sl.areas.add(area);
|
||||||
@ -137,6 +132,16 @@ class Server {
|
|||||||
|
|
||||||
public String url;
|
public String url;
|
||||||
|
|
||||||
|
public String depend;
|
||||||
|
|
||||||
|
public String getDepend() {
|
||||||
|
return depend;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDepend(String depend) {
|
||||||
|
this.depend = depend;
|
||||||
|
}
|
||||||
|
|
||||||
public String getAddress() {
|
public String getAddress() {
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,9 @@ package cn.citycraft.CTZLoginServer.listen;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerLoginEvent;
|
import org.bukkit.event.player.PlayerLoginEvent;
|
||||||
import org.bukkit.event.player.PlayerLoginEvent.Result;
|
import org.bukkit.event.player.PlayerLoginEvent.Result;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
@ -31,28 +33,34 @@ public class PlayerListen implements Listener {
|
|||||||
long lasttime = lastquittime.get(name) == null ? 0 : lastquittime.get(name);
|
long lasttime = lastquittime.get(name) == null ? 0 : lastquittime.get(name);
|
||||||
e.setKickMessage("§6[§bCTZLS§6] §c禁止入服 请使用服务器专用启动器进入游戏!");
|
e.setKickMessage("§6[§bCTZLS§6] §c禁止入服 请使用服务器专用启动器进入游戏!");
|
||||||
if (getNowTime() - lasttime < Config.getInstance().getInt("server.timeout")) {
|
if (getNowTime() - lasttime < Config.getInstance().getInt("server.timeout")) {
|
||||||
API.forceLogin(e.getPlayer());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (CTZLoginQueue.canLogin(name)) {
|
|
||||||
if (CTZLoginQueue.isCheckIP()) {
|
|
||||||
if (CTZLoginQueue.canLogin(name, e.getAddress().getHostAddress())) {
|
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());
|
API.forceLogin(e.getPlayer());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
e.setKickMessage("§6[§bCTZLS§6] §c禁止入服 申请登录的IP与客户端IP不同!");
|
|
||||||
} else {
|
|
||||||
if (CTZLoginQueue.Login(name)) {
|
if (CTZLoginQueue.Login(name)) {
|
||||||
API.forceLogin(e.getPlayer());
|
API.forceLogin(e.getPlayer());
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (!Config.getInstance().getBoolean("forceclient"))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
e.setResult(Result.KICK_WHITELIST);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void PlayerQuit(PlayerQuitEvent e) {
|
public void PlayerQuit(PlayerQuitEvent e) {
|
||||||
|
@ -19,10 +19,11 @@ areas:
|
|||||||
name: '纯净大区'
|
name: '纯净大区'
|
||||||
servers:
|
servers:
|
||||||
1:
|
1:
|
||||||
name: "光板小镇"
|
name: "InfinityZone"
|
||||||
address: "CityCraft.cn"
|
address: "four.mengcraft.com"
|
||||||
port: 25565
|
port: 25565
|
||||||
info: "纯净服务器"
|
info: "InfinityZone \u000d 稳定 声誉 生存 地皮 小游戏"
|
||||||
|
depend: "1.8"
|
||||||
version: "1.8-Forge"
|
version: "1.8-Forge"
|
||||||
url: "CityCraft.cn"
|
url: "CityCraft.cn"
|
||||||
2:
|
2:
|
||||||
@ -31,7 +32,8 @@ areas:
|
|||||||
1:
|
1:
|
||||||
name: "光板小镇"
|
name: "光板小镇"
|
||||||
address: "CityCraft.cn"
|
address: "CityCraft.cn"
|
||||||
port: 25565
|
port: 25573
|
||||||
info: "MOD服务器: 豆腐 家具 "
|
info: "MOD服务器: 豆腐 家具 "
|
||||||
|
depend: ""
|
||||||
version: "1.7.10-Forge"
|
version: "1.7.10-Forge"
|
||||||
url: "CityCraft.cn"
|
url: "CityCraft.cn"
|
||||||
|
Loading…
Reference in New Issue
Block a user