Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class StartEndCommand implements CommandExecutor {
- private Main instance;
- public StartEndCommand(Main instance) {
- this.instance = instance;
- }
- ScoreboardAPI sc = new ScoreboardAPI();
- int counttime = 10;
- public Double arena(Player p) {
- FileConfiguration config = instance.getConfig();
- for (Double a = config.getDouble("spawn.arena1.x"); a < config.getDouble("spawn.arena2.x"); a++) {
- for (Double a1 = config.getDouble("spawn.arena2.x"); a < config.getDouble("spawn.arena1.x"); a++) {
- for (Double i = config.getDouble("spawn.arena1.y"); a < config.getDouble("spawn.arena2.y"); a++) {
- for (Double i1 = config.getDouble("spawn.arena2.y"); a < config.getDouble("spawn.arena1.y"); a++) {
- for (Double u = config.getDouble("spawn.arena1.z"); a < config.getDouble("spawn.arena2.z"); a++) {
- Block block = p.getWorld().getBlockAt(new Location(p.getWorld(), a, i, u));
- block.setTypeIdAndData(35, (byte) 4, true);
- for (Double u1 = config.getDouble("spawn.arena2.z"); a < config.getDouble("spawn.arena1.z"); a++) {
- Block block1 = p.getWorld().getBlockAt(new Location(p.getWorld(), a1, i1, u1));
- block1.setTypeIdAndData(35, (byte) 4, true);
- }
- }
- }
- }
- }
- }
- return null;
- }
- public boolean onCommand(final CommandSender send, Command cmd, String label, String[] args) {
- final FileConfiguration config = instance.getConfig();
- if (cmd.getName().equalsIgnoreCase("start")) {
- for (final Player p : Bukkit.getOnlinePlayers()) {
- arena(p);
- new BukkitRunnable() {
- final Location loc = p.getLocation();
- final org.bukkit.World world = p.getWorld();
- public void run() {
- if (counttime == 0) {
- p.teleport(new Location(world, config.getDouble("spawn.game.x"), config.getDouble("spawn.game.y"), config.getDouble("spawn.game.z")));
- p.sendTitle("ゲームスタート", "~~Block Party~~", 50, 50, 50);
- sc.bp.setDisplaySlot(DisplaySlot.SIDEBAR);
- this.cancel();
- }
- else {
- p.sendMessage(ChatColor.YELLOW + "ゲーム開始まで " + ChatColor.RESET + String.valueOf(counttime) + ChatColor.YELLOW + "秒");
- p.playSound(loc, Sound.UI_BUTTON_CLICK, 50, 50);
- }
- counttime--;
- }
- }.runTaskTimer(instance, 0L, 20L);
- new BukkitRunnable() {
- int round = 20;
- int round_starttime = 20;
- int default_round = 20;
- int save_round_time = 20;
- String sc_player = null;
- String sc_spec = null;
- Boolean a = false;
- public void run() {
- if (round == 0 && sc.bp_player.getSize() == 0) {
- p.sendTitle("ゲーム終了", "~~Block Party~~", 50, 50, 50);
- this.cancel();
- }
- if (round_starttime == 0) {
- a=false;
- round_starttime+=(save_round_time-1);
- save_round_time-=1;
- }
- else {
- a=true;
- TextComponent timer = new TextComponent();
- timer.setText(String.valueOf(round_starttime));
- p.spigot().sendMessage(ChatMessageType.ACTION_BAR, timer);
- round_starttime--;
- }
- if (a == true) {
- arena(p);
- send.sendMessage("あいうえお");
- }
- if (sc_player != null) {
- sc.bp.getScoreboard().resetScores(sc_player);
- }
- sc_player = (ChatColor.GREEN + " プレイヤー: " + sc.bp_player.getSize());
- sc.bp.getScore(sc_player).setScore(9);
- if (sc_spec != null) {
- sc.bp.getScoreboard().resetScores(sc_spec);
- }
- sc_spec = (ChatColor.GRAY + " 観戦者: " + sc.bp_spec.getSize());
- sc.bp.getScore(sc_spec).setScore(8);
- }
- }.runTaskTimer(instance, 0L, 20L);
- }
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement