Пример #1
0
  public void onEnable() {
    me = this;
    // Register the event listeners
    getServer().getPluginManager().registerEvents(listeners, this);
    getCommand("Cranked").setExecutor(new Commands(this));

    // Create the default config.yml
    getConfig().options().copyDefaults();
    saveConfig();

    for (Player p : Bukkit.getOnlinePlayers()) {
      CrankedPlayer cp = new CrankedPlayer(p);
      CrankedPlayerManager.loadCrackedPlayer(cp);
    }
    if (Files.getArenas().getConfigurationSection("Arenas") != null)
      for (String s : Files.getArenas().getConfigurationSection("Arenas").getKeys(false)) {
        Arena arena = new Arena(StringUtil.getWord(s));
        ArenaManager.loadArena(arena);
        System.out.println("Loaded Arena: " + arena);
      }
    else System.out.println("Couldn't Loaded Any Arenas");
    if (getConfig().getBoolean("MySQL.Enable")) {
      MySQL =
          new MySQL(
              this,
              getConfig().getString("MySQL.Host"),
              getConfig().getString("MySQL.Port"),
              getConfig().getString("MySQL.Database"),
              getConfig().getString("MySQL.User"),
              getConfig().getString("MySQL.Pass"));
      c = MySQL.openConnection();
    }
  }
Пример #2
0
 public static void setScore(String name, Integer score) {
   if (Main.me.getConfig().getBoolean("MySQL.Enable")) setMySQLStats(name, "Score", score);
   else {
     Files.getPlayers().set("Players." + name + ".Score", score);
     Files.savePlayers();
   }
 }
Пример #3
0
 public static void setDeaths(String name, Integer deaths) {
   if (Main.me.getConfig().getBoolean("MySQL.Enable")) setMySQLStats(name, "Deaths", deaths);
   else {
     Files.getPlayers().set("Players." + name + ".Deaths", deaths);
     Files.savePlayers();
   }
 }
Пример #4
0
 public static int getScore(String name) {
   if (Main.me.getConfig().getBoolean("MySQL.Enable"))
     return Integer.valueOf(getMySQLStats(name, "Score"));
   else return Files.getPlayers().getInt("Players." + name + ".Score");
 }