Package com.nickuc.chat.api
Interface nChatAPI
public interface nChatAPI
nChat API interface.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceInterface used for internal nChat calls. -
Method Summary
Modifier and TypeMethodDescriptionbooleancreateChannel(Channel channel) Creates a new channelbooleandeleteChannel(Channel channel) Deletes a channel.static nChatAPIgetApi()Returns the nLogin api.intReturns the version of the api.getChannelByCommand(String command) Gets a public channel registered by command.getChannelByName(String name) Gets a public channel registered by name.getChannelByNameAndCommand(String input) Gets a public channel registered by name and command.getGlobalTag(String tag) Returns the content of a global nChat tag.getPrivateChannelByName(String name, boolean isProxy) Gets a private channel registered by name.Lists all registered private channels.Lists all registered public channels.getSession(org.bukkit.entity.Player player) Returns a player's session.Returns the version of the plugin.voidhandlePublicMessage(org.bukkit.entity.Player sender, String message, PublicChannel publicChannel, boolean force, Consumer<PublicMessageEvent> callback) Sends a message on nChat.default voidhandlePublicMessage(org.bukkit.entity.Player sender, String message, PublicChannel publicChannel, Consumer<PublicMessageEvent> callback) Sends a message on nChat.default voidhandleVirtualMessage(String format, PublicChannel publicChannel, boolean highlight, Consumer<VirtualMessageEvent> callback) Sends a virtual message on nChat.default voidhandleVirtualMessage(String format, PublicChannel publicChannel, Consumer<VirtualMessageEvent> callback) Sends a virtual message on nChat.voidhandleVirtualMessage(String sender, String format, PublicChannel publicChannel, boolean highlight, Consumer<VirtualMessageEvent> callback) Sends a virtual message on nChat.default voidhandleVirtualMessage(String sender, String format, PublicChannel publicChannel, Consumer<VirtualMessageEvent> callback) Sends a virtual message on nChat.default booleanhasChannelByCommand(String command) Check if a public channel exists by command.default booleanhasChannelByName(String name) Check if a public channel exists by name.default booleanhasChannelByNameAndCommand(String input) Check if a public channel exists by name or command.default booleanhasPrivateChannelByName(String name, boolean isProxy) Check if a private channel exists by name.internal()Returns the nChat internal api.default booleanisLoaded()Deprecated.booleanreloadChannel(Channel channel) Reloads a canal.voidReloads nChat's public and private channels.voidReloads the nChat config.default booleanremoveGlobalTag(String tag) Deletes a global nChat tag.replacePlaceholders(org.bukkit.entity.Player player, String input) Replaces an input with nChat placeholders.booleansaveChannel(Channel channel) Saves a canal.default booleansetGlobalTag(String tag, GlobalTag globalTag) Defines a global nChat tag.booleansetGlobalTag(String tag, GlobalTag globalTag, boolean override) Defines a global nChat tag.
-
Method Details
-
getApi
Returns the nLogin api.- Throws:
IllegalStateException- if the api has not yet been instantiated
-
isLoaded
Deprecated.It checks if the api is ready to be used.- Since:
- API v1
-
getVersion
Returns the version of the plugin.- Since:
- API v1
-
getApiVersion
int getApiVersion()Returns the version of the api.- Since:
- API v1
-
getSession
Returns a player's session.- Parameters:
player- the owner of the session- Throws:
IllegalStateException- if the player session is not loaded- Since:
- API v2
-
getGlobalTag
Returns the content of a global nChat tag.- Parameters:
tag- the desired tag without {}- Returns:
- the GlobalTag instance (can be null if it doesn't exist)
- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
removeGlobalTag
Deletes a global nChat tag.- Parameters:
tag- the desired tag without {}- Returns:
- true if the tag existed before.
- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
setGlobalTag
Defines a global nChat tag.- Parameters:
tag- the desired tag without {}globalTag- the global tag translator.- Returns:
- true when the tag already exists.
- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
setGlobalTag
Defines a global nChat tag.- Parameters:
tag- the desired tag without {}globalTag- the global tag translatoroverride- if true, it adds the tag even if it already exists- Returns:
- true when the tag already exists
- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
replacePlaceholders
@Nonnull String replacePlaceholders(@Nonnull org.bukkit.entity.Player player, @Nonnull String input) Replaces an input with nChat placeholders.- Parameters:
player- the desired playerinput- the content to be replaced- Returns:
- content with processed placeholders
- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
getPublicChannels
Lists all registered public channels.- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
getPrivateChannels
Lists all registered private channels.- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
getChannelByName
Gets a public channel registered by name.- Parameters:
name- the name of the channel- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
getPrivateChannelByName
Gets a private channel registered by name.- Parameters:
name- the name of the channelisProxy- true if the channel is a proxy- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
getChannelByCommand
Gets a public channel registered by command.- Parameters:
command- command of the channel- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
getChannelByNameAndCommand
Gets a public channel registered by name and command.- Parameters:
input- the name or command of the channel- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
hasChannelByName
Check if a public channel exists by name.- Parameters:
name- the name of the channel- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
hasPrivateChannelByName
Check if a private channel exists by name.- Parameters:
name- the name of the channelisProxy- true if the channel is a proxy- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
hasChannelByCommand
Check if a public channel exists by command.- Parameters:
command- command of the channel- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
hasChannelByNameAndCommand
Check if a public channel exists by name or command.- Parameters:
input- the name or command of the channel- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
handlePublicMessage
default void handlePublicMessage(@Nonnull org.bukkit.entity.Player sender, @Nonnull String message, @Nonnull PublicChannel publicChannel, @Nullable Consumer<PublicMessageEvent> callback) Sends a message on nChat.- Parameters:
sender- the player used to send itmessage- the message to be sentpublicChannel- the channel to be usedcallback- the callback of the handled event- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
handlePublicMessage
void handlePublicMessage(@Nonnull org.bukkit.entity.Player sender, @Nonnull String message, @Nonnull PublicChannel publicChannel, boolean force, @Nullable Consumer<PublicMessageEvent> callback) Sends a message on nChat.- Parameters:
sender- the player used to send itmessage- the message to be sentpublicChannel- the channel to be usedforce- if true, forces the message to be sent (ignores permissions, cost and delay).callback- the callback of the handled event- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
handleVirtualMessage
default void handleVirtualMessage(@Nonnull String format, @Nonnull PublicChannel publicChannel, @Nullable Consumer<VirtualMessageEvent> callback) Sends a virtual message on nChat.- Parameters:
format- format of the message sentpublicChannel- the channel to be usedcallback- the callback of the handled event- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
handleVirtualMessage
default void handleVirtualMessage(@Nonnull String format, @Nonnull PublicChannel publicChannel, boolean highlight, @Nullable Consumer<VirtualMessageEvent> callback) Sends a virtual message on nChat.- Parameters:
format- format of the message sentpublicChannel- the channel to be usedhighlight- if true, highlights the messagecallback- the callback of the handled event- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
handleVirtualMessage
default void handleVirtualMessage(@Nullable String sender, @Nonnull String format, @Nonnull PublicChannel publicChannel, @Nullable Consumer<VirtualMessageEvent> callback) Sends a virtual message on nChat.- Parameters:
sender- the player that will send the message (optional)format- format of the message to be sentpublicChannel- the channel to be usedcallback- the callback of the handled event- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
handleVirtualMessage
void handleVirtualMessage(@Nullable String sender, @Nonnull String format, @Nonnull PublicChannel publicChannel, boolean highlight, @Nullable Consumer<VirtualMessageEvent> callback) Sends a virtual message on nChat.- Parameters:
sender- the player that will send the message (optional)format- format of the message to be sentpublicChannel- the channel to be usedhighlight- if true, highlights the messagecallback- the callback of the handled event- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
reloadConfig
void reloadConfig()Reloads the nChat config.- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
reloadChannels
void reloadChannels()Reloads nChat's public and private channels.- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
createChannel
Creates a new channel- Parameters:
channel- the channel to be created- Returns:
- true if the channel was created
- Throws:
IllegalStateException- if the API is not yet fully loaded- Since:
- API v1
-
reloadChannel
Reloads a canal.- Parameters:
channel- the channel to be reloaded- Returns:
- true if the channel exists
- Since:
- API v1
-
saveChannel
Saves a canal.- Parameters:
channel- the channel to be saved- Returns:
- true if the channel already exists or was successfully created
- Since:
- API v1
-
deleteChannel
Deletes a channel.- Parameters:
channel- the channel to be deleted- Returns:
- true if the channel existed
- Since:
- API v1
-
internal
nChatAPI.nChatInternal internal()Returns the nChat internal api.
-