Skip to content

Commit bc241f9

Browse files
committed
add-option-disable-sound
1 parent 4a6a6f5 commit bc241f9

3 files changed

Lines changed: 30 additions & 5 deletions

File tree

CONFIG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,26 @@ publickits:
112112
```
113113

114114

115+
### **Sounds**
116+
117+
This section allows you to enable, disable, and customize the sounds played by the plugin.
118+
119+
```yaml
120+
sounds:
121+
enabled: true # Set to false to disable all plugin sounds.
122+
# Sound played on successful actions (e.g. saving a kit)
123+
success: ENTITY_PLAYER_LEVELUP
124+
# Sound played on failed actions (e.g. attempting to use a disabled command)
125+
failure: ENTITY_ITEM_BREAK
126+
# Sound played when a button is clicked in a GUI
127+
click: UI_BUTTON_CLICK
128+
# Sound played when a GUI is opened
129+
open_gui: UI_BUTTON_CLICK
130+
# Sound played when a GUI is closed
131+
close_gui: UI_BUTTON_CLICK
132+
```
133+
134+
115135
### **Anti-Exploit**
116136
117137
This section allows you to enable or disable anti-exploit features, commonly applicable to this plugin.

src/main/java/dev/noah/perplayerkit/util/SoundManager.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ public static void playCloseGui(Player player) {
5858
}
5959

6060
private static void play(Player player, Sound sound) {
61+
// exit if sounds are disabled
62+
if (!PerPlayerKit.getPlugin().getConfig().getBoolean("sounds.enabled", true)) {
63+
return;
64+
}
6165
player.playSound(player.getLocation(), sound, 1.0f, 1.0f);
6266
}
6367
}

src/main/resources/config.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,14 @@ feature:
151151

152152
# Sound settings for plugin feedback
153153
sounds:
154-
# Sound to play on successful actions (e.g. kit load, save, delete, repair)
154+
enabled: true
155+
# Sound played on successful actions (e.g. saving a kit)
155156
success: ENTITY_PLAYER_LEVELUP
156-
# Sound to play on failed actions or errors
157+
# Sound played on failed actions (e.g. attempting to use a disabled command)
157158
failure: ENTITY_ITEM_BREAK
158-
# Sound for generic UI clicks
159+
# Sound played when a button is clicked in a GUI
159160
click: UI_BUTTON_CLICK
160-
# Sound when opening a GUI/menu
161+
# Sound played when a GUI is opened
161162
open_gui: UI_BUTTON_CLICK
162-
# Sound when closing a GUI/menu
163+
# Sound played when a GUI is closed
163164
close_gui: UI_BUTTON_CLICK

0 commit comments

Comments
 (0)