.dev

Modules1 min read

Notifications

Toasts labelled with your server name, updated in place by id.

notify:1Tier A · Decorate

Good for

  • Queue position that updates in place
  • Match found, round starting, restart warnings
  • Rewards and level-ups without spamming chat

Try it in game, no code

/tehoapi notify * &bRanked_queue Match found!

A notification is a toast in Teho's own notification stack, labelled with your server's name and icon so it can never pass for a message from Teho itself. Re-sending the same id updates the toast in place, which makes it good for progress ("Queue: 3rd in line") as well as one-off messages.

Send one

Java
teho.notify(Notification.builder("queue")
        .title("Ranked queue")
        .body("You are 3rd in line")
        .accent(0x4DA9FF)
        .duration(5000)
        .sound(true)
        .build());

Later, update it with the same id, or take it down early:

Java
teho.notify(Notification.builder("queue").title("Ranked queue").body("Match found!").accent(0x7CDB8A).build());
teho.dismiss("queue");

Builder

MethodDefaultNotes
builder(id)requiredIdentifies the toast. Same id, same toast.
title(String)requiredUp to 64 characters. § colour codes allowed.
body(String)emptyUp to 256 characters.
accent(rgb)Teho blueThe toast's accent stripe.
duration(ms)client defaultClamped to 1–15 seconds.
sound(boolean)falsePlay the notification sound.

What the player sees and controls

  • At most 5 toasts per 10 seconds from your server. Extra ones are dropped.
  • Text is plain text plus colour codes. Formatting that could imitate Teho's own chrome is stripped.
  • Quiet mode in Settings -> Servers turns your notifications off while keeping every other feature.

No code

Turn on the welcome toast in config.yml, or test from the console:

YAML
welcome:
  enabled: true
  title: "&bWelcome, {player}"
  body: "This server supports Teho"
Text
/tehoapi notify * Restart in 5 minutes Save your builds