mirror of
https://github.com/Nan1t/NanoLimbo.git
synced 2026-02-10 19:06:14 +01:00
Chunk packet. Counting players and kicking if too many
This commit is contained in:
@@ -7,11 +7,29 @@ import ru.nanit.limbo.LimboConfig;
|
||||
import ru.nanit.limbo.connection.ClientChannelInitializer;
|
||||
import ru.nanit.limbo.util.Logger;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public final class LimboServer {
|
||||
|
||||
private AtomicInteger playersCount;
|
||||
|
||||
public int getPlayersCount(){
|
||||
return playersCount.get();
|
||||
}
|
||||
|
||||
public void incrementPlayers(){
|
||||
playersCount.incrementAndGet();
|
||||
}
|
||||
|
||||
public void decrementPlayers(){
|
||||
playersCount.decrementAndGet();
|
||||
}
|
||||
|
||||
public void start() throws Exception {
|
||||
Logger.info("Starting server...");
|
||||
|
||||
playersCount = new AtomicInteger();
|
||||
|
||||
ServerBootstrap bootstrap = new ServerBootstrap()
|
||||
.group(new NioEventLoopGroup(), new NioEventLoopGroup())
|
||||
.channel(NioServerSocketChannel.class)
|
||||
|
||||
Reference in New Issue
Block a user