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

Implement chat changes #1172

Closed
wants to merge 64 commits into from
Closed

Implement chat changes #1172

wants to merge 64 commits into from

Conversation

Kebab11noel
Copy link
Member

No description provided.

TheMode and others added 30 commits June 9, 2022 22:15
Signed-off-by: TheMode <themode@outlook.fr>
Signed-off-by: TheMode <themode@outlook.fr>
Signed-off-by: TheMode <themode@outlook.fr>
Signed-off-by: TheMode <themode@outlook.fr>
Signed-off-by: TheMode <themode@outlook.fr>
Signed-off-by: TheMode <themode@outlook.fr>
Signed-off-by: TheMode <themode@outlook.fr>
Signed-off-by: TheMode <themode@outlook.fr>
Signed-off-by: TheMode <themode@outlook.fr>
@Kebab11noel Kebab11noel marked this pull request as ready for review June 19, 2022 23:04
Copy link
Contributor

@BomBardyGamer BomBardyGamer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just contains nitpicks and styling issues. Other than that, looks alright to me, though I can't say it's good, since I didn't fully look at it.

Good PR though :)

private ChatTypeBuilder playerChatType = ChatTypeBuilder.builder(ChatType.CHAT.key()).chat(ChatDecoration.contentWithSender("chat.type.text"));
private ChatTypeBuilder systemChatType = ChatTypeBuilder.builder(ChatType.SYSTEM.key()).chat();

public Builder setRequireValidPlayerPublicKey(boolean requireValidPlayerPublicKey) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't most of the other builders in Minestom omit the set prefix?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change that, and this config change will be made in master first

import java.util.function.Supplier;

/**
* Used to mimic the final keyword
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well that's not really true, it's more of a lazy initialized object than a final object, i.e. it can only be set once, and can be set lazily.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I recommend a new name like LazyInitializedObject or LazyLoadedValue for this class?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We try to avoid this object, so it's name probably won't matter, but if it ends up in the final pr i'll choose a better name.

*
* @param <T> type of the object
*/
public final class ObjectCache<T> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't an object cache, it's a memoizing supplier. It calls the supplier once and caches the result. The name ObjectCache implies that it stores and tracks multiple objects, which misrepresents what this object does.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well i'm bad at naming things, but will change this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's fair enough. I recommend something like MemoizingSupplier.

Comment on lines +16 to +23
public enum SignatureAlgorithm {
SHA256withRSA,
SHA1withRSA
}

public enum KeyAlgorithm {
RSA
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about it, these enums don't really even need to exist. These are only used in the string constant context, i.e. by calling name() all the time, so they could just be string constants instead of enums.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the enum you can be sure that the method will exists, but with a string you might accidentally pass a wrong value.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is true, but is there even even that anyone other than us internally could pass an incorrect value? Because if there is not (and I'm pretty sure there isn't), we don't need the enum to guard against that.

@BomBardyGamer
Copy link
Contributor

I think this PR should wait until Adventure 4.12.0 is released, as I believe that quite a few things will be implemented in that, and so not required here. We don't want to push an API that will later be rewritten. I think this should be blocked by KyoriPowered/adventure#777

@Kebab11noel
Copy link
Member Author

I think this PR should wait until Adventure 4.12.0 is released, as I believe that quite a few things will be implemented in that, and so not required here. We don't want to push an API that will later be rewritten. I think this should be blocked by KyoriPowered/adventure#777

That was my original idea, but seems like the linked pull request barely makes any progress and if they go the route of supporting system messages only then it won't require a big change, I also had some suggestions and some of them was semi-agreed on it, yet no commits, so I'm not sure what's going on whit that pr, but anyways this pr is already blocking on the config (which will be merged today hopefully) and the registry rework (which isn't started yet).

@davidmayr
Copy link
Contributor

I think this PR should wait until Adventure 4.12.0 is released, as I believe that quite a few things will be implemented in that, and so not required here. We don't want to push an API that will later be rewritten. I think this should be blocked by KyoriPowered/adventure#777

We now have adventure 4.12.0. When will we have this implemented?

@mworzala mworzala deleted the branch 1.19 March 24, 2024 23:17
@mworzala mworzala closed this Mar 24, 2024
@mworzala mworzala deleted the feature/1.19-chat branch March 24, 2024 23:17
@mworzala mworzala restored the feature/1.19-chat branch March 24, 2024 23:18
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

Successfully merging this pull request may close these issues.

None yet

6 participants