From 6800d06bc076e8a3d52919dc6d7fa3a272a1b418 Mon Sep 17 00:00:00 2001 From: Athar42 Date: Wed, 24 Dec 2025 22:30:19 +0100 Subject: [PATCH 1/6] - Quick readme update --- readme.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index 286c85c..747d045 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# Custom Discs v5.1.3 +# Custom Discs v5.1.4 ### For Paper and Folia ### 1.21.7 to 1.21.11 @@ -52,9 +52,9 @@ Versions support matrix : | **1.21.4** | Paper | 4.2 - 4.4 | [4.4](https://github.com/Navoei/CustomDiscs/releases/tag/v4.4) | | **1.21.5** | Paper | 4.4 | [4.4](https://github.com/Navoei/CustomDiscs/releases/tag/v4.4) | | **1.21.6, 1.21.7-8** | Paper | 4.5 | [4.5](https://github.com/Navoei/CustomDiscs/releases/tag/v4.5) | -| **1.21.7-9, 1.21.8**
**1.21.8** | Paper
Folia | 5.0 - 5.1.3
5.1.1 - 5.1.3 | [5.1.3](https://modrinth.com/plugin/customdiscs-plugin/version/5.1.3) | -| **1.21.9, 1.21.10**
**1.21.9, 1.21.10** | Paper
Folia | 5.1.2 - 5.1.3
5.1.2 - 5.1.3 | [5.1.3](https://modrinth.com/plugin/customdiscs-plugin/version/5.1.3) | -| **1.21.11**
**1.21.11** | Paper
Folia | 5.1.3 - 5.1.4
5.1.3 - 5.1.4 | [5.1.4](https://modrinth.com/plugin/customdiscs-plugin/version/5.1.4) | +| **1.21.7-9, 1.21.8**
**1.21.8** | Paper
Folia | 5.0 - 5.1.4
5.1.1 - 5.1.4 | [5.1.4](https://modrinth.com/plugin/customdiscs-plugin/version/5.1.4) | +| **1.21.9, 1.21.10**
**1.21.9, 1.21.10** | Paper
Folia | 5.1.2 - 5.1.4
5.1.2 - 5.1.4 | [5.1.4](https://modrinth.com/plugin/customdiscs-plugin/version/5.1.4) | +| **1.21.11**
**1.21.11** | Paper
Folia | 5.1.3 - 5.1.4
5.1.3 - 5.1.4 | [5.1.4](https://modrinth.com/plugin/customdiscs-plugin/version/5.1.4) | https://user-images.githubusercontent.com/64107368/178426026-c454ac66-5133-4f3a-9af9-7f674e022423.mp4 From d929bf507f6437da6966aedf14da933118d03ae1 Mon Sep 17 00:00:00 2001 From: Athar42 Date: Fri, 30 Jan 2026 21:21:44 +0100 Subject: [PATCH 2/6] Update 5.1.5 - Add default mob heads/skulls to the allowed list to be played - Update Gradle Shadow to release 9.3.1 --- build.gradle | 2 +- gradle.properties | 2 +- readme.md | 8 ++--- .../customdiscsplugin/event/HeadPlay.java | 8 ++--- .../customdiscsplugin/utils/TypeChecker.java | 33 ++++++++++++++++++- 5 files changed, 42 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index e12ffa6..fcf4fb9 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id 'java' - id "com.gradleup.shadow" version "9.2.2" + id "com.gradleup.shadow" version "9.3.1" } java { diff --git a/gradle.properties b/gradle.properties index 1a99ba4..934b5bb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,6 +10,6 @@ mod_id=customdiscsplugin voicechat_api_version=2.6.0 command_api_version=11.1.0 -plugin_version=5.1.4 +plugin_version=5.1.5 maven_group=me.Navoei.customdiscsplugin archives_base_name=custom-discs \ No newline at end of file diff --git a/readme.md b/readme.md index 747d045..2943afd 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# Custom Discs v5.1.4 +# Custom Discs v5.1.5 ### For Paper and Folia ### 1.21.7 to 1.21.11 @@ -52,9 +52,9 @@ Versions support matrix : | **1.21.4** | Paper | 4.2 - 4.4 | [4.4](https://github.com/Navoei/CustomDiscs/releases/tag/v4.4) | | **1.21.5** | Paper | 4.4 | [4.4](https://github.com/Navoei/CustomDiscs/releases/tag/v4.4) | | **1.21.6, 1.21.7-8** | Paper | 4.5 | [4.5](https://github.com/Navoei/CustomDiscs/releases/tag/v4.5) | -| **1.21.7-9, 1.21.8**
**1.21.8** | Paper
Folia | 5.0 - 5.1.4
5.1.1 - 5.1.4 | [5.1.4](https://modrinth.com/plugin/customdiscs-plugin/version/5.1.4) | -| **1.21.9, 1.21.10**
**1.21.9, 1.21.10** | Paper
Folia | 5.1.2 - 5.1.4
5.1.2 - 5.1.4 | [5.1.4](https://modrinth.com/plugin/customdiscs-plugin/version/5.1.4) | -| **1.21.11**
**1.21.11** | Paper
Folia | 5.1.3 - 5.1.4
5.1.3 - 5.1.4 | [5.1.4](https://modrinth.com/plugin/customdiscs-plugin/version/5.1.4) | +| **1.21.7-9, 1.21.8**
**1.21.8** | Paper
Folia | 5.0 - 5.1.5
5.1.1 - 5.1.5 | [5.1.4](https://modrinth.com/plugin/customdiscs-plugin/version/5.1.5) | +| **1.21.9, 1.21.10**
**1.21.9, 1.21.10** | Paper
Folia | 5.1.2 - 5.1.5
5.1.2 - 5.1.5 | [5.1.4](https://modrinth.com/plugin/customdiscs-plugin/version/5.1.5) | +| **1.21.11**
**1.21.11** | Paper
Folia | 5.1.3 - 5.1.5
5.1.3 - 5.1.5 | [5.1.4](https://modrinth.com/plugin/customdiscs-plugin/version/5.1.5) | https://user-images.githubusercontent.com/64107368/178426026-c454ac66-5133-4f3a-9af9-7f674e022423.mp4 diff --git a/src/main/java/me/Navoei/customdiscsplugin/event/HeadPlay.java b/src/main/java/me/Navoei/customdiscsplugin/event/HeadPlay.java index bdd2f88..1b09324 100644 --- a/src/main/java/me/Navoei/customdiscsplugin/event/HeadPlay.java +++ b/src/main/java/me/Navoei/customdiscsplugin/event/HeadPlay.java @@ -4,6 +4,7 @@ import me.Navoei.customdiscsplugin.PlayerManager; import me.Navoei.customdiscsplugin.VoicePlugin; import me.Navoei.customdiscsplugin.language.Lang; +import me.Navoei.customdiscsplugin.utils.TypeChecker; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; @@ -48,7 +49,7 @@ public void onNotePlay(NotePlayEvent event) throws IOException { if (PlayerManager.instance().isAudioPlayerPlaying(noteBlock.getLocation())) return; Block headBlock = noteBlock.getRelative(BlockFace.UP); - if (headBlock.getType() != Material.PLAYER_HEAD) return; + if (!TypeChecker.isHead(headBlock.getType())) return; Skull skull = (Skull) headBlock.getState(); PersistentDataContainer persistentDataContainer = skull.getPersistentDataContainer(); @@ -88,16 +89,15 @@ public void onNotePlay(NotePlayEvent event) throws IOException { public void onHeadPlace(BlockPlaceEvent event) { ItemStack item = event.getItemInHand(); - if (item.getType() != Material.PLAYER_HEAD) return; + if (!TypeChecker.isHead(item.getType())) return; if (!(item.getItemMeta() instanceof SkullMeta meta)) return; PersistentDataContainer itemPDC = meta.getPersistentDataContainer(); if (!itemPDC.has(new NamespacedKey(customDiscs, "customhead"), PersistentDataType.STRING)) return; Block block = event.getBlockPlaced(); + if (!TypeChecker.isHead(block.getType()) && !TypeChecker.isWallHead(block.getType())) return; Bukkit.getRegionScheduler().runDelayed(customDiscs, block.getLocation(), task -> { - if (block.getType() != Material.PLAYER_HEAD && block.getType() != Material.PLAYER_WALL_HEAD) return; - Skull skull = (Skull) block.getState(); PersistentDataContainer blockPDC = skull.getPersistentDataContainer(); diff --git a/src/main/java/me/Navoei/customdiscsplugin/utils/TypeChecker.java b/src/main/java/me/Navoei/customdiscsplugin/utils/TypeChecker.java index 3067791..dccf87c 100644 --- a/src/main/java/me/Navoei/customdiscsplugin/utils/TypeChecker.java +++ b/src/main/java/me/Navoei/customdiscsplugin/utils/TypeChecker.java @@ -9,6 +9,9 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.persistence.PersistentDataType; +import java.util.EnumSet; +import java.util.Set; + public class TypeChecker { static CustomDiscs customDiscs = CustomDiscs.getInstance(); @@ -55,12 +58,40 @@ public static boolean isCustomGoatHornPlayer(Player p) { // PLAYER HEADS + private static final Set HEAD_LIST_MATERIALS = EnumSet.of( + Material.PLAYER_HEAD, + Material.WITHER_SKELETON_SKULL, + Material.SKELETON_SKULL, + Material.ZOMBIE_HEAD, + Material.CREEPER_HEAD, + Material.PIGLIN_HEAD, + Material.DRAGON_HEAD + ); + + private static final Set HEAD_WALL_LIST_MATERIALS = EnumSet.of( + Material.PLAYER_WALL_HEAD, + Material.WITHER_SKELETON_WALL_SKULL, + Material.SKELETON_WALL_SKULL, + Material.ZOMBIE_WALL_HEAD, + Material.CREEPER_WALL_HEAD, + Material.PIGLIN_WALL_HEAD, + Material.DRAGON_WALL_HEAD + ); + /*public static boolean isHead(ItemStack item) { return item.getType().toString().contains("PLAYER_HEAD"); }*/ + public static boolean isHead(Material material) { + return HEAD_LIST_MATERIALS.contains(material); + } + + public static boolean isWallHead(Material material) { + return HEAD_WALL_LIST_MATERIALS.contains(material); + } + public static boolean isHeadPlayer(Player p) { - return p.getInventory().getItemInMainHand().getType().equals(Material.PLAYER_HEAD); + return isHead(p.getInventory().getItemInMainHand().getType()); } /*public static boolean isCustomHead(ItemStack itemStack) { From 5634cb3308b777a29bd30edb060d2737fe507b94 Mon Sep 17 00:00:00 2001 From: Athar42 Date: Sun, 1 Feb 2026 20:50:04 +0100 Subject: [PATCH 3/6] Update 5.1.5 - Fix : Mining head/skull to keep its custom data. - Fix : Breaking noteblock and/or head (by hand or explosion) stop any playing audio. - Fix : Triggering a noteblock restart the head custom audio. - Will not be fixed (for now) : An explosion will drop the head but will wiped any custom data. You'll have to recreate it with /cd create... --- .../customdiscsplugin/HopperManager.java | 2 +- .../customdiscsplugin/event/HeadPlay.java | 129 +++++++++++++++++- .../customdiscsplugin/event/JukeBox.java | 2 +- 3 files changed, 130 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/Navoei/customdiscsplugin/HopperManager.java b/src/main/java/me/Navoei/customdiscsplugin/HopperManager.java index ba7edb7..6145447 100644 --- a/src/main/java/me/Navoei/customdiscsplugin/HopperManager.java +++ b/src/main/java/me/Navoei/customdiscsplugin/HopperManager.java @@ -107,7 +107,7 @@ public void onChunkLoad(ChunkLoadEvent event) { } for (BlockState blockState : event.getChunk().getTileEntities()) { if (blockState instanceof Jukebox jukebox) { - if (!jukebox.hasRecord()) return; + if (!jukebox.hasRecord()) continue; if (!PlayerManager.instance().isAudioPlayerPlaying(blockState.getLocation()) && TypeChecker.isCustomMusicDisc(jukebox.getRecord())) { jukebox.stopPlaying(); } diff --git a/src/main/java/me/Navoei/customdiscsplugin/event/HeadPlay.java b/src/main/java/me/Navoei/customdiscsplugin/event/HeadPlay.java index 1b09324..7431772 100644 --- a/src/main/java/me/Navoei/customdiscsplugin/event/HeadPlay.java +++ b/src/main/java/me/Navoei/customdiscsplugin/event/HeadPlay.java @@ -15,22 +15,31 @@ import org.bukkit.Bukkit; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import org.bukkit.block.BlockState; import org.bukkit.block.Skull; +import org.bukkit.entity.Item; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockDropItemEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.NotePlayEvent; +import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.persistence.PersistentDataContainer; import org.bukkit.persistence.PersistentDataType; +import javax.annotation.Nullable; import java.io.FileNotFoundException; import java.io.IOException; import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; import java.util.Optional; public class HeadPlay implements Listener{ @@ -46,7 +55,7 @@ public void onNotePlay(NotePlayEvent event) throws IOException { if (noteBlock.getType() != Material.NOTE_BLOCK) return; - if (PlayerManager.instance().isAudioPlayerPlaying(noteBlock.getLocation())) return; + if (PlayerManager.instance().isAudioPlayerPlaying(noteBlock.getLocation())) playerManager.stopDisc(noteBlock); Block headBlock = noteBlock.getRelative(BlockFace.UP); if (!TypeChecker.isHead(headBlock.getType())) return; @@ -124,4 +133,122 @@ public void onHeadPlace(BlockPlaceEvent event) { }, 1L); } + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onHeadBreak(BlockBreakEvent event) { + Block block = event.getBlock(); + if (!TypeChecker.isHead(block.getType()) && !TypeChecker.isWallHead(block.getType())) return; + + Skull headSkull = (Skull) block.getState(); + + PersistentDataContainer headPDC = headSkull.getPersistentDataContainer(); + if (!headPDC.has(new NamespacedKey(customDiscs, "customhead"), PersistentDataType.STRING)) return; + + Block noteblockBlockChecker = block.getRelative(BlockFace.DOWN); + + if (noteblockBlockChecker.getType() != Material.NOTE_BLOCK) return; + + playerManager.stopDisc(noteblockBlockChecker); + } + + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onHeadDrop(BlockDropItemEvent event) { + BlockState blockState = event.getBlockState(); + + if (!(blockState instanceof Skull skull)) return; + + PersistentDataContainer blockPDC = skull.getPersistentDataContainer(); + + NamespacedKey headKey = new NamespacedKey(customDiscs, "customhead"); + NamespacedKey loreKey = new NamespacedKey(customDiscs, "headlore"); + NamespacedKey rangeKey = new NamespacedKey(customDiscs, "range"); + + for (Item itemEntity : event.getItems()) { + ItemStack droppedStack = itemEntity.getItemStack(); + if (!TypeChecker.isHead(droppedStack.getType()) && !TypeChecker.isWallHead(droppedStack.getType())) continue; + + ItemMeta droppedMeta = droppedStack.getItemMeta(); + if (droppedMeta == null) continue; + + PersistentDataContainer droppedItemPDC = droppedMeta.getPersistentDataContainer(); + + String customHeadRetrieved = blockPDC.get(headKey, PersistentDataType.STRING); + if (customHeadRetrieved != null) { + droppedItemPDC.set(headKey, PersistentDataType.STRING, customHeadRetrieved); + } + + String loreRetrieved = blockPDC.get(loreKey, PersistentDataType.STRING); + if (loreRetrieved != null) { + droppedItemPDC.set(loreKey, PersistentDataType.STRING, loreRetrieved); + + Component deserialized = GsonComponentSerializer.gson().deserialize(loreRetrieved); + @Nullable List itemLore = new ArrayList<>(); + itemLore.add(deserialized); + droppedMeta.lore(itemLore); + } + + Float rangeRetrieved = blockPDC.get(rangeKey, PersistentDataType.FLOAT); + if (rangeRetrieved != null) { + droppedItemPDC.set(rangeKey, PersistentDataType.FLOAT, rangeRetrieved); + } + + droppedStack.setItemMeta(droppedMeta); + } + } + + //TODO: To rework someday, so that it retain custom_data infos + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onHeadExplode(EntityExplodeEvent event) { + for (Block explodedBlock : event.blockList()) { + if (TypeChecker.isHead(explodedBlock.getType()) || TypeChecker.isWallHead(explodedBlock.getType())) { + Skull headSkull = (Skull) explodedBlock.getState(); + + PersistentDataContainer headPDC = headSkull.getPersistentDataContainer(); + if (!headPDC.has(new NamespacedKey(customDiscs, "customhead"), PersistentDataType.STRING)) return; + + Block noteblockBlockChecker = explodedBlock.getRelative(BlockFace.DOWN); + + if (noteblockBlockChecker.getType() != Material.NOTE_BLOCK) continue; + + playerManager.stopDisc(noteblockBlockChecker); + } + } + } + + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onNoteblockHeadBreak(BlockBreakEvent event) { + Block block = event.getBlock(); + + if (block.getType() != Material.NOTE_BLOCK) return; + + Block headBlockChecker = block.getRelative(BlockFace.UP); + + if (!TypeChecker.isHead(headBlockChecker.getType())) return; + + Skull headSkull = (Skull) headBlockChecker.getState(); + + PersistentDataContainer headPDC = headSkull.getPersistentDataContainer(); + if (!headPDC.has(new NamespacedKey(customDiscs, "customhead"), PersistentDataType.STRING)) return; + + playerManager.stopDisc(block); + } + + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onNoteblockHeadExplode(EntityExplodeEvent event) { + for (Block explodedBlock : event.blockList()) { + if (explodedBlock.getType() == Material.NOTE_BLOCK) { + + Block headBlockChecker = explodedBlock.getRelative(BlockFace.UP); + + if (!TypeChecker.isHead(headBlockChecker.getType())) continue; + + Skull headSkull = (Skull) headBlockChecker.getState(); + + PersistentDataContainer headPDC = headSkull.getPersistentDataContainer(); + if (!headPDC.has(new NamespacedKey(customDiscs, "customhead"), PersistentDataType.STRING)) continue; + + playerManager.stopDisc(explodedBlock); + } + } + } + } \ No newline at end of file diff --git a/src/main/java/me/Navoei/customdiscsplugin/event/JukeBox.java b/src/main/java/me/Navoei/customdiscsplugin/event/JukeBox.java index 7f23194..8c1ea37 100644 --- a/src/main/java/me/Navoei/customdiscsplugin/event/JukeBox.java +++ b/src/main/java/me/Navoei/customdiscsplugin/event/JukeBox.java @@ -136,7 +136,7 @@ public void onJukeboxExplode(EntityExplodeEvent event) { for (Block explodedBlock : event.blockList()) { if (explodedBlock.getType() == Material.JUKEBOX) { Jukebox jukebox = (Jukebox) explodedBlock.getState(); - if (!isCustomMusicDisc(jukebox.getRecord())) return; + if (!isCustomMusicDisc(jukebox.getRecord())) continue; playerManager.stopDisc(explodedBlock); } } From 8faf5eebce83806e29d6da3d4a888cd44e9e67ae Mon Sep 17 00:00:00 2001 From: Athar42 Date: Sun, 8 Feb 2026 17:47:12 +0100 Subject: [PATCH 4/6] Update 5.1.5 - Reorder checks for HopperManager + use of local variable to avoid excessive external calls (shouldn't change a lot "performance wise", but still a little better this way) --- .../customdiscsplugin/HopperManager.java | 42 ++++++++++++------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/src/main/java/me/Navoei/customdiscsplugin/HopperManager.java b/src/main/java/me/Navoei/customdiscsplugin/HopperManager.java index 6145447..bf158fb 100644 --- a/src/main/java/me/Navoei/customdiscsplugin/HopperManager.java +++ b/src/main/java/me/Navoei/customdiscsplugin/HopperManager.java @@ -20,6 +20,8 @@ import org.bukkit.event.inventory.InventoryMoveItemEvent; import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.world.ChunkLoadEvent; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; import org.bukkit.persistence.PersistentDataContainer; import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.meta.ItemMeta; @@ -27,7 +29,7 @@ import org.bukkit.persistence.PersistentDataType; import java.nio.file.Path; -import java.util.Objects; +import java.util.List; import java.util.Optional; import java.util.logging.Logger; @@ -43,18 +45,27 @@ public void onJukeboxInsertFromHopper(InventoryMoveItemEvent event) { if (debugModeResult) { pluginLogger.info("DEBUG - HopperManager -> Enter : onJukeboxInsertFromHopper"); } - if (event.getDestination().getLocation() == null) return; - if (!event.getDestination().getType().equals(InventoryType.JUKEBOX)) return; - if (!TypeChecker.isCustomMusicDisc(event.getItem())) return; - Component songNameComponent = Objects.requireNonNull(event.getItem().getItemMeta().lore()).get(0).asComponent(); + Inventory destinationInventory = event.getDestination(); + + if (destinationInventory.getLocation() == null) return; + if (!destinationInventory.getType().equals(InventoryType.JUKEBOX)) return; + + ItemStack eventItemStack = event.getItem(); + + if (!TypeChecker.isCustomMusicDisc(eventItemStack)) return; + + ItemMeta discMeta = eventItemStack.getItemMeta(); + + List discLore = discMeta.lore(); + if (discLore == null || discLore.isEmpty()) return; + Component songNameComponent = discLore.getFirst().asComponent(); String songName = PlainTextComponentSerializer.plainText().serialize(songNameComponent); Component customActionBarSongPlaying = LegacyComponentSerializer.legacyAmpersand().deserialize(Lang.NOW_PLAYING.toString().replace("%song_name%", songName)); - ItemMeta discMeta = event.getItem().getItemMeta(); String soundFileName = discMeta.getPersistentDataContainer().get(new NamespacedKey(customDiscs, "customdisc"), PersistentDataType.STRING); - PersistentDataContainer persistentDataContainer = event.getItem().getItemMeta().getPersistentDataContainer(); + PersistentDataContainer persistentDataContainer = discMeta.getPersistentDataContainer(); float range = CustomDiscs.getInstance().musicDiscDistance; NamespacedKey customSoundRangeKey = new NamespacedKey(customDiscs, "range"); @@ -63,14 +74,13 @@ public void onJukeboxInsertFromHopper(InventoryMoveItemEvent event) { range = Math.min(soundRange, CustomDiscs.getInstance().musicDiscMaxDistance); } - if (!event.getItem().hasData(DataComponentTypes.TOOLTIP_DISPLAY) || !event.getItem().getData(DataComponentTypes.TOOLTIP_DISPLAY).hiddenComponents().contains(DataComponentTypes.JUKEBOX_PLAYABLE)) { - event.getItem().setData(DataComponentTypes.TOOLTIP_DISPLAY, TooltipDisplay.tooltipDisplay().addHiddenComponents(DataComponentTypes.JUKEBOX_PLAYABLE).build()); + if (!eventItemStack.hasData(DataComponentTypes.TOOLTIP_DISPLAY) || !eventItemStack.getData(DataComponentTypes.TOOLTIP_DISPLAY).hiddenComponents().contains(DataComponentTypes.JUKEBOX_PLAYABLE)) { + eventItemStack.setData(DataComponentTypes.TOOLTIP_DISPLAY, TooltipDisplay.tooltipDisplay().addHiddenComponents(DataComponentTypes.JUKEBOX_PLAYABLE).build()); } Path soundFilePath = Path.of(customDiscs.getDataFolder().getPath(), "musicdata", soundFileName); assert VoicePlugin.voicechatServerApi != null; - playerManager.playAudio(VoicePlugin.voicechatServerApi, soundFilePath, event.getDestination().getLocation().getBlock(), customActionBarSongPlaying, range); - + playerManager.playAudio(VoicePlugin.voicechatServerApi, soundFilePath, destinationInventory.getLocation().getBlock(), customActionBarSongPlaying, range); } @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @@ -79,21 +89,23 @@ public void onJukeboxEjectToHopperMinecart(InventoryMoveItemEvent event) { pluginLogger.info("DEBUG - HopperManager -> Enter : onJukeboxEjectToHopper"); } + Inventory sourceInventory = event.getSource(); + + if (sourceInventory.getLocation() == null) return; + if (!sourceInventory.getType().equals(InventoryType.JUKEBOX)) return; if (!TypeChecker.isCustomMusicDisc(event.getItem())) return; - if (event.getSource().getLocation() == null) return; - if (!event.getSource().getType().equals(InventoryType.JUKEBOX)) return; if (ServerVersionChecker.isPaperAPI()) { if (!(event.getDestination().getHolder(false) instanceof HopperMinecart)) return; - InventoryHolder holderSource = event.getSource().getHolder(false); + InventoryHolder holderSource = sourceInventory.getHolder(false); if (holderSource instanceof BlockState) { playerManager.stopDisc(((BlockState) holderSource).getBlock()); } } else { if (!(event.getDestination().getHolder() instanceof HopperMinecart)) return; - InventoryHolder holderSource = event.getSource().getHolder(); + InventoryHolder holderSource = sourceInventory.getHolder(); if (holderSource instanceof BlockState) { playerManager.stopDisc(((BlockState) holderSource).getBlock()); } From e4d58ce29e559cdea0d66f98f5294c82fbc64fe6 Mon Sep 17 00:00:00 2001 From: Athar42 Date: Mon, 16 Feb 2026 00:48:18 +0100 Subject: [PATCH 5/6] Update 5.1.5 - Update Discord invite link --- readme.md | 2 +- src/main/java/me/Navoei/customdiscsplugin/CustomDiscs.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index 2943afd..c599bfb 100644 --- a/readme.md +++ b/readme.md @@ -10,7 +10,7 @@ A Paper fork of henkelmax's Audio Player. Special thanks to Athar42 for maintain - Music files should go into ```plugins/CustomDiscs/musicdata/``` - Music files must be in the ```.wav```, ```.flac```, or ```.mp3``` format. -Join the discord for support: https://discord.gg/YJpqruvZ97. The issues section in this repository has been closed. +Join the discord for support: https://discord.gg/rJtBRmRFCr. The issues section in this repository has been closed. Downloading Files: - To download a file use the command ```/cd download ```. diff --git a/src/main/java/me/Navoei/customdiscsplugin/CustomDiscs.java b/src/main/java/me/Navoei/customdiscsplugin/CustomDiscs.java index 69faac2..ab37225 100644 --- a/src/main/java/me/Navoei/customdiscsplugin/CustomDiscs.java +++ b/src/main/java/me/Navoei/customdiscsplugin/CustomDiscs.java @@ -141,10 +141,10 @@ public void onEnable() { .clickEvent(ClickEvent.openUrl("https://github.com/Navoei/CustomDiscs")) .hoverEvent(HoverEvent.showText(Component.text("Click to open CustomDiscs' GitHub page")))), LegacyComponentAmpersand.deserialize("&aDiscord&7: ") - .append(Component.text("https://discord.gg/YJpqruvZ97") + .append(Component.text("https://discord.gg/rJtBRmRFCr") .color(NamedTextColor.BLUE) .decorate(TextDecoration.UNDERLINED) - .clickEvent(ClickEvent.openUrl("https://discord.gg/YJpqruvZ97")) + .clickEvent(ClickEvent.openUrl("https://discord.gg/rJtBRmRFCr")) .hoverEvent(HoverEvent.showText(Component.text("Click to join our Discord !")))) }; From 353a02a3b10f94626436eed7d9b37d7512f849d8 Mon Sep 17 00:00:00 2001 From: Athar42 Date: Mon, 16 Feb 2026 00:48:37 +0100 Subject: [PATCH 6/6] Update 5.1.5 - Correct Readme --- readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index c599bfb..551cba6 100644 --- a/readme.md +++ b/readme.md @@ -52,9 +52,9 @@ Versions support matrix : | **1.21.4** | Paper | 4.2 - 4.4 | [4.4](https://github.com/Navoei/CustomDiscs/releases/tag/v4.4) | | **1.21.5** | Paper | 4.4 | [4.4](https://github.com/Navoei/CustomDiscs/releases/tag/v4.4) | | **1.21.6, 1.21.7-8** | Paper | 4.5 | [4.5](https://github.com/Navoei/CustomDiscs/releases/tag/v4.5) | -| **1.21.7-9, 1.21.8**
**1.21.8** | Paper
Folia | 5.0 - 5.1.5
5.1.1 - 5.1.5 | [5.1.4](https://modrinth.com/plugin/customdiscs-plugin/version/5.1.5) | -| **1.21.9, 1.21.10**
**1.21.9, 1.21.10** | Paper
Folia | 5.1.2 - 5.1.5
5.1.2 - 5.1.5 | [5.1.4](https://modrinth.com/plugin/customdiscs-plugin/version/5.1.5) | -| **1.21.11**
**1.21.11** | Paper
Folia | 5.1.3 - 5.1.5
5.1.3 - 5.1.5 | [5.1.4](https://modrinth.com/plugin/customdiscs-plugin/version/5.1.5) | +| **1.21.7-9, 1.21.8**
**1.21.8** | Paper
Folia | 5.0 - 5.1.5
5.1.1 - 5.1.5 | [5.1.5](https://modrinth.com/plugin/customdiscs-plugin/version/5.1.5) | +| **1.21.9, 1.21.10**
**1.21.9, 1.21.10** | Paper
Folia | 5.1.2 - 5.1.5
5.1.2 - 5.1.5 | [5.1.5](https://modrinth.com/plugin/customdiscs-plugin/version/5.1.5) | +| **1.21.11**
**1.21.11** | Paper
Folia | 5.1.3 - 5.1.5
5.1.3 - 5.1.5 | [5.1.5](https://modrinth.com/plugin/customdiscs-plugin/version/5.1.5) | https://user-images.githubusercontent.com/64107368/178426026-c454ac66-5133-4f3a-9af9-7f674e022423.mp4