Set max-players to 3, but managed to connect 6 players with prismarine-web-client
kf106 opened this issue · comments
Minecraft authentication is off, and I am connecting with 3 normal and 3 incognito browsers (Brave, Chrome) from two different PCs. Here is the settings file:
const mcServer = require('flying-squid')
const orthoverse = mcServer.createMCServer({
motd: 'The Orthoverse metaverse world',
port: 20565,
'max-players': 3,
'online-mode': false,
logging: true,
gameMode: 0,
difficulty: 1,
worldFolder: 'world',
generation: {
name: 'orthogen',
options: {
seed: 100,
version: '1.15.2',
pregen: 6*2
}
},
kickTimeout: 60000,
checkTimoutInterval: 4000,
plugins: {
hengeportals: 'hengeportals',
ethereum: 'ethereum'
},
modpe: false,
'view-distance': 6,
'player-list-text': {
header: 'Orthoverse',
footer: 'Voxel World'
},
'everybody-op': false,
'max-entities': 100,
version: '1.15.2'
})
console.log(orthoverse.motd)
I'll look further myself to see how max-players is used, but I'm guessing this is a bug.
So the logging in happens in minecraft-protocol/src/server/login.js and there does not appear to be anything to check that the number of players exceeds max players.
If you add
console.log("There are " + server.playerCount + " players and the maximum is " + server.maxPlayers)
if (server.playerCount >= server.maxPlayers) {
client.end('The server is full')
return
}
after line 37, which says client.username = packet.username
then it kicks any extra players trying to log on after the maximum.