Every method of com.mountale.api.MountaleAPI. Mount ids are not case-sensitive. MountaleAPI.API_VERSION is 1; it goes up when methods are added.
Mounts
| Method | Returns | Description |
|---|
getMounts() | Collection<MountInfo> | Every loaded mount, in the order of mounts/ |
getMount(String mountId) | Optional<MountInfo> | One mount by id |
getMountByItem(String itemId) | Optional<MountInfo> | The mount a scroll teaches, from its item id |
Player State
| Method | Returns | Description |
|---|
isMounted(UUID player) | boolean | Riding a Mountale mount |
getActiveMount(UUID player) | Optional<MountInfo> | The Mountale mount they are riding |
isCasting(UUID player) | boolean | Summoning a mount right now (cast in progress) |
isInCombat(UUID player) | boolean | In combat according to Mountale's combat log |
getCombatSecondsLeft(UUID player) | long | Seconds of combat left, 0 if not in combat |
Unlocks
Unlocking a mount means giving the player its permission (Permission in the mount file, mountale.mount.<id> by default). It works the same way as a mount scroll.
| Method | Returns | Description |
|---|
hasUnlocked(UUID player, String mountId) | boolean | Has the mount's permission: their own, from a group or from a wildcard |
getUnlockedMounts(UUID player) | List<MountInfo> | Every mount they can ride |
unlock(UUID player, String mountId) | MountResult | Gives them the permission, with no chat message. Works for offline players |
lock(UUID player, String mountId) | MountResult | Removes their own permission. If they also get it from a group or a wildcard, they keep the mount |
getFavorites(UUID player) | List<String> | Ids of their favorite mounts, in order. Meant for online players |
MountResult values:
| Value | Meaning |
|---|
OK | Done |
ALREADY | Nothing to do: they could already ride it (unlock) or didn't have their own permission (lock) |
UNKNOWN_MOUNT | No mount with that id |
FAILED | The permission system didn't accept the change (see the console) |
result.isSuccess() is true only for OK.
Actions
| Method | Returns | Description |
|---|
dismount(UUID player) | boolean | Takes them off their Mountale mount, which vanishes. Reason API. false if they weren't riding one |
cancelCast(UUID player) | boolean | Interrupts the summon in progress. Reason API. false if they weren't summoning |
tagCombat(UUID player) | void | Puts them in combat, as if an entity had hit them. Does nothing if the combat log is off or they're offline |
Restrictions & Listeners
| Method | Description |
|---|
registerSummonRestriction(SummonRestriction) | Adds a rule that can forbid summoning |
unregisterSummonRestriction(SummonRestriction) | Removes it |
registerListener(MountaleListener) | Adds an event listener |
unregisterListener(MountaleListener) | Removes it |
See Restrictions & Events.
MountInfo
A read-only snapshot of a mount. It doesn't change if the configuration is reloaded later.
| Field | Type | Description |
|---|
id() | String | Mount id: the name of its file in mounts/ |
displayName() | String | Name players see |
description() | String | Description |
rarityId() | String | Rarity id from Rarities in config.json |
rarityName() | String | Rarity name in the configured language |
rarityColor() | String | Rarity color, #rrggbb |
speedBonus() | double | Speed added over walking speed, in percent (70 = +70 %) |
icon() | String | Icon path relative to Common/UI/Custom; empty if none |
permission() | String | Permission that unlocks it |
itemId() | String | Item id of its scroll, such as Mountale_Scroll_Bengal_Tiger. The item exists if the mount was loaded when the server started |