private void playOutExplosion(GlowPlayer player, Iterable<BlockVector> blocks) { Collection<ExplosionMessage.Record> records = new ArrayList<>(); Location clientLoc = location.clone(); clientLoc.setX((int) clientLoc.getX()); clientLoc.setY((int) clientLoc.getY()); clientLoc.setZ((int) clientLoc.getZ()); for (BlockVector block : blocks) { byte x = (byte) (block.getBlockX() - clientLoc.getBlockX()); byte y = (byte) (block.getBlockY() - clientLoc.getBlockY()); byte z = (byte) (block.getBlockZ() - clientLoc.getBlockZ()); records.add(new ExplosionMessage.Record(x, y, z)); } Vector velocity = player.getVelocity(); ExplosionMessage message = new ExplosionMessage( (float) location.getX(), (float) location.getY(), (float) location.getZ(), 5, (float) velocity.getX(), (float) velocity.getY(), (float) velocity.getZ(), records); player.getSession().send(message); }
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 static void playSound(Player to, String sound, Location loc, float volume, float data) { if (Storm.wConfigs.get(to.getWorld().getName()).Play__Weather__Sounds) ((CraftPlayer) to) .getHandle() .playerConnection .sendPacket( new Packet62NamedSoundEffect( sound, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), volume, data)); }
public Location getSurfaceAt(Location origin) { Chunk chunky = origin.getChunk(); int x = origin.getBlockX(), z = origin.getBlockZ(), surface = 0, envid = origin.getWorld().getEnvironment().getId(); Set dimmap = Sets.newHashSet(envid == 0 ? new int[] {1, 2, 3, 7, 15, 16} : envid == -1 ? 87 : 121); for (int y = 0; y != 256; y++) if (dimmap.contains(chunky.getBlock(x, y, z).getTypeId())) surface = y; return chunky.getBlock(x, surface, z).getLocation(); }
public WorldEditorException(final String msg, final Location loc) { super( msg + " at " + loc.getWorld().getName() + ":" + loc.getBlockX() + ":" + loc.getBlockY() + ":" + loc.getBlockZ()); this.loc = loc; }
/* * getMSG (String id, [char color1, char color2], Object param1, Object param2, Object param3... ) */ public String getMSG(Object... s) { String str = "&4Unknown message"; String color1 = "&" + this.c1; String color2 = "&" + this.c2; if (s.length > 0) { String id = s[0].toString(); str = "&4Unknown message (" + id + ")"; if (msg.containsKey(id)) { int px = 1; if ((s.length > 1) && (s[1] instanceof Character)) { px = 2; color1 = "&" + s[1]; if ((s.length > 2) && (s[2] instanceof Character)) { px = 3; color2 = "&" + s[2]; } } str = color1 + msg.get(id); if (px < s.length) for (int i = px; i < s.length; i++) { String f = s[i].toString(); if (s[i] instanceof Location) { Location loc = (Location) s[i]; f = loc.getWorld().getName() + "[" + loc.getBlockX() + ", " + loc.getBlockY() + ", " + loc.getBlockZ() + "]"; } str = str.replace("%" + Integer.toString(i - px + 1) + "%", color2 + f + color1); } } else if (this.savelng) { addMSG(id, str); SaveMSG(); } } return ChatColor.translateAlternateColorCodes('&', str); }