{"id":28362798,"url":"https://github.com/grimanticheat/grimapi","last_synced_at":"2026-04-28T00:03:29.200Z","repository":{"id":40594396,"uuid":"507412798","full_name":"GrimAnticheat/GrimAPI","owner":"GrimAnticheat","description":"The API for Grim Anticheat","archived":false,"fork":false,"pushed_at":"2026-04-22T13:33:48.000Z","size":169,"stargazers_count":22,"open_issues_count":2,"forks_count":28,"subscribers_count":6,"default_branch":"master","last_synced_at":"2026-04-22T15:26:43.461Z","etag":null,"topics":["api","grim","java","minecraft","plugin-api"],"latest_commit_sha":null,"homepage":"https://grim.ac/wiki","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GrimAnticheat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-06-25T20:40:52.000Z","updated_at":"2026-04-22T13:33:52.000Z","dependencies_parsed_at":"2024-08-17T18:25:54.304Z","dependency_job_id":"91f64991-e93f-4f06-93d8-0c36ded64c02","html_url":"https://github.com/GrimAnticheat/GrimAPI","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GrimAnticheat/GrimAPI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrimAnticheat%2FGrimAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrimAnticheat%2FGrimAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrimAnticheat%2FGrimAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrimAnticheat%2FGrimAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GrimAnticheat","download_url":"https://codeload.github.com/GrimAnticheat/GrimAPI/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrimAnticheat%2FGrimAPI/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32205942,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T01:12:49.758Z","status":"online","status_checked_at":"2026-04-24T02:00:07.115Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","grim","java","minecraft","plugin-api"],"created_at":"2025-05-28T15:12:48.688Z","updated_at":"2026-04-24T02:00:52.783Z","avatar_url":"https://github.com/GrimAnticheat.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n \u003ch1\u003eGrimAPI\u003c/h1\u003e\n    \n \u003cdiv\u003e\n  \u003ca href=\"https://github.com/GrimAnticheat/GrimAPI/actions/workflows/gradle-publish.yml\"\u003e\n   \u003cimg alt=\"Workflow\" src=\"https://github.com/GrimAnticheat/GrimAPI/actions/workflows/gradle-publish.yml/badge.svg\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://repo.grim.ac\"\u003e\n   \u003cimg alt=\"Maven repository\" src=\"https://repo.grim.ac/api/badge/latest/snapshots/ac/grim/grimac/GrimAPI?name=Version\u0026style=flat\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://discord.grim.ac\"\u003e\n   \u003cimg alt=\"Discord\" src=\"https://img.shields.io/discord/811396969670901800?style=flat\u0026label=Discord\u0026logo=discord\"\u003e\n  \u003c/a\u003e\n \u003c/div\u003e\n \n \u003cbr\u003e\n \u003cdiv\u003e\n  \u003ca href=\"https://grim.ac\"\u003eWebsite\u003c/a\u003e\n  |\n  \u003ca href=\"https://github.com/GrimAnticheat/Grim/wiki/Developer-API\"\u003eWiki\u003c/a\u003e\n  |\n  \u003ca href=\"https://repo.grim.ac/\"\u003eMaven\u003c/a\u003e\n  |\n  \u003ca href=\"https://github.com/GrimAnticheat/Grim\"\u003eGrimAC\u003c/a\u003e\n \u003c/div\u003e\n\n \u003cbr\u003e\n \u003cdiv\u003e\nThe official developer plugin API for GrimAnticheat\n \u003c/div\u003e\n\n\u003c/div\u003e\n\n### **Requirements**:\n- Java 17 or higher\n- A supported environment listed [here](https://github.com/GrimAnticheat/Grim/wiki/Supported-environments)\n\n\n### Wiki\nYou can find more documentation and examples of how to use the API on the [wiki](https://github.com/GrimAnticheat/Grim/wiki/Developer-API).\n\n### **Gradle**:\n```kt\nrepositories {\n    maven {\n        name = \"grimacSnapshots\"\n        url = uri(\"https://repo.grim.ac/snapshots\")\n    }\n}\ndependencies {\n    // replace %VERSION% with the latest API version\n    compileOnly(\"ac.grim.grimac:GrimAPI:%VERSION%\")\n}\n```\n\n### **Maven**:\n```xml\n\u003crepository\u003e\n  \u003cid\u003egrimac-snapshots\u003c/id\u003e\n  \u003cname\u003eGrimAC's Maven Repository\u003c/name\u003e\n  \u003curl\u003ehttps://repo.grim.ac/snapshots\u003c/url\u003e\n\u003c/repository\u003e\n\u003c!-- replace %VERSION% with the latest API version --\u003e\n\u003cdependency\u003e\n  \u003cgroupId\u003eac.grim.grimac\u003c/groupId\u003e\n  \u003cartifactId\u003eGrimAPI\u003c/artifactId\u003e\n  \u003cversion\u003e%VERSION%\u003c/version\u003e\n  \u003cscope\u003eprovided\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\n### **Subscribing to events** (1.3+)\n\nThe current API dispatches each event through its own `EventChannel`. Grab the\nchannel via `bus.get(EventClass.class)` and subscribe with its fluent\n`on…(…)` method. Handlers take the event's fields as positional parameters\n— no pooled event object, no class-keyed registry lookup on the hot path.\n\nEvery subscribe takes a `GrimPlugin` as the first argument. The bus tracks\nsubscriptions by that plugin and sweeps them automatically on plugin disable\nvia `bus.unregisterAllListeners(plugin)` — same lifecycle model as Bukkit's\n`HandlerList`. Resolve the `GrimPlugin` once at plugin enable and reuse it:\n\n```java\nGrimAbstractAPI api = GrimAPIProvider.get();\nEventBus bus = api.getEventBus();\nGrimPlugin grim = api.getGrimPlugin(this);   // resolve once; `this` can be a Bukkit\n                                             // JavaPlugin, a Fabric ModContainer, etc.\n\n// Non-cancellable — observational\nbus.get(GrimTransactionSendEvent.class)\n   .onTransactionSend(grim, (user, id, ts) -\u003e {\n       getLogger().info(\"tx-send \" + id + \" for \" + user.getName());\n   });\n\n// Cancellable — returns the new cancelled state (true = cancel)\nbus.get(FlagEvent.class)\n   .onFlag(grim, (user, check, verbose, cancelled) -\u003e {\n       if (verbose.contains(\"safe\")) return false; // un-cancel\n       return cancelled;\n   });\n\n// Priority + ignoreCancelled overloads\nbus.get(FlagEvent.class)\n   .onFlag(grim, (u, c, v, cancelled) -\u003e true, /*priority*/ 10, /*ignoreCancelled*/ false);\n```\n\nIf you really don't want to hold a `GrimPlugin` reference, every `onX(...)`\nhas a `@Deprecated` `onX(Object pluginContext, Handler, …)` overload that\nresolves the context through the bus's plugin resolver:\n\n```java\n// Works but warns. Call api.getGrimPlugin(this) once and use the\n// non-deprecated overload instead.\nbus.get(FlagEvent.class).onFlag((Object) this, (u, c, v, cancelled) -\u003e cancelled);\n```\n\n**Cache the channel for hot paths.** The `bus.get(...)` lookup is a\nConcurrentHashMap hit; storing the channel in a `static final` lets the JIT\nfold the lookup away entirely:\n\n```java\npublic final class MyHotPathClass {\n    private static final FlagEvent.Channel FLAG =\n            GrimAPIProvider.get().getEventBus().get(FlagEvent.class);\n\n    public void process() {\n        // No map lookup, no event-object allocation.\n        FLAG.fire(user, check, verbose);\n    }\n}\n```\n\n**Priority ordering.** Lower priority fires first; higher priority gets the\nfinal say on cancellation. This matches Bukkit's `EventPriority`\nconvention — a handler at a high priority can observe the settled cancelled\nstate after lower-priority handlers have run (useful for monitoring) or,\nwhen registered with `ignoreCancelled = true`, override a lower-priority\nhandler's cancellation by returning `false`.\n\n\u003e **Note:** This is a direction flip from pre-1.3 Grim, which sorted\n\u003e highest-first. Plugins migrating from 1.2.x that use explicit priority\n\u003e numbers should re-evaluate what \"early\" and \"late\" mean for their logic.\n\n**Addon events.** Plugins that define their own `GrimEvent\u003cChannel\u003e`\nsubclass register it once at enable with\n`bus.register(MyEvent.class, new MyEvent.Channel())`.\n\n**Plugin-disable cleanup.** `bus.unregisterAllListeners(grim)` sweeps every\nhandler registered with that `GrimPlugin` — both the typed\n`bus.get(E.class).onX(grim, handler)` path and the legacy\n`bus.subscribe(ctx, E.class, listener)` / `@GrimEventHandler` paths. In\n`onDisable()`, pass either your `GrimPlugin` or the same `Object` context\nyou registered with:\n\n```java\n@Override\npublic void onDisable() {\n    EventBus bus = GrimAPIProvider.get().getEventBus();\n    bus.unregisterAllListeners(this);  // or: bus.unregisterAllListeners(grim)\n}\n```\n\n**Legacy API.** `bus.post(event)`, `bus.subscribe(ctx, EventClass.class, listener)`\nand `@GrimEventHandler` reflective registration are preserved for source\ncompatibility with 1.2.4.0 callers, route through the same channels, and are\nmarked `@Deprecated` with doc pointing at `bus.get(E.class).on…(grim, handler)`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrimanticheat%2Fgrimapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrimanticheat%2Fgrimapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrimanticheat%2Fgrimapi/lists"}