Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set max-players to 3, but managed to connect 6 players with prismarine-web-client #615

Open
kf106 opened this issue Jan 6, 2023 · 1 comment

Comments

@kf106
Copy link
Contributor

kf106 commented Jan 6, 2023

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.

@kf106
Copy link
Contributor Author

kf106 commented Jan 6, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant