mirror of
https://github.com/Auxilor/EcoSkills.git
synced 2025-12-31 12:56:31 +00:00
Added disabled-in-worlds to stats
This commit is contained in:
@@ -17,6 +17,11 @@ class StatCritChance : Stat(
|
||||
fun handle(event: EntityDamageByEntityEvent) {
|
||||
val player = event.damager.tryAsPlayer() ?: return
|
||||
|
||||
if (this.config.getStrings("disabled-in-worlds").contains(player.world.name)
|
||||
|| Stats.CRIT_DAMAGE.config.getStrings("disabled-in-worlds").contains(player.world.name)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (NumberUtils.randFloat(0.0, 100.0) >= (this.config.getDouble("chance-per-level") * player.getStatLevel(this))) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -18,6 +18,10 @@ class StatDefense : Stat(
|
||||
|
||||
val player = event.entity as Player
|
||||
|
||||
if (this.config.getStrings("disabled-in-worlds").contains(player.world.name)) {
|
||||
return
|
||||
}
|
||||
|
||||
var multiplier = this.config.getDouble("percent-less-damage-per-level") * player.getStatLevel(this)
|
||||
multiplier /= 100
|
||||
multiplier += 1
|
||||
|
||||
@@ -15,6 +15,11 @@ class StatFerocity : Stat(
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
fun handle(event: EntityDamageByEntityEvent) {
|
||||
val player = event.damager.tryAsPlayer() ?: return
|
||||
|
||||
if (this.config.getStrings("disabled-in-worlds").contains(player.world.name)) {
|
||||
return
|
||||
}
|
||||
|
||||
val victim = if (event.entity is LivingEntity) event.entity as LivingEntity else return
|
||||
|
||||
if (victim.hasMetadata("ferocity")) {
|
||||
|
||||
@@ -5,6 +5,9 @@ import com.willfp.ecoskills.stats.Stat
|
||||
import org.bukkit.attribute.Attribute
|
||||
import org.bukkit.attribute.AttributeModifier
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.EventPriority
|
||||
import org.bukkit.event.player.PlayerChangedWorldEvent
|
||||
|
||||
class StatSpeed : Stat(
|
||||
"speed"
|
||||
@@ -17,11 +20,25 @@ class StatSpeed : Stat(
|
||||
AttributeModifier.Operation.MULTIPLY_SCALAR_1
|
||||
)
|
||||
val instance = player.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED) ?: return
|
||||
|
||||
instance.removeModifier(modifier)
|
||||
|
||||
if (this.config.getStrings("disabled-in-worlds").contains(player.world.name)) {
|
||||
return
|
||||
}
|
||||
|
||||
plugin.scheduler.run {
|
||||
instance.removeModifier(modifier)
|
||||
instance.addModifier(modifier)
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
fun handle(event: PlayerChangedWorldEvent) {
|
||||
val player = event.player
|
||||
|
||||
plugin.scheduler.run {
|
||||
updateStatLevel(player)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,10 @@ class StatStrength : Stat(
|
||||
fun handle(event: EntityDamageByEntityEvent) {
|
||||
val player = event.damager.tryAsPlayer() ?: return
|
||||
|
||||
if (this.config.getStrings("disabled-in-worlds").contains(player.world.name)) {
|
||||
return
|
||||
}
|
||||
|
||||
var multiplier = this.config.getDouble("percent-more-damage-per-level") * player.getStatLevel(this)
|
||||
multiplier /= 100
|
||||
multiplier += 1
|
||||
|
||||
@@ -14,6 +14,10 @@ class StatWisdom : Stat(
|
||||
fun handle(event: NaturalExpGainEvent) {
|
||||
val player = event.expChangeEvent.player
|
||||
|
||||
if (this.config.getStrings("disabled-in-worlds").contains(player.world.name)) {
|
||||
return
|
||||
}
|
||||
|
||||
var multiplier = this.config.getDouble("percent-more-xp-gain") * player.getStatLevel(this)
|
||||
multiplier /= 100
|
||||
multiplier += 1
|
||||
|
||||
@@ -272,10 +272,14 @@ skills:
|
||||
stats:
|
||||
defense:
|
||||
name: "&#e884b0🛡 Defense"
|
||||
# Disabled worlds
|
||||
disabled-in-worlds: []
|
||||
# 100% halves the incoming damage
|
||||
percent-less-damage-per-level: 0.25
|
||||
strength:
|
||||
name: "&#db0000🗡 Strength"
|
||||
# Disabled worlds
|
||||
disabled-in-worlds: []
|
||||
# 100% is double damage
|
||||
percent-more-damage-per-level: 0.25
|
||||
crit_chance:
|
||||
@@ -284,21 +288,29 @@ stats:
|
||||
chance-per-level: 1
|
||||
crit_damage:
|
||||
name: "&9☠ Crit Damage"
|
||||
# Disabled worlds
|
||||
disabled-in-worlds: []
|
||||
# The percent more damage to deal on crits for each level.
|
||||
percent-more-damage-per-level: 0.5
|
||||
# The amount more damage to deal on crits by default.
|
||||
base-percent-more: 50
|
||||
speed:
|
||||
name: "(ffe6✦ Speed"
|
||||
# Disabled worlds
|
||||
disabled-in-worlds: []
|
||||
# The percent more speed to give for the speed attribute (internal in the game)
|
||||
# for each level
|
||||
percent-faster-per-level: 1
|
||||
wisdom:
|
||||
name: "*f566✎ Wisdom"
|
||||
# Disabled worlds
|
||||
disabled-in-worlds: []
|
||||
# The percent more xp to gain from orbs for each level of the stat.
|
||||
percent-more-xp-gain: 1
|
||||
ferocity:
|
||||
name: "b0000⫽ Ferocity"
|
||||
# Disabled worlds
|
||||
disabled-in-worlds: []
|
||||
# The percent chance to deal damage twice
|
||||
chance-per-level: 0.5
|
||||
|
||||
|
||||
Reference in New Issue
Block a user