org.bukkit.event.vehicle.VehicleEnterEvent Java Examples
The following examples show how to use
org.bukkit.event.vehicle.VehicleEnterEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExprVehicle.java From Skript with GNU General Public License v3.0 | 6 votes |
@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(); } if (hasMountEvents) { if (getTime() >= 0 && e instanceof EntityMountEvent && p.equals(((EntityMountEvent) e).getEntity()) && !Delay.isDelayed(e)) { return ((EntityMountEvent) e).getMount(); } if (getTime() >= 0 && e instanceof EntityDismountEvent && p.equals(((EntityDismountEvent) e).getEntity()) && !Delay.isDelayed(e)) { return ((EntityDismountEvent) e).getDismounted(); } } return p.getVehicle(); } }); }
Example #2
Source File: RegionInteractListener.java From NovaGuilds with GNU General Public License v3.0 | 6 votes |
@EventHandler public void onVehicleEnter(VehicleEnterEvent event) { Vehicle vehicle = event.getVehicle(); if(!(event.getEntered() instanceof Player)) { return; } final Player player = (Player) event.getEntered(); NovaPlayer nPlayer = PlayerManager.getPlayer(player); List<String> denyRiding = Config.REGION_DENYRIDING.getStringList(); if(denyRiding.contains(vehicle.getType().name()) && RegionManager.get(vehicle) != null && (!plugin.getRegionManager().canInteract(player, vehicle) || (!nPlayer.getPreferences().getBypass() && !nPlayer.hasPermission(GuildPermission.MOB_RIDE))) && !PlayerManager.getPlayer(event.getEntered()).isVehicleListed(vehicle)) { event.setCancelled(true); Message.CHAT_REGION_DENY_RIDEMOB.send(event.getEntered()); } }
Example #3
Source File: EntityEventHandler.java From GriefDefender with MIT License | 5 votes |
@EventHandler(priority = EventPriority.LOWEST) public void onEntityMount(VehicleEnterEvent event) { if (!GDFlags.ENTITY_RIDING) { return; } final Entity source = event.getEntered(); final World world = source.getWorld(); if (!GriefDefenderPlugin.getInstance().claimsEnabledForWorld(world.getUID())) { return; } if (GriefDefenderPlugin.isSourceIdBlacklisted(Flags.ENTITY_RIDING.getName(), source, world.getUID())) { return; } if (GriefDefenderPlugin.isTargetIdBlacklisted(Flags.ENTITY_RIDING.getName(), event.getVehicle(), world.getUID())) { return; } GDTimings.ENTITY_MOUNT_EVENT.startTiming(); Player player = source instanceof Player ? (Player) source : null; if (player != null) { GDCauseStackManager.getInstance().pushCause(player); } final Location location = event.getVehicle().getLocation(); final GDClaim targetClaim = GriefDefenderPlugin.getInstance().dataStore.getClaimAt(location); if (GDPermissionManager.getInstance().getFinalPermission(event, location, targetClaim, Flags.ENTITY_RIDING, source, event.getVehicle(), player, TrustTypes.ACCESSOR, true) == Tristate.FALSE) { if (player != null) { PlayerUtil.getInstance().sendInteractEntityDenyMessage(targetClaim, player, null, event.getVehicle()); } event.setCancelled(true); } GDTimings.ENTITY_MOUNT_EVENT.stopTiming(); }
Example #4
Source File: PlayerEventListener.java From Hawk with GNU General Public License v3.0 | 5 votes |
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void vehicleEnter(VehicleEnterEvent e) { if(e.getEntered() instanceof Player) { HawkPlayer pp = hawk.getHawkPlayer((Player)e.getEntered()); pp.sendSimulatedAction(new Runnable() { @Override public void run() { pp.setInVehicle(true); } }); } }
Example #5
Source File: ExploitEvents.java From uSkyBlock with GNU General Public License v3.0 | 5 votes |
@EventHandler public void on(VehicleEnterEvent e) { if (mountEnabled || !(e.getEntered() instanceof Player) || !plugin.getWorldManager().isSkyAssociatedWorld(e.getVehicle().getWorld()) ) { return; } Player player = (Player) e.getEntered(); if (player.hasPermission("usb.mod.bypassprotection") || plugin.playerIsOnIsland(player)) { return; } e.setCancelled(true); player.sendMessage(tr("\u00a7eRiding is only allowed on your own island!")); }
Example #6
Source File: VehicleObjective.java From BetonQuest with GNU General Public License v3.0 | 5 votes |
@EventHandler(ignoreCancelled = true) public void onVehicleEnter(VehicleEnterEvent event) { if (!(event.getEntered() instanceof Player)) return; String playerID = PlayerConverter.getID((Player) event.getEntered()); if (containsPlayer(playerID) && (any || event.getVehicle().getType() == vehicle) && checkConditions(playerID)) { completeObjective(playerID); } }
Example #7
Source File: LivingEntityShopListener.java From Shopkeepers with GNU General Public License v3.0 | 5 votes |
@EventHandler(ignoreCancelled = true) void onEntityEnterVehicle(VehicleEnterEvent event) { Entity entity = event.getEntered(); if (plugin.isShopkeeper(entity)) { event.setCancelled(true); } }
Example #8
Source File: EventFilterMatchModule.java From PGM with GNU Affero General Public License v3.0 | 4 votes |
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onVehicleEnter(final VehicleEnterEvent event) { cancelUnlessInteracting(event, event.getEntered()); }
Example #9
Source File: FreezeMatchModule.java From PGM with GNU Affero General Public License v3.0 | 4 votes |
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onVehicleEnter(final VehicleEnterEvent event) { if (freeze.isFrozen(event.getEntered())) { event.setCancelled(true); } }
Example #10
Source File: EventFilterMatchModule.java From ProjectAres with GNU Affero General Public License v3.0 | 4 votes |
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onVehicleEnter(final VehicleEnterEvent event) { cancelUnlessInteracting(event, event.getEntered()); }
Example #11
Source File: FreezeListener.java From ProjectAres with GNU Affero General Public License v3.0 | 4 votes |
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onVehicleEnter(final VehicleEnterEvent event) { if(freeze.isFrozen(event.getEntered())) { event.setCancelled(true); } }
Example #12
Source File: ExprVehicle.java From Skript with GNU General Public License v3.0 | 4 votes |
@SuppressWarnings("unchecked") @Override public boolean setTime(final int time) { return super.setTime(time, getExpr(), VehicleEnterEvent.class, VehicleExitEvent.class); }
Example #13
Source File: ExprPassenger.java From Skript with GNU General Public License v3.0 | 4 votes |
@SuppressWarnings("unchecked") @Override public boolean setTime(final int time) { return super.setTime(time, vehicle, VehicleEnterEvent.class, VehicleExitEvent.class); }
Example #14
Source File: MultiplePassengersRestrict.java From ProtocolSupport with GNU Affero General Public License v3.0 | 4 votes |
@EventHandler(ignoreCancelled = true) public void onVehicleEnter(VehicleEnterEvent event) { if (!event.getVehicle().getPassengers().isEmpty() && needsRestrict()) { event.setCancelled(true); } }
Example #15
Source File: ObserverModule.java From CardinalPGM with MIT License | 4 votes |
@EventHandler public void onVehicleEnter(VehicleEnterEvent event) { if (event.getEntered() instanceof Player && testObserverOrDead((Player) event.getEntered())) { event.setCancelled(true); } }