diff --git a/build.gradle.kts b/build.gradle.kts index 4609cef..a437982 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,9 +1,9 @@ plugins { `java-library` - id("com.github.johnrengelman.shadow") version "7.1.2" - id("io.freefair.lombok") version "8.0.1" - id("net.minecrell.plugin-yml.bukkit") version "0.5.2" - id("io.papermc.paperweight.userdev") version "1.5.4" apply false + id("io.github.goooler.shadow") version "8.1.7" + id("io.freefair.lombok") version "8.6" + id("net.minecrell.plugin-yml.bukkit") version "0.6.0" + id("io.papermc.paperweight.userdev") version "1.7.1" apply false } bukkit { @@ -24,7 +24,7 @@ allprojects { apply(plugin = "java-library"); apply(plugin = "io.freefair.lombok") - version = "2.1.0" + version = "2.1.1" repositories { mavenCentral() @@ -66,4 +66,5 @@ dependencies { api(project(":nms:versions:20_1", "reobf")) api(project(":nms:versions:20_2", "reobf")) api(project(":nms:versions:20_3", "reobf")) + api(project(":nms:versions:20_5", "reobf")) } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 41dfb87..0d18421 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/nms/src/main/java/ru/spliterash/musicbox/minecraft/nms/jukebox/JukeboxFactory.java b/nms/src/main/java/ru/spliterash/musicbox/minecraft/nms/jukebox/JukeboxFactory.java index 94387f6..621d39f 100644 --- a/nms/src/main/java/ru/spliterash/musicbox/minecraft/nms/jukebox/JukeboxFactory.java +++ b/nms/src/main/java/ru/spliterash/musicbox/minecraft/nms/jukebox/JukeboxFactory.java @@ -27,8 +27,10 @@ public class JukeboxFactory { case "1.20.4": className = START_PATH + "V20_3"; break; + case "1.20.5": + case "1.20.6": default: - className = null; + className = START_PATH + "V20_5"; break; } } else if (iV == 19) { diff --git a/nms/versions/20_3/build.gradle.kts b/nms/versions/20_3/build.gradle.kts index e0ffe2d..95a2496 100644 --- a/nms/versions/20_3/build.gradle.kts +++ b/nms/versions/20_3/build.gradle.kts @@ -5,5 +5,5 @@ java { toolchain.languageVersion.set(JavaLanguageVersion.of(17)) } dependencies { - paperweight.paperDevBundle("1.20.4-R0.1-SNAPSHOT") + paperweight.paperDevBundle("1.20.3-R0.1-SNAPSHOT") } \ No newline at end of file diff --git a/nms/versions/20_5/build.gradle.kts b/nms/versions/20_5/build.gradle.kts new file mode 100644 index 0000000..aba500c --- /dev/null +++ b/nms/versions/20_5/build.gradle.kts @@ -0,0 +1,9 @@ +plugins { + id("io.papermc.paperweight.userdev") +} +java { + toolchain.languageVersion.set(JavaLanguageVersion.of(21)) +} +dependencies { + paperweight.paperDevBundle("1.20.5-R0.1-SNAPSHOT") +} \ No newline at end of file diff --git a/nms/versions/20_5/src/main/java/ru/spliterash/musicbox/minecraft/nms/jukebox/versions/V20_5.java b/nms/versions/20_5/src/main/java/ru/spliterash/musicbox/minecraft/nms/jukebox/versions/V20_5.java new file mode 100644 index 0000000..28829b8 --- /dev/null +++ b/nms/versions/20_5/src/main/java/ru/spliterash/musicbox/minecraft/nms/jukebox/versions/V20_5.java @@ -0,0 +1,31 @@ +package ru.spliterash.musicbox.minecraft.nms.jukebox.versions; + +import net.minecraft.world.level.block.entity.JukeboxBlockEntity; +import org.bukkit.block.Jukebox; +import org.bukkit.craftbukkit.block.CraftJukebox; +import org.bukkit.craftbukkit.inventory.CraftItemStack; +import org.bukkit.inventory.ItemStack; +import ru.spliterash.musicbox.minecraft.nms.jukebox.IJukebox; + +public class V20_5 implements IJukebox { + private final JukeboxBlockEntity tileEntity; + + public V20_5(Jukebox jukebox) { + CraftJukebox craft = (CraftJukebox) jukebox; + tileEntity = craft.getTileEntity(); + } + + public void setJukebox(ItemStack item) { + net.minecraft.world.item.ItemStack converted = CraftItemStack.asNMSCopy(item); + tileEntity.setRecordWithoutPlaying(converted); + + } + + public ItemStack getJukebox() { + net.minecraft.world.item.ItemStack nmsItem = tileEntity.getItem(0); + if (nmsItem.isEmpty()) + return null; + + return CraftItemStack.asBukkitCopy(nmsItem); + } +} diff --git a/plugin/src/main/java/ru/spliterash/musicbox/MusicBox.java b/plugin/src/main/java/ru/spliterash/musicbox/MusicBox.java index 8104202..b1516b6 100644 --- a/plugin/src/main/java/ru/spliterash/musicbox/MusicBox.java +++ b/plugin/src/main/java/ru/spliterash/musicbox/MusicBox.java @@ -8,6 +8,7 @@ import org.bukkit.command.PluginCommand; import org.bukkit.command.TabExecutor; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; import ru.spliterash.musicbox.commands.MusicBoxExecutor; import ru.spliterash.musicbox.customPlayers.abstracts.AbstractBlockPlayer; @@ -80,7 +81,7 @@ public void reloadPlugin() { PlayerWrapper.clearAll(); MusicBoxSongManager.reload(new File(getDataFolder(), "songs")); GUIActions.reloadGUI(); - + ItemStack stack; if (configObject.isBStats() && bStats == null) { diff --git a/settings.gradle b/settings.gradle index 2e1d867..c6c447e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -12,4 +12,5 @@ include "nms:versions:19_3" include "nms:versions:19_4" include "nms:versions:20_1" include "nms:versions:20_2" -include "nms:versions:20_3" \ No newline at end of file +include "nms:versions:20_3" +include "nms:versions:20_5" \ No newline at end of file