From ed64b2e60afe9d379cb387ffd05f9e20bdb2f783 Mon Sep 17 00:00:00 2001 From: NichtStudioCode <51272202+NichtStudioCode@users.noreply.github.com> Date: Thu, 28 Jan 2021 17:26:47 +0100 Subject: [PATCH] Minor changes Removed one unnecessary Exception Fixed spelling --- .../de/studiocode/invgui/animation/impl/BaseAnimation.java | 2 +- .../java/de/studiocode/invgui/window/impl/BaseWindow.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/studiocode/invgui/animation/impl/BaseAnimation.java b/src/main/java/de/studiocode/invgui/animation/impl/BaseAnimation.java index bc06e6e..1969e1d 100644 --- a/src/main/java/de/studiocode/invgui/animation/impl/BaseAnimation.java +++ b/src/main/java/de/studiocode/invgui/animation/impl/BaseAnimation.java @@ -70,7 +70,7 @@ public abstract class BaseAnimation implements Animation { @Override public void start() { task = Bukkit.getScheduler().runTaskTimer(InvGui.getInstance().getPlugin(), () -> { - // if there are now viewers for more than 3 ticks, the animation can be cancelled + // if there are no viewers for more than 3 ticks, the animation can be cancelled if (getViewers().isEmpty()) { noViewerTicks++; if (noViewerTicks > 3) { diff --git a/src/main/java/de/studiocode/invgui/window/impl/BaseWindow.java b/src/main/java/de/studiocode/invgui/window/impl/BaseWindow.java index 40002a3..d5348b4 100644 --- a/src/main/java/de/studiocode/invgui/window/impl/BaseWindow.java +++ b/src/main/java/de/studiocode/invgui/window/impl/BaseWindow.java @@ -165,13 +165,13 @@ public abstract class BaseWindow implements Window, GUIParent { @Override public void closeForViewer() { closeable = true; - new ArrayList<>(inventory.getViewers()).forEach(HumanEntity::closeInventory); // clone list to prevent ConcurrentModificationException + // clone list to prevent ConcurrentModificationException + new ArrayList<>(inventory.getViewers()).forEach(HumanEntity::closeInventory); } @Override public void show() { if (closed) throw new IllegalStateException("The Window has already been closed."); - if (inventory.getViewers().size() != 0) throw new IllegalStateException("A Window can only have one viewer."); Player viewer = getViewer(); if (viewer == null) throw new IllegalStateException("The player is not online.");