mirror of https://github.com/PaperMC/Paper.git
37 lines
1.2 KiB
Diff
37 lines
1.2 KiB
Diff
--- a/net/minecraft/server/players/BanListEntry.java
|
|
+++ b/net/minecraft/server/players/BanListEntry.java
|
|
@@ -26,8 +26,8 @@
|
|
this.reason = s1 == null ? "Banned by an operator." : s1;
|
|
}
|
|
|
|
- protected BanListEntry(@Nullable T t0, JsonObject jsonobject) {
|
|
- super(t0);
|
|
+ protected BanListEntry(@Nullable T user, JsonObject entryData) {
|
|
+ super(checkExpiry(user, entryData)); // CraftBukkit
|
|
|
|
Date date;
|
|
|
|
@@ -85,4 +83,22 @@
|
|
jsonobject.addProperty("expires", this.expires == null ? "forever" : BanListEntry.DATE_FORMAT.format(this.expires));
|
|
jsonobject.addProperty("reason", this.reason);
|
|
}
|
|
+
|
|
+ // CraftBukkit start
|
|
+ private static <T> T checkExpiry(T object, JsonObject jsonobject) {
|
|
+ Date expires = null;
|
|
+
|
|
+ try {
|
|
+ expires = jsonobject.has("expires") ? DATE_FORMAT.parse(jsonobject.get("expires").getAsString()) : null;
|
|
+ } catch (ParseException ex) {
|
|
+ // Guess we don't have a date
|
|
+ }
|
|
+
|
|
+ if (expires == null || expires.after(new Date())) {
|
|
+ return object;
|
|
+ } else {
|
|
+ return null;
|
|
+ }
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|