Interface FlickAPI

All Known Implementing Classes:
FlickApiImpl

public interface FlickAPI
Entry point of the Flick Server API.
FlickAPI flick = FlickAPI.get();
if (flick.isFlick(player)) {
    flick.disableModules(player, List.of(FlickModules.FREELOOK, FlickModules.FULLBRIGHT), "Ranked match");
    flick.sendNotification(player, "Match found", "Good luck!");
}
All methods must be called on the server main thread (calls from other threads are re-scheduled onto it). Methods returning boolean return false when the player is not a Flick player (no handshake), so they are safe to call for everyone. Everything a server sets lives only for the player's current connection.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
    Internal: holder of the running instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    addWaypoint(org.bukkit.entity.Player player, FlickWaypoint waypoint)
    Adds or replaces (same id) a waypoint.
    boolean
    clearRichPresence(org.bukkit.entity.Player player)
     
    boolean
    clearWaypoints(org.bukkit.entity.Player player)
     
    boolean
    disableModules(org.bukkit.entity.Player player, Collection<String> moduleIds, String reason)
    Forces the given Flick modules off for this player (adds to the modules already disabled by this API / config).
    boolean
    enableModules(org.bukkit.entity.Player player, Collection<String> moduleIds)
    Re-allows modules previously disabled through the API (config-disabled modules stay disabled).
    static FlickAPI
    get()
    The running API instance (plugin FlickServerAPI must be enabled — add depend: [FlickServerAPI]).
    getClient(org.bukkit.entity.Player player)
     
    All online players using Flick.
    boolean
    isFlick(org.bukkit.entity.Player player)
    True once the player's Flick client completed the handshake.
    boolean
    removeWaypoint(org.bukkit.entity.Player player, String waypointId)
     
    requestMods(org.bukkit.entity.Player player)
    Asks the client for its loaded mod ids.
    boolean
    reset(org.bukkit.entity.Player player)
    Clears everything this server set for the player (waypoints, API-disabled modules, presence).
    boolean
    resetModules(org.bukkit.entity.Player player)
    Clears all API-disabled modules (config-disabled modules stay disabled).
    default boolean
    sendNotification(org.bukkit.entity.Player player, String title, String body)
     
    boolean
    sendNotification(org.bukkit.entity.Player player, String title, String body, NotificationKind kind, Duration duration)
    Glass toast in the top-right corner.
    boolean
    setRichPresence(org.bukkit.entity.Player player, String details, String state)
    Sets the Discord Rich Presence text shown while the player is on this server (details/state ≤ 64 chars each).
  • Method Details

    • get

      static FlickAPI get()
      The running API instance (plugin FlickServerAPI must be enabled — add depend: [FlickServerAPI]).
    • isFlick

      boolean isFlick(org.bukkit.entity.Player player)
      True once the player's Flick client completed the handshake.
    • getClient

      Optional<FlickPlayer> getClient(org.bukkit.entity.Player player)
    • getClients

      Collection<FlickPlayer> getClients()
      All online players using Flick.
    • addWaypoint

      boolean addWaypoint(org.bukkit.entity.Player player, FlickWaypoint waypoint)
      Adds or replaces (same id) a waypoint. Max 200 per player.
    • removeWaypoint

      boolean removeWaypoint(org.bukkit.entity.Player player, String waypointId)
    • clearWaypoints

      boolean clearWaypoints(org.bukkit.entity.Player player)
    • disableModules

      boolean disableModules(org.bukkit.entity.Player player, Collection<String> moduleIds, String reason)
      Forces the given Flick modules off for this player (adds to the modules already disabled by this API / config). The player sees them greyed out ("Disabled by the server") and cannot enable them until they leave. See FlickModules for ids; unknown ids are ignored by the client.
    • enableModules

      boolean enableModules(org.bukkit.entity.Player player, Collection<String> moduleIds)
      Re-allows modules previously disabled through the API (config-disabled modules stay disabled).
    • resetModules

      boolean resetModules(org.bukkit.entity.Player player)
      Clears all API-disabled modules (config-disabled modules stay disabled).
    • sendNotification

      default boolean sendNotification(org.bukkit.entity.Player player, String title, String body)
    • sendNotification

      boolean sendNotification(org.bukkit.entity.Player player, String title, String body, NotificationKind kind, Duration duration)
      Glass toast in the top-right corner. Title ≤ 64, body ≤ 160 characters, duration 1–15 s.
    • setRichPresence

      boolean setRichPresence(org.bukkit.entity.Player player, String details, String state)
      Sets the Discord Rich Presence text shown while the player is on this server (details/state ≤ 64 chars each). Only applied if the player shows the server in their Discord status and allows it.
    • clearRichPresence

      boolean clearRichPresence(org.bukkit.entity.Player player)
    • requestMods

      CompletableFuture<List<String>> requestMods(org.bukkit.entity.Player player)
      Asks the client for its loaded mod ids. Completes on the main thread; fails with TimeoutException after 10 s, or IllegalStateException if the player is not a Flick player / leaves. If the player refused sharing, completes with an empty list. The list is reported by the client and can be spoofed.
    • reset

      boolean reset(org.bukkit.entity.Player player)
      Clears everything this server set for the player (waypoints, API-disabled modules, presence).