Improve command system

This commit is contained in:
Melledy
2025-11-25 23:09:20 -08:00
parent fd8e8925ca
commit 2acd506245
19 changed files with 175 additions and 172 deletions

View File

@@ -17,7 +17,7 @@ import emu.nebula.command.CommandHandler;
public class GiveCommand implements CommandHandler {
@Override
public void execute(CommandArgs args) {
public String execute(CommandArgs args) {
// Setup mail
var mail = new GameMail("System", "Give Command Result", "");
@@ -31,18 +31,17 @@ public class GiveCommand implements CommandHandler {
var itemData = GameData.getItemDataTable().get(itemId);
if (itemData == null) {
args.sendMessage("Item \"" + arg + "\" does not exist!");
continue;
}
// Add
mail.addAttachment(itemId, amount);
// Log
args.sendMessage("Giving " + args.getTarget().getName() + " " + amount + " of " + itemId);
}
// Add mail
args.getTarget().getMailbox().sendMail(mail);
//
return "Give command success, check your mail";
}
}