File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
src/main/java/org/spongepowered/api/entity/living/player Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 2525package org .spongepowered .api .entity .living .player ;
2626
2727import org .spongepowered .api .ResourceKey ;
28+ import org .spongepowered .api .Server ;
2829import org .spongepowered .api .block .entity .EnderChest ;
2930import org .spongepowered .api .data .DataHolder ;
3031import org .spongepowered .api .data .Keys ;
@@ -203,4 +204,13 @@ default Value.Mutable<VanishState> vanishState() {
203204 return this .requireValue (Keys .VANISH_STATE ).asMutable ();
204205 }
205206
207+ /**
208+ * Gets if the {@link User} has played on the {@link Server} before. Added
209+ * as a utility.
210+ *
211+ * @return True if played before, false otherwise
212+ */
213+ default boolean hasPlayedBefore () {
214+ return !this .firstJoined ().map (Value ::get ).equals (this .lastJoined ().map (Value ::get ));
215+ }
206216}
Original file line number Diff line number Diff line change @@ -299,7 +299,7 @@ default Value.Mutable<Boolean> hasViewedCredits() {
299299 * @return True if played before, false otherwise
300300 */
301301 default boolean hasPlayedBefore () {
302- return !this .firstJoined ().equals (this .lastPlayed ( ));
302+ return !this .firstJoined ().map ( Value :: get ). equals (this .lastJoined (). map ( Value :: get ));
303303 }
304304
305305 /**
You can’t perform that action at this time.
0 commit comments