Class ServerInfoContextProvider
java.lang.Object
dev.rollczi.litecommands.bungee.context.ServerInfoContextProvider
- All Implemented Interfaces:
dev.rollczi.litecommands.context.ContextChainedProvider<net.md_5.bungee.api.CommandSender,net.md_5.bungee.api.config.ServerInfo>
public class ServerInfoContextProvider
extends Object
implements dev.rollczi.litecommands.context.ContextChainedProvider<net.md_5.bungee.api.CommandSender,net.md_5.bungee.api.config.ServerInfo>
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
For example:
LiteCommandsBuilder.message(MessageKey, Object).
For example:
or with the lambda function:builder.message(LiteBungeeMessages.NOT_CONNECTED_TO_ANY_SERVER, "Not connected to any server!");
builder.message(LiteBungeeMessages.NOT_CONNECTED_TO_ANY_SERVER, (invocation, player) -> "Hello, " + player.getName() + "! You are not connected to any server!");
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondev.rollczi.litecommands.context.ContextResult<net.md_5.bungee.api.config.ServerInfo> provide(dev.rollczi.litecommands.invocation.Invocation<net.md_5.bungee.api.CommandSender> invocation, dev.rollczi.litecommands.context.ContextChainAccessor<net.md_5.bungee.api.CommandSender> accessor)
-
Constructor Details
-
ServerInfoContextProvider
public ServerInfoContextProvider()
-
-
Method Details
-
provide
public dev.rollczi.litecommands.context.ContextResult<net.md_5.bungee.api.config.ServerInfo> provide(dev.rollczi.litecommands.invocation.Invocation<net.md_5.bungee.api.CommandSender> invocation, dev.rollczi.litecommands.context.ContextChainAccessor<net.md_5.bungee.api.CommandSender> accessor) - Specified by:
providein interfacedev.rollczi.litecommands.context.ContextChainedProvider<net.md_5.bungee.api.CommandSender,net.md_5.bungee.api.config.ServerInfo>
-