- Баллы
- 76
- Имя в Minecraft
- ItsWay
Привет,я незнаю как сделать, сделал кастомное тнт, и надо сделать так что бы при взрыве его, уничтожался обсидиан в определённом радиусе, начало я сделал такой механизм с простым тнт, вот код:
Вот код с добавлением тнт:
Вопрос как мне в классе листенер проверять entitytype одинаков с entitytype из кастомного тнт(tnt1)
вот проверка с простым тнт:
Это listener класс
это класс добавления тнт
Вот код с добавлением тнт:
Вопрос как мне в классе листенер проверять entitytype одинаков с entitytype из кастомного тнт(tnt1)
вот проверка с простым тнт:
Код:
if (e.getEntityType() == EntityType.PRIMED_TNT) {
@EventHandler
public void onExplode(EntityExplodeEvent e) {
FileConfiguration config = plugin.getConfig();
int radiusexplode = config.getInt("configurations.tnts.standart_tnt.explode-obsidian-radius");
World world = e.getEntity().getWorld();
if (e.getEntityType() == EntityType.PRIMED_TNT) {
for (int x = e.getEntity().getLocation().getBlockX() - radiusexplode; x < e.getEntity().getLocation().getBlockX() + radiusexplode; x++) {
for (int y = e.getEntity().getLocation().getBlockY() - radiusexplode; y < e.getEntity().getLocation().getBlockY() + radiusexplode; y++) {
for (int z = e.getEntity().getLocation().getBlockZ() - radiusexplode; z < e.getEntity().getLocation().getBlockZ() + radiusexplode; z++) {
Block radiusBlock = world.getBlockAt(x, y, z);
if(config.getBoolean("configurations.tnts.standart_tnt.explode-obsidian") == true) {
if(radiusBlock.getType() == Material.OBSIDIAN) {
e.blockList().add(radiusBlock);
Bukkit.broadcast("Succesfully", null);
return;
}
}
if(config.getBoolean("configurations.tnt`s.standart_tnt.explode-obsidian") == false) {
e.blockList().remove(radiusBlock);
}
}
}
}
}
}
Это listener класс
Код:
public class ItemManager {
private system plugin;
ItemManager (system plugin) {
this.plugin = plugin;
}
public static ItemStack tnt1;
public static void init() {
Createtnt1();
}
private static void Createtnt1() {
ItemStack item = new ItemStack(Material.TNT, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("TNT TIER 1");
List<String> lore = new ArrayList<>();
lore.add("Bahaet 10 na 10");
lore.add("Prikol, on bahaet obsidian)");
meta.setLore(lore);
item.setItemMeta(meta);
tnt1 = item;
}
}
это класс добавления тнт