Class FlickApiImpl

java.lang.Object
net.flick.serverapi.internal.FlickApiImpl
All Implemented Interfaces:
FlickAPI, org.bukkit.event.Listener, org.bukkit.plugin.messaging.PluginMessageListener

public final class FlickApiImpl extends Object implements FlickAPI, org.bukkit.plugin.messaging.PluginMessageListener, org.bukkit.event.Listener
Implementation of FlickAPI: sessions, inbound messages, config policies.
  • Constructor Details

    • FlickApiImpl

      public FlickApiImpl(org.bukkit.plugin.Plugin plugin, Settings settings)
  • Method Details

    • settings

      public Settings settings()
    • inboundDropped

      public int inboundDropped()
      Inbound messages dropped by the rate limit / rejected as malformed (diagnostics).
    • inboundRejected

      public int inboundRejected()
    • updateSettings

      public void updateSettings(Settings s)
      Applies a reloaded config to everyone online (module policy).
    • onPluginMessageReceived

      public void onPluginMessageReceived(String channel, org.bukkit.entity.Player player, byte[] message)
      Specified by:
      onPluginMessageReceived in interface org.bukkit.plugin.messaging.PluginMessageListener
    • onQuit

      public void onQuit(org.bukkit.event.player.PlayerQuitEvent e)
    • onWorldChange

      public void onWorldChange(org.bukkit.event.player.PlayerChangedWorldEvent e)
    • shutdown

      public void shutdown()
      Called on disable: fail pending futures, forget sessions (clients reset on disconnect anyway).
    • isFlick

      public boolean isFlick(org.bukkit.entity.Player player)
      Description copied from interface: FlickAPI
      True once the player's Flick client completed the handshake.
      Specified by:
      isFlick in interface FlickAPI
    • getClient

      public Optional<FlickPlayer> getClient(org.bukkit.entity.Player player)
      Specified by:
      getClient in interface FlickAPI
    • getClients

      public Collection<FlickPlayer> getClients()
      Description copied from interface: FlickAPI
      All online players using Flick.
      Specified by:
      getClients in interface FlickAPI
    • addWaypoint

      public boolean addWaypoint(org.bukkit.entity.Player player, FlickWaypoint waypoint)
      Description copied from interface: FlickAPI
      Adds or replaces (same id) a waypoint. Max 200 per player.
      Specified by:
      addWaypoint in interface FlickAPI
    • removeWaypoint

      public boolean removeWaypoint(org.bukkit.entity.Player player, String waypointId)
      Specified by:
      removeWaypoint in interface FlickAPI
    • clearWaypoints

      public boolean clearWaypoints(org.bukkit.entity.Player player)
      Specified by:
      clearWaypoints in interface FlickAPI
    • disableModules

      public boolean disableModules(org.bukkit.entity.Player player, Collection<String> moduleIds, String reason)
      Description copied from interface: FlickAPI
      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.
      Specified by:
      disableModules in interface FlickAPI
    • enableModules

      public boolean enableModules(org.bukkit.entity.Player player, Collection<String> moduleIds)
      Description copied from interface: FlickAPI
      Re-allows modules previously disabled through the API (config-disabled modules stay disabled).
      Specified by:
      enableModules in interface FlickAPI
    • resetModules

      public boolean resetModules(org.bukkit.entity.Player player)
      Description copied from interface: FlickAPI
      Clears all API-disabled modules (config-disabled modules stay disabled).
      Specified by:
      resetModules in interface FlickAPI
    • sendNotification

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

      public boolean setRichPresence(org.bukkit.entity.Player player, String details, String state)
      Description copied from interface: FlickAPI
      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.
      Specified by:
      setRichPresence in interface FlickAPI
    • clearRichPresence

      public boolean clearRichPresence(org.bukkit.entity.Player player)
      Specified by:
      clearRichPresence in interface FlickAPI
    • requestMods

      public CompletableFuture<List<String>> requestMods(org.bukkit.entity.Player player)
      Description copied from interface: FlickAPI
      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.
      Specified by:
      requestMods in interface FlickAPI
    • reset

      public boolean reset(org.bukkit.entity.Player player)
      Description copied from interface: FlickAPI
      Clears everything this server set for the player (waypoints, API-disabled modules, presence).
      Specified by:
      reset in interface FlickAPI