org.bukkit.Bukkit.shutdown()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(200)

本文整理了Java中org.bukkit.Bukkit.shutdown()方法的一些代码示例,展示了Bukkit.shutdown()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bukkit.shutdown()方法的具体详情如下:
包路径:org.bukkit.Bukkit
类名称:Bukkit
方法名:shutdown

Bukkit.shutdown介绍

暂无

代码示例

代码示例来源:origin: Bukkit/Bukkit

@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
  if (!testPermission(sender)) return true;
  Command.broadcastCommandMessage(sender, "Stopping the server..");
  Bukkit.shutdown();
  String reason = this.createString(args, 0);
  if (StringUtils.isNotEmpty(reason)) {
    for (Player player : Bukkit.getOnlinePlayers()) {
      player.kickPlayer(reason);
    }
  }
  return true;
}

代码示例来源:origin: dzikoysk/WildSkript

protected void execute(Event event) {
  Bukkit.shutdown();
}

代码示例来源:origin: TimoCloud/TimoCloud

private void stop() {
  Bukkit.getScheduler().runTask(this, () -> {
    Bukkit.shutdown();
    System.exit(0);
  });
}

代码示例来源:origin: bitquest/bitquest

public boolean run(
   CommandSender sender, Command cmd, String label, String[] args, Player player) {
  StringBuilder message = new StringBuilder();
  message.append(sender.getName()).append(" has shut down the server for emergency reasons");

  if (args.length > 0) {
   message.append(": ");
   for (String word : args) {
    message.append(word).append(" ");
   }
  }
  for (Player currentPlayer : Bukkit.getOnlinePlayers()) {
   currentPlayer.kickPlayer(message.toString());
  }

  Bukkit.shutdown();
  return true;
 }
}

代码示例来源:origin: Dytanic/CloudNet

@Deprecated
@Override
public void run()
{
  getServer().getPluginManager().disablePlugin(this);
  Bukkit.shutdown();
}

代码示例来源:origin: ProtocolSupport/ProtocolSupport

@Override
public void onDisable() {
  Bukkit.shutdown();
  ServerPlatform.get().getInjector().onDisable();
}

代码示例来源:origin: SpigotMC/Spigot-API

@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
  if (!testPermission(sender)) return true;
  Command.broadcastCommandMessage(sender, "Stopping the server..");
  Bukkit.shutdown();
  String reason = this.createString(args, 0);
  if (StringUtils.isNotEmpty(reason)) {
    for (Player player : Bukkit.getOnlinePlayers()) {
      player.kickPlayer(reason);
    }
  }
  return true;
}

代码示例来源:origin: ProtocolSupport/ProtocolSupport

} catch (Throwable t) {
  getLogger().severe("Unable to load buildinfo, make sure you built this version using Gradle");
  Bukkit.shutdown();
  Bukkit.shutdown();
  return;
} else {
  Bukkit.shutdown();
  return;
} catch (Throwable t) {
  getLogger().log(Level.SEVERE, "Error when loading, make sure you are using supported server version", t);
  Bukkit.shutdown();

代码示例来源:origin: Bkm016/TabooLib

Bukkit.shutdown();

代码示例来源:origin: bitquest/bitquest

public void adoptPet(Player player, String pet_name) {
 try {
  final User user = new User(this.db_con, player.getUniqueId());
  if (user.wallet.getBalance(3) >= PET_PRICE) {
   try {
    if (user.wallet.payment(this.wallet.address, PET_PRICE) == true) {
     createPet(user, pet_name);
     spawnPet(player);
    }
   } catch (Exception e) {
    e.printStackTrace();
   }
  } else {
   player.sendMessage(
     ChatColor.RED
       + "You need "
       + PET_PRICE / DENOMINATION_FACTOR
       + " "
       + DENOMINATION_NAME
       + " to adopt a pet.");
  }
 } catch (Exception e) {
  e.printStackTrace();
  Bukkit.shutdown();
 }
}

代码示例来源:origin: bitquest/bitquest

Bukkit.shutdown();
System.out.println("Please set the POSTGRES_PORT_5432_TCP_PORT environment variable");
e.printStackTrace();
System.out.println("[fatal] plugin enable fails");
Bukkit.shutdown();

代码示例来源:origin: io.github.bedwarsrel/BedwarsRel-Common

@Override
 public void run() {
  if (BedwarsRel.getInstance().isSpigot()
    && BedwarsRel.getInstance().getBooleanConfig("bungeecord.spigot-restart", true)) {
   BedwarsRel.getInstance().getServer()
     .dispatchCommand(BedwarsRel.getInstance().getServer().getConsoleSender(),
       "restart");
  } else {
   Bukkit.shutdown();
  }
 }
}.runTaskLater(BedwarsRel.getInstance(), 70L);

代码示例来源:origin: Bkm016/TabooLib

/**
 * 创建服务器数据表
 */
static void createTableWithServerUUID() {
  SQLTable table = new SQLTable(Main.getTablePrefix() + "_serveruuid", SQLColumn.PRIMARY_KEY_ID, new SQLColumn(SQLColumnType.TEXT, "uuid"), new SQLColumn(SQLColumnType.TEXT, "hash"));
  table.executeUpdate(table.createQuery()).dataSource(dataSource).run();
  tables.put("serveruuid", table);
  // 获取当前服务器信息
  String hash = getServerHash(TabooLib.getServerUID());
  if (hash == null) {
    // 写入序列号
    table.executeUpdate("insert into " + table.getTableName() + " values(null, ?, ?)")
        .dataSource(dataSource)
        .statement(s -> {
          s.setString(1, TabooLib.getServerUID());
          s.setString(2, StringUtils.hashKeyForDisk(Main.getInst().getDataFolder().getPath()));
        }).run();
  } else if (!hash.equals(StringUtils.hashKeyForDisk(Main.getInst().getDataFolder().getPath()))) {
    TLocale.Logger.error("NOTIFY.ERROR-SERVER-KEY");
    TabooLib.resetServerUID();
    Bukkit.shutdown();
  }
}

代码示例来源:origin: BedwarsRel/BedwarsRel

@Override
 public void run() {
  if (BedwarsRel.getInstance().isSpigot()
    && BedwarsRel.getInstance().getBooleanConfig("bungeecord.spigot-restart", true)) {
   BedwarsRel.getInstance().getServer()
     .dispatchCommand(BedwarsRel.getInstance().getServer().getConsoleSender(),
       "restart");
  } else {
   Bukkit.shutdown();
  }
 }
}.runTaskLater(BedwarsRel.getInstance(), 70L);

代码示例来源:origin: Bkm016/TabooLib

Bukkit.shutdown();

代码示例来源:origin: bitquest/bitquest

System.out.println("Event failed. Shutting down...");
e1.printStackTrace();
Bukkit.shutdown();

相关文章