shared code for my plugins. plain java 21 except a tiny paper main class so the jar can sit in plugins/ without paper rejecting it. staff and holograms both use it. they declare it as a hard plugin dependency instead of shading it, so the jar has to be installed or the plugin will not load.
whats in it (mikey.me.core):
communication.protocol.PluginProtocolsigns and checks plugin messages (wrap/unwrap, HMAC-SHA256 with a shared secret, 30s window, replayed nonces get dropped)communication.LocalCommunicationin process message bus for paper only mode, behindCommunicationApi.CommunicationModeisPROXYorPAPERjson.JsonUtiltiny json helpers (escape,extractString,extractLong, etc)registry.CoreRegistryinitsetsplugins/MikeyCore.register("staff")makesplugins/MikeyCore/staff/anddatabase()readsdatabase.ymlin that folderpersistence.YamlFilereads and writes a plain yaml file (maps, lists, numbers, bools). no bukkit.readon a missing file is an empty mappersistence.DatabaseConfigdb settings record,toStringhides the passwordpersistence.DatabasePoolhikari pool from that config.connection()borrows one,close()stops it. the plugin opensplugins/MikeyCore/database.ymlon enable and closes it on disable. no mysql just means nothing connects until something askspersistence.ActivePunishmentPolicychecks if a ban/mute is still active from its start time and durationworld.WorldPointa world name plus x y z.withinuses a show distance and a bigger hide distance so stuff doesnt flicker on the edgetext.Linesadd/set/remove on a list of strings. line numbers are 1-based, a bad one comes back emptytext.Placeholderscontains/anyfor a%placeholder%token.100%and%%dont counttext.Keys.simpleids matching[a-z0-9_-]+text.Colors&codes, hex (&#rrggbb,<#rrggbb>,{#rrggbb},#rrggbb,&x&r&r&g&g&b&b) and<#start>text</#end>gradients.color()reads#rrggbb/#aarrggbbtext.Animations&u,<RAINBOW>, and<#ANIM:wave|burn|typewriter|scroll|colors>.frameis one tick of that text
its not published anywhere, plugins pull it in as a Gradle composite build. put this repo next to the plugin repo and add to the plugins settings.gradle.kts:
includeBuild("../MikeyCore") {
name = "mikey-core"
}then depend on it with compileOnly, dont shade it:
compileOnly("mikey.core:mikey-core:0.1.0-SNAPSHOT")gradle swaps in the local build for that coordinate so changes here show up without publishing.
needs JDK 21.
./gradlew build./gradlew test for just the tests.