From 82e86f666911ac573134106f93f059847cdef9b5 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Mon, 2 Dec 2013 23:31:43 +1300 Subject: [PATCH] Fix some errors --- .../disguise/disguisetypes/TargetedDisguise.java | 12 ++++++++++++ .../disguise/utilities/DisguiseUtilities.java | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/me/libraryaddict/disguise/disguisetypes/TargetedDisguise.java b/src/me/libraryaddict/disguise/disguisetypes/TargetedDisguise.java index b3585254..f43a9ad1 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/TargetedDisguise.java +++ b/src/me/libraryaddict/disguise/disguisetypes/TargetedDisguise.java @@ -45,6 +45,18 @@ public abstract class TargetedDisguise extends Disguise { targetType = newTargetType; } + public void silentlySetViewDisguise(String playername) { + if (!disguiseViewers.contains(playername)) { + disguiseViewers.add(playername); + } + } + + public void silentlyUnsetViewDisguise(String playername) { + if (disguiseViewers.contains(playername)) { + disguiseViewers.remove(playername); + } + } + public void setViewDisguise(String playername) { if (!disguiseViewers.contains(playername)) { disguiseViewers.add(playername); diff --git a/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java b/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java index 2ee10ec6..597830d0 100644 --- a/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java +++ b/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java @@ -65,7 +65,7 @@ public class DisguiseUtilities { d.unsetViewDisguise(name); } else { for (String playername : disguise.getObservers()) { - d.unsetViewDisguise(playername); + d.silentlyUnsetViewDisguise(playername); } } } else if (disguise.getTargetType() == TargetType.SHOW_TO_EVERYONE_BUT_THESE_PLAYERS) { @@ -90,7 +90,7 @@ public class DisguiseUtilities { d.setViewDisguise(name); } else { for (String playername : disguise.getObservers()) { - d.setViewDisguise(playername); + d.silentlySetViewDisguise(playername); } } } else if (disguise.getTargetType() == TargetType.SHOW_TO_EVERYONE_BUT_THESE_PLAYERS) {