Developer API
Events and the API facade other plugins can use to integrate with Steal a Brainrot.
Other plugins can react to the game or drive parts of it. There are two surfaces: Bukkit events and a static API facade.
Events
Listen to these like any Bukkit event. The cancellable ones let you block the action. All of them live in cc.arrowtan.stealABrainRot.api.events.
Mobs and bases
| Event | Fires when | Cancellable |
|---|---|---|
MobPurchaseEvent | A player claims a mob off the path, before money is taken | Yes |
MobInterceptedEvent | A walking mob gets bought out from under its owner | Yes |
MobSecuredEvent | A mob lands in a base slot | No |
MobStolenEvent | A thief picks up a secured mob to carry it off | Yes |
MobSoldEvent | A player sells a mob out of their own base (the refund can be changed) | Yes |
TrapTriggerEvent | A trap goes off | No |
BaseClaimedEvent / BaseUnclaimedEvent | A base changes hands | No |
BaseProtectionActivateEvent | A shield goes up | No |
BaseUpgradeEvent | A player buys a base upgrade. getType() is extra-slots or auto-defense, plus getNewLevel() | No |
Rounds, players and progress
| Event | Fires when | Cancellable |
|---|---|---|
RoundStartEvent | An arena's game gets going (enough players, or an admin forced it) | No |
RoundEndEvent | A round finishes. getRanking() lists player ids richest first | No |
PlayerRebirthEvent | A player rebirths. getNewLevel() is their count afterwards | No |
AchievementUnlockEvent | A player unlocks an achievement. getAchievementId() | No |
TeamJoinEvent | A player joins a team by invite or auto-fill. getTeamNumber() | No |
TradeCompleteEvent | A trade went through. getFirst() / getSecond() | No |
CrateOpenEvent | A crate reward is rolled | No |
GlassColorUnlockEvent | A player unlocks a color | No |
SpectatorPromotedEvent | A queued spectator is offered a base | No |
SpecialEventStartEvent / SpecialEventEndEvent | A special event begins or ends. getEventId() | No |
The API facade
BrainrotAPI api = StealABrainRot.getAPI();
// economy (respects economy.mode, so this is Vault money in vault mode)
double money = api.getPlayerMoney(player);
api.addMoney(player, 500);
boolean paid = api.removeMoney(player, 250);
// mobs
MobState state = api.getMobState(entity); // PATH, WALKING_TO_BASE, SECURED, STOLEN (being carried)
BrainrotMob mob = api.getMob(entity);
boolean bought = api.claimMobFromPath(player, mob); // no confirm click, normal price and checks
boolean took = api.interceptMob(player, mob);
boolean grabbed = api.stealSecuredMob(thief, mob);
BrainrotMob added = api.addMobToBase(owner, 5); // straight into a free slot, null if full
// bases
Base base = api.getPlayerBase(player);
api.claimBase(player, 3);
api.unclaimBase(base);
List<Location> zone = api.getClaimZone(base);
boolean inside = api.isInClaimZone(location, base);
// protection and glass
api.activateBaseProtection(base);
api.activateBaseProtection(base, 120); // custom length in seconds
int secondsLeft = api.getProtectionTimeLeft(base);
api.unlockGlassColor(player, GlassColor.PURPLE);
boolean equipped = api.setGlassColor(player, GlassColor.PURPLE); // false if not owned
GlassColor color = api.getEquippedGlassColor(player);
// arenas, rounds and queue
Arena arena = api.getArena("arena1");
boolean running = api.isRoundRunning(arena);
int roundLeft = api.getRoundTimeLeft(arena); // -1 with no clock
api.endRound(arena);
int queuePos = api.getQueuePosition(player);
api.addToQueue(player, arena);
api.removeFromQueue(player);
api.promoteFromQueue(arena);
// progress, teams, events, cosmetics
int rebirths = api.getRebirths(player);
Set<String> achievements = api.getAchievements(player);
boolean allies = api.areTeammates(a, b);
int team = api.getTeamNumber(player); // -1 when solo or teams are off
Set<UUID> members = api.getTeamMembers(player);
api.startSpecialEvent("golden_hour", 300);
api.stopSpecialEvent("golden_hour");
boolean on = api.isSpecialEventActive("golden_hour");
boolean given = api.giveCosmetic(player, "trail:flame");Add the plugin jar as a provided dependency and softdepend: [StealABrainRot] in your plugin.yml.
Need a hook that does not exist yet? Ask on the Discord; the API grows on request.