.dev

Install2 min read

Paper, Spigot & Folia

One jar for Bukkit-based servers from 1.8.8 to the latest release.

Artifact
TehoAPI.jar
Servers
Spigot, Paper, Folia
Versions
1.8.8 -> latest
Java
8 or newer

One jar covers every Bukkit-based server. It is built against the 1.8.8 Spigot API with a Java 8 target, declares folia-supported: true, and finds dimension ids by reflection on newer servers, so you do not need a per-version build.

Install

  1. Download TehoAPI.jar and put it in plugins/.
  2. Start the server once. The plugin writes plugins/TehoAPI/config.yml.
  3. Set server-name, then run /tehoapi reload.

That is all a standalone server needs. Read Configuration for presets you can turn on without code.

Use it from a plugin

Declare the dependency so TehoAPI loads first:

YAML
name: Skyline
main: gg.skyline.SkylinePlugin
version: 1.0.0
depend: [TehoAPI]

Use softdepend instead if Teho support is optional. In that case check TehoApi.find().isPresent() before calling anything.

Add Teho's repository and compile against teho-api-bukkit:

Kotlin
repositories {
    maven("https://repo.papermc.io/repository/maven-public/")
    maven("https://repo.tehoclient.dev/releases")
}

dependencies {
    compileOnly("io.papermc.paper:paper-api:1.21.11-R0.1-SNAPSHOT")
    compileOnly("dev.tehoclient:teho-api-bukkit:1.0.0")
}

Bukkit helpers

BukkitTeho saves the boilerplate of going from Bukkit types to Teho ones.

MethodWhat it does
BukkitTeho.player(Player)The player's TehoPlayer, or empty if they are not on Teho.
BukkitTeho.isTeho(Player)Shorthand for player(p).isPresent().
BukkitTeho.waypoint(id, Location)A Waypoint.Builder already placed at the block position and dimension of the location.
BukkitTeho.dimensionOf(World)The dimension id the client expects, such as overworld or the_nether.
Java
@EventHandler
public void onDeath(PlayerDeathEvent event) {
    Player player = event.getEntity();
    Location where = player.getLocation();
    BukkitTeho.player(player).ifPresent(teho -> teho.waypoints().set(
            BukkitTeho.waypoint("death", where)
                    .name("Last death")
                    .color(0xFF5555)
                    .focus(true)
                    .build()));
}

Bukkit events

All of them live in dev.tehoclient.api.bukkit.event and extend TehoPlayerEvent, which gives you getPlayer() and getTehoPlayer(). See Events for when each one fires.

TehoPlayerReadyEvent, TehoConsentEvent, TehoStaffToolEvent, TehoClientEvent, TehoKeyEvent, TehoUiEvent, TehoInspectEvent and the cancellable TehoStaffActionEvent.

Folia

The same jar runs on Folia. The plugin schedules its own delayed work on each player's entity scheduler there, so presets such as the welcome toast and death waypoints work unchanged. From your own code, call the API from the thread that owns the player, as you would for any other player call.

Behind a proxy

Without a proxy plugin, each backend handshakes with the player on its own every time they join it. That is the simplest setup and enough for per-server features. To share one session across the network, install the proxy plugin and set proxy.secret on both sides, as described in Networks & proxies.