-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove need for versioning by using registry
- Loading branch information
1 parent
f65254f
commit 4bf4dbe
Showing
4 changed files
with
32 additions
and
90 deletions.
There are no files selected for viewing
65 changes: 0 additions & 65 deletions
65
src/main/java/com/iantapply/wynncraft/nbs/enums/Sound.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 13 additions & 3 deletions
16
src/main/java/com/iantapply/wynncraft/nbs/instruments/NBSInstrument.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,24 @@ | ||
package com.iantapply.wynncraft.nbs.instruments; | ||
|
||
import com.iantapply.wynncraft.nbs.utils.InstrumentUtils; | ||
import org.bukkit.NamespacedKey; | ||
import org.bukkit.Registry; | ||
import org.bukkit.Sound; | ||
|
||
public class NBSInstrument { | ||
public static Sound getInstrument(byte instrument) { | ||
String instrumentName = getInstrumentName(instrument); | ||
NamespacedKey key = NamespacedKey.minecraft(instrumentName); | ||
Sound sound = Registry.SOUNDS.get(key); | ||
|
||
public static org.bukkit.Sound getInstrument(byte instrument) { | ||
return org.bukkit.Sound.valueOf(getInstrumentName(instrument)); | ||
if (sound == null) { | ||
throw new IllegalArgumentException("Invalid instrument: " + instrumentName); | ||
} | ||
|
||
return sound; | ||
} | ||
|
||
public static String getInstrumentName(byte instrument) { | ||
return InstrumentUtils.getInstrumentName(instrument); | ||
return InstrumentUtils.getNamespacedKey(instrument); | ||
} | ||
} |
37 changes: 17 additions & 20 deletions
37
src/main/java/com/iantapply/wynncraft/nbs/utils/InstrumentUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters