From 4f5c66d02731541d4acefcf47b49d9ad2df6bc6f Mon Sep 17 00:00:00 2001 From: Miqhtie Date: Tue, 19 Jan 2021 23:46:27 -0500 Subject: [PATCH] fix some more bugs --- src/main/java/me/miqhtie/deathswap/Main.java | 4 ++-- .../java/me/miqhtie/deathswap/events/DeathEvent.java | 1 - .../java/me/miqhtie/deathswap/tasks/StartTask.java | 10 ++++++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/me/miqhtie/deathswap/Main.java b/src/main/java/me/miqhtie/deathswap/Main.java index 33bec3a..c53f2d3 100644 --- a/src/main/java/me/miqhtie/deathswap/Main.java +++ b/src/main/java/me/miqhtie/deathswap/Main.java @@ -84,8 +84,8 @@ public boolean canBeStarted(){ public void randomTeleport(World world) { int x = world.getSpawnLocation().getBlockX(); int z = world.getSpawnLocation().getBlockZ(); - int minDistance = 50; - int maxRange = 1000; + int minDistance = 20; + int maxRange = 250; String players = "@a"; Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), String.format("spreadplayers %s %s %s %s %s %s", x, z ,minDistance, maxRange, false, players)); } diff --git a/src/main/java/me/miqhtie/deathswap/events/DeathEvent.java b/src/main/java/me/miqhtie/deathswap/events/DeathEvent.java index 2dbdbb7..f406785 100644 --- a/src/main/java/me/miqhtie/deathswap/events/DeathEvent.java +++ b/src/main/java/me/miqhtie/deathswap/events/DeathEvent.java @@ -12,7 +12,6 @@ public class DeathEvent implements Listener { @EventHandler public void death(PlayerDeathEvent event) { -// event.setDeathMessage(null); Main.instance.checkForWinner(event.getEntity()); } } diff --git a/src/main/java/me/miqhtie/deathswap/tasks/StartTask.java b/src/main/java/me/miqhtie/deathswap/tasks/StartTask.java index 00f67e3..9ad7efc 100644 --- a/src/main/java/me/miqhtie/deathswap/tasks/StartTask.java +++ b/src/main/java/me/miqhtie/deathswap/tasks/StartTask.java @@ -15,21 +15,27 @@ public class StartTask extends BukkitRunnable { public void run() { final ArrayList onlinePlayers = (new ArrayList<>(Bukkit.getOnlinePlayers())); + World world = null; for(Player p : onlinePlayers) { + world = p.getWorld(); p.sendTitle(ChatColor.GREEN + "The game is now STARTING", "", 0, 40, 0); p.setHealth(20); p.setSaturation(0); p.setGameMode(GameMode.SURVIVAL); } -// Main.instance.getServer().dispatchCommand( Main.instance.getServer().getConsoleSender(), "worldborder set 1000"); + if(world != null){ + world.getWorldBorder().setCenter(world.getSpawnLocation()); + world.getWorldBorder().setSize(1000); + } + Main.instance.getServer().dispatchCommand( Main.instance.getServer().getConsoleSender(), "time set 0"); Main.instance.getServer().dispatchCommand( Main.instance.getServer().getConsoleSender(), "save-off"); Main.instance.getServer().dispatchCommand( Main.instance.getServer().getConsoleSender(), "gamerule spectatorsGenerateChunks false"); Main.instance.minSwapTime = Main.instance.getConfig().getInt("minSwapTime"); Main.instance.maxSwapTime = Main.instance.getConfig().getInt("maxSwapTime"); -// Main.instance.randomTeleport(onlinePlayers.get(0).getWorld()); + Main.instance.randomTeleport(onlinePlayers.get(0).getWorld()); Main.instance.playersInGame = onlinePlayers;