From 00cac16f1c9d4ce16dda128b41fc5e25d372ec6b Mon Sep 17 00:00:00 2001 From: Ryan Barlow <7389646+ryanbarlow97@users.noreply.github.com> Date: Thu, 15 Oct 2026 15:10:06 +0000 Subject: [PATCH 1/2] Send the find and the spent counter as one line Co-Authored-By: Claude Opus 5.5 --- .../handlers/SourceHandler.java | 15 +++++++++--- src/main/resources/messages.yml | 5 ++-- .../handlers/SourceHandlerTest.java | 23 +++++++++++++++++++ 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/tfminecraft/geigercounters/handlers/SourceHandler.java b/src/main/java/net/tfminecraft/geigercounters/handlers/SourceHandler.java index a556dcc..58600b6 100644 --- a/src/main/java/net/tfminecraft/geigercounters/handlers/SourceHandler.java +++ b/src/main/java/net/tfminecraft/geigercounters/handlers/SourceHandler.java @@ -305,13 +305,23 @@ private void collectSource(Player player, UUID hunter, Location collected, Equip dropLimits.recordCollection(player); UsageStats.getInstance().recordSourceCollected(); Bukkit.getPluginManager().callEvent(new GeigerSourceCollectEvent(player, collected)); - notifyPlayerOfCollection(player); replaceGeigerWithDeadVersion(player, geigerSlot); + notifyPlayerOfCollection(player); giveReward(player); } + // One line: the find, then the spent counter. A blank half is left out. private void notifyPlayerOfCollection(Player player) { - player.sendMessage(config.getMessages().get("player.found-source")); + String found = config.getMessages().get("player.found-source"); + String spent = config.getMessages().get("player.dead-geiger"); + if (found.isBlank() || spent.isBlank()) { + String only = found.isBlank() ? spent : found; + if (!only.isBlank()) { + player.sendMessage(only); + } + return; + } + player.sendMessage(found + " " + spent); } private void replaceGeigerWithDeadVersion(Player player, EquipmentSlot geigerSlot) { @@ -336,7 +346,6 @@ private void replaceGeigerWithDeadVersion(Player player, EquipmentSlot geigerSlo deadGeiger.setAmount(1); giveItemOrDropLeftovers(player, deadGeiger); player.playSound(player.getLocation(), Sound.ENTITY_ITEM_BREAK, 1f, 1f); - player.sendMessage(config.getMessages().get("player.dead-geiger")); } catch (Exception e) { plugin.getLogger().warning("Failed to give dead Geiger Counter to " + player.getName() + ": " + e.getMessage()); } diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml index 54cfb5a..76bfdd6 100644 --- a/src/main/resources/messages.yml +++ b/src/main/resources/messages.yml @@ -12,13 +12,14 @@ # PLAYER - seen by anyone hunting a source # ==================================== player: - # Shown when a player finds their radioactive source + # Shown when a player finds their radioactive source, followed on the same + # line by dead-geiger. Leave either blank to drop that half. found-source: "&#AA00FFYou have found the source of Arcane Radiation!" # Title of the signal bar shown while holding a detector signal-bar: "&#AA00FFArcane signal" - # Shown when the Geiger Counter burns out after finding the source + # Second half of the found-source line: the counter burns out dead-geiger: "&7Your Arcane Trace Detector has run out of fuel." # Shown when a player has used up their drops for the current window diff --git a/src/test/java/net/tfminecraft/geigercounters/handlers/SourceHandlerTest.java b/src/test/java/net/tfminecraft/geigercounters/handlers/SourceHandlerTest.java index 99e0173..4723105 100644 --- a/src/test/java/net/tfminecraft/geigercounters/handlers/SourceHandlerTest.java +++ b/src/test/java/net/tfminecraft/geigercounters/handlers/SourceHandlerTest.java @@ -361,6 +361,29 @@ void collectionConsumesCounterRecordsLimitAndPublishesOriginalLocation() { assertFalse(handler.isPlacing(hunter)); } + @Test + void collectionSendsTheFindAndTheSpentCounterAsOneLine() { + when(messages.get("player.found-source")).thenReturn("Found!"); + when(messages.get("player.dead-geiger")).thenReturn("Spent."); + place(); + collect(EquipmentSlot.HAND); + verify(player).sendMessage("Found! Spent."); + verify(player, times(1)).sendMessage(anyString()); + } + + @Test + void aBlankHalfOfTheCollectionLineIsLeftOut() { + when(messages.get("player.found-source")).thenReturn("Found!", " ", ""); + when(messages.get("player.dead-geiger")).thenReturn("", "Spent.", ""); + for (int run = 0; run < 3; run++) { + place(); + collect(EquipmentSlot.HAND); + } + verify(player).sendMessage("Found!"); + verify(player).sendMessage("Spent."); + verify(player, times(2)).sendMessage(anyString()); + } + @Test void offhandCollectionAlsoGrantsClonedRewardWithConfiguredAmount() { TierReward tier = new TierReward("rare", 1); From 4ebe8dee5fc296396f92c5243f6e5ea6d0ed31bb Mon Sep 17 00:00:00 2001 From: Ryan Barlow <7389646+ryanbarlow97@users.noreply.github.com> Date: Thu, 15 Oct 2026 15:10:29 +0000 Subject: [PATCH 2/2] Shorten the collection line Co-Authored-By: Claude Opus 5.5 --- src/main/resources/messages.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml index 76bfdd6..cacb050 100644 --- a/src/main/resources/messages.yml +++ b/src/main/resources/messages.yml @@ -14,13 +14,13 @@ player: # Shown when a player finds their radioactive source, followed on the same # line by dead-geiger. Leave either blank to drop that half. - found-source: "&#AA00FFYou have found the source of Arcane Radiation!" + found-source: "&#AA00FFYou found the arcane source!" # Title of the signal bar shown while holding a detector signal-bar: "&#AA00FFArcane signal" # Second half of the found-source line: the counter burns out - dead-geiger: "&7Your Arcane Trace Detector has run out of fuel." + dead-geiger: "&7Your detector is spent." # Shown when a player has used up their drops for the current window # %max% = drops allowed per window