9
0
mirror of https://github.com/Auxilor/EcoSkills.git synced 2026-01-02 22:02:19 +00:00

Merge branch '0ft3n_master'

# Conflicts:
#	build.gradle
#	gradle.properties
This commit is contained in:
Auxilor
2022-11-23 18:05:35 +00:00
10 changed files with 40 additions and 14 deletions

View File

@@ -47,7 +47,7 @@ allprojects {
dependencies {
compileOnly 'com.willfp:eco:6.44.0'
implementation 'com.willfp:libreforge:3.121.0'
implementation 'com.willfp:libreforge:3.120.0'
implementation 'org.joml:joml:1.10.4'
compileOnly fileTree(dir: '../../lib', include: ['*.jar'])
compileOnly 'com.github.LegameMc:EnchantGui-API:1.0'

View File

@@ -101,7 +101,7 @@ class CommandRecount(plugin: EcoPlugin): Subcommand(
if (reward.obj is Effect && reward.obj == effect) {
for (i in range) {
val obj = reward.obj
val toGive = skill.getLevelUpReward(obj, i)
val toGive = skill.getLevelUpReward(reward, i)
ofSkill+=toGive
}
}

View File

@@ -22,7 +22,7 @@ class DataListener : Listener {
}
event.player.setEffectLevel(
obj,
skill.getCumulativeLevelUpReward(obj, event.player.getSkillLevel(skill))
skill.getCumulativeLevelUpReward(levelUpReward, event.player.getSkillLevel(skill))
)
}
}

View File

@@ -32,6 +32,11 @@ class EffectSerratedStrikes : Effect(
return
}
if (victim.hasMetadata("serratedStrikes") &&
this.config.getBool("prevent-multiple-bleeding")) {
return
}
if (!this.checkConditions(player)) {
return
}
@@ -52,10 +57,13 @@ class EffectSerratedStrikes : Effect(
var currentBleedCount = 0
victim.setMetadata("serratedStrikes", plugin.metadataValueFactory.create(1))
plugin.runnableFactory.create { bukkitRunnable: RunnableTask ->
currentBleedCount++
victim.damage(bleedDamage)
if (currentBleedCount >= bleedCount) {
victim.removeMetadata("serratedStrikes", plugin)
bukkitRunnable.cancel()
return@create
}

View File

@@ -214,9 +214,9 @@ abstract class Skill @JvmOverloads constructor(
return ArrayList(rewards)
}
fun getLevelUpReward(skillObject: SkillObject, to: Int): Int {
fun getLevelUpReward(skillObjectReward: SkillObjectReward, to: Int): Int {
for (reward in rewards) {
if (reward.obj != skillObject) {
if (reward != skillObjectReward) {
continue
}
@@ -231,10 +231,10 @@ abstract class Skill @JvmOverloads constructor(
return 0
}
fun getCumulativeLevelUpReward(skillObject: SkillObject, to: Int): Int {
fun getCumulativeLevelUpReward(skillObjectReward: SkillObjectReward, to: Int): Int {
var levels = 0
for (i in 1..to) {
levels += getLevelUpReward(skillObject, i)
levels += getLevelUpReward(skillObjectReward, i)
}
return levels
@@ -264,7 +264,7 @@ abstract class Skill @JvmOverloads constructor(
val skillObject = levelUpReward.obj
if (skillObject is Effect) {
val objLevel = this.getCumulativeLevelUpReward(skillObject, level)
val objLevel = this.getCumulativeLevelUpReward(levelUpReward, level)
msg = msg.replace(
"%ecoskills_${skillObject.id}_description%",
skillObject.getDescription(objLevel)
@@ -303,7 +303,7 @@ abstract class Skill @JvmOverloads constructor(
for (levelUpReward in this.getLevelUpRewards()) {
val skillObject = levelUpReward.obj
val objLevel = this.getCumulativeLevelUpReward(skillObject, level)
val objLevel = this.getCumulativeLevelUpReward(levelUpReward, level)
s = s.replace("%ecoskills_${skillObject.id}%", objLevel.toString())
s = s.replace("%ecoskills_${skillObject.id}_numeral%", NumberUtils.toNumeral(objLevel))

View File

@@ -20,7 +20,7 @@ class SkillLevellingListener : Listener {
for (reward in skill.getLevelUpRewards()) {
val obj = reward.obj
val toGive = skill.getLevelUpReward(obj, to)
val toGive = skill.getLevelUpReward(reward, to)
when (obj) {
is Effect -> {

View File

@@ -5,4 +5,20 @@ import com.willfp.ecoskills.SkillObject
data class SkillObjectReward (
val obj: SkillObject,
val options: SkillObjectOptions
)
) {
override fun equals(other: Any?): Boolean {
if (other !is SkillObjectReward) {
return false
}
return this.obj == other.obj && this.options.endLevel == other.options.endLevel &&
this.options.startLevel == other.options.startLevel
&& this.options.amountPerLevel == other.options.amountPerLevel
}
override fun hashCode(): Int {
var result = obj.hashCode()
result = 31 * result + options.hashCode()
return result
}
}

View File

@@ -44,7 +44,7 @@ class SkillExploration : Skill(
}
}
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
fun handleLevelling(event: EntityDamageEvent) {
val player = (event.entity as? Player)?.filterSkillEnabled() ?: return

View File

@@ -69,6 +69,8 @@ serrated_strikes:
bleed-tick-spacing: 15
# The amount of bleed ticks to give
bleed-ticks: 4
# Prevent multiple stacks of serrated strikes
prevent-multiple-bleeding: false
# Disabled worlds
disabled-in-worlds: [ ]
# Conditions

View File

@@ -1,4 +1,4 @@
#libreforge-updater
#Wed Nov 23 17:25:08 GMT 2022
version=1.106.0
#Thu Nov 17 08:38:30 GMT 2022
version=1.105.1
plugin-name=EcoSkills