Merge pull request 'Is Punished' (#152) from is_punished into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #152 Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Commit
9c3427a1ac
@ -27,6 +27,7 @@ import java.sql.SQLException;
|
|||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public class Punishment {
|
public class Punishment {
|
||||||
|
|
||||||
@ -50,6 +51,16 @@ public class Punishment {
|
|||||||
}, user);
|
}, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isPunished(SteamwarUser user, Punishment.PunishmentType type, Consumer<Punishment> callback) {
|
||||||
|
Punishment punishment = Punishment.getPunishmentOfPlayer(user.getId(), type);
|
||||||
|
if(punishment == null || punishment.isCurrent()) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
callback.accept(punishment);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private final Timestamp startTime;
|
private final Timestamp startTime;
|
||||||
private Timestamp endTime;
|
private Timestamp endTime;
|
||||||
private final PunishmentType type;
|
private final PunishmentType type;
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren