From c0f5b17975288d0cd334c8299bd221ca37d0f771 Mon Sep 17 00:00:00 2001 From: PikaMug <2267126+PikaMug@users.noreply.github.com> Date: Sun, 11 Oct 2020 01:57:30 -0400 Subject: [PATCH] NEW console logging of taking and quitting quests --- main/src/main/java/me/blackvein/quests/QuestFactory.java | 8 ++++---- main/src/main/java/me/blackvein/quests/Quester.java | 6 ++++++ .../java/me/blackvein/quests/actions/ActionFactory.java | 8 ++++---- .../me/blackvein/quests/conditions/ConditionFactory.java | 8 ++++---- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/main/src/main/java/me/blackvein/quests/QuestFactory.java b/main/src/main/java/me/blackvein/quests/QuestFactory.java index 74ceea40a..55bad1168 100644 --- a/main/src/main/java/me/blackvein/quests/QuestFactory.java +++ b/main/src/main/java/me/blackvein/quests/QuestFactory.java @@ -587,9 +587,9 @@ public class QuestFactory implements ConversationAbandonedListener { plugin.reload(callback); context.getForWhom().sendRawMessage(ChatColor.GREEN + Lang.get("questDeleted")); if (plugin.getSettings().getConsoleLogging() > 0) { - final String name = context.getForWhom() instanceof Player ? + final String identifier = context.getForWhom() instanceof Player ? "Player " + ((Player)context.getForWhom()).getUniqueId() : "CONSOLE"; - plugin.getLogger().info(name + " deleted quest " + quest); + plugin.getLogger().info(identifier + " deleted quest " + quest); } } @@ -632,9 +632,9 @@ public class QuestFactory implements ConversationAbandonedListener { savePlanner(context, section); saveOptions(context, section); if (plugin.getSettings().getConsoleLogging() > 0) { - final String name = context.getForWhom() instanceof Player ? + final String identifier = context.getForWhom() instanceof Player ? "Player " + ((Player)context.getForWhom()).getUniqueId() : "CONSOLE"; - plugin.getLogger().info(name + " saved quest " + (String) context.getSessionData(CK.Q_NAME)); + plugin.getLogger().info(identifier + " saved quest " + (String) context.getSessionData(CK.Q_NAME)); } } diff --git a/main/src/main/java/me/blackvein/quests/Quester.java b/main/src/main/java/me/blackvein/quests/Quester.java index 8f41a249d..184a42773 100644 --- a/main/src/main/java/me/blackvein/quests/Quester.java +++ b/main/src/main/java/me/blackvein/quests/Quester.java @@ -539,6 +539,9 @@ public class Quester { addEmptiesFor(q, 0); try { currentQuests.put(q, 0); + if (plugin.getSettings().getConsoleLogging() > 1) { + plugin.getLogger().info(getPlayer().getUniqueId() + " started quest " + q.getName()); + } } catch (final NullPointerException npe) { plugin.getLogger().severe("Unable to add quest" + q.getName() + " for player " + player.getName() + ". Consider resetting player data or report on Github"); @@ -671,6 +674,9 @@ public class Quester { return; } hardQuit(quest); + if (plugin.getSettings().getConsoleLogging() > 1) { + plugin.getLogger().info(getPlayer().getUniqueId() + " quit quest " + quest.getName()); + } for (final String message : messages) { if (message != null && !message.equals("") && getPlayer().isOnline()) { getPlayer().sendMessage(message); 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 63b3f1ce2..c52adfcb9 100644 --- a/main/src/main/java/me/blackvein/quests/actions/ActionFactory.java +++ b/main/src/main/java/me/blackvein/quests/actions/ActionFactory.java @@ -302,9 +302,9 @@ public class ActionFactory implements ConversationAbandonedListener { plugin.reload(callback); context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("eventEditorDeleted")); if (plugin.getSettings().getConsoleLogging() > 0) { - final String name = context.getForWhom() instanceof Player ? + final String identifier = context.getForWhom() instanceof Player ? "Player " + ((Player)context.getForWhom()).getUniqueId() : "CONSOLE"; - plugin.getLogger().info(name + " deleted action " + action); + plugin.getLogger().info(identifier + " deleted action " + action); } for (final Quester q : plugin.getQuesters()) { for (final Quest quest : q.getCurrentQuests().keySet()) { @@ -465,9 +465,9 @@ public class ActionFactory implements ConversationAbandonedListener { plugin.reload(callback); context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("eventEditorSaved")); if (plugin.getSettings().getConsoleLogging() > 0) { - final String name = context.getForWhom() instanceof Player ? + final String identifier = context.getForWhom() instanceof Player ? "Player " + ((Player)context.getForWhom()).getUniqueId() : "CONSOLE"; - plugin.getLogger().info(name + " saved action " + (String) context.getSessionData(CK.E_NAME)); + plugin.getLogger().info(identifier + " saved action " + (String) context.getSessionData(CK.E_NAME)); } for (final Quester q : plugin.getQuesters()) { for (final Quest quest : q.getCurrentQuests().keySet()) { diff --git a/main/src/main/java/me/blackvein/quests/conditions/ConditionFactory.java b/main/src/main/java/me/blackvein/quests/conditions/ConditionFactory.java index b1e6e07dd..352aee9c2 100644 --- a/main/src/main/java/me/blackvein/quests/conditions/ConditionFactory.java +++ b/main/src/main/java/me/blackvein/quests/conditions/ConditionFactory.java @@ -144,9 +144,9 @@ public class ConditionFactory implements ConversationAbandonedListener { plugin.reload(callback); context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("conditionEditorDeleted")); if (plugin.getSettings().getConsoleLogging() > 0) { - final String name = context.getForWhom() instanceof Player ? + final String identifier = context.getForWhom() instanceof Player ? "Player " + ((Player)context.getForWhom()).getUniqueId() : "CONSOLE"; - plugin.getLogger().info(name + " deleted condition " + condition); + plugin.getLogger().info(identifier + " deleted condition " + condition); } for (final Quester q : plugin.getQuesters()) { for (final Quest quest : q.getCurrentQuests().keySet()) { @@ -215,9 +215,9 @@ public class ConditionFactory implements ConversationAbandonedListener { plugin.reload(callback); context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("conditionEditorSaved")); if (plugin.getSettings().getConsoleLogging() > 0) { - final String name = context.getForWhom() instanceof Player ? + final String identifier = context.getForWhom() instanceof Player ? "Player " + ((Player)context.getForWhom()).getUniqueId() : "CONSOLE"; - plugin.getLogger().info(name + " saved condition " + (String) context.getSessionData(CK.C_NAME)); + plugin.getLogger().info(identifier + " saved condition " + (String) context.getSessionData(CK.C_NAME)); } for (final Quester q : plugin.getQuesters()) { for (final Quest quest : q.getCurrentQuests().keySet()) {