Java 类org.bukkit.event.player.PlayerMoveEvent 实例源码

项目:NoDaylight    文件:PlayerMoveListener.java   
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
    if (!event.getFrom().getWorld().getName().equalsIgnoreCase("cave")) {
        return;
    }

    if (event.getTo().getBlock().getLightFromSky() == 0) {
        return;
    }

    if (event.getPlayer().getGameMode() == GameMode.CREATIVE) {
        return;
    }

    event.getPlayer().setHealth(0.0D);

    TextComponent message = new TextComponent("DU VOLLIDIOT! SONNE IST GEFÄHRLICH! HOFFE DU LERNST DARAUS");
    message.setColor(ChatColor.DARK_RED);

    event.getPlayer().spigot().sendMessage(message);
}
项目:Crescent    文件:ImpossibleA.java   
@Override
public void call(Event event) {
    final Player player = profile.getPlayer();

    if (event instanceof PlayerMoveEvent) {
        if ((player.isSprinting() || player.isBlocking() || player.isConversing()) && player.isSneaking()) {
            callback(true);
            return;
        }
        callback(false);
    } else if (event instanceof AsyncPlayerChatEvent) {
        if ((player.isBlocking() || player.isSprinting() || player.isSneaking())) {
            callback(true);
            return;
        }
        callback(false);
    }
}
项目:Crescent    文件:BehaviourListeners.java   
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
    final Player player = event.getPlayer();

    final Material from = event.getFrom().getBlock().getRelative(BlockFace.DOWN).getType();

    final Behaviour behaviour = Profile.getProfile(player.getUniqueId()).getBehaviour();

    final long current = System.currentTimeMillis();

    if (player.isSprinting()) {
        behaviour.getMotion().setLastSprint(current);
    }
    if (player.isFlying()) {
        behaviour.getMotion().setLastFly(current);
    }

    if (from.isSolid() || behaviour.getMotion().getLastY() == -1.0 || !behaviour.getMotion().isDescending()) {
        behaviour.getMotion().setLastY(player.getLocation().getY());
    }

    if (!behaviour.isOnGround()) {
        behaviour.getMotion().setLastYDiff(event.getTo().getY() - event.getFrom().getY());
    }
}
项目:Chambers    文件:ClaimMoveListener.java   
@EventHandler
public void onMove(PlayerMoveEvent event) {
    Game game = Chambers.getInstance().getGameManager().getGame();
    if (game.getStatus() != GameStatus.INGAME) {
        return;
    }
    Location to = event.getTo();
    Location from = event.getFrom();
    if (to.getBlockX() != from.getBlockX() || to.getBlockZ() != from.getBlockZ()) {
        Player player = event.getPlayer();
        Team toTeam = Chambers.getInstance().getClaimManager().getTeamAt(to);
        Team fromTeam = Chambers.getInstance().getClaimManager().getTeamAt(from);
        if (toTeam != fromTeam) {
            Bukkit.getPluginManager().callEvent(new PlayerEnterClaimEvent(player, toTeam.getClaim()));
            Bukkit.getPluginManager().callEvent(new PlayerLeaveClaimEvent(player, fromTeam.getClaim()));
            if (toTeam.getType() == TeamType.KOTH_CAP || fromTeam.getType() == TeamType.KOTH_CAP) {
                return;
            }
            player.sendMessage(ChatColor.YELLOW + "Now leaving: " + fromTeam.getFormattedName());
            player.sendMessage(ChatColor.YELLOW + "Now entering: " + toTeam.getFormattedName());
        }
    }
}
项目:Arcadia-Spigot    文件:DeadEndGame.java   
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
    if(this.getAPI().getGameManager().isAlive(event.getPlayer())) {
        if(event.getTo().getY() <= Integer.valueOf((String) this.getGameMap().fetchSetting("floorLevel"))) {
            this.getAPI().getGameManager().setAlive(event.getPlayer(), false);
        } else {
            final Block block = event.getTo().getBlock().getRelative(BlockFace.DOWN);
            if(block.getType() != Material.AIR) {
                if(!pendingDeletion.contains(block)) {
                    pendingDeletion.add(block);
                    new BukkitRunnable() {
                        public void run() {
                            if(pendingDeletion.contains(block)) {
                                block.setType(Material.AIR);
                                pendingDeletion.remove(block);
                            }
                        }
                    }.runTaskLater(this.getAPI().getPlugin(), 3L);
                }
            }
        }
    }
}
项目:Arcadia-Spigot    文件:MineFieldGame.java   
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
    if(this.getAPI().getGameManager().isAlive(event.getPlayer())) {
        if(event.getTo().getBlock().getType() == Material.STONE_PLATE) {
            event.getTo().getBlock().setType(Material.AIR);
            event.getTo().getWorld().spigot().playEffect(event.getTo(), Effect.FLAME,
                    0, 0, 1, 1, 1, 0, 5, 15);
            event.getTo().getWorld().spigot().playEffect(event.getTo(), Effect.EXPLOSION,
                0, 0, 1, 1, 1, 0, 6, 15);
            event.getTo().getWorld().playSound(event.getTo(), Sound.ENTITY_GENERIC_EXPLODE, 5f, 1f);
            event.getPlayer().teleport(startPosition);
            return;
        }
        if(this.getSidebar().getSidebar().getScore(event.getPlayer().getName()).getScore() >= -1) {
            this.endGame();
        }
    }
}
项目:Arcadia-Spigot    文件:SpectatorListener.java   
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
    if(!event.getTo().getWorld().getName().equalsIgnoreCase(event.getFrom().getWorld().getName())) return;
    if(event.getTo().getWorld().getName().equalsIgnoreCase("world")) return;
    ArcadiaAPI api = Arcadia.getPlugin(Arcadia.class).getAPI();
    if(!api.getGameManager().isAlive(event.getPlayer())) {
        double yLevel = Utils.parseLocation((String) api.getGameManager().getCurrentGame()
            .getGameMap().fetchSetting("spectatorLocation")).getY();
        double yDif = Math.abs(event.getTo().getY() - yLevel);
        Location newLocation = event.getTo();
        newLocation.setY(yLevel);
        if(yDif >= 0.5) event.setTo(newLocation);
    }
    if(api.getMapRegistry().getMapBounds() != null) {
        if(!api.getMapRegistry().getMapBounds().contains(event.getTo())) {
            if(api.getGameManager().isAlive(event.getPlayer())
                    && api.getGameManager().getCurrentGame().killOnMapExit) {
                api.getGameManager().setAlive(event.getPlayer(), false);
            } else {
                event.setTo(event.getFrom());
            }
        }
    }
}
项目:WC    文件:IronElevators.java   
@EventHandler(priority = EventPriority.HIGH)
public void upElevator(PlayerMoveEvent e) {
    Player p = e.getPlayer();
    Block b = e.getTo().getBlock().getRelative(BlockFace.DOWN);
    if (p.hasPermission("ironelevators.use") && e.getFrom().getY() < e.getTo().getY()
            && b.getType() == elevatorMaterial) {
        b = b.getRelative(BlockFace.UP, minElevation);
        int i = maxElevation;
        while (i > 0 && !(
                b.getType() == elevatorMaterial
                        && b.getRelative(BlockFace.UP).getType().isTransparent()
                        && b.getRelative(BlockFace.UP, 2).getType().isTransparent()
        )
                ) {
            i--;
            b = b.getRelative(BlockFace.UP);
        }
        if (i > 0) {
            Location l = p.getLocation();
            l.setY(l.getY() + maxElevation + 3 - i);
            p.teleport(l);
            p.getWorld().playSound(p.getLocation(), Sound.ENTITY_IRONGOLEM_ATTACK, 1, 1);
        }
    }
}
项目:SuperiorCraft    文件:GhostBlock.java   
@EventHandler
public void onPlayerMoveEvent(PlayerMoveEvent e) {
    for (Entity en : e.getPlayer().getWorld().getEntities()) {
        if (en.getCustomName() != null && en.getCustomName().equals(getName()) && en.getLocation().distance(e.getTo()) <= 1) {
            Location l = en.getLocation();
            //e.getPlayer().sendMessage(getPlayerDirection(e.getPlayer()));
            if (getPlayerDirection(e.getPlayer()).equals("north")) {
                l.add(-1.2, 0, 0);  
            }
            else if (getPlayerDirection(e.getPlayer()).equals("south")) {
                l.add(1.2, 0, 0);   
            }
            else if (getPlayerDirection(e.getPlayer()).equals("east")) {
                l.add(0, 0, -1.2);  
            }
            else if (getPlayerDirection(e.getPlayer()).equals("west")) {
                l.add(0, 0, 1.2);   
            }
            else {
                l = e.getPlayer().getLocation();
            }
            l.setDirection(e.getPlayer().getLocation().getDirection());
            e.setTo(l);
        }
    }
}
项目:SuperiorCraft    文件:SuperiorCraft.java   
@EventHandler
public void onPlayerMoveEvent(PlayerMoveEvent e) {
    /*if (e.getPlayer().getTargetBlock((HashSet<Byte>) null, 100).getType() != Material.AIR) {
        e.getPlayer().teleport(e.getPlayer().getLocation().add(0, 1, 0));
    }*/

    /*for (Entity en : e.getPlayer().getWorld().getEntities()) {
        for (int i = 0; i < en.getScoreboardTags().toArray().length; i++) {
            String tag = en.getScoreboardTags().toString().replace('[', ' ').replace(']', ' ').trim().split(",")[i];
            //System.out.println(tag);
            if (tag.startsWith("p:")) {
                //System.out.println(tag.substring(2, tag.length()));
                if (tag.substring(2, tag.length()).equalsIgnoreCase(e.getPlayer().getName())) {
                    en.teleport(e.getPlayer().getLocation().add(0, -0.2, 0));
                    e.setFrom(en.getLocation());
                }
            }
        }
    }*/
}
项目:ProjectAres    文件:Pickup.java   
@EventHandler(ignoreCancelled = true)
public void onMove(PlayerMoveEvent event) {
    if(!isSpawned()) return;
    MatchPlayer player = match.getPlayer(event.getPlayer());
    if(player != null) {
        CooldownPlayerFacet cooler = player.facet(CooldownPlayerFacet.class);
        if(player.canInteract() &&
           cooler.isNotCooling(this) &&
           Capsule.fromEndpointsAndRadius(event.getFrom().position(),
                                          event.getTo().position(),
                                          0.5)
                  .intersects(Sphere.fromCircumscribedCuboid(entity.get().getBoundingBox())) &&
           data.pickup().query(player).isAllowed()) {

            cooler.coolFor(this, data.cooldown());
            despawn(true);
            player.facet(KitPlayerFacet.class).applyKit(data.kit(), false);
        }
    }
}
项目:ProjectAres    文件:SignUpdater.java   
@EventHandler(priority = EventPriority.MONITOR)
public void move(final PlayerMoveEvent event) {
    Player player = event.getPlayer();
    Location to = event.getTo();
    Location from = event.getFrom();
    Block toBlock = to.getBlock();
    Block fromBlock = from.getBlock();

    handleLook(player, to);

    if(PORTAL_MATERIALS.contains(toBlock.getType()) && !PORTAL_MATERIALS.contains(fromBlock.getType())) {
        nearestSign(event.getTo()).ifPresent(
            sign -> sign.connector().teleport(player)
        );
    }
}
项目:ProjectAres    文件:PlayerMovementListener.java   
/**
 * Modify the to location of the given event to prevent the movement and
 * move the player so they are standing on the center of the block at the
 * from location.
 */
private static void resetPosition(final PlayerMoveEvent event) {
    Location newLoc;
    double yValue = event.getFrom().getY();

    if(yValue <= 0 || event instanceof PlayerTeleportEvent) {
        newLoc = event.getFrom();
    } else {
        newLoc = BlockUtils.center(event.getFrom()).subtract(new Vector(0, 0.5, 0));
        if(newLoc.getBlock() != null) {
            switch(newLoc.getBlock().getType()) {
            case STEP:
            case WOOD_STEP:
                newLoc.add(new Vector(0, 0.5, 0));
                break;
            default: break;
            }
        }
    }

    newLoc.setPitch(event.getTo().getPitch());
    newLoc.setYaw(event.getTo().getYaw());
    event.setCancelled(false);
    event.setTo(newLoc);
}
项目:KingdomFactions    文件:HomeTeleportMoveEvent.java   
@EventHandler
public void onMove(PlayerMoveEvent e) {
    KingdomFactionsPlayer p = PlayerModule.getInstance().getPlayer(e.getPlayer());
    double xfrom = e.getFrom().getX();
    double yfrom = e.getFrom().getY();
    double zfrom = e.getFrom().getZ();
    double xto = e.getTo().getX();
    double yto = e.getTo().getY();
    double zto = e.getTo().getZ();
    if (!(xfrom == xto && yfrom == yto && zfrom == zto)) {
        if (p.hasAction()) {
            if (p.getAction() instanceof TeleportationAction) {
                ((TeleportationAction) p.getAction()).notifyPlayerOnMovement();
            } else if(p.getAction() instanceof LogoutAction) {
                p.getAction().cancel();
                p.sendMessage(Messages.getInstance().getPrefix() + "Je bewoog! Je uitlog actie is geannuleerd!");
            }
        }
    }
}
项目:Hub    文件:DoubleJumpListener.java   
@EventHandler
public void onPlayerMove(PlayerMoveEvent event)
{
    if (event.getPlayer().getGameMode() != GameMode.ADVENTURE)
        return;

    if (event.getPlayer().getAllowFlight())
        return;

    if (this.hub.getPlayerManager().isBusy(event.getPlayer()))
        return;

    if (((LivingEntity) event.getPlayer()).isOnGround())
    {
        event.getPlayer().setAllowFlight(true);
        this.allowed.add(event.getPlayer().getUniqueId());
    }
}
项目:Hub    文件:ParkourListener.java   
@EventHandler
public void onPlayerMove(PlayerMoveEvent event)
{
    if (this.cooldown.contains(event.getPlayer().getUniqueId()))
        return;

    this.cooldown.add(event.getPlayer().getUniqueId());

    this.hub.getServer().getScheduler().runTask(this.hub, () ->
    {
        this.cooldown.remove(event.getPlayer().getUniqueId());
        Parkour parkour = this.hub.getParkourManager().getPlayerParkour(event.getPlayer().getUniqueId());

        if (parkour != null && event.getTo().getBlockY() <= parkour.getMinimalHeight())
            parkour.failPlayer(event.getPlayer());
    });
}
项目:mczone    文件:Events.java   
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
    if (State.PVP)
        return;

    Block b = event.getTo().getBlock();
    Team team = Team.getTeam(event.getPlayer());
    if (team == null)
        return;

       if (b.getX() < team.getMin().getX() + 1 || b.getZ() < team.getMin().getZ() + 1) {
           Chat.player(event.getPlayer(), "&cYou cannot leave your team's quadrant!");
           event.getPlayer().teleport(event.getFrom());
       }
       if (b.getX() > team.getMax().getX() - 1 || b.getZ() > team.getMax().getZ() - 1) {
           Chat.player(event.getPlayer(), "&cYou cannot leave your team's quadrant!");
           event.getPlayer().teleport(event.getFrom());
       }
}
项目:mczone    文件:Events.java   
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
    Gamer g = Gamer.get(event.getPlayer().getName());
    if (Scheduler.getState() == State.WAITING && !g.getBoolean("moveable")) {

        Location to = g.getLocation("spawn-block");
        if (to == null)
            return;

        if (Map.getCurrent().getWorld() != g.getPlayer().getWorld()) {
            event.getPlayer().teleport(to);
            return;
        }

        to.setYaw(event.getPlayer().getLocation().getYaw());
        to.setPitch(event.getPlayer().getLocation().getPitch());
        if (to.getBlock().getX() != event.getTo().getBlock().getX())
            event.getPlayer().teleport(to);
        else if (to.getBlock().getZ() != event.getTo().getBlock().getZ())
            event.getPlayer().teleport(to);
    }
}
项目:mczone    文件:KitEvents.java   
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
    final Gamer g = Gamer.get(event.getPlayer());

    if (g.getVariable("spectator") != null)
        return;

    if (g.getVariable("kit") != Kit.get("tank"))
        return;

    g.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1, 100), true);

    if (g.getPlayer().isSprinting()) {
        new BukkitRunnable() {
            public void run() {
                g.getPlayer().setSprinting(false);
            }
        }.runTaskLater(Nexus.getPlugin(), 1);
    }
}
项目:RPGInventory    文件:PetListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerMove(PlayerMoveEvent event) {
    Player player = event.getPlayer();
    if (!InventoryManager.playerIsLoaded(player)) {
        return;
    }

    PlayerWrapper playerWrapper = InventoryManager.get(player);
    if (playerWrapper.hasPet() && playerWrapper.getPet().getPassenger() != player) {
        LivingEntity petEntity = playerWrapper.getPet();
        PetType pet = PetManager.getPetFromEntity(petEntity, player);
        if (pet != null && pet.getRole() != PetType.Role.COMPANION) {
            EntityUtils.goPetToPlayer(player, petEntity);
        }
    }
}
项目:RPGInventory    文件:ElytraListener.java   
@EventHandler(ignoreCancelled = true)
public void onPlayerFall(PlayerMoveEvent event) {
    Player player = event.getPlayer();
    if (!InventoryManager.playerIsLoaded(player) || player.isFlying()
            || player.getVehicle() != null) {
        return;
    }

    PlayerWrapper playerWrapper = InventoryManager.get(player);
    boolean endFalling = false;
    if (!player.isOnGround()) {
        if (playerIsSneakOnLadder(player) || isPlayerCanFall(player)) {
            playerWrapper.onFall();
        } else if (!player.isGliding()) {
            endFalling = true;
        }
    } else if (playerWrapper.isFalling()) {
        endFalling = true;
    }

    if (endFalling) {
        playerWrapper.setFalling(false);
    }
}
项目:RPGInventory    文件:PlayerListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
public void onPlayerMoveWhenNotLoaded(PlayerMoveEvent event) {
    Player player = event.getPlayer();

    if (!InventoryManager.isAllowedWorld(player.getWorld()) || InventoryManager.playerIsLoaded(player)) {
        return;
    }

    if (PlayerLoader.isPreparedPlayer(player)) {
        PlayerLoader.removePlayer(player);
        player.kickPlayer(RPGInventory.getLanguage().getMessage("error.rp.denied"));
        event.setCancelled(true);
    } else {
        Location toLocation = event.getTo();
        Location newLocation = event.getFrom().clone();
        //noinspection deprecation
        if (!player.isOnGround()) {
            newLocation.setY(toLocation.getY());
        }

        newLocation.setPitch(toLocation.getPitch());
        newLocation.setYaw(toLocation.getYaw());
        event.setTo(newLocation);
    }
}
项目:MT_Core    文件:PlayerListener.java   
@EventHandler
public void onPlayerMove(PlayerMoveEvent e) {
    Player p = e.getPlayer();
    PlayerObject pObject = main.getPlayerManager().getMortuusPlayer(p.getUniqueId());

    // if 25 minutes have passed since the last kill set to neutral.
    // The time is in SECONDS.
    if (pObject.getLastPlayerKillTime() != 0) {
        if (pObject.getLastPlayerKillTime() + 1500 < (System.currentTimeMillis() / 1000)
                && pObject.getPkState() != PKStates.NEUTRAL) {

            main.getScoreboards().switchTeam(p, "NEUTRAL");
            pObject.setPkState(PKStates.NEUTRAL);
            pObject.setPlayerKills(0);
        }
    }
}
项目:WorldBorder    文件:WorldBorderListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public final void onPlayerMove(final PlayerMoveEvent event) {
    final Location from = event.getFrom();
    final Location to = event.getTo();
    // If the player didn't move a complete block, ignore.
    if (from.getBlockX() == to.getBlockX()
            && from.getBlockY() == to.getBlockY()
            && from.getBlockZ() == to.getBlockZ()) {
        return;
    }

    final double origX = to.getX();
    final double origZ = to.getZ();
    this.adjustToPos(to, wbHandler.getBorder(to.getWorld()));
    if (Double.compare(origX, to.getX()) != 0
            || Double.compare(origZ, to.getZ()) != 0) {
        event.getPlayer().sendMessage(DENY_ENTRY);
    }
}
项目:HCFCore    文件:BorderListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onPlayerMove(final PlayerMoveEvent event) {
    final Location from = event.getFrom();
    final Location to = event.getTo();
    if (from.getBlockX() == to.getBlockX() && from.getBlockZ() == to.getBlockZ()) {
        return;
    }
    if (!isWithinBorder(to) && isWithinBorder(from)) {
        final Player player = event.getPlayer();
        player.sendMessage(ChatColor.RED + "You cannot go past the border.");
        event.setTo(from);
        final Entity vehicle = player.getVehicle();
        if (vehicle != null) {
            vehicle.eject();
            vehicle.teleport(from);
            vehicle.setPassenger((Entity)player);
        }
    }
}
项目:Crescent    文件:WaterWalkA.java   
@Override
public void call(Event event) {
    if (event instanceof PlayerMoveEvent) {
        final PlayerMoveEvent pme = (PlayerMoveEvent) event;

        final Behaviour behaviour = profile.getBehaviour();

        if (!behaviour.getMotion().isDescending() && !behaviour.isInCreativeOrSpectator()
                && !profile.getPlayer().isInsideVehicle() && behaviour.isOnLiquidBlock()
                && !behaviour.isInWater()) {

            final Material from = getMaterialDown(pme.getFrom());
            final Material to = getMaterialDown(pme.getTo());

            // Avoid false positives.
            if (from == Material.WATER_LILY || to == Material.WATER_LILY || Helper.isSlab(from)
                    || Helper.isSlab(to)) {
                return;
            }

            final double fromY = pme.getFrom().getY(), toY = pme.getTo().getY();

            // If the player is walking on a block.
            if ((fromY % 1.0 == 0.0 || fromY % 0.5 == 0.0) && (toY % 1.0 == 0.0 || toY % 0.5 == 0.0)) {
                callback(true);
            }
        }

        callback(false);
    }
}
项目:Crescent    文件:AntiGravityA.java   
@Override
public void call(Event event) {
    if (event instanceof PlayerMoveEvent) {
        final PlayerMoveEvent pme = (PlayerMoveEvent) event;

        final Behaviour behaviour = profile.getBehaviour();

        if (!behaviour.isOnGround() && !behaviour.isInLiquid() && !behaviour.isInWeb()) {
            if (behaviour.getMotion().isDescending()) {
                final double difference = Math.abs((behaviour.getMotion()
                        .calculateGravityEffect() /*
                                                     * Expected y difference
                                                     */)
                        - (pme.getTo().getY() - pme.getFrom()
                                .getY()) /* Actual y difference */);
                if (difference > ALLOWED_MAX_GRAVITY_DIFFERENCE && behaviour
                        .getBlocksBelowGround() > 2 /*
                                                     * The player being too
                                                     * close to the ground
                                                     * causes false
                                                     * positives.
                                                     */) {
                    callback(true);
                }
            }
        }
    }
}
项目:Warzone    文件:PortalModule.java   
@EventHandler
public void onMove(PlayerMoveEvent event) {
    if (from.getBlocks().contains(event.getTo().getBlock()) && !from.getBlocks().contains(event.getFrom().getBlock())) {
        if (!teams.isEmpty()) {

            //allow spectators to use portals
            MatchTeam spectators = TGM.get().getModule(TeamManagerModule.class).getSpectators();
            if (!spectators.containsPlayer(event.getPlayer())) {
                boolean onTeam = false;

                for (MatchTeam team : teams) {
                    if (team.containsPlayer(event.getPlayer())) {
                        onTeam = true;
                        break;
                    }
                }
                if(!onTeam) return;
            }
        }

        event.getPlayer().teleport(to);
        if (sound) {
            event.getFrom().getWorld().playSound(event.getFrom(), Sound.ENTITY_ENDERMEN_TELEPORT, 0.2f, 1);
            event.getTo().getWorld().playSound(event.getFrom(), Sound.ENTITY_ENDERMEN_TELEPORT, 0.2f, 1);
        }
    }
}
项目:FlexMC    文件:FlexPlayer.java   
@Override
public void teleport( Location l, boolean onGround ) {
    Location k = this.getLocation();
    if ( ( l.getBlockX() / 16 != k.getBlockX() / 16 ) || (  l.getBlockZ() / 16 != k.getBlockZ() / 16 ) ) {
        this.refreshShownChunks( false );
    }
    super.teleport( l, onGround );
    EventFactory.call( new PlayerMoveEvent( this, k, l ) );

}
项目:HCFCore    文件:StuckTimer.java   
@EventHandler(ignoreCancelled=true, priority=EventPriority.MONITOR)
public void onPlayerMove(PlayerMoveEvent event)
{
    Player player = event.getPlayer();
    UUID uuid = player.getUniqueId();
    if (getRemaining(uuid) > 0L)
    {
        Location from = (Location)this.startedLocations.get(uuid);
        checkMovement(player, from, event.getTo());
    }
}
项目:Arcadia-Spigot    文件:SpleefGame.java   
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
    if(this.getAPI().getGameManager().isAlive(event.getPlayer())) {
        if(event.getTo().getY() <= Integer.valueOf((String) this.getGameMap().fetchSetting("floorLevel"))) {
            this.getAPI().getGameManager().setAlive(event.getPlayer(), false);
        }
    }
}
项目:Arcadia-Spigot    文件:RainbowJumpGame.java   
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
    if(this.getAPI().getGameManager().isAlive(event.getPlayer())) {
        if(this.getSidebar().getSidebar().getScore(event.getPlayer().getName()).getScore() >= -1) {
            this.endGame();
        }
        if(event.getTo().getY() <= Integer.valueOf((String) this.getGameMap().fetchSetting("floorLevel"))) {
            event.setTo(startPosition);
        }
    }
}
项目:Arcadia-Spigot    文件:TrampolinioGame.java   
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
    if(!this.getAPI().getGameManager().isAlive(event.getPlayer())) return;
    for(Map.Entry<Location, Object[]> entry : this.currentLocations.entrySet()) {
        if(event.getTo().distance(entry.getKey()) >= 1D) continue;
        this.claimPoint(event.getPlayer(), entry.getKey());
        return;
    }
}
项目:Arcadia-Spigot    文件:ColorShuffleGame.java   
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
    if(this.getAPI().getGameManager().isAlive(event.getPlayer())) {
        if(event.getTo().getY() <= Integer.valueOf((String) this.getGameMap().fetchSetting("floorLevel"))) {
            this.getAPI().getGameManager().setAlive(event.getPlayer(), false);
        }
    }
}
项目:Arcadia-Spigot    文件:RelativeDistanceSidebar.java   
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
    if(target == null) return;
    if(!event.getTo().getWorld().getName().equalsIgnoreCase(event.getFrom().getWorld().getName())) return;
    if(event.getTo().getBlockX() == event.getFrom().getBlockX()
            && event.getTo().getBlockZ() == event.getFrom().getBlockZ()) return;
    updateTarget(event.getPlayer());
}
项目:Arcadia-Spigot    文件:DistanceSidebar.java   
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
    if(target == null) return;
    if(!event.getTo().getWorld().getName().equalsIgnoreCase(event.getFrom().getWorld().getName())) return;
    if(event.getTo().getBlockX() == event.getFrom().getBlockX()
        && event.getTo().getBlockZ() == event.getFrom().getBlockZ()) return;
    updateTarget(event.getPlayer());
}
项目:Scorch    文件:EnchantListener.java   
@EventHandler
public void onMove(PlayerMoveEvent event){
    Player player = event.getPlayer();
    for (Map.Entry<CustomEnchantment, Integer> entry : getValidEnchantments(getItems(player)).entrySet()) {
        entry.getKey().passiveEffect(player, event);
    }
}
项目:AddGun    文件:RailGun.java   
/**
 * We keep track of players being still; if they haven't moved much but did
 * look around, we start tracking, otherwise we clear them.
 * 
 * @param event
 *            the movement event.
 */
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void playerMoveEvent(PlayerMoveEvent event) {
    if (event.getFrom().distanceSquared(event.getTo()) <= .000001) {
        stillSince.computeIfAbsent(event.getPlayer().getUniqueId(), u -> {
            if (event.getPlayer().hasPermission("addgun.data")) { event.getPlayer().sendMessage(ChatColor.GOLD + " still started"); }
            return System.currentTimeMillis(); 
        });
    } else {
        if (stillSince.containsKey(event.getPlayer().getUniqueId()) && event.getPlayer().hasPermission("addgun.data")) {
            event.getPlayer().sendMessage(ChatColor.GOLD + " still cleared");
        }
        stillSince.remove(event.getPlayer().getUniqueId());
    }
}
项目:OpenRPG    文件:MoveHandler.java   
@EventHandler
public void handleMove(PlayerMoveEvent event) {
    NPC.getNPCsInRange(5, event.getTo()).forEach(npc -> {
        OpenPlayer player = PlayerManager.getInstance().get(event.getPlayer());

        if (npc.shouldLookAtPlayer()) {
            npc.face(player);
        }
    });
}
项目:OpenRPG    文件:TriggerRegionChangeEvent.java   
@EventHandler
public void onRegionChange(PlayerMoveEvent event) {
    Region region = RegionManager.getInstance().getRegion(event.getTo());
    OpenPlayer player = PlayerManager.getInstance().get(event.getPlayer());

    if (region != null) {
        boolean visited = player.hasVisitedRegion(region);
        Region previous = player.setRegion(region);

        if (previous != null) {
            Bukkit.getPluginManager().callEvent(new RegionChangeEvent(player, region, previous, visited));
        }
    }
}