A core API that adds many features to make developing gui-based plugins easier. ZetaCore also acts as a management plugin for all plugins using it (That also extend the ZetaPlugin class.) It includes features for easily managing config files as well as easily add your config options to a database. There are also many utilities and helper classes to create gui menus and develop intricate commands for your plugin.
Config, config, and more config!
All about data and storing it.
Basic data storer
This uses a yml file to store data and has no database relation.
Adding SQL Support
Now you will have your data stored in an SQL database and a local file. This ensures that if the database is ever down you still have the correct data.
We'll build off of the previous example. (Although that isn't a very practical example it still works to get the gist)
Initializing these data storers and Initializing a ZetaPlugin
This has to be done in your main class (And that class has to extend ZetaPlugin)
This example assumes you implemented you data handler with SQL.
This example also shows how you would set up a ZetaPlugin in the first place. The getIcon method is used to get the item displayed when in the menu for managing various plugins.
Menus
ZetaCore has features to allow you to easily create gui menus
Simple Menu
This is a simple example of how to create a GUI using ZetaCore. This example uses ZetaCore's AbstractGUIMenu class to implement a simple GUI as well as that class's methods to easily create items and add them to the GUI. This will create a menu where the player can click on items to get them. The menu will have 54 slots and will be titled "Test Menu" with a gold coloring. There is also a secret feature where if you click a specific slot, you will get a secret diamond.
Config, config, and more config!
All about data and storing it.
Basic data storer
This uses a yml file to store data and has no database relation.
Code (Java):
public
class MyDataHandler
extends DataStorer
{
private boolean someOption ;
private String nameOfSomething ;
public MyDataHandler (ZetaPlugin plugin ) {
super (plugin, "file_name" ) ;
}
@Override
public void write ( ) {
this. config. set ( "someOption", someOption ) ;
this. config. set ( "name", nameOfSomething ) ;
this. save ( ) ; // Important, actually writes to file.
}
@Override
public void read ( ) {
this. someOption = this. config. getBoolean ( "someOption" ) ;
this. nameOfSomething = this. config. getString ( "name" ) ;
}
@Override
public void setDefualts ( ) {
if ( ! this. config. contains ( "someOption" ) {
this. config. set ( "someOption", someOption ) ;
}
if ( ! this. config. contains ( "name" ) {
this. config. set ( "name", nameOfSomething ) ;
}
// After defaults are set the read method is called.
}
}
private boolean someOption ;
private String nameOfSomething ;
public MyDataHandler (ZetaPlugin plugin ) {
super (plugin, "file_name" ) ;
}
@Override
public void write ( ) {
this. config. set ( "someOption", someOption ) ;
this. config. set ( "name", nameOfSomething ) ;
this. save ( ) ; // Important, actually writes to file.
}
@Override
public void read ( ) {
this. someOption = this. config. getBoolean ( "someOption" ) ;
this. nameOfSomething = this. config. getString ( "name" ) ;
}
@Override
public void setDefualts ( ) {
if ( ! this. config. contains ( "someOption" ) {
this. config. set ( "someOption", someOption ) ;
}
if ( ! this. config. contains ( "name" ) {
this. config. set ( "name", nameOfSomething ) ;
}
// After defaults are set the read method is called.
}
}
Now you will have your data stored in an SQL database and a local file. This ensures that if the database is ever down you still have the correct data.
We'll build off of the previous example. (Although that isn't a very practical example it still works to get the gist)
Code (Java):
public
class MyDataHandler
extends AbstractUntypedSQLDataStorer
<Integer
>
/* The generic specifies the type of the primary key */
{
// UntypedSQLDataStorer indicates there is no associated object.
public MyDataHandler (ZetaPlugin plugin ) {
super (plugin, "file_name", "table_name" ) ;
}
// You have a few new methods to implement.
@Override
public List <SQLColumn <?>> getColumns (SQLHandler handler ) {
// In most cases you will likely not have to use the SQLHandler
List <SQLColumn <?>> columns = new ArrayList <> ( ) ;
columns. add ( new SQLInteger ( "ID", table, /* Reference to this table */ 1, ColumnSettings. PRIMARY_KEY /* Specifies this column as the primary key. Other options available using ColumnSettings.Builder */ ) ;
columns. add ( new SQLVarChar ( "NAME", table, 16 ) ;
columns. add ( new SQLBool ( "SOME_BOOLEAN", table ) ;
return columns ;
}
@Override
public void readDB ( ) {
RowList rows = this. table. getRows ( ) ;
this. someOption = rows. getFirstValue ( "ID", 0, "SOME_BOOLEAN" ). getBoolean ( ) ; // Gets the first row and then gets the boolean under the key of `SOME_BOOLEAN`
this. nameOfSomething = rows. getFirstValue ( "ID", 0, "NAME" ). getString ( ) ; // Gets the first row and then gets the string under the key of `NAME`
}
@Override
public void writeDB ( ) {
this. table. writeValue ( 0, /* Id */ nameOfSomething, this. someOption ) ;
/*
* Using this method you must input your objects in the order that you specified in your getColumns method
* Also when writing to the database (outside of this method) you will need to either call table.commit() or writeToDB()
* Because for performance I use batches of SQL statements rather than sending them individually
*/
}
@Override
public String getPrimaryKey ( ) {
return "ID" ;
}
}
// UntypedSQLDataStorer indicates there is no associated object.
public MyDataHandler (ZetaPlugin plugin ) {
super (plugin, "file_name", "table_name" ) ;
}
// You have a few new methods to implement.
@Override
public List <SQLColumn <?>> getColumns (SQLHandler handler ) {
// In most cases you will likely not have to use the SQLHandler
List <SQLColumn <?>> columns = new ArrayList <> ( ) ;
columns. add ( new SQLInteger ( "ID", table, /* Reference to this table */ 1, ColumnSettings. PRIMARY_KEY /* Specifies this column as the primary key. Other options available using ColumnSettings.Builder */ ) ;
columns. add ( new SQLVarChar ( "NAME", table, 16 ) ;
columns. add ( new SQLBool ( "SOME_BOOLEAN", table ) ;
return columns ;
}
@Override
public void readDB ( ) {
RowList rows = this. table. getRows ( ) ;
this. someOption = rows. getFirstValue ( "ID", 0, "SOME_BOOLEAN" ). getBoolean ( ) ; // Gets the first row and then gets the boolean under the key of `SOME_BOOLEAN`
this. nameOfSomething = rows. getFirstValue ( "ID", 0, "NAME" ). getString ( ) ; // Gets the first row and then gets the string under the key of `NAME`
}
@Override
public void writeDB ( ) {
this. table. writeValue ( 0, /* Id */ nameOfSomething, this. someOption ) ;
/*
* Using this method you must input your objects in the order that you specified in your getColumns method
* Also when writing to the database (outside of this method) you will need to either call table.commit() or writeToDB()
* Because for performance I use batches of SQL statements rather than sending them individually
*/
}
@Override
public String getPrimaryKey ( ) {
return "ID" ;
}
}
This has to be done in your main class (And that class has to extend ZetaPlugin)
This example assumes you implemented you data handler with SQL.
Code (Java):
public
class MyPlugin
extends ZetaPlugin
{
// Already extends JavaPlugin, so all is well
private MyDataHandler dataHandler ;
private boolean dataRead ;
@Override
public void onEnable ( ) {
// Register any events that DON'T require your data.
super. onEnable ( ) ;
}
@Override
public String getPluginName ( ) {
return "MyPlugin" ;
}
@Override
protected void registerDataStorers ( ) {
dataHandler = new MyDataHandler ( this ) ;
dataHandler. setup ( ) ;
}
// Data is read asynchronously so this method is run after data has been read
@Override
public void onDataReadFinish ( ) {
this. dataRead = true ;
// Register any events that require your data
}
@Override
public boolean initializedFinished ( ) {
return dataRead ;
}
@Override
public ItemStack getIcon ( ) {
return new ItemStack (Material. COMMAND_BLOCK ) ;
}
}
private MyDataHandler dataHandler ;
private boolean dataRead ;
@Override
public void onEnable ( ) {
// Register any events that DON'T require your data.
super. onEnable ( ) ;
}
@Override
public String getPluginName ( ) {
return "MyPlugin" ;
}
@Override
protected void registerDataStorers ( ) {
dataHandler = new MyDataHandler ( this ) ;
dataHandler. setup ( ) ;
}
// Data is read asynchronously so this method is run after data has been read
@Override
public void onDataReadFinish ( ) {
this. dataRead = true ;
// Register any events that require your data
}
@Override
public boolean initializedFinished ( ) {
return dataRead ;
}
@Override
public ItemStack getIcon ( ) {
return new ItemStack (Material. COMMAND_BLOCK ) ;
}
}
Menus
ZetaCore has features to allow you to easily create gui menus
Simple Menu
This is a simple example of how to create a GUI using ZetaCore. This example uses ZetaCore's AbstractGUIMenu class to implement a simple GUI as well as that class's methods to easily create items and add them to the GUI. This will create a menu where the player can click on items to get them. The menu will have 54 slots and will be titled "Test Menu" with a gold coloring. There is also a secret feature where if you click a specific slot, you will get a secret diamond.
Code (Java):
public
class SimpleMenu
extends AbstractGUIMenu
{
public SimpleMenu (PlayerUtil menuUtil ) {
super (menuUtil, "&6Test Menu", 54 ) ; // Supports formatting codes
}
@Override
public void setItems ( ) {
// Set items here
this. inv. setItem ( 0, makeItem (Material. DIAMOND, "&bDiamond" ) ) ;
this. inv. setItem ( 1, makeItem (Material. GOLD_INGOT, "&6Gold" ) ) ;
this. inv. setItem ( 2, makeItem (Material. IRON_INGOT, "&fIron" ) ) ;
this. inv. setItem ( 3, makeItem (Material. COAL, "&8Coal" ) ) ;
this. inv. setItem ( 4, makeItem (Material. REDSTONE, "&cRedstone" ) ) ;
this. inv. setItem ( 5, makeItem (Material. BARRIER, "&cBarrier", "&7Click me to get a barrier" ) ) ; // Supports lore and formatting codes
}
@Override
public void handleClick (InventoryClickEvent e ) {
// Handle clicks here
// If the player clicks on an item, this method will be called
switch (e. getSlot ( ) ) {
case 0 :
this. owner. getInventory ( ). addItem (makeItem (Material. DIAMOND, "&bDiamond" ) ) ;
break ;
case 1 :
this. owner. getInventory ( ). addItem (makeItem (Material. GOLD_INGOT, "&6Gold" ) ) ;
break ;
case 2 :
this. owner. getInventory ( ). addItem (makeItem (Material. IRON_INGOT, "&fIron" ) ) ;
break ;
case 3 :
this. owner. getInventory ( ). addItem (makeItem (Material. COAL, "&8Coal" ) ) ;
break ;
case 4 :
this. owner. getInventory ( ). addItem (makeItem (Material. REDSTONE, "&cRedstone" ) ) ;
break ;
case 5 :
this. owner. getInventory ( ). addItem (makeItem (Material. BARRIER, "&cBarrier" ) ) ;
break ;
}
}
@Override
public void handleClickAnywhere (InventoryClickEvent e ) {
// However, if you want to handle clicks anywhere in the inventory, use this method
super. handleClickAnywhere (e ) ;
if (e. getSlot ( ) == 12 ) {
this. owner. getInventory ( ). addItem (makeItem (Material. DIAMOND, "&4Secret Diamond" ) ) ;
}
}
}
public SimpleMenu (PlayerUtil menuUtil ) {
super (menuUtil, "&6Test Menu", 54 ) ; // Supports formatting codes
}
@Override
public void setItems ( ) {
// Set items here
this. inv. setItem ( 0, makeItem (Material. DIAMOND, "&bDiamond" ) ) ;
this. inv. setItem ( 1, makeItem (Material. GOLD_INGOT, "&6Gold" ) ) ;
this. inv. setItem ( 2, makeItem (Material. IRON_INGOT, "&fIron" ) ) ;
this. inv. setItem ( 3, makeItem (Material. COAL, "&8Coal" ) ) ;
this. inv. setItem ( 4, makeItem (Material. REDSTONE, "&cRedstone" ) ) ;
this. inv. setItem ( 5, makeItem (Material. BARRIER, "&cBarrier", "&7Click me to get a barrier" ) ) ; // Supports lore and formatting codes
}
@Override
public void handleClick (InventoryClickEvent e ) {
// Handle clicks here
// If the player clicks on an item, this method will be called
switch (e. getSlot ( ) ) {
case 0 :
this. owner. getInventory ( ). addItem (makeItem (Material. DIAMOND, "&bDiamond" ) ) ;
break ;
case 1 :
this. owner. getInventory ( ). addItem (makeItem (Material. GOLD_INGOT, "&6Gold" ) ) ;
break ;
case 2 :
this. owner. getInventory ( ). addItem (makeItem (Material. IRON_INGOT, "&fIron" ) ) ;
break ;
case 3 :
this. owner. getInventory ( ). addItem (makeItem (Material. COAL, "&8Coal" ) ) ;
break ;
case 4 :
this. owner. getInventory ( ). addItem (makeItem (Material. REDSTONE, "&cRedstone" ) ) ;
break ;
case 5 :
this. owner. getInventory ( ). addItem (makeItem (Material. BARRIER, "&cBarrier" ) ) ;
break ;
}
}
@Override
public void handleClickAnywhere (InventoryClickEvent e ) {
// However, if you want to handle clicks anywhere in the inventory, use this method
super. handleClickAnywhere (e ) ;
if (e. getSlot ( ) == 12 ) {
this. owner. getInventory ( ). addItem (makeItem (Material. DIAMOND, "&4Secret Diamond" ) ) ;
}
}
}
Quick facts
- Edition: Minecraft Java
- File type: .jar
- Minecraft versions listed: 1.8, 1.9, 1.10
- How to install: Install the matching mod loader (Forge, Fabric or NeoForge) for your Minecraft version. → Download the .jar. → Put it in the .minecraft/mods folder and launch that loader profile.
- Where to get it: Opens on Spigot — not every file is mirrored on our own servers.
Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.
ζetaCore is a free Minecraft Java mod. Compatible with Minecraft 1.8, 1.9, 1.10, 1.11 and newer. Downloaded 353 times (via Spigot). Download it and open it directly in the game.