Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Patching two bugs. #419

Merged
merged 1 commit into from

1 participant

Sean Porter
Sean Porter
Owner

This should patch two bugs. First is the gross lack of items dropped by mcMMO, as reflected in issue #417. Second is another ConcurrentModificationException, as reflected in issue #418.

Sean Porter Glitchfinder merged commit d0c051a into from
Sean Porter Glitchfinder was assigned
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 3, 2013
  1. Sean Porter

    Patching a bug where mcMMO drops too few items, and yet another concu…

    Glitchfinder authored
    …rrent modification exception.
This page is out of date. Refresh to see the latest.
8 src/main/java/com/gmail/nossr50/util/Misc.java
View
@@ -5,6 +5,7 @@
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
+import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent;
@@ -253,7 +254,12 @@ public static void dropItem(Location location, ItemStack itemStack) {
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);
}
/**
6 src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java
View
@@ -254,14 +254,16 @@ public synchronized void saveChunk(int cx, int cz, World world) {
if(store.containsKey(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))
continue;
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))
continue;
Something went wrong with that request. Please try again.