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

feat(api): Pointers supplier #429

Merged
merged 3 commits into from
Apr 24, 2024

Conversation

kezz
Copy link
Member

@kezz kezz commented Aug 26, 2021

This PR closes #428 by providing the PointersSupplier class which can be stored statically and resolved whenever Audience#pointers() is called to prevent having a bazillion hash maps lying about that all do the same thing.

When implemented, it would look something like this:

 public class MyPointeredObject extends SomePointeredParent implements Pointered {
  private static final PointersSupplier<MyPointeredObject> POINTERS = PointersSupplier.builder()
    .parent(SomePointeredParent.POINTERS) // Fallback to the parent to get pointers from.
    .resolving(Identity.UUID, MyPointeredObject::getUniqueId)
    .resolving(Identity.DISPLAY_NAME, MyPointeredObject::getDisplayName)
    .build();

  @Override
  public Pointers pointers() {
    return POINTERS.view(this);
  }
}

@kezz kezz requested a review from kashike August 29, 2021 16:31
@zml2008
Copy link
Member

zml2008 commented Sep 6, 2021

Looks good -- probably more useful for native implementations than -platform because -platform is more dynamic about which sources it adds pointers from.

One thing i'd like to see is some sort of 'inheritance' functionality. toBuilder() is close, but has a type parameter of T rather than U extends T, which would prevent it from being used to, for example, have a PointersSupplier for ServerPlayer extend from CommandSource.

@zml2008 zml2008 added this to the 4.10.0 milestone Oct 3, 2021
@zml2008 zml2008 removed this from the 4.10.0 milestone Jan 23, 2022
@kezz
Copy link
Member Author

kezz commented Feb 24, 2023

One thing i'd like to see is some sort of 'inheritance' functionality. toBuilder() is close, but has a type parameter of T rather than U extends T, which would prevent it from being used to, for example, have a PointersSupplier for ServerPlayer extend from CommandSource.

Do you think it would make more sense for the builder to have a fallback or parent method where you pass in your instance of the parent class or it's pointers supplier object?

@zml2008
Copy link
Member

zml2008 commented Feb 26, 2023

Do you think it would make more sense for the builder to have a fallback or parent method where you pass in your instance of the parent class or it's pointers supplier object?

@kezz I think that would be a reasonable option

@kezz kezz mentioned this pull request Jul 20, 2023
@kezz kezz changed the title api: Implement PointersSupplier feature(api): Pointers supplier Feb 27, 2024
@kezz kezz changed the title feature(api): Pointers supplier feat(api): Pointers supplier Feb 27, 2024
@kezz kezz requested review from kashike and zml2008 February 27, 2024 17:51
@kezz kezz added this to the 4.17.0 milestone Feb 27, 2024
@kezz
Copy link
Member Author

kezz commented Feb 27, 2024

Rebased and addressed zml's comments. You can now pass a parent to the supplier builder - see the PR description for an updated example.

@zml2008 zml2008 dismissed kashike’s stale review April 24, 2024 05:00

changes have been made

@zml2008 zml2008 self-assigned this Apr 24, 2024
@zml2008 zml2008 added this pull request to the merge queue Apr 24, 2024
Merged via the queue into KyoriPowered:main/4 with commit 3f61d40 Apr 24, 2024
3 checks passed
0utplay pushed a commit to CloudNetService/CloudNet that referenced this pull request May 16, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[net.kyori:adventure-text-serializer-legacy](https://github.com/KyoriPowered/adventure)
| `4.16.0` -> `4.17.0` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/net.kyori:adventure-text-serializer-legacy/4.17.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/net.kyori:adventure-text-serializer-legacy/4.17.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/net.kyori:adventure-text-serializer-legacy/4.16.0/4.17.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/net.kyori:adventure-text-serializer-legacy/4.16.0/4.17.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[net.kyori:adventure-text-serializer-gson](https://github.com/KyoriPowered/adventure)
| `4.16.0` -> `4.17.0` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/net.kyori:adventure-text-serializer-gson/4.17.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/net.kyori:adventure-text-serializer-gson/4.17.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/net.kyori:adventure-text-serializer-gson/4.16.0/4.17.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/net.kyori:adventure-text-serializer-gson/4.16.0/4.17.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [net.kyori:adventure-api](https://github.com/KyoriPowered/adventure)
| `4.16.0` -> `4.17.0` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/net.kyori:adventure-api/4.17.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/net.kyori:adventure-api/4.17.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/net.kyori:adventure-api/4.16.0/4.17.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/net.kyori:adventure-api/4.16.0/4.17.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>KyoriPowered/adventure
(net.kyori:adventure-text-serializer-legacy)</summary>

###
[`v4.17.0`](https://github.com/KyoriPowered/adventure/releases/tag/v4.17.0):
🌏 Adventure 4.17.0

<!-- Release notes generated using configuration in .github/release.yaml
at main/4 -->

#### What's Changed

##### ✨ Features

- feat(text-minimessage): Show ANSI rendering of parsed components in
tests by [@&#8203;zml2008](https://github.com/zml2008) in
[KyoriPowered/adventure#1042
- feat(minimessage): Add target to deserialization for contextual tags
by [@&#8203;kezz](https://github.com/kezz) in
[KyoriPowered/adventure#1051
- feat(api): Pointers supplier by
[@&#8203;kezz](https://github.com/kezz) in
[KyoriPowered/adventure#429
- 1.20.5 by [@&#8203;zml2008](https://github.com/zml2008) in
[KyoriPowered/adventure#1055

##### 🐛 Fixes

- fix(text-minimessage): Handle larger raninbow phases correctly by
[@&#8203;zml2008](https://github.com/zml2008) in
[KyoriPowered/adventure#1041
- fix: Allow for case-insensitivity in legacy serializer, closes
[#&#8203;1043](https://github.com/KyoriPowered/adventure/issues/1043)
by [@&#8203;kezz](https://github.com/kezz) in
[KyoriPowered/adventure#1044
- fix(api): Only trigger bossbar listeners if flags actually changed by
[@&#8203;zml2008](https://github.com/zml2008) in
[KyoriPowered/adventure#1067
- fix(nbt): `CompoundBinaryTag#getBoolean` ignores false values when
default value is true by [@&#8203;kashike](https://github.com/kashike)
in
KyoriPowered/adventure@e0edf0f
- fix(nbt): `ListBinaryTag` is weakly immutable by
[@&#8203;kashike](https://github.com/kashike) in
KyoriPowered/adventure@2e612aa

**Full Changelog**:
KyoriPowered/adventure@v4.16.0...v4.17.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 6:00am" in timezone
Europe/Berlin, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these
updates again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/CloudNetService/CloudNet).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNjMuNSIsInVwZGF0ZWRJblZlciI6IjM3LjM2My41IiwidGFyZ2V0QnJhbmNoIjoibmlnaHRseSIsImxhYmVscyI6WyJ0OiBkZXBlbmRlbmNpZXMiXX0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Per-type pointer checking
3 participants