Skip to content

Commit

Permalink
Bugfix ( Issue Navoei#4 )
Browse files Browse the repository at this point in the history
  • Loading branch information
Navoei committed Aug 16, 2022
1 parent ec4076f commit 03d7a82
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ mod_id=customdiscsplugin
# Target an older API to make it compatible with older versions of Simple Voice Chat
voicechat_api_version=2.3.3

plugin_version=2.1
plugin_version=2.1.1
maven_group=me.Navoei.customdiscsplugin
archives_base_name=custom-discs
6 changes: 4 additions & 2 deletions src/main/java/me/Navoei/customdiscsplugin/HopperManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public class HopperManager implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
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 (!isCustomMusicDisc(event.getItem())) return;

Expand Down Expand Up @@ -225,7 +226,8 @@ public void onJukeboxPlace(BlockPlaceEvent event) {

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.getRelative(BlockFace.DOWN).getType().equals(Material.HOPPER)) return;

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/me/Navoei/customdiscsplugin/event/JukeBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,9 @@ public void onEject(PlayerInteractEvent event) {

if (jukeboxContainsDisc(block)) {
stopDisc(block, player);

Bukkit.getScheduler().runTaskLater(CustomDiscs.getInstance(), () -> HopperManager.instance().getNextDiscFromHopperIntoJukebox(block), 1L);

}

}

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
Expand Down

0 comments on commit 03d7a82

Please sign in to comment.