Code Monkey home page Code Monkey logo

Comments (12)

andrewrk avatar andrewrk commented on July 17, 2024

There's a slippery line to draw, which is how much work does this module do. This is one of those places where I opted for this module doing less.

I have a higher level API called mineflayer which does exactly what you said.

There are some places that this module has to understand the protocol, and that is mostly because of this module handling encryption and authentication. However, at any place I could get away with not understanding the actual game protocol, I did.

Even if you want to be nice and send the kick packet, you still want to be able to forcefully end the connection. This module lets you do both. If you want to send the kick packet, use

client.write(0xff, {reason: "client.disconnect"});

If you want to forcefully end the connection, use client.end().

This is a wontfix.

from node-minecraft-protocol.

roblabla avatar roblabla commented on July 17, 2024

I understand that, however, your module internally kicks the client based on the keepalive in the server, which results in the inability to gracefully kick the client without modifying the library's source itself.

from node-minecraft-protocol.

andrewrk avatar andrewrk commented on July 17, 2024

Oh I see what you're saying. Yes I agree something is wrong with the server API - it tries to do too much and too little at the same time. Sorry to jump the gun.

from node-minecraft-protocol.

andrewrk avatar andrewrk commented on July 17, 2024

Maybe this could be solved by deleting the keep alive code in the server

from node-minecraft-protocol.

andrewrk avatar andrewrk commented on July 17, 2024

Really any way you want to solve it, I am likely to accept a PR for it.

from node-minecraft-protocol.

mappum avatar mappum commented on July 17, 2024

Previously, there was an option to disable the keepalive kick, but it looks like that is gone now. I believe that should be in there because it is part of the protocol, not something servers need to worry about (TCP has keepalives, but it's not like you have to worry about that when using sockets).

from node-minecraft-protocol.

roblabla avatar roblabla commented on July 17, 2024

I suppose the question is if the automatic kicking for things should use an actual protocol packet. IMO, yes.

from node-minecraft-protocol.

mappum avatar mappum commented on July 17, 2024

Oh, when I wrote it, it did use a kick packet, it looks like that got changed.

from node-minecraft-protocol.

roblabla avatar roblabla commented on July 17, 2024

Also, is mineflayer also a server API ? I thought it was only for client bots.

In any way, I think it would seem logical to remap client.end to both end the stream and send the packet with the reason. This way, yes, the module does "a little more" but in the end, I think kicking on stream's end is pretty much part of the protocol (wouldn't go as far to say it officially is, but it's how it "should be").

from node-minecraft-protocol.

andrewrk avatar andrewrk commented on July 17, 2024

mineflayer is client only, correct. I misinterpreted this issue at first thinking you were talking about client API.

@roblabla if you submit a good PR that uses an actual protocol packet for automatic kicking like you want, I will accept it.

from node-minecraft-protocol.

andrewrk avatar andrewrk commented on July 17, 2024

@mappum I would also accept a PR that added an option to disable keepAlive.

from node-minecraft-protocol.

roblabla avatar roblabla commented on July 17, 2024

Ah I see, my bad for not being clear enough. Okay, will do that once I get encryption working (almost there...)

from node-minecraft-protocol.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.