Only allow one editor instance per player

This commit is contained in:
PikaMug 2019-06-11 13:54:31 -04:00
parent 2360f68eda
commit f8456a66fc
2 changed files with 13 additions and 2 deletions

View File

@ -436,7 +436,12 @@ public class CmdExecutor implements CommandExecutor {
private boolean questsActions(final CommandSender cs) {
if (cs.hasPermission("quests.events.*") || cs.hasPermission("quests.actions.*")
|| cs.hasPermission("quests.actions.editor") || cs.hasPermission("quests.events.editor")) {
plugin.getEventFactory().getConversationFactory().buildConversation((Conversable) cs).begin();
Conversable c = (Conversable) cs;
if (!c.isConversing()) {
plugin.getEventFactory().getConversationFactory().buildConversation(c).begin();
} else {
cs.sendMessage(ChatColor.RED + Lang.get("duplicateEditor"));
}
} else {
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
}
@ -445,7 +450,12 @@ public class CmdExecutor implements CommandExecutor {
private boolean questsEditor(final CommandSender cs) {
if (cs.hasPermission("quests.editor.*") || cs.hasPermission("quests.editor.editor")) {
plugin.getQuestFactory().getConversationFactory().buildConversation((Conversable) cs).begin();
Conversable c = (Conversable) cs;
if (!c.isConversing()) {
plugin.getQuestFactory().getConversationFactory().buildConversation(c).begin();
} else {
cs.sendMessage(ChatColor.RED + Lang.get("duplicateEditor"));
}
} else {
cs.sendMessage(ChatColor.RED + Lang.get("NoPermission"));
}

View File

@ -863,4 +863,5 @@ timerStart: "%green%You have%red% <time> seconds%green% to finish this quest/sta
questErrorReadingFile: "Error reading Quests file."
questSaveError: "An error occurred while saving."
noPermission: "You do not have permission to do that."
duplicateEditor: "You are already using an editor!"
difference: "The difference is '<data>'."