Okay, so you bring up a lot of very important points. Don’t feel like you’re being ignorant. Pretty much all you’ve said is correct, short of a few nuanced details.
The current flag system was designed to fix a very big problem.
The problem of inheritance.
Or more annoyingly, the problem of MULTIPLE inheritance.
See, the old flag system was originally a tree hierarchy, with each flag inheriting from exactly one other flag. Each flag would control a behavior, and if a flag’s value was undefined, it would check its parent flag.
However, this introduced a really big problem, specifically with entities.
Let’s say we had a flag entity
, which was the parent of all entity related events.
Then we have a flag damage
, which was a child of entity
, and would cover events where an entity is damaged.
Then we also have a flag player
, which covers entity related events where the entity is a player. This flag is ALSO a child of entity
.
Now I want to add a flag damage_player
. We now run into a problem: Should this flag inherit from damage
or player
?
The obvious solution is “both”, so then I introduced the concept of multiple inheritance. But then I immediately ran into the diamond problem of multiple inheritance. Google that if you don’t know what that is.
The only solution I could think of was to order the parents in order of priority, and use parent distance as a primary heuristic, and priority as a secondary, “tie-breaker” heuristic.
However this quickly became really unmanageable and even more confusing. It was clear that it was getting out of hand, so I tried a different idea.
Fast forward a lot of thinking, and the current flag system was born. Each event is a set of flags, and each flag represents some property, with the set only containing flags that apply to that event.
This makes the flag list very concise, and allows for control of more behaviors than what would normally be allowed.
What would have normally required you to set a dozen different flags, now you can do with just a single line. This is done using matching sets, or sets of flags that only match other sets if the other sets contains all the flags in the matching sets.
This is why the root
or debuff
flags feel redundant. It’s because they ARE. However this redundancy allows you to do things like debuff
=true
, which grants all permissions instantly. This makes it feel like it’s still a hierarchal system, even if it isn’t.
Hope that provides some context.
EDIT: ACTUALLY, have some more context.
FoxGuard is NOT a complete plugin. Honestly it’s VERY far away from completion. In the end product, most users don’t ever have to deal with the underlying flag system. The whole point of FoxGuard is abstraction. A lot of the plugin is abstracted in a way that can be extended later on. The handlers that are available right now pretty much expose the guts of the minecraft server in a very crude way. This is NOT the end product.
Which then leads into…
IF ANYONE WANTS TO HELP ME DEVELOP THIS BEHEMOTH OF A PLUGIN, I WOULD LOVE HELP.
THERE IS PLENTY OF CONTENT-BASED CODE THAT NEEDS TO BE WRITTEN, AND IT’S ACTUALLY FUN TO WRITE IT.
Now that i’m done crying over not having any help with this plugin, I hope you understand why the plugin is written the way it is.
I will probably have much more and much better documentation in the future, but until then, just bear with me.