ickerio / factions

Highly customizable, lightweight and fully featured factions mod for the Fabric loader in Minecraft
MIT License
25 stars 28 forks source link

Placeholders API Support (and preparation for the per-player patch) #69

Closed CamperSamu closed 2 years ago

CamperSamu commented 2 years ago

This PR adds support for Patbox/TextPlaceholderAPI and adds 5 methods that will be used for a (still W.I.P.) per-player power and permission-based power patch. If you don't want them I can just refactor the code and add back everything once the other patch is ready.

image

Placeholders added:

I'm also starting to work on a fork of this mod over at CampHQmc/factions where I will introduce more breaking and radical changes.

CamperSamu commented 2 years ago

Also ignore the Italian lol

BlueZeeKing commented 2 years ago

The Placeholder API looks good, but I would like to keep all per-player power stuff separate.

CamperSamu commented 2 years ago

Will be done tomorrow, right now I'm not at home and I'll be back late.

ickerio commented 2 years ago

Yeah this looks really good. The Placeholder API is awesome. I agree with @BlueZeeKing, probably best to remove the per player stuff until its done. Cheers!

CamperSamu commented 2 years ago

The only thing I'd like to keep from the extra methods is Factions#calculateMaxPower, so there's a standardized method to calculate a faction's power instead of copy-pasting the same formula over and over.

Also this should make easier in the future to add custom formulas via config if someone wants to work on it (like the original factions plugin)

BlueZeeKing commented 2 years ago

The only thing I'd like to keep from the extra methods is Factions#calculateMaxPower, so there's a standardized method to calculate a faction's power instead of copy-pasting the same formula over and over.

I 100% agree with this. When I reworked part of the config I had to change this in every single place when it could have just been one function.

CamperSamu commented 2 years ago

I need to make the commit respect the config changes, working on it

CamperSamu commented 2 years ago

Now everything works with 66dcf3bc0cc6fbcbcc09f3168e44c89846950f5d and CI is passing, waiting on review and merge.

CamperSamu commented 2 years ago

The Placeholder API is required while ideally, it would be optional. I could quickly fix this though and isn't that big of an issue

PAPI is JIJ-able, so it's fine like this, but if you want to change it to modCompile it's just a if statement in the mod init.