X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FProfile.java;h=7c294307b827a8e070937e857a1930dd9d2c6391;hb=df1e2e70c2f7031cd5b175d58b8f0b70c672176b;hp=242c96e4bde26b5371cf1b2a535bc15c14b8a559;hpb=554a8f521027da73bd6519f3480b1ed70b108903;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/data/Profile.java b/src/main/java/net/pterodactylus/sone/data/Profile.java index 242c96e..7c29430 100644 --- a/src/main/java/net/pterodactylus/sone/data/Profile.java +++ b/src/main/java/net/pterodactylus/sone/data/Profile.java @@ -26,16 +26,25 @@ package net.pterodactylus.sone.data; public class Profile { /** Whether the profile was modified. */ - private boolean modified; + private volatile boolean modified; /** The first name. */ - private String firstName; + private volatile String firstName; /** The middle name(s). */ - private String middleName; + private volatile String middleName; /** The last name. */ - private String lastName; + private volatile String lastName; + + /** The day of the birth date. */ + private volatile Integer birthDay; + + /** The month of the birth date. */ + private volatile Integer birthMonth; + + /** The year of the birth date. */ + private volatile Integer birthYear; /** * Creates a new empty profile. @@ -51,9 +60,15 @@ public class Profile { * The profile to copy */ public Profile(Profile profile) { + if (profile == null) { + return; + } this.firstName = profile.firstName; this.middleName = profile.middleName; this.lastName = profile.lastName; + this.birthDay = profile.birthDay; + this.birthMonth = profile.birthMonth; + this.birthYear = profile.birthYear; } // @@ -138,4 +153,70 @@ public class Profile { return this; } + /** + * Returns the day of the birth date. + * + * @return The day of the birth date (from 1 to 31) + */ + public Integer getBirthDay() { + return birthDay; + } + + /** + * Sets the day of the birth date. + * + * @param birthDay + * The day of the birth date (from 1 to 31) + * @return This profile (for method chaining) + */ + public Profile setBirthDay(Integer birthDay) { + modified |= ((birthDay != null) && (!birthDay.equals(this.birthDay))) || (this.birthDay != null); + this.birthDay = birthDay; + return this; + } + + /** + * Returns the month of the birth date. + * + * @return The month of the birth date (from 1 to 12) + */ + public Integer getBirthMonth() { + return birthMonth; + } + + /** + * Sets the month of the birth date. + * + * @param birthMonth + * The month of the birth date (from 1 to 12) + * @return This profile (for method chaining) + */ + public Profile setBirthMonth(Integer birthMonth) { + modified |= ((birthMonth != null) && (!birthMonth.equals(this.birthMonth))) || (this.birthMonth != null); + this.birthMonth = birthMonth; + return this; + } + + /** + * Returns the year of the birth date. + * + * @return The year of the birth date + */ + public Integer getBirthYear() { + return birthYear; + } + + /** + * Sets the year of the birth date. + * + * @param birthYear + * The year of the birth date + * @return This profile (for method chaining) + */ + public Profile setBirthYear(Integer birthYear) { + modified |= ((birthYear != null) && (!birthYear.equals(this.birthYear))) || (this.birthYear != null); + this.birthYear = birthYear; + return this; + } + }