mirror of
https://github.com/Auxilor/Reforges.git
synced 2025-12-27 19:09:15 +00:00
Added enabled: true/false option to every sound in the config
This commit is contained in:
@@ -76,12 +76,14 @@ public class ReforgeHandler extends PluginDependent<EcoPlugin> {
|
||||
if (!EconomyManager.hasAmount(player, cost)) {
|
||||
player.sendMessage(this.getPlugin().getLangYml().getMessage("insufficient-money"));
|
||||
|
||||
player.playSound(
|
||||
player.getLocation(),
|
||||
Sound.valueOf(this.getPlugin().getConfigYml().getString("gui.insufficient-money-sound.id").toUpperCase()),
|
||||
1f,
|
||||
(float) this.getPlugin().getConfigYml().getDouble("gui.insufficient-money-sound.pitch")
|
||||
);
|
||||
if (this.getPlugin().getConfigYml().getBool("gui.insufficient-money-sound.enabled")) {
|
||||
player.playSound(
|
||||
player.getLocation(),
|
||||
Sound.valueOf(this.getPlugin().getConfigYml().getString("gui.insufficient-money-sound.id").toUpperCase()),
|
||||
1f,
|
||||
(float) this.getPlugin().getConfigYml().getDouble("gui.insufficient-money-sound.pitch")
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -92,13 +94,14 @@ public class ReforgeHandler extends PluginDependent<EcoPlugin> {
|
||||
xpCost *= Math.pow(this.getPlugin().getConfigYml().getDouble("reforge.cost-exponent"), reforges);
|
||||
if (player.getLevel() < xpCost) {
|
||||
player.sendMessage(this.getPlugin().getLangYml().getMessage("insufficient-xp"));
|
||||
|
||||
player.playSound(
|
||||
player.getLocation(),
|
||||
Sound.valueOf(this.getPlugin().getConfigYml().getString("gui.insufficient-money-sound.id").toUpperCase()),
|
||||
1f,
|
||||
(float) this.getPlugin().getConfigYml().getDouble("gui.insufficient-money-sound.pitch")
|
||||
);
|
||||
if (this.getPlugin().getConfigYml().getBool("gui.insufficient-money-sound.enabled")) {
|
||||
player.playSound(
|
||||
player.getLocation(),
|
||||
Sound.valueOf(this.getPlugin().getConfigYml().getString("gui.insufficient-money-sound.id").toUpperCase()),
|
||||
1f,
|
||||
(float) this.getPlugin().getConfigYml().getDouble("gui.insufficient-money-sound.pitch")
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -120,19 +123,25 @@ public class ReforgeHandler extends PluginDependent<EcoPlugin> {
|
||||
stone.setItemMeta(null);
|
||||
stone.setAmount(0);
|
||||
|
||||
if (this.getPlugin().getConfigYml().getBool("gui.stone-sound.enabled")) {
|
||||
player.playSound(
|
||||
player.getLocation(),
|
||||
Sound.valueOf(this.getPlugin().getConfigYml().getString("gui.stone-sound.id").toUpperCase()),
|
||||
1f,
|
||||
(float) this.getPlugin().getConfigYml().getDouble("gui.stone-sound.pitch")
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (this.getPlugin().getConfigYml().getBool("gui.sound.enabled")) {
|
||||
player.playSound(
|
||||
player.getLocation(),
|
||||
Sound.valueOf(this.getPlugin().getConfigYml().getString("gui.stone-sound.id").toUpperCase()),
|
||||
Sound.valueOf(this.getPlugin().getConfigYml().getString("gui.sound.id").toUpperCase()),
|
||||
1f,
|
||||
(float) this.getPlugin().getConfigYml().getDouble("gui.stone-sound.pitch")
|
||||
(float) this.getPlugin().getConfigYml().getDouble("gui.sound.pitch")
|
||||
);
|
||||
}
|
||||
|
||||
player.playSound(
|
||||
player.getLocation(),
|
||||
Sound.valueOf(this.getPlugin().getConfigYml().getString("gui.sound.id").toUpperCase()),
|
||||
1f,
|
||||
(float) this.getPlugin().getConfigYml().getDouble("gui.sound.pitch")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,13 +21,14 @@ class CommandOpen(
|
||||
sender.sendMessage(plugin.langYml.getMessage("invalid-player"))
|
||||
return
|
||||
}
|
||||
player.playSound(
|
||||
player.location,
|
||||
Sound.valueOf(plugin.configYml.getString("gui.open-sound.id").uppercase()),
|
||||
1f,
|
||||
plugin.configYml.getDouble("gui.open-sound.pitch").toFloat()
|
||||
)
|
||||
menu.open(player)
|
||||
if (plugin.configYml.getBool("gui.open-sound.enabled")) {
|
||||
player.playSound(
|
||||
player.location,
|
||||
Sound.valueOf(plugin.configYml.getString("gui.open-sound.id").uppercase()),
|
||||
1f,
|
||||
plugin.configYml.getDouble("gui.open-sound.pitch").toFloat()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun tabComplete(sender: CommandSender, args: List<String>): List<String> {
|
||||
|
||||
@@ -12,12 +12,14 @@ class CommandReforge(
|
||||
) : PluginCommand(plugin, "reforge", "reforges.command.reforge", true) {
|
||||
override fun onExecute(player: CommandSender, args: List<String>) {
|
||||
player as Player
|
||||
player.playSound(
|
||||
player.location,
|
||||
Sound.valueOf(plugin.configYml.getString("gui.open-sound.id").uppercase()),
|
||||
1f,
|
||||
plugin.configYml.getDouble("gui.open-sound.pitch").toFloat()
|
||||
)
|
||||
if (plugin.configYml.getBool("gui.open-sound.enabled")) {
|
||||
player.playSound(
|
||||
player.location,
|
||||
Sound.valueOf(plugin.configYml.getString("gui.open-sound.id").uppercase()),
|
||||
1f,
|
||||
plugin.configYml.getDouble("gui.open-sound.pitch").toFloat()
|
||||
)
|
||||
}
|
||||
menu.open(player)
|
||||
}
|
||||
}
|
||||
@@ -105,18 +105,22 @@ gui:
|
||||
- '&7You cannot reforge this item!'
|
||||
|
||||
sound:
|
||||
enabled: true
|
||||
id: BLOCK_ANVIL_USE
|
||||
pitch: 1
|
||||
|
||||
open-sound:
|
||||
enabled: true
|
||||
id: BLOCK_ANVIL_PLACE
|
||||
pitch: 0.8
|
||||
|
||||
stone-sound:
|
||||
enabled: true
|
||||
id: ENTITY_ENDER_DRAGON_HURT
|
||||
pitch: 0.5
|
||||
|
||||
insufficient-money-sound:
|
||||
enabled: true
|
||||
id: ENTITY_VILLAGER_NO
|
||||
pitch: 0.8
|
||||
|
||||
|
||||
Reference in New Issue
Block a user