-
-
Notifications
You must be signed in to change notification settings - Fork 678
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
feat(plugin-api): userId & clientName getters #743
feat(plugin-api): userId & clientName getters #743
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not idiomatic Kotlin. In Kotlin, if you have a property like val userId: String
, which is a public final value, a getter is automatically created. From the perspective of Java, it would look like public String getUserId()
Interfaces in Kotlin support properties, not just functions.
You should thus:
- Add the two properties to the interface
- Remove the explicit getters
- Remove the
private
access modifiers. Default is public. - Add the
override
modifier toSocketContext
, e.g.override val userId: String
@devoxin @TopiSenpai just for future reference, the release of code changes to the API have to go through me, as I am the only one with credentials and who can sign releases. |
Should probably also consider parsing the userId to be a Long. It's a string because Discord snowflakes are sent from Discord as strings in JSON for the sake of compatibility |
Yes I'm aware of what idiomatic kotlin is. I attempted to have kotlin automatically create getters for me but it complained...
ISocketContext is a Java interface.
Properties inside of a java interface? I'm pretty sure this isn't idiomatic java. |
Wouldn't that kind of be out of scope for this PR? It should be separate. |
Fair, I didn't realise it was written in Java. That was a deliberate choice.
Perhaps. But then you can do the conversion in the getter. I am not willing to release two separate API versions. |
Sounds good 👍🏼 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent. I will be releasing a new API version to Maven Central
Actually, we haven't really decided on how to manage plugin API versions that have not been merged into master. Are you fine with using JitPack for now? |
API version 3.6.0 released |
* feat(plugin-api): userId & clientName getters * fix: remove trailing space from javadoc * chore: convert user id to long in getter
* feat(plugin-api): userId & clientName getters * fix: remove trailing space from javadoc * chore: convert user id to long in getter
Adds two methods for getting the name & userId of a client