From ecaf8cb06b597150a56b2645618352d0c53374c3 Mon Sep 17 00:00:00 2001 From: PikaMug <2267126+PikaMug@users.noreply.github.com> Date: Sun, 23 Aug 2020 21:25:25 -0400 Subject: [PATCH] Use smaller object footprint when abandoning conversation --- .../main/java/me/blackvein/quests/QuestFactory.java | 8 ++++---- .../me/blackvein/quests/actions/ActionFactory.java | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/main/src/main/java/me/blackvein/quests/QuestFactory.java b/main/src/main/java/me/blackvein/quests/QuestFactory.java index efce20614..7c48da22b 100644 --- a/main/src/main/java/me/blackvein/quests/QuestFactory.java +++ b/main/src/main/java/me/blackvein/quests/QuestFactory.java @@ -136,10 +136,10 @@ public class QuestFactory implements ConversationAbandonedListener { if (abandonedEvent.getContext().getSessionData(CK.Q_NAME) != null) { editingQuestNames.remove(abandonedEvent.getContext().getSessionData(CK.Q_NAME)); } - final Player player = (Player) abandonedEvent.getContext().getForWhom(); - selectedBlockStarts.remove(player.getUniqueId()); - selectedKillLocations.remove(player.getUniqueId()); - selectedReachLocations.remove(player.getUniqueId()); + final UUID uuid = ((Player) abandonedEvent.getContext().getForWhom()).getUniqueId(); + selectedBlockStarts.remove(uuid); + selectedKillLocations.remove(uuid); + selectedReachLocations.remove(uuid); } public Prompt returnToMenu(final ConversationContext context) { diff --git a/main/src/main/java/me/blackvein/quests/actions/ActionFactory.java b/main/src/main/java/me/blackvein/quests/actions/ActionFactory.java index 30f045f02..60ac817ce 100644 --- a/main/src/main/java/me/blackvein/quests/actions/ActionFactory.java +++ b/main/src/main/java/me/blackvein/quests/actions/ActionFactory.java @@ -126,12 +126,12 @@ public class ActionFactory implements ConversationAbandonedListener { @Override public void conversationAbandoned(final ConversationAbandonedEvent abandonedEvent) { - final Player player = (Player) abandonedEvent.getContext().getForWhom(); - selectedExplosionLocations.remove(player.getUniqueId()); - selectedEffectLocations.remove(player.getUniqueId()); - selectedMobLocations.remove(player.getUniqueId()); - selectedLightningLocations.remove(player.getUniqueId()); - selectedTeleportLocations.remove(player.getUniqueId()); + final UUID uuid = ((Player) abandonedEvent.getContext().getForWhom()).getUniqueId(); + selectedExplosionLocations.remove(uuid); + selectedEffectLocations.remove(uuid); + selectedMobLocations.remove(uuid); + selectedLightningLocations.remove(uuid); + selectedTeleportLocations.remove(uuid); } public Prompt returnToMenu(final ConversationContext context) {