Open Phoenix616 opened 1 year ago
@phoenix616 has funded $20.00 to this issue.
Different NPC systems have different ways of approaching NPC IDs. I'm questioning if I should make a generic NPCIdentifier interface to account for that (Citizens uses numerical IDs, other plugins may use UUIDs or internal names)
Yeah that's indeed an interesting question. This might actually be the case for more services than just this now that I think about it (e.g. someone might not use a string for the holograms either) so maybe having a general Identifier interface in the Tresor API that can be used by any service which might handle IDs could be best (one could even argue that a player using a UUID is kinda arbitrary and should use such an interface...)
If you want to take a stab at designing something like that feel free but I will too have to think about the best approach for that as it needs to be user-friendly enough to be easily usable. (E.g. you wouldn't want to have to always wrap your player-UUID to use an Economy service but this might not be that big of an issue in the case of NPCs or even holograms where you already have the Identifier from creating it. But again, some people might want to store them in a config/database, so any Identifier implementation would also need to be able to properly be converted into a storeable format...)
So yeah, thanks for bringing this up. If you have a good idea for addressing these points then feel free but it's definitely not part of this issue and if you want to do NPCs too then feel free to just implement it in a way that you think should work with most (e.g. Citizens can get NPCs via UUID too, maybe just using that for now would be the best approach)
Another issue I can think of is persistence. Certain APIs create persistent / non-persistent NPCs/Holograms etc. How should we tackle this? Citizens has its NPCRegistry system that allows us to choose, I'm unsure about other plugins like ZNPCs
Sounds like something that could be put behind a Feature enum (like one for persistent, one for temporary) and an option on NPC creation to store it or not. (And a create method without a parameter to be used with all plugins which should probably default to storing for those that can do both as I would assume that's what one usually expect it to do)
Design a service provider for working with NPCs.
Questionable how configurable this should be. But at least creating simple ones and querying for existence might be a good start.
Plugins that will be supported right out of the gate:
IssueHunt Summary
### Backers (Total: $20.00) - [ phoenix616](https://oss.issuehunt.io/u/phoenix616) ($20.00) ### Submitted pull Requests - [#26 NPC Draft](https://oss.issuehunt.io/r/Minebench/Tresor/pull/26) --- #### [Become a backer now!](https://oss.issuehunt.io/r/Minebench/Tresor/issues/23) #### [Or submit a pull request to get the deposits!](https://oss.issuehunt.io/r/Minebench/Tresor/issues/23) ### Tips - Checkout the [Issuehunt explorer](https://oss.issuehunt.io/r/Minebench/Tresor/) to discover more funded issues. - Need some help from other developers? [Add your repositories](https://oss.issuehunt.io/r/new) on IssueHunt to raise funds.