Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package de.pascal.skypvp;
- import org.bukkit.configuration.file.YamlConfiguration;
- import org.bukkit.entity.Player;
- import java.io.File;
- import java.io.IOException;
- public class Coins {
- public static File file = new File("plugins/SkyPVP", "coins.yml");
- public static YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
- public static int getCoins(Player p) {
- return cfg.getInt(getUser(p));
- }
- public static String getUser(Player p) {
- return p.getName();
- }
- public static void setCoins(Player p, int anzahl) {
- cfg.set(getUser(p), anzahl);
- }
- public static void addCoins(Player p, int anzahl) {
- cfg.set(getUser(p), getCoins(p) + anzahl);
- }
- public static void removeCoins(Player p, int anzahl) {
- cfg.set(getUser(p), getCoins(p) - anzahl);
- }
- public static void saveCoinAPI() {
- try {
- cfg.save(file);
- if(!(file.exists())) {
- file.createNewFile();
- }
- }catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement