當前位置: 首頁>>代碼示例>>Java>>正文


Java Bukkit.shutdown方法代碼示例

本文整理匯總了Java中org.bukkit.Bukkit.shutdown方法的典型用法代碼示例。如果您正苦於以下問題:Java Bukkit.shutdown方法的具體用法?Java Bukkit.shutdown怎麽用?Java Bukkit.shutdown使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.Bukkit的用法示例。


在下文中一共展示了Bukkit.shutdown方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: CheckAndDownloadPlugin

import org.bukkit.Bukkit; //導入方法依賴的package包/類
public static void CheckAndDownloadPlugin() {
    if (ConfigMain.AutoUpdate == true) {
        try {
            // 整體獲取
            File NetworkerFile = new File(EscapeLag.MainThis.getDataFolder(), "networkerlog");
            DowloadFile("http://www.relatev.com/files/EscapeLag/NetWorker.yml", NetworkerFile);
            YamlConfiguration URLLog = YamlConfiguration.loadConfiguration(NetworkerFile);
            // 檢查插件並下載新版本
            EscapeLag.MainThis.getLogger().info("正在檢查新版本插件,請稍等...");
            int NewVersion = URLLog.getInt("UpdateVersion");
            int NowVersion = Integer.valueOf("%BUILD_NUMBER%");
            if (NewVersion > NowVersion) {
                EscapeLag.MainThis.getLogger().info("插件檢測到新版本 " + NewVersion + ",正在自動下載新版本插件...");
                DowloadFile("https://www.relatev.com/files/EscapeLag/EscapeLag.jar", EscapeLag.getPluginsFile());
                EscapeLag.MainThis.getLogger().info("插件更新版本下載完成!正在重啟服務器!");
                Bukkit.shutdown();
            } else {
                EscapeLag.MainThis.getLogger().info("EscapeLag插件工作良好,暫無新版本檢測更新。");
            }
            // 完成提示
            EscapeLag.MainThis.getLogger().info("全部網絡工作都讀取完畢了...");
        } catch (IOException ex) {
        }
    }
}
 
開發者ID:GelandiAssociation,項目名稱:EscapeLag,代碼行數:26,代碼來源:NetWorker.java

示例2: AgarGame

import org.bukkit.Bukkit; //導入方法依賴的package包/類
public AgarGame(GameType type) {
    super("agarmc", AgarMC.NAME, type.getDisplayName(), CPlayer.class);
    gameType = type;
    try
    {
        IGameProperties config = SamaGamesAPI.get().getGameManager().getGameProperties();
        origin = Utils.getLocation(config.getOption("origin", null));
        dimensions = config.getOption("dimensions", null).getAsInt();
        maxstatic = dimensions * dimensions / 24;
        maxvirus = dimensions * dimensions / 1000;
        maxcells = 16;
        Bukkit.getLogger().info("Arena : Origin = " + origin.toString() + ", Dimensions = " + dimensions);
    }
    catch(Exception e)
    {
        Bukkit.getLogger().severe("Error in game.json ! Stopping server !");
        e.printStackTrace();
        Bukkit.shutdown();
    }
}
 
開發者ID:SamaGames,項目名稱:AgarMC,代碼行數:21,代碼來源:AgarGame.java

示例3: connect

import org.bukkit.Bukkit; //導入方法依賴的package包/類
private void connect()
{
    JedisPoolConfig config = new JedisPoolConfig();
    config.setMaxTotal(-1);
    config.setJmxEnabled(false);

    try
    {
        this.cachePool = new JedisPool(config, this.bungee.getIp(), this.bungee.getPort(), 0, this.bungee.getPassword());
        this.cachePool.getResource().close();

        this.plugin.log(Level.INFO, "Connected to database.");
    }
    catch (Exception e)
    {
        plugin.getLogger().log(Level.SEVERE, "Can't connect to the database!", e);
        Bukkit.shutdown();
    }
}
 
開發者ID:SamaGames,項目名稱:SamaGamesCore,代碼行數:20,代碼來源:DatabaseConnector.java

示例4: channelRead0

import org.bukkit.Bukkit; //導入方法依賴的package包/類
@Override
protected void channelRead0(ChannelHandlerContext ctx, Packet packet) throws Exception {
	if (packet instanceof PacketPing) {
		ctx.channel().writeAndFlush(packet);
	} else if (packet instanceof PacketKillServer) {
		Bukkit.shutdown();
	} else if (packet instanceof PacketToServerDispatchCommand) {
		Bukkit.dispatchCommand(Bukkit.getConsoleSender(), ((PacketToServerDispatchCommand) packet).getCommand());
	}

	SpigotConnectorPlugin.getInstance().getPacketHandlers().forEach(handler -> handler.channelRead(ctx, packet));
}
 
開發者ID:CentauriCloud,項目名稱:CentauriCloud,代碼行數:13,代碼來源:NetworkHandler.java

示例5: run

import org.bukkit.Bukkit; //導入方法依賴的package包/類
@Deprecated
@Override
public void run()
{
    getServer().getPluginManager().disablePlugin(this);
    Bukkit.shutdown();
}
 
開發者ID:Dytanic,項目名稱:CloudNet,代碼行數:8,代碼來源:BukkitBootstrap.java

示例6: RestartServer

import org.bukkit.Bukkit; //導入方法依賴的package包/類
public static void RestartServer(String message){
AzureAPI.log("開始以理由 " + message +"重啟服務器...");
List<Player> players = AzurePlayerList.players();
int ps = players.size();
for(int i=0;i<ps;i++){
	Player player = players.get(i);
	player.kickPlayer(loggerPrefix + message);
}
      Bukkit.shutdown();
  }
 
開發者ID:GelandiAssociation,項目名稱:EscapeLag,代碼行數:11,代碼來源:AzureAPI.java

示例7: run

import org.bukkit.Bukkit; //導入方法依賴的package包/類
@Override
public void run() {
	TIME += 1;

       Bukkit.getScheduler().scheduleSyncDelayedTask(Walls.instance, new Runnable() {
           @Override
           public void run() {
               Walls.checkWinner();
           }
       });
	
	int limit = 2700;
	if (TIME == limit - 300) {
	    Chat.server("&cGame ending in 5 minutes!");
	    return;
	}
	if (TIME == limit - 120) {
	    Chat.server("&cGame ending in 2 minutes!");
	    return;
	}
	if (TIME == limit - 60) {
	    Chat.server("&cGame ending in 1 minute!");
	    return;
	}
	if (TIME >= limit - 10) {
		Chat.server("&cGame ending in " + Chat.time(2700 - TIME) + "!");
	}
	if (TIME == limit || Bukkit.getOnlinePlayers().length == 0) {
		Bukkit.shutdown();
	}
	
}
 
開發者ID:thekeenant,項目名稱:mczone,代碼行數:33,代碼來源:PVPTask.java

示例8: reload

import org.bukkit.Bukkit; //導入方法依賴的package包/類
public void reload()
{
    try
    {
        File file = new File(APIPlugin.getInstance().getDataFolder().getAbsoluteFile().getParentFile().getParentFile(), "game.json");

        if (!file.exists())
        {
            APIPlugin.log(Level.WARNING, "No game properties file found! If this serveur isn't a game server, don't worry about this message!");
            return;
        }

        JsonObject rootJson = new JsonParser().parse(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8"))).getAsJsonObject();
        this.templateID = rootJson.get("template-id").getAsString();
        this.mapName = rootJson.get("map-name").getAsString();
        this.minSlots = rootJson.get("min-slots").getAsInt();
        this.maxSlots = rootJson.get("max-slots").getAsInt();
        this.options = rootJson.get("options").getAsJsonObject();

        File worldFolder = new File(APIPlugin.getInstance().getDataFolder().getAbsoluteFile().getParentFile().getParentFile(), "world");
        File arenaFile = new File(worldFolder, "arena.json");

        if (!arenaFile.exists())
        {
            this.mapProperties = new JsonObject();
            APIPlugin.log(Level.WARNING, "No arena properties file found! If this serveur isn't a game server, don't worry about this message!");
            return;
        }

        this.mapProperties = new JsonParser().parse(new InputStreamReader(new FileInputStream(arenaFile), Charset.forName("UTF-8"))).getAsJsonObject();
    }
    catch (FileNotFoundException e)
    {
        e.printStackTrace();
        APIPlugin.log(Level.SEVERE, "Can't open the game properties file. Abort start!");
        APIPlugin.getInstance().disable();
        Bukkit.shutdown();
    }
}
 
開發者ID:SamaGames,項目名稱:SamaGamesCore,代碼行數:40,代碼來源:GameProperties.java

示例9: run

import org.bukkit.Bukkit; //導入方法依賴的package包/類
@Override
public void run() {
	if (TIME % 20 == 0) {
        Kit.load();
	}
	
	TOTAL_TIME += 1;
	if (Bukkit.getOnlinePlayers().length > 1)
	    TIME -= 1;
	
	if (TOTAL_TIME > 900 && Bukkit.getOnlinePlayers().length <= 3) {
	    Bukkit.shutdown();
	}
	
	if (Bukkit.getOnlinePlayers().length==Bukkit.getMaxPlayers() && TIME >= 15) {
		TIME = 10;
	}
	
	if (TIME==0) {
		boolean start = true;
		for (Team team : Team.list) {
			if (team.getMembers().size() <= 2) {
				start = false;
				break;
			}
		}
		if (start) {
		    Bukkit.getScheduler().scheduleSyncDelayedTask(Walls.instance, new Runnable() {
                   @Override
                   public void run() {
                       Walls.prep();
                   }
		    });
		}
		else {
			Chat.server("&cWe need 2 players per team in order to start the game!");
			TIME = Config.getInt("pre-time");
			return;
		}
		return;
	}
	
	if (TIME % 20 == 0 || TIME <= 10)
		Chat.server("&eGame beginning in &4" + Chat.time(TIME) + "&e!");	
}
 
開發者ID:thekeenant,項目名稱:mczone,代碼行數:46,代碼來源:PreTask.java

示例10: finishGeneration

import org.bukkit.Bukkit; //導入方法依賴的package包/類
public void finishGeneration(World world, long time)
{
    this.getLogger().info("Ready in " + time + "ms");
    Bukkit.shutdown();
}
 
開發者ID:SamaGames,項目名稱:SurvivalAPI,代碼行數:6,代碼來源:SurvivalGenerator.java

示例11: fatal

import org.bukkit.Bukkit; //導入方法依賴的package包/類
public static void fatal(final String prefix, final String context) {
    Bukkit.getLogger().severe(prefix + context);
    Bukkit.shutdown();
}
 
開發者ID:Recraft,項目名稱:Recreator,代碼行數:5,代碼來源:AzureAPI.java


注:本文中的org.bukkit.Bukkit.shutdown方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。