Server owners, this is a Spigot library, it does nothing on it's own, it's used for helping other developers in various ways to help them develop their plugins, and may be the base of my own future plugins!
SpigotAdditions is a library providing awesome features and APIs for plugin development, and aims to save a bunch of time and get rid of boilerplate ugly code!
Best features of SpigotAdditions include:
- Automatic Listener + Handler API
- Custom Command API
- Custom Enchantment API
- ItemStackBuilders
- GUI Creation API/Tools
- Custom Item API and Player Head API
- MySQL Tools and MongoDB API/Tools
- Updater API
- Serealizers (Custom + ItemSerealizer for JSON and YAML)
- Config and DataFile API
- Event Flows!
- ChatMessage API with custom click events!
For documentation, more information and a way to integrate this library in your own plugin, visit the
GitHub page!
The below code snippets are probably outdated, to view all the cool new features and the actual up-to-date snippets, visit the GitHub page linked above!
If you face any issues, post a GitHub issue, or send me a Discord friend request on:
ImDaMilan#3333
A few code examples:
Code (Java):
public
static @Listener
void onPlayerJoin
(PlayerJoinEvent event
)
{
event.
getPlayer
(
).
sendMessage
(
"Hello!"
)
;
}
^ The Listener annotation that automatically registers the listener/handler for you, and doesn't require you to put it in a Listener class.
Code (Java):
ItemStack item
=
new ItemStackBuilder
(Material.
BOOK
)
.
name
(
"Test"
)
.
lore
(
"Test"
)
.
amount
(
1
)
.
modelData
(
1
)
.
enchant
(Enchantment.
DURABILITY,
1
)
;
new CustomItem
(item,
"plugin_name:test_custom_item", PLUGININSTANCE
)
;
CustomItem.
isCustomItem
(item, PLUGININSTANCE
)
;
ItemStack head
=
new PlayerHeadItem
(player
).
get
(
)
;
^ The Custom Item API, Player Head API and ItemStackBuilder examples.
Code (Java):
@Command
(
name
=
"test",
permission
=
"test.test",
usage
=
"/test",
description
=
"Testing command",
aliases
=
{
"t",
"testcommand"
},
minArgs
=
0,
playerOnly
=
false,
consoleOnly
=
false
)
public
class TestCommand
{
public
static
boolean execute
(CommandSender sender, Command command,
String label,
String
[
] args
)
{
sender.
sendMessage
(
"Test command executed!"
)
;
return
true
;
}
}
^ Command annotation automatically registers the custom command without having to put it in the config.yml, and provides some command QoL features!
Code (Java):
new EnchantmentWrapper
(
"telekinesis",
"Telekinesis",
1,
false,
false, EnchantmentTarget.
TOOL
)
;
SQLConnection sql
=
new SQLConnection
(host, port, database, name, pass
)
;
sql.
execute
(
"CREATE TABLE IF NOT EXISTS tablename"
)
;
sql.
forEach
(
"GET * FROM db", result
->
System.
out.
println
(result
)
)
;
sql.
getResults
(
"GET * FROM db"
)
;
sql.
getConnection
(
)
;
sql.
close
(
)
;
Updater updater
=
new Updater
(PLUGININSTANCE, RESOURCEID
)
;
String latestVersion
= updater.
getLatest
(
)
;
updater.
download
(
)
;
//automatically downloads the newest version!
^ Examples for the Custom Enchantment API that automatically registers the enchant with just that single constructor), the MySQL Tools API and the Updater API.
If you are interested in quality server hosting, clicking the above image supports me as a developer and gives you a 25% discount on server hosting!