public void zoneCrystalCreation(Player player, Location blockLocation) {

    World world = player.getWorld();

    Location centerBlock = new CenterBlock().variable(player, blockLocation, 0.475);

    centerBlock.getBlock().setType(Material.AIR);
    world.spawn(centerBlock, EnderCrystal.class);

    int cBX = centerBlock.getBlockX();
    int cBY = centerBlock.getBlockY();
    int cBZ = centerBlock.getBlockZ();

    List<String> zoneList = RocketInit.getPlugin().getConfig().getStringList("zones");
    String activeZone =
        player.getUniqueId().toString() + "|" + world.getName() + "|" + cBX + "|" + cBY + "|" + cBZ;
    zoneList.add(activeZone);

    RocketInit.getPlugin().getConfig().set("zones", zoneList);
    RocketInit.getPlugin().saveConfig();

    reloadFlyZones(false);

    Location particleLocation = new Location(world, cBX + 0.5, cBY + 1.2, cBZ + 0.5);

    world.playSound(centerBlock, Sound.ENTITY_WITHER_AMBIENT, 1.25f, 0.55f);

    PacketPlayOutWorldParticles packet =
        new PacketPlayOutWorldParticles(
            EnumParticle.PORTAL,
            false,
            particleLocation.getBlockX(),
            particleLocation.getBlockY(),
            particleLocation.getBlockZ(),
            0.0f,
            0.0f,
            0.0f,
            2,
            2500,
            null);

    for (Player serverPlayer : player.getWorld().getPlayers())
      ((CraftPlayer) serverPlayer).getHandle().playerConnection.sendPacket(packet);

    commonString.messageSend(RocketInit.getPlugin(), player, true, RocketLanguage.RB_FZ_SUCCESS);
  }
Esempio n. 2
0
 /*
  * Установка блока с проверкой на приват
  */
 public boolean placeBlock(Location loc, Player p, Material newType, byte newData, boolean phys) {
   return placeBlock(loc.getBlock(), p, newType, newData, phys);
 }