Skip to content

Commit

Permalink
Merge pull request #2 from heyxmirko/feature/sound-config-option
Browse files Browse the repository at this point in the history
Add configurable sound effect for heart usage
  • Loading branch information
KartoffelChipss authored Apr 18, 2024
2 parents fbd5a29 + 2f2d9a5 commit 781f72c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.strassburger</groupId>
<artifactId>lifestealz</artifactId>
<version>1.0.13</version>
<version>1.0.14</version>
<packaging>jar</packaging>

<name>lifestealz</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ class PlayerInteractionListener : Listener {
ManagePlayerdata().manageHearts(player = player, amount = 2.0, direction = "inc")
player.maxHealth += 2.0
player.health += 2.0
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 500.0f, 1.0f)

if (Lifestealz.instance.config.getBoolean("heartuseSound.enabled")) {
val sound = Sound.valueOf(Lifestealz.instance.config.getString("heartuseSound.sound")!!)
val volume = Lifestealz.instance.config.getDouble("heartuseSound.volume").toFloat()
val pitch = Lifestealz.instance.config.getDouble("heartuseSound.pitch").toFloat()
player.playSound(player.location, sound, volume, pitch)
}

val heartuseCommands = Lifestealz.instance.config.getStringList("heartuseCommands")
heartuseCommands.forEach {
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ eliminationCommands:
heartuseCommands:
# - "say &player& used a heart item"

heartuseSound:
enabled: true
sound: ENTITY_PLAYER_LEVELUP # Find all sounds here: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Sound.html
volume: 1.0
pitch: 1.0

reviveuseCommands:
# - "say &player& revived &target&"

Expand Down

0 comments on commit 781f72c

Please sign in to comment.