Skip to content

SnTags v2.0.0

Choose a tag to compare

@ValentinTarnovsky ValentinTarnovsky released this 03 Aug 23:11
· 32 commits to main since this release

SnTags 2.0.0 is a full rewrite on SnLib. Same plugin, same commands, same placeholders - rebuilt from zero on the shared engine.

This is a clean break, not a drop-in update. Read the upgrade section before installing it on a live server.


Upgrading from 1.x - do this first

Back up plugins/SnTags/ and your database. Two of the changes below are irreversible.

Then, in plugins/SnTags/, delete config.yml, messages.yml and guis.yml.

This is not optional. 2.0.0 does not read the 1.x config layout, and leaving the old config.yml in place produces a file the server cannot parse. When that happens the plugin starts on built-in defaults - a MySQL server silently falls back to a new, empty SQLite file and serves every player no tags, with nothing in the log that names the cause. tags.yml is the exception: keep it, it is read as-is.

What carries over

Tag ownership (who owns which tag) Kept. Same table, same schema.
Personal tags from /tagadmin custom Kept, including their numeric ids.
tags.yml Kept and read as-is.
Whichever tag each player had equipped Reset. 1.x stored this in a table 2.0.0 does not read. Everyone keeps their tags and re-picks one from /tags.
Mixed-case tag identifiers Merged, irreversibly. 1.x stored VIP and vip as two tags; on the first start they become one and the duplicate ownership row is deleted. Players keep the tag through the surviving row.
config.yml, messages.yml, guis.yml Not read, nothing converted. Re-enter your database credentials, your table-prefix and any restyling by hand.

Behaviour changes to check before you deploy

Placeholders now need a viewer. %sntags_tag% and %sntags_has_tag% parsed with no player - a hologram line, a console-context parse - are left as the literal text instead of resolving. 1.x substituted an empty string for %sntags_tag%. This is decided in the PlaceholderAPI bridge, above the plugin. If you branch on %sntags_has_tag% anywhere, make sure that parse carries a player, or the condition takes the else branch for everyone.

%sntags_tag% still returns raw, uncolorized text with its & and &#RRGGBB codes intact, and the expansion identifier is still sntags. That contract is unchanged since 1.0.0 and is safe for cross-network chat formats, TAB and scoreboards.

Tag display text is now validated on input. /tagadmin create and /tagadmin custom refuse non-cosmetic MiniMessage. Colours, decorations, <gradient> and <rainbow> keep working; <click>, <hover> and similar are rejected, because tag text reaches other players' chat and a clickable element there runs as whoever clicks it. Text already in tags.yml or in the database is not re-checked.

MySQL pool tuning is one knob. database.pool-size replaces the four pool.* keys of 1.x.


Known issue

Hand-editing tags.yml while the server is running. /tagadmin create and /tagadmin delete rewrite the file from the copy the plugin loaded at startup, so edits you make by hand are lost if either command runs before a reload.

Run /tags reload after editing the file by hand and before using those commands. Editing it while the server is stopped needs no reload, and /tags reload on its own is always safe.

A fix is planned for 2.0.1. It is not in this release because the first attempt at it turned out to be worse than the bug - it could rebuild tags.yml from an incomplete read and drop the other tags - so it was reverted rather than shipped.


What is new under the hood

Everything below the commands is different: SnLib owns config, language, the menu, the database pool and the scheduler, and there is no hand-rolled infrastructure left in the plugin.

  • The selector menu is defined in guis/tag-selector.yml. Slots, materials, lore, ordering and pagination are all yours to edit - no positions are hardcoded.
  • Every message lives in lang/messages_en.yml.
  • Tag order in the menu is the order of the keys in tags.yml. Move a block to reorder it; it is never sorted alphabetically.
  • Database writes are off the main thread, and a failed write now tells the player or the admin instead of failing silently.
  • /tags reload, /tags help and /tags debug come from SnLib.
  • Requires SnLib - the server refuses to load SnTags without it.

Requirements

Java 21+, Paper 1.20.x or 1.21.x, SnLib. PlaceholderAPI is optional; without it the expansion is simply not registered.