From 1a04edc98918b4c60b66b8e406760cc574033a1b Mon Sep 17 00:00:00 2001 From: Jakubk15 <77227023+Jakubk15@users.noreply.github.com> Date: Mon, 22 Jun 2026 19:17:00 +0200 Subject: [PATCH 1/2] fix: trim whitespace and reject blank-space description in parcel input (#219, #220) - Trim parcel name before storing to strip leading/trailing spaces - Trim parcel description and coerce a whitespace-only entry to null (treated as unset) Co-Authored-By: Claude Sonnet 4.6 Claude-Session: https://claude.ai/code/session_01R4YqhTV42FvN95HanC7XJc --- .../parcellockers/gui/implementation/locker/SendingGui.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eternalcode/parcellockers/gui/implementation/locker/SendingGui.java b/src/main/java/com/eternalcode/parcellockers/gui/implementation/locker/SendingGui.java index 5019fe67..2911d735 100644 --- a/src/main/java/com/eternalcode/parcellockers/gui/implementation/locker/SendingGui.java +++ b/src/main/java/com/eternalcode/parcellockers/gui/implementation/locker/SendingGui.java @@ -111,7 +111,7 @@ public void show(Player player) { return; } - this.state.parcelName(name); + this.state.parcelName(name.trim()); this.noticeService.player(player.getUniqueId(), messages -> messages.parcel.nameSet); this.updateNameItem(); @@ -155,8 +155,9 @@ public void show(Player player) { 200, DialogAction.customClick((DialogResponseView view, Audience audience) -> { String description = view.getText("description"); + String trimmedDescription = description != null ? description.trim() : null; - this.state.parcelDescription(description); + this.state.parcelDescription(trimmedDescription == null || trimmedDescription.isEmpty() ? null : trimmedDescription); this.noticeService.player(player.getUniqueId(), messages -> messages.parcel.descriptionSet); this.updateDescriptionItem(); From 94ca910836faed528114116fd25a96635c9116a3 Mon Sep 17 00:00:00 2001 From: Jakubk15 <77227023+Jakubk15@users.noreply.github.com> Date: Mon, 22 Jun 2026 19:22:09 +0200 Subject: [PATCH 2/2] refactor: simplify description blank-check using isBlank() Co-Authored-By: Claude Sonnet 4.6 Claude-Session: https://claude.ai/code/session_01R4YqhTV42FvN95HanC7XJc --- .../parcellockers/gui/implementation/locker/SendingGui.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/eternalcode/parcellockers/gui/implementation/locker/SendingGui.java b/src/main/java/com/eternalcode/parcellockers/gui/implementation/locker/SendingGui.java index 2911d735..31b3d9f0 100644 --- a/src/main/java/com/eternalcode/parcellockers/gui/implementation/locker/SendingGui.java +++ b/src/main/java/com/eternalcode/parcellockers/gui/implementation/locker/SendingGui.java @@ -155,9 +155,9 @@ public void show(Player player) { 200, DialogAction.customClick((DialogResponseView view, Audience audience) -> { String description = view.getText("description"); - String trimmedDescription = description != null ? description.trim() : null; + String trimmedDescription = (description == null || description.isBlank()) ? null : description.trim(); - this.state.parcelDescription(trimmedDescription == null || trimmedDescription.isEmpty() ? null : trimmedDescription); + this.state.parcelDescription(trimmedDescription); this.noticeService.player(player.getUniqueId(), messages -> messages.parcel.descriptionSet); this.updateDescriptionItem();