renme config class, add blocks/items devmode startup check
This commit is contained in:
parent
141c1b1f5c
commit
ee3bf79c4c
98 changed files with 1463 additions and 928 deletions
|
@ -39,7 +39,6 @@ import common.future.Futures;
|
|||
import common.future.ListenableFuture;
|
||||
import common.future.ListenableFutureTask;
|
||||
import common.future.ThreadFactoryBuilder;
|
||||
import common.init.Config;
|
||||
import common.init.EntityRegistry;
|
||||
import common.init.Registry;
|
||||
import common.init.UniverseRegistry;
|
||||
|
@ -91,6 +90,7 @@ import common.util.Position;
|
|||
import common.util.Util;
|
||||
import common.util.Var;
|
||||
import common.util.WorldPos;
|
||||
import common.vars.Vars;
|
||||
import common.world.World;
|
||||
import server.biome.GenBiome;
|
||||
import server.clipboard.ReorderRegistry;
|
||||
|
@ -100,8 +100,8 @@ import server.command.FixedExecutor;
|
|||
import server.network.HandshakeHandler;
|
||||
import server.network.Player;
|
||||
import server.network.User;
|
||||
import server.util.SVar;
|
||||
import server.util.ServerConfig;
|
||||
import server.vars.SVar;
|
||||
import server.vars.SVars;
|
||||
import server.world.Converter;
|
||||
import server.world.Region;
|
||||
import server.world.WorldServer;
|
||||
|
@ -258,7 +258,7 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
|
||||
private Server() {
|
||||
for(Class<?> clazz : new Class[] {Config.class, ServerConfig.class}) {
|
||||
for(Class<?> clazz : new Class[] {Vars.class, SVars.class}) {
|
||||
for(Field field : clazz.getDeclaredFields()) {
|
||||
if(field.isAnnotationPresent(Var.class)) {
|
||||
if(!Modifier.isStatic(field.getModifiers()) || Modifier.isFinal(field.getModifiers()))
|
||||
|
@ -277,7 +277,7 @@ public final class Server implements IThreadListener {
|
|||
for(WorldServer world : Server.this.getWorlds()) {
|
||||
world.updatePhysics();
|
||||
}
|
||||
Server.this.sendPacket(new SPacketWorld(WorldServer.clampGravity(), ServerConfig.dayCycle, ServerConfig.timeFlow));
|
||||
Server.this.sendPacket(new SPacketWorld(WorldServer.clampGravity(), SVars.dayCycle, SVars.timeFlow));
|
||||
}
|
||||
}, "daylightCycle", "timeFlow", "gravity");
|
||||
this.setCallback(new Runnable() {
|
||||
|
@ -289,12 +289,12 @@ public final class Server implements IThreadListener {
|
|||
}, "viewDistance");
|
||||
this.setCallback(new Runnable() {
|
||||
public void run() {
|
||||
Server.this.bind(ServerConfig.port);
|
||||
Server.this.bind(SVars.port);
|
||||
}
|
||||
}, "port");
|
||||
this.setCallback(new Runnable() {
|
||||
public void run() {
|
||||
if((!ServerConfig.password.isEmpty() && ServerConfig.password.length() < 8) || ServerConfig.password.length() > IPlayer.MAX_PASS_LENGTH)
|
||||
if((!SVars.password.isEmpty() && SVars.password.length() < 8) || SVars.password.length() > IPlayer.MAX_PASS_LENGTH)
|
||||
Log.IO.warn("Passwort muss aus 8-" + IPlayer.MAX_PASS_LENGTH + " Zeichen bestehen, Login wird nicht möglich sein");
|
||||
}
|
||||
}, "password");
|
||||
|
@ -439,11 +439,11 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
WorldServer.loadWarps(dim, this.warps);
|
||||
}
|
||||
if(ServerConfig.port >= 0)
|
||||
this.bind(ServerConfig.port);
|
||||
if(SVars.port >= 0)
|
||||
this.bind(SVars.port);
|
||||
else
|
||||
Log.SYSTEM.warn("Kein Port definiert, verwende 'sv port <1024-32767>' um einen Hosting-Port festzulegen");
|
||||
if(ServerConfig.accessRequired && ServerConfig.password.length() < 8)
|
||||
if(SVars.accessRequired && SVars.password.length() < 8)
|
||||
Log.SYSTEM.warn("Kein Passwort definiert, verwende 'sv password <8-" + IPlayer.MAX_PASS_LENGTH + " Zeichen>' um ein Zugangspasswort festzulegen");
|
||||
Thread con = new Thread(new Runnable() {
|
||||
private final BufferedReader reader = new BufferedReader(new InputStreamReader(new BufferedInputStream(System.in)));
|
||||
|
@ -515,7 +515,7 @@ public final class Server implements IThreadListener {
|
|||
|
||||
public void preload(WorldServer world, int bx, int bz) {
|
||||
int done = 0;
|
||||
int total = ServerConfig.distance * 2 + 1;
|
||||
int total = SVars.distance * 2 + 1;
|
||||
total *= total;
|
||||
Log.TICK.info("Generiere und lade Welt");
|
||||
// WorldServer world = this.getWorld(Config.spawnDim);
|
||||
|
@ -523,8 +523,8 @@ public final class Server implements IThreadListener {
|
|||
bx = bx >> 4;
|
||||
bz = bz >> 4;
|
||||
long last = System.currentTimeMillis();
|
||||
for(int x = -ServerConfig.distance; x <= ServerConfig.distance; x++) {
|
||||
for(int z = -ServerConfig.distance; z <= ServerConfig.distance; z++) {
|
||||
for(int x = -SVars.distance; x <= SVars.distance; x++) {
|
||||
for(int z = -SVars.distance; z <= SVars.distance; z++) {
|
||||
long time = System.currentTimeMillis();
|
||||
if(time - last > 1000L) {
|
||||
Log.TICK.info("Bereite Spawnbereich vor" + ": " + (done * 100 / total) + "%");
|
||||
|
@ -610,7 +610,7 @@ public final class Server implements IThreadListener {
|
|||
this.sendPacket(new SPacketPlayerListItem((List)this.getPlayers()));
|
||||
this.pingTimer = 0;
|
||||
}
|
||||
if(ServerConfig.saveInterval > 0 && ++this.saveTimer >= ServerConfig.saveInterval) {
|
||||
if(SVars.saveInterval > 0 && ++this.saveTimer >= SVars.saveInterval) {
|
||||
this.saveAllPlayerData(false);
|
||||
this.saveAllWorlds(false);
|
||||
this.saveTimer = 0;
|
||||
|
@ -761,7 +761,7 @@ public final class Server implements IThreadListener {
|
|||
WorldServer world = this.getWorld(origin.getDimension());
|
||||
world = world == null ? this.space : world;
|
||||
BlockPos pos = origin;
|
||||
int radius = ServerConfig.spawnRadius;
|
||||
int radius = SVars.spawnRadius;
|
||||
if(radius > 0) {
|
||||
pos = world.getTopSolidOrLiquidBlock(pos.add(
|
||||
ExtMath.clampi(world.rand.excl(-radius, radius), -World.MAX_SIZE + 1, World.MAX_SIZE - 1), 0,
|
||||
|
@ -782,10 +782,10 @@ public final class Server implements IThreadListener {
|
|||
Player conn = new Player(this, connection, loginUser);
|
||||
if(tag != null)
|
||||
conn.readTags(tag);
|
||||
if(ServerConfig.compression >= 0) {
|
||||
connection.sendPacket(new RPacketEnableCompression(ServerConfig.compression), new ChannelFutureListener() {
|
||||
if(SVars.compression >= 0) {
|
||||
connection.sendPacket(new RPacketEnableCompression(SVars.compression), new ChannelFutureListener() {
|
||||
public void operationComplete(ChannelFuture future) throws Exception {
|
||||
connection.setCompressionTreshold(ServerConfig.compression);
|
||||
connection.setCompressionTreshold(SVars.compression);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -817,7 +817,7 @@ public final class Server implements IThreadListener {
|
|||
conn.sendPacket(new SPacketJoinGame(player.getId(), world.dimension, EntityRegistry.getEntityID(player), tag == null));
|
||||
conn.sendPacket(new SPacketHeldItemChange(player.inventory.currentItem));
|
||||
conn.sendPacket(new SPacketWorld(WorldServer.clampGravity(),
|
||||
ServerConfig.dayCycle, ServerConfig.timeFlow));
|
||||
SVars.dayCycle, SVars.timeFlow));
|
||||
// conn.initializeStats();
|
||||
this.sendPacket(new SPacketPlayerListItem(false, conn));
|
||||
|
||||
|
@ -948,7 +948,7 @@ public final class Server implements IThreadListener {
|
|||
// this.movePlayerToSpawn(nplayer);
|
||||
}
|
||||
world.loadChunk((int)nplayer.posX >> 4, (int)nplayer.posZ >> 4);
|
||||
if(bed != null ? ServerConfig.checkBed : ServerConfig.spawnRadius >= 0) {
|
||||
if(bed != null ? SVars.checkBed : SVars.spawnRadius >= 0) {
|
||||
while(!world.getCollidingBoundingBoxes(nplayer, nplayer.getEntityBoundingBox()).isEmpty() && nplayer.posY < 512.0D) {
|
||||
nplayer.setPosition(nplayer.posX, nplayer.posY + 1.0D, nplayer.posZ);
|
||||
}
|
||||
|
@ -1205,7 +1205,7 @@ public final class Server implements IThreadListener {
|
|||
if(this.endpoint != null)
|
||||
this.terminateEndpoint("Wechsele auf Port " + port);
|
||||
// throw new IllegalStateException("Eingangspunkt bereits gesetzt");
|
||||
Log.NETWORK.info("Öffne Port %d auf 0.0.0.0 (Timeout %ds)", port, ServerConfig.timeout);
|
||||
Log.NETWORK.info("Öffne Port %d auf 0.0.0.0 (Timeout %ds)", port, SVars.timeout);
|
||||
this.endpoint = ((ServerBootstrap)((ServerBootstrap)(new ServerBootstrap()).channel(NioServerSocketChannel.class)).childHandler(new ChannelInitializer<Channel>() {
|
||||
protected void initChannel(Channel channel) throws Exception {
|
||||
try {
|
||||
|
@ -1213,7 +1213,7 @@ public final class Server implements IThreadListener {
|
|||
}
|
||||
catch(ChannelException e) {
|
||||
}
|
||||
channel.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(ServerConfig.timeout)))
|
||||
channel.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(SVars.timeout)))
|
||||
.addLast((String)"splitter", (ChannelHandler)(new PacketSplitter()))
|
||||
.addLast((String)"decoder", (ChannelHandler)(new PacketDecoder(true)))
|
||||
.addLast((String)"prepender", (ChannelHandler)(new PacketPrepender()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue