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:
- 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.
- Typed actions: one thing a reward does, such as giving an item or a crate key.
- 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 examplesh-events) to yourplugin.yml. Add-on jars go through the same checks as any plugin you upload. Plugin names starting withsh-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.
| Action | Settings | What it does |
|---|---|---|
message | text | Sends the player a message (colours and styles only) |
broadcast | text | Tells everyone online; {player} is filled in |
title | title, subtitle | A big title on the player's screen |
give_item | item like diamond x3, name | Gives 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 |
sound | sound, volume, pitch | Plays a sound |
effect | effect, seconds, level | A potion effect, up to 10 minutes, level 1 to 5 |
command | command | Runs a console command, only if it starts with one of the commands you allowed on the settings page |
give_currency | currency, amount | Gives money or another currency (needs the economy); at most 100,000 per action |
potion | effect, seconds, level | A potion effect (from the shared base plugin) |
give_key | key, amount | Gives crate keys (the daily key limit applies) |
give_spawner | type_id, amount | Gives spawner items |
start_event | event | Starts one of your events now |
spawn_boss | boss, pad | Calls a boss |
give_generator | tier (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.
| Part | Service | What it offers |
|---|---|---|
| sh-core | ShCore.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-economy | EconomyService | Balances and transfers, the price table, registerPrice and registerItemKeyResolver to make your custom items sellable. |
| sh-rewards | RewardsService | Record votes. |
| sh-display | DisplayService | registerBoard for your own leaderboard, place holograms. |
| sh-guard | GuardService | Is a player in combat or protected, end protection, raise a flag for staff. |
| sh-zones | ZoneService | Regions at a location, flag values, flags().register(...) for your own flag, create and change regions. |
| sh-travel | TravelService | Spawn, warps, and send(player, place, reason, warmup) for teleports with our warm-up rules. |
| sh-api | ActionRegistry | Register your own action types; run actions. Types you add here can be used in every file, the base plugin's too. |
| sh-api | CurrencyService | Money and other currencies, through the server's money ledger. |
| sh-crates | KeyService | Give crate keys (earned only; the daily limit applies). |
| sh-events | LeaderboardService | Add your own event leaderboards and feed them numbers (shown in /top). |
| sh-events | BoosterService | Read or start boosters such as "sell x2" (a sell booster applies to /sell). |
| sh-events | SeasonService | Register what your plugin resets at a season's end. |
| sh-events | EventTypes | Register new timed event types. |
| sh-teams | TeamLookup | Read who is in which team. |
| sh-lifesteal | LifestealService | Read 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-bosses | BossAbilities | Register new boss abilities. |
| sh-box | BoxService | Box PvP: read levels, prestige and Packs, add ore to a Pack, register pickaxe enchants and named sell or token bonuses (see Box PvP). |
| sh-api | SnapshotService | Ask for a backup before something big. |
| sh-gens | GensService | Income, slots, prestige, activity levels and XP, plots, and registries for generator tiers, sell multipliers, activities, tool enchants and prestige rewards (Gens). |
Events
| Part | Events |
|---|---|
| sh-core | MenuOpenEvent (cancel it, or swap in your own menu) |
| sh-economy | SellEvent (add a named multiplier, such as a booster), SoldEvent, ShopPurchaseEvent, AuctionListEvent, AuctionBuyEvent, AuctionSoldEvent, PaidEvent |
| sh-rewards | VoteReceivedEvent, DailyRewardClaimEvent |
| sh-crates | KeyGrantEvent (change the amount or cancel), CrateOpenEvent (add a bonus reward; the rolled prize and its shown chance never change), CrateRewardEvent |
| sh-events | EventStartEvent (cancel), EventEndEvent, SeasonEndEvent (cancel), SeasonStartEvent, LeaderboardResetEvent |
| sh-spawners | SpawnerGenerateEvent (change the loot or cancel), SpawnerChangeEvent (cancel a place, stack, break or trust change) |
| sh-bosses | BossEvents.Spawn (cancel), BossEvents.Damage (change the counted damage), BossEvents.Phase, BossEvents.Death (add a reward) |
| sh-teams | TeamEvents.Create (cancel), TeamEvents.Join (cancel), TeamEvents.Leave, TeamEvents.Disband |
| sh-box | BoxEvents.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-lifesteal | LifestealEvents.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-guard | CombatTagEvent, ProtectionEvent, AbuseFlagEvent |
| sh-zones | ZoneEnterEvent (cancel to keep a player out), ZoneLeaveEvent |
| sh-travel | TeleportEvent (cancel, or change where they go), RtpPickEvent |
| sh-gens | GeneratorPlaceEvent, 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_currencyaction cannot give crate keys; usegive_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,
/sellstill 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.