mirror of
https://github.com/Auxilor/EcoSkills.git
synced 2025-12-31 12:56:31 +00:00
@@ -23,7 +23,7 @@ class CommandToggleSound(plugin: EcoPlugin) :
|
||||
) {
|
||||
|
||||
override fun onExecute(sender: CommandSender, args: List<String>) {
|
||||
if (this.plugin.configYml.getBool("skills.progress.sound.enabled")) {
|
||||
if (!this.plugin.configYml.getBool("skills.progress.sound.enabled")) {
|
||||
sender.sendMessage(this.plugin.langYml.getMessage("xp-gain-sound-disabled"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -5,9 +5,13 @@ import com.willfp.eco.core.items.Items
|
||||
import com.willfp.eco.util.NumberUtils
|
||||
import com.willfp.ecoskills.effects.Effect
|
||||
import com.willfp.ecoskills.getEffectLevel
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.Location
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.EventPriority
|
||||
import org.bukkit.event.player.PlayerFishEvent
|
||||
import org.bukkit.inventory.ItemStack
|
||||
|
||||
class EffectEyeOfTheDepths: Effect(
|
||||
"eye_of_the_depths"
|
||||
@@ -38,13 +42,39 @@ class EffectEyeOfTheDepths: Effect(
|
||||
|
||||
val items = config.getStrings("rare-loot-items")
|
||||
|
||||
val itemName = items[NumberUtils.randInt(0, items.size - 1)]
|
||||
val reward = items[NumberUtils.randInt(0, items.size - 1)]
|
||||
|
||||
val item = Items.lookup(itemName).item
|
||||
|
||||
DropQueue(player)
|
||||
.setLocation(event.caught!!.location)
|
||||
.addItem(item)
|
||||
.push()
|
||||
LootReward.fromString(reward).reward(player, event.caught!!.location)
|
||||
}
|
||||
}
|
||||
|
||||
class LootReward(
|
||||
private val item: ItemStack? = null,
|
||||
private val command: String? = null
|
||||
)
|
||||
{
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun fromString(from: String): LootReward {
|
||||
return if (from.startsWith("command::", true)) {
|
||||
LootReward(command = from.replace("command::", "").replace("command:: ", ""))
|
||||
} else {
|
||||
LootReward(item = Items.lookup(from).item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun reward(player: Player, location: Location = player.location) {
|
||||
if (item != null) {
|
||||
DropQueue(player)
|
||||
.setLocation(location)
|
||||
.addItem(item)
|
||||
.push()
|
||||
}
|
||||
else {
|
||||
command?.let { Bukkit.dispatchCommand(Bukkit.getConsoleSender(), it.replace("%player%", player.name)) }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ eye_of_the_depths:
|
||||
|
||||
# Disabled worlds
|
||||
disabled-in-worlds: []
|
||||
rare-loot-items:
|
||||
rare-loot-items: # Either an item from items lookup system, or a command (- command: say %player% is cool)
|
||||
- enchanted_book confusion:1
|
||||
- enchanted_book confusion:2
|
||||
- netherite_ingot
|
||||
|
||||
@@ -83,4 +83,8 @@ xp-rewards:
|
||||
- "sugar_cane:2"
|
||||
- "brown_mushroom:6"
|
||||
- "red_mushroom:6"
|
||||
- "cocoa:3"
|
||||
- "cocoa:3"
|
||||
- "nether_wart:4"
|
||||
- "bamboo:1"
|
||||
- "sweet_berries:3"
|
||||
- "glow_berries:3"
|
||||
Reference in New Issue
Block a user