Added database support for mail

Send mail command now works from console (to use it from console change the uuid in the 'SendMailCommand' file
This commit is contained in:
Benjamin Elsdon
2022-04-23 23:07:18 +08:00
parent e24de95d29
commit 69779a0321
5 changed files with 187 additions and 44 deletions

View File

@@ -1,10 +1,14 @@
package emu.grasscutter.command.commands;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.game.Mail;
import emu.grasscutter.server.packet.send.PacketMailChangeNotify;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
@Command(label = "sendmail", usage = "sendmail")
@@ -12,8 +16,17 @@ public class SendMailCommand implements CommandHandler {
@Override
public void execute(GenshinPlayer sender, List<String> args) {
// This is literally so I can test the notification
sender.getSession().send(new PacketMailChangeNotify(sender));
// This is literally so I can receive mail for some reason.
if(sender == null) {
// This is my uuid in my test server. This is just for testing.
// If someone pulled this please put your uuid to receive mail using /sendmail
// until I actually make a proper /sendmail command.
sender = Grasscutter.getGameServer().getPlayerByUid(7006);
}
sender.sendMail(new Mail(new Mail.MailContent("Test", "This is a test"),
new ArrayList<Mail.MailItem>(){{add(new Mail.MailItem(1062));}},
Instant.now().getEpochSecond() + 4000));
sender.dropMessage("Check your inbox");
}
}