diff --git a/build.gradle b/build.gradle index 8c677b0..c2d8a44 100644 --- a/build.gradle +++ b/build.gradle @@ -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' } diff --git a/eco-core/core-plugin/build.gradle b/eco-core/core-plugin/build.gradle index 5fbebee..da8ef46 100644 --- a/eco-core/core-plugin/build.gradle +++ b/eco-core/core-plugin/build.gradle @@ -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' } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/EcoSkillsPlugin.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/EcoSkillsPlugin.java index 30d478f..044bdeb 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/EcoSkillsPlugin.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoskills/EcoSkillsPlugin.java @@ -127,7 +127,7 @@ public class EcoSkillsPlugin extends EcoPlugin { @Override protected List loadIntegrationLoaders() { - return Arrays.asList( + return List.of( new IntegrationLoader("EcoEnchants", () -> this.getEventManager().registerListener(new EcoEnchantsEnchantingLeveller(this))) ); } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/actionbar/ActionBarUtils.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/actionbar/ActionBarUtils.kt index ed495e2..c8bdfa6 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/actionbar/ActionBarUtils.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/actionbar/ActionBarUtils.kt @@ -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) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandRank.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandRank.kt index 6859edb..f0903c3 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandRank.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandRank.kt @@ -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() 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()) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandRecount.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandRecount.kt index 69b6f21..3014f9d 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandRecount.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandRecount.kt @@ -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) } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandTop.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandTop.kt index 30a2dc9..8542136 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandTop.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/commands/CommandTop.kt @@ -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() 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()) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/Effect.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/Effect.kt index d26d5c0..def767c 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/Effect.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/Effect.kt @@ -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)) } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectBountifulHarvest.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectBountifulHarvest.kt index c29ada4..bab449b 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectBountifulHarvest.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectBountifulHarvest.kt @@ -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 } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectEyeOfTheDepths.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectEyeOfTheDepths.kt index dae9df6..776e8cb 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectEyeOfTheDepths.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectEyeOfTheDepths.kt @@ -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)] diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectMasterLumberjack.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectMasterLumberjack.kt index 6577035..7f7faa2 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectMasterLumberjack.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectMasterLumberjack.kt @@ -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 } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectPotionmaster.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectPotionmaster.kt index 0a4d21a..4178255 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectPotionmaster.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectPotionmaster.kt @@ -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)) } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSpelunking.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSpelunking.kt index 1e354ae..417893e 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSpelunking.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/effects/effects/EffectSpelunking.kt @@ -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 } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/gui/SkillGUI.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/gui/SkillGUI.kt index 749bdfb..f1172ec 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/gui/SkillGUI.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/gui/SkillGUI.kt @@ -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 = 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 diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/Skill.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/Skill.kt index b07887b..39d27f2 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/Skill.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/Skill.kt @@ -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 { val lore = mutableListOf() - 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 diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/SkillGUI.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/SkillGUI.kt index e7a84d6..4d971d4 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/SkillGUI.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/SkillGUI.kt @@ -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() - 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 = 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>() @@ -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") diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillAlchemy.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillAlchemy.kt index 70e526b..64ea006 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillAlchemy.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillAlchemy.kt @@ -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() diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillExploration.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillExploration.kt index 77e2435..c2da9ce 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillExploration.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillExploration.kt @@ -27,7 +27,7 @@ class SkillExploration : Skill( } if (!this.config.getBool("allow-flying") && player.isFlying) { - return; + return } val from = event.from diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillFarming.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillFarming.kt index e790e49..f605f94 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillFarming.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillFarming.kt @@ -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() diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillMining.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillMining.kt index 8a4104c..7a11908 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillMining.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillMining.kt @@ -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() diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillWoodcutting.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillWoodcutting.kt index 123a8e9..62aedd5 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillWoodcutting.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/skills/skills/SkillWoodcutting.kt @@ -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() diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/stats/DamageIndicatorListener.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/stats/DamageIndicatorListener.kt index 143e058..3ccd0e1 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/stats/DamageIndicatorListener.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoskills/stats/DamageIndicatorListener.kt @@ -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)) diff --git a/eco-extensions/attackspeed/src/main/java/com/willfp/ecoskills/attackspeed/AttackSpeedMain.java b/eco-extensions/attackspeed/src/main/java/com/willfp/ecoskills/attackspeed/AttackSpeedMain.java index c1e675c..59cd619 100644 --- a/eco-extensions/attackspeed/src/main/java/com/willfp/ecoskills/attackspeed/AttackSpeedMain.java +++ b/eco-extensions/attackspeed/src/main/java/com/willfp/ecoskills/attackspeed/AttackSpeedMain.java @@ -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.