From 74ea265f313e946fbbd417a464a02c3b217a7fa4 Mon Sep 17 00:00:00 2001 From: MiniDay <372403923@qq.com> Date: Sun, 22 Jan 2023 02:01:50 +0800 Subject: [PATCH] =?UTF-8?q?feat(bukkit):=20=E5=85=81=E8=AE=B8=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E6=9F=90=E4=BA=9B=E7=89=B9=E5=AE=9A=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E7=82=B9=E5=87=BB=E9=9F=B3=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/hamster3/mc/plugin/core/bukkit/page/PageConfig.java | 7 ++++++- hamster-core-bukkit/src/main/resources/pages/FixedPage.yml | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hamster-core-bukkit/src/main/java/cn/hamster3/mc/plugin/core/bukkit/page/PageConfig.java b/hamster-core-bukkit/src/main/java/cn/hamster3/mc/plugin/core/bukkit/page/PageConfig.java index 01a94e6..d879718 100644 --- a/hamster-core-bukkit/src/main/java/cn/hamster3/mc/plugin/core/bukkit/page/PageConfig.java +++ b/hamster-core-bukkit/src/main/java/cn/hamster3/mc/plugin/core/bukkit/page/PageConfig.java @@ -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(); diff --git a/hamster-core-bukkit/src/main/resources/pages/FixedPage.yml b/hamster-core-bukkit/src/main/resources/pages/FixedPage.yml index 03f24fd..bf79b9b 100644 --- a/hamster-core-bukkit/src/main/resources/pages/FixedPage.yml +++ b/hamster-core-bukkit/src/main/resources/pages/FixedPage.yml @@ -14,6 +14,7 @@ groups: '!': "info" sounds: + "empty": "" "default": "UI_BUTTON_CLICK" "accept": "ENTITY_PLAYER_LEVELUP" "deny": "BLOCK_ANVIL_HIT"