Exemple #1
0
  @Override
  public void onEnable() {
    dfolder = getDataFolder();
    dfolder.mkdirs();
    this.gen = new UUIDGenerator();
    /* Register some listeners... */
    getServer().getPluginManager().registerEvents(new OnSignChanged(), this);
    getServer().getPluginManager().registerEvents(new OnDispense(), this);
    getServer().getPluginManager().registerEvents(new OnBlockPlace(), this);
    getServer().getPluginManager().registerEvents(new OnBlockBreak(), this);
    getServer().getPluginManager().registerEvents(new OnInteract(), this);
    getServer().getPluginManager().registerEvents(new OnPlayerJoin(), this);
    getCommand("infinitedispenser").setExecutor(new CommandInfiniteDispenser());

    Server serv = Bukkit.getServer();
    StatsRequest s = new StatsRequest("start");
    s.put("Plugin Version", ver + "");
    s.put("Bukkit Version", serv.getBukkitVersion());
    s.put("Full Version", serv.getVersion());
    s.put("Server Port", serv.getPort() + "");
    s.put("Online Mode", serv.getOnlineMode() + "");
    try {
      s.put("Unique ID", gen.getUID());
    } catch (Exception e1) {
    }
    s.put("Time", System.currentTimeMillis() + "");

    s.send("http://dashie.in/s.php?stat=%stat%");
    try {
      Metrics metrics = new Metrics(this);
      metrics.start();
    } catch (IOException e) {
      System.out.println("[ID] Error starting metrics!");
    }
    this.saveDefaultConfig();
    FileConfiguration cf = this.getConfig();
    update = cf.getBoolean("update-checking");
  }
 @Override
 public String getBukkitVersion() {
   return server.getBukkitVersion();
 }