Server HostPlaceholder name
All docs pages

Add-ons for setups

The add-on kit of our setup plugins: typed actions, services, events and data files you and your AI can build on.

DraftThis page is a first draft and may change.

Our setup plugins are closed, but each has a small add-on kit so you (or your AI) can build on top without seeing our code. The kit is versioned; this page describes version 1.0.0. A change that could break an add-on raises the first number.

There are three ways to add to a setup, from easiest to most powerful:

  1. Data files: prices, crates, rewards, events, bosses, regions, warps and holograms are plain YAML files your AI can write (see each page), or settings on the settings page. They can only use the typed actions below.
  2. Typed actions: one thing a reward does, such as giving an item or a crate key.
  3. A Java add-on plugin that uses the services and events below. Add depend: [sh-core, sh-api] (and the other parts you use, for example sh-events) to your plugin.yml. Add-on jars go through the same checks as any plugin you upload. Plugin names starting with sh- are kept for our own plugins, so pick another name.

Actions

An action is one thing a reward does, written as data. Crates, events, bosses, weekly prizes, the daily reward and vote rewards all use them, from one shared list: any file can use any action below, and the ones your add-ons register. Run /shapi on your server to see every action type and its settings.

ActionSettingsWhat it does
messagetextSends the player a message (colours and styles only)
broadcasttextTells everyone online; {player} is filled in
titletitle, subtitleA big title on the player's screen
give_itemitem like diamond x3, nameGives items; extra items drop at their feet, and a player who is offline finds them in /collect. Command blocks, barriers, spawners, spawn eggs and other operator items can never be given this way, nor can netherite gear, enchanted golden apples, totems, elytra or maces; at most 2,304 of one item per action
soundsound, volume, pitchPlays a sound
effecteffect, seconds, levelA potion effect, up to 10 minutes, level 1 to 5
commandcommandRuns a console command, only if it starts with one of the commands you allowed on the settings page
give_currencycurrency, amountGives money or another currency (needs the economy); at most 100,000 per action
potioneffect, seconds, levelA potion effect (from the shared base plugin)
give_keykey, amountGives crate keys (the daily key limit applies)
give_spawnertype_id, amountGives spawner items
start_eventeventStarts one of your events now
spawn_bossboss, padCalls a boss
give_generatortier (1 to 12), amount (1 to 16)Gives gens generators (the gens setup)

For example, a King of the hill prize:

rewards:
  "1":
    - {type: give_key, key: event, amount: 2}
    - {type: broadcast, text: "<gold>{player} is King of the hill!"}

Two small differences, because the daily and vote rewards (rewards.yml) come from the shared base plugin: there, give_item takes item: minecraft:diamond and amount: 3, and message and sound take the same settings as above. Everything else reads the same in every file.

The command lists are yours only. Crates, events and bosses use the list under "Commands rewards may run" in the shared add-on settings (empty at first); the daily and vote rewards use the same setting of the base plugin (eco give, shcrates give and say at first). Only you change them, on the settings page: your AI can write rewards, but it cannot add commands to either list. Commands like op, stop, ban and permission changes are never allowed, whatever is on the list. List only the start of a command, like eco give; rewards fill in the player. An entry that could never work is left out, with a warning in the console that says why.

Services

Get a service in your plugin's enable, for example EconomyService.get() or, for the add-on kit's services, from Bukkit's services manager.

PartServiceWhat it offers
sh-coreShCore.api()Currencies and the money ledger (every change is audited and can be undone), player data per namespace, the settings system, menus (menus().open(player, menu)), the action registry (add your own action types), the item collection box, playtime.
sh-economyEconomyServiceBalances and transfers, the price table, registerPrice and registerItemKeyResolver to make your custom items sellable.
sh-rewardsRewardsServiceRecord votes.
sh-displayDisplayServiceregisterBoard for your own leaderboard, place holograms.
sh-guardGuardServiceIs a player in combat or protected, end protection, raise a flag for staff.
sh-zonesZoneServiceRegions at a location, flag values, flags().register(...) for your own flag, create and change regions.
sh-travelTravelServiceSpawn, warps, and send(player, place, reason, warmup) for teleports with our warm-up rules.
sh-apiActionRegistryRegister your own action types; run actions. Types you add here can be used in every file, the base plugin's too.
sh-apiCurrencyServiceMoney and other currencies, through the server's money ledger.
sh-cratesKeyServiceGive crate keys (earned only; the daily limit applies).
sh-eventsLeaderboardServiceAdd your own event leaderboards and feed them numbers (shown in /top).
sh-eventsBoosterServiceRead or start boosters such as "sell x2" (a sell booster applies to /sell).
sh-eventsSeasonServiceRegister what your plugin resets at a season's end.
sh-eventsEventTypesRegister new timed event types.
sh-teamsTeamLookupRead who is in which team.
sh-lifestealLifestealServiceRead hearts and the heart bank, add or take hearts (written to the heart ledger), registerRule to lower or veto heart steals (a rule can never raise one; rules run in the order they were added, a rule that fails is skipped, and they go away when your plugin stops), completeSpiritTrial for your own trial course, and tell real Heart items and Revive Beacons apart.
sh-bossesBossAbilitiesRegister new boss abilities.
sh-boxBoxServiceBox PvP: read levels, prestige and Packs, add ore to a Pack, register pickaxe enchants and named sell or token bonuses (see Box PvP).
sh-apiSnapshotServiceAsk for a backup before something big.
sh-gensGensServiceIncome, slots, prestige, activity levels and XP, plots, and registries for generator tiers, sell multipliers, activities, tool enchants and prestige rewards (Gens).

Events

PartEvents
sh-coreMenuOpenEvent (cancel it, or swap in your own menu)
sh-economySellEvent (add a named multiplier, such as a booster), SoldEvent, ShopPurchaseEvent, AuctionListEvent, AuctionBuyEvent, AuctionSoldEvent, PaidEvent
sh-rewardsVoteReceivedEvent, DailyRewardClaimEvent
sh-cratesKeyGrantEvent (change the amount or cancel), CrateOpenEvent (add a bonus reward; the rolled prize and its shown chance never change), CrateRewardEvent
sh-eventsEventStartEvent (cancel), EventEndEvent, SeasonEndEvent (cancel), SeasonStartEvent, LeaderboardResetEvent
sh-spawnersSpawnerGenerateEvent (change the loot or cancel), SpawnerChangeEvent (cancel a place, stack, break or trust change)
sh-bossesBossEvents.Spawn (cancel), BossEvents.Damage (change the counted damage), BossEvents.Phase, BossEvents.Death (add a reward)
sh-teamsTeamEvents.Create (cancel), TeamEvents.Join (cancel), TeamEvents.Leave, TeamEvents.Disband
sh-boxBoxEvents.BlockMinedEvent (cancel, change tokens), PackSellEvent (add a multiplier, cancel), PackSoldEvent, RankUpEvent (cancel), RankedUpEvent, PrestigeEvent (cancel), PrestigedEvent, EnchantBoughtEvent, DeathDropEvent (change the share, cancel), MineRefillEvent (cancel), MineShuffleEvent
sh-lifestealLifestealEvents.HeartSteal and HeartLoss (lower the hearts or cancel), HeartWithdraw and HeartBank (cancel), Elimination (pick a softer mode only, the same way for every player; the time out cannot change), Revive (cancel), HeartsChanged, HeartStolen, Eliminated, Returned
sh-guardCombatTagEvent, ProtectionEvent, AbuseFlagEvent
sh-zonesZoneEnterEvent (cancel to keep a player out), ZoneLeaveEvent
sh-travelTeleportEvent (cancel, or change where they go), RtpPickEvent
sh-gensGeneratorPlaceEvent, GeneratorDropEvent, GeneratorUpgradeEvent, GenSellEvent, PrestigeEvent, ActivityHarvestEvent (cancel or change), GeneratorPlacedEvent, GeneratorUpgradedEvent, PrestigedEvent, OfflineEarningsGrantedEvent, SeasonEndedEvent

Events that can be cancelled run before the change; the others report what already happened.

Rules every add-on keeps

  • Money and keys only change through the ledger and the key service. There is no way around the audit, the daily key limit or the "earned only" rule for keys.
  • Keys can never come from a purchase, and crate chances are always shown. The give_currency action cannot give crate keys; use give_key, which keeps the daily limit.
  • Sell boosters and other multipliers must be earned in game or be server-wide events, never sold or tied to a paid rank (no pay-to-win). However large they are, /sell still never pays more than the shop charges for the same item.
  • Hearts, revives, protection and shorter bans are never sold or tied to a paid rank, and never come from crates. Add-on heart rules can only make steals smaller.
  • Player data is stored by player ID only; do not store names, internet addresses or chat.