9
0
mirror of https://github.com/Auxilor/EcoSkills.git synced 2025-12-31 04:46:31 +00:00

Fixed permission cache

This commit is contained in:
Auxilor
2022-01-14 18:54:12 +00:00
parent b961ccbd3e
commit c7a512a055
2 changed files with 8 additions and 6 deletions

View File

@@ -74,6 +74,7 @@ public class EcoSkillsPlugin extends EcoPlugin {
ActionBarUtils.startRunnable();
}
this.getScheduler().runTimer(EcoSkillsPlayerKt::clearExpMultiplierCache, 100, 100);
SkillDisplayListener.tickBossBars(this);
this.getScheduler().runAsyncTimer(new LeaderboardHandler.Runnable(), 50, 2400);
}

View File

@@ -16,12 +16,16 @@ import org.bukkit.entity.Entity
import org.bukkit.entity.Player
import org.bukkit.entity.Projectile
import org.bukkit.entity.Tameable
import java.util.UUID
import java.util.*
import kotlin.math.abs
private val expMultiplierCache = mutableMapOf<UUID, Double>()
private val plugin: EcoSkillsPlugin = EcoSkillsPlugin.getInstance()
fun clearExpMultiplierCache() {
expMultiplierCache.clear()
}
fun Player.getSkillExperienceMultiplier(): Double {
if (expMultiplierCache.containsKey(this.uniqueId)) {
return expMultiplierCache[this.uniqueId]!!
@@ -55,10 +59,6 @@ private fun Player.cacheSkillExperienceMultiplier(): Double {
}
}
plugin.scheduler.runLater({
expMultiplierCache.remove(this.uniqueId)
}, 200)
return 1.0
}
@@ -179,7 +179,8 @@ fun OfflinePlayer.setStatLevel(stat: Stat, level: Int) {
}
}
private val gainSoundKey = PersistentDataKey<Boolean>(plugin.namespacedKeyFactory.create("gainSound"), PersistentDataKeyType.BOOLEAN, true);
private val gainSoundKey =
PersistentDataKey<Boolean>(plugin.namespacedKeyFactory.create("gainSound"), PersistentDataKeyType.BOOLEAN, true);
fun OfflinePlayer.hasGainSoundEnabled(): Boolean {
return PlayerProfile.load(this).read(gainSoundKey)