Do you want a multi-language and multi-gender server and do you want to be more professional ?
Are you tired of making own configurable messages system ?
MessagesAPI is for you!
FEATURES
- YAML or MySQL data storage
- Everything can be customized
- Nations and genders !
- Customized messages for males and females !
- Customized messages for different nations !
- UUID support
- PlayerName support (updating names by UUID)
- Easy and simple API usage
HOW TO INSTALL (FOR SERVER ADMINS)
- Download plugin
- Add it to plugins folder
- Start your server
- Configurate config.yml
- Restart your server
HOW TO INSTALL (FOR DEVs)
- Download jar file
- Add it as library to your project
- Add dependency to plugin.yml
- Use API (see tutorial) and enjoy :)
COMMANDS & PERMISSIONS
/nations - List of supported nations
messagesapi.player.nation
/nation <nation> - Changes your nation
messagesapi.player.gender
/gender <f|m|fe|ma|female|male> - Changes your gender
/msgapi - Default help menu
messagesapi.admin.reload
/msgapi reload - Reloads the plugin
Aliases for /msgapi
====
/lang
/language
PLUGIN CONFIGURATION
config.yml
database :
host : localhost
port : '3307'
database : db
user : username
password : pass123
#Storage type: mysql or yaml
#Recommended: yaml
storage : yamlnations.yml
#List of nations, only YAML storage type
nations :
UNIVERSAL : uni
ENGLISH : en
CZECH : cz
SLOVAK : skmessages.yml
#List of messages, only YAML data storage
messages:
NO_PERMISSION:
en:
BOTH: '&fYou don''t have enough permissions!'
PREFIX:
uni:
BOTH: '&f[&aMessagesAPI&f]&a '
MESSAGESAPI_HELP:
en:
BOTH: "&c&lMessagesAPI - Help Menu \n&b/nation <nation> - Changes a nation\n\
&b/gender <f/m> - Changes a gender"
cz:
BOTH: "&c&lMessagesAPI - Help Menu \n&b/nation <nation> - Upraví tvůj nation\n\
&b/gender <f/m> - Upraví tvůj gender"
MESSAGESAPI_UNKNOWN_GENDER:
en:
BOTH: '&cSorry, but this gender doesn''t exist !'
MESSAGESAPI_UNKNOWN_NATION:
en:
BOTH: '&cSorry, but this nation doesn''t exist !'
MESSAGESAPI_UNKNOWN_MESSAGE:
uni:
BOTH: '&cSorry, but this we don''t have any message to this action !'
MESSAGESAPI_GENDER_FEMALE:
en:
BOTH: FEMALE
MESSAGESAPI_GENDER_MALE:
en:
BOTH: MALE
MESSAGESAPI_NATION_CHANGED:
en:
BOTH: '&aYou have successfully changed your nation to &b%nation%'
MESSAGESAPI_NATIONSLIST_HEADER:
en:
BOTH: '&c&l --- List of supported nations ---'
MESSAGESAPI_NOPERM:
en:
BOTH: '&cYou don''t have enough permissions to do this command !'
MESSAGESAPI_RELOAD:
en:
BOTH: '&aReloaded !'
MESSAGESAPI_GENDER_CHANGED:
en:
MALE: '&aYou have successfully changed your gender to &b%gender%'
FEMALE: '&aYou have successfully changed your gender to &d%gender%'players.yml
#Player list - only YAML
players:
d93d0fb8-3458-3f9b-b1f1-004f6906a992:
name: apik007
nation: CZECH
gender: MALEAPI USAGE
TestApp.java
package testapp ;
import eu.mrapik.messagesapi.MsgAPI ;
import eu.mrapik.messagesapi.model.Gender ;
import eu.mrapik.messagesapi.model.Message ;
import eu.mrapik.messagesapi.model.Nation ;
import eu.mrapik.messagesapi.model.User ;
import org.bukkit.entity.Player ;
import org.bukkit.event.EventHandler ;
import org.bukkit.event.Listener ;
import org.bukkit.event.player.PlayerJoinEvent ;
import org.bukkit.plugin.java.JavaPlugin ;
public class TestApp extends JavaPlugin implements Listener {
private MsgAPI api ;
@Override
public void onEnable ( ) {
//Init
api = new MsgAPI ( ) ;
//To be sure, every used nation should be registered
api. registerNation ( api. createNation ( "CZECH" , "cz" ) ) ;
api. registerNation ( api. createNation ( "SLOVAK" , "sk" ) ) ;
//This just adds the messages to cache-storage, it won't save it to YAML/MySQL
api. addMessage ( api. createMessage ( "TEST" , "&aHey girl, how are you?" , "ENGLISH" , Gender. FEMALE ) ) ;
api. addMessage ( api. createMessage ( "TEST" , "&aHey boy, how are you?" , "ENGLISH" , Gender. MALE ) ) ;
api. addMessage ( api. createMessage ( "TEST" , "&aHey holka, jak je?" , "CZECH" , Gender. FEMALE ) ) ;
api. addMessage ( api. createMessage ( "TEST" , "&aHey kluku, jak je?" , "CZECH" , Gender. MALE ) ) ;
//Example of creating messages using factory method
Message msg = api. createMessage ( "TEST2" , "Hey girl, how are you?" , "ENGLISH" , Gender. FEMALE ) ;
//This will save data to the central storage (YAML or MySQL)
api. registerMessage ( msg ) ;
api. registerMessage ( api. createMessage ( "TEST2" , "(F) Hej, ako?" , "SLOVAK" , Gender. FEMALE ) ) ;
api. registerMessage ( api. createMessage ( "TEST2" , "(M) Hey, ako?" , "SLOVAK" , Gender. MALE ) ) ;
//Want to add universal message for both genders and all nations? Like plugin prefix?
api. registerMessage ( api. createMessage ( "UNIVERSAL" , "MyPrefix" , api. getUniversalNation ( ) , Gender. BOTH ) ) ;
//Or just...
api. registerMessage ( api. createUniversalMessage ( "UNIVERSAL" , "MyPrefix" ) ) ;
this . getServer ( ) . getPluginManager ( ) . registerEvents ( this , this ) ;
}
@Override
public void onDisable ( ) {
}
@EventHandler
public void onPlayerJoin ( PlayerJoinEvent event ) {
Player player = event. getPlayer ( ) ;
//You can use getUser(UUID) or getOnlineUser(Player) - not accessing the database
User user = api. getOnlineUser ( player ) ;
//Getting nation and gender
Nation nation = user. getNation ( ) ;
Gender gender = user. getGender ( ) ;
//Alternative methods without using User
nation = api. getNation ( player. getUniqueId ( ) ) ;
gender = api. getGender ( player. getUniqueId ( ) ) ;
//Getting message, it automatically loads gender and nation
Message msg = api. getMessage ( "TEST" , event. getPlayer ( ) ) ;
//Getting just the final string, similar to msg.getString();
String message = api. getMessageString ( "TEST" , event. getPlayer ( ) ) ;
//Using colorizer method which replaces all & symbols with §
event. setJoinMessage ( api. colorize ( message ) ) ;
}
} TODO LIST
1. Adds Group Prefix feature - change prefixes by group/rank
IF YOU HAVE ANY IDEAS OR YOU NOTICE SOME BUGS, PM ME PLEASE
IF YOU LIKE THIS RESOURCE AND IF YOU LIKE MY JOB, YOU CAN BUY ME A COFFEE :)
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