mirror of
https://github.com/Auxilor/EcoSkills.git
synced 2026-01-04 15:41:36 +00:00
Updated to eco 6.12.1
This commit is contained in:
@@ -8,7 +8,6 @@ import com.willfp.ecoskills.commands.CommandSkills;
|
||||
import com.willfp.ecoskills.config.EffectsYml;
|
||||
import com.willfp.ecoskills.data.DataListener;
|
||||
import com.willfp.ecoskills.data.LeaderboardHandler;
|
||||
import com.willfp.ecoskills.data.PlayerBlockListener;
|
||||
import com.willfp.ecoskills.data.SaveHandler;
|
||||
import com.willfp.ecoskills.data.storage.DataHandler;
|
||||
import com.willfp.ecoskills.data.storage.MySQLDataHandler;
|
||||
@@ -16,12 +15,6 @@ import com.willfp.ecoskills.data.storage.YamlDataHandler;
|
||||
import com.willfp.ecoskills.effects.Effect;
|
||||
import com.willfp.ecoskills.effects.Effects;
|
||||
import com.willfp.ecoskills.integrations.EcoEnchantsEnchantingLeveller;
|
||||
import com.willfp.ecoskills.integrations.afk.AFKHandlerKt;
|
||||
import com.willfp.ecoskills.integrations.afk.impl.AFKIntegrationEssentials;
|
||||
import com.willfp.ecoskills.integrations.hologram.HologramManager;
|
||||
import com.willfp.ecoskills.integrations.hologram.wrappers.HologramCMI;
|
||||
import com.willfp.ecoskills.integrations.hologram.wrappers.HologramGHolo;
|
||||
import com.willfp.ecoskills.integrations.hologram.wrappers.HologramHolographicDisplays;
|
||||
import com.willfp.ecoskills.skills.Skill;
|
||||
import com.willfp.ecoskills.skills.SkillDisplayListener;
|
||||
import com.willfp.ecoskills.skills.SkillLevellingListener;
|
||||
@@ -125,7 +118,6 @@ public class EcoSkillsPlugin extends EcoPlugin {
|
||||
new SkillDisplayListener(this),
|
||||
new StatModifierListener(),
|
||||
new DataListener(),
|
||||
new PlayerBlockListener(this),
|
||||
new DamageIndicatorListener(this)
|
||||
);
|
||||
}
|
||||
@@ -141,11 +133,7 @@ public class EcoSkillsPlugin extends EcoPlugin {
|
||||
@Override
|
||||
protected List<IntegrationLoader> loadIntegrationLoaders() {
|
||||
return Arrays.asList(
|
||||
new IntegrationLoader("HolographicDisplays", () -> HologramManager.register(new HologramHolographicDisplays(this))),
|
||||
new IntegrationLoader("GHolo", () -> HologramManager.register(new HologramGHolo(this))),
|
||||
new IntegrationLoader("CMI", () -> HologramManager.register(new HologramCMI(this))),
|
||||
new IntegrationLoader("EcoEnchants", () -> this.getEventManager().registerListener(new EcoEnchantsEnchantingLeveller(this))),
|
||||
new IntegrationLoader("Essentials", () -> AFKHandlerKt.registerIntegration(new AFKIntegrationEssentials()))
|
||||
new IntegrationLoader("EcoEnchants", () -> this.getEventManager().registerListener(new EcoEnchantsEnchantingLeveller(this)))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.willfp.ecoskills
|
||||
|
||||
import org.bukkit.potion.PotionData
|
||||
import org.bukkit.potion.PotionType
|
||||
|
||||
val PotionData.duration: Int
|
||||
get() {
|
||||
if (this.isExtended) {
|
||||
return when (this.type) {
|
||||
PotionType.INSTANT_DAMAGE, PotionType.INSTANT_HEAL -> 0
|
||||
PotionType.POISON, PotionType.REGEN -> 1800
|
||||
PotionType.SLOW_FALLING, PotionType.WEAKNESS, PotionType.SLOWNESS -> 4800
|
||||
PotionType.TURTLE_MASTER -> 800
|
||||
else -> 9600
|
||||
}
|
||||
}
|
||||
if (this.isUpgraded) {
|
||||
return when (this.type) {
|
||||
PotionType.INSTANT_DAMAGE, PotionType.INSTANT_HEAL -> 0
|
||||
PotionType.POISON, PotionType.REGEN -> 420
|
||||
PotionType.SLOW_FALLING, PotionType.WEAKNESS, PotionType.SLOWNESS -> 440
|
||||
PotionType.TURTLE_MASTER -> 400
|
||||
else -> 1800
|
||||
}
|
||||
}
|
||||
return when (this.type) {
|
||||
PotionType.INSTANT_DAMAGE, PotionType.INSTANT_HEAL -> 0
|
||||
PotionType.POISON, PotionType.REGEN -> 900
|
||||
PotionType.SLOW_FALLING, PotionType.WEAKNESS, PotionType.SLOWNESS -> 400
|
||||
PotionType.TURTLE_MASTER -> 1800
|
||||
else -> 3600
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package com.willfp.ecoskills.data
|
||||
|
||||
import com.willfp.eco.util.NamespacedKeyUtils
|
||||
import com.willfp.ecoskills.EcoSkillsPlugin
|
||||
import org.bukkit.block.Block
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.EventPriority
|
||||
import org.bukkit.event.Listener
|
||||
import org.bukkit.event.block.BlockBreakEvent
|
||||
import org.bukkit.event.block.BlockMultiPlaceEvent
|
||||
import org.bukkit.event.block.BlockPlaceEvent
|
||||
import org.bukkit.persistence.PersistentDataType
|
||||
|
||||
class PlayerBlockListener(
|
||||
private val plugin: EcoSkillsPlugin
|
||||
) : Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
fun onPlace(event: BlockPlaceEvent) {
|
||||
val block = event.blockPlaced
|
||||
|
||||
writeKey(block)
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
fun onPlace(event: BlockMultiPlaceEvent) {
|
||||
val block = event.blockPlaced
|
||||
|
||||
writeKey(block)
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
fun onBreak(event: BlockBreakEvent) {
|
||||
val block = event.block
|
||||
|
||||
this.plugin.scheduler.run {
|
||||
removeKey(block)
|
||||
}
|
||||
}
|
||||
|
||||
private fun writeKey(block: Block) {
|
||||
val loc = block.location.hashCode().toString(16)
|
||||
block.chunk.persistentDataContainer.set(
|
||||
NamespacedKeyUtils.create("ecoskills", loc.lowercase()),
|
||||
PersistentDataType.INTEGER,
|
||||
1
|
||||
)
|
||||
}
|
||||
|
||||
private fun removeKey(block: Block) {
|
||||
val loc = block.location.hashCode().toString(16)
|
||||
block.chunk.persistentDataContainer.remove(NamespacedKeyUtils.create("ecoskills", loc.lowercase()))
|
||||
}
|
||||
}
|
||||
|
||||
fun Block.isPlayerPlaced(): Boolean {
|
||||
val chunk = this.chunk
|
||||
return chunk.persistentDataContainer.has(
|
||||
NamespacedKeyUtils.create(
|
||||
"ecoskills",
|
||||
this.location.hashCode().toString(16)
|
||||
), PersistentDataType.INTEGER
|
||||
)
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.willfp.ecoskills.data
|
||||
|
||||
import com.willfp.eco.core.EcoPlugin
|
||||
import com.willfp.ecoskills.data.storage.PlayerProfile.Companion.profile
|
||||
import org.bukkit.OfflinePlayer
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.Listener
|
||||
import org.bukkit.event.player.PlayerJoinEvent
|
||||
import org.bukkit.event.player.PlayerQuitEvent
|
||||
|
||||
class SavedPlayerNameListener(
|
||||
private val plugin: EcoPlugin
|
||||
) : Listener {
|
||||
@EventHandler
|
||||
fun onJoin(event: PlayerJoinEvent) {
|
||||
event.player.savedDisplayName = event.player.displayName
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
fun onJoin(event: PlayerQuitEvent) {
|
||||
event.player.savedDisplayName = event.player.displayName
|
||||
}
|
||||
}
|
||||
|
||||
var OfflinePlayer.savedDisplayName: String
|
||||
get() {
|
||||
if (this is Player) {
|
||||
profile.write("name", this.displayName)
|
||||
return this.displayName
|
||||
}
|
||||
|
||||
return profile.read("name", this.name ?: "Unknown Player")
|
||||
}
|
||||
set(value) {
|
||||
return profile.write("name", value)
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.willfp.ecoskills.effects.effects
|
||||
|
||||
import com.willfp.eco.core.drops.DropQueue
|
||||
import com.willfp.eco.util.BlockUtils
|
||||
import com.willfp.eco.util.NumberUtils
|
||||
import com.willfp.ecoskills.data.isPlayerPlaced
|
||||
import com.willfp.ecoskills.effects.Effect
|
||||
import com.willfp.ecoskills.getEffectLevel
|
||||
import org.bukkit.Bukkit
|
||||
@@ -45,7 +45,7 @@ class EffectMasterLumberjack : Effect(
|
||||
|
||||
val block = event.block
|
||||
|
||||
if (block.isPlayerPlaced()) {
|
||||
if (BlockUtils.isPlayerPlaced(block)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.willfp.ecoskills.effects.effects
|
||||
|
||||
import com.willfp.eco.util.NumberUtils
|
||||
import com.willfp.eco.util.PotionUtils
|
||||
import com.willfp.eco.util.StringUtils
|
||||
import com.willfp.ecoskills.duration
|
||||
import com.willfp.ecoskills.effects.Effect
|
||||
import com.willfp.ecoskills.getEffectLevel
|
||||
import org.bukkit.entity.Player
|
||||
@@ -54,7 +54,7 @@ class EffectPotionmaster : Effect(
|
||||
}
|
||||
}
|
||||
|
||||
val duration = potionData.duration
|
||||
val duration = PotionUtils.getDuration(potionData)
|
||||
val delta = (duration * multiplier).toInt() - duration
|
||||
val secondsDelta = NumberUtils.format(delta / 20.0)
|
||||
|
||||
@@ -107,7 +107,7 @@ class EffectPotionmaster : Effect(
|
||||
player.addPotionEffect(
|
||||
PotionEffect(
|
||||
k,
|
||||
data.duration + delta,
|
||||
PotionUtils.getDuration(data) + delta,
|
||||
v
|
||||
)
|
||||
)
|
||||
@@ -144,7 +144,7 @@ class EffectPotionmaster : Effect(
|
||||
entity.addPotionEffect(
|
||||
PotionEffect(
|
||||
key,
|
||||
((data.duration + delta) * event.getIntensity(entity)).toInt(),
|
||||
((PotionUtils.getDuration(data) + delta) * event.getIntensity(entity)).toInt(),
|
||||
value
|
||||
)
|
||||
)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.willfp.ecoskills.effects.effects
|
||||
|
||||
import com.willfp.eco.core.drops.DropQueue
|
||||
import com.willfp.eco.util.BlockUtils
|
||||
import com.willfp.eco.util.NumberUtils
|
||||
import com.willfp.ecoskills.data.isPlayerPlaced
|
||||
import com.willfp.ecoskills.effects.Effect
|
||||
import com.willfp.ecoskills.getEffectLevel
|
||||
import org.bukkit.Bukkit
|
||||
@@ -45,7 +45,7 @@ class EffectSpelunking : Effect(
|
||||
|
||||
val block = event.block
|
||||
|
||||
if (block.isPlayerPlaced()) {
|
||||
if (BlockUtils.isPlayerPlaced(block)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.willfp.ecoskills.integrations.afk
|
||||
|
||||
import org.bukkit.entity.Player
|
||||
|
||||
private val registry = mutableSetOf<AFKIntegration>()
|
||||
|
||||
fun registerIntegration(integration: AFKIntegration) {
|
||||
registry.add(integration)
|
||||
}
|
||||
|
||||
val Player.isAfk: Boolean
|
||||
get() {
|
||||
for (afkIntegration in registry) {
|
||||
if (afkIntegration.isAfk(this)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.willfp.ecoskills.integrations.afk
|
||||
|
||||
import com.willfp.eco.core.integrations.Integration
|
||||
import org.bukkit.entity.Player
|
||||
|
||||
interface AFKIntegration : Integration {
|
||||
fun isAfk(player: Player): Boolean
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.willfp.ecoskills.integrations.afk.impl
|
||||
|
||||
import com.earth2me.essentials.Essentials
|
||||
import com.willfp.ecoskills.integrations.afk.AFKIntegration
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.plugin.java.JavaPlugin
|
||||
|
||||
class AFKIntegrationEssentials: AFKIntegration {
|
||||
private val ess: Essentials = JavaPlugin.getPlugin(Essentials::class.java)
|
||||
|
||||
override fun isAfk(player: Player): Boolean {
|
||||
return ess.getUser(player) != null && ess.getUser(player).isAfk
|
||||
}
|
||||
|
||||
override fun getPluginName(): String {
|
||||
return "Essentials"
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.willfp.ecoskills.integrations.hologram
|
||||
|
||||
import org.bukkit.Location
|
||||
|
||||
object HologramManager {
|
||||
private val hologramWrappers = mutableListOf<HologramWrapper>()
|
||||
|
||||
@JvmStatic
|
||||
fun register(wrapper: HologramWrapper) {
|
||||
hologramWrappers.add(wrapper)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun spawnHolo(location: Location, contents: List<String>, lifespan: Int) {
|
||||
hologramWrappers.firstOrNull()?.spawnHolo(location, contents, lifespan)
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.willfp.ecoskills.integrations.hologram
|
||||
|
||||
import org.bukkit.Location
|
||||
|
||||
interface HologramWrapper {
|
||||
fun spawnHolo(location: Location, contents: List<String>, lifespan: Int)
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.willfp.ecoskills.integrations.hologram.wrappers
|
||||
|
||||
import com.Zrips.CMI.CMI
|
||||
import com.Zrips.CMI.Modules.Holograms.CMIHologram
|
||||
import com.willfp.eco.core.EcoPlugin
|
||||
import com.willfp.ecoskills.integrations.hologram.HologramWrapper
|
||||
import net.Zrips.CMILib.Container.CMILocation
|
||||
import org.bukkit.Location
|
||||
import java.util.*
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
class HologramCMI(
|
||||
private val plugin: EcoPlugin
|
||||
) : HologramWrapper {
|
||||
override fun spawnHolo(location: Location, contents: List<String>, lifespan: Int) {
|
||||
val holo = CMIHologram(UUID.randomUUID().toString(), CMILocation(location))
|
||||
holo.enable()
|
||||
holo.lines = contents
|
||||
CMI.getInstance().hologramManager.addHologram(holo)
|
||||
plugin.scheduler.runLater({
|
||||
CMI.getInstance().hologramManager.removeHolo(holo)
|
||||
}, lifespan.toLong())
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.willfp.ecoskills.integrations.hologram.wrappers
|
||||
|
||||
import com.willfp.eco.core.EcoPlugin
|
||||
import com.willfp.ecoskills.integrations.hologram.HologramWrapper
|
||||
import me.gholo.api.GHoloAPI
|
||||
import org.bukkit.Location
|
||||
import java.util.*
|
||||
|
||||
class HologramGHolo(
|
||||
private val plugin: EcoPlugin
|
||||
) : HologramWrapper {
|
||||
override fun spawnHolo(location: Location, contents: List<String>, lifespan: Int) {
|
||||
val api = GHoloAPI()
|
||||
val id = UUID.randomUUID().toString()
|
||||
|
||||
api.insertHolo(id, location, contents)
|
||||
|
||||
plugin.scheduler.runLater({
|
||||
api.removeHolo(id)
|
||||
}, lifespan.toLong())
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.willfp.ecoskills.integrations.hologram.wrappers
|
||||
|
||||
import com.gmail.filoghost.holographicdisplays.api.HologramsAPI
|
||||
import com.willfp.eco.core.EcoPlugin
|
||||
import com.willfp.ecoskills.integrations.hologram.HologramWrapper
|
||||
import org.bukkit.Location
|
||||
|
||||
class HologramHolographicDisplays(
|
||||
private val plugin: EcoPlugin
|
||||
) : HologramWrapper {
|
||||
override fun spawnHolo(location: Location, contents: List<String>, lifespan: Int) {
|
||||
val hologram = HologramsAPI.createHologram(plugin, location)
|
||||
|
||||
for (s in contents) {
|
||||
hologram.appendTextLine(s)
|
||||
}
|
||||
|
||||
plugin.scheduler.runLater({
|
||||
hologram.delete()
|
||||
}, lifespan.toLong())
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoskills.skills.skills
|
||||
|
||||
import com.willfp.eco.core.integrations.afk.AFKManager
|
||||
import com.willfp.ecoskills.giveSkillExperience
|
||||
import com.willfp.ecoskills.integrations.afk.isAfk
|
||||
import com.willfp.ecoskills.skills.Skill
|
||||
import org.bukkit.GameMode
|
||||
import org.bukkit.Material
|
||||
@@ -46,7 +46,7 @@ class SkillAlchemy : Skill(
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.configYml.getBool("skills.prevent-levelling-while-afk") && player.isAfk) {
|
||||
if (plugin.configYml.getBool("skills.prevent-levelling-while-afk") && AFKManager.isAfk(player)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoskills.skills.skills
|
||||
|
||||
import com.willfp.eco.core.integrations.afk.AFKManager
|
||||
import com.willfp.ecoskills.giveSkillExperience
|
||||
import com.willfp.ecoskills.integrations.afk.isAfk
|
||||
import com.willfp.ecoskills.skills.Skill
|
||||
import org.bukkit.GameMode
|
||||
import org.bukkit.entity.Player
|
||||
@@ -23,7 +23,7 @@ class SkillArmory : Skill(
|
||||
return
|
||||
}
|
||||
|
||||
if (plugin.configYml.getBool("skills.prevent-levelling-while-afk") && player.isAfk) {
|
||||
if (plugin.configYml.getBool("skills.prevent-levelling-while-afk") && AFKManager.isAfk(player)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.willfp.ecoskills.skills.skills
|
||||
|
||||
import com.willfp.eco.core.events.EntityDeathByEntityEvent
|
||||
import com.willfp.eco.core.integrations.afk.AFKManager
|
||||
import com.willfp.ecoskills.giveSkillExperience
|
||||
import com.willfp.ecoskills.integrations.afk.isAfk
|
||||
import com.willfp.ecoskills.skills.Skill
|
||||
import com.willfp.ecoskills.tryAsPlayer
|
||||
import org.bukkit.GameMode
|
||||
@@ -21,7 +21,7 @@ class SkillCombat : Skill(
|
||||
return
|
||||
}
|
||||
|
||||
if (plugin.configYml.getBool("skills.prevent-levelling-while-afk") && player.isAfk) {
|
||||
if (plugin.configYml.getBool("skills.prevent-levelling-while-afk") && AFKManager.isAfk(player)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoskills.skills.skills
|
||||
|
||||
import com.willfp.eco.core.integrations.afk.AFKManager
|
||||
import com.willfp.ecoskills.giveSkillExperience
|
||||
import com.willfp.ecoskills.integrations.afk.isAfk
|
||||
import com.willfp.ecoskills.skills.Skill
|
||||
import org.bukkit.GameMode
|
||||
import org.bukkit.event.EventHandler
|
||||
@@ -20,7 +20,7 @@ class SkillEnchanting : Skill(
|
||||
return
|
||||
}
|
||||
|
||||
if (plugin.configYml.getBool("skills.prevent-levelling-while-afk") && player.isAfk) {
|
||||
if (plugin.configYml.getBool("skills.prevent-levelling-while-afk") && AFKManager.isAfk(player)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.willfp.ecoskills.skills.skills
|
||||
|
||||
import com.willfp.eco.core.integrations.afk.AFKManager
|
||||
import com.willfp.eco.util.NumberUtils
|
||||
import com.willfp.ecoskills.giveSkillExperience
|
||||
import com.willfp.ecoskills.integrations.afk.isAfk
|
||||
import com.willfp.ecoskills.skills.Skill
|
||||
import org.bukkit.GameMode
|
||||
import org.bukkit.entity.Player
|
||||
@@ -35,7 +35,7 @@ class SkillExploration : Skill(
|
||||
xp *= speed
|
||||
}
|
||||
|
||||
if (plugin.configYml.getBool("skills.prevent-levelling-while-afk") && player.isAfk) {
|
||||
if (plugin.configYml.getBool("skills.prevent-levelling-while-afk") && AFKManager.isAfk(player)) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class SkillExploration : Skill(
|
||||
return
|
||||
}
|
||||
|
||||
if (plugin.configYml.getBool("skills.prevent-levelling-while-afk") && player.isAfk) {
|
||||
if (plugin.configYml.getBool("skills.prevent-levelling-while-afk") && AFKManager.isAfk(player)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.willfp.ecoskills.skills.skills
|
||||
|
||||
import com.willfp.ecoskills.data.isPlayerPlaced
|
||||
import com.willfp.eco.core.integrations.afk.AFKManager
|
||||
import com.willfp.eco.util.BlockUtils
|
||||
import com.willfp.ecoskills.giveSkillExperience
|
||||
import com.willfp.ecoskills.integrations.afk.isAfk
|
||||
import com.willfp.ecoskills.skills.Skill
|
||||
import org.bukkit.GameMode
|
||||
import org.bukkit.Material
|
||||
@@ -39,7 +39,7 @@ class SkillFarming : Skill(
|
||||
return
|
||||
}
|
||||
|
||||
if (plugin.configYml.getBool("skills.prevent-levelling-while-afk") && player.isAfk) {
|
||||
if (plugin.configYml.getBool("skills.prevent-levelling-while-afk") && AFKManager.isAfk(player)) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class SkillFarming : Skill(
|
||||
}
|
||||
}
|
||||
|
||||
if (event.block.isPlayerPlaced() &&
|
||||
if (BlockUtils.isPlayerPlaced(event.block) &&
|
||||
(event.block.type == Material.PUMPKIN || event.block.type == Material.MELON || event.block.type == Material.SUGAR_CANE)
|
||||
) {
|
||||
return
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.willfp.ecoskills.skills.skills
|
||||
|
||||
import com.willfp.eco.core.integrations.afk.AFKManager
|
||||
import com.willfp.ecoskills.giveSkillExperience
|
||||
import com.willfp.ecoskills.integrations.afk.isAfk
|
||||
import com.willfp.ecoskills.skills.Skill
|
||||
import org.bukkit.GameMode
|
||||
import org.bukkit.event.EventHandler
|
||||
@@ -19,7 +19,7 @@ class SkillFishing : Skill(
|
||||
return
|
||||
}
|
||||
|
||||
if (plugin.configYml.getBool("skills.prevent-levelling-while-afk") && player.isAfk) {
|
||||
if (plugin.configYml.getBool("skills.prevent-levelling-while-afk") && AFKManager.isAfk(player)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.willfp.ecoskills.skills.skills
|
||||
|
||||
import com.willfp.ecoskills.data.isPlayerPlaced
|
||||
import com.willfp.eco.core.integrations.afk.AFKManager
|
||||
import com.willfp.eco.util.BlockUtils
|
||||
import com.willfp.ecoskills.giveSkillExperience
|
||||
import com.willfp.ecoskills.integrations.afk.isAfk
|
||||
import com.willfp.ecoskills.skills.Skill
|
||||
import org.bukkit.GameMode
|
||||
import org.bukkit.Material
|
||||
@@ -40,11 +40,11 @@ class SkillMining : Skill(
|
||||
|
||||
val toGive = rewards[type] ?: return
|
||||
|
||||
if (event.block.isPlayerPlaced()) {
|
||||
if (BlockUtils.isPlayerPlaced(event.block)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (plugin.configYml.getBool("skills.prevent-levelling-while-afk") && player.isAfk) {
|
||||
if (plugin.configYml.getBool("skills.prevent-levelling-while-afk") && AFKManager.isAfk(player)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.willfp.ecoskills.skills.skills
|
||||
|
||||
import com.willfp.ecoskills.data.isPlayerPlaced
|
||||
import com.willfp.eco.core.integrations.afk.AFKManager
|
||||
import com.willfp.eco.util.BlockUtils
|
||||
import com.willfp.ecoskills.giveSkillExperience
|
||||
import com.willfp.ecoskills.integrations.afk.isAfk
|
||||
import com.willfp.ecoskills.skills.Skill
|
||||
import org.bukkit.GameMode
|
||||
import org.bukkit.Material
|
||||
@@ -40,11 +40,11 @@ class SkillWoodcutting : Skill(
|
||||
|
||||
val toGive = rewards[type] ?: return
|
||||
|
||||
if (event.block.isPlayerPlaced()) {
|
||||
if (BlockUtils.isPlayerPlaced(event.block)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (plugin.configYml.getBool("skills.prevent-levelling-while-afk") && player.isAfk) {
|
||||
if (plugin.configYml.getBool("skills.prevent-levelling-while-afk") && AFKManager.isAfk(player)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.willfp.ecoskills.stats
|
||||
|
||||
import com.willfp.eco.core.EcoPlugin
|
||||
import com.willfp.eco.core.integrations.hologram.HologramManager
|
||||
import com.willfp.eco.util.NumberUtils
|
||||
import com.willfp.eco.util.StringUtils
|
||||
import com.willfp.ecoskills.integrations.hologram.HologramManager
|
||||
import com.willfp.ecoskills.isCrit
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.EventPriority
|
||||
@@ -46,6 +46,10 @@ class DamageIndicatorListener(
|
||||
|
||||
text = StringUtils.format(text)
|
||||
|
||||
HologramManager.spawnHolo(location, listOf(text), 30);
|
||||
val holo = HologramManager.createHologram(location, listOf(text))
|
||||
|
||||
plugin.scheduler.runLater({
|
||||
holo.remove()
|
||||
}, 30)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user