Steal a Brainrot

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

EventFires whenCancellable
MobPurchaseEventA player claims a mob off the path, before money is takenYes
MobInterceptedEventA walking mob gets bought out from under its ownerYes
MobSecuredEventA mob lands in a base slotNo
MobStolenEventA thief picks up a secured mob to carry it offYes
MobSoldEventA player sells a mob out of their own base (the refund can be changed)Yes
TrapTriggerEventA trap goes offNo
BaseClaimedEvent / BaseUnclaimedEventA base changes handsNo
BaseProtectionActivateEventA shield goes upNo
BaseUpgradeEventA player buys a base upgrade. getType() is extra-slots or auto-defense, plus getNewLevel()No

Rounds, players and progress

EventFires whenCancellable
RoundStartEventAn arena's game gets going (enough players, or an admin forced it)No
RoundEndEventA round finishes. getRanking() lists player ids richest firstNo
PlayerRebirthEventA player rebirths. getNewLevel() is their count afterwardsNo
AchievementUnlockEventA player unlocks an achievement. getAchievementId()No
TeamJoinEventA player joins a team by invite or auto-fill. getTeamNumber()No
TradeCompleteEventA trade went through. getFirst() / getSecond()No
CrateOpenEventA crate reward is rolledNo
GlassColorUnlockEventA player unlocks a colorNo
SpectatorPromotedEventA queued spectator is offered a baseNo
SpecialEventStartEvent / SpecialEventEndEventA 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.

On this page