Class ServerContextProvider

java.lang.Object
dev.rollczi.litecommands.bungee.context.ServerContextProvider
All Implemented Interfaces:
dev.rollczi.litecommands.context.ContextChainedProvider<net.md_5.bungee.api.CommandSender,net.md_5.bungee.api.connection.Server>, dev.rollczi.litecommands.context.ContextProvider<net.md_5.bungee.api.CommandSender,net.md_5.bungee.api.connection.Server>

public class ServerContextProvider extends Object implements dev.rollczi.litecommands.context.ContextProvider<net.md_5.bungee.api.CommandSender,net.md_5.bungee.api.connection.Server>
Built-in context provider that provides a server instance if the sender is a player and is connected to a server. Otherwise, it returns an error message. You can modify the message using LiteCommandsBuilder.message(MessageKey, Object).
For example:
 builder.message(LiteBungeeMessages.NOT_CONNECTED_TO_ANY_SERVER, "Not connected to any server!");
 
or with the lambda function:
 builder.message(LiteBungeeMessages.NOT_CONNECTED_TO_ANY_SERVER, (invocation, player) -> "Hello, " + player.getName() + "! You are not connected to any server!");
 
  • Constructor Summary

    Constructors
    Constructor
    Description
    ServerContextProvider(dev.rollczi.litecommands.message.MessageRegistry<net.md_5.bungee.api.CommandSender> messageRegistry)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    dev.rollczi.litecommands.context.ContextResult<net.md_5.bungee.api.connection.Server>
    provide(dev.rollczi.litecommands.invocation.Invocation<net.md_5.bungee.api.CommandSender> invocation)
     

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface dev.rollczi.litecommands.context.ContextProvider

    provide
  • Constructor Details

    • ServerContextProvider

      public ServerContextProvider(dev.rollczi.litecommands.message.MessageRegistry<net.md_5.bungee.api.CommandSender> messageRegistry)
  • Method Details

    • provide

      public dev.rollczi.litecommands.context.ContextResult<net.md_5.bungee.api.connection.Server> provide(dev.rollczi.litecommands.invocation.Invocation<net.md_5.bungee.api.CommandSender> invocation)
      Specified by:
      provide in interface dev.rollczi.litecommands.context.ContextProvider<net.md_5.bungee.api.CommandSender,net.md_5.bungee.api.connection.Server>