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