Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 20:40:07 +01:00
Handle expired bans correctly. Fixes BUKKIT-5541
Dieser Commit ist enthalten in:
Ursprung
3e911dba54
Commit
98555224aa
@ -23,7 +23,7 @@ public abstract class ExpirableListEntry extends JsonListEntry {
|
||||
}
|
||||
|
||||
protected ExpirableListEntry(Object object, JsonObject jsonobject) {
|
||||
super(object, jsonobject);
|
||||
super(checkExpiry(object, jsonobject), jsonobject); // CraftBukkit - check expiry
|
||||
|
||||
Date date;
|
||||
|
||||
@ -75,5 +75,21 @@ public abstract class ExpirableListEntry extends JsonListEntry {
|
||||
public Date getCreated() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
private static Object checkExpiry(Object object, JsonObject jsonobject) {
|
||||
Date expires = null;
|
||||
|
||||
try {
|
||||
expires = jsonobject.has("expires") ? a.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
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ public abstract class PlayerList {
|
||||
PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress());
|
||||
String s;
|
||||
|
||||
if (this.j.isBanned(gameprofile)) {
|
||||
if (this.j.isBanned(gameprofile) && !this.j.get(gameprofile).e()) { // Should be hasExpired
|
||||
GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.j.get(gameprofile);
|
||||
|
||||
s = "You are banned from this server!\nReason: " + gameprofilebanentry.getReason();
|
||||
@ -366,7 +366,7 @@ public abstract class PlayerList {
|
||||
} else if (!this.isWhitelisted(gameprofile)) {
|
||||
// return "You are not white-listed on this server!";
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "You are not white-listed on this server!");
|
||||
} else if (this.k.isBanned(socketaddress)) {
|
||||
} else if (this.k.isBanned(socketaddress) && !this.j.get(gameprofile).e()) { // Should be hasExpired
|
||||
IpBanEntry ipbanentry = this.k.get(socketaddress);
|
||||
|
||||
s = "Your IP address is banned from this server!\nReason: " + ipbanentry.getReason();
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren