Skip to main content

API Reference

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​

MethodReturnsDescription
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​

MethodReturnsDescription
isMounted(UUID player)booleanRiding a Mountale mount
getActiveMount(UUID player)Optional<MountInfo>The Mountale mount they are riding
isCasting(UUID player)booleanSummoning a mount right now (cast in progress)
isInCombat(UUID player)booleanIn combat according to Mountale's combat log
getCombatSecondsLeft(UUID player)longSeconds 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.

MethodReturnsDescription
hasUnlocked(UUID player, String mountId)booleanHas 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)MountResultGives them the permission, with no chat message. Works for offline players
lock(UUID player, String mountId)MountResultRemoves 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:

ValueMeaning
OKDone
ALREADYNothing to do: they could already ride it (unlock) or didn't have their own permission (lock)
UNKNOWN_MOUNTNo mount with that id
FAILEDThe permission system didn't accept the change (see the console)

result.isSuccess() is true only for OK.

Actions​

MethodReturnsDescription
dismount(UUID player)booleanTakes them off their Mountale mount, which vanishes. Reason API. false if they weren't riding one
cancelCast(UUID player)booleanInterrupts the summon in progress. Reason API. false if they weren't summoning
tagCombat(UUID player)voidPuts them in combat, as if an entity had hit them. Does nothing if the combat log is off or they're offline

Restrictions & Listeners​

MethodDescription
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.

FieldTypeDescription
id()StringMount id: the name of its file in mounts/
displayName()StringName players see
description()StringDescription
rarityId()StringRarity id from Rarities in config.json
rarityName()StringRarity name in the configured language
rarityColor()StringRarity color, #rrggbb
speedBonus()doubleSpeed added over walking speed, in percent (70 = +70 %)
icon()StringIcon path relative to Common/UI/Custom; empty if none
permission()StringPermission that unlocks it
itemId()StringItem id of its scroll, such as Mountale_Scroll_Bengal_Tiger. The item exists if the mount was loaded when the server started