Skip to content

Commit

Permalink
Fixed Beetroots double drop issue #4667
Browse files Browse the repository at this point in the history
  • Loading branch information
nossr50 committed Mar 20, 2023
1 parent 6bdc51b commit 2d78eaa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changelog.txt
@@ -1,4 +1,5 @@
Version 2.1.219
Fixed double drop issue with Beetroots
Added 'Skills.Mining.BlastMining.Bonus_Drops.Enabled' to advanced.yml to enable/disable bonus drops from Blast Mining

Version 2.1.218
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/com/gmail/nossr50/listeners/BlockListener.java
Expand Up @@ -38,6 +38,7 @@
import org.bukkit.inventory.ItemStack;

import java.util.HashSet;
import java.util.Locale;

public class BlockListener implements Listener {
private final mcMMO plugin;
Expand All @@ -56,6 +57,12 @@ public void onBlockDropItemEvent(BlockDropItemEvent event)
return;
}

int tileEntityTolerance = 1;

// beetroot hotfix, potentially other plants may need this fix
if(event.getBlockState().getType() == Material.BEETROOTS)
tileEntityTolerance = 2;

//Track how many "things" are being dropped
HashSet<Material> uniqueMaterials = new HashSet<>();
boolean dontRewardTE = false; //If we suspect TEs are mixed in with other things don't reward bonus drops for anything that isn't a block
Expand All @@ -70,7 +77,7 @@ public void onBlockDropItemEvent(BlockDropItemEvent event)
blockCount++;
}

if(uniqueMaterials.size() > 1) {
if(uniqueMaterials.size() > tileEntityTolerance) {
//Too many things are dropping, assume tile entities might be duped
//Technically this would also prevent something like coal from being bonus dropped if you placed a TE above a coal ore when mining it but that's pretty edge case and this is a good solution for now
dontRewardTE = true;
Expand Down

0 comments on commit 2d78eaa

Please sign in to comment.