Skip to content

Commit

Permalink
feat: sniff logging
Browse files Browse the repository at this point in the history
  • Loading branch information
BlurOne-GIT committed Feb 14, 2024
1 parent 1ff5685 commit 943b9d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class PotionOfSniffing(private val plugin: JavaPlugin, config: ConfigurationSect

private val playerMaps = mutableMapOf<Player, MutableMap<Location, Display>>()
private val taskMap = mutableMapOf<UUID, BukkitTask>()
private val shallLog = config.getBoolean("sniff_logging", true)
private val oreSniffingMode = config.getString("ore_sniffing_mode", "block")
private val worlds = config.getConfigurationSection("enabled_worlds")

Expand Down Expand Up @@ -155,7 +156,12 @@ class PotionOfSniffing(private val plugin: JavaPlugin, config: ConfigurationSect
fun scanForOres(player: Player, radius: Int = worlds?.getInt("${player.world.name}.radius") ?: 16, duration: Double = worlds?.getDouble("${player.world.name}.duration") ?: 60.0)
{
if (radius <= 1) return

if (shallLog)
plugin.logger.info("${player.name} is sniffing for ores in a radius of $radius blocks for $duration seconds.")

player.world.playSound(player, Sound.ENTITY_SNIFFER_SNIFFING, SoundCategory.PLAYERS, 5f, (1.25 - 0.25 * radius / (worlds?.getInt("${player.world.name}.radius") ?: 16)).toFloat())

for (x in -radius..radius)
for (y in -radius..radius)
for (z in -radius..radius)
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ high_on_sugar:
potion_of_sniffing:
# Enable or disable this feature
enabled: true
# Enable console logging for use of the potion
sniff_logging: false
# The world(s) where the potion is enabled with its duration (in seconds) and radius (in blocks)
enabled_worlds:
world:
Expand Down

0 comments on commit 943b9d0

Please sign in to comment.