Remove needsAdmin property from PunishmentType enum and refactor related declarations for cleaner structure.

Signed-off-by: Chaoscaot <max@maxsp.de>
This commit is contained in:
2025-11-09 17:25:19 +01:00
parent 5d36393643
commit fc71f47add
@@ -125,7 +125,6 @@ class Punishment(id: EntityID<Int>) : IntEntity(id) {
fun isCurrent() = perma || endTime.after(Date())
enum class PunishmentType(
val needsAdmin: Boolean,
val teamMessage: String?,
val playerMessagePerma: String?,
val playerMessageUntil: String?,
@@ -134,10 +133,9 @@ class Punishment(id: EntityID<Int>) : IntEntity(id) {
val userPerm: UserPerm,
val multi: Boolean = false
) {
Ban(false, "BAN_TEAM", "BAN_PERMA", "BAN_UNTIL", "UNBAN_ERROR", "UNBAN", UserPerm.TEAM),
Mute(false, "MUTE_TEAM", "MUTE_PERMA", "MUTE_UNTIL", "UNMUTE_ERROR", "UNMUTE", UserPerm.TEAM),
Ban("BAN_TEAM", "BAN_PERMA", "BAN_UNTIL", "UNBAN_ERROR", "UNBAN", UserPerm.TEAM),
Mute("MUTE_TEAM", "MUTE_PERMA", "MUTE_UNTIL", "UNMUTE_ERROR", "UNMUTE", UserPerm.TEAM),
NoSchemReceiving(
true,
"NOSCHEMRECEIVING_TEAM",
"NOSCHEMRECEIVING_PERMA",
"NOSCHEMRECEIVING_UNTIL",
@@ -146,7 +144,6 @@ class Punishment(id: EntityID<Int>) : IntEntity(id) {
UserPerm.MODERATION
),
NoSchemSharing(
true,
"NOSCHEMSHARING_TEAM",
"NOSCHEMSHARING_PERMA",
"NOSCHEMSHARING_UNTIL",
@@ -155,7 +152,6 @@ class Punishment(id: EntityID<Int>) : IntEntity(id) {
UserPerm.MODERATION
),
NoSchemSubmitting(
false,
"NOSCHEMSUBMITTING_TEAM",
"NOSCHEMSUBMITTING_PERMA",
"NOSCHEMSUBMITTING_UNTIL",
@@ -164,7 +160,6 @@ class Punishment(id: EntityID<Int>) : IntEntity(id) {
UserPerm.TEAM
),
NoDevServer(
true,
"NODEVSERVER_TEAM",
"NODEVSERVER_PERMA",
"NODEVSERVER_UNTIL",
@@ -173,7 +168,6 @@ class Punishment(id: EntityID<Int>) : IntEntity(id) {
UserPerm.PREFIX_DEVELOPER
),
NoFightServer(
true,
"NOFIGHTSERVER_TEAM",
"NOFIGHTSERVER_PERMA",
"NOFIGHTSERVER_UNTIL",
@@ -182,7 +176,6 @@ class Punishment(id: EntityID<Int>) : IntEntity(id) {
UserPerm.MODERATION
),
NoTeamServer(
true,
"NOTEAMSERVER_TEAM",
"NOTEAMSERVER_PERMA",
"NOTEAMSERVER_UNTIL",
@@ -190,9 +183,8 @@ class Punishment(id: EntityID<Int>) : IntEntity(id) {
"UNNOTEAMSERVER",
UserPerm.MODERATION
),
Note(false, "NOTE_TEAM", null, null, null, null, UserPerm.TEAM, true);
Note("NOTE_TEAM", null, null, null, null, UserPerm.TEAM, true);
fun isNeedsAdmin() = needsAdmin
fun isMulti() = multi
}
}