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 durationweb.WebServertiny http server.start(port, token)binds,route(method, path, handler)adds a route,html(path, body)serves a page,stop()closes it. empty token stays on 127.0.0.1. a token listens on every interface and has to be sent asAuthorization: Bearer,X-Token, or?token=. no extra deps, jdk http serverweb.WebAppsthe one shared server.open(plugins/MikeyCore/web.yml)starts it whenenabledis true. keys areenabled,port,token,token-hours(default 12),luckperms(default false).luckpermsonly changes the offline hologram editor check. a blank token stays on localhost with no auth. any other token binds public but is not a password and is not written back. player tokens live in memory (issue(name),allow(name -> ...)), lasttoken-hours, and a restart clears them. another plugin callsregister(id, server -> ...)andunregister(id). same id replaces just that plugin's routes.web.WebFiles.textreads a classpath page.web.Jsonparses a json bodyworld.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.