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

Remove packetIndexes dependency in client.js #267

Closed
rom1504 opened this issue Oct 1, 2015 · 1 comment
Closed

Remove packetIndexes dependency in client.js #267

rom1504 opened this issue Oct 1, 2015 · 1 comment

Comments

@rom1504
Copy link
Member

rom1504 commented Oct 1, 2015

https://github.com/PrismarineJS/node-minecraft-protocol/blob/master/src/client.js#L37

The packetIndexes.packetStates[direction].hasOwnProperty(event) check can just be removed. It doesn't matter if some non-packet events are added to the packetToParse object. There's basically just 'error' and 'session'.

Getting rid of the dependency in client.js will make things easier for cross version work by limiting the reading of packets definitions to serializer.js

@rom1504
Copy link
Member Author

rom1504 commented Oct 1, 2015

Would be possible to use https://nodejs.org/api/events.html#events_emitter_listenercount_type there.
But it's only available in node 4.0 (see nodejs/node#734 ) so I guess not.

roblabla added a commit that referenced this issue Oct 1, 2015
remove dependency to readPackets from client.js : fix #267
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