OMGPIDocs

OMGPI

Source

JavaDocs

SpigotMC

Rewards

In some cases, player gets a reward - this can be anything you want. OMGPI uses by default rewards names "winner", "loser", "kill", "death". Here is an example code of how you can handle rewards:

public void player_reward(OMGPlayer p, String id) {
    new BukkitRunnable() {
        public void run() {
            if (gamefig.contains("rewards." + id.toLowerCase() + ".informable"))
                for (String rw : gamefig.getConfigurationSection("rewards." + id.toLowerCase() + ".informable").getKeys(false)) {
                    int i = Integer.parseInt(gamefig.getString("rewards." + id.toLowerCase() + ".informable." + rw));
                    if (rw.equalsIgnoreCase("gc")) p.addGameCoins(i);
                    else if (MySQL.set("UUID", p.bukkit.getUniqueId(), rw.split(":")[1], (int) (MySQL.get("UUID", p.bukkit.getUniqueId(), rw.split(":")[1], rw.split(":")[0])) + i, rw.split(":")[0]))
                        p.bukkit.sendMessage(i >= 0 ? ChatColor.DARK_GRAY + "+" + i + " " + rw.split(":")[1] : ChatColor.DARK_GRAY + "-" + p + " " + rw.split(":")[1]);
                }
            if (gamefig.contains("rewards." + id.toLowerCase() + ".silent"))
                for (String rw : gamefig.getConfigurationSection("rewards." + id.toLowerCase() + ".silent").getKeys(false)) {
                    int i = Integer.parseInt(gamefig.getString("rewards." + id.toLowerCase() + ".silent." + rw));
                    if (rw.equalsIgnoreCase("gc")) p.gameCoins += i;
                    else
                        MySQL.set("UUID", p.bukkit.getUniqueId(), rw.split(":")[1], (int) (MySQL.get("UUID", p.bukkit.getUniqueId(), rw.split(":")[1], rw.split(":")[0])) + i, rw.split(":")[0]);
                }
        }
    }.runTaskLaterAsynchronously(this, 5L);
}

This will do a following gamefig section:

rewards:
  id:
    informable:
      gc: 10
      'Table:Column': Value
    silent:
    ...

Informable messages players, silent does not. "gc" is game coins addition. The code uses SQL and checks UUID column for player matches.