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); }
public void reloadFlyZones(boolean showMessage) { RocketInit.rocketZoneLocations.clear(); List<String> zoneList = RocketInit.getPlugin().getConfig().getStringList("zones"); if (zoneList.size() > 0) { for (String zone : zoneList) { String[] zoneSection = zone.split("\\|"); final Location zoneLocationStart = new Location( Bukkit.getWorld(zoneSection[1]), Integer.parseInt(zoneSection[2]) - 25, Integer.parseInt(zoneSection[3]) - 5, Integer.parseInt(zoneSection[4]) - 25); final Location zoneLocationEnd = new Location( Bukkit.getWorld(zoneSection[1]), Integer.parseInt(zoneSection[2]) + 25, Integer.parseInt(zoneSection[3]) + 50, Integer.parseInt(zoneSection[4]) + 25); RocketInit.rocketZoneLocations.put( UUID.fromString(zoneSection[0]), new ConcurrentHashMap<Location, Location>() { { put(zoneLocationStart, zoneLocationEnd); } }); } if (showMessage) RocketInit.registerMap.put("zone", zoneList.size()); } }