remove server side debug
This commit is contained in:
parent
f4c024cde7
commit
374e0c4617
22 changed files with 1084 additions and 801 deletions
|
@ -121,7 +121,6 @@ public final class Server implements IThreadListener {
|
|||
private final List<Dimension> unload = Lists.<Dimension>newArrayList();
|
||||
private final Map<String, Position> warps = Maps.<String, Position>newTreeMap();
|
||||
private final CommandEnvironment scriptEnv = new CommandEnvironment(this);
|
||||
private final boolean debug;
|
||||
|
||||
private KeyPair keyPair;
|
||||
private WorldServer space;
|
||||
|
@ -158,8 +157,7 @@ public final class Server implements IThreadListener {
|
|||
UniverseRegistry.register();
|
||||
RotationRegistry.register();
|
||||
ReorderRegistry.register();
|
||||
boolean debug = System.getProperty("server.debug", null) != null;
|
||||
final Server server = new Server(debug);
|
||||
final Server server = new Server();
|
||||
Registry.addShutdownHook(new Runnable() {
|
||||
public void run() {
|
||||
server.stopServer();
|
||||
|
@ -240,8 +238,7 @@ public final class Server implements IThreadListener {
|
|||
return World.START_TIME;
|
||||
}
|
||||
|
||||
private Server(boolean debug) {
|
||||
this.debug = debug;
|
||||
private Server() {
|
||||
Config.setCallback(new Runnable() {
|
||||
public void run() {
|
||||
for(WorldServer world : Server.this.getWorlds()) {
|
||||
|
@ -277,7 +274,7 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
|
||||
public List<String> getPlayerFilenames() {
|
||||
String[] list = this.debug ? null : new File("players").list();
|
||||
String[] list = new File("players").list();
|
||||
if(list == null)
|
||||
return Lists.newArrayList();
|
||||
List<String> names = Lists.newArrayList();
|
||||
|
@ -292,14 +289,12 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
|
||||
public void saveWorldInfo() {
|
||||
if(!this.debug) {
|
||||
saveServerConfig(this.space.getDayTime(), this);
|
||||
WorldServer.saveWarps(this.warps);
|
||||
}
|
||||
saveServerConfig(this.space.getDayTime(), this);
|
||||
WorldServer.saveWarps(this.warps);
|
||||
}
|
||||
|
||||
public TagObject loadPlayerData(String user) {
|
||||
if(this.debug || !IPlayer.isValidUser(user))
|
||||
if(!IPlayer.isValidUser(user))
|
||||
return null;
|
||||
TagObject tag = null;
|
||||
try {
|
||||
|
@ -316,7 +311,7 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
|
||||
public void writePlayerData(String user, TagObject tag) {
|
||||
if(this.debug || !IPlayer.isValidUser(user))
|
||||
if(!IPlayer.isValidUser(user))
|
||||
return;
|
||||
try {
|
||||
File tmp = new File(new File("players"), user + ".cdt.tmp");
|
||||
|
@ -346,8 +341,6 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
|
||||
public void saveAllWorlds(boolean message) {
|
||||
if(this.debug)
|
||||
return;
|
||||
if(message)
|
||||
Log.TICK.info("Speichere Welt");
|
||||
this.saveWorldInfo();
|
||||
|
@ -372,22 +365,20 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
|
||||
public void run(long time) {
|
||||
if(!this.debug) {
|
||||
Converter.convert();
|
||||
long wtime = this.loadServerConfig();
|
||||
if(this.keyPair == null) {
|
||||
Log.SYSTEM.info("Generiere neues Schlüsselpaar");
|
||||
this.keyPair = EncryptUtil.createKeypair();
|
||||
}
|
||||
User.loadDatabase(this.users);
|
||||
Converter.convert();
|
||||
long wtime = this.loadServerConfig();
|
||||
if(this.keyPair == null) {
|
||||
Log.SYSTEM.info("Generiere neues Schlüsselpaar");
|
||||
this.keyPair = EncryptUtil.createKeypair();
|
||||
}
|
||||
User.loadDatabase(this.users);
|
||||
// if(dtime == -1L) // {
|
||||
// dtime = World.START_TIME;
|
||||
//// Config.set("spawnDim", "1", null);
|
||||
//// }
|
||||
this.worlds.add(this.space = new WorldServer(this, wtime,
|
||||
Space.INSTANCE, false));
|
||||
this.dimensions.put(this.space.dimension.getDimensionId(), this.space);
|
||||
new File("players").mkdirs();
|
||||
this.worlds.add(this.space = new WorldServer(this, wtime, Space.INSTANCE));
|
||||
this.dimensions.put(this.space.dimension.getDimensionId(), this.space);
|
||||
new File("players").mkdirs();
|
||||
// if(Config.spawnY < 0) {
|
||||
// WorldServer world = this.getWorld(Config.spawnDim);
|
||||
// world = world == null ? this.space : world;
|
||||
|
@ -410,28 +401,12 @@ public final class Server implements IThreadListener {
|
|||
// Config.set("spawnYaw", "" + (-180.0f + rand.floatv() * 360.0f), null);
|
||||
// Config.set("spawnPitch", "0.0", null);
|
||||
// }
|
||||
}
|
||||
else {
|
||||
Log.SYSTEM.info("Generiere temporäres Schlüsselpaar");
|
||||
this.keyPair = EncryptUtil.createKeypair();
|
||||
Config.clear();
|
||||
UniverseRegistry.clear();
|
||||
Config.set("daylightCycle", "false", false);
|
||||
Config.set("weatherChanges", "false", false);
|
||||
Config.set("mobSpawning", "false", false);
|
||||
Config.set("spawnRadius", "0", false);
|
||||
this.worlds.add(this.space = new WorldServer(this, World.START_TIME,
|
||||
Space.INSTANCE, true));
|
||||
this.dimensions.put(this.space.dimension.getDimensionId(), this.space);
|
||||
}
|
||||
this.setTpsTarget(20.0f);
|
||||
if(!this.debug) {
|
||||
for(Dimension dim : UniverseRegistry.getDimensions()) {
|
||||
if(WorldServer.needsLoading(dim)) {
|
||||
this.getWorld(dim.getDimensionId()).loadForcedChunks();
|
||||
}
|
||||
WorldServer.loadWarps(dim, this.warps);
|
||||
for(Dimension dim : UniverseRegistry.getDimensions()) {
|
||||
if(WorldServer.needsLoading(dim)) {
|
||||
this.getWorld(dim.getDimensionId()).loadForcedChunks();
|
||||
}
|
||||
WorldServer.loadWarps(dim, this.warps);
|
||||
}
|
||||
if(Config.port >= 0)
|
||||
this.bind(Config.port);
|
||||
|
@ -626,8 +601,7 @@ public final class Server implements IThreadListener {
|
|||
Dimension dim = UniverseRegistry.getDimension(dimension);
|
||||
if(dim == null)
|
||||
return null;
|
||||
world = new WorldServer(this, this.space.getDayTime(),
|
||||
dim, this.debug);
|
||||
world = new WorldServer(this, this.space.getDayTime(), dim);
|
||||
this.worlds.add(world);
|
||||
this.dimensions.put(dimension, world);
|
||||
}
|
||||
|
@ -786,7 +760,7 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
});
|
||||
}
|
||||
connection.sendPacket(new RPacketLoginSuccess(this.debug));
|
||||
connection.sendPacket(new RPacketLoginSuccess());
|
||||
connection.setNetHandler(conn);
|
||||
this.players.add(conn);
|
||||
User user = this.users.remove(loginUser);
|
||||
|
@ -861,8 +835,6 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
|
||||
private TagObject readPlayer(String user) {
|
||||
if(this.debug)
|
||||
return null;
|
||||
TagObject tag = null;
|
||||
try {
|
||||
File dat = new File(new File("players"), user + ".cdt");
|
||||
|
@ -878,8 +850,6 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
|
||||
private void writePlayer(Player conn) {
|
||||
if(this.debug)
|
||||
return;
|
||||
try {
|
||||
TagObject tag = new TagObject();
|
||||
EntityNPC entity = conn.getPresentEntity();
|
||||
|
@ -1107,8 +1077,6 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
|
||||
public void saveAllPlayerData(boolean message) {
|
||||
if(this.debug)
|
||||
return;
|
||||
if(message) {
|
||||
Log.TICK.info("Speichere Spielerdaten");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue