Пример #1
0
  @EventHandler(priority = EventPriority.MONITOR)
  public void throwPlayer(PlayerInteractEvent event) {
    // Do nothing if player did not left click.
    Action action = event.getAction();
    if (action != LEFT_CLICK_AIR && action != LEFT_CLICK_BLOCK) return;

    // Do nothing if player does not have permission.
    Player player = event.getPlayer();
    if (!Perm.PLAYERSTACKER.has(player)) return;

    // Do nothing if player is not stacking.
    User user = plugin.getUser(player.getUniqueId());
    if (user != null && !user.isStacking()) return;

    // Do nothing if top passenger is the clicking player.
    Entity topPassenger = getTopPassenger(player);
    if (topPassenger == player) return;

    // Throw the top passenger.
    topPassenger.leaveVehicle();
    topPassenger.setVelocity(player.getLocation().getDirection().multiply(1.6D).setY(1.0D));
  }
Пример #2
0
 public boolean leaveVehicle() {
   return e.leaveVehicle();
 }