Fixed explosions dropping right items.
This commit is contained in:
parent
1e29bd6936
commit
b45e00796d
@ -1127,7 +1127,7 @@ public class Bridge extends TeamGame implements OreObsfucation
|
|||||||
// Reveal ore that are inside the explosion
|
// Reveal ore that are inside the explosion
|
||||||
_ore.Explosion(event);
|
_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
|
// Handle block ownership for explosion
|
||||||
if (event.getOwner() != null)
|
if (event.getOwner() != null)
|
||||||
@ -1142,16 +1142,9 @@ public class Bridge extends TeamGame implements OreObsfucation
|
|||||||
cur.getType() == Material.DIAMOND_ORE)
|
cur.getType() == Material.DIAMOND_ORE)
|
||||||
{
|
{
|
||||||
event.GetBlocks().remove(cur);
|
event.GetBlocks().remove(cur);
|
||||||
|
lootDrops.put(cur, new HashSet<ItemStack>());
|
||||||
switch (cur.getType())
|
|
||||||
{
|
lootDrops.get(cur).addAll(cur.getDrops());
|
||||||
case DIAMOND_ORE:
|
|
||||||
lootDrops.put(cur, Material.DIAMOND);
|
|
||||||
case COAL_ORE:
|
|
||||||
lootDrops.put(cur, Material.COAL);
|
|
||||||
default:
|
|
||||||
lootDrops.put(cur, cur.getType());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1166,8 +1159,11 @@ public class Bridge extends TeamGame implements OreObsfucation
|
|||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
Location drop = block.getLocation().clone().add(.5, .5, .5);
|
Location drop = block.getLocation().clone().add(.5, .5, .5);
|
||||||
|
|
||||||
Item item = block.getWorld().dropItem(drop, new ItemStack(lootDrops.remove(block)));
|
for (ItemStack stack : lootDrops.remove(block))
|
||||||
item.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), event.getOwner().getUniqueId()));
|
{
|
||||||
|
Item item = block.getWorld().dropItem(drop, stack);
|
||||||
|
item.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), event.getOwner().getUniqueId()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 1);
|
}, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user