diff --git a/src/main/java/me/funky/praxi/arena/Arena.java b/src/main/java/me/funky/praxi/arena/Arena.java index 5da62d2..9a56f64 100644 --- a/src/main/java/me/funky/praxi/arena/Arena.java +++ b/src/main/java/me/funky/praxi/arena/Arena.java @@ -8,7 +8,9 @@ import me.funky.praxi.arena.impl.StandaloneArena; import me.funky.praxi.kit.Kit; import me.funky.praxi.util.LocationUtil; +import org.bukkit.Chunk; import org.bukkit.Location; +import org.bukkit.World; import org.bukkit.configuration.file.FileConfiguration; import java.util.ArrayList; @@ -146,10 +148,22 @@ public boolean isSetup() { } public int getMaxBuildHeight() { - int highest = (int) (spawnA.getY() >= spawnB.getY() ? spawnA.getY() : spawnB.getY()); + int highest = (int) (Math.max(spawnA.getY(), spawnB.getY())); return highest + 5; } + public void unloadArena(){ + for(Chunk chunk : getChunks()) { + chunk.getWorld().unloadChunk(chunk); + } + } + + public void loadArena(){ + for(Chunk chunk : getChunks()) { + chunk.getWorld().loadChunk(chunk); + } + } + public Location getSpawnA() { if (spawnA == null) { return null; diff --git a/src/main/java/me/funky/praxi/kit/menu/KitEditorSelectKitMenu.java b/src/main/java/me/funky/praxi/kit/menu/KitEditorSelectKitMenu.java index 19dfaa4..c8f0806 100644 --- a/src/main/java/me/funky/praxi/kit/menu/KitEditorSelectKitMenu.java +++ b/src/main/java/me/funky/praxi/kit/menu/KitEditorSelectKitMenu.java @@ -39,7 +39,7 @@ public Map getButtons(Player player) { Map buttons = new HashMap<>(); AtomicInteger i = new AtomicInteger(10); Kit.getKits().forEach(kit -> { - if (kit.isEnabled()) { + if (kit.isEnabled() && kit.getKitLoadout().getContents() != null) { buttons.put(i.getAndIncrement(), new KitDisplayButton(kit)); } }); diff --git a/src/main/java/me/funky/praxi/match/Match.java b/src/main/java/me/funky/praxi/match/Match.java index 67107d2..88ebf05 100644 --- a/src/main/java/me/funky/praxi/match/Match.java +++ b/src/main/java/me/funky/praxi/match/Match.java @@ -188,6 +188,7 @@ public Player getOpponent(Player player) { public void start() { + arena.loadArena(); // Set state state = MatchState.STARTING_ROUND; @@ -229,6 +230,7 @@ public void start() { } public void end() { + arena.unloadArena(); for (GameParticipant gameParticipant : getParticipants()) { for (MatchGamePlayer gamePlayer : gameParticipant.getPlayers()) { if (!gamePlayer.isDisconnected()) { diff --git a/src/main/java/me/funky/praxi/profile/ProfileListener.java b/src/main/java/me/funky/praxi/profile/ProfileListener.java index 94333d7..c0770b0 100644 --- a/src/main/java/me/funky/praxi/profile/ProfileListener.java +++ b/src/main/java/me/funky/praxi/profile/ProfileListener.java @@ -10,6 +10,7 @@ import me.funky.praxi.profile.option.OptionsOpenedEvent; import me.funky.praxi.profile.visibility.VisibilityLogic; import me.funky.praxi.util.CC; +import org.apache.logging.log4j.core.net.Priority; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameMode; @@ -117,7 +118,7 @@ public void onAsyncPlayerPreLoginEvent(AsyncPlayerPreLoginEvent event) { Profile.getProfiles().put(event.getUniqueId(), profile); } - @EventHandler + @EventHandler(priority = EventPriority.MONITOR) public void onPlayerJoinEvent(PlayerJoinEvent event) { event.setJoinMessage(null); Praxi.getInstance().getEssentials().teleportToSpawn(event.getPlayer()); @@ -138,7 +139,7 @@ public void run() { }.runTaskLater(Praxi.getInstance(), 10L); } - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.MONITOR) public void onPlayerQuitEvent(PlayerQuitEvent event) { event.setQuitMessage(null); Profile profile = Profile.getProfiles().get(event.getPlayer().getUniqueId());