Safe
Safe is a very lightweight economy plugin inspired by vault. As Safe is an API, this plugin would be used as dependency to other plugins to easily manage balance systems of players using SQLite.
Depend on Safe
To use Safe you need other plugins supporting it. Here is how to add Safe as a dependency to your PaperMC project using Gradle.
Gradle - manual
- Download a Safe .jar file.
- Put the file in your development folder inside both
/libs/and/run/plugins/. - In gradle.properties, add this line:
safe.version=[VERSION]. (Change [VERSION] to your actual downloaded file version) - Next, add it to your dependencies in
build.gradle(.kts). It would look something like:dependencies { compileOnly(files("libs/Safe-${property("safe.version")}.jar")) } - In your plugin's
plugin.ymlfile, addSafeto your dependencies. It would look like:depend: [Safe] - Reload your Gradle project.
Gradle - GitHub
- In your build.gradle(.kts), add these lines to
repositories:ivy { url = uri( "https://github.com/Sealing99/Safe/releases/download" ) patternLayout { artifact("[revision]/[artifact]-[revision].[ext]") } metadataSources { artifact() } } - Next, add it to your dependencies:
compileOnly("com.github.Sealing99:Safe:${property("safe.version")}") - In gradle.properties, add
safe.version=[VERSION](replace [VERSION] with your actual version) - In your plugin's
plugin.ymlfile, addSafeto your dependencies. It would look like:depend: [Safe] - Reload your Gradle project.
Gradle - jitpack
- In your build.gradle(.kts), add
maven { url = uri("https://jitpack.io") }at the end ofrepositories {}. - Add
compileOnly("com.github.Sealing99:Safe:${property("safe.version")}")todependencies {}. - In gradle.properties, add
safe.version=[VERSION](replace [VERSION] with your actual version) - In your plugin's
plugin.ymlfile, addSafeto your dependencies. It would look like:depend: [Safe] - Reload your Gradle project.
How to use Safe as an API
Safe has exposed several methods to call to connect to the economy database.
- Add a
net.sealing99.safe.Safefield to your main class. - On enabling, initialize the field using:
try { safeAPI = (Safe) getServer().getPluginManager().getPlugin("Safe"); } catch (Exception e) { getLogger().severe("Failed to connect to Safe API"); e.printStackTrace(); getServer().getPluginManager().disablePlugin(this); return; } - To get a balance, call
Safe#getBalanceDatabase().getBalance(String uuid) - To set/add/remove money:
Safe#getBalanceDatabase() .setBalance(String uuid, BigDecimal bal); .addMoney(String uuid, BigDecimal amount); .removeMoney(String uuid, BigDecimal amount);
Safe automatically saves/loads balances on start/stop, so no further functions to call are needed.
No gallery available for this project.
| Version | Minecraft | Loader | Download |
|---|---|---|---|
|
Safe 0.5.0-beta 0.5.0 |
1.21, 1.21.1, 1.21.10, 1.21.11, 1.21.2, 1.21.3, 1.21.4, 1.21.5, 1.21.6, 1.21.7, 1.21.8, 1.21.9, 26.1, 26.1.1, 26.1.2, 26.2, 26.3
|
bukkit, paper, purpur, spigot
|
Download |
|
Safe 0.4.0-beta 0.4.0 |
1.21, 1.21.1, 1.21.10, 1.21.11, 1.21.2, 1.21.3, 1.21.4, 1.21.5, 1.21.6, 1.21.7, 1.21.8, 1.21.9, 26.1, 26.1.1, 26.1.2, 26.2, 26.3
|
bukkit, paper, purpur, spigot
|
Download |
|
Safe 0.3.0-beta 0.3.0 |
1.21, 1.21.1, 1.21.10, 1.21.11, 1.21.2, 1.21.3, 1.21.4, 1.21.5, 1.21.6, 1.21.7, 1.21.8, 1.21.9, 26.1, 26.1.1, 26.1.2, 26.2, 26.3
|
bukkit, paper, purpur, spigot
|
Download |
|
Safe 0.2.0-beta 0.2.0 |
26.2
|
paper
|
Download |
|
Safe 0.1.0-beta 0.1.0 |
26.2
|
paper
|
Download |