From 61e021e463f92fc4724e6bbe912b137a3c7c4763 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sat, 25 Dec 2021 18:12:18 +1300 Subject: [PATCH] Fix a concurrent modification error when calling disguiseToAll wrongly --- .../src/main/java/me/libraryaddict/disguise/DisguiseAPI.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin/src/main/java/me/libraryaddict/disguise/DisguiseAPI.java b/plugin/src/main/java/me/libraryaddict/disguise/DisguiseAPI.java index d7a3074a..7dd1852d 100644 --- a/plugin/src/main/java/me/libraryaddict/disguise/DisguiseAPI.java +++ b/plugin/src/main/java/me/libraryaddict/disguise/DisguiseAPI.java @@ -3,6 +3,7 @@ package me.libraryaddict.disguise; import com.comphenix.protocol.wrappers.WrappedDataWatcher; import com.comphenix.protocol.wrappers.WrappedGameProfile; import com.comphenix.protocol.wrappers.WrappedWatchableObject; +import java.util.ArrayList; import me.libraryaddict.disguise.disguisetypes.*; import me.libraryaddict.disguise.disguisetypes.TargetedDisguise.TargetType; import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher; @@ -282,7 +283,7 @@ public class DisguiseAPI { // You called the disguiseToAll method foolish mortal! Prepare to have your custom settings wiped!!! ((TargetedDisguise) disguise).setDisguiseTarget(TargetType.SHOW_TO_EVERYONE_BUT_THESE_PLAYERS); - for (String observer : ((TargetedDisguise) disguise).getObservers()) { + for (String observer : new ArrayList<>(((TargetedDisguise) disguise).getObservers())) { ((TargetedDisguise) disguise).removePlayer(observer); }