mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-15 00:15:33 +01:00
Receiving items in mail
This commit is contained in:
@@ -573,15 +573,45 @@ public class GenshinPlayer {
|
||||
this.sendPacket(new PacketPrivateChatNotify(sender.getUid(), this.getUid(), message.toString()));
|
||||
}
|
||||
|
||||
public List<Mail> getMail() { return mail; }
|
||||
// ---------------------MAIL------------------------
|
||||
|
||||
public List<Mail> getAllMail() { return this.mail; }
|
||||
|
||||
public void sendMail(Mail message) {
|
||||
|
||||
this.mail.add(message);
|
||||
message._id = this.mail.size() + 1;
|
||||
this.save();
|
||||
this.sendPacket(new PacketMailChangeNotify(this, message));
|
||||
}
|
||||
|
||||
public boolean deleteMail(int mailId) {
|
||||
Mail message = getMailById(mailId);
|
||||
|
||||
if(message != null) {
|
||||
this.mail.remove(message);
|
||||
this.save();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public Mail getMailById(int mailId) {
|
||||
return this.mail.stream().filter(message -> message._id == mailId).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
public int getMailIndex(Mail message) {
|
||||
return this.mail.indexOf(message);
|
||||
}
|
||||
|
||||
public boolean replaceMailByIndex(int mailId, Mail message) {
|
||||
if(getMailById(mailId) != null) {
|
||||
this.mail.set(mailId, message);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void interactWith(int gadgetEntityId) {
|
||||
GenshinEntity entity = getScene().getEntityById(gadgetEntityId);
|
||||
|
||||
@@ -55,6 +55,10 @@ public class Mail {
|
||||
this.stateValue = state;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return this._id;
|
||||
}
|
||||
|
||||
@Entity
|
||||
public static class MailContent {
|
||||
public String title;
|
||||
|
||||
Reference in New Issue
Block a user