This API allows to use Coins on your Spigot Server!
This API is very easy to use and lightweight.
How to use:
Datas:
Future Things:
• Get 20 Downloads [Done!]
• Get 50 Downloads [Done!]
• Get 100 Downloads [Done!]
• Get 200 Downloads
This API is very easy to use and lightweight.
How to use:
Spoiler: With MySQL
Code (Text):
## MYSQL ##
public void onEnable() {
MySQL mysql = new MySQL("USERNAME", "PASSWORD", "DATABASE", "HOST", "PORT"); //Set your mysql login datas
mysql.connect(); //Connect to your mysql database
mysql.addTable(); //Create new table if not exists
}
public void onDisable() {
MySQL mysql = new MySQL();
mysql.close(); //Close the connection to your mysql database
}
public void onJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
MySQL mysql = new MySQL();
if(!mysql.PlayerExists(p.getUniqueId())) { //Check if the player exists
mysql.createPlayer(p.getUniqueId()); //Creates a new player
}
}
public void onDeath(PlayerDeathEvent e) {
Player p = e.getPlayer();
MySQL mysql = new MySQL();
Coins coins = new Coins();
if(mysql.PlayerExists(p.getUniqueId())) { //Check if the player exists
p.sendMessage("§3" + coins.get(p.getUniqueId()) + " §7Coins."); //Get the amount of coins
coins.set(p.getUniqueId(), 1); //Set an amount of coins
coins.add(p.getUniqueId(), 1); //Add an amount of coins
coins.remove(p.getUniqueId(), 1); //Remove an amount of coins
if(coins.hasEnough(p.getUniqueId(), 10)) { //Check if the player has enough coins
coins.add(p.getUniqueId(), 10);
}
}
}
public void onEnable() {
MySQL mysql = new MySQL("USERNAME", "PASSWORD", "DATABASE", "HOST", "PORT"); //Set your mysql login datas
mysql.connect(); //Connect to your mysql database
mysql.addTable(); //Create new table if not exists
}
public void onDisable() {
MySQL mysql = new MySQL();
mysql.close(); //Close the connection to your mysql database
}
public void onJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
MySQL mysql = new MySQL();
if(!mysql.PlayerExists(p.getUniqueId())) { //Check if the player exists
mysql.createPlayer(p.getUniqueId()); //Creates a new player
}
}
public void onDeath(PlayerDeathEvent e) {
Player p = e.getPlayer();
MySQL mysql = new MySQL();
Coins coins = new Coins();
if(mysql.PlayerExists(p.getUniqueId())) { //Check if the player exists
p.sendMessage("§3" + coins.get(p.getUniqueId()) + " §7Coins."); //Get the amount of coins
coins.set(p.getUniqueId(), 1); //Set an amount of coins
coins.add(p.getUniqueId(), 1); //Add an amount of coins
coins.remove(p.getUniqueId(), 1); //Remove an amount of coins
if(coins.hasEnough(p.getUniqueId(), 10)) { //Check if the player has enough coins
coins.add(p.getUniqueId(), 10);
}
}
}
Spoiler: Without MySQL
Code (Text):
## LOCAL ##
public void onDeath(PlayerDeathEvent e) {
Player p = e.getPlayer();
MySQL mysql = new MySQL();
Coins coins = new Coins();
p.sendMessage("§3" + coins.get(p.getUniqueId()) + " §7Coins."); //Get the amount of coins
coins.set(p.getUniqueId(), 1); //Set an amount of coins
coins.add(p.getUniqueId(), 1); //Add an amount of coins
coins.remove(p.getUniqueId(), 1); //Remove an amount of coins
if(coins.hasEnough(p.getUniqueId(), 10)) { //Check if the player has enough coins
coins.add(p.getUniqueId(), 10);
}
}
public void onDeath(PlayerDeathEvent e) {
Player p = e.getPlayer();
MySQL mysql = new MySQL();
Coins coins = new Coins();
p.sendMessage("§3" + coins.get(p.getUniqueId()) + " §7Coins."); //Get the amount of coins
coins.set(p.getUniqueId(), 1); //Set an amount of coins
coins.add(p.getUniqueId(), 1); //Add an amount of coins
coins.remove(p.getUniqueId(), 1); //Remove an amount of coins
if(coins.hasEnough(p.getUniqueId(), 10)) { //Check if the player has enough coins
coins.add(p.getUniqueId(), 10);
}
}
Spoiler: Own /coins Command
1st: Disable the '/coins' command in the config.yml
Then:
Then:
Code (Text):
@Override
public boolean onCommand(CommandSender sender, Command cmd, String cmdlabel, String[] args) {
if(sender instanceof Player) {
Player p = (Player) sender;
if(args.length == 0) {
String msg = pl.getConfig().getString("Coins Command.Messages.Coins").replace("[COINS]", Coins.get(p.getUniqueId()).toString()).replace("&", "§");
p.sendMessage(msg);
}
if(args.length == 1) {
Player t = (Player) Bukkit.getPlayer(args[1]);
if(t != null) {
String msg = pl.getConfig().getString("Coins Command.Messages.Coins Other").replace("[PLAYER]", t.getName()).replace("[COINS]", Coins.get(t.getUniqueId()).toString()).replace("&", "§");
p.sendMessage(msg);
}
}
}
return true;
}
public boolean onCommand(CommandSender sender, Command cmd, String cmdlabel, String[] args) {
if(sender instanceof Player) {
Player p = (Player) sender;
if(args.length == 0) {
String msg = pl.getConfig().getString("Coins Command.Messages.Coins").replace("[COINS]", Coins.get(p.getUniqueId()).toString()).replace("&", "§");
p.sendMessage(msg);
}
if(args.length == 1) {
Player t = (Player) Bukkit.getPlayer(args[1]);
if(t != null) {
String msg = pl.getConfig().getString("Coins Command.Messages.Coins Other").replace("[PLAYER]", t.getName()).replace("[COINS]", Coins.get(t.getUniqueId()).toString()).replace("&", "§");
p.sendMessage(msg);
}
}
}
return true;
}
Datas:
Spoiler: config.yml
Code (Text):
########################
## CoinsAPI by DomeDD ##
########################
Coins Command:
Enabled: true
Messages:
Coins: '&8[&2CoinsAPI&8] &7Your coins: &3[COINS]'
Coins Other: '&8[&2CoinsAPI&8] &7[PLAYER]''s coins: &3[COINS]'
## CoinsAPI by DomeDD ##
########################
Coins Command:
Enabled: true
Messages:
Coins: '&8[&2CoinsAPI&8] &7Your coins: &3[COINS]'
Coins Other: '&8[&2CoinsAPI&8] &7[PLAYER]''s coins: &3[COINS]'
Future Things:
• Get 20 Downloads [Done!]
• Get 50 Downloads [Done!]
• Get 100 Downloads [Done!]
• Get 200 Downloads
Quick facts
- Edition: Minecraft Java
- File type: .jar
- Minecraft versions listed: 1.7, 1.8, 1.9
- 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.
Simple Coins API | 1.7 - 1.13 is a free Minecraft Java mod. Compatible with Minecraft 1.7, 1.8, 1.9, 1.10. Downloaded 1,947 times (via Spigot). Download it and open it directly in the game.