Skip to content

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

Merged
BlueZeeKing merged 4 commits intoickerio:masterfrom
CamperSamu:placeholders-patch
Jul 3, 2022
Merged

Placeholders API Support (and preparation for the per-player patch)#69
BlueZeeKing merged 4 commits intoickerio:masterfrom
CamperSamu:placeholders-patch

Conversation

@CamperSamu
Copy link
Contributor

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:

  • %factions:name%
  • %factions:description%
  • %factions:state%
  • %factions:power%
  • %factions:power_formatted%
  • %factions:max_power%
  • %factions:player_power%
  • %factions:player_max_power%
  • %factions:required_power%
  • %factions:required_power_formatted%

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
Copy link
Contributor Author

Also ignore the Italian lol

@BlueZeeKing
Copy link
Collaborator

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

Copy link
Collaborator

@BlueZeeKing BlueZeeKing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the per-player power, as it's not done yet

@CamperSamu
Copy link
Contributor Author

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

@ickerio
Copy link
Owner

ickerio commented Jul 3, 2022

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
Copy link
Contributor Author

CamperSamu commented Jul 3, 2022

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
Copy link
Collaborator

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.

Copy link
Contributor Author

@CamperSamu CamperSamu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved with 868e9a1

@CamperSamu
Copy link
Contributor Author

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

@CamperSamu
Copy link
Contributor Author

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

@CamperSamu CamperSamu requested a review from BlueZeeKing July 3, 2022 19:23
Copy link
Collaborator

@BlueZeeKing BlueZeeKing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@BlueZeeKing BlueZeeKing merged commit 9340e9f into ickerio:master Jul 3, 2022
@CamperSamu
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants