Знаю, мега тупой вопрос, но не могу это сделать, пробывал гуглить и ничего, вот как я спавню аирдроп: (/airdropspawn):
Java:
World world = Bukkit.getWorld("world");
Random random = new Random();
int maxX = Main.getInstance().getConfig().getInt("airdrop.location-spawn.maxX");
int mixX = Main.getInstance().getConfig().getInt("airdrop.location-spawn.mixX");
int maxZ = Main.getInstance().getConfig().getInt("airdrop.location-spawn.maxZ");
int mixZ = Main.getInstance().getConfig().getInt("airdrop.location-spawn.mixZ");
int x = random.nextInt(maxX) - mixX;
int z = random.nextInt(maxZ) - mixZ;
int y = world.getHighestBlockYAt(x, z);
if (y >= 10 && y <= 256) {
Location location = new Location(world, x, y, z);
Block block = location.getBlock();
Hologram hologram = new Hologram(location);
hologram.setTime(60);
final Material originalBlockType = block.getType();
// hg
// hg
String materialName = Main.getInstance().getConfig().getString("airdrop.material");
Material material = Material.valueOf(materialName);
block.setType(material);
ShulkerBox box = (ShulkerBox) block.getState();
box.getPersistentDataContainer().set(
NamespacedKey.fromString("airdrop"),
PersistentDataType.STRING, "airdrop"
);
BukkitRunnable timer = new BukkitRunnable() {
@Override
public void run() {
block.setType(originalBlockType);
String died = Main.getInstance().getConfig().getString("messages.died-airdrop");
ChatUtils.sendMsgAll(died);
deleteRegion(name);
}
};
timer.runTaskLater(Main.getInstance(), 1200);
fillInventoryWithRandomLoot(box.getInventory());
String sound = Main.getInstance().getConfig().getString("airdrop.sound");
ChatUtils.playServerSound(Sound.valueOf(sound));
ChatUtils.sendTitleAll();
String t = String.valueOf(location.getX());
String j = String.valueOf(location.getY());
String u = String.valueOf(location.getZ());
String messagespawn = Main.getInstance().getConfig().getString("messages.spawn-airdrop")
.replace("{x}", t)
.replace("{y}", j)
.replace("{z}", u);
ChatUtils.sendMsgAll(messagespawn);