up da te fi sh
This commit is contained in:
parent
90c80170bb
commit
521e11197b
|
|
@ -46,6 +46,7 @@ object FishListener {
|
|||
if (fishEvent.state == PlayerFishEvent.State.CAUGHT_FISH) {
|
||||
rod.handleFished(fishEvent)
|
||||
}
|
||||
|
||||
val resultItem = if (rod.durability <= 0) {
|
||||
player.sendMessage("§c| §7您的鱼竿已损坏")
|
||||
ItemStack(Material.AIR)
|
||||
|
|
|
|||
|
|
@ -29,16 +29,20 @@ class BaitReward(config: ConfigurationSection) {
|
|||
rod.luck = if (rod.luck - it.deLuck > 0) rod.luck - it.deLuck else 0
|
||||
}
|
||||
|
||||
// handle Guarantees
|
||||
if (it.isGuarantees) {
|
||||
if (rod.luck == it.luckLimit) {
|
||||
it.execute(player)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// handle common
|
||||
it.execute(player)
|
||||
}
|
||||
}
|
||||
|
||||
fun doGuarantee(player: Player, luck: Int, legacy: Int) {
|
||||
rewardList.forEach {
|
||||
// handle Guarantees
|
||||
if (it.isGuarantees) {
|
||||
if (it.luckLimit in legacy..luck) {
|
||||
it.execute(player)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -25,10 +25,14 @@ data class FishingRodInstance(
|
|||
|
||||
fun handleFished(fishEvent: PlayerFishEvent) {
|
||||
fishEvent.expToDrop = 0
|
||||
luck++
|
||||
fishEvent.caught!!.remove()
|
||||
fishEvent.player.inventory.itemInMainHand
|
||||
val bait = BaitManager.baits[item.itemMeta!!.persistentDataContainer[SanseFish.baitKey, PersistentDataType.STRING]?: return]!!
|
||||
luck++
|
||||
val maxLuck = item.itemMeta!!.persistentDataContainer.getOrDefault(SanseFish.maxLuckKey, PersistentDataType.INTEGER, type.defaultLuck)
|
||||
if (luck > maxLuck) {
|
||||
bait.rewards.doGuarantee(fishEvent.player, luck, maxLuck)
|
||||
}
|
||||
bait.rewards.doReward(fishEvent.player, this)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue