Skip to content

Commit d400b0a

Browse files
revert(punishment): remove duration validation and restore mute message format
Invalid duration defaults to permanent punishment (stricter, not weaker). Restores original mute message format with reason line.
1 parent 925f752 commit d400b0a

3 files changed

Lines changed: 4 additions & 11 deletions

File tree

commons/src/main/java/net/swofty/commons/punishment/PunishmentMessages.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ public static Component muteMessage(ActivePunishment punishment) {
4848
time = "§7Your mute will expire in §c" + prettyTimeLeft + "\n\n";
4949
}
5050

51+
String reasonLine = "§7Reason: §f" + reason.getReasonString() + "\n";
5152
String urlInfo = "§7Find out more here: §fwww.hypixel.net/mutes\n";
5253
String footer = "§7Mute ID: §f" + punishment.banId();
53-
return Component.text(line + header + time + urlInfo + footer + line);
54+
return Component.text(line + header + reasonLine + time + urlInfo + footer + line);
5455
}
5556
}

type.generic/src/main/java/net/swofty/type/generic/command/commands/BanCommand.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,8 @@ public void registerUsage(MinestomCommand command) {
6464

6565
CompletableFuture.runAsync(() -> {
6666
try {
67-
long actualTime = StringUtility.parseDuration(duration);
68-
if (actualTime <= 0) {
69-
player.sendMessage("§cInvalid duration format. Use e.g. 30d, 12h, 30m, 10s.");
70-
return;
71-
}
7267
UUID targetUuid = net.minestom.server.utils.mojang.MojangUtils.getUUID(playerName);
68+
long actualTime = StringUtility.parseDuration(duration);
7369
long expiryTime = System.currentTimeMillis() + actualTime;
7470
banPlayer(player, targetUuid, type, player.getUuid(), actualTime, expiryTime, playerName, null);
7571
} catch (IOException e) {

type.generic/src/main/java/net/swofty/type/generic/command/commands/MuteCommand.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,8 @@ public void registerUsage(MinestomCommand command) {
5757

5858
CompletableFuture.runAsync(() -> {
5959
try {
60-
long actualTime = StringUtility.parseDuration(duration);
61-
if (actualTime <= 0) {
62-
player.sendMessage("§cInvalid duration format. Use e.g. 30d, 12h, 30m, 10s.");
63-
return;
64-
}
6560
UUID targetUuid = net.minestom.server.utils.mojang.MojangUtils.getUUID(playerName);
61+
long actualTime = StringUtility.parseDuration(duration);
6662
long expiryTime = System.currentTimeMillis() + actualTime;
6763
mutePlayer(player, targetUuid, type, player.getUuid(), actualTime, expiryTime, playerName);
6864
} catch (IOException e) {

0 commit comments

Comments
 (0)