org.bukkit.Location.getZ()

Here are the examples of the java api org.bukkit.Location.getZ() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

178 Examples 7

19 Source : ParticleHandlers.java
with GNU General Public License v3.0
from ZombieStriker

public static void spawnParticle(double r, double g, double b, Location loc) {
    try {
        if (is13) {
            Particle.DustOptions dust = new Particle.DustOptions(Color.fromRGB((int) (r * 255), (int) (g * 255), (int) (b * 255)), 1);
            for (Player player : loc.getWorld().getPlayers()) {
                if (player.getLocation().distanceSquared(loc) < 60 * 60)
                    player.spawnParticle(Particle.REDSTONE, loc.getX(), loc.getY(), loc.getZ(), 0, 0, 0, 0, dust);
            }
        /*Particle.DustOptions dust = new Particle.DustOptions(
						Color.fromRGB((int) (r * 255), (int) (g * 255), (int) (b * 255)), 1);
				loc.getWorld().spawnParticle(Particle.REDSTONE, loc.getX(), loc.getY(), loc.getZ(), 0, 0, 0, 0, dust);*/
        } else {
            for (Player player : loc.getWorld().getPlayers()) {
                if (player.getLocation().distanceSquared(loc) < 60 * 60)
                    player.spawnParticle(Particle.REDSTONE, loc.getX(), loc.getY(), loc.getZ(), 0, r, g, b, 1);
            }
        // loc.getWorld().spawnParticle(Particle.REDSTONE, loc.getX(), loc.getY(), loc.getZ(), 0, r, g, b, 1);
        }
    } catch (Error | Exception e45) {
        e45.printStackTrace();
    }
}

19 Source : ParticleWrapper.java
with Apache License 2.0
from UnknownStudio

public void spawnParticle(Player player, Location location) {
    spawnParticle(player, location.getX(), location.getY(), location.getZ());
}

19 Source : ParticleWrapper.java
with Apache License 2.0
from UnknownStudio

public void spawnParticle(Location location) {
    spawnParticle(location.getWorld(), location.getX(), location.getY(), location.getZ());
}

19 Source : Quat.java
with MIT License
from TabooLib

public static Quat at(Location location) {
    return Quat.at(location.getX(), location.getY(), location.getZ());
}

19 Source : InternalPathfinderExecutor.java
with MIT License
from TabooLib

@Override
public boolean navigationMove(LivingEnreplacedy enreplacedy, Location location, double speed) {
    return ((Navigation) getNavigation(enreplacedy)).a(location.getX(), location.getY(), location.getZ(), speed);
}

19 Source : InternalPathfinderExecutor.java
with MIT License
from TabooLib

@Override
public void controllerLookAt(LivingEnreplacedy enreplacedy, Location target) {
    ((ControllerLook) getControllerLook(enreplacedy)).a(target.getX(), target.getY(), target.getZ(), 10, 40);
}

19 Source : CustomNPC.java
with GNU General Public License v3.0
from SamaGames

public void setLocation(Location loc) {
    setLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
}

19 Source : HighlightListener.java
with GNU General Public License v2.0
from SakuraKoi

private Location roundLocation(Location location) {
    Location loc = location.clone();
    loc.setX(Math.round(loc.getX()));
    loc.setZ(Math.round(loc.getZ()));
    return loc;
}

19 Source : VersionedWorld.java
with MIT License
from PXAV

/**
 * Creates an explosion at the given location.
 *
 * @param world         The world to spawn the explosion at.
 * @param location      The center of the explosion
 * @param power         The power of the explosion. More information on explosion powers can be
 *                      found in {@link ExplosionPower}
 * @param breakBlocks   Whether the explosion should be able to break blocks.
 * @param igniteFire    Whether the explosion should be able to ignite a fire within its radius.
 */
@Override
public void createExplosion(KelpWorld world, KelpLocation location, ExplosionPower power, boolean breakBlocks, boolean igniteFire) {
    Location bukkitLocation = location.getBukkitLocation();
    world.getBukkitWorld().createExplosion(bukkitLocation.getX(), bukkitLocation.getY(), bukkitLocation.getZ(), power.getPower(), igniteFire, breakBlocks);
}

19 Source : KelpLocation.java
with MIT License
from PXAV

public static KelpLocation from(Location location) {
    KelpLocation kelpLocation = new KelpLocation();
    kelpLocation.setX(location.getX());
    kelpLocation.setY(location.getY());
    kelpLocation.setZ(location.getZ());
    kelpLocation.setYaw(location.getYaw());
    kelpLocation.setPitch(location.getPitch());
    kelpLocation.setWorldName(location.getWorld().getName());
    return kelpLocation;
}

19 Source : ArenaInitializer1_11_R1.java
with GNU General Public License v3.0
from Plugily-Projects

@Override
public void spawnVillager(Location location) {
    RidableVillager ridableVillager = new RidableVillager(location.getWorld());
    ridableVillager.setPosition(location.getX(), location.getY(), location.getZ());
    ((CraftWorld) location.getWorld()).getHandle().addEnreplacedy(ridableVillager, CreatureSpawnEvent.SpawnReason.CUSTOM);
    Villager villager = (Villager) ridableVillager.getBukkitEnreplacedy();
    villager.setRemoveWhenFarAway(false);
    this.addVillager((Villager) ridableVillager.getBukkitEnreplacedy());
}

19 Source : PathfinderGoalFollowOwner.java
with GNU General Public License v2.0
from PatoTheBest

private boolean a(int i, int j, int k) {
    if (Math.abs((double) i - this.enreplacedyOwner.locX()) < 2.0D && Math.abs((double) k - this.enreplacedyOwner.locZ()) < 2.0D) {
        return false;
    } else if (!this.a(new BlockPosition(i, j, k))) {
        return false;
    } else {
        CraftEnreplacedy enreplacedy = this.enreplacedy.getBukkitEnreplacedy();
        Location to = new Location(enreplacedy.getWorld(), (float) i + 0.5F, j, (float) k + 0.5F, this.enreplacedy.yaw, this.enreplacedy.pitch);
        EnreplacedyTeleportEvent event = new EnreplacedyTeleportEvent(enreplacedy, enreplacedy.getLocation(), to);
        this.enreplacedy.world.getServer().getPluginManager().callEvent(event);
        if (event.isCancelled()) {
            return false;
        } else {
            to = event.getTo();
            this.enreplacedy.setPositionRotation(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
            this.navigation.o();
            return true;
        }
    }
}

19 Source : BoundingBox.java
with GNU General Public License v3.0
from Mohist-Community

/**
 * Shifts this bounding box by the given amounts.
 *
 * @param shift the shift
 * @return this bounding box (now shifted)
 */
@NotNull
public BoundingBox shift(@NotNull Location shift) {
    Validate.notNull(shift, "Shift is null!");
    return this.shift(shift.getX(), shift.getY(), shift.getZ());
}

19 Source : BoundingBox.java
with GNU General Public License v3.0
from Mohist-Community

/**
 * Expands this bounding box to contain (or border) the specified position.
 *
 * @param position the position
 * @return this bounding box (now expanded)
 * @see #contains(double, double, double)
 */
@NotNull
public BoundingBox union(@NotNull Location position) {
    Validate.notNull(position, "Position is null!");
    return this.union(position.getX(), position.getY(), position.getZ());
}

19 Source : LocationAdapter.java
with GNU General Public License v3.0
from Maxlego08

private String getRaw(Location location) {
    Map<String, Object> serial = new HashMap<String, Object>();
    serial.put(NAME, location.getWorld().getName());
    serial.put(X, Double.toString(location.getX()));
    serial.put(Y, Double.toString(location.getY()));
    serial.put(Z, Double.toString(location.getZ()));
    serial.put(YAW, Float.toString(location.getYaw()));
    serial.put(PITCH, Float.toString(location.getPitch()));
    return ZPlugin.z().getGson().toJson(serial);
}

19 Source : EntityAIFollowOwner.java
with GNU General Public License v3.0
from josephworks

public void updateTask() {
    this.tameable.getLookHelper().setLookPositionWithEnreplacedy(this.owner, 10.0F, (float) this.tameable.getVerticalFaceSpeed());
    if (!this.tameable.isSitting()) {
        if (--this.timeToRecalcPath <= 0) {
            this.timeToRecalcPath = 10;
            if (!this.petPathfinder.tryMoveToEnreplacedyLiving(this.owner, this.followSpeed)) {
                if (!this.tameable.getLeashed() && !this.tameable.isRiding()) {
                    if (this.tameable.getDistanceSq(this.owner) >= 144.0D) {
                        int i = MathHelper.floor(this.owner.posX) - 2;
                        int j = MathHelper.floor(this.owner.posZ) - 2;
                        int k = MathHelper.floor(this.owner.getEnreplacedyBoundingBox().minY);
                        for (int l = 0; l <= 4; ++l) {
                            for (int i1 = 0; i1 <= 4; ++i1) {
                                if ((l < 1 || i1 < 1 || l > 3 || i1 > 3) && this.isTeleportFriendlyBlock(i, j, k, l, i1)) {
                                    // this.tameable.setLocationAndAngles((double)((float)(i + l) + 0.5F), (double)k, (double)((float)(j + i1) + 0.5F), this.tameable.rotationYaw, this.tameable.rotationPitch);
                                    CraftEnreplacedy enreplacedy = this.tameable.getBukkitEnreplacedy();
                                    Location to = new Location(enreplacedy.getWorld(), (double) ((float) (i + l) + 0.5F), (double) k, (double) ((float) (j + i1) + 0.5F), this.tameable.rotationYaw, this.tameable.rotationPitch);
                                    EnreplacedyTeleportEvent event = new EnreplacedyTeleportEvent(enreplacedy, enreplacedy.getLocation(), to);
                                    this.tameable.world.getServer().getPluginManager().callEvent(event);
                                    if (event.isCancelled()) {
                                        return;
                                    }
                                    to = event.getTo();
                                    this.tameable.setLocationAndAngles(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
                                    this.petPathfinder.clearPath();
                                    return;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

19 Source : DebugSectionUtils.java
with Apache License 2.0
from isstac

/**
 * Formats the given location in a human readable way. Null-safe.
 *
 * @param location the location to format
 * @return the formatted location
 */
static String formatLocation(Location location) {
    if (location == null) {
        return "null";
    }
    String worldName = location.getWorld() == null ? "null" : location.getWorld().getName();
    return formatLocation(location.getX(), location.getY(), location.getZ(), worldName);
}

19 Source : ClassBuilder.java
with MIT License
from InventivetalentDev

public static Object updateEnreplacedyLocation(Object enreplacedy, Location loc) throws Exception {
    NMSClreplaced.Enreplacedy.getDeclaredField("locX").set(enreplacedy, loc.getX());
    NMSClreplaced.Enreplacedy.getDeclaredField("locY").set(enreplacedy, loc.getY());
    NMSClreplaced.Enreplacedy.getDeclaredField("locZ").set(enreplacedy, loc.getZ());
    return enreplacedy;
}

19 Source : ClassBuilder.java
with MIT License
from InventivetalentDev

public static Object buildWitherSpawnPacket(int id, UUID uuid, /*UUID*/
Location loc, Object dataWatcher) throws Exception {
    Object packet = NMSClreplaced.PacketPlayOutSpawnEnreplacedyLiving.newInstance();
    if (Minecraft.VERSION.olderThan(Minecraft.Version.v1_9_R1)) {
        AccessUtil.setAccessible(NMSClreplaced.PacketPlayOutSpawnEnreplacedyLiving.getDeclaredField("a")).set(packet, id);
        // TODO: Find correct enreplacedy type id
        AccessUtil.setAccessible(NMSClreplaced.PacketPlayOutSpawnEnreplacedyLiving.getDeclaredField("b")).set(packet, 64);
        AccessUtil.setAccessible(NMSClreplaced.PacketPlayOutSpawnEnreplacedyLiving.getDeclaredField("c")).set(packet, (int) loc.getX());
        AccessUtil.setAccessible(NMSClreplaced.PacketPlayOutSpawnEnreplacedyLiving.getDeclaredField("d")).set(packet, MathUtil.floor(loc.getY() * 32D));
        AccessUtil.setAccessible(NMSClreplaced.PacketPlayOutSpawnEnreplacedyLiving.getDeclaredField("e")).set(packet, (int) loc.getZ());
        AccessUtil.setAccessible(NMSClreplaced.PacketPlayOutSpawnEnreplacedyLiving.getDeclaredField("i")).set(packet, (byte) MathUtil.d(loc.getYaw() * 256F / 360F));
        AccessUtil.setAccessible(NMSClreplaced.PacketPlayOutSpawnEnreplacedyLiving.getDeclaredField("j")).set(packet, (byte) MathUtil.d(loc.getPitch() * 256F / 360F));
        AccessUtil.setAccessible(NMSClreplaced.PacketPlayOutSpawnEnreplacedyLiving.getDeclaredField("k")).set(packet, (byte) MathUtil.d(loc.getPitch() * 256F / 360F));
        AccessUtil.setAccessible(NMSClreplaced.PacketPlayOutSpawnEnreplacedyLiving.getDeclaredField("l")).set(packet, dataWatcher);
    } else {
        AccessUtil.setAccessible(NMSClreplaced.PacketPlayOutSpawnEnreplacedyLiving.getDeclaredField("a")).set(packet, id);
        AccessUtil.setAccessible(NMSClreplaced.PacketPlayOutSpawnEnreplacedyLiving.getDeclaredField("b")).set(packet, uuid);
        AccessUtil.setAccessible(NMSClreplaced.PacketPlayOutSpawnEnreplacedyLiving.getDeclaredField("c")).set(packet, 64);
        AccessUtil.setAccessible(NMSClreplaced.PacketPlayOutSpawnEnreplacedyLiving.getDeclaredField("d")).set(packet, loc.getX());
        AccessUtil.setAccessible(NMSClreplaced.PacketPlayOutSpawnEnreplacedyLiving.getDeclaredField("e")).set(packet, loc.getY());
        AccessUtil.setAccessible(NMSClreplaced.PacketPlayOutSpawnEnreplacedyLiving.getDeclaredField("f")).set(packet, loc.getZ());
        AccessUtil.setAccessible(NMSClreplaced.PacketPlayOutSpawnEnreplacedyLiving.getDeclaredField("j")).set(packet, (byte) MathUtil.d(loc.getYaw() * 256F / 360F));
        AccessUtil.setAccessible(NMSClreplaced.PacketPlayOutSpawnEnreplacedyLiving.getDeclaredField("k")).set(packet, (byte) MathUtil.d(loc.getPitch() * 256F / 360F));
        AccessUtil.setAccessible(NMSClreplaced.PacketPlayOutSpawnEnreplacedyLiving.getDeclaredField("l")).set(packet, (byte) MathUtil.d(loc.getPitch() * 256F / 360F));
        AccessUtil.setAccessible(NMSClreplaced.PacketPlayOutSpawnEnreplacedyLiving.getDeclaredField("m")).set(packet, dataWatcher);
    }
    return packet;
}

19 Source : HologramLine.java
with MIT License
from Holovid

public PacketContainer createSpawnPackets(final Location location) {
    final PacketContainer spawnEnreplacedyLiving = new PacketContainer(PacketType.Play.Server.SPAWN_ENreplacedY_LIVING);
    spawnEnreplacedyLiving.getIntegers().write(0, enreplacedyId);
    spawnEnreplacedyLiving.getUUIDs().write(0, UUID.randomUUID());
    spawnEnreplacedyLiving.getIntegers().write(1, 1);
    spawnEnreplacedyLiving.getDoubles().write(0, location.getX());
    spawnEnreplacedyLiving.getDoubles().write(1, location.getY());
    spawnEnreplacedyLiving.getDoubles().write(2, location.getZ());
    return spawnEnreplacedyLiving;
}

19 Source : NMSExtras.java
with MIT License
from CryptoMorin

/**
 * https://minecraft.gamepedia.com/Damage#Lightning_damage
 * Lightnings deal 5 damage.
 *
 * @param players  the players to send the packet to.
 * @param location the location to spawn the lightning.
 * @param sound    if the lightning should have a sound or be silent.
 */
public static void lightning(Collection<Player> players, Location location, boolean sound) {
    try {
        Object world = WORLD_HANDLE.invoke(location.getWorld());
        if (!XMaterial.supports(16)) {
            // I don't know what the isEffect and isSilent params are used for.
            // It doesn't seem to visually change the lightning.
            Object lightningBolt = LIGHTNING_ENreplacedY.invoke(world, location.getX(), location.getY(), location.getZ(), false, false);
            Object packet = ENreplacedY_PACKET.invoke(lightningBolt);
            for (Player player : players) {
                if (sound)
                    XSound.ENreplacedY_LIGHTNING_BOLT_THUNDER.play(player);
                ReflectionUtils.sendPacket(player, packet);
            }
        } else {
            Clreplaced<?> nmsEnreplacedyType = ReflectionUtils.getNMSClreplaced("EnreplacedyTypes");
            Object lightningType = nmsEnreplacedyType.getClreplaced().getField("LIGHTNING_BOLT").get(nmsEnreplacedyType);
            Object lightningBolt = LIGHTNING_ENreplacedY.invoke(lightningType, world);
            Object lightningBoltID = lightningBolt.getClreplaced().getMethod("getId").invoke(lightningBolt);
            Object lightningBoltUUID = lightningBolt.getClreplaced().getMethod("getUniqueID").invoke(lightningBolt);
            Object vec3D = VEC3D.invoke(0D, 0D, 0D);
            Object packet = ENreplacedY_PACKET.invoke(lightningBoltID, lightningBoltUUID, location.getX(), location.getY(), location.getZ(), 0F, 0F, lightningType, 0, vec3D);
            for (Player player : players) {
                if (sound)
                    XSound.ENreplacedY_LIGHTNING_BOLT_THUNDER.play(player);
                ReflectionUtils.sendPacket(player, packet);
            }
        }
    } catch (Throwable throwable) {
        throwable.printStackTrace();
    }
}

19 Source : NMSExtras.java
with MIT License
from CryptoMorin

public static void chest(Block chest, boolean open) {
    Location location = chest.getLocation();
    try {
        Object world = WORLD_HANDLE.invoke(location.getWorld());
        Object position = BLOCK_POSITION.invoke(location.getX(), location.getY(), location.getZ());
        Object block = GET_BLOCK.invoke(GET_BLOCK_TYPE.invoke(world, position));
        PLAY_BLOCK_ACTION.invoke(world, position, block, 1, open ? 1 : 0);
    } catch (Throwable throwable) {
        throwable.printStackTrace();
    }
}

19 Source : DistanceCheck.java
with GNU General Public License v3.0
from CoolLord22

@Override
public boolean checkInstance(CustomDrop drop, OccurredEvent occurrence) {
    if (locCheck == null)
        return false;
    Location loc = occurrence.getLocation();
    Log.logInfo("DistanceCheck - start", Verbosity.HIGHEST);
    Log.logInfo("DistanceCheck - " + loc.toString() + " vs " + locCheck, Verbosity.HIGH);
    Double actualDistance = check2dDistance(loc.getX(), loc.getZ(), locCheck.getX(), locCheck.getZ());
    if (actualDistance > distance) {
        return true;
    } else {
        return false;
    }
}

19 Source : MathUtils.java
with GNU General Public License v3.0
from APDevTeam

/**
 * checks if the given bukkit <code>location</code> is within <code>hitbox</code>
 * @param hitBox the bounding box to check within
 * @param location the location to check
 * @return True if the player is within the given bounding box
 */
@Contract(pure = true)
public static boolean locationInHitBox(@NotNull final HitBox hitBox, @NotNull final Location location) {
    return hitBox.inBounds(location.getX(), location.getY(), location.getZ());
}

18 Source : SkillUtils.java
with Apache License 2.0
from Wauzmons

/**
 * Creates an audiovisual explosion, that can not destroy blocks.
 *
 * @param location The location of the explosion.
 * @param power The power of the explosion.
 */
public static void createExplosion(Location location, float power) {
    location.getWorld().createExplosion(location.getX(), location.getY(), location.getZ(), power, false, false);
}

18 Source : DisplayArmorstand.java
with Apache License 2.0
from Shynixn

/**
 * Teleports the armorstand to the given location
 *
 * @param location location
 */
@Override
public void teleport(Location location) {
    this.armorStand.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
    final PacketPlayOutEnreplacedyTeleport teleportPacket = new PacketPlayOutEnreplacedyTeleport(this.armorStand);
    this.sendPacket(teleportPacket);
}

18 Source : FoxPathfinderGoalFollowOwner.java
with MIT License
from SeanOMik

private boolean a(int i, int j, int k) {
    if (Math.abs((double) i - this.b.locX()) < 2.0D && Math.abs((double) k - this.b.locZ()) < 2.0D) {
        return false;
    } else if (!this.a(new BlockPosition(i, j, k))) {
        return false;
    } else {
        CraftEnreplacedy enreplacedy = this.a.getBukkitEnreplacedy();
        Location to = new Location(enreplacedy.getWorld(), (double) ((float) i + 0.5F), (double) j, (double) ((float) k + 0.5F), this.a.yaw, this.a.pitch);
        EnreplacedyTeleportEvent event = new EnreplacedyTeleportEvent(enreplacedy, enreplacedy.getLocation(), to);
        this.a.world.getServer().getPluginManager().callEvent(event);
        if (event.isCancelled()) {
            return false;
        } else {
            to = event.getTo();
            this.a.setPositionRotation(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
            this.e.o();
            return true;
        }
    }
}

18 Source : FoxPathfinderGoalFollowOwner.java
with MIT License
from SeanOMik

public void e() {
    this.a.getControllerLook().a(this.c, 10.0F, (float) this.a.M());
    if (!this.a.isSitting() && --this.f <= 0) {
        this.f = 10;
        if (!this.e.a(this.c, this.d) && !this.a.isLeashed() && !this.a.isPreplacedenger() && this.a.h(this.c) >= 144.0D) {
            int i = MathHelper.floor(this.c.locX) - 2;
            int j = MathHelper.floor(this.c.locZ) - 2;
            int k = MathHelper.floor(this.c.getBoundingBox().minY);
            for (int l = 0; l <= 4; ++l) {
                for (int i1 = 0; i1 <= 4; ++i1) {
                    if ((l < 1 || i1 < 1 || l > 3 || i1 > 3) && this.a(new BlockPosition(i + l, k - 1, j + i1))) {
                        CraftEnreplacedy enreplacedy = this.a.getBukkitEnreplacedy();
                        Location to = new Location(enreplacedy.getWorld(), (double) ((float) (i + l) + 0.5F), (double) k, (double) ((float) (j + i1) + 0.5F), this.a.yaw, this.a.pitch);
                        EnreplacedyTeleportEvent event = new EnreplacedyTeleportEvent(enreplacedy, enreplacedy.getLocation(), to);
                        this.a.world.getServer().getPluginManager().callEvent(event);
                        if (event.isCancelled()) {
                            return;
                        }
                        to = event.getTo();
                        this.a.setPositionRotation(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
                        this.e.o();
                        return;
                    }
                }
            }
        }
    }
}

18 Source : EntityNMS.java
with GNU Lesser General Public License v3.0
from ScreamingSandals

public void setLocation(Location location) {
    Object world = ClreplacedStorage.getMethod(handler, "getWorld,func_130014_f_").invoke();
    World craftWorld = (World) ClreplacedStorage.getMethod(world, "getWorld").invoke();
    if (!location.getWorld().equals(craftWorld)) {
        ClreplacedStorage.setField(handler, "world,field_70170_p", ClreplacedStorage.getHandle(location.getWorld()));
    }
    ClreplacedStorage.getMethod(handler, "setLocation,func_70080_a", double.clreplaced, double.clreplaced, double.clreplaced, float.clreplaced, float.clreplaced).invoke(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
}

18 Source : Hologram.java
with GNU General Public License v3.0
from SamaGames

private static EnreplacedyArmorStand generateEnreplacediesForLine(Location loc, String text) {
    EnreplacedyArmorStand enreplacedy = new EnreplacedyArmorStand(((CraftWorld) loc.getWorld()).getHandle());
    enreplacedy.setSize(0.00001F, 0.00001F);
    enreplacedy.setInvisible(true);
    enreplacedy.setNoGravity(true);
    enreplacedy.setCustomName(text);
    enreplacedy.setCustomNameVisible(true);
    enreplacedy.setLocation(loc.getX(), loc.getY() - 2, loc.getZ(), 0, 0);
    return enreplacedy;
}

18 Source : LocationUtils.java
with MIT License
from Redempt

/**
 * Converts a Location to a String
 * @param loc The Location to be stringified
 * @param separator The separator to use between pieces of information
 * @return The stringified Location
 */
public static String toString(Location loc, String separator) {
    return new StringBuilder().append(loc.getWorld().getName()).append(separator).append(loc.getX()).append(separator).append(loc.getY()).append(separator).append(loc.getZ()).toString();
}

18 Source : ArenaInitializer1_16_R3.java
with GNU General Public License v3.0
from Plugily-Projects

@Override
public void spawnVillager(Location location) {
    RidableVillager ridableVillager = new RidableVillager(location.getWorld());
    ridableVillager.setPosition(location.getX(), location.getY(), location.getZ());
    world.addEnreplacedy(ridableVillager, CreatureSpawnEvent.SpawnReason.CUSTOM);
    Villager villager = (Villager) ridableVillager.getBukkitEnreplacedy();
    villager.setRemoveWhenFarAway(false);
    this.addVillager((Villager) ridableVillager.getBukkitEnreplacedy());
}

18 Source : ArenaInitializer1_16_R3.java
with GNU General Public License v3.0
from Plugily-Projects

@Override
public void spawnSoftHardZombie(Random random) {
    Location location = getZombieSpawns().get(random.nextInt(getZombieSpawns().size()));
    HardZombie hardZombie = new HardZombie(world);
    hardZombie.setPosition(location.getX(), location.getY(), location.getZ());
    world.addEnreplacedy(hardZombie, CreatureSpawnEvent.SpawnReason.CUSTOM);
    Zombie zombie = (Zombie) hardZombie.getBukkitEnreplacedy();
    InitializerHelper.prepareSoftHardZombie(zombie, this);
    this.addZombie(zombie);
    super.setOptionValue(ArenaOption.ZOMBIES_TO_SPAWN, getOption(ArenaOption.ZOMBIES_TO_SPAWN) - 1);
}

18 Source : ArenaInitializer1_16_R3.java
with GNU General Public License v3.0
from Plugily-Projects

@Override
public void spawnHardZombie(Random random) {
    Location location = getZombieSpawns().get(random.nextInt(getZombieSpawns().size()));
    HardZombie hardZombie = new HardZombie(world);
    hardZombie.setPosition(location.getX(), location.getY(), location.getZ());
    world.addEnreplacedy(hardZombie, CreatureSpawnEvent.SpawnReason.CUSTOM);
    Zombie zombie = (Zombie) hardZombie.getBukkitEnreplacedy();
    InitializerHelper.prepareHardZombie(zombie, this);
    this.addZombie(zombie);
    super.setOptionValue(ArenaOption.ZOMBIES_TO_SPAWN, getOption(ArenaOption.ZOMBIES_TO_SPAWN) - 1);
}

18 Source : ArenaInitializer1_16_R3.java
with GNU General Public License v3.0
from Plugily-Projects

@Override
public void spawnVillagerBuster(Random random) {
    Location location = getZombieSpawns().get(random.nextInt(getZombieSpawns().size()));
    VillagerBuster villagerBuster = new VillagerBuster(world);
    villagerBuster.setPosition(location.getX(), location.getY(), location.getZ());
    world.addEnreplacedy(villagerBuster, CreatureSpawnEvent.SpawnReason.CUSTOM);
    Zombie zombie = (Zombie) villagerBuster.getBukkitEnreplacedy();
    InitializerHelper.prepareVillagerBusterZombie(zombie, this);
    this.addZombie(zombie);
    super.setOptionValue(ArenaOption.ZOMBIES_TO_SPAWN, getOption(ArenaOption.ZOMBIES_TO_SPAWN) - 1);
}

18 Source : ArenaInitializer1_16_R3.java
with GNU General Public License v3.0
from Plugily-Projects

@Override
public void spawnPlayerBuster(Random random) {
    Location location = getZombieSpawns().get(random.nextInt(getZombieSpawns().size()));
    PlayerBuster playerBuster = new PlayerBuster(world);
    playerBuster.setPosition(location.getX(), location.getY(), location.getZ());
    world.addEnreplacedy(playerBuster, CreatureSpawnEvent.SpawnReason.CUSTOM);
    Zombie zombie = (Zombie) playerBuster.getBukkitEnreplacedy();
    InitializerHelper.preparePlayerBusterZombie(zombie, this);
    this.addZombie(zombie);
    super.setOptionValue(ArenaOption.ZOMBIES_TO_SPAWN, getOption(ArenaOption.ZOMBIES_TO_SPAWN) - 1);
}

18 Source : ArenaInitializer1_16_R3.java
with GNU General Public License v3.0
from Plugily-Projects

@Override
public void spawnVillagerSlayer(Random random) {
    Location location = getZombieSpawns().get(random.nextInt(getZombieSpawns().size() - 1));
    VillagerSlayer villagerSlayer = new VillagerSlayer(world);
    villagerSlayer.setPosition(location.getX(), location.getY(), location.getZ());
    world.addEnreplacedy(villagerSlayer, CreatureSpawnEvent.SpawnReason.CUSTOM);
    Zombie zombie = (Zombie) villagerSlayer.getBukkitEnreplacedy();
    InitializerHelper.prepareVillagerSlayerZombie(zombie, this);
    this.addZombie(zombie);
    super.setOptionValue(ArenaOption.ZOMBIES_TO_SPAWN, getOption(ArenaOption.ZOMBIES_TO_SPAWN) - 1);
}

18 Source : ArenaInitializer1_14_R1.java
with GNU General Public License v3.0
from Plugily-Projects

@Override
public void spawnSoftHardZombie(Random random) {
    Location location = getZombieSpawns().get(random.nextInt(getZombieSpawns().size()));
    HardZombie fastZombie = new HardZombie(world);
    fastZombie.setPosition(location.getX(), location.getY(), location.getZ());
    world.addEnreplacedy(fastZombie, CreatureSpawnEvent.SpawnReason.CUSTOM);
    Zombie zombie = (Zombie) fastZombie.getBukkitEnreplacedy();
    InitializerHelper.prepareSoftHardZombie(zombie, this);
    this.addZombie(zombie);
    super.setOptionValue(ArenaOption.ZOMBIES_TO_SPAWN, getOption(ArenaOption.ZOMBIES_TO_SPAWN) - 1);
}

18 Source : ArenaInitializer1_14_R1.java
with GNU General Public License v3.0
from Plugily-Projects

@Override
public void spawnHardZombie(Random random) {
    Location location = getZombieSpawns().get(random.nextInt(getZombieSpawns().size()));
    HardZombie fastZombie = new HardZombie(world);
    fastZombie.setPosition(location.getX(), location.getY(), location.getZ());
    world.addEnreplacedy(fastZombie, CreatureSpawnEvent.SpawnReason.CUSTOM);
    Zombie zombie = (Zombie) fastZombie.getBukkitEnreplacedy();
    InitializerHelper.prepareHardZombie(zombie, this);
    this.addZombie(zombie);
    super.setOptionValue(ArenaOption.ZOMBIES_TO_SPAWN, getOption(ArenaOption.ZOMBIES_TO_SPAWN) - 1);
}

18 Source : ArenaInitializer1_12_R1.java
with GNU General Public License v3.0
from Plugily-Projects

@Override
public void spawnWolf(Location location, Player player) {
    if (!canSpawnMobForPlayer(player, org.bukkit.enreplacedy.EnreplacedyType.WOLF)) {
        return;
    }
    WorkingWolf wolf = new WorkingWolf(location.getWorld());
    wolf.setPosition(location.getX(), location.getY(), location.getZ());
    world.addEnreplacedy(wolf, CreatureSpawnEvent.SpawnReason.CUSTOM);
    wolf.setCustomName(plugin.getChatManager().colorMessage(Messages.SPAWNED_WOLF_NAME).replace("%player%", player.getName()));
    wolf.setCustomNameVisible(true);
    wolf.setInvisible(false);
    ((Wolf) wolf.getBukkitEnreplacedy()).setOwner(player);
    this.addWolf((Wolf) wolf.getBukkitEnreplacedy());
}

18 Source : ArenaInitializer1_12_R1.java
with GNU General Public License v3.0
from Plugily-Projects

@Override
public void spawnGolem(Location location, Player player) {
    if (!canSpawnMobForPlayer(player, org.bukkit.enreplacedy.EnreplacedyType.IRON_GOLEM)) {
        return;
    }
    RidableIronGolem ironGolem = new RidableIronGolem(location.getWorld());
    ironGolem.setPosition(location.getX(), location.getY(), location.getZ());
    ironGolem.setCustomName(plugin.getChatManager().colorMessage(Messages.SPAWNED_GOLEM_NAME).replace("%player%", player.getName()));
    ironGolem.setCustomNameVisible(true);
    world.addEnreplacedy(ironGolem, CreatureSpawnEvent.SpawnReason.CUSTOM);
    this.addIronGolem((org.bukkit.enreplacedy.IronGolem) ironGolem.getBukkitEnreplacedy());
}

18 Source : ArenaInitializer1_11_R1.java
with GNU General Public License v3.0
from Plugily-Projects

@Override
public void spawnBabyZombie(Random random) {
    Location location = getZombieSpawns().get(random.nextInt(getZombieSpawns().size()));
    BabyZombie fastZombie = new BabyZombie(world);
    fastZombie.setPosition(location.getX(), location.getY(), location.getZ());
    Zombie zombie = (Zombie) fastZombie.getBukkitEnreplacedy();
    CreatureUtils.applyAttributes(zombie, this);
    zombie.setRemoveWhenFarAway(false);
    world.addEnreplacedy(fastZombie, CreatureSpawnEvent.SpawnReason.CUSTOM);
    plugin.getHolidayManager().applyHolidayZombieEffects(zombie);
    this.addZombie((Zombie) fastZombie.getBukkitEnreplacedy());
    super.setOptionValue(ArenaOption.ZOMBIES_TO_SPAWN, getOption(ArenaOption.ZOMBIES_TO_SPAWN) - 1);
}

18 Source : WrapperPlayServerPosition.java
with GNU General Public License v3.0
from Photon-GitHub

@Override
public void setWithLocation(final Location location) {
    this.setX(location.getX());
    this.setY(location.getY());
    this.setZ(location.getZ());
    this.setYaw(location.getYaw());
    this.setPitch(location.getPitch());
}

18 Source : WrapperPlayServerEntityTeleport.java
with GNU General Public License v3.0
from Photon-GitHub

@Override
public void setWithLocation(Location location) {
    this.setX(location.getX());
    this.setY(location.getY());
    this.setZ(location.getZ());
    this.setYaw(location.getYaw());
    this.setPitch(location.getPitch());
}

18 Source : NMSImpl.java
with GNU General Public License v2.0
from PatoTheBest

@Override
public ArmorStand spawnProvisionalArmorStand(Location location) {
    EnreplacedyArmorStand enreplacedyArmorStand = new EnreplacedyArmorStand(((CraftWorld) location.getWorld()).getHandle()) {

        // disable saving
        @Override
        public boolean c(NBTTagCompound nbttagcompound) {
            return false;
        }

        // disable saving
        @Override
        public boolean d(NBTTagCompound nbttagcompound) {
            return false;
        }
    };
    enreplacedyArmorStand.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
    ((CraftWorld) location.getWorld()).getHandle().addEnreplacedy(enreplacedyArmorStand, CreatureSpawnEvent.SpawnReason.CUSTOM);
    return (ArmorStand) enreplacedyArmorStand.getBukkitEnreplacedy();
}

18 Source : NMSImpl.java
with GNU General Public License v2.0
from PatoTheBest

@Override
public ArmorStand spawnProvisionalArmorStand(Location location) {
    EnreplacedyArmorStand enreplacedyArmorStand = new EnreplacedyArmorStand(((CraftWorld) location.getWorld()).getHandle(), location.getX(), location.getY(), location.getZ()) {

        // disable saving
        @Override
        public boolean a_(NBTTagCompound nbttagcompound) {
            return false;
        }

        // disable saving
        @Override
        public boolean d(NBTTagCompound nbttagcompound) {
            return false;
        }
    };
    enreplacedyArmorStand.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
    ((CraftWorld) location.getWorld()).getHandle().addEnreplacedy(enreplacedyArmorStand, CreatureSpawnEvent.SpawnReason.CUSTOM);
    return (ArmorStand) enreplacedyArmorStand.getBukkitEnreplacedy();
}

18 Source : NMSImpl.java
with GNU General Public License v2.0
from PatoTheBest

@Override
public ArmorStand spawnProvisionalArmorStand(Location location) {
    EnreplacedyArmorStand enreplacedyArmorStand = new EnreplacedyArmorStand(((CraftWorld) location.getWorld()).getHandle(), location.getX(), location.getY(), location.getZ()) {

        // disable saving
        @Override
        public boolean c(NBTTagCompound nbttagcompound) {
            return false;
        }

        // disable saving
        @Override
        public boolean d(NBTTagCompound nbttagcompound) {
            return false;
        }
    };
    enreplacedyArmorStand.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
    ((CraftWorld) location.getWorld()).getHandle().addEnreplacedy(enreplacedyArmorStand, CreatureSpawnEvent.SpawnReason.CUSTOM);
    return (ArmorStand) enreplacedyArmorStand.getBukkitEnreplacedy();
}

18 Source : BukkitPacketBuilder.java
with Apache License 2.0
from NEZNAMY

/**
 * Builds enreplacedy teleport packet with given parameters
 * @param enreplacedyId - enreplacedy id
 * @param location - location to teleport to
 * @return enreplacedy teleport packet
 * @throws Exception - if reflection fails
 */
public Object buildEnreplacedyTeleportPacket(int enreplacedyId, Location location) throws Exception {
    Object nmsPacket = nms.newPacketPlayOutEnreplacedyTeleport.newInstance();
    nms.PacketPlayOutEnreplacedyTeleport_ENreplacedYID.set(nmsPacket, enreplacedyId);
    if (ProtocolVersion.SERVER_VERSION.getMinorVersion() >= 9) {
        nms.PacketPlayOutEnreplacedyTeleport_X.set(nmsPacket, location.getX());
        nms.PacketPlayOutEnreplacedyTeleport_Y.set(nmsPacket, location.getY());
        nms.PacketPlayOutEnreplacedyTeleport_Z.set(nmsPacket, location.getZ());
    } else {
        nms.PacketPlayOutEnreplacedyTeleport_X.set(nmsPacket, floor((double) location.getX() * 32));
        nms.PacketPlayOutEnreplacedyTeleport_Y.set(nmsPacket, floor((double) location.getY() * 32));
        nms.PacketPlayOutEnreplacedyTeleport_Z.set(nmsPacket, floor((double) location.getZ() * 32));
    }
    nms.PacketPlayOutEnreplacedyTeleport_YAW.set(nmsPacket, (byte) ((float) location.getYaw() / 360 * 256));
    nms.PacketPlayOutEnreplacedyTeleport_PITCH.set(nmsPacket, (byte) ((float) location.getPitch() / 360 * 256));
    return nmsPacket;
}

18 Source : FastParticle.java
with MIT License
from MrMicky-FR

public static <T> void spawnParticle(Player player, ParticleType particle, Location location, int count, T data) {
    spawnParticle(player, particle, location.getX(), location.getY(), location.getZ(), count, data);
}

18 Source : FastParticle.java
with MIT License
from MrMicky-FR

public static void spawnParticle(Player player, ParticleType particle, Location location, int count, double offsetX, double offsetY, double offsetZ) {
    spawnParticle(player, particle, location.getX(), location.getY(), location.getZ(), count, offsetX, offsetY, offsetZ);
}

See More Examples