mirror of
https://github.com/Melledy/Nebula.git
synced 2025-12-14 13:24:43 +01:00
Update mail state on ping
This commit is contained in:
@@ -27,6 +27,8 @@ public class Mailbox extends PlayerManager implements GameDatabaseObject, Iterab
|
||||
|
||||
private List<GameMail> list;
|
||||
|
||||
private transient boolean newState;
|
||||
|
||||
@Deprecated // Morphia only
|
||||
public Mailbox() {
|
||||
|
||||
@@ -41,6 +43,10 @@ public class Mailbox extends PlayerManager implements GameDatabaseObject, Iterab
|
||||
this.save();
|
||||
}
|
||||
|
||||
public void clearNewState() {
|
||||
this.newState = false;
|
||||
}
|
||||
|
||||
// TODO optimize to an O(n) algorithm like a map
|
||||
public GameMail getMailById(int id) {
|
||||
return this.getList().stream()
|
||||
@@ -56,6 +62,9 @@ public class Mailbox extends PlayerManager implements GameDatabaseObject, Iterab
|
||||
// Add to mail list
|
||||
this.list.add(mail);
|
||||
|
||||
// Set state
|
||||
this.newState = true;
|
||||
|
||||
// Save to database
|
||||
Nebula.getGameDatabase().update(this, getUid(), "lastMailId", this.getLastMailId());
|
||||
Nebula.getGameDatabase().addToList(this, getUid(), "list", mail);
|
||||
|
||||
Reference in New Issue
Block a user