From 7061f0117f2aec80c606b4fabab69b09204ce193 Mon Sep 17 00:00:00 2001 From: iceBear67 Date: Wed, 16 Oct 2024 10:41:53 +0800 Subject: [PATCH] Fix a bug in setting player slots --- src/main/java/dev/tylerm/khs/game/PlayerLoader.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/tylerm/khs/game/PlayerLoader.java b/src/main/java/dev/tylerm/khs/game/PlayerLoader.java index 7fd92cd..bee5406 100644 --- a/src/main/java/dev/tylerm/khs/game/PlayerLoader.java +++ b/src/main/java/dev/tylerm/khs/game/PlayerLoader.java @@ -90,7 +90,7 @@ public static void resetPlayer(Player player, Board board) { loadPlayer(player); if (board.isSeeker(player)) { if (pvpEnabled) { - for (int i = 0; i < 9; i++) { + for (int i = 0; i < Math.min(9, SEEKER_ITEMS.size()); i++) { if (SEEKER_ITEMS.get(i) == null) continue; player.getInventory().setItem(i, SEEKER_ITEMS.get(i)); } @@ -107,7 +107,7 @@ public static void resetPlayer(Player player, Board board) { player.addPotionEffect(effect); } else if (board.isHider(player)) { if (pvpEnabled) { - for (int i = 0; i < 9; i++) { + for (int i = 0; i < Math.min(9, SEEKER_ITEMS.size()); i++) { if (HIDER_ITEMS.get(i) == null) continue; player.getInventory().setItem(i, HIDER_ITEMS.get(i)); }