Allow more versatile implementations of Polychat clients #50
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was working on a Polychat client implementation for a custom Minecraft proxy.
While doing this I noticed some limitations in the Polychat client base I couldn't properly work around, so instead of hacking my way around them, I decided to make a PR!
These two limitations are addressed in this PR:
Config handling
Polychat requires a dedicated config file for each client and is incapable of getting config values passed during instantiation.
While this works fine in the scenario of a standalone Minecraft client, my client spawns multiple Polychat clients with similar configs. It is more reasonable for my usecase to maintain the configs on the implementation side and have them passed to the Polychat instance.
Which is what I did. I added an optional parameter
YamlConfig config
to the constructor of thePolychatClient
class.Logging
Polychat has
System.out
/System.err
hard-coded for logging. While this is easy and doesn't introduce a dependency on a logging library such as Log4J, I want to have the possibility of configuring my own logger.Therefore I added an Interface
Logger
that handles all logging methods. It's implemented by aDefaultLogger
that usesSystem.out
/System.err
like before, but gives me the possibility of adding my own logger on my implementation.