diff --git a/src/main/java/net/kyrptonaught/serverutils/noteblockMusic/NoteblockMusicMod.java b/src/main/java/net/kyrptonaught/serverutils/noteblockMusic/NoteblockMusicMod.java index fb4d078..a35777f 100644 --- a/src/main/java/net/kyrptonaught/serverutils/noteblockMusic/NoteblockMusicMod.java +++ b/src/main/java/net/kyrptonaught/serverutils/noteblockMusic/NoteblockMusicMod.java @@ -9,6 +9,7 @@ import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; import net.kyrptonaught.serverutils.Module; +import net.kyrptonaught.serverutils.ServerUtilsMod; import net.minecraft.command.argument.BlockPosArgumentType; import net.minecraft.command.argument.EntityArgumentType; import net.minecraft.entity.Entity; @@ -16,8 +17,11 @@ import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.world.ServerWorld; +import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; import net.minecraft.world.level.storage.LevelStorage; +import nota.Nota; +import nota.event.SongEndEvent; import nota.model.RepeatMode; import nota.model.Song; import nota.player.EntitySongPlayer; @@ -38,6 +42,14 @@ public class NoteblockMusicMod extends Module { private static final HashMap songPlayers = new HashMap<>(); + @Override + public void onInitialize() { + SongEndEvent.EVENT.register(songPlayer -> { + String song = songPlayer.getId().getPath(); + songPlayers.remove(song).destroy(); + }); + } + @Override public void registerCommands(CommandDispatcher dispatcher) { dispatcher.register(CommandManager.literal("playnbs") @@ -124,6 +136,7 @@ private static void primeSongPlayer(SongPlayer songPlayer, CommandContext