From 398b8d673a731c29d5c0c0feb0bd44fd077bb4d6 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Fri, 13 Aug 2021 22:30:17 -0400 Subject: [PATCH] respawn bug fix --- src/main/java/net/tylermurphy/hideAndSeek/Store.java | 3 --- .../net/tylermurphy/hideAndSeek/commands/EnableBorder.java | 4 ++++ .../java/net/tylermurphy/hideAndSeek/commands/SetBorder.java | 4 ++++ src/main/java/net/tylermurphy/hideAndSeek/commands/Start.java | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/tylermurphy/hideAndSeek/Store.java b/src/main/java/net/tylermurphy/hideAndSeek/Store.java index 4c8666a..470deaa 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/Store.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/Store.java @@ -41,12 +41,9 @@ public class Store { public static int getPlayerData(String playerName, String key) { HashMap data = playerData.get(playerName); if(data == null) { - data = new HashMap(); - playerData.put(playerName, data); return 0; } if(data.get(key) == null) { - data.put(key, 0); return 0; } return data.get(key); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/commands/EnableBorder.java b/src/main/java/net/tylermurphy/hideAndSeek/commands/EnableBorder.java index 4aa44ad..6c925e2 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/commands/EnableBorder.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/commands/EnableBorder.java @@ -10,6 +10,10 @@ import static net.tylermurphy.hideAndSeek.Store.*; public class EnableBorder implements ICommand { public void execute(CommandSender sender, String[] args) { + if(!status.equals("Standby") && !status.equals("Setup")) { + sender.sendMessage(errorPrefix + "Game is currently in session"); + return; + } if(worldborderPosition == null) { sender.sendMessage(errorPrefix + "Please setup worldborder info before enabling"); return; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/commands/SetBorder.java b/src/main/java/net/tylermurphy/hideAndSeek/commands/SetBorder.java index 07e69bb..6482c45 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/commands/SetBorder.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/commands/SetBorder.java @@ -12,6 +12,10 @@ import static net.tylermurphy.hideAndSeek.Store.*; public class SetBorder implements ICommand { public void execute(CommandSender sender, String[] args) { + if(!status.equals("Standby") && !status.equals("Setup")) { + sender.sendMessage(errorPrefix + "Game is currently in session"); + return; + } if(spawnPosition == null) { sender.sendMessage(errorPrefix + "Please set spawn position first"); return; diff --git a/src/main/java/net/tylermurphy/hideAndSeek/commands/Start.java b/src/main/java/net/tylermurphy/hideAndSeek/commands/Start.java index 8dc0f5f..1a290c5 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/commands/Start.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/commands/Start.java @@ -47,6 +47,7 @@ public class Start implements ICommand { player.removePotionEffect(effect.getType()); } } + Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), String.format("spawnpoint @a %s %s %s", spawnPosition.getBlockX(), spawnPosition.getBlockY(), spawnPosition.getBlockZ())); for(String playerName : Seeker.getEntries()) { Player player = playerList.get(playerName); if(player != null) {