UtilAPI v2.1.0
The UtilAPI is an API to simplify the development of spigot plugins. It is very helpful for beginners, but there are also some functions that can help advanced developers.
To use the API, the .jar file must be added as a library. I will try to publish a maven repo in the future.
Functions
MySQL
The UtilAPI provides a very simple way to establish and use an SQL connection. First, an instance of the SQL class must be created. In addition, an SQlConfig is needed to store and retrieve the login data for the database.
Example:
Code (Java):
SQLConfig cfg
=
new SQLConfig
(
"plugins//yourProject",
"mysql.yml"
)
;
// creates a new SQL config
SQL sql
=
new SQL
(cfg.
readData
(
)
)
;
// creates a new instance of the SQL class
sql.
connect
// connects to the db
UUID Fetcher
With the UUIDFetcher, UUIDs can be converted into player names and vice versa.
Code (Java):
UUID uuid
= UUIDFetcher.
getUUID
(player.
getName
(
)
)
;
// Returns the UUID of the selected player
Config
The Custom config makes it possible to create new configs very quickly and easily.
Code (Java):
Config cfg
=
new Config
(
"path//to//the",
"file.name"
)
;
cfg.
write
(
"is.chris.cool",
true
)
;
The API offers many more possibilities, these are just a few examples. More detailed documentation is available on the GitHUb repo.