Add PlaceHolderAPI support or events?
Fernthedev opened this issue ยท 15 comments
Unless I missed something, I haven't seen anything related to PlaceHolderAPI support or events that get called when a hologram is made. Could this be added in the future?
I need to check if there could be perfomance issues, otherwise it will be added!
It was a very simple injection for me: since all you need from PlaceHolderAPI was to convert the customName found in protocol lib support from an unaffected string to a PlaceHolderAPI replaced string, similar to how {displayname} and {player} were replaced (I knew I was going to have PlaceHolderAPI, so I didn't bother do to any safety checks or anything). The only issue is this: #101 (the player triggering ProtocolLib would be the oldest person on the server in the area). This probably needs to be fixed first, and I have no idea where to look.
Edit: I think i needed to replace both current and old ProtocolLib class files, since once I have done so, it matches with the issue linked above: while I temporarily see (description above), now upon server restart, it fixes itself.
Edit: the bug found in 101 was patched.
@Helcostr PRs are welcome, i see you already implemented this feature in your server
@Helcostr PRs are welcome, I see you already implemented this feature in your server
It's a sloppy PR, since I wasn't thinking about designing it to be elegant, and just spaghetti it in. I'll re-educate myself and work on a PR when I got the time (I was looking to flog for the performance evaluation).
Edit: Apparently we are no longer running my custom build, and have since attached a plugin for HoloDisp: https://www.spigotmc.org/resources/holographicextension.18461/
Still want to see the 1 line PR?
I've already added it ;) #239
It's not closed. I just closed the other issue, that is a duplicate of this one.
we need this.http://prntscr.com/oa3is4
Each placeholder has its own way of getting values, some have more heavy loads than others. It's probably not wise to be calling heavy loads every tick or whatever. Maybe have a config option to update the placeholder every few ticks or so?
Edit: Forgot to also mention, there could be MULTIPLE holograms doing this at once around a server that has other operations. Performance is pretty important when implementing something like this
Each placeholder has its own way of getting values, some have more heavy loads than others. It's probably not wise to be calling heavy loads every tick or whatever. Maybe have a config option to update the placeholder every few ticks or so?
Edit: Forgot to also mention, there could be MULTIPLE holograms doing this at once around a server that has other operations. Performance is pretty important when implementing something like this
If others can recklessly take care of placeholder caching (which probably is non existent), why can't you just follow suit then? Usually, scoreboards render per player, and they refresh X amount of game ticks...