Java 类org.bukkit.event.vehicle.VehicleExitEvent 实例源码

项目:Skript    文件:ExprVehicle.java   
@Override
protected Entity[] get(final Event e, final Entity[] source) {
    return get(source, new Converter<Entity, Entity>() {
        @Override
        @Nullable
        public Entity convert(final Entity p) {
            if (getTime() >= 0 && e instanceof VehicleEnterEvent && p.equals(((VehicleEnterEvent) e).getEntered()) && !Delay.isDelayed(e)) {
                return ((VehicleEnterEvent) e).getVehicle();
            }
            if (getTime() >= 0 && e instanceof VehicleExitEvent && p.equals(((VehicleExitEvent) e).getExited()) && !Delay.isDelayed(e)) {
                return ((VehicleExitEvent) e).getVehicle();
            }
            return p.getVehicle();
        }
    });
}
项目:Skript    文件:ExprPassenger.java   
@Override
protected Entity[] get(final Event e, final Entity[] source) {
    return get(source, new Converter<Entity, Entity>() {
        @Override
        @Nullable
        public Entity convert(final Entity v) {
            if (getTime() >= 0 && e instanceof VehicleEnterEvent && v.equals(((VehicleEnterEvent) e).getVehicle()) && !Delay.isDelayed(e)) {
                return ((VehicleEnterEvent) e).getEntered();
            }
            if (getTime() >= 0 && e instanceof VehicleExitEvent && v.equals(((VehicleExitEvent) e).getVehicle()) && !Delay.isDelayed(e)) {
                return ((VehicleExitEvent) e).getExited();
            }
            return v.getPassenger();
        }
    });
}
项目:modules-extra    文件:ListenerVehicle.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onVehicleExit(final VehicleExitEvent event)
{
    if (event.getExited() instanceof Player)
    {
        VehicleExit action = this.newAction(VehicleExit.class, event.getExited().getWorld());
        if (action != null)
        {
            action.setVehicle(event.getVehicle());
            action.setLocation(event.getVehicle().getLocation());
            action.setPlayer((Player)event.getExited());
            this.logAction(action);
        }
    }
    else
    {
        // TODO entity vehicle exit
    }
}
项目:SpigotSource    文件:Entity.java   
protected void p(Entity entity) {
    if (entity.bz() == this) {
        throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
    } else {
        // CraftBukkit start
        CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle();
        Entity orig = craft == null ? null : craft.getHandle();
        if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
            VehicleExitEvent event = new VehicleExitEvent(
                    (Vehicle) getBukkitEntity(),
                    (LivingEntity) entity.getBukkitEntity()
            );
            Bukkit.getPluginManager().callEvent(event);
            CraftEntity craftn = (CraftEntity) entity.getBukkitEntity().getVehicle();
            Entity n = craftn == null ? null : craftn.getHandle();
            if (event.isCancelled() || n != orig) {
                return;
            }
        }
        // CraftBukkit end
        Bukkit.getPluginManager().callEvent( new org.spigotmc.event.entity.EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity())); // Spigot
        this.passengers.remove(entity);
        entity.j = 60;
    }
}
项目:ZentrelaRPG    文件:HorseManager.java   
@EventHandler
public void onDismount(VehicleExitEvent event) {
    if (event.getExited() instanceof Player) {
        Player p = (Player) event.getExited();
        if (plugin.getPD(p) != null)
            plugin.getPD(p).riding = false;
    }
    if (horseUUIDs.contains(event.getVehicle().getUniqueId())) {
        Vehicle v = event.getVehicle();
        RScheduler.schedule(plugin, new Runnable() {
            public void run() {
                if (v != null && v.isValid()) {
                    if (v instanceof Horse) {
                        if (((CraftHorse) v).getHandle() instanceof CustomHorse) {
                            ((CustomHorse) ((CraftHorse) v).getHandle()).rearUp();
                        }
                    }
                }
            }
        }, 10);
        RScheduler.schedule(plugin, new Runnable() {
            public void run() {
                if (v != null && v.isValid()) {
                    RParticles.show(ParticleEffect.CLOUD, v.getLocation().add(0, 1, 0), 10);
                    v.remove();
                }
            }
        }, 35);
    }
}
项目:Arcadia-Spigot    文件:WorldListener.java   
@EventHandler
public void onVehicleExit(VehicleExitEvent event) {
    if(event.getExited().getType() != EntityType.PLAYER) return;
    ArcadiaAPI api = Arcadia.getPlugin(Arcadia.class).getAPI();
    if(!api.getGameManager().isAlive((Player) event.getExited())) return;
    if(api.getGameManager().getGameState() != GameState.FINISHED) {
        if(event.getVehicle().hasMetadata("allow-exit")) return;
        event.setCancelled(true);
    }
}
项目:AddGun    文件:PlayerListener.java   
/**
 * We keep track of players entering and exiting vehicles.
 * 
 * @param event
 *  the exit event
 */
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void vehicleExitEvent(VehicleExitEvent event) {
    if (event.getExited() != null && event.getVehicle() != null && event.getExited() instanceof Player) {
        Player eventPlayer = (Player) event.getExited();
        /*if (vehicleSince.containsKey(eventPlayer.getUniqueId()) && eventPlayer.hasPermission("addgun.data")) {
            eventPlayer.sendMessage(ChatColor.GOLD + " exited vehicle");
        }*/
        vehicleSince.remove(eventPlayer.getUniqueId());
        vehicleLeft.computeIfAbsent(eventPlayer.getUniqueId(), u -> {
            return System.currentTimeMillis(); 
        });
    }
}
项目:EchoPet    文件:PetEntityListener.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onDismount(VehicleExitEvent event) {
    Entity e = event.getVehicle();
    if (ReflectionUtil.getEntityHandle(e) instanceof IEntityPet) {
        IEntityPet entityPet = (IEntityPet) ReflectionUtil.getEntityHandle(e);
        if (entityPet.getPet().isOwnerRiding() && !entityPet.getPet().isOwnerInMountingProcess()) {
            Lang.sendTo(entityPet.getPet().getOwner(), Lang.RIDE_PET_OFF.toString());
            entityPet.getPet().ownerRidePet(false);
        }
    }
}
项目:Cardinal    文件:InteractModule.java   
/**
 * Prevents a player that can't interact from exiting vehicles.
 *
 * @param event The event.
 */
@EventHandler(ignoreCancelled = true)
public void onVehicleExit(VehicleExitEvent event) {
  if (event.getActor() instanceof Player && !canInteract((Player) event.getActor())) {
    event.setCancelled(true);
  }
}
项目:SonarPet    文件:PetEntityListener.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onDismount(VehicleExitEvent event) {
    Entity e = event.getVehicle();
    if (plugin.isPet(e)) {
        IEntityPet entityPet = plugin.getPetEntity(e);
        if (entityPet.getPet().isOwnerRiding() && !entityPet.getPet().isOwnerInMountingProcess()) {
            Lang.sendTo(entityPet.getPet().getOwner(), Lang.RIDE_PET_OFF.toString());
            entityPet.getPet().ownerRidePet(false);
        }
    }
}
项目:acidisland    文件:SafeBoat.java   
/**
 * @param e
 *            This event aims to put the player in a safe place when they
 *            exit the boat
 */
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBoatExit(VehicleExitEvent e) {
    final Entity boat = e.getVehicle();
    if (!boat.getType().equals(EntityType.BOAT)) {
        // Not a boat
        return;
    }
    // LivingEntity entity = e.getExited();
    final Entity entityObj = (Entity) e.getExited();
    if (!(entityObj instanceof Player)) {
        return;
    }
    final Player player = (Player) entityObj;
    final World playerWorld = player.getWorld();
    if (!playerWorld.getName().equalsIgnoreCase(Settings.worldName)) {
        // Not the right world
        return;
    }
    if (SafeBoat.ignoreList.contains(player.getUniqueId())) {
        return;
    }
    // Set the boat exit flag for this player
    // midTeleport.add(player.getUniqueId());
    if (exitedBoat.containsKey(player.getUniqueId())) {
        // Debounce
        e.setCancelled(true);
    } else {
        exitedBoat.put(player.getUniqueId(), boat);
    }
    return;
}
项目:AntiCheat-COMPAT    文件:VehicleListener.java   
@EventHandler(ignoreCancelled = true)
public void onVehicleExit(VehicleExitEvent event) {
    if (event.getExited() instanceof Player) {
        getBackend().logEnterExit((Player) event.getExited());
    }

    AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
}
项目:askyblock    文件:SafeBoat.java   
/**
 * @param e
 *            This event aims to put the player in a safe place when they
 *            exit the boat
 */
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBoatExit(VehicleExitEvent e) {
    final Entity boat = e.getVehicle();
    if (!boat.getType().equals(EntityType.BOAT)) {
        // Not a boat
        return;
    }
    // LivingEntity entity = e.getExited();
    final Entity entityObj = (Entity) e.getExited();
    if (!(entityObj instanceof Player)) {
        return;
    }
    final Player player = (Player) entityObj;
    final World playerWorld = player.getWorld();
    if (!playerWorld.getName().equalsIgnoreCase(Settings.worldName)) {
        // Not the right world
        return;
    }
    if (SafeBoat.ignoreList.contains(player.getUniqueId())) {
        return;
    }
    // Set the boat exit flag for this player
    // midTeleport.add(player.getUniqueId());
    if (exitedBoat.containsKey(player.getUniqueId())) {
        // Debounce
        e.setCancelled(true);
    } else {
        exitedBoat.put(player.getUniqueId(), boat);
    }
    return;
}
项目:Dexoria-Hub    文件:GadgetMenu.java   
@EventHandler
public void onDismount(VehicleExitEvent e){
    if(e.getVehicle() instanceof Horse){
        RemoteEntity ent1 = re.get(e.getExited());      
        ent1.setSpeed(0.7d);
    }
}
项目:DeinCart    文件:DeinCartListener.java   
@EventHandler
public void onVehicleExit(VehicleExitEvent event) {
    if (event.getExited() != null && event.getExited() instanceof Player) {
        Player player = (Player) event.getExited();
        if (this.manager.isRoutePlayer(player)) {
            event.setCancelled(true);
        }
    }
}
项目:DeadHorses    文件:PlayerListener.java   
/**
 * Handle a player being thrown from an untamed Dead Horse.
 * 
 * @param event Caught event
 */
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onVehicleExitEvent(VehicleExitEvent event) {
  if (!isDeadHorse(event.getVehicle())) {
    return;
  }
  if (!(event.getExited() instanceof Player) || !Perms.isUser((Player) event.getExited())) {
    return;
  }
  Horse horse = (Horse) event.getVehicle();

  if (plugin.getPluginConfig().isVanillaTamingEnabled() && horse.isAdult() && !horse.isTamed()) {
    playAngryEffects(horse);
  }
}
项目:Equestrian-Dash    文件:VehicleExitListener.java   
@EventHandler
public void onDismount(VehicleExitEvent event)
{
    Player p = (Player) event.getExited();

    if (p.getGameMode() != GameMode.CREATIVE)
    {
        event.setCancelled(true);
    }
}
项目:Wayward    文件:ChairExitVehicleListener.java   
@EventHandler(priority= EventPriority.LOWEST)
public void onExitVehicle(VehicleExitEvent event) {
    if (event.getVehicle().getPassenger() instanceof Player) {
        final Player player = (Player) event.getVehicle().getPassenger();
        if (plugin.getChairManager().isSitting(player)) {
            plugin.getChairManager().unsitPlayerNormal(player);
        }
    }
}
项目:BCProtect    文件:PlayerAccessListener.java   
@EventHandler (ignoreCancelled = true)
public void onVehicleExit(VehicleExitEvent event) {
    LivingEntity entity = event.getExited();
    if (entity instanceof Player)
        if (! Util.checkPermission((Player) entity, event.getVehicle().getLocation(BCProtect.location), "canAccess")) {
            event.setCancelled(true);
        }
}
项目:MineKart    文件:JockeyListener.java   
/**
 * Called when a player tried to dismount a vehicle.
 * 
 * @param event The vehicle exit event containing information on this
 *            event
 */
@EventHandler
public void onEntityDismount(VehicleExitEvent event) {

    LivingEntity jockeyEntity = event.getExited();

    if (!(jockeyEntity instanceof Player))
        return;

    Jockey jockey = MineKart.getInstance().getJockey((Player) jockeyEntity);
    if (jockey == null)
        return;

    event.setCancelled(true);
}
项目:HorseMount    文件:HorseMount.java   
@EventHandler
public void onVehicleExit(VehicleExitEvent event) {
    if (event.getVehicle() instanceof Horse) {
        Horse h = (Horse) event.getVehicle();
        h.remove();
    }
}
项目:FlyingTub    文件:TubFlightListener.java   
@EventHandler(ignoreCancelled=true)
public final void onVehicleExit(VehicleExitEvent event) {
    Vehicle cart = event.getVehicle();
    if (cart.getType() == EntityType.MINECART) {
        ((Minecart) cart).setFlyingVelocityMod(exitedVelocityMod);
    }
}
项目:ProjectAres    文件:FreezeListener.java   
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onVehicleExit(final VehicleExitEvent event) {
    if(freeze.isFrozen(event.getExited())) {
        event.setCancelled(true);
    }
}
项目:GamePlate    文件:ObserverModule.java   
@EventHandler
public void onVehicleExit(VehicleExitEvent event) {
    if (event.getExited() instanceof Player && isObserver((Player) event.getExited())) {
        event.setCancelled(true);
    }
}
项目:Skript    文件:ExprVehicle.java   
@SuppressWarnings("unchecked")
@Override
public boolean setTime(final int time) {
    return super.setTime(time, getExpr(), VehicleEnterEvent.class, VehicleExitEvent.class);
}
项目:Skript    文件:ExprPassenger.java   
@SuppressWarnings("unchecked")
@Override
public boolean setTime(final int time) {
    return super.setTime(time, getExpr(), VehicleEnterEvent.class, VehicleExitEvent.class);
}
项目:AbilityAPI    文件:SequenceListener.java   
@EventHandler
public void onVehicleExit(VehicleExitEvent event) {
    if (event.getExited() instanceof Player) {
        this.manager.invoke((Player) event.getExited(), event);
    }
}
项目:Cardinal-Plus    文件:ObserverModule.java   
@EventHandler
public void onVehicleExit(VehicleExitEvent event) {
    if (!match.isRunning() || event.getExited() instanceof Player && TeamUtils.getTeamByPlayer((Player) event.getExited()).isObserver()) {
        event.setCancelled(true);
    }
}
项目:NoHack    文件:NoHackListener.java   
@EventHandler(ignoreCancelled = true)
public void onMountExit(VehicleExitEvent event) {

    if (event.getExited() instanceof Player) {

        Player p = (Player) event.getExited();

        MoveData md = nh.vars.getMoveData(p.getName());

        md.lastmounting = System.currentTimeMillis();

        nh.vars.setMoveData(p.getName(), md);

    }

}
项目:CardinalPGM    文件:ObserverModule.java   
@EventHandler
public void onVehicleExit(VehicleExitEvent event) {
    if (event.getExited() instanceof Player && testObserverOrDead((Player) event.getExited())) {
        event.setCancelled(true);
    }
}