Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.tfminecraft.tlibs.objects.api.ItemAPI;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.Sound;
Expand Down Expand Up @@ -311,6 +312,7 @@ private void collectSource(Player player, UUID hunter, Location collected, Equip
}

// One line: the find, then the spent counter. A blank half is left out.
// A reset between them stops the first half's colour and format carrying over.
private void notifyPlayerOfCollection(Player player) {
String found = config.getMessages().get("player.found-source");
String spent = config.getMessages().get("player.dead-geiger");
Expand All @@ -321,7 +323,7 @@ private void notifyPlayerOfCollection(Player player) {
}
return;
}
player.sendMessage(found + " " + spent);
player.sendMessage(found + " " + ChatColor.RESET + spent);
}

private void replaceGeigerWithDeadVersion(Player player, EquipmentSlot geigerSlot) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@

@Test
void rejectedCandidatesRetryThenAccept() {
when(filter.check(any())).thenReturn(SpawnLocationFilter.Rejection.LIQUID, null);

Check warning on line 192 in src/test/java/net/tfminecraft/geigercounters/handlers/SourceHandlerTest.java

View workflow job for this annotation

GitHub Actions / build

non-varargs call of varargs method with inexact argument type for last parameter;
assertNotNull(handler.placeNear(hunter, origin).join());
verify(filter, times(2)).check(any());
}
Expand Down Expand Up @@ -367,10 +367,19 @@
when(messages.get("player.dead-geiger")).thenReturn("Spent.");
place();
collect(EquipmentSlot.HAND);
verify(player).sendMessage("Found! Spent.");
verify(player).sendMessage("Found! \u00a7rSpent.");
verify(player, times(1)).sendMessage(anyString());
}

@Test
void theFirstHalfsFormattingDoesNotCarryIntoTheSecond() {
when(messages.get("player.found-source")).thenReturn("\u00a75\u00a7oFound!");
when(messages.get("player.dead-geiger")).thenReturn("\u00a7lSpent.");
place();
collect(EquipmentSlot.HAND);
verify(player).sendMessage("\u00a75\u00a7oFound! \u00a7r\u00a7lSpent.");
}

@Test
void aBlankHalfOfTheCollectionLineIsLeftOut() {
when(messages.get("player.found-source")).thenReturn("Found!", " ", "");
Expand Down