diff --git a/eco-core/core-plugin/src/main/java/com/willfp/reforges/reforges/util/ReforgeHandler.java b/eco-core/core-plugin/src/main/java/com/willfp/reforges/reforges/util/ReforgeHandler.java index 2d9363d..0a220e0 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/reforges/reforges/util/ReforgeHandler.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/reforges/reforges/util/ReforgeHandler.java @@ -76,12 +76,14 @@ public class ReforgeHandler extends PluginDependent { 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 { 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 { 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") - ); } } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/reforges/commands/CommandOpen.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/reforges/commands/CommandOpen.kt index e42661d..e196719 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/reforges/commands/CommandOpen.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/reforges/commands/CommandOpen.kt @@ -21,12 +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() - ) + 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) } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/reforges/commands/CommandReforge.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/reforges/commands/CommandReforge.kt index 902a523..59fee3b 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/reforges/commands/CommandReforge.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/reforges/commands/CommandReforge.kt @@ -12,12 +12,14 @@ class CommandReforge( ) : PluginCommand(plugin, "reforge", "reforges.command.reforge", true) { override fun onExecute(player: CommandSender, args: List) { 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) } } \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/reforges/gui/ReforgeGUI.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/reforges/gui/ReforgeGUI.kt index 8df57f8..cf54a5e 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/reforges/gui/ReforgeGUI.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/reforges/gui/ReforgeGUI.kt @@ -7,6 +7,7 @@ import com.willfp.eco.core.gui.menu.Menu import com.willfp.eco.core.gui.slot.FillerMask import com.willfp.eco.core.gui.slot.MaskMaterials import com.willfp.eco.core.gui.slot.Slot +import com.willfp.eco.core.items.Items import com.willfp.eco.core.items.builder.ItemStackBuilder import com.willfp.eco.util.NumberUtils import com.willfp.reforges.ReforgesPlugin @@ -114,12 +115,9 @@ object ReforgeGUI { .mapNotNull { Material.getMaterial(it.uppercase()) } .toTypedArray() - val allowMaterial = - Material.getMaterial(plugin.configYml.getString("gui.show-allowed.allow-material", false).uppercase())!! - val denyMaterial = - Material.getMaterial(plugin.configYml.getString("gui.show-allowed.deny-material", false).uppercase())!! - val closeMaterial = - Material.getMaterial(plugin.configYml.getString("gui.close.material", false).toUpperCase())!! + val allowItem = Items.lookup(plugin.configYml.getString("gui.show-allowed.allow-material")).item + val denyItem = Items.lookup(plugin.configYml.getString("gui.show-allowed.deny-material")).item + val closeItem = Items.lookup(plugin.configYml.getString("gui.close.material")).item menu = Menu.builder(plugin.configYml.getInt("gui.rows")).apply { setTitle(plugin.langYml.getFormattedString("menu.title")) @@ -136,9 +134,11 @@ object ReforgeGUI { ).status if (status == ReforgeStatus.ALLOW || status == ReforgeStatus.ALLOW_STONE) { - previous.type = allowMaterial + previous.type = allowItem.type + previous.itemMeta = allowItem.itemMeta } else { - previous.type = denyMaterial + previous.type = denyItem.type + previous.itemMeta = denyItem.itemMeta } } }.build() @@ -172,7 +172,7 @@ object ReforgeGUI { plugin.configYml.getInt("gui.close.location.row"), plugin.configYml.getInt("gui.close.location.column"), Slot.builder( - ItemStackBuilder(closeMaterial) + ItemStackBuilder(closeItem) .setDisplayName(plugin.langYml.getFormattedString("menu.close")) .build() ).onLeftClick { event, _, _ -> diff --git a/eco-core/core-plugin/src/main/resources/config.yml b/eco-core/core-plugin/src/main/resources/config.yml index e759454..b3ff2aa 100644 --- a/eco-core/core-plugin/src/main/resources/config.yml +++ b/eco-core/core-plugin/src/main/resources/config.yml @@ -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