mirror of
https://github.com/PikaMug/Quests.git
synced 2025-02-08 08:31:19 +01:00
NEW console logging of editor save and delete operations
This commit is contained in:
parent
5ae6d357e8
commit
198cf2f9b2
@ -553,12 +553,12 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
data.load(questsFile);
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
.replace("<quest>", questsFile.getName()));
|
||||
return;
|
||||
} catch (final InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
.replace("<quest>", questsFile.getName()));
|
||||
return;
|
||||
}
|
||||
@ -573,7 +573,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
try {
|
||||
data.save(questsFile);
|
||||
} catch (final IOException e) {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questSaveError"));
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questSaveError"));
|
||||
return;
|
||||
}
|
||||
final ReloadCallback<Boolean> callback = new ReloadCallback<Boolean>() {
|
||||
@ -586,6 +586,11 @@ 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 ?
|
||||
"Player " + ((Player)context.getForWhom()).getUniqueId() : "CONSOLE";
|
||||
plugin.getLogger().info(name + " deleted quest " + quest);
|
||||
}
|
||||
}
|
||||
|
||||
public void saveQuest(final ConversationContext context, final ConfigurationSection section) {
|
||||
@ -626,6 +631,11 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
saveRewards(context, section);
|
||||
savePlanner(context, section);
|
||||
saveOptions(context, section);
|
||||
if (plugin.getSettings().getConsoleLogging() > 0) {
|
||||
final String name = context.getForWhom() instanceof Player ?
|
||||
"Player " + ((Player)context.getForWhom()).getUniqueId() : "CONSOLE";
|
||||
plugin.getLogger().info(name + " saved quest " + (String) context.getSessionData(CK.Q_NAME));
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -27,6 +27,7 @@ public class Settings {
|
||||
private boolean allowCommandsForNpcQuests = false;
|
||||
private boolean allowPranks = true;
|
||||
private boolean askConfirmation = true;
|
||||
private int consoleLogging = 1;
|
||||
private boolean genFilesOnJoin = true;
|
||||
private boolean ignoreLockedQuests = false;
|
||||
private int killDelay = 0;
|
||||
@ -75,6 +76,12 @@ public class Settings {
|
||||
public void setAskConfirmation(final boolean askConfirmation) {
|
||||
this.askConfirmation = askConfirmation;
|
||||
}
|
||||
public int getConsoleLogging() {
|
||||
return consoleLogging;
|
||||
}
|
||||
public void setConsoleLogging(final int consoleLogging) {
|
||||
this.consoleLogging = consoleLogging;
|
||||
}
|
||||
public boolean canGenFilesOnJoin() {
|
||||
return genFilesOnJoin;
|
||||
}
|
||||
@ -161,6 +168,7 @@ public class Settings {
|
||||
allowCommandsForNpcQuests = config.getBoolean("allow-command-quests-with-npcs", false);
|
||||
allowPranks = config.getBoolean("allow-pranks", true);
|
||||
askConfirmation = config.getBoolean("ask-confirmation", true);
|
||||
consoleLogging = config.getInt("console-logging", 1);
|
||||
genFilesOnJoin = config.getBoolean("generate-files-on-join", true);
|
||||
ignoreLockedQuests = config.getBoolean("ignore-locked-quests", false);
|
||||
killDelay = config.getInt("kill-delay", 600);
|
||||
|
@ -268,12 +268,12 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
data.load(actionsFile);
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
.replace("<file>", actionsFile.getName()));
|
||||
return;
|
||||
} catch (final InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
.replace("<file>", actionsFile.getName()));
|
||||
return;
|
||||
}
|
||||
@ -288,7 +288,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
try {
|
||||
data.save(actionsFile);
|
||||
} catch (final IOException e) {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questSaveError"));
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questSaveError"));
|
||||
return;
|
||||
}
|
||||
final ReloadCallback<Boolean> callback = new ReloadCallback<Boolean>() {
|
||||
@ -300,7 +300,12 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
};
|
||||
plugin.reload(callback);
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW + Lang.get("eventEditorDeleted"));
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("eventEditorDeleted"));
|
||||
if (plugin.getSettings().getConsoleLogging() > 0) {
|
||||
final String name = context.getForWhom() instanceof Player ?
|
||||
"Player " + ((Player)context.getForWhom()).getUniqueId() : "CONSOLE";
|
||||
plugin.getLogger().info(name + " deleted action " + action);
|
||||
}
|
||||
for (final Quester q : plugin.getQuesters()) {
|
||||
for (final Quest quest : q.getCurrentQuests().keySet()) {
|
||||
q.checkQuest(quest);
|
||||
@ -317,12 +322,12 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
data.load(actionsFile);
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
.replace("<file>", actionsFile.getName()));
|
||||
return;
|
||||
} catch (final InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
.replace("<file>", actionsFile.getName()));
|
||||
return;
|
||||
}
|
||||
@ -446,7 +451,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
try {
|
||||
data.save(actionsFile);
|
||||
} catch (final IOException e) {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questSaveError"));
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questSaveError"));
|
||||
return;
|
||||
}
|
||||
final ReloadCallback<Boolean> callback = new ReloadCallback<Boolean>() {
|
||||
@ -458,7 +463,12 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
};
|
||||
plugin.reload(callback);
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW + Lang.get("eventEditorSaved"));
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("eventEditorSaved"));
|
||||
if (plugin.getSettings().getConsoleLogging() > 0) {
|
||||
final String name = context.getForWhom() instanceof Player ?
|
||||
"Player " + ((Player)context.getForWhom()).getUniqueId() : "CONSOLE";
|
||||
plugin.getLogger().info(name + " saved action " + (String) context.getSessionData(CK.E_NAME));
|
||||
}
|
||||
for (final Quester q : plugin.getQuesters()) {
|
||||
for (final Quest quest : q.getCurrentQuests().keySet()) {
|
||||
q.checkQuest(quest);
|
||||
|
@ -115,12 +115,12 @@ public class ConditionFactory implements ConversationAbandonedListener {
|
||||
data.load(conditionsFile);
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
.replace("<file>", conditionsFile.getName()));
|
||||
return;
|
||||
} catch (final InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
.replace("<file>", conditionsFile.getName()));
|
||||
return;
|
||||
}
|
||||
@ -130,7 +130,7 @@ public class ConditionFactory implements ConversationAbandonedListener {
|
||||
try {
|
||||
data.save(conditionsFile);
|
||||
} catch (final IOException e) {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questSaveError"));
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questSaveError"));
|
||||
return;
|
||||
}
|
||||
final ReloadCallback<Boolean> callback = new ReloadCallback<Boolean>() {
|
||||
@ -142,7 +142,12 @@ public class ConditionFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
};
|
||||
plugin.reload(callback);
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW + Lang.get("conditionEditorDeleted"));
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("conditionEditorDeleted"));
|
||||
if (plugin.getSettings().getConsoleLogging() > 0) {
|
||||
final String name = context.getForWhom() instanceof Player ?
|
||||
"Player " + ((Player)context.getForWhom()).getUniqueId() : "CONSOLE";
|
||||
plugin.getLogger().info(name + " deleted condition " + condition);
|
||||
}
|
||||
for (final Quester q : plugin.getQuesters()) {
|
||||
for (final Quest quest : q.getCurrentQuests().keySet()) {
|
||||
q.checkQuest(quest);
|
||||
@ -158,12 +163,12 @@ public class ConditionFactory implements ConversationAbandonedListener {
|
||||
data.load(conditionsFile);
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
.replace("<file>", conditionsFile.getName()));
|
||||
return;
|
||||
} catch (final InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questErrorReadingFile")
|
||||
.replace("<file>", conditionsFile.getName()));
|
||||
return;
|
||||
}
|
||||
@ -196,7 +201,7 @@ public class ConditionFactory implements ConversationAbandonedListener {
|
||||
try {
|
||||
data.save(conditionsFile);
|
||||
} catch (final IOException e) {
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questSaveError"));
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questSaveError"));
|
||||
return;
|
||||
}
|
||||
final ReloadCallback<Boolean> callback = new ReloadCallback<Boolean>() {
|
||||
@ -208,7 +213,12 @@ public class ConditionFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
};
|
||||
plugin.reload(callback);
|
||||
((Player) context.getForWhom()).sendMessage(ChatColor.YELLOW + Lang.get("conditionEditorSaved"));
|
||||
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("conditionEditorSaved"));
|
||||
if (plugin.getSettings().getConsoleLogging() > 0) {
|
||||
final String name = context.getForWhom() instanceof Player ?
|
||||
"Player " + ((Player)context.getForWhom()).getUniqueId() : "CONSOLE";
|
||||
plugin.getLogger().info(name + " saved condition " + (String) context.getSessionData(CK.C_NAME));
|
||||
}
|
||||
for (final Quester q : plugin.getQuesters()) {
|
||||
for (final Quest quest : q.getCurrentQuests().keySet()) {
|
||||
q.checkQuest(quest);
|
||||
|
@ -5,6 +5,7 @@ allow-command-quests-with-npcs: false
|
||||
allow-pranks: true
|
||||
allow-quitting: true
|
||||
ask-confirmation: true
|
||||
console-logging: 1
|
||||
generate-files-on-join: true
|
||||
ignore-locked-quests: false
|
||||
kill-delay: 600
|
||||
|
Loading…
Reference in New Issue
Block a user