MoxCore - Basic utilities library
1.2Contains MySQL, SQLite, maths, easy Item creation, action-barAPI, titleAPI and more!
Introduction:
- Do you want to have everything essential like SQL databases in some lines instead of few files and hundreds lines?
- Do you need basic maths like .chanceOf(30)?
- Do you want to create action bars, titles very easy without working with packets?
- Do you want to have tools like calculating distance 2D or 3D and much more?
Then this Library is for you.
We have created this library to create plugins faster without unessesary managing with minecraft server classes. Our Mox plugins will usually use those APIs.
Donation wall:
If you want be on this list, send us donate.
We will promote your server here or whatever you will want!
Donations are giving us motivation to add new things into our plugins because by that we know that someone appreciates our work!
Also we are adding and developing our stuff for free, so dontaions are, for us, very nice gift from you :p !
If you want donate us, please give information in donation in which plugin you want to be added to the donation wall.
- Null :c You can be first!
Features:
SQL Databases :
MySQLDatabase is working with scheduler. It means that update queries will not affect performance and will not dreadlock your machine due to too many Threads created!
Example code :
SQLDatabase database ;
if ( getConfig ( ) . getString ( "database.type" ) . equalsIgnoreCase ( "mysql" ) ) {
String host = getConfig ( ) . getString ( "database.mysql.host" ) ;
String port = getConfig ( ) . getString ( "database.mysql.port" ) ;
String databaseName = getConfig ( ) . getString ( "database.mysql.database" ) ;
String user = getConfig ( ) . getString ( "database.mysql.user" ) ;
String password = getConfig ( ) . getString ( "database.mysql.password" ) ;
database = new MySQLDatabase ( this ) ;
database. createConnection ( host, port, databaseName, user, password ) ;
} else {
String fileLocation = getConfig ( ) . getString ( "database.sqlite.file-location" ) . replace ( "%plugin-folder%" , getDataFolder ( ) . getPath ( ) ) ;
database = new SQLiteDatabase ( this ) ;
database. createConnection ( fileLocation ) ;
}
Example config:
#Types: "mysql" (network), "sqlite" (.db file).
database :
type : "sqlite"
sqlite :
file-location : "%plugin-folder%/database.db"
mysql :
host : "localhost"
port : "3306"
database : "MoxCore"
user : "root"
password : "password"
ActionBar:
Actionbars are called asynchronously so you will not experience any affect on main thread .
Example code:
ActionBar actionBar = new ActionBar ( "&bSome text!" ) ;
actionBar. send ( player ) ; // Can be send to List<Player> or .sendToAll()
Title:
Ending titles are called asynchronously so you will not experience any affect on main thread .
Example code:
// Example method
public void showTitle ( String titleText, String subTitleText, Player player ) {
Title title = new Title ( titleText, subTitleText, 40 ) ; // 40 is in ticks how long title will appear. 20 ticks = 1 second.
title. setFadeIn ( 8 ) ; // Default value is 10
title. setFadeOut ( 12 ) ; // Default value is 10
title. send ( player ) ; // Can be send to List<Player> or .sendToAll()
}
ServerUtils:
This API has utils that are related to server stuff. You can get it using MoxCore.getServerUtils(); or you can call it directly, for example ServerUtils .sendMessage(player, "&2[&aINFO&2] ", "&cHello!");
Example code:
ServerUtils. sendMessage ( player, "&c[&4Prefix&c] " , "&cMessage with prefix!" ) ;
ServerUtils. sendMessage ( player, "&cMessage without prefix!" ) ;
ServerUtils. sendMessage ( Bukkit. getOnlinePlayers ( ) , "&cMessage to list of players!" ) ;
ServerUtils. setTablistHeaderFooter ( player, "&aThis is tab header!" , "&2This is tab footer!" ) ;
MathUtils:
This API contains method that will calculate something for you with return. You can get it using MoxCore.getMathUtils(); or you can call it directly, for example MathUtils.chanceOfProcent(50);
Example code:
if ( MathUtils. chanceOfProcent ( 50 ) {
player. setHealth ( 0 ) ;
} else {
Double distance = MathUtils. calculateDistance3D ( player. getLocation ( ) , dungeonLocation ) ;
player. teleport ( dungeonLocation ) ;
ServerUtils. sendMessage ( player, "&bYou have been teleported &3" + distance + " &bblocks away!" ) ;
}
ItemUtils:
With this API you can create itemstacks and modify them. You can get it using MoxCore.getItemUtils(); or you can call it directly, for example ItemUtils.addGlow(itemStack);
Example code:
ItemStack itemStack = ItemUtils. createItemStack ( Material. STICK , 1 , 0 , "&5Stick with hidden word Love" , "&dDo you believe in true love?" ) ;
itemStack = ItemUtils. setCustomTag ( itemStack, "Word" , "Love" ) ;
itemStack = ItemUtils. addGlow ( itemStack ) ;
Creating custom potion:
ItemStack potion = ItemUtils. createPotionItemStack ( Material. POTION , 1 , PotionEffectType. REGENERATION , 100 , 1 ) ; // Normal regeneration potion II with 5s duration (100 ticks)
potion = ItemUtils. setPotionColor ( potion, Color . fromRGB ( 175 , 0 , 0 ) ) ; // Adding pink color. You can define your own as you want.
potion = ItemUtils. addPotionEffect ( potion, PotionEffectType. HEAL , 0 , 2 ) ; // Adding HEAL III to potion.
// Here it is. We have created normal potion with custom color that heals instantly and gives regeneration for 5s
ConfigUtils:
This API allows you to do nice things with your configuration file, for example - set missing keys automaticly with default values from plugin's source config. You can get it using MoxCore.getConfigUtils(); or you can call it directly, for example Config Utils.loadItemStack(myPlugin.getConfig(), "my.item", myPlugin);
Example code:
ItemStack configItem = ConfigUtils. loadItemStack ( myPlugin. getConfig ( ) , "my.item" , myPlugin ) ;
Example config:
my :
item :
material : "POTION"
data : 0
amount : 2
name : "&b&lMy Potion!"
lore : "&dMy Supa potion!"
potion-data :
effect : "INVISIBILITY"
duration : 400
amplifer : 0
color : "0,0,150"
enchants :
- KNOCKBACK 4Similar 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