NFAQ - CryptoMorin/KingdomsX GitHub Wiki
But we're here to answer them anyways.
Kingdoms comes with several powerful turrets by default, but also allows server owners to create their own custom ones. All the turret configuration files are located in the Turrets
folder.
The basic workflow for creating a new turret is as follows:
- Begin by creating a new YML file for your turret in the
Turrets
folder. - Copy the configuration of one of the existing turrets (from
arrow.yml
for example) and paste it into your new one. - Modify the settings to make your new turret unique.
- Make your turret available for purchase in the Nexus by adding it to the GUI in
guis
-><lang>
->structures
->nexus
->turrets.yml
. Simply copy one of the purchase buttons for other turrets and use it for your new one. Make sure that the button is named the same as in step 1 (without the .yml part; see example for arrow turret), and don't forget to change theposx
andposy
so it doesn't overlap existing items. - In
guis
-><lang>
->turrets
create a new YML file that is named exactly the same as in step 1. This will be the GUI shown when you right-click the turret after it's been placed, containing upgrade, ammo and buttons for other options. - Copy one of the guis of existing turret (eg.
arrow.yml
) and paste it into your new file. Configure it to your liking.
Note
Please refer to this section for a more detailed explanation and an example custom turret that you can use for your server.
We're going to be making a custom misc upgrade that adds permission for players. Thankfully LuckPerms Contextual Permissions make this easier.
- In misc-upgrades.yml we're going to add a new entry.
custom-misc-upgrade: # The name here will be important later for permissions and GUIs
enabled: true
can-be-disabled: true
max-level: 3
-
Make a new permission group using /lp creategroup kingdoms. This is where all kingdom related permissions will be defined. It's mostly for organization purposes.
-
We need to install ExtraContexts official LuckPerms addon to work with PlaceholderAPI-oriented contexts.
-
Enable placeholder API support in ExtraContexts config.yml and add the a new placeholder for the misc upgrade:
placeholderapi: true
placeholderapi-placeholders:
allowflight: "%player_allow_flight%"
customMiscUpgrade: "%kingdoms_kingdom_upgrade:level type=misc, of=CUSTOM_MISC_UPGRADE%"
Here we used a complicated functional placeholder. The of
option is determined by the config entry name. We used custom-misc-upgrade
. A rule of thumb is that whatever name you used, make all the characters uppercase and replace -
with _
.
- Add contextual permissions:
/lp group kingdoms permission set kingdoms.misc.custom.1 true customMiscUpgrade=1
/lp group kingdoms permission set kingdoms.misc.custom.2 true customMiscUpgrade=2
/lp group kingdoms permission set kingdoms.misc.custom.3 true customMiscUpgrade=3
Here we chose kingdoms.misc.custom.x
, but really, it could be any permission! customMiscUpgrade
is the context which relies on a single integer.
We only added 3 of them, because the max level is 3. If you want more levels, go back to step 1 and change the max-level
option.
- Make the default group inherit our newly created group:
/lp group default parent add kingdoms
This will allow all permissions to automatically use this group no matter what. Now, you might be asking, doesn't this give them the permissions right away whether they have the upgrade or not, or even in a kingdom at all? No, it doesn't because we used contextual permissions which is basically a way of saying "you only have this permission if a certain condition is met" and those conditions being our contexts, i.e.customMiscUpgrade=x
If your higher groups (donator ranks, mod, admin, etc) don't inherit the default
group for some reasons, you also have to add them to these groups too.
- Finally we can verify that it works:
/lp user <player> permission check kingdoms.misc.custom.1
We can also check what's the current context of the player using /lp user <player> info
Note that contextual permissions are not that perfect. If you for whatever reason needed to check these permission for a player that's offline, it won't work correctly due to performance issues from LuckPerms side.
- Add it to the GUI so players can actually upgrade it.
Just adding it to the
misc-upgrade.yml
is not enough, we need to manually open a slot for it inside misc-upgrades.yml GUI
The GUI's layout is designed to look nice with the default amount of upgrades. So if you want to add it, you should reposition all options.
options:
custom-misc-upgrade: # We just reused the same name as it is
name: "&2My Custom Misc Upgrade"
material: DIAMOND_BLOCK
lore: |
&7Gives you cool permissions
posx: x
posy: y
Also to translate the name shown in chat for %upgrade%
placeholder, you can add it to your language file upgrades -> misc -> custom-misc-upgrade -> name
9. Bonus Step: Upgrade Trees & Commands
You can make another upgrade to be only enabled if a certain condition is met, this works for all upgrades as well. Let's say we only want someone to upgrade this permission if they upgraded max members
to the maximum level and they have at least 10 members.
custom-misc-upgrade:
enabled: true
can-be-disabled: true
max-level: 3
condition:
"{kingdoms_kingdom_upgrade:level type=misc, of=MAX_MEMBERS} < 10": "miscupgrades.required.max-members"
"kingdoms_members < 10": "miscupgrades.required.members"
Here the keys are conditions and the values are paths to the entry to the error message to send to that player and prevent them from upgrading it if that condition is met. These entries are not defined by default and it can be any entry. You have to add them to your language files like en.yml
java.lang.RuntimeException: java.sql.BatchUpdateException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'JSON NULL,`claims` JSON NULL,`protectedBlocks` JSON NULL,`mutedChannels` JSON NU' at line 1
Caused by: java.sql.BatchUpdateException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'JSON NULL,`claims` JSON NULL,`protectedBlocks` JSON NULL,`mutedChannels` JSON NU' at line 1
Caused by: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'JSON NULL,`claims` JSON NULL,`protectedBlocks` JSON NULL,`mutedChannels` JSON NU' at line 1
at org.kingdoms.libs.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) ~[KingdomsX-1.16.19.jar:?]
at org.kingdoms.libs.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) ~[KingdomsX-1.16.19.jar:?]
at org.kingdoms.libs.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:763) ~[KingdomsX-1.16.19.jar:?]
at org.kingdoms.libs.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:780) ~[KingdomsX-1.16.19.jar:?]
at org.kingdoms.libs.mysql.cj.jdbc.StatementImpl.executeBatchUsingMultiQueries(StatementImpl.java:1019) ~[KingdomsX-1.16.19.jar:?]
at org.kingdoms.libs.mysql.cj.jdbc.StatementImpl.executeBatchInternal(StatementImpl.java:839) ~[KingdomsX-1.16.19.jar:?]
at org.kingdoms.libs.mysql.cj.jdbc.StatementImpl.executeBatch(StatementImpl.java:795) ~[KingdomsX-1.16.19.jar:?] at org.kingdoms.libs.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:127) ~[KingdomsX-1.16.19.jar:?] at org.kingdoms.libs.hikari.pool.HikariProxyStatement.executeBatch(HikariProxyStatement.java) ~[KingdomsX-1.16.19.jar:?]
at org.kingdoms.data.database.sql.SQLDatabase.<init>(SQLDatabase.java:60) ~[KingdomsX-1.16.19.jar:?]
... 16 more
This simply means that your MySQL server is outdated and needs to be updated. If your host provides a panel, you can update your MySQL from there, if not, you can manually download and install from the official MySQL download page.
Caused by: org.kingdoms.libs.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors
Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors
Caused by: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors
// or
Caused by: java.sql.SQLNonTransientConnectionException: SSL Connection required, but not provided by server.
Caused by: org.kingdoms.libs.mysql.cj.exceptions.UnableToConnectException: SSL Connection required, but not provided by server.
You simply need to set ssl option to false
and restart the server.
This is for archive purposes only.
Minecraft Version | Latest Plugin Version |
---|---|
1.20.1 | 1.16.14.1.1 |
1.20.2 | 1.16.18 |
1.20.4 | 1.16.18 |