mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Fixing Mining Double Drops (update configs)
This commit is contained in:
parent
3f30f6950b
commit
9568c0f85c
@ -151,6 +151,16 @@ Version 2.2.0
|
|||||||
Added API method to grab the level cap of a skill by its PrimarySkillType ENUM definition
|
Added API method to grab the level cap of a skill by its PrimarySkillType ENUM definition
|
||||||
Added API method to check if a skill was being level capped
|
Added API method to check if a skill was being level capped
|
||||||
|
|
||||||
|
Version 2.1.30
|
||||||
|
Fixed yet another bug involving double drops
|
||||||
|
DoubleDrop config tables now must contain all things that can possibly be doubled, such as the Ore block, the ore itself, etc.
|
||||||
|
Added the following items to the DoubleDrop tables for Mining: Coal, Diamond, Emerald, Glowstone_Dust, Iron_Ingot, Lapis_Lazuli, Nether_Quartz, Redstone, Cobblestone
|
||||||
|
|
||||||
|
NOTE: I'm gonna have to blame Bukkit on this one, several API methods I used are actually unfinished and kind of janky. So I hacked something together to make them work.
|
||||||
|
|
||||||
|
Version 2.1.29
|
||||||
|
Fixed a bug where double drops and triple drops were not activating
|
||||||
|
|
||||||
Version 2.1.28
|
Version 2.1.28
|
||||||
Fixed a bug where Archery could not gain XP
|
Fixed a bug where Archery could not gain XP
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.Tag;
|
import org.bukkit.Tag;
|
||||||
import org.bukkit.block.*;
|
import org.bukkit.block.*;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -60,31 +61,59 @@ public class BlockListener implements Listener {
|
|||||||
{
|
{
|
||||||
ItemStack is = new ItemStack(item.getItemStack());
|
ItemStack is = new ItemStack(item.getItemStack());
|
||||||
|
|
||||||
if(!event.getBlock().getDrops().contains(is))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(is.getAmount() <= 0)
|
if(is.getAmount() <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(event.getBlock().getState().getMetadata(mcMMO.doubleDropKey).size() > 0)
|
if(!Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.MINING, is.getType())
|
||||||
{
|
&& !Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.HERBALISM, is.getType())
|
||||||
//Extra Protection
|
&& !Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.WOODCUTTING, is.getType()))
|
||||||
if(event.getBlock().getState() instanceof Container)
|
continue;
|
||||||
return;
|
|
||||||
|
|
||||||
event.getBlock().getState().removeMetadata(mcMMO.doubleDropKey, plugin);
|
if(event.getBlock().getState().getMetadata(mcMMO.doubleDrops).size() > 0)
|
||||||
|
event.getBlock().getState().getWorld().dropItemNaturally(event.getBlockState().getLocation(), is);
|
||||||
|
else if(event.getBlock().getState().getMetadata(mcMMO.tripleDrops).size() > 0)
|
||||||
|
{
|
||||||
|
event.getBlock().getState().getWorld().dropItemNaturally(event.getBlockState().getLocation(), is);
|
||||||
|
event.getBlock().getState().getWorld().dropItemNaturally(event.getBlockState().getLocation(), is);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void onBlockDropItemEvent(BlockDropItemEvent event)
|
||||||
|
{
|
||||||
|
for(Item item : event.getItems())
|
||||||
|
{
|
||||||
|
ItemStack is = new ItemStack(item.getItemStack());
|
||||||
|
|
||||||
|
if(event.getBlock().getMetadata(mcMMO.doubleDrops).size() > 0)
|
||||||
|
{
|
||||||
|
List<MetadataValue> metadataValue = event.getBlock().getMetadata(mcMMO.doubleDrops);
|
||||||
|
|
||||||
|
BonusDrops bonusDrops = (BonusDrops) metadataValue.get(0);
|
||||||
|
Collection<ItemStack> potentialDrops = (Collection<ItemStack>) bonusDrops.value();
|
||||||
|
|
||||||
|
if(potentialDrops.contains(is))
|
||||||
|
{
|
||||||
event.getBlock().getState().getWorld().dropItemNaturally(event.getBlockState().getLocation(), is);
|
event.getBlock().getState().getWorld().dropItemNaturally(event.getBlockState().getLocation(), is);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(event.getBlock().getState().getMetadata(mcMMO.tripleDropKey).size() > 0)
|
event.getBlock().removeMetadata(mcMMO.doubleDrops, plugin);
|
||||||
{
|
} else {
|
||||||
//Extra Protection
|
if(event.getBlock().getMetadata(mcMMO.tripleDrops).size() > 0) {
|
||||||
if(event.getBlock().getState() instanceof Container)
|
List<MetadataValue> metadataValue = event.getBlock().getMetadata(mcMMO.tripleDrops);
|
||||||
return;
|
|
||||||
event.getBlock().getState().removeMetadata(mcMMO.tripleDropKey, plugin);
|
BonusDrops bonusDrops = (BonusDrops) metadataValue.get(0);
|
||||||
|
Collection<ItemStack> potentialDrops = (Collection<ItemStack>) bonusDrops.value();
|
||||||
|
|
||||||
|
if (potentialDrops.contains(is)) {
|
||||||
event.getBlock().getState().getWorld().dropItemNaturally(event.getBlockState().getLocation(), is);
|
event.getBlock().getState().getWorld().dropItemNaturally(event.getBlockState().getLocation(), is);
|
||||||
event.getBlock().getState().getWorld().dropItemNaturally(event.getBlockState().getLocation(), is);
|
event.getBlock().getState().getWorld().dropItemNaturally(event.getBlockState().getLocation(), is);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event.getBlock().removeMetadata(mcMMO.tripleDrops, plugin);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,6 +95,8 @@ public class mcMMO extends JavaPlugin {
|
|||||||
public final static String infiniteArrowKey = "mcMMO: Infinite Arrow";
|
public final static String infiniteArrowKey = "mcMMO: Infinite Arrow";
|
||||||
public final static String bowForceKey = "mcMMO: Bow Force";
|
public final static String bowForceKey = "mcMMO: Bow Force";
|
||||||
public final static String arrowDistanceKey = "mcMMO: Arrow Distance";
|
public final static String arrowDistanceKey = "mcMMO: Arrow Distance";
|
||||||
|
public final static String doubleDrops = "mcMMO: Double Drops";
|
||||||
|
public final static String tripleDrops = "mcMMO: Triple Drops";
|
||||||
//public final static String customDamageKey = "mcMMO: Custom Damage";
|
//public final static String customDamageKey = "mcMMO: Custom Damage";
|
||||||
public final static String disarmedItemKey = "mcMMO: Disarmed Item";
|
public final static String disarmedItemKey = "mcMMO: Disarmed Item";
|
||||||
public final static String playerDataKey = "mcMMO: Player Data";
|
public final static String playerDataKey = "mcMMO: Player Data";
|
||||||
|
@ -454,20 +454,29 @@ Double_Drops:
|
|||||||
Diorite: true
|
Diorite: true
|
||||||
Granite: true
|
Granite: true
|
||||||
Coal_Ore: true
|
Coal_Ore: true
|
||||||
|
Coal: true
|
||||||
Diamond_Ore: true
|
Diamond_Ore: true
|
||||||
|
Diamond: true
|
||||||
Emerald_Ore: true
|
Emerald_Ore: true
|
||||||
|
Emerald: true
|
||||||
End_Stone: true
|
End_Stone: true
|
||||||
Glowstone: true
|
Glowstone: true
|
||||||
|
Glowstone_Dust: true
|
||||||
Gold_Ore: true
|
Gold_Ore: true
|
||||||
Iron_Ore: true
|
Iron_Ore: true
|
||||||
|
Iron_Ingot: true
|
||||||
Lapis_Ore: true
|
Lapis_Ore: true
|
||||||
|
Lapis_Lazuli: true
|
||||||
Mossy_Cobblestone: true
|
Mossy_Cobblestone: true
|
||||||
Netherrack: true
|
Netherrack: true
|
||||||
Obsidian: true
|
Obsidian: true
|
||||||
Nether_Quartz_Ore: true
|
Nether_Quartz_Ore: true
|
||||||
|
Nether_Quartz: true
|
||||||
Redstone_Ore: true
|
Redstone_Ore: true
|
||||||
|
Redstone: true
|
||||||
Sandstone: true
|
Sandstone: true
|
||||||
Stone: true
|
Stone: true
|
||||||
|
Cobblestone: true
|
||||||
Woodcutting:
|
Woodcutting:
|
||||||
Acacia_Log: true
|
Acacia_Log: true
|
||||||
Birch_Log: true
|
Birch_Log: true
|
||||||
|
Loading…
Reference in New Issue
Block a user