1
mirror of https://github.com/Shiewk/SModeration.git synced 2026-04-28 05:54:16 +02:00

Add default reason to config

This commit is contained in:
Shy
2026-04-12 15:02:41 +02:00
parent ea54f83909
commit 24da79642a
5 changed files with 7 additions and 5 deletions
@@ -54,7 +54,7 @@ public final class BanCommand implements CommandProvider {
UUID sender = CommandUtil.getSenderUUID(context.getSource()); UUID sender = CommandUtil.getSenderUUID(context.getSource());
UUID target = context.getArgument("player", UUID.class); UUID target = context.getArgument("player", UUID.class);
long duration = context.getArgument("duration", Long.class); long duration = context.getArgument("duration", Long.class);
executeBan(punishmentManager, sender, target, duration, Punishment.DEFAULT_REASON); executeBan(punishmentManager, sender, target, duration, SModerationPaper.config().getString("default-reason", "No reason provided."));
return Command.SINGLE_SUCCESS; return Command.SINGLE_SUCCESS;
} }
@@ -57,7 +57,7 @@ public final class KickCommand implements CommandProvider {
} }
UUID sender = CommandUtil.getSenderUUID(context.getSource()); UUID sender = CommandUtil.getSenderUUID(context.getSource());
Player target = CommandUtil.getPlayerSingle(context, "player"); Player target = CommandUtil.getPlayerSingle(context, "player");
executeKick(punishmentManager, sender, target, Punishment.DEFAULT_REASON); executeKick(punishmentManager, sender, target, SModerationPaper.config().getString("default-reason", "No reason provided."));
return Command.SINGLE_SUCCESS; return Command.SINGLE_SUCCESS;
} }
@@ -54,7 +54,7 @@ public final class MuteCommand implements CommandProvider {
UUID sender = CommandUtil.getSenderUUID(context.getSource()); UUID sender = CommandUtil.getSenderUUID(context.getSource());
UUID target = context.getArgument("player", UUID.class); UUID target = context.getArgument("player", UUID.class);
long duration = context.getArgument("duration", Long.class); long duration = context.getArgument("duration", Long.class);
executeMute(punishmentManager, sender, target, duration, Punishment.DEFAULT_REASON); executeMute(punishmentManager, sender, target, duration, SModerationPaper.config().getString("default-reason", "No reason provided."));
return Command.SINGLE_SUCCESS; return Command.SINGLE_SUCCESS;
} }
@@ -17,8 +17,6 @@ import static net.kyori.adventure.text.Component.translatable;
public abstract class Punishment { public abstract class Punishment {
public static final String DEFAULT_REASON = "No reason provided.";
protected final UUID id; protected final UUID id;
protected final String type; protected final String type;
protected final long timestamp; protected final long timestamp;
+4
View File
@@ -1,6 +1,10 @@
# If enabled, punishments can no longer be issued without providing a reason. # If enabled, punishments can no longer be issued without providing a reason.
force-reason: false force-reason: false
# The string that should be used when no reason is provided.
# This has no effect if 'force-reason' is set to true.
default-reason: No reason provided.
# Allows you to toggle specific plugin features. # Allows you to toggle specific plugin features.
features: features:
# Should punishments be tracked and executed? # Should punishments be tracked and executed?