skizord
Новичок
- Баллы
- 16
- Имя в Minecraft
- skizord
Мне нужно чтобы переменная rand генерировалась в if(alternate == true), но если я это делаю то появляется ошибка в else, я бы мог инициализировать переменную за проверкой, но смысл итогового плагина становится совсем другим, знаю вопрос немного не про Bukkit, но я не знаю куда обращаться еще.
if (alternate) {
int rand = generate_random_number(); //переменная из за которой все проблемы
chooseTerracottaType(rand);
timer = 3;
} else {
if (rand == 1) {
player.sendMessage(ChatColor.GREEN + "Ваш цвет" + ChatColor.RED + " Зеленый");
} else if (rand == 2) {
player.sendMessage(ChatColor.GREEN + "Ваш цвет" + ChatColor.RED + " Красный");
} else if (rand == 3) {
player.sendMessage(ChatColor.GREEN + "Ваш цвет" + ChatColor.RED + " Желтый");
} else if (rand == 4) {
player.sendMessage(ChatColor.GREEN + "Ваш цвет" + ChatColor.RED + " Фиолетовый");
} else if (rand == 5) {
player.sendMessage(ChatColor.GREEN + "Ваш цвет" + ChatColor.RED + " Синий");
}
spawnTerracotta();
timer = 5;
}
if (alternate) {
int rand = generate_random_number(); //переменная из за которой все проблемы
chooseTerracottaType(rand);
timer = 3;
} else {
if (rand == 1) {
player.sendMessage(ChatColor.GREEN + "Ваш цвет" + ChatColor.RED + " Зеленый");
} else if (rand == 2) {
player.sendMessage(ChatColor.GREEN + "Ваш цвет" + ChatColor.RED + " Красный");
} else if (rand == 3) {
player.sendMessage(ChatColor.GREEN + "Ваш цвет" + ChatColor.RED + " Желтый");
} else if (rand == 4) {
player.sendMessage(ChatColor.GREEN + "Ваш цвет" + ChatColor.RED + " Фиолетовый");
} else if (rand == 5) {
player.sendMessage(ChatColor.GREEN + "Ваш цвет" + ChatColor.RED + " Синий");
}
spawnTerracotta();
timer = 5;
}