Bugfix ( Issue #4 )

This commit is contained in:
Navoei
2022-08-16 16:35:38 -05:00
parent ec4076f2ba
commit 03d7a82e30
3 changed files with 6 additions and 5 deletions

View File

@@ -11,6 +11,6 @@ mod_id=customdiscsplugin
# Target an older API to make it compatible with older versions of Simple Voice Chat # Target an older API to make it compatible with older versions of Simple Voice Chat
voicechat_api_version=2.3.3 voicechat_api_version=2.3.3
plugin_version=2.1 plugin_version=2.1.1
maven_group=me.Navoei.customdiscsplugin maven_group=me.Navoei.customdiscsplugin
archives_base_name=custom-discs archives_base_name=custom-discs

View File

@@ -28,7 +28,8 @@ public class HopperManager implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onHopperPickupFromOtherSource(InventoryMoveItemEvent event) { public void onHopperPickupFromOtherSource(InventoryMoveItemEvent event) {
if (!Objects.requireNonNull(event.getDestination().getLocation()).getChunk().isLoaded()) return; if (event.getDestination().getLocation() == null) return;
if (!event.getDestination().getLocation().getChunk().isLoaded()) return;
if (!event.getDestination().getLocation().getBlock().getType().equals(Material.HOPPER)) return; if (!event.getDestination().getLocation().getBlock().getType().equals(Material.HOPPER)) return;
if (!isCustomMusicDisc(event.getItem())) return; if (!isCustomMusicDisc(event.getItem())) return;
@@ -225,7 +226,8 @@ public class HopperManager implements Listener {
public void itemJukeboxToHopper (Block block) { public void itemJukeboxToHopper (Block block) {
if (!Objects.requireNonNull(block.getLocation()).getChunk().isLoaded()) return; if (block == null) return;
if (!block.getLocation().getChunk().isLoaded()) return;
if (!block.getType().equals(Material.JUKEBOX)) return; if (!block.getType().equals(Material.JUKEBOX)) return;
if (!block.getRelative(BlockFace.DOWN).getType().equals(Material.HOPPER)) return; if (!block.getRelative(BlockFace.DOWN).getType().equals(Material.HOPPER)) return;

View File

@@ -79,10 +79,9 @@ public class JukeBox implements Listener{
if (jukeboxContainsDisc(block)) { if (jukeboxContainsDisc(block)) {
stopDisc(block, player); stopDisc(block, player);
Bukkit.getScheduler().runTaskLater(CustomDiscs.getInstance(), () -> HopperManager.instance().getNextDiscFromHopperIntoJukebox(block), 1L); Bukkit.getScheduler().runTaskLater(CustomDiscs.getInstance(), () -> HopperManager.instance().getNextDiscFromHopperIntoJukebox(block), 1L);
} }
} }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)