From 98c76468dbf8f9c83e69cccd8dd102c40469b431 Mon Sep 17 00:00:00 2001 From: PikaMug Date: Sat, 25 May 2019 22:25:42 -0400 Subject: [PATCH] Prevent crashes from /questadmin reset, fixes #799 --- .../java/me/blackvein/quests/listeners/CmdExecutor.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main/src/main/java/me/blackvein/quests/listeners/CmdExecutor.java b/main/src/main/java/me/blackvein/quests/listeners/CmdExecutor.java index c897c1cd2..20f0f67b7 100644 --- a/main/src/main/java/me/blackvein/quests/listeners/CmdExecutor.java +++ b/main/src/main/java/me/blackvein/quests/listeners/CmdExecutor.java @@ -1338,9 +1338,9 @@ public class CmdExecutor implements CommandExecutor { } UUID id = quester.getUUID(); LinkedList temp = plugin.getQuesters(); - for (Quester q : temp) { - if (q.getUUID().equals(id)) { - temp.remove(q); + for(Iterator itr = temp.iterator(); itr.hasNext();) { + if (itr.next().getUUID().equals(id)) { + itr.remove(); } } plugin.setQuesters(temp); @@ -1366,7 +1366,7 @@ public class CmdExecutor implements CommandExecutor { quester.setUUID(id); quester.saveData(); LinkedList temp2 = plugin.getQuesters(); - temp.add(quester); + temp2.add(quester); plugin.setQuesters(temp2); } else { cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));