本文整理匯總了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) {
}
}
}
示例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();
}
}
示例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();
}
}
示例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));
}
示例5: run
import org.bukkit.Bukkit; //導入方法依賴的package包/類
@Deprecated
@Override
public void run()
{
getServer().getPluginManager().disablePlugin(this);
Bukkit.shutdown();
}
示例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();
}
示例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();
}
}
示例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();
}
}
示例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!");
}
示例10: finishGeneration
import org.bukkit.Bukkit; //導入方法依賴的package包/類
public void finishGeneration(World world, long time)
{
this.getLogger().info("Ready in " + time + "ms");
Bukkit.shutdown();
}
示例11: fatal
import org.bukkit.Bukkit; //導入方法依賴的package包/類
public static void fatal(final String prefix, final String context) {
Bukkit.getLogger().severe(prefix + context);
Bukkit.shutdown();
}