From 8d4284138f59905cf4f47e630eab1c57cde3209c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beatrice=20Dellac=C3=A0?= Date: Sat, 12 Nov 2022 01:25:55 +0100 Subject: [PATCH] Fix OutOfBounds errors --- .../limbomanager/objects/LocationCheckRunnable.java | 6 ++---- src/main/resources/config.yml | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/wtf/beatrice/limbomanager/objects/LocationCheckRunnable.java b/src/main/java/wtf/beatrice/limbomanager/objects/LocationCheckRunnable.java index 3af5f7b..5386f58 100644 --- a/src/main/java/wtf/beatrice/limbomanager/objects/LocationCheckRunnable.java +++ b/src/main/java/wtf/beatrice/limbomanager/objects/LocationCheckRunnable.java @@ -26,8 +26,6 @@ public class LocationCheckRunnable implements Runnable public void run() { // if we checked all players, refill the list and skip the check for this time (in case server is empty). - - if(playersToCheck.isEmpty()) { playersToCheck.addAll(Bukkit.getServer().getOnlinePlayers()); return; @@ -37,8 +35,8 @@ public class LocationCheckRunnable implements Runnable Player player = null; while(player == null || !player.isOnline()) // check if player left and in case, move to next one { - player = playersToCheck.get(0); - playersToCheck.remove(player); + if(!playersToCheck.isEmpty()) player = playersToCheck.get(0); + if(player != null) playersToCheck.remove(player); } Location playerLocation = player.getLocation(); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index be57d82..2062ac2 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,6 +1,6 @@ sizing: island-distance: 500 - allowed-range: 100 + allowed-range: 50 island: world-name: world spawn-offset: