PlayerBirthday.java 1.43 KB
Newer Older
Miyucchi's avatar
Miyucchi committed
1
2
package emu.grasscutter.game.player;

Jaida Wu's avatar
Jaida Wu committed
3
import dev.morphia.annotations.Entity;
Miyucchi's avatar
Miyucchi committed
4
5
import emu.grasscutter.net.proto.BirthdayOuterClass.Birthday;

Jaida Wu's avatar
Jaida Wu committed
6
@Entity
Miyucchi's avatar
Miyucchi committed
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
public class PlayerBirthday {
    private int day;
    private int month;

    public PlayerBirthday(){
        this.day = 0;
        this.month = 0;
    }

    public PlayerBirthday(int day, int month){
        this.day = day;
        this.month = month;
    }

    public PlayerBirthday set(PlayerBirthday birth){
        this.day = birth.day;
        this.month = birth.month;

        return this;
    }

    public PlayerBirthday set(int d, int m){
        this.day = d;
        this.month = m;

        return this;
    }

    public PlayerBirthday setDay(int value){
        this.day = value;
        return this;
    }

    public PlayerBirthday setMonth(int value){
        this.month = value;
        return this;
    }

    public int getDay(){
        return this.day;
    }

    public int getMonth(){
        return this.month;
    }

    public Birthday toProto(){
        return Birthday.newBuilder()
                .setDay(this.getDay())
                .setMonth(this.getMonth())
                .build();
    }

    public Birthday.Builder getFilledProtoWhenNotEmpty(){
        if(this.getDay() > 0)
        {
            return Birthday.newBuilder()
                    .setDay(this.getDay())
                    .setMonth(this.getMonth());
        }

        return Birthday.newBuilder();
    }
}