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:
@@ -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'
|
||||
}
|
||||
|
||||
|
||||
@@ -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'
|
||||
}
|
||||
|
||||
|
||||
@@ -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)))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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())
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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)]
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -27,7 +27,7 @@ class SkillExploration : Skill(
|
||||
}
|
||||
|
||||
if (!this.config.getBool("allow-flying") && player.isFlying) {
|
||||
return;
|
||||
return
|
||||
}
|
||||
|
||||
val from = event.from
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user