Skip to content

Commit

Permalink
Return null if enum found no matches
Browse files Browse the repository at this point in the history
  • Loading branch information
libraryaddict committed Nov 17, 2024
1 parent f8594e7 commit 9815a74
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ private static String[] getPackages() {
private static String getVersion() {
String version = Bukkit.getVersion() + "\t" + LibsDisguises.getInstance().getDescription().getVersion();

// 1.21.3 has every build with this
if (DisguiseUtilities.isRunningPaper() && NmsVersion.v1_21_R2.isSupported()) {
ServerBuildInfo buildInfo = ServerBuildInfo.buildInfo();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2683,6 +2683,8 @@ public static <T> T fromEnum(Class<T> clss, String name) {

return e;
}

return null;
}

return (T) Bukkit.getRegistry((Class<Keyed>) clss).get(new NamespacedKey(split[0], split[1]));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private void loadSounds() {

for (String sound : sounds) {
try {
Sound actualSound = ReflectionManager.fromEnum(Sound.class,sound);
Sound actualSound = ReflectionManager.fromEnum(Sound.class, sound);

group.addSound(actualSound, type);
} catch (Exception ignored) {
Expand Down

0 comments on commit 9815a74

Please sign in to comment.