Class DiscordPlatform

java.lang.Object
net.lucypoulton.squirtgun.discord.DiscordPlatform
All Implemented Interfaces:
net.lucypoulton.squirtgun.platform.Platform
Direct Known Subclasses:
HostedDiscordPlatform, StandaloneDiscordPlatform

public abstract class DiscordPlatform extends Object implements net.lucypoulton.squirtgun.platform.Platform
A Platform implementation for a JDA instance.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    DiscordPlatform​(net.dv8tion.jda.api.JDA jda, String commandPrefix)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    net.lucypoulton.squirtgun.platform.AuthMode
    Authentication mode is not relevant to Discord so always returns offline
    List<net.lucypoulton.squirtgun.platform.audience.SquirtgunPlayer>
     
    abstract @Nullable DiscordUser
    getPlayer​(String name)
    Gets a DiscordUser from a user's Minecraft username.
    abstract @Nullable DiscordUser
    getPlayer​(UUID uuid)
    Gets a DiscordUser from a user's Minecraft UUID.
    net.dv8tion.jda.api.JDA
    jda()
     
    void
    log​(net.kyori.adventure.text.Component component)
     
     
    void
    registerCommand​(net.lucypoulton.squirtgun.command.node.CommandNode<?> node, net.lucypoulton.squirtgun.format.FormatProvider provider)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.lucypoulton.squirtgun.platform.Platform

    getConfigPath, getConsole, getEventManager, getLogger, getTaskScheduler
  • Constructor Details

    • DiscordPlatform

      protected DiscordPlatform(net.dv8tion.jda.api.JDA jda, String commandPrefix)
      Parameters:
      jda - the JDA instance to use to provide bot functionality
      commandPrefix - the prefix to use for commands
  • Method Details

    • jda

      public net.dv8tion.jda.api.JDA jda()
    • name

      public String name()
      Specified by:
      name in interface net.lucypoulton.squirtgun.platform.Platform
    • getAuthMode

      public net.lucypoulton.squirtgun.platform.AuthMode getAuthMode()
      Authentication mode is not relevant to Discord so always returns offline
      Specified by:
      getAuthMode in interface net.lucypoulton.squirtgun.platform.Platform
      Returns:
      AuthMode.OFFLINE
    • getPlayer

      @Nullable public abstract @Nullable DiscordUser getPlayer(UUID uuid)
      Gets a DiscordUser from a user's Minecraft UUID.
      Specified by:
      getPlayer in interface net.lucypoulton.squirtgun.platform.Platform
      Parameters:
      uuid - the UUID of the player to get
      Returns:
      a SquirtgunPlayer if the user is known and has a linked Discord account, otherwise null
    • getPlayer

      @Nullable public abstract @Nullable DiscordUser getPlayer(String name)
      Gets a DiscordUser from a user's Minecraft username.
      Specified by:
      getPlayer in interface net.lucypoulton.squirtgun.platform.Platform
      Parameters:
      name - the name of the player to get
      Returns:
      a SquirtgunPlayer if the user is known has a linked Discord account, otherwise null
    • getOnlinePlayers

      public List<net.lucypoulton.squirtgun.platform.audience.SquirtgunPlayer> getOnlinePlayers()
      Specified by:
      getOnlinePlayers in interface net.lucypoulton.squirtgun.platform.Platform
      Returns:
      an empty list - this method is not applicable to Discord
    • registerCommand

      public void registerCommand(net.lucypoulton.squirtgun.command.node.CommandNode<?> node, net.lucypoulton.squirtgun.format.FormatProvider provider)
      Specified by:
      registerCommand in interface net.lucypoulton.squirtgun.platform.Platform
    • log

      public void log(net.kyori.adventure.text.Component component)
      Specified by:
      log in interface net.lucypoulton.squirtgun.platform.Platform
    • audiences

      public DiscordAudiences audiences()