Comments (12)
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.
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.
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.
Maybe this could be solved by deleting the keep alive code in the server
from node-minecraft-protocol.
Really any way you want to solve it, I am likely to accept a PR for it.
from node-minecraft-protocol.
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.
I suppose the question is if the automatic kicking for things should use an actual protocol packet. IMO, yes.
from node-minecraft-protocol.
Oh, when I wrote it, it did use a kick packet, it looks like that got changed.
from node-minecraft-protocol.
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.
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.
@mappum I would also accept a PR that added an option to disable keepAlive.
from node-minecraft-protocol.
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)
- Still disconnects when using node-minecraft-protocol/blob/master/examples/proxy/proxy.js HOT 13
- Hide Mojang deprecation warning when using custom auth server. HOT 1
- Get error when trying to write login data to client HOT 9
- Chat commands do not support chat previewing HOT 1
- Translation string crash
- Ping is not a recognized export HOT 5
- Chunk size is 23 but only 15 was read ; partial packet : {"name":"entity_sound_effect","params":{"soundId":526,"soundCategory":2,"entityId":52724,"volume":16,"pitch":1}}; buffer :5c8e0402f49b03418000003f800000fb8f631a089c6c66 HOT 8
- custom_payload packet won't encode properly. HOT 8
- support 1.20.2 HOT 13
- How can I login to a server with custom yggdrasil endpoint? HOT 1
- Chat Signing is Forced for Commands HOT 3
- Separate lint in tests
- Add packet dump for all supported versions HOT 1
- Automatically check all supported version in version.js are mentioned in the readme HOT 1
- support 1.20.3 and .4 HOT 7
- Cannot read properties of undefined (reading 'overworld') HOT 1
- "Chunk size is 42 but only 2 was read" error HOT 7
- Inconsistent `playerChat` event data
- undefined nbt value HOT 2
- Some event handlers end up being called multiple times after going thru configuration state. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-minecraft-protocol.