@Override public String callAction(Player player, Object[] metadata) { Block plate = Util.getNearbyLocation(player, 5).getBlock(); Block ground = plate.getLocation().subtract(0, 1, 0).getBlock(); Block tnt = ground.getLocation().subtract(0, 1, 0).getBlock(); if (Util.isValid(plate) && Util.isSolid(ground) && Util.isSolid(tnt)) { plate.setTypeId(random.nextBoolean() ? 70 : 72); tnt.setType(Material.TNT); Location loc = plate.getLocation(); return ("Location: " + loc.getBlockX() + ", " + loc.getBlockY() + ", " + loc.getBlockZ()); } return "Failed, could not find a proper location!"; }
@Override public void onSpawn() { getEntity().setMaxHealth(Herobrine.getConfigFile().getInt("Herobrine.hellsGuardianHealth")); getEntity().setHealth(getEntity().getMaxHealth()); getEntity().getEquipment().setBoots(Util.getColoredArmour(Material.LEATHER_BOOTS, Color.RED)); getEntity() .getEquipment() .setLeggings(Util.getColoredArmour(Material.LEATHER_LEGGINGS, Color.RED)); getEntity() .getEquipment() .setChestplate(Util.getColoredArmour(Material.LEATHER_CHESTPLATE, Color.RED)); getEntity().getEquipment().setHelmet(Util.getColoredArmour(Material.LEATHER_HELMET, Color.RED)); getEntity().getEquipment().setItemInHand(new ItemStack(Material.IRON_SWORD, 1)); }
@Override public IActionResult callAction(Player player, Object[] metadata) { Block[] blocks = new Block[14]; blocks[0] = Util.getNearbyLocation(player, 25).add(0, 2, 0).getBlock(); blocks[1] = blocks[0].getRelative(BlockFace.NORTH).getLocation().subtract(0, 1, 0).getBlock(); blocks[2] = blocks[0].getRelative(BlockFace.SOUTH).getLocation().subtract(0, 1, 0).getBlock(); blocks[3] = blocks[0].getRelative(BlockFace.WEST).getLocation().subtract(0, 1, 0).getBlock(); blocks[4] = blocks[0].getRelative(BlockFace.EAST).getLocation().subtract(0, 1, 0).getBlock(); blocks[5] = blocks[1].getRelative(BlockFace.NORTH).getLocation().subtract(0, 1, 0).getBlock(); blocks[6] = blocks[2].getRelative(BlockFace.SOUTH).getLocation().subtract(0, 1, 0).getBlock(); blocks[7] = blocks[3].getRelative(BlockFace.WEST).getLocation().subtract(0, 1, 0).getBlock(); blocks[8] = blocks[4].getRelative(BlockFace.EAST).getLocation().subtract(0, 1, 0).getBlock(); blocks[9] = blocks[0].getRelative(BlockFace.NORTH_EAST).getLocation().subtract(0, 2, 0).getBlock(); blocks[10] = blocks[0].getRelative(BlockFace.SOUTH_EAST).getLocation().subtract(0, 2, 0).getBlock(); blocks[11] = blocks[0].getRelative(BlockFace.SOUTH_WEST).getLocation().subtract(0, 2, 0).getBlock(); blocks[12] = blocks[0].getRelative(BlockFace.NORTH_WEST).getLocation().subtract(0, 2, 0).getBlock(); blocks[13] = blocks[0].getLocation().subtract(0, 1, 0).getBlock(); for (int index = 0; index < blocks.length; index++) { Block block = blocks[index]; if (index >= 5 && index <= 12) { if (Util.isSolid(block.getLocation().subtract(0, 1, 0).getBlock()) || player.getLocation().distance(block.getLocation()) <= 1F) { return (new ActionResult("Failed, could not find a proper location!")); } } } for (int index = 0; index < blocks.length; index++) { Block block = blocks[index]; if (index == 13) { block.setType(Material.NETHERRACK); blocks[0].setType(Material.FIRE); } else { block.setType(Material.SANDSTONE); } } Location loc = blocks[0].getLocation(); return (new ActionResult( "Done.", "Location: " + loc.getBlockX() + ", " + loc.getBlockY() + ", " + loc.getBlockZ())); }
@Override public String callAction(Player player, Object[] metadata) { Location loc = Util.getNearbyLocation(player, 3); player.getWorld().createExplosion(loc, 2F); return ("Location: " + loc.getBlockX() + ", " + loc.getBlockY() + ", " + loc.getBlockZ()); }