mirror of
https://github.com/Shiewk/SModeration.git
synced 2026-04-29 06:34:17 +02:00
823093be35
- Punishments are now saved as JSON in files named after their targets - Each punishment type now has its own Java class - Each file contains a list of JSON objects that is updated every time something changes (e.g. player muted, banned or unbanned) - Punishments have a unique ID now; if something changes, the new version is added to the list and overwrites the old version - 'Undo' has been renamed to 'cancel' - You can no longer mute or ban players if they are already muted or banned
35 lines
1.1 KiB
Java
35 lines
1.1 KiB
Java
package de.shiewk.smoderation.paper.punishments;
|
|
|
|
import de.shiewk.smoderation.paper.util.SerializationHelper;
|
|
import org.jspecify.annotations.NonNull;
|
|
|
|
import java.util.UUID;
|
|
|
|
public class Mute extends TimedPunishment {
|
|
|
|
public Mute(UUID id, long timestamp, UUID issuer, UUID target, String reason, long duration, UUID cancelledBy) {
|
|
super(id, "mute", timestamp, issuer, target, reason, duration, cancelledBy);
|
|
}
|
|
|
|
public Mute(UUID id, long timestamp, UUID issuer, UUID target, String reason, long duration) {
|
|
this(id, timestamp, issuer, target, reason, duration, null);
|
|
}
|
|
|
|
public static class Factory implements PunishmentFactory<Mute> {
|
|
|
|
@Override
|
|
public @NonNull Mute deserialize(SerializationHelper helper) {
|
|
return new Mute(
|
|
helper.getUUID("id"),
|
|
helper.getLong("timestamp"),
|
|
helper.getUUID("issuer"),
|
|
helper.getUUID("target"),
|
|
helper.getString("reason"),
|
|
helper.getLong("duration"),
|
|
helper.getUUID("cancelledBy", null)
|
|
);
|
|
}
|
|
|
|
}
|
|
}
|