@EventHandler public void onMountPet(VehicleEnterEvent event) { if (event.getEntered().getType() != EntityType.PLAYER || event.getVehicle().getType() != EntityType.HORSE) { return; } Player player = (Player) event.getEntered(); if (!InventoryManager.playerIsLoaded(player)) { return; } Horse vehicle = (Horse) event.getVehicle(); if (PetManager.getPetFromEntity(vehicle, player) != null && player != vehicle.getOwner()) { PlayerUtils.sendMessage(player, RPGInventory.getLanguage().getMessage("error.mount.owner", vehicle.getOwner().getName())); event.setCancelled(true); } }
@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 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()); } }
@EventHandler(priority = EventPriority.HIGH) public void onVehicleEnter(VehicleEnterEvent event) { if (!(event.getEntered() instanceof Player)) { return; } Player player = (Player) event.getEntered(); if (this.manager.isHorse(event.getVehicle())) { Horse horse = (Horse) event.getVehicle(); if (this.manager.isOwned(horse.getUniqueId())) { if (!this.manager.canMountHorse(player, horse) && !perm.has(player, "horsekeep.bypass.mount")) { String ownerName = this.manager.getOwnerName(horse.getUniqueId()); if (ownerName == null) ownerName = "Unknown"; player.sendMessage(this.getChatPrefix() + this.lang.get("horseBelongsTo").replace("%player", ownerName)); event.setCancelled(true); } } } }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onVehicleEnter(final VehicleEnterEvent event) { if (event.getEntered() instanceof Player) { VehicleEnter action = this.newAction(VehicleEnter.class, event.getEntered().getWorld()); if (action != null) { action.setVehicle(event.getVehicle()); action.setLocation(event.getVehicle().getLocation()); action.setPlayer((Player)event.getEntered()); this.logAction(action); } } else { // TODO entity vehicle enter } }
/** * We keep track of players entering and exiting vehicles. * * @param event * the entrance event */ @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void vehicleEnterEvent(VehicleEnterEvent event) { if (event.getEntered() != null && event.getVehicle() != null && event.getEntered() instanceof Player) { Player eventPlayer = (Player) event.getEntered(); vehicleSince.computeIfAbsent(eventPlayer.getUniqueId(), u -> { //if (eventPlayer.hasPermission("addgun.data")) {eventPlayer.sendMessage(ChatColor.GOLD + " entered vehicle"); } return System.currentTimeMillis(); }); vehicleLeft.remove(eventPlayer.getUniqueId()); } }
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) public void onVehicleEnter(VehicleEnterEvent event) { Entity entered = event.getEntered(); if (entered instanceof Player) { Vehicle vehicle = event.getVehicle(); if (vehicle instanceof Horse) { Horse horse = (Horse) event.getVehicle(); AnimalTamer owner = horse.getOwner(); if (owner != null && !owner.equals(entered)) { ((Player) entered).sendMessage(ChatColor.YELLOW + "You cannot ride a Horse that belongs to " + ChatColor.RED + owner.getName() + ChatColor.YELLOW + '.'); event.setCancelled(true); } } } }
@EventHandler public void onVehicleEnter(VehicleEnterEvent event) { if (event.getEntered() instanceof Player) { Player player = (Player) event.getEntered(); if (isPlayerSpectator(player)) { event.setCancelled(true); } } }
/** * Prevents a player that can't interact from entering vehicles. * * @param event The event. */ @EventHandler(ignoreCancelled = true) public void onVehicleEnter(VehicleEnterEvent event) { if (event.getActor() instanceof Player && !canInteract((Player) event.getActor())) { event.setCancelled(true); } }
@EventHandler public void on(VehicleEnterEvent e) { if (mountEnabled || !(e.getEntered() instanceof Player)) { return; } Player player = (Player) e.getEntered(); if (hasPermission(player, "usb.mod.bypassprotection") || plugin.playerIsOnIsland(player)) { return; } e.setCancelled(true); player.sendMessage(tr("\u00a7eRiding is only allowed on your own island!")); }
@EventHandler(ignoreCancelled = true) public void onVehicleEnter(VehicleEnterEvent event) { if (event.getEntered() instanceof Player) { getBackend().logEnterExit((Player) event.getEntered()); } AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners()); }
@EventHandler 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); } }
@EventHandler public void VehicleEnter(final VehicleEnterEvent event) { if (!(event.getVehicle().getPassenger() instanceof Player)) return; final Player player = (Player) event.getVehicle().getPassenger(); if (plugin.isLoggedIn(player)) return; event.setCancelled(true); plugin.sendAuthReminderMessage(player); }
@EventHandler public void onVehicleEnter(VehicleEnterEvent event) { Player player = (Player) event.getEntered(); if (player.getVehicle() instanceof Horse) { player.getVehicle().remove(); msgPlayer(player, "Automatically dismounted due to vehicle change."); } }
/** * Stops spectators riding horses, Minecarts, etc. */ @EventHandler (priority = EventPriority.HIGHEST) public void onVehicleEnter(final VehicleEnterEvent e) { if (e.getEntered() instanceof Player && p.getPlayerData((Player) e.getEntered()).isSpectating()) { e.setCancelled(true); } }
@EventHandler(ignoreCancelled = true) void onEntityEnterVehicle(VehicleEnterEvent event) { Entity entity = event.getEntered(); if (plugin.isShopkeeper(entity)) { event.setCancelled(true); } }
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onVehicleEnter(final VehicleEnterEvent event) { cancelUnlessInteracting(event, event.getEntered()); }
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onVehicleEnter(final VehicleEnterEvent event) { if(freeze.isFrozen(event.getEntered())) { event.setCancelled(true); } }
@EventHandler public void onVehicleEnter(VehicleEnterEvent e) { if (e.getEntered() instanceof Player && SkyWarsReloaded.getPC().getPlayer(((Player) e.getEntered()).getUniqueId()).isSpectating()) { e.setCancelled(true); } }
@EventHandler public void onVehicleEnter(VehicleEnterEvent event) { if (event.getEntered() instanceof Player && isObserver((Player) event.getEntered())) { event.setCancelled(true); } }
@SuppressWarnings("unchecked") @Override public boolean setTime(final int time) { return super.setTime(time, getExpr(), VehicleEnterEvent.class, VehicleExitEvent.class); }
@EventHandler public void onVehicleEnter(VehicleEnterEvent event) { if (event.getEntered() instanceof Player) { this.manager.invoke((Player) event.getEntered(), event); } }
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onVehicleEnter(VehicleEnterEvent event) { if (this.isObserving(event.getEntered())) { event.setCancelled(true); } }
@EventHandler public void onVehicleEnter(VehicleEnterEvent event) { if (!match.isRunning() || event.getEntered() instanceof Player && TeamUtils.getTeamByPlayer((Player) event.getEntered()).isObserver()) { event.setCancelled(true); } }
@EventHandler(ignoreCancelled = true) public void onMount(VehicleEnterEvent event) { if (event.getEntered() instanceof Player) { Player p = (Player) event.getEntered(); MoveData md = nh.vars.getMoveData(p.getName()); md.lastmounting = System.currentTimeMillis(); nh.vars.setMoveData(p.getName(), md); } }
@EventHandler(ignoreCancelled = true) public void onVehicleEnter(VehicleEnterEvent event) { if (!event.getVehicle().getPassengers().isEmpty() && needsRestrict()) { event.setCancelled(true); } }
@EventHandler public void onVehicleEnter(final VehicleEnterEvent event) { if (!(event.getEntered() instanceof Player)) { return; } if (!this.canInteract(event.getVehicle(), (Player)event.getEntered())) { event.setCancelled(true); } }
@EventHandler public void onVehicleEnter(VehicleEnterEvent event) { if (event.getEntered() instanceof Player && testObserverOrDead((Player) event.getEntered())) { event.setCancelled(true); } }
@EventHandler public void horseEnter(VehicleEnterEvent event){ if(event.getVehicle() instanceof Horse){ EntityType entered = (EntityType)event.getEntered().getType(); if(entered == EntityType.PLAYER){ //Playercheck Player p = (Player)event.getEntered(); String playername = p.getName(); @SuppressWarnings("unused") Server server = p.getServer(); //Not used for now Horse h = (Horse)event.getVehicle(); AnimalTamer owner = h.getOwner(); HashMap<String, ArrayList<Block>> map = ECHorses.hashmap; //Getting hashmap from main class if(map.containsKey(playername)){ //If player has done /horseunclaim, then when the player left click the horse, unclaim the horse. if(owner == null){ p.sendMessage(ChatColor.AQUA + "[ECHorses]" + ChatColor.GREEN + " Nobody owns this horse!"); return; } if(!(owner == null)){ if(p.isOp() || p.hasPermission("echorse.override")){ p.sendMessage("You are overriding horse protection!"); h.setOwner(null); //Removing horse claim (untame horse) map.remove(playername); //Remove the player from hashmap. return; } if(h.getOwner().getName() == p.getName()){ //Owner check Location loc = h.getLocation().clone(); Inventory inv = h.getInventory(); for (ItemStack item : inv.getContents()){ //Checking if the horse has saddle & armor & or something its inventory (Donkey) if(item!= null){ loc.getWorld().dropItemNaturally(loc, item.clone()); //Drops all the inventory contents on the horse location ground. } } inv.clear(); //Clears the inventory of the horse. if(h.isCarryingChest()){ //If the horse is carrying a chest (Donkey) h.setCarryingChest(false); //if true then remove the chest. } h.setOwner(null); //Remove horse claim (untame horse.) p.sendMessage(ChatColor.AQUA + "[ECHorses]" + ChatColor.GOLD + " Successfully removed horse protection. (Horse is not tamed anymore)"); map.remove(playername); //Remove the player from hashmap. event.setCancelled(true); return; } } } //Horse stealing protection (Entering the horse) if(!(owner == null)){ if(p.isOp() || p.hasPermission("echorse.override")){ //Overriding the protection if player is OP return; } if(h.getOwner().getName() == p.getName()){ //Checking if entering player is the owner return; } else { p.sendMessage(ChatColor.AQUA + "[ECHorses]" + ChatColor.RED + " This horse is owned by " + h.getOwner().getName()); Bukkit.getLogger().info("[ECHorses] " + playername + " tried entering someone elses horse"); event.setCancelled(true); return; } } p.sendMessage(ChatColor.AQUA + "[ECHorses]" + ChatColor.GREEN + " This horse is untamed!"); } } }
@EventHandler(ignoreCancelled=true) public final void onVehicleEnter(VehicleEnterEvent event) { fixCart(event.getVehicle()); }