Skip to content

Commit

Permalink
Merge pull request #87 from Th3Shadowbroker/fix/itemsadder-break
Browse files Browse the repository at this point in the history
Fix/itemsadder break
  • Loading branch information
Th3Shadowbroker authored Feb 4, 2023
2 parents cd9d4dd + cbe4a92 commit e5a735b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>dev.th3shadowbroker.spigot</groupId>
<artifactId>OuroborosMines</artifactId>
<version>1.12.0-SNAPSHOT</version>
<version>1.12.1-SNAPSHOT</version>

<properties>
<plugin.name>${project.artifactId}</plugin.name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ private void breakNaturally(BlockBreakEvent event, MineableMaterial mineableMate

Player player = event.getPlayer();
Location blockLocation = event.getBlock().getLocation();

removeCustomBlockClaim(event.getBlock());
event.getBlock().setType(Material.AIR);

Map<Integer, ItemStack> overflow = player.getInventory().addItem(drops.stream().toArray(ItemStack[]::new));
overflow.values().forEach(i -> blockLocation.getWorld().dropItem(blockLocation, i));
} else {
Expand All @@ -185,7 +189,7 @@ private void breakNaturally(BlockBreakEvent event, MineableMaterial mineableMate
Location blockLocation = event.getBlock().getLocation();

removeCustomBlockClaim(event.getBlock());
blockLocation.getBlock().setType(Material.AIR);
event.getBlock().setType(Material.AIR);

customDefaultDrops.get().forEach(
itemStack -> {
Expand All @@ -194,6 +198,9 @@ private void breakNaturally(BlockBreakEvent event, MineableMaterial mineableMate
);
}
}
} else {
removeCustomBlockClaim(event.getBlock());
event.getBlock().setType(Material.AIR);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ public void onDefaultDropsCheck(DefaultDropsCheckEvent event) {

@EventHandler
public void onRemoveCustomBlock(RemoveCustomBlockEvent event) {
Optional.ofNullable(CustomBlock.byAlreadyPlaced(event.getBlock())).ifPresent(CustomBlock::remove);
Optional.ofNullable(CustomBlock.byAlreadyPlaced(event.getBlock())).ifPresent(cb -> {
cb.playBreakEffect();
cb.remove();
});
}

@EventHandler
Expand Down

0 comments on commit e5a735b

Please sign in to comment.