9
0
mirror of https://github.com/Auxilor/EcoSkills.git synced 2025-12-30 20:39:16 +00:00

Fixed deprecated method references

This commit is contained in:
Auxilor
2022-01-08 11:57:29 +00:00
parent e413c6ada2
commit 10ef12e04e
23 changed files with 41 additions and 41 deletions

View File

@@ -45,7 +45,7 @@ allprojects {
compileOnly fileTree(dir: '../../lib', include: ['*.jar'])
compileOnly 'org.jetbrains:annotations:19.0.0'
compileOnly 'org.jetbrains:annotations:22.0.0'
compileOnly 'org.jetbrains.kotlin:kotlin-stdlib:1.6.0'
}

View File

@@ -6,7 +6,7 @@ dependencies {
compileOnly 'com.gmail.filoghost.holographicdisplays:holographicdisplays-api:2.4.0'
compileOnly 'com.comphenix.protocol:ProtocolLib:4.7.0'
compileOnly 'com.willfp:EcoEnchants:8.2.0'
compileOnly 'net.kyori:adventure-api:4.9.2'
compileOnly 'net.kyori:adventure-api:4.9.3'
compileOnly 'net.essentialsx:EssentialsX:2.19.0'
}

View File

@@ -127,7 +127,7 @@ public class EcoSkillsPlugin extends EcoPlugin {
@Override
protected List<IntegrationLoader> loadIntegrationLoaders() {
return Arrays.asList(
return List.of(
new IntegrationLoader("EcoEnchants", () -> this.getEventManager().registerListener(new EcoEnchantsEnchantingLeveller(this)))
);
}

View File

@@ -59,7 +59,7 @@ object ActionBarUtils {
}
val message = plugin.configYml
.getString("persistent-action-bar.format", false)
.getString("persistent-action-bar.format")
val component = StringUtils.format(message, player)
whitelistTemp(player.uniqueId)

View File

@@ -36,13 +36,13 @@ class CommandRank(plugin: EcoPlugin) :
val top = LeaderboardHandler.getPage(page, skill)
val messages = plugin.langYml.getStrings("top", false)
val messages = plugin.langYml.getStrings("top")
val lines = mutableListOf<String>()
val useDisplayName = plugin.configYml.getBool("commands.top.use-display-name")
for ((rank, player) in top) {
var line = plugin.langYml.getString("top-line-format", false)
var line = plugin.langYml.getString("top-line-format")
.replace("%rank%", rank.toString())
.replace("%level%", player.getSkillLevel(skill).toString())

View File

@@ -41,7 +41,7 @@ class CommandRecount(plugin: EcoPlugin): Subcommand(
if (effect == null) {
if (args[1].lowercase().contentEquals("all")) {
var total = 0;
var total = 0
for (ceffect in Effects.values()) {
total+=recount(player, ceffect)
}

View File

@@ -22,13 +22,13 @@ class CommandTop(plugin: EcoPlugin) :
val page = args.firstOrNull()?.toIntOrNull() ?: 1
val top = LeaderboardHandler.getPage(page)
val messages = plugin.langYml.getStrings("top", false)
val messages = plugin.langYml.getStrings("top")
val lines = mutableListOf<String>()
val useDisplayName = plugin.configYml.getBool("commands.top.use-display-name")
for ((rank, player) in top) {
var line = plugin.langYml.getString("top-line-format", false)
var line = plugin.langYml.getString("top-line-format")
.replace("%rank%", rank.toString())
.replace("%level%", player.getTotalSkillLevel().toString())

View File

@@ -45,7 +45,7 @@ abstract class Effect(
abstract fun formatDescription(string: String, level: Int): String
fun getDescription(level: Int): String {
val desc = config.getString("description", false)
val desc = config.getString("description")
return StringUtils.format(formatDescription(desc, level))
}

View File

@@ -63,7 +63,7 @@ class EffectBountifulHarvest : Effect(
return
}
if (!config.getStrings("on-blocks", false).contains(mat.name.lowercase())) {
if (!config.getStrings("on-blocks").contains(mat.name.lowercase())) {
return
}

View File

@@ -36,7 +36,7 @@ class EffectEyeOfTheDepths: Effect(
return
}
val items = config.getStrings("rare-loot-items", false)
val items = config.getStrings("rare-loot-items")
val itemName = items[NumberUtils.randInt(0, items.size - 1)]

View File

@@ -53,7 +53,7 @@ class EffectMasterLumberjack : Effect(
return
}
if (!config.getStrings("on-blocks", false).contains(mat.name.lowercase())) {
if (!config.getStrings("on-blocks").contains(mat.name.lowercase())) {
return
}

View File

@@ -70,7 +70,7 @@ class EffectPotionmaster : Effect(
val lore = meta.lore ?: ArrayList()
for (string in config.getStrings("lore", false)) {
for (string in config.getStrings("lore")) {
lore.add(StringUtils.format(string.replace("%seconds%", secondsDelta), player))
}

View File

@@ -53,7 +53,7 @@ class EffectSpelunking : Effect(
return
}
if (!config.getStrings("on-blocks", false).contains(mat.name.lowercase())) {
if (!config.getStrings("on-blocks").contains(mat.name.lowercase())) {
return
}

View File

@@ -29,23 +29,23 @@ object SkillGUI {
@JvmStatic
private fun buildHomeMenu(plugin: EcoSkillsPlugin): Menu {
val maskPattern = plugin.configYml.getStrings("gui.mask.pattern", false).toTypedArray()
val maskPattern = plugin.configYml.getStrings("gui.mask.pattern").toTypedArray()
val maskMaterials = plugin.configYml
.getStrings("gui.mask.materials", false)
.getStrings("gui.mask.materials")
.mapNotNull { Material.getMaterial(it.uppercase(Locale.getDefault())) }
.toTypedArray()
val closeItem = Items.lookup(plugin.configYml.getString("gui.close.material", false)).item
val closeItem = Items.lookup(plugin.configYml.getString("gui.close.material")).item
val playerHeadItemBuilder = Function { player: Player ->
val itemStack = SkullBuilder()
.setDisplayName(
StringUtils.format(
plugin.configYml.getString("gui.player-info.name", false)
plugin.configYml.getString("gui.player-info.name")
.replace("%player%", player.displayName), player
)
)
.addLoreLines {
val lore: MutableList<String> = ArrayList()
for (string in plugin.configYml.getStrings("gui.player-info.lore", false)) {
for (string in plugin.configYml.getStrings("gui.player-info.lore")) {
lore.add(StringUtils.format(string!!, player))
}
lore

View File

@@ -75,7 +75,7 @@ abstract class Skill(
}
levelCommands.clear()
for (string in config.getStrings("rewards.level-commands", false)) {
for (string in config.getStrings("rewards.level-commands")) {
val split = string.split(":")
val level = split[0].toInt()
val command = split[1]
@@ -163,7 +163,7 @@ abstract class Skill(
}
}
for (string in this.config.getStrings("rewards.chat-messages.$highestLevel", false)) {
for (string in this.config.getStrings("rewards.chat-messages.$highestLevel")) {
var msg = string
for (levelUpReward in this.getLevelUpRewards()) {
@@ -199,7 +199,7 @@ abstract class Skill(
}
}
for (string in this.config.getStrings("rewards.progression-lore.$highestLevel", false)) {
for (string in this.config.getStrings("rewards.progression-lore.$highestLevel")) {
var s = string
for (levelUpReward in this.getLevelUpRewards()) {
@@ -225,7 +225,7 @@ abstract class Skill(
fun getGUILore(player: Player): MutableList<String> {
val lore = mutableListOf<String>()
for (string in this.config.getStrings("gui.lore", false)) {
for (string in this.config.getStrings("gui.lore")) {
lore.add(StringUtils.format(string, player))
}
return lore

View File

@@ -20,7 +20,7 @@ import org.bukkit.entity.Player
import org.bukkit.inventory.ItemFlag
import org.bukkit.inventory.ItemStack
import org.bukkit.persistence.PersistentDataType
import java.util.*
import java.util.Objects
import kotlin.math.ceil
class SkillGUI(
@@ -48,7 +48,7 @@ class SkillGUI(
val requiredXP = skill.getExpForLevel(player.getSkillLevel(skill) + 1)
val requiredXPString = if (requiredXP == Int.MAX_VALUE) plugin.langYml.getFormattedString("infinity") else NumberUtils.format(requiredXP.toDouble())
val lore = mutableListOf<String>()
for (string in plugin.configYml.getStrings("gui.skill-icon.lore", false)) {
for (string in plugin.configYml.getStrings("gui.skill-icon.lore")) {
lore.add(
StringUtils.format(
string.replace("%description%", skill.description)
@@ -95,16 +95,16 @@ class SkillGUI(
val levels: Menu
init {
val maskPattern = plugin.configYml.getStrings("level-gui.mask.pattern", false).toTypedArray()
val maskPattern = plugin.configYml.getStrings("level-gui.mask.pattern").toTypedArray()
val maskMaterials: Array<Material> = plugin.configYml
.getStrings("level-gui.mask.materials", false)
.getStrings("level-gui.mask.materials")
.stream()
.map { string: String -> Material.getMaterial(string.uppercase()) }
.filter(Objects::nonNull)
.toArray { length -> arrayOfNulls(length) }
val progressionOrder = "123456789abcdefghijklmnopqrstuvwxyz"
val progressionPattern = plugin.configYml.getStrings("level-gui.progression-slots.pattern", false)
val progressionPattern = plugin.configYml.getStrings("level-gui.progression-slots.pattern")
val progressionSlots = mutableMapOf<Int, Pair<Int, Int>>()
@@ -131,9 +131,9 @@ class SkillGUI(
val pages = ceil(skill.maxLevel / progressionSlots.size.toDouble()).toInt()
val levelsPerPage = progressionSlots.size
val closeMaterial = Items.lookup(plugin.configYml.getString("level-gui.progression-slots.close.material", false)).item
val homeMaterial = Items.lookup(plugin.configYml.getString("level-gui.progression-slots.prev-page.material", false)).item
val nextMaterial = Items.lookup(plugin.configYml.getString("level-gui.progression-slots.next-page.material", false)).item
val closeMaterial = Items.lookup(plugin.configYml.getString("level-gui.progression-slots.close.material")).item
val homeMaterial = Items.lookup(plugin.configYml.getString("level-gui.progression-slots.prev-page.material")).item
val nextMaterial = Items.lookup(plugin.configYml.getString("level-gui.progression-slots.next-page.material")).item
val pageKey = plugin.namespacedKeyFactory.create("page")

View File

@@ -23,7 +23,7 @@ class SkillAlchemy : Skill(
override fun postUpdate() {
rewards.clear()
for (string in this.config.getStrings("xp-rewards", false)) {
for (string in this.config.getStrings("xp-rewards")) {
val split = string.split(":")
val material = Material.getMaterial(split[0].uppercase()) ?: continue
rewards[material] = split[1].toDouble()

View File

@@ -27,7 +27,7 @@ class SkillExploration : Skill(
}
if (!this.config.getBool("allow-flying") && player.isFlying) {
return;
return
}
val from = event.from

View File

@@ -23,7 +23,7 @@ class SkillFarming : Skill(
override fun postUpdate() {
rewards.clear()
for (string in this.config.getStrings("xp-rewards", false)) {
for (string in this.config.getStrings("xp-rewards")) {
val split = string.split(":")
val material = Material.getMaterial(split[0].uppercase()) ?: continue
rewards[material] = split[1].toDouble()

View File

@@ -22,7 +22,7 @@ class SkillMining : Skill(
override fun postUpdate() {
rewards.clear()
for (string in this.config.getStrings("xp-rewards", false)) {
for (string in this.config.getStrings("xp-rewards")) {
val split = string.split(":")
val material = Material.getMaterial(split[0].uppercase()) ?: continue
rewards[material] = split[1].toDouble()

View File

@@ -22,7 +22,7 @@ class SkillWoodcutting : Skill(
override fun postUpdate() {
rewards.clear()
for (string in this.config.getStrings("xp-rewards", false)) {
for (string in this.config.getStrings("xp-rewards")) {
val split = string.split(":")
val material = Material.getMaterial(split[0].uppercase()) ?: continue
rewards[material] = split[1].toDouble()

View File

@@ -52,9 +52,9 @@ class DamageIndicatorListener(
)
var text: String = if (event.isCrit) {
plugin.configYml.getString("damage-indicators.format.crit", false)
plugin.configYml.getString("damage-indicators.format.crit")
} else {
plugin.configYml.getString("damage-indicators.format.normal", false)
plugin.configYml.getString("damage-indicators.format.normal")
}
text = text.replace("%damage%", NumberUtils.format(event.damage))
@@ -88,7 +88,7 @@ class DamageIndicatorListener(
NumberUtils.randFloat(-z, z)
)
var text = plugin.configYml.getString("damage-indicators.healing.format", false)
var text = plugin.configYml.getString("damage-indicators.healing.format")
text = text.replace("%damage%", NumberUtils.format(event.amount))

View File

@@ -14,7 +14,7 @@ public class AttackSpeedMain extends Extension {
/**
* attackspeed.yml.
*/
private Config config = new AttackSpeedConfig(this);
private final Config config = new AttackSpeedConfig(this);
/**
* Create a new extension for a plugin.