Patching a bug where mcMMO drops too few items, and yet another concurrent modification exception.

This commit is contained in:
Glitchfinder 2013-01-02 18:03:52 -08:00
parent 5b18abbea0
commit d444e088c4
2 changed files with 11 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import java.util.Random;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
@ -253,7 +254,12 @@ public class Misc {
return; return;
} }
location.getWorld().dropItemNaturally(location, itemStack).setItemStack(itemStack); Item newItem = location.getWorld().dropItemNaturally(location, itemStack);
ItemStack cloned = itemStack.clone();
cloned.setAmount(newItem.getItemStack().getAmount());
newItem.setItemStack(cloned);
} }
/** /**

View File

@ -254,14 +254,16 @@ public class HashChunkManager implements ChunkManager {
if(store.containsKey(world.getName() + "," + cx + "," + cz)) { if(store.containsKey(world.getName() + "," + cx + "," + cz)) {
ChunkStore out = store.get(world.getName() + "," + cx + "," + cz); ChunkStore out = store.get(world.getName() + "," + cx + "," + cz);
for(Entity entity : spawnedMobs) { List<Entity> tempSpawnedMobs = new ArrayList<Entity>(spawnedMobs);
for(Entity entity : tempSpawnedMobs) {
if(!isEntityInChunk(entity, cx, cz, world)) if(!isEntityInChunk(entity, cx, cz, world))
continue; continue;
out.addSpawnedMob(entity.getUniqueId()); out.addSpawnedMob(entity.getUniqueId());
} }
for(Entity entity : spawnedPets) { List<Entity> tempSpawnedPets = new ArrayList<Entity>(spawnedPets);
for(Entity entity : tempSpawnedPets) {
if(!isEntityInChunk(entity, cx, cz, world)) if(!isEntityInChunk(entity, cx, cz, world))
continue; continue;