mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Fixed Beetroots double drop issue #4667
This commit is contained in:
parent
6bdc51be76
commit
2d78eaa495
@ -1,4 +1,5 @@
|
|||||||
Version 2.1.219
|
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
|
Added 'Skills.Mining.BlastMining.Bonus_Drops.Enabled' to advanced.yml to enable/disable bonus drops from Blast Mining
|
||||||
|
|
||||||
Version 2.1.218
|
Version 2.1.218
|
||||||
|
@ -38,6 +38,7 @@ import org.bukkit.event.block.*;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class BlockListener implements Listener {
|
public class BlockListener implements Listener {
|
||||||
private final mcMMO plugin;
|
private final mcMMO plugin;
|
||||||
@ -56,6 +57,12 @@ public class BlockListener implements Listener {
|
|||||||
return;
|
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
|
//Track how many "things" are being dropped
|
||||||
HashSet<Material> uniqueMaterials = new HashSet<>();
|
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
|
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
|
||||||
@ -70,7 +77,7 @@ public class BlockListener implements Listener {
|
|||||||
blockCount++;
|
blockCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(uniqueMaterials.size() > 1) {
|
if(uniqueMaterials.size() > tileEntityTolerance) {
|
||||||
//Too many things are dropping, assume tile entities might be duped
|
//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
|
//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;
|
dontRewardTE = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user