Skip to content

Commit c24b6d7

Browse files
committed
fix sounds not working after registry update in 9.30
update spigot api to 1.21.4
1 parent 065522f commit c24b6d7

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
<dependency>
6969
<groupId>org.spigotmc</groupId>
7070
<artifactId>spigot-api</artifactId>
71-
<version>1.21.3-R0.1-SNAPSHOT</version>
71+
<version>1.21.4-R0.1-SNAPSHOT</version>
7272
<scope>provided</scope>
7373
</dependency>
7474
<!-- Vault API -->

src/main/java/tntrun/arena/handlers/SoundHandler.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public SoundHandler (TNTRun plugin) {
3535

3636
@Override
3737
public void NOTE_PLING(Player p, float volume, float pitch) {
38-
NamespacedKey key = NamespacedKey.minecraft("block_note_block_pling");
38+
NamespacedKey key = getKey("block_note_block_pling");
3939
p.playSound(p.getLocation(), Registry.SOUNDS.get(key), volume, pitch);
4040
}
4141

@@ -74,7 +74,7 @@ public void BLOCK_BREAK(Block fblock) {
7474
* @return sound
7575
*/
7676
private Sound getSound(String path) {
77-
NamespacedKey key = NamespacedKey.minecraft(plugin.getConfig().getString("sounds." + path + ".sound").toLowerCase());
77+
NamespacedKey key = getKey(plugin.getConfig().getString("sounds." + path + ".sound"));
7878
return Registry.SOUNDS.get(key);
7979
}
8080

@@ -106,4 +106,7 @@ private boolean isSoundEnabled(String path) {
106106
return plugin.getConfig().getBoolean("sounds." + path + ".enabled");
107107
}
108108

109+
private NamespacedKey getKey(String keyString) {
110+
return NamespacedKey.minecraft(keyString.toLowerCase().replaceAll("_", "."));
111+
}
109112
}

0 commit comments

Comments
 (0)