@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
 public void onPlayerLogin(final AsyncPlayerPreLoginEvent event) {
   if (!server.getOnlineMode()) return;
   if (event.getLoginResult() == AsyncPlayerPreLoginEvent.Result.KICK_BANNED) return;
   logger.log(Level.FINER, "Received " + event.getEventName());
   final String playerName = event.getName();
   if (this.isPlayerBanned(playerName)) {
     final BanRecord record = this.playerRecordManager.find(playerName).getActiveBan();
     final String message = this.getKickMessage(record);
     event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_BANNED, message);
   }
 }
Beispiel #2
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 boolean getOnlineMode() {
   return server.getOnlineMode();
 }