Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patching two bugs. #419

Merged
merged 1 commit into from Jan 3, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/main/java/com/gmail/nossr50/util/Misc.java
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

/**
Expand Down
Expand Up @@ -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;

Expand Down