mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-25 13:13:06 +08:00
Add quest debugging commands
This commit is contained in:
parent
cf56d032de
commit
6869008bcc
@ -1,64 +1,92 @@
|
|||||||
package emu.grasscutter.command.commands;
|
package emu.grasscutter.command.commands;
|
||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
import emu.grasscutter.command.Command;
|
import emu.grasscutter.command.Command;
|
||||||
import emu.grasscutter.command.CommandHandler;
|
import emu.grasscutter.command.CommandHandler;
|
||||||
import emu.grasscutter.game.player.Player;
|
import emu.grasscutter.game.player.Player;
|
||||||
import emu.grasscutter.game.quest.GameQuest;
|
import emu.grasscutter.game.quest.GameQuest;
|
||||||
import java.util.List;
|
|
||||||
|
import java.util.List;
|
||||||
@Command(
|
|
||||||
label = "quest",
|
@Command(
|
||||||
aliases = {"q"},
|
label = "quest",
|
||||||
usage = {"(add|finish) [<questId>]"},
|
aliases = {"q"},
|
||||||
permission = "player.quest",
|
usage = {"(add|finish) [<questId>]"},
|
||||||
permissionTargeted = "player.quest.others")
|
permission = "player.quest",
|
||||||
public final class QuestCommand implements CommandHandler {
|
permissionTargeted = "player.quest.others")
|
||||||
|
public final class QuestCommand implements CommandHandler {
|
||||||
@Override
|
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
@Override
|
||||||
if (args.size() != 2) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
sendUsageMessage(sender);
|
if (args.size() != 2) {
|
||||||
return;
|
sendUsageMessage(sender);
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
String cmd = args.get(0).toLowerCase();
|
|
||||||
int questId;
|
String cmd = args.get(0).toLowerCase();
|
||||||
|
int questId;
|
||||||
try {
|
|
||||||
questId = Integer.parseInt(args.get(1));
|
try {
|
||||||
} catch (Exception e) {
|
questId = Integer.parseInt(args.get(1));
|
||||||
CommandHandler.sendMessage(sender, translate(sender, "commands.quest.invalid_id"));
|
} catch (Exception e) {
|
||||||
return;
|
CommandHandler.sendMessage(sender, translate(sender, "commands.quest.invalid_id"));
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
switch (cmd) {
|
|
||||||
case "add" -> {
|
switch (cmd) {
|
||||||
GameQuest quest = targetPlayer.getQuestManager().addQuest(questId);
|
case "add" -> {
|
||||||
|
GameQuest quest = targetPlayer.getQuestManager().addQuest(questId);
|
||||||
if (quest != null) {
|
|
||||||
CommandHandler.sendMessage(sender, translate(sender, "commands.quest.added", questId));
|
if (quest != null) {
|
||||||
return;
|
CommandHandler.sendMessage(sender, translate(sender, "commands.quest.added", questId));
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
CommandHandler.sendMessage(sender, translate(sender, "commands.quest.not_found"));
|
|
||||||
}
|
CommandHandler.sendMessage(sender, translate(sender, "commands.quest.not_found"));
|
||||||
case "finish" -> {
|
}
|
||||||
GameQuest quest = targetPlayer.getQuestManager().getQuestById(questId);
|
case "finish" -> {
|
||||||
|
GameQuest quest = targetPlayer.getQuestManager().getQuestById(questId);
|
||||||
if (quest == null) {
|
|
||||||
CommandHandler.sendMessage(sender, translate(sender, "commands.quest.not_found"));
|
if (quest == null) {
|
||||||
return;
|
CommandHandler.sendMessage(sender, translate(sender, "commands.quest.not_found"));
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
quest.finish();
|
|
||||||
|
quest.finish();
|
||||||
CommandHandler.sendMessage(sender, translate(sender, "commands.quest.finished", questId));
|
|
||||||
}
|
CommandHandler.sendMessage(sender, translate(sender, "commands.quest.finished", questId));
|
||||||
default -> {
|
}
|
||||||
sendUsageMessage(sender);
|
case "running" -> {
|
||||||
}
|
var quest = targetPlayer.getQuestManager().getQuestById(questId);
|
||||||
}
|
if (quest == null) {
|
||||||
}
|
CommandHandler.sendMessage(sender, translate(sender, "commands.quest.not_found"));
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CommandHandler.sendMessage(sender, translate(sender, "commands.quest.running",
|
||||||
|
questId, translate(sender, switch(quest.state) {
|
||||||
|
case QUEST_STATE_NONE, NONE -> "commands.quest.state.none";
|
||||||
|
case QUEST_STATE_UNSTARTED, UNSTARTED -> "commands.quest.state.unstarted";
|
||||||
|
case QUEST_STATE_UNFINISHED, UNFINISHED -> "commands.quest.state.unfinished";
|
||||||
|
case QUEST_STATE_FINISHED, FINISHED -> "commands.quest.state.finished";
|
||||||
|
case QUEST_STATE_FAILED, FAILED -> "commands.quest.state.failed";
|
||||||
|
}, quest.getState().getValue()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
case "talking" -> {
|
||||||
|
var mainQuest = targetPlayer.getQuestManager().getMainQuestByTalkId(questId);
|
||||||
|
if (mainQuest == null) {
|
||||||
|
CommandHandler.sendMessage(sender, translate(sender, "commands.quest.not_found"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var talk = mainQuest.getTalks().get(questId);
|
||||||
|
CommandHandler.sendMessage(sender, translate(sender, "commands.quest.talking",
|
||||||
|
questId, translate(sender, "commands.quest.state." + (talk == null ? "not_exists" : "exists")),
|
||||||
|
mainQuest.getParentQuestId(), mainQuest.getState().getValue()));
|
||||||
|
}
|
||||||
|
default -> this.sendUsageMessage(sender);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -239,6 +239,17 @@
|
|||||||
"not_found": "Quest not found.",
|
"not_found": "Quest not found.",
|
||||||
"invalid_id": "Invalid quest ID.",
|
"invalid_id": "Invalid quest ID.",
|
||||||
"description": "Add or finish quests",
|
"description": "Add or finish quests",
|
||||||
|
"running": "Quest %s is %s (%s).",
|
||||||
|
"talking": "Talk %s is %s for main quest %s (%s).",
|
||||||
|
"state": {
|
||||||
|
"none": "unknown (none)",
|
||||||
|
"unstarted": "unfinished (not started, not completed)",
|
||||||
|
"unfinished": "unfinished (started, not completed)",
|
||||||
|
"finished": "finished (completed)",
|
||||||
|
"failed": "finished (completed, but failed)",
|
||||||
|
"exists": "found",
|
||||||
|
"not_exists": "not found"
|
||||||
|
},
|
||||||
"enabled": "Questing enabled."
|
"enabled": "Questing enabled."
|
||||||
},
|
},
|
||||||
"group": {
|
"group": {
|
||||||
|
@ -239,6 +239,17 @@
|
|||||||
"not_found": "Misión no encontrada.",
|
"not_found": "Misión no encontrada.",
|
||||||
"invalid_id": "ID de misión inválido.",
|
"invalid_id": "ID de misión inválido.",
|
||||||
"description": "Añade o finaliza misiones",
|
"description": "Añade o finaliza misiones",
|
||||||
|
"running": "🇺🇸Quest %s is %s (%s).",
|
||||||
|
"talking": "🇺🇸Talk %s is %s for main quest %s (%s).",
|
||||||
|
"state": {
|
||||||
|
"none": "🇺🇸unknown (none)",
|
||||||
|
"unstarted": "🇺🇸unfinished (not started, not completed)",
|
||||||
|
"unfinished": "🇺🇸unfinished (started, not completed)",
|
||||||
|
"finished": "🇺🇸finished (completed)",
|
||||||
|
"failed": "🇺🇸finished (completed, but failed)",
|
||||||
|
"exists": "🇺🇸found",
|
||||||
|
"not_exists": "🇺🇸not found"
|
||||||
|
},
|
||||||
"enabled": "🇺🇸Questing enabled."
|
"enabled": "🇺🇸Questing enabled."
|
||||||
},
|
},
|
||||||
"group": {
|
"group": {
|
||||||
|
@ -239,6 +239,17 @@
|
|||||||
"not_found": "Quête introuvable.",
|
"not_found": "Quête introuvable.",
|
||||||
"invalid_id": "ID de la quête invalide.",
|
"invalid_id": "ID de la quête invalide.",
|
||||||
"description": "Ajoute ou termine une quête",
|
"description": "Ajoute ou termine une quête",
|
||||||
|
"running": "🇺🇸Quest %s is %s (%s).",
|
||||||
|
"talking": "🇺🇸Talk %s is %s for main quest %s (%s).",
|
||||||
|
"state": {
|
||||||
|
"none": "🇺🇸unknown (none)",
|
||||||
|
"unstarted": "🇺🇸unfinished (not started, not completed)",
|
||||||
|
"unfinished": "🇺🇸unfinished (started, not completed)",
|
||||||
|
"finished": "🇺🇸finished (completed)",
|
||||||
|
"failed": "🇺🇸finished (completed, but failed)",
|
||||||
|
"exists": "🇺🇸found",
|
||||||
|
"not_exists": "🇺🇸not found"
|
||||||
|
},
|
||||||
"enabled": "Quêtes activées."
|
"enabled": "Quêtes activées."
|
||||||
},
|
},
|
||||||
"group": {
|
"group": {
|
||||||
|
@ -239,6 +239,17 @@
|
|||||||
"not_found": "Missione non trovata.",
|
"not_found": "Missione non trovata.",
|
||||||
"invalid_id": "ID missione non valido.",
|
"invalid_id": "ID missione non valido.",
|
||||||
"description": "Aggiungi o completa missioni",
|
"description": "Aggiungi o completa missioni",
|
||||||
|
"running": "🇺🇸Quest %s is %s (%s).",
|
||||||
|
"talking": "🇺🇸Talk %s is %s for main quest %s (%s).",
|
||||||
|
"state": {
|
||||||
|
"none": "🇺🇸unknown (none)",
|
||||||
|
"unstarted": "🇺🇸unfinished (not started, not completed)",
|
||||||
|
"unfinished": "🇺🇸unfinished (started, not completed)",
|
||||||
|
"finished": "🇺🇸finished (completed)",
|
||||||
|
"failed": "🇺🇸finished (completed, but failed)",
|
||||||
|
"exists": "🇺🇸found",
|
||||||
|
"not_exists": "🇺🇸not found"
|
||||||
|
},
|
||||||
"enabled": "🇺🇸Questing enabled."
|
"enabled": "🇺🇸Questing enabled."
|
||||||
},
|
},
|
||||||
"group": {
|
"group": {
|
||||||
|
@ -239,6 +239,17 @@
|
|||||||
"not_found": "クエストが見つかりません。",
|
"not_found": "クエストが見つかりません。",
|
||||||
"invalid_id": "クエストIDが無効です。",
|
"invalid_id": "クエストIDが無効です。",
|
||||||
"description": "クエストを追加または終了します。",
|
"description": "クエストを追加または終了します。",
|
||||||
|
"running": "🇺🇸Quest %s is %s (%s).",
|
||||||
|
"talking": "🇺🇸Talk %s is %s for main quest %s (%s).",
|
||||||
|
"state": {
|
||||||
|
"none": "🇺🇸unknown (none)",
|
||||||
|
"unstarted": "🇺🇸unfinished (not started, not completed)",
|
||||||
|
"unfinished": "🇺🇸unfinished (started, not completed)",
|
||||||
|
"finished": "🇺🇸finished (completed)",
|
||||||
|
"failed": "🇺🇸finished (completed, but failed)",
|
||||||
|
"exists": "🇺🇸found",
|
||||||
|
"not_exists": "🇺🇸not found"
|
||||||
|
},
|
||||||
"enabled": "🇺🇸Questing enabled."
|
"enabled": "🇺🇸Questing enabled."
|
||||||
},
|
},
|
||||||
"group": {
|
"group": {
|
||||||
|
@ -239,6 +239,17 @@
|
|||||||
"not_found": "퀘스트를 찾을 수 없습니다.",
|
"not_found": "퀘스트를 찾을 수 없습니다.",
|
||||||
"invalid_id": "퀘스트ID를 찾을 수 없습니다.",
|
"invalid_id": "퀘스트ID를 찾을 수 없습니다.",
|
||||||
"description": "퀘스트를 추가하거나 완료합니다.",
|
"description": "퀘스트를 추가하거나 완료합니다.",
|
||||||
|
"running": "🇺🇸Quest %s is %s (%s).",
|
||||||
|
"talking": "🇺🇸Talk %s is %s for main quest %s (%s).",
|
||||||
|
"state": {
|
||||||
|
"none": "🇺🇸unknown (none)",
|
||||||
|
"unstarted": "🇺🇸unfinished (not started, not completed)",
|
||||||
|
"unfinished": "🇺🇸unfinished (started, not completed)",
|
||||||
|
"finished": "🇺🇸finished (completed)",
|
||||||
|
"failed": "🇺🇸finished (completed, but failed)",
|
||||||
|
"exists": "🇺🇸found",
|
||||||
|
"not_exists": "🇺🇸not found"
|
||||||
|
},
|
||||||
"enabled": "🇺🇸Questing enabled."
|
"enabled": "🇺🇸Questing enabled."
|
||||||
},
|
},
|
||||||
"group": {
|
"group": {
|
||||||
|
@ -239,6 +239,17 @@
|
|||||||
"not_found": "Nie ma zadania o podanym ID.",
|
"not_found": "Nie ma zadania o podanym ID.",
|
||||||
"invalid_id": "Błędny format ID zadania.",
|
"invalid_id": "Błędny format ID zadania.",
|
||||||
"description": "Dodaj lub wykonaj wskazane zadanie.",
|
"description": "Dodaj lub wykonaj wskazane zadanie.",
|
||||||
|
"running": "🇺🇸Quest %s is %s (%s).",
|
||||||
|
"talking": "🇺🇸Talk %s is %s for main quest %s (%s).",
|
||||||
|
"state": {
|
||||||
|
"none": "🇺🇸unknown (none)",
|
||||||
|
"unstarted": "🇺🇸unfinished (not started, not completed)",
|
||||||
|
"unfinished": "🇺🇸unfinished (started, not completed)",
|
||||||
|
"finished": "🇺🇸finished (completed)",
|
||||||
|
"failed": "🇺🇸finished (completed, but failed)",
|
||||||
|
"exists": "🇺🇸found",
|
||||||
|
"not_exists": "🇺🇸not found"
|
||||||
|
},
|
||||||
"enabled": "🇺🇸Questing enabled."
|
"enabled": "🇺🇸Questing enabled."
|
||||||
},
|
},
|
||||||
"group": {
|
"group": {
|
||||||
|
@ -239,6 +239,17 @@
|
|||||||
"not_found": "Misiunea nu a fost găsită.",
|
"not_found": "Misiunea nu a fost găsită.",
|
||||||
"invalid_id": "ID-ul misiunii nu a fost găsit.",
|
"invalid_id": "ID-ul misiunii nu a fost găsit.",
|
||||||
"description": "Adaugă sau termină misiuni",
|
"description": "Adaugă sau termină misiuni",
|
||||||
|
"running": "🇺🇸Quest %s is %s (%s).",
|
||||||
|
"talking": "🇺🇸Talk %s is %s for main quest %s (%s).",
|
||||||
|
"state": {
|
||||||
|
"none": "🇺🇸unknown (none)",
|
||||||
|
"unstarted": "🇺🇸unfinished (not started, not completed)",
|
||||||
|
"unfinished": "🇺🇸unfinished (started, not completed)",
|
||||||
|
"finished": "🇺🇸finished (completed)",
|
||||||
|
"failed": "🇺🇸finished (completed, but failed)",
|
||||||
|
"exists": "🇺🇸found",
|
||||||
|
"not_exists": "🇺🇸not found"
|
||||||
|
},
|
||||||
"enabled": "🇺🇸Questing enabled."
|
"enabled": "🇺🇸Questing enabled."
|
||||||
},
|
},
|
||||||
"group": {
|
"group": {
|
||||||
|
@ -239,6 +239,17 @@
|
|||||||
"not_found": "Квест не найден.",
|
"not_found": "Квест не найден.",
|
||||||
"invalid_id": "Некорректный ID квеста.",
|
"invalid_id": "Некорректный ID квеста.",
|
||||||
"description": "Добавляет (add) или завершает (finish) квесты",
|
"description": "Добавляет (add) или завершает (finish) квесты",
|
||||||
|
"running": "🇺🇸Quest %s is %s (%s).",
|
||||||
|
"talking": "🇺🇸Talk %s is %s for main quest %s (%s).",
|
||||||
|
"state": {
|
||||||
|
"none": "🇺🇸unknown (none)",
|
||||||
|
"unstarted": "🇺🇸unfinished (not started, not completed)",
|
||||||
|
"unfinished": "🇺🇸unfinished (started, not completed)",
|
||||||
|
"finished": "🇺🇸finished (completed)",
|
||||||
|
"failed": "🇺🇸finished (completed, but failed)",
|
||||||
|
"exists": "🇺🇸found",
|
||||||
|
"not_exists": "🇺🇸not found"
|
||||||
|
},
|
||||||
"enabled": "🇺🇸Questing enabled."
|
"enabled": "🇺🇸Questing enabled."
|
||||||
},
|
},
|
||||||
"group": {
|
"group": {
|
||||||
|
@ -239,6 +239,17 @@
|
|||||||
"not_found": "任务不存在。",
|
"not_found": "任务不存在。",
|
||||||
"invalid_id": "无效的任务ID。",
|
"invalid_id": "无效的任务ID。",
|
||||||
"description": "添加或完成任务",
|
"description": "添加或完成任务",
|
||||||
|
"running": "🇺🇸Quest %s is %s (%s).",
|
||||||
|
"talking": "🇺🇸Talk %s is %s for main quest %s (%s).",
|
||||||
|
"state": {
|
||||||
|
"none": "🇺🇸unknown (none)",
|
||||||
|
"unstarted": "🇺🇸unfinished (not started, not completed)",
|
||||||
|
"unfinished": "🇺🇸unfinished (started, not completed)",
|
||||||
|
"finished": "🇺🇸finished (completed)",
|
||||||
|
"failed": "🇺🇸finished (completed, but failed)",
|
||||||
|
"exists": "🇺🇸found",
|
||||||
|
"not_exists": "🇺🇸not found"
|
||||||
|
},
|
||||||
"enabled": "🇺🇸Questing enabled."
|
"enabled": "🇺🇸Questing enabled."
|
||||||
},
|
},
|
||||||
"group": {
|
"group": {
|
||||||
|
@ -239,6 +239,17 @@
|
|||||||
"not_found": "未找到任務",
|
"not_found": "未找到任務",
|
||||||
"invalid_id": "無效的任務ID",
|
"invalid_id": "無效的任務ID",
|
||||||
"description": "添加或完成任務",
|
"description": "添加或完成任務",
|
||||||
|
"running": "🇺🇸Quest %s is %s (%s).",
|
||||||
|
"talking": "🇺🇸Talk %s is %s for main quest %s (%s).",
|
||||||
|
"state": {
|
||||||
|
"none": "🇺🇸unknown (none)",
|
||||||
|
"unstarted": "🇺🇸unfinished (not started, not completed)",
|
||||||
|
"unfinished": "🇺🇸unfinished (started, not completed)",
|
||||||
|
"finished": "🇺🇸finished (completed)",
|
||||||
|
"failed": "🇺🇸finished (completed, but failed)",
|
||||||
|
"exists": "🇺🇸found",
|
||||||
|
"not_exists": "🇺🇸not found"
|
||||||
|
},
|
||||||
"enabled": "🇺🇸Questing enabled."
|
"enabled": "🇺🇸Questing enabled."
|
||||||
},
|
},
|
||||||
"group": {
|
"group": {
|
||||||
|
Loading…
Reference in New Issue
Block a user