mirror of
https://github.com/garbagemule/MobArena.git
synced 2025-03-09 13:19:10 +01:00
Fix class chest bones not giving pets.
This commit is contained in:
parent
d6fe6ade4c
commit
b643cce511
@ -15,7 +15,6 @@ public class ArenaClass
|
||||
private ItemStack helmet, chestplate, leggings, boots;
|
||||
private List<ItemStack> items, armor;
|
||||
private Map<String,Boolean> perms;
|
||||
private int pets;
|
||||
private boolean unbreakableWeapons;
|
||||
private boolean mount;
|
||||
|
||||
@ -30,7 +29,6 @@ public class ArenaClass
|
||||
this.items = new ArrayList<ItemStack>();
|
||||
this.armor = new ArrayList<ItemStack>(4);
|
||||
this.perms = new HashMap<String,Boolean>();
|
||||
this.pets = 0;
|
||||
|
||||
this.unbreakableWeapons = unbreakableWeapons;
|
||||
}
|
||||
@ -107,9 +105,6 @@ public class ArenaClass
|
||||
if (unbreakableWeapons && isWeapon(stack)) {
|
||||
stack.setDurability(Short.MIN_VALUE);
|
||||
}
|
||||
else if (stack.getType() == Material.BONE) {
|
||||
pets += stack.getAmount();
|
||||
}
|
||||
|
||||
else if (stack.getTypeId() == 170 && stack.getAmount() == 1) {
|
||||
if (mount) return;
|
||||
@ -239,14 +234,6 @@ public class ArenaClass
|
||||
return pa;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the amount of pets this class is given upon starting the arena.
|
||||
* @return the number of pets this class has
|
||||
*/
|
||||
public int getPetAmount() {
|
||||
return pets;
|
||||
}
|
||||
|
||||
public boolean hasUnbreakableWeapons() {
|
||||
return unbreakableWeapons;
|
||||
}
|
||||
|
@ -700,19 +700,16 @@ public class ArenaImpl implements Arena
|
||||
}
|
||||
|
||||
private void spawnPets() {
|
||||
for (Map.Entry<Player,ArenaPlayer> entry : arenaPlayerMap.entrySet()) {
|
||||
ArenaClass arenaClass = entry.getValue().getArenaClass();
|
||||
int petAmount = arenaClass.getPetAmount();
|
||||
for (Player p : arenaPlayers) {
|
||||
// Find the first slot containing bones
|
||||
int bone = p.getInventory().first(Material.BONE);
|
||||
if (bone == -1) continue;
|
||||
|
||||
if (petAmount <= 0) {
|
||||
continue;
|
||||
}
|
||||
// Get the amount of pets to spawn
|
||||
int amount = p.getInventory().getItem(bone).getAmount();
|
||||
|
||||
// Remove the bones from the inventory.
|
||||
Player p = entry.getKey();
|
||||
p.getInventory().removeItem(new ItemStack(Material.BONE, petAmount));
|
||||
|
||||
for (int i = 0; i < petAmount; i++) {
|
||||
// Spawn each pet
|
||||
for (int i = 0; i < amount; i++) {
|
||||
Wolf wolf = (Wolf) world.spawnEntity(p.getLocation(), EntityType.WOLF);
|
||||
wolf.setTamed(true);
|
||||
wolf.setOwner(p);
|
||||
@ -721,6 +718,9 @@ public class ArenaImpl implements Arena
|
||||
wolf.setFireTicks(32768);
|
||||
monsterManager.addPet(wolf);
|
||||
}
|
||||
|
||||
// Remove the bones
|
||||
p.getInventory().setItem(bone, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user