Skip to content

Commit

Permalink
fix some more bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Miqhtiedev committed Jan 20, 2021
1 parent a3cef16 commit 4f5c66d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/main/java/me/miqhtie/deathswap/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
1 change: 0 additions & 1 deletion src/main/java/me/miqhtie/deathswap/events/DeathEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
public class DeathEvent implements Listener {
@EventHandler
public void death(PlayerDeathEvent event) {
// event.setDeathMessage(null);
Main.instance.checkForWinner(event.getEntity());
}
}
10 changes: 8 additions & 2 deletions src/main/java/me/miqhtie/deathswap/tasks/StartTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,27 @@ public class StartTask extends BukkitRunnable {
public void run() {
final ArrayList<Player> 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;

Expand Down

0 comments on commit 4f5c66d

Please sign in to comment.