diff --git a/build.gradle.kts b/build.gradle.kts index bb2f4f0..abcfe7f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,16 +8,17 @@ plugins { id("com.github.johnrengelman.shadow").version("6.1.0") } group = "nfsprodriver" -version = "1.4" +version = "1.5" repositories { mavenCentral() - maven("https://papermc.io/repo/repository/maven-public/") + maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") + maven("https://oss.sonatype.org/content/repositories/snapshots") + maven("https://oss.sonatype.org/content/repositories/central") } dependencies { val kotlinVersion: String by System.getProperties() implementation(kotlin("stdlib", kotlinVersion)) - //https://papermc.io/javadocs/paper/1.16/overview-summary.html - compileOnly("com.destroystokyo.paper", "paper-api", "1.16.5-R0.1-SNAPSHOT") + compileOnly("org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT") } val autoRelocate by tasks.register("configureShadowRelocation", ConfigureShadowRelocation::class) { target = tasks.getByName("shadowJar") as ShadowJar? @@ -37,7 +38,7 @@ tasks { } withType { kotlinOptions { - jvmTarget = "1.8" + jvmTarget = "16" } } } diff --git a/gradle.properties b/gradle.properties index fa1f2f7..4a8fc03 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ kotlin.code.style=official -systemProp.kotlinVersion=1.4.30 +systemProp.kotlinVersion=1.5.10 diff --git a/src/main/kotlin/BeaconRange.kt b/src/main/kotlin/BeaconRange.kt index 2f20006..881c277 100644 --- a/src/main/kotlin/BeaconRange.kt +++ b/src/main/kotlin/BeaconRange.kt @@ -4,8 +4,6 @@ import org.bukkit.Material import org.bukkit.NamespacedKey import org.bukkit.block.Beacon import org.bukkit.block.Block -import org.bukkit.block.BlockState -import org.bukkit.enchantments.Enchantment import org.bukkit.entity.* import org.bukkit.inventory.Inventory import org.bukkit.plugin.java.JavaPlugin @@ -14,7 +12,6 @@ import org.bukkit.potion.PotionEffectType import org.bukkit.inventory.ShapedRecipe import org.bukkit.inventory.ItemStack -import java.util.function.Predicate class BeaconRange : JavaPlugin(){ @@ -34,16 +31,10 @@ class BeaconRange : JavaPlugin(){ remSSRecipe() } - private fun generateConfig() { - - } - private fun addSSRecipe() { val superStar = ItemStack(Material.NETHER_STAR) - val ssMeta = superStar.itemMeta - ssMeta.setDisplayName("Super Star (enabled)") - superStar.setItemMeta(ssMeta) - superStar.lore = listOf("No effects") + superStar.itemMeta?.setDisplayName("Super Star (enabled)") + superStar.itemMeta?.lore = listOf("No effects") val superStarRec = ShapedRecipe(NamespacedKey(this, "superStar"), superStar) superStarRec.shape("SSS", "SSS", "SSS") superStarRec.setIngredient('S', Material.NETHER_STAR) @@ -110,7 +101,7 @@ class BeaconRange : JavaPlugin(){ beaconEffects.forEach { (beaconEffectType, beaconEffectAmp) -> val inv: Inventory = player.inventory val stars: List = inv.contents.filter { itemStack -> itemStack?.itemMeta?.displayName?.contains("Super Star") == true } - if (stars.isEmpty() || stars.first().itemMeta.displayName.contains("enabled")) { + if (stars.isEmpty() || stars.first().itemMeta?.displayName?.contains("enabled") == true) { val effect = PotionEffect(beaconEffectType, duration, minOf(beaconEffectAmp, config.getInt("maxAmp").minus(1))) player.addPotionEffect(effect) } @@ -166,7 +157,7 @@ class BeaconRange : JavaPlugin(){ beaconEffects.forEach { beaconEffect -> lore.add(beaconEffect.key.name+": "+beaconEffect.value.toString()) } - inv.itemInOffHand.lore = lore + inv.itemInOffHand.itemMeta?.lore = lore } } } @@ -180,7 +171,7 @@ class BeaconRange : JavaPlugin(){ val inv = player.inventory val itemName: String? = inv.itemInOffHand.itemMeta?.displayName if (itemName != null && itemName.contains("Super Star") && itemName.contains("enabled")) { - inv.itemInOffHand.lore?.forEach { starEffect -> + inv.itemInOffHand.itemMeta?.lore?.forEach { starEffect -> val split: List = starEffect.split(": ") if (split.count() == 2) { val effectType: PotionEffectType = PotionEffectType.getByName(split[0])!! diff --git a/src/main/kotlin/events/RightClick.kt b/src/main/kotlin/events/RightClick.kt index 31d179a..85c06f7 100644 --- a/src/main/kotlin/events/RightClick.kt +++ b/src/main/kotlin/events/RightClick.kt @@ -15,7 +15,7 @@ class RightClick : Listener { val itemName: String? = inv.itemInMainHand.itemMeta?.displayName if (itemName != null) { if(itemName.contains("Super Star")) { - val meta: ItemMeta = inv.itemInMainHand.itemMeta + val meta: ItemMeta = inv.itemInMainHand.itemMeta!! if (itemName.contains("enabled")) { meta.setDisplayName("Super Star (disabled)") } else { diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 2a75990..6c09eb9 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ main: BeaconRange name: BeaconRange -version: 1.4 -api-version: "1.16" +version: 1.5 +api-version: "1.17" author: Bjarne Roß description: Extend the range of your beacons!