Skip to content

Commit

Permalink
Log only found and selected objects to reduce unnecessary entries in …
Browse files Browse the repository at this point in the history
…StashLogger module. (Issue #264) (#272)

* Update StashLogger.kt

log only found and selected items instead of all.

* This is kotlin not java

* Change wrong whitespaces

* More wrong whitespaces

* Beautify

Co-authored-by: Constructor <fractalminds@protonmail.com>
  • Loading branch information
gamerpaddy and Avanatiker authored Apr 6, 2022
1 parent a141ff5 commit 1519d78
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ object StashLogger : Module(

if (logToChat) {
val positionString = center.asString()
MessageSendHelper.sendChatMessage("$chatName $positionString $string")
MessageSendHelper.sendChatMessage("$chatName Found $string at ($positionString) ")
}

found = found || true
found = true
}

if (found) {
Expand Down Expand Up @@ -166,7 +166,13 @@ object StashLogger : Module(
}

override fun toString(): String {
return "($chests chests, $shulkers shulkers, $droppers droppers, $dispensers dispensers, $hoppers hoppers)"
val statList = mutableListOf<String>()
if (chests > 0 && logChests) statList.add("$chests chest${if (chests == 1) "" else "s"}")
if (shulkers > 0 && logShulkers) statList.add("$shulkers shulker${if (shulkers == 1) "" else "s"}")
if (droppers > 0 && logDroppers) statList.add("$droppers dropper${if (droppers == 1) "" else "s"}")
if (dispensers > 0 && logDispensers) statList.add("$dispensers dispenser${if (dispensers == 1) "" else "s"}")
if (hoppers > 0 && logHoppers) statList.add("$hoppers hopper${if (hoppers == 1) "" else "s"}")
return statList.joinToString()
}
}
}

0 comments on commit 1519d78

Please sign in to comment.