.dev

Start here2 min read

Quickstart

From an empty plugin to a toast on a Teho player's screen in five minutes.

This page takes a Paper server from nothing to a toast, a waypoint and a HUD timer on a Teho player's screen. If you run a network, do this on one backend first, then read Networks & proxies.

Install the plugin

Download TehoAPI.jar, put it in your server's plugins/ folder and start the server once. It writes plugins/TehoAPI/config.yml with every feature switched on.

Give the server a name players will see on everything it sends:

YAML
server-name: "Skyline"
welcome:
  enabled: true
  title: "&bWelcome, {player}"
  body: "This server supports Teho"
death-waypoint: true

Run /tehoapi reload. Join with Teho and you will get the welcome toast. Die, and a waypoint marks the spot.

Check that the client is detected

Run /tehoapi list (permission tehoapi.admin). Each Teho player is listed with their client version, Minecraft version and the capabilities they negotiated. If you are missing, see troubleshooting below.

Depend on the API from your plugin

Teho hosts its own Maven repository at repo.tehoclient.dev. Add it, then depend on the artifact for your platform as compileOnly, since TehoAPI is already installed on the server:

Kotlin
repositories {
    maven("https://repo.tehoclient.dev/releases")
}

dependencies {
    compileOnly("dev.tehoclient:teho-api-bukkit:1.0.0")
}

teho-api-bukkit brings in teho-api and the protocol with it. On other platforms swap the suffix: -velocity, -bungee, -sponge, -fabric, -neoforge or -minestom.

Then make sure TehoAPI loads before you:

YAML
depend: [TehoAPI]

Send something when the player is ready

TehoPlayerReadyEvent fires once the handshake is done, which is the earliest moment a send can succeed.

Java
public final class SkylinePlugin extends JavaPlugin implements Listener {
    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(this, this);
    }

    @EventHandler
    public void onReady(TehoPlayerReadyEvent event) {
        Player player = event.getPlayer();
        TehoPlayer teho = event.getTehoPlayer();

        teho.notify(Notification.builder("welcome")
                .title("Welcome, " + player.getName())
                .body("Ranked queue is open")
                .accent(0x4DA9FF)
                .duration(6000)
                .build());

        teho.waypoints().set(BukkitTeho.waypoint("spawn", player.getWorld().getSpawnLocation())
                .name("Spawn")
                .color(0x7CDB8A)
                .focus(true)
                .build());

        teho.hud().timer(Timer.stopwatch("session", "Session", 0).color(0xFFC24D));
    }
}

Reach players from anywhere else

Outside the ready event, look the player up. The Optional is empty for players who are not on Teho, or who turned the API off for your server.

Java
BukkitTeho.player(player).ifPresent(teho -> teho.hud().cooldown(
        Cooldown.builder("ender_pearl", 15_000)
                .label("Ender Pearl")
                .item("ender_pearl")
                .build()));

Troubleshooting

  • Nobody shows in /tehoapi list. The client only speaks the API after it reaches the play state. Make sure nothing on the server blocks custom payloads, and that the player has not set your server to Off in Settings -> Servers.
  • Sends return false. The player did not negotiate that capability. teho.supports("hud:1") tells you up front. Also check that the feature is not switched off under features: in config.yml.
  • It works on the backend but not through the proxy. Either install nothing on the proxy, or install the proxy plugin and set the same proxy.secret on both sides. See Networks & proxies.