Fixed explosions dropping right items.

This commit is contained in:
Mysticate 2016-01-29 15:58:49 -05:00
parent 1e29bd6936
commit b45e00796d

View File

@ -1127,7 +1127,7 @@ public class Bridge extends TeamGame implements OreObsfucation
// Reveal ore that are inside the explosion
_ore.Explosion(event);
NautHashMap<Block, Material> lootDrops = new NautHashMap<Block, Material>();
NautHashMap<Block, HashSet<ItemStack>> lootDrops = new NautHashMap<Block, HashSet<ItemStack>>();
// Handle block ownership for explosion
if (event.getOwner() != null)
@ -1142,16 +1142,9 @@ public class Bridge extends TeamGame implements OreObsfucation
cur.getType() == Material.DIAMOND_ORE)
{
event.GetBlocks().remove(cur);
switch (cur.getType())
{
case DIAMOND_ORE:
lootDrops.put(cur, Material.DIAMOND);
case COAL_ORE:
lootDrops.put(cur, Material.COAL);
default:
lootDrops.put(cur, cur.getType());
}
lootDrops.put(cur, new HashSet<ItemStack>());
lootDrops.get(cur).addAll(cur.getDrops());
}
}
}
@ -1166,8 +1159,11 @@ public class Bridge extends TeamGame implements OreObsfucation
block.setType(Material.AIR);
Location drop = block.getLocation().clone().add(.5, .5, .5);
Item item = block.getWorld().dropItem(drop, new ItemStack(lootDrops.remove(block)));
item.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), event.getOwner().getUniqueId()));
for (ItemStack stack : lootDrops.remove(block))
{
Item item = block.getWorld().dropItem(drop, stack);
item.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), event.getOwner().getUniqueId()));
}
}
}
}, 1);