Replies: 14 comments
-
|
mmmh, is there maybe some interface we use? is implementing Map too much? generally like more utils like this. |
Beta Was this translation helpful? Give feedback.
-
|
Well |
Beta Was this translation helpful? Give feedback.
-
|
Hello, I would like to help but I've never have contributed before. could someone give me a bit more info? Thanks. |
Beta Was this translation helpful? Give feedback.
-
|
You can find our contribution guide at https://github.com/PaperMC/Paper/blob/master/CONTRIBUTING.md. If you have more questions feel free to hop by our discord's paper-dev channel. |
Beta Was this translation helpful? Give feedback.
-
since minecraft server includes guava maybe look into this? https://guava.dev/releases/30.1-jre/api/docs/com/google/common/collect/Table.html |
Beta Was this translation helpful? Give feedback.
-
|
Minecraft includes it currently but is not guaranteed in the future so it's probably not a good idea to design API around that. |
Beta Was this translation helpful? Give feedback.
-
never thought of that tbh, but since guava is mostly used in datafixerupper i would assume they are not removing guava anytime soon |
Beta Was this translation helpful? Give feedback.
-
|
aren't both Paper and CraftBukkit use Guava in many places, i.e. Preconditions? I think it's alright to use it if there is something useful in it |
Beta Was this translation helpful? Give feedback.
-
|
Using inside of the API and exposing it as ABI are two entirely different concepts, but, given that guava has been part of the internals for years, and they're still using it, it's probably a reasonably safe bet; not to mention, it's already actually exposed in the API Saying that, Table comes with some implementation expectations that the PDC does not meet; |
Beta Was this translation helpful? Give feedback.
-
|
bad idea to just manually impl? takes 30 seconds, and don't think there's any good interface that can be used for this afaik |
Beta Was this translation helpful? Give feedback.
-
|
No, I think a manual implementation is fine. PDC should have |
Beta Was this translation helpful? Give feedback.
-
|
For mapping functions on compute, is it worth it to pass persistent type to it? For something like
Also can (also editing on phone because I'm realizing I just didn't commit to pr) |
Beta Was this translation helpful? Give feedback.
-
|
I don't think there is a point in passing PDT ? pdc.computeIfPresent(customDataKey, PersistentDataType.STRING, (key, s) -> s.trim());Concerning that moving getOrDefault to the API serves literally 0 advantage for functionality, I'd argue against it as its just, more diff for no reason. |
Beta Was this translation helpful? Give feedback.
-
|
what i was thinking, i'm just incompetent at patch modifying even following instructions so just wanted to make sure, ty |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is your feature request related to a problem?
Will reduce boilerplate code & reduce multiple map calls where unnecessary.
Describe the solution you'd like.
The methods are self-explanatory, since they would be modifying the underlying map, just like the existing PersistentDataContainer set & get methods.
PersistentDataContainer::computeIfAbsent
PersistentDataContainer::compute
PersistentDataContainer::computeIfPresent
Describe alternatives you've considered.
Having to access the underlying map numerous times, instead of being able to use the methods provided by the underlying map.
Other
No response
Beta Was this translation helpful? Give feedback.
All reactions