SpigotMessageAPI
v1.1.0Give your plugin users a better experience with this user-friendly message setup API.
Please report any bugs you found here.
Sounds are different for 1.8/1.10! (Download Sounds 1.8) (Download Sounds 1.10)
- Give server owners the best experience while setting up messages for your plugin.
- 1.8-1.12 Title Support
- 1.8-1.12 Actionbar Support
- Message (One line)
- Message List (Multiple Lines)
- Sound Support
- Use multiple options. (Ex: Title & Actionbar)
- Use only specific options. (Ex: only Title)
- Use your own variables.
- User-friendly
How To: Messages
Players will be able to configure their messages like explained below. You can use multiple options (for example, you are able to send a regular message and an actionbar!) This is the format of these messages, an example usage will be given below.
<config-path>:
Message: '<message>'
MessageList:
- '<message1>'
- '<message2>'
Title:
FadeIn: <fade in time>
Stay: <stay time>
FadeOut: <fade out time>
Title: '<message>'
Subtitle: '<message>'
ActionBar:
Stay: <stay time>
ActionBar: '<message>'
Sound: <sound>The format will change when a specific load type is used. It will replace the "Message", "MessageList", "Title", "ActionBar" and "Sound" with the config path:
<config-path>: '<message>'
<config-path>:
- '<message1>'
- '<message2>'
<config-path>:
FadeIn: <fade in time>
Stay: <stay time>
FadeOut: <fade out time>
Title: '<message>'
Subtitle: '<message>'
<config-path>:
Stay: <stay time>
ActionBar: '<message>'
<config-path>: <sound>Regular Message:
ToReceiver:
Message: '&7[%server-sender%&7] &6%suggest-player% &7> &7[%server-receiver%&7] &6%receiver%&7: &6%msg%'Multiple Messages:
ToReceiver:
MessageList:
- '&7[%server-sender%&7] &6%suggest-player% &7sent you a message:
- '&6%msg%'Title:
ToReceiver:
Title:
FadeIn: 2
Stay: 10
FadeOut: 2
Title: '&7%sender%'
Subtitle: '&6%msg%'ActionBar:
ToReceiver:
ActionBar:
Stay: 10
ActionBar: '&6%sender%&7: &6%msg%'Sound:
ToReceiver:
Sound: <sound>How To: Use SpigotMessagesAPI
There are several things you'll have to do in order to use SpigotMessagesAPI. (Players will also have to install this plugin on their server)
Step 1:
Set " depends: [SpigotMessagesAPI]" in your plugin.yml
Step 2:
Import SpigotMessagesAPI to your project, different for each software you use. This option will most likely be called "library".
Step 3:
Register one of your config files.
SpigotMessageAPI.registerConfigFile(<name>, new ConfigFile(<directory>, <file name>));Here is an example usage:
ConfigFile configFile = new ConfigFile(getDataFolder().getPath(), "config.yml");
SpigotMessageAPI.registerConfigFile("config", configFile);Step 4:
Register messages:
SpigotMessageAPI.registerMessage(<name>, new Message(<config file>, <path>));You can also put a load type in that method, that way it will only load that method:
SpigotMessageAPI.registerMessage(<name>, new Message(<config file>, <path>, LoadType.TITLE));Here is an example usage:
SpigotMessageAPI.registerMessage("msg", new Message(configFile, "Messages.MSG"));Step 5:
Use the plugin. Here are a few methods that you'll be able to use with SpigotMessageAPI.
//Getter for config file
ConfigFile configFile = SpigotMessageAPI.getConfigFile(String name)
//Reload config file (with all messages setup for it)
configFile.reload();
//Getter for message
Message message = SpigotMessageAPI.getMessage(String name)
//Get message parser, to replace variables etc.
MessageParser mP = message.getParser();
//Replace variables
mP.parseVariable(String variable, String replacement)
//Send message
mP.send(CommandSender sender);
//Send message as long as it doesn't contain x, y, z... (Will be done per line if a list, the same for title and subtitle)
mP.send(CommandSender sender, String... cannotContain);If you found any sorts of bugs or do you have any suggestions, please, put them in the comments so I'll be able to make this plugin better!
Similar projects
Plugin →Let Me Despawn
Improves performance by tweaking mob despawn rules. Say bye to pesky unintentional persistent mobs.
25MSueta
JourneyMap
Real-time map used for mapping in-game or your browser as you explore.
14.7MSueta
Emotecraft
Create your own emotes in Minecraft.
7.5MSueta
Simple Tpa
A simple tpa plugin which sends requests
5.4MSueta
Common Network
Forge and Fabric Unified Networking Solution
3.9MSueta
Set Home
A lightweight plugin for players to set their homes.
3.8MSueta
