diff --git a/src/main/java/io/github/subkek/customdiscs/CustomDiscs.java b/src/main/java/io/github/subkek/customdiscs/CustomDiscs.java index 1daa789..d1c2429 100644 --- a/src/main/java/io/github/subkek/customdiscs/CustomDiscs.java +++ b/src/main/java/io/github/subkek/customdiscs/CustomDiscs.java @@ -79,7 +79,7 @@ public void onEnable() { } getServer().getPluginManager().registerEvents(new JukeboxHandler(), this); - getServer().getPluginManager().registerEvents(HopperHandler.instance(), this); + getServer().getPluginManager().registerEvents(HopperHandler.getInstance(), this); CustomDiscsCommand customDiscsCommand = new CustomDiscsCommand(); getCommand("customdisc").setExecutor(customDiscsCommand); diff --git a/src/main/java/io/github/subkek/customdiscs/LavaPlayerManager.java b/src/main/java/io/github/subkek/customdiscs/LavaPlayerManager.java index 4dda203..8791518 100644 --- a/src/main/java/io/github/subkek/customdiscs/LavaPlayerManager.java +++ b/src/main/java/io/github/subkek/customdiscs/LavaPlayerManager.java @@ -147,7 +147,7 @@ public void stopPlaying(UUID uuid, boolean includeBlock) { lavaPlayer.audioPlayer.destroy(); lavaPlayer.lavaPlayerThread.interrupt(); if (includeBlock) { - HopperHandler.instance().discToHopper(lavaPlayer.block); + HopperHandler.getInstance().discToHopper(lavaPlayer.block); } } else { CustomDiscs.debug( diff --git a/src/main/java/io/github/subkek/customdiscs/PlayerManager.java b/src/main/java/io/github/subkek/customdiscs/PlayerManager.java index ea4223b..ce87ef7 100644 --- a/src/main/java/io/github/subkek/customdiscs/PlayerManager.java +++ b/src/main/java/io/github/subkek/customdiscs/PlayerManager.java @@ -102,13 +102,13 @@ public void playLocationalAudio(VoicechatServerApi api, Path soundFilePath, Bloc return; } - audioPlayer.setOnStopped(() -> HopperHandler.instance().discToHopper(block)); - synchronized (stopped) { if (!stopped.get()) { player.set(audioPlayer); } else { audioPlayer.stopPlaying(); + stopPlaying(id); + HopperHandler.getInstance().discToHopper(block); } } }); diff --git a/src/main/java/io/github/subkek/customdiscs/event/HopperHandler.java b/src/main/java/io/github/subkek/customdiscs/event/HopperHandler.java index a089a3b..daa0930 100644 --- a/src/main/java/io/github/subkek/customdiscs/event/HopperHandler.java +++ b/src/main/java/io/github/subkek/customdiscs/event/HopperHandler.java @@ -21,7 +21,7 @@ public class HopperHandler implements Listener { PlayerManager playerManager = PlayerManager.getInstance(); LavaPlayerManager lavaPlayerManager = LavaPlayerManager.getInstance(); - public static HopperHandler instance() { + public static HopperHandler getInstance() { if (instance == null) { instance = new HopperHandler(); }