feat(bukkit): 允许设置某些特定按钮没有点击音效
This commit is contained in:
@@ -90,8 +90,13 @@ public class PageConfig implements InventoryHolder {
|
||||
ConfigurationSection buttonSoundConfig = rawConfig.getConfigurationSection("sounds");
|
||||
if (buttonSoundConfig != null) {
|
||||
for (String key : buttonSoundConfig.getKeys(false)) {
|
||||
String soundName = buttonSoundConfig.getString(key, "");
|
||||
if (soundName.isEmpty() || soundName.equalsIgnoreCase("null")) {
|
||||
buttonSounds.put(key, null);
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
buttonSounds.put(key, Sound.valueOf(buttonSoundConfig.getString(key)));
|
||||
buttonSounds.put(key, Sound.valueOf(soundName));
|
||||
} catch (Exception e) {
|
||||
HamsterCorePlugin.getInstance().getLogger().warning("初始化 PageConfig 时遇到了一个异常:");
|
||||
e.printStackTrace();
|
||||
|
@@ -14,6 +14,7 @@ groups:
|
||||
'!': "info"
|
||||
|
||||
sounds:
|
||||
"empty": ""
|
||||
"default": "UI_BUTTON_CLICK"
|
||||
"accept": "ENTITY_PLAYER_LEVELUP"
|
||||
"deny": "BLOCK_ANVIL_HIT"
|
||||
|
Reference in New Issue
Block a user