ronaldburns / PlaceholderAPI

An advanced placeholder hub for the Sponge API
https://ore.spongepowered.org/rojo8399/PlaceholderAPI
MIT License
16 stars 15 forks source link

Version 5.0 #45

Open Wundero opened 7 years ago

Wundero commented 7 years ago

This is my sort of idea list for version 5 that I would like to put out before working on it. Figured this time it would be better to make the complete update process transparent as migrating from 3 to 4 was quite interesting.

I have two streams, with separate ideas, that can be implemented:

OR

That's all I've got for now but it's pretty big so I will leave it as is. for a bit. Any suggestions are appreciated, as always

Wundero commented 6 years ago

So I've been playing with the idea of the parser system, and I've come up with some ideas:

I still need to figure out how this system might include support for placeholder-object attachment.

ronaldburns commented 6 years ago

I like the Cause and Context system because it's what I already know when learning Sponge. I've read over your first idea a couple times now and I still can't wrap my head around it.

Wundero commented 6 years ago

It's likely that I will adopt something like that, though I think using contexts in some way is more important since they are named. If there is no source but an observer exists, the placeholder may think the observer is the source (which may or may not be desirable), so I have to do some thinking about what to do.

Wundero commented 6 years ago

Oops clicked the wrong button.

ronaldburns commented 6 years ago

I've read through this many times now and am still confused. Won't be able to help out until I see some commits as a start. :(

Wundero commented 6 years ago

I am still figuring out how I want to go about making this update as there are a lot of things that would have to be changed, and if I should wait until 8.0 hits a snapshot stream to start or just force 7.0 instead. I will create commits at some point which lay out the groundwork but I have some thinking to do first haha. I was on holiday and so had no time to work on this the past couple of weeks, but I might be able to get some things done soon (I hope).

Wundero commented 6 years ago

Another rough idea I have: I would like to create an asynchronous handling system for placeholders; that way, if a placeholder takes a long time to parse (for instance a mysql query), it does not slow the main thread. Ideally, all placeholders should be asynchronous since they are not supposed to modify any Sponge objects, and thus asynchronous computation is fine (we do not care about values that may change during execution, since we will only be grabbing it once anyways), however placeholders like the sound placeholder may not support it. If a placeholder does not support asynchronous computation, it will be parsed synchronously and then wait for the remaining async parses to complete. Realistically, if I handle this properly, there should be no issues with having parts be synchronous and parts not, due to the fact that parsing is the only real external handling and each parser should be independent. The javascript parser may present an issue if called async and that worries me, so what I might do is use the classwriter from ASM to determine if calls are made to the placeholder service parsing, and if they are enforce that that placeholder is synchronous.

CompletableFuture should allow me to do most of this properly, and I will probably use something like a ResultBuilder that supports concurrent modification (with a concurrent hash map probably) to combine the results and then return them.