9
0
mirror of https://gitlab.com/SamB440/rpgregions-2.git synced 2026-01-04 15:31:38 +00:00

Allow playing custom sounds on discovery

This commit is contained in:
SamB440
2023-12-04 12:49:42 +00:00
parent 66f8ff897d
commit f95e4f82ad
5 changed files with 39 additions and 30 deletions

View File

@@ -46,7 +46,7 @@ public class ConfiguredRegion {
private String id;
private String customName;
private final List<DiscoveryReward> rewards;
@NeedsGUI private Sound sound;
@NeedsGUI private String soundName;
private String icon;
private int iconModel;
private int undiscoveredIconModel;
@@ -89,7 +89,7 @@ public class ConfiguredRegion {
this.id = id;
this.customName = customName;
this.rewards = rewards;
this.sound = Sound.UI_TOAST_CHALLENGE_COMPLETE;
this.soundName = Sound.UI_TOAST_CHALLENGE_COMPLETE.name();
Optional<Material> defaultIcon = Optional.of(Material.valueOf(RPGRegionsAPI.getAPI().getConfig().getString("settings.server.gui.default_region_icon")));
this.icon = defaultIcon.map(Enum::name).orElseGet(Material.TOTEM_OF_UNDYING::name);
this.undiscoveredIcon = defaultIcon.map(Enum::name).orElseGet(Material.TOTEM_OF_UNDYING::name);
@@ -116,7 +116,7 @@ public class ConfiguredRegion {
public ConfiguredRegion(@Nullable World world, String id, String customName,
List<DiscoveryReward> rewards, List<RegionEffect> effects, Sound sound, Material icon) {
this(world, id, customName, rewards, effects);
this.sound = sound;
this.soundName = sound.name();
this.icon = icon.name();
}
@@ -142,8 +142,8 @@ public class ConfiguredRegion {
}
@Nullable
public Sound getSound() {
return sound;
public String getSoundName() {
return soundName;
}
@Nullable