@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(); } }); }
@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(); } }); }
@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 } }
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; } }
@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); } }
@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); } }
/** * 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(); }); } }
@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); } } }
/** * 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); } }
@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); } } }
/** * @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; }
@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()); }
@EventHandler public void onDismount(VehicleExitEvent e){ if(e.getVehicle() instanceof Horse){ RemoteEntity ent1 = re.get(e.getExited()); ent1.setSpeed(0.7d); } }
@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); } } }
/** * 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); } }
@EventHandler public void onDismount(VehicleExitEvent event) { Player p = (Player) event.getExited(); if (p.getGameMode() != GameMode.CREATIVE) { event.setCancelled(true); } }
@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); } } }
@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); } }
/** * 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); }
@EventHandler public void onVehicleExit(VehicleExitEvent event) { if (event.getVehicle() instanceof Horse) { Horse h = (Horse) event.getVehicle(); h.remove(); } }
@EventHandler(ignoreCancelled=true) public final void onVehicleExit(VehicleExitEvent event) { Vehicle cart = event.getVehicle(); if (cart.getType() == EntityType.MINECART) { ((Minecart) cart).setFlyingVelocityMod(exitedVelocityMod); } }
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onVehicleExit(final VehicleExitEvent event) { if(freeze.isFrozen(event.getExited())) { event.setCancelled(true); } }
@EventHandler public void onVehicleExit(VehicleExitEvent event) { if (event.getExited() instanceof Player && isObserver((Player) event.getExited())) { event.setCancelled(true); } }
@SuppressWarnings("unchecked") @Override public boolean setTime(final int time) { return super.setTime(time, getExpr(), VehicleEnterEvent.class, VehicleExitEvent.class); }
@EventHandler public void onVehicleExit(VehicleExitEvent event) { if (event.getExited() instanceof Player) { this.manager.invoke((Player) event.getExited(), event); } }
@EventHandler public void onVehicleExit(VehicleExitEvent event) { if (!match.isRunning() || event.getExited() instanceof Player && TeamUtils.getTeamByPlayer((Player) event.getExited()).isObserver()) { event.setCancelled(true); } }
@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); } }
@EventHandler public void onVehicleExit(VehicleExitEvent event) { if (event.getExited() instanceof Player && testObserverOrDead((Player) event.getExited())) { event.setCancelled(true); } }