Example #1
0
  public void onEnable() {

    instance = this;

    if (Bukkit.getPluginManager().getPlugin("LightAntibot") == null) {
      Bukkit.shutdown();
      warn("Name of plugin changed! Shutting down server...");
      return;
    }

    ConfigurationUtils.defaultConfiguration();
    ConfigurationUtils.loadConfiguration();

    Bukkit.getPluginManager().registerEvents(new PlayerChat(), this);
    Bukkit.getPluginManager().registerEvents(new PlayerInteract(), this);
    if (bossbarCaptcha) Bukkit.getPluginManager().registerEvents(new PlayerJoin(), this);
    Bukkit.getPluginManager().registerEvents(new PlayerLogin(), this);
    if (serverPing) Bukkit.getPluginManager().registerEvents(new ServerPing(), this);

    getCommand("antibot").setExecutor(new AntiBot());

    new ThrottleTask().start();
    if (UpdateUtils.needUpdate()) UpdateUtils.doUpdate();

    info("Enabled (v" + version + ").");

    MetricsUtils.queryMetric();
  }
Example #2
0
 @Override
 public void run() {
   if (this.plugin.getBrManager().getGameStatus().equals(BRGameStatus.END)) {
     Bukkit.shutdown();
     return;
   }
   this.plugin.getBrManager().setGameStatus(BRGameStatus.END);
   BRUtils.announce(plugin, "¥µ©`¥Ð¤ò10Ãëáá¤ËÔÙÆð„Ó¤·¤Þ¤¹¡£");
   Player[] players = CommonUtil.getOnlinePlayers();
   for (int i = 0; i < players.length; i++) {
     for (int j = 0; j < players.length; j++) {
       players[i].showPlayer(players[j]);
     }
   }
   for (int i = 10; i > 0; i--) {
     try {
       if (i <= 5 || i == 10) BRUtils.announce(plugin, String.format("ÔÙÆð„Ó¤Þ¤Ç%dÃë", i));
       Thread.sleep(1000);
     } catch (InterruptedException e) {
       System.out.println(e);
     }
   }
   // Bukkit.shutdown();
   stopServer();
 }
Example #3
0
  public void run() {
    timeUntilStart = 60;
    while (true) {
      if (GameState.isState(GameState.IN_LOBBY))
        if (Game.canStart()) {
          timeUntilStart = 15;
          ChatUtils.broadcast("Es sind genügend Spieler da, Countdown startet...");
          ChatUtils.broadcast(timeUntilStart + " Sekunden bis zum Start!");
          for (; timeUntilStart >= 0; timeUntilStart--) {
            if (!Game.canStart()) {
              ChatUtils.broadcast("Es sind zu wenig Spieler da, Countdown gestoppt!");
              break;
            }
            if (timeUntilStart == 0) {
              Game.start();
              break;
            }

            if (timeUntilStart % 10 == 0 || timeUntilStart < 10) {
              ChatUtils.broadcast(timeUntilStart + " Sekunden bis zum Start!");
            }

            try {
              Thread.sleep(1000);
            } catch (InterruptedException e) {
              e.printStackTrace();
              Bukkit.shutdown();
            }
          }
        }
      try {
        Thread.sleep(1000);
      } catch (InterruptedException e) {
        e.printStackTrace();
        Bukkit.shutdown();
      }
    }
  }
Example #4
0
  public boolean execute(CommandSender sender, String currentAlias, String[] args) {
    if (!testPermission(sender)) {
      return true;
    }
    Command.broadcastCommandMessage(sender, "Stopping the server..");
    Bukkit.shutdown();

    String reason = createString(args, 0);
    if (StringUtils.isNotEmpty(reason)) {
      for (Player player : Bukkit.getOnlinePlayers()) {
        player.kickPlayer(reason);
      }
    }
    return true;
  }
 /** Close the CraftBukkit server when they're done. */
 @AfterClass
 public static void shutdownCraftBukkit() {
   Bukkit.shutdown();
 }
Example #6
0
  /** Enable * */
  public void onEnable() {
    /** Plugin * */
    plugin = this;

    /** Packet * */
    packet = new PacketPlayResourcePackStatus();

    /** Shops * */
    Shop.setup();

    /** Inject packet * */
    try {
      packet.inject();
    } catch (NoSuchFieldException | IllegalAccessException e1) {
      e1.printStackTrace();
    }

    /** Setup config * */
    saveDefaultConfig();

    /** Config * */
    laserdamage = getConfig().getInt("laserdamage");
    maxhealth = getConfig().getInt("spaceshiphealth");
    explosiondamage = getConfig().getInt("explosiondamage");
    explosioncooldown = getConfig().getInt("explosioncooldown");
    hangarcooldown = getConfig().getInt("hangarcooldown");
    killaura = getConfig().getInt("killaura");

    /** Connect to database * */
    try {
      SQL.connect();
    } catch (Exception e) {
      /** Error * */
      Bukkit.getLogger().severe("Konnte keine Verbindung zur MySQL-Datenbank aufbauen!");

      /** Shutdown * */
      Bukkit.shutdown();

      /** Return * */
      return;
    }

    /** Worlds * */
    new Worlds(getConfig().getInt("maprange"));

    /** Plugin manager * */
    PluginManager pm = Bukkit.getPluginManager();

    /** Register events * */
    pm.registerEvents(new ListenerJoin(), plugin);
    pm.registerEvents(new ListenerVehicle(), plugin);
    pm.registerEvents(new ListenerKick(), plugin);
    pm.registerEvents(new ListenerQuit(), plugin);
    pm.registerEvents(new ListenerDestroy(), plugin);
    pm.registerEvents(new ListenerDamage(), plugin);
    pm.registerEvents(new ListenerWeather(), plugin);
    pm.registerEvents(new ListenerInteract(), plugin);
    pm.registerEvents(new ListenerCreatureSpawn(), plugin);
    pm.registerEvents(new ListenerChat(), plugin);
    pm.registerEvents(new ListenerClick(), plugin);
    pm.registerEvents(new ListenerDrop(), plugin);
    pm.registerEvents(new ListenerSneak(), plugin);
    pm.registerEvents(new ListenerHeld(), plugin);
    pm.registerEvents(new ListenerFood(), plugin);
    pm.registerEvents(new ListenerBreak(), plugin);
    pm.registerEvents(new ListenerShop(), plugin);

    /** Scheduler * */
    new SpaceshipScheduler();
    new HangarScheduler();
  }