From e7a5d8d155181eae81889fdd7f795eff2e99dd97 Mon Sep 17 00:00:00 2001 From: Will FP Date: Sat, 6 Jan 2024 13:36:19 +0000 Subject: [PATCH] Reimplemented lost commits --- eco-core/core-backend/build.gradle.kts | 2 +- .../eco/internal/command/HandledCommand.kt | 1 - .../eco/internal/config/EcoConfigSection.kt | 1 - .../eco/internal/config/EcoLoadableConfig.kt | 1 - .../willfp/eco/internal/drops/EcoDropQueue.kt | 16 ++++++++++++---- .../eco/internal/entities/EntityArgParserName.kt | 1 + .../internal/extensions/EcoExtensionLoader.kt | 1 + .../internal/factory/EcoNamespacedKeyFactory.kt | 2 +- .../fast/InternalNamespacedKeyFactory.kt | 1 - .../com/willfp/eco/internal/gui/menu/EcoMenu.kt | 1 + .../eco/internal/gui/menu/RenderedInventory.kt | 1 - .../eco/internal/integrations/PAPIExpansion.kt | 1 + .../willfp/eco/internal/items/ArgParserHead.kt | 1 - .../willfp/eco/internal/items/ArgParserName.kt | 4 +++- .../willfp/eco/internal/items/ArgParserTrim.kt | 2 -- 15 files changed, 21 insertions(+), 15 deletions(-) diff --git a/eco-core/core-backend/build.gradle.kts b/eco-core/core-backend/build.gradle.kts index 363b898b4..f951608dc 100644 --- a/eco-core/core-backend/build.gradle.kts +++ b/eco-core/core-backend/build.gradle.kts @@ -6,7 +6,7 @@ dependencies { implementation("org.reflections:reflections:0.9.12") implementation("org.objenesis:objenesis:3.2") - compileOnly("org.spigotmc:spigot-api:1.20.2-R0.1-SNAPSHOT") + compileOnly("io.papermc.paper:paper-api:1.20.2-R0.1-SNAPSHOT") compileOnly("me.clip:placeholderapi:2.11.4") compileOnly("net.kyori:adventure-text-minimessage:4.10.0") compileOnly("net.kyori:adventure-platform-bukkit:4.1.0") diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/command/HandledCommand.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/command/HandledCommand.kt index c4dd15e39..0318d9464 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/command/HandledCommand.kt +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/command/HandledCommand.kt @@ -3,7 +3,6 @@ package com.willfp.eco.internal.command import com.willfp.eco.core.EcoPlugin import com.willfp.eco.core.command.CommandBase import com.willfp.eco.core.command.NotificationException -import com.willfp.eco.core.config.base.LangYml import org.bukkit.Bukkit import org.bukkit.command.Command import org.bukkit.command.CommandExecutor diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/config/EcoConfigSection.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/config/EcoConfigSection.kt index f6c24e193..65dbc5acb 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/config/EcoConfigSection.kt +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/config/EcoConfigSection.kt @@ -2,7 +2,6 @@ package com.willfp.eco.internal.config import com.willfp.eco.core.config.ConfigType import com.willfp.eco.core.placeholder.InjectablePlaceholder -import java.util.concurrent.ConcurrentHashMap class EcoConfigSection( type: ConfigType, diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/config/EcoLoadableConfig.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/config/EcoLoadableConfig.kt index d8920fe30..2faab9182 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/config/EcoLoadableConfig.kt +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/config/EcoLoadableConfig.kt @@ -15,7 +15,6 @@ import java.nio.channels.AsynchronousFileChannel import java.nio.file.Files import java.nio.file.StandardOpenOption -@Suppress("UNCHECKED_CAST") open class EcoLoadableConfig( type: ConfigType, configName: String, diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/drops/EcoDropQueue.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/drops/EcoDropQueue.kt index 0f6e6d572..5d68219a9 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/drops/EcoDropQueue.kt +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/drops/EcoDropQueue.kt @@ -1,5 +1,6 @@ package com.willfp.eco.internal.drops +import com.willfp.eco.core.Prerequisite import com.willfp.eco.core.drops.DropQueue import com.willfp.eco.core.events.DropQueuePushEvent import com.willfp.eco.core.integrations.antigrief.AntigriefManager @@ -72,10 +73,17 @@ open class EcoDropQueue(val player: Player) : DropQueue() { world.dropItem(location, drop!!).velocity = Vector() } if (xp > 0) { - val orb = - world.spawnEntity(player.location.add(0.0, 0.2, 0.0), EntityType.EXPERIENCE_ORB) as ExperienceOrb - orb.velocity = Vector(0, 0, 0) - orb.experience = xp + if (Prerequisite.HAS_PAPER.isMet) { + player.giveExp(xp, true) + } else { + val orb = + world.spawnEntity( + player.location.add(0.0, 0.2, 0.0), + EntityType.EXPERIENCE_ORB + ) as ExperienceOrb + orb.velocity = Vector(0, 0, 0) + orb.experience = xp + } } } else { for (drop in items) { diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/entities/EntityArgParserName.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/entities/EntityArgParserName.kt index b41bd6174..767bc5304 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/entities/EntityArgParserName.kt +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/entities/EntityArgParserName.kt @@ -19,6 +19,7 @@ object EntityArgParserName : EntityArgParser { val formatted = StringUtils.format(name) + @Suppress("DEPRECATION") return EntityArgParseResult( { it.customName == formatted }, { diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/extensions/EcoExtensionLoader.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/extensions/EcoExtensionLoader.kt index 3fe7b09e0..40d4c6a1d 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/extensions/EcoExtensionLoader.kt +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/extensions/EcoExtensionLoader.kt @@ -42,6 +42,7 @@ class EcoExtensionLoader( } } + @Suppress("DEPRECATION") @Throws(MalformedExtensionException::class) private fun loadExtension(extensionJar: File) { val url = extensionJar.toURI().toURL() diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/factory/EcoNamespacedKeyFactory.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/factory/EcoNamespacedKeyFactory.kt index 7768362eb..c93fd166e 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/factory/EcoNamespacedKeyFactory.kt +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/factory/EcoNamespacedKeyFactory.kt @@ -7,6 +7,6 @@ import org.bukkit.NamespacedKey class EcoNamespacedKeyFactory(private val plugin: EcoPlugin) : NamespacedKeyFactory { override fun create(key: String): NamespacedKey { - return NamespacedKeyUtils.create(plugin.name, key) + return NamespacedKeyUtils.create(plugin.id, key) } } \ No newline at end of file diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/fast/InternalNamespacedKeyFactory.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/fast/InternalNamespacedKeyFactory.kt index a86cb0fb7..5459e2809 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/fast/InternalNamespacedKeyFactory.kt +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/fast/InternalNamespacedKeyFactory.kt @@ -25,7 +25,6 @@ class FastInternalNamespacedKeyFactory : InternalNamespacedKeyFactory { class SafeInternalNamespacedKeyFactory : InternalNamespacedKeyFactory { override fun create(namespace: String, key: String): NamespacedKey { - @Suppress("DEPRECATION") return NamespacedKey(namespace, key) } } diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/gui/menu/EcoMenu.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/gui/menu/EcoMenu.kt index dbd9221b3..3d3b55570 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/gui/menu/EcoMenu.kt +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/gui/menu/EcoMenu.kt @@ -43,6 +43,7 @@ class EcoMenu( getPossiblyReactiveSlot(row, column, player) override fun open(player: Player): Inventory { + @Suppress("DEPRECATION") val inventory = if (columns == 9) { Bukkit.createInventory(null, rows * columns, title) } else { diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/gui/menu/RenderedInventory.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/gui/menu/RenderedInventory.kt index 609f4c1cf..dcdd097e3 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/gui/menu/RenderedInventory.kt +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/gui/menu/RenderedInventory.kt @@ -1,7 +1,6 @@ package com.willfp.eco.internal.gui.menu import com.willfp.eco.core.gui.menu.events.CaptiveItemChangeEvent -import com.willfp.eco.core.items.isEmpty import com.willfp.eco.core.recipe.parts.EmptyTestableItem import com.willfp.eco.util.MenuUtils import com.willfp.eco.util.openMenu diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/integrations/PAPIExpansion.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/integrations/PAPIExpansion.kt index 744886721..799c3e9d4 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/integrations/PAPIExpansion.kt +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/integrations/PAPIExpansion.kt @@ -6,6 +6,7 @@ import com.willfp.eco.core.placeholder.context.placeholderContext import me.clip.placeholderapi.expansion.PlaceholderExpansion import org.bukkit.entity.Player +@Suppress("DEPRECATION") class PAPIExpansion(private val plugin: EcoPlugin) : PlaceholderExpansion() { init { register() diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/ArgParserHead.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/ArgParserHead.kt index 1d73f5944..fe96be30f 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/ArgParserHead.kt +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/ArgParserHead.kt @@ -28,7 +28,6 @@ object ArgParserHead : LookupArgParser { playerName ?: return null - @Suppress("DEPRECATION") val player = Bukkit.getOfflinePlayer(playerName) meta.owningPlayer = player diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/ArgParserName.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/ArgParserName.kt index 554b23a19..608f04761 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/ArgParserName.kt +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/ArgParserName.kt @@ -22,12 +22,13 @@ object ArgParserName : LookupArgParser { val formatted = StringUtils.format(name) // I don't know why it says it's redundant, the compiler yells at me - @Suppress("UsePropertyAccessSyntax", "RedundantSuppression") + @Suppress("UsePropertyAccessSyntax", "RedundantSuppression", "DEPRECATION") meta.setDisplayName(formatted) return Predicate { val testMeta = it.itemMeta ?: return@Predicate false + @Suppress("DEPRECATION") testMeta.displayName == formatted } } @@ -37,6 +38,7 @@ object ArgParserName : LookupArgParser { return null } + @Suppress("DEPRECATION") return "name:\"${meta.displayName}\"" } } \ No newline at end of file diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/ArgParserTrim.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/ArgParserTrim.kt index 3de5e82bf..80d7f40b0 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/ArgParserTrim.kt +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/ArgParserTrim.kt @@ -1,13 +1,11 @@ package com.willfp.eco.internal.items import com.willfp.eco.core.items.args.LookupArgParser -import org.bukkit.Color import org.bukkit.NamespacedKey import org.bukkit.Registry import org.bukkit.inventory.ItemStack import org.bukkit.inventory.meta.ArmorMeta import org.bukkit.inventory.meta.ItemMeta -import org.bukkit.inventory.meta.LeatherArmorMeta import org.bukkit.inventory.meta.trim.ArmorTrim import org.bukkit.inventory.meta.trim.TrimMaterial import org.bukkit.inventory.meta.trim.TrimPattern