- Баллы
- 76
- Имя в Minecraft
- Lucatjuh
При создание арены не спавнятся мобы. Класс "Arena" (Ошибок в данном случае нет)
Java:
package ru.lucatjuh.mobsminigame;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Zombie;
import org.*********ventory.ItemStack;
public class Arena {
private Location minLocation, maxLocation, spawnLocation;
public Arena(Location minLocation, Location maxLocation, Location spawnLocation) {
this.setMinLocation(minLocation);
this.setMaxLocation(maxLocation);
this.setSpawnLocation(spawnLocation);
}
public void spawnMobs() {
Location randomLocation = new Location(minLocation.getWorld(),
minLocation.getX() + (int) (Math.random() * (maxLocation.getX() - minLocation.getX() + 1)),
minLocation.getY() + (int) (Math.random() * (maxLocation.getY() - minLocation.getY() + 1)),
minLocation.getZ() + (int) (Math.random() * (maxLocation.getZ() - minLocation.getZ() + 1)));
Zombie zombie = (Zombie) randomLocation.getWorld().spawnEntity(randomLocation, EntityType.ZOMBIE);
zombie.setCustomName("Arena zombie");
zombie.getEquipment().setItemInHand(new ItemStack(Material.BEDROCK));
}
public Location getMinLocation() {
return minLocation;
}
public void setMinLocation(Location minLocation) {
this.minLocation = minLocation;
}
public Location getMaxLocation() {
return maxLocation;
}
public void setMaxLocation(Location maxLocation) {
this.maxLocation = maxLocation;
}
public Location getSpawnLocation() {
return spawnLocation;
}
public void setSpawnLocation(Location spawnLocation) {
this.spawnLocation = spawnLocation;
}
}
