コード例 #1
0
 public void shutdown(String messageToKickWith) {
   System.out.print(HungergamesApi.getConfigManager().getLoggerConfig().getShuttingDown());
   ServerShutdownEvent event = new ServerShutdownEvent();
   Bukkit.getServer().getPluginManager().callEvent(event);
   if (!event.isCancelled()) {
     for (String command : mainConfig.getCommandsToRunBeforeShutdown())
       Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
     for (Player player : Bukkit.getOnlinePlayers()) {
       player.kickPlayer(messageToKickWith);
     }
     Bukkit.dispatchCommand(Bukkit.getConsoleSender(), mainConfig.getCommandToStopTheServerWith());
   } else
     System.out.print(HungergamesApi.getConfigManager().getLoggerConfig().getShutdownCancelled());
 }