1
mirror of https://github.com/Shiewk/SModeration.git synced 2026-04-29 06:34:17 +02:00

Rework save format and punishment manager

- 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
This commit is contained in:
Shy
2026-04-08 16:12:01 +02:00
parent fecd21bf19
commit 823093be35
26 changed files with 795 additions and 509 deletions
@@ -1,7 +1,7 @@
package de.shiewk.smoderation.paper.event;
import de.shiewk.smoderation.paper.punishments.Punishment;
import de.shiewk.smoderation.paper.storage.PunishmentContainer;
import de.shiewk.smoderation.paper.punishments.PunishmentManager;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
@@ -11,20 +11,20 @@ public class PunishmentIssueEvent extends Event implements Cancellable {
private static final HandlerList handlerList = new HandlerList();
private final Punishment punishment;
private final PunishmentContainer container;
private final PunishmentManager manager;
private boolean cancelled;
public PunishmentIssueEvent(Punishment punishment, PunishmentContainer container) {
public PunishmentIssueEvent(Punishment punishment, PunishmentManager manager) {
this.punishment = punishment;
this.container = container;
this.manager = manager;
}
public Punishment getPunishment() {
return punishment;
}
public PunishmentContainer getContainer() {
return container;
public PunishmentManager getPunishmentManager() {
return manager;
}
@Override