@Override
  public int onVehicleDamageStatusUpdate(int vehicleId, int playerId) {
    try {
      IVehicle vehicle = sampObjectPool.getVehicle(vehicleId);
      IPlayer player = sampObjectPool.getPlayer(playerId);

      // SampNativeFunction.getVehicleDamageStatus(vehicleid, vehicle.damage);

      VehicleUpdateDamageEvent event = new VehicleUpdateDamageEvent(vehicle, player);

      if (player instanceof Player && vehicle instanceof Vehicle) {
        eventManager.dispatchEvent(event, vehicle, player);
      } else if (player instanceof Player) {
        eventManager.dispatchEvent(event, player);
      } else if (vehicle instanceof Vehicle) {
        eventManager.dispatchEvent(event, vehicle);
      }

      // player.on();
      // player.event.dispatchEvent( new Player(player) );

      return 1;
    } catch (Exception e) {
      e.printStackTrace();
      return 0;
    }
  }
  @Override
  public int onVehicleMod(int playerId, int vehicleId, int componentId) {
    try {
      IPlayer player = sampObjectPool.getPlayer(playerId);
      IVehicle vehicle = sampObjectPool.getVehicle(vehicleId);

      VehicleModEvent event = new VehicleModEvent(vehicle, componentId);

      if (vehicle instanceof Vehicle) {
        Vehicle veh = (Vehicle) vehicle;
        veh.processVehicleMod();
      }

      if (player instanceof Player && vehicle instanceof Vehicle) {
        eventManager.dispatchEvent(event, vehicle, player);
      } else if (player instanceof Player) {
        eventManager.dispatchEvent(event, player);
      } else if (vehicle instanceof Vehicle) {
        eventManager.dispatchEvent(event, vehicle);
      }

      return 1;
    } catch (Exception e) {
      e.printStackTrace();
      return 0;
    }
  }
  @Override
  public int onVehicleSpawn(int vehicleId) {
    try {
      IVehicle vehicle = sampObjectPool.getVehicle(vehicleId);

      if (vehicle instanceof Vehicle) {
        VehicleSpawnEvent event = new VehicleSpawnEvent(vehicle);
        eventManager.dispatchEvent(event, vehicle);
      }

      return 1;
    } catch (Exception e) {
      e.printStackTrace();
      return 0;
    }
  }
  @Override
  public int onVehicleStreamOut(int vehicleId, int forPlayerId) {
    try {
      IVehicle vehicle = sampObjectPool.getVehicle(vehicleId);
      IPlayer player = sampObjectPool.getPlayer(forPlayerId);

      VehicleStreamOutEvent event = new VehicleStreamOutEvent(vehicle, player);

      if (player instanceof Player && vehicle instanceof Vehicle) {
        eventManager.dispatchEvent(event, vehicle, player);
      } else if (player instanceof Player) {
        eventManager.dispatchEvent(event, player);
      } else if (vehicle instanceof Vehicle) {
        eventManager.dispatchEvent(event, vehicle);
      }

      return 1;
    } catch (Exception e) {
      e.printStackTrace();
      return 0;
    }
  }
  @Override
  public int onVehicleRespray(int playerId, int vehicleId, int color1, int color2) {
    try {
      IPlayer player = sampObjectPool.getPlayer(playerId);
      IVehicle vehicle = sampObjectPool.getVehicle(vehicleId);

      VehicleResprayEvent event = new VehicleResprayEvent(vehicle, color1, color2);

      if (player instanceof Player && vehicle instanceof Vehicle) {
        eventManager.dispatchEvent(event, vehicle, player);
      } else if (player instanceof Player) {
        eventManager.dispatchEvent(event, player);
      } else if (vehicle instanceof Vehicle) {
        eventManager.dispatchEvent(event, vehicle);
      }

      return 1;
    } catch (Exception e) {
      e.printStackTrace();
      return 0;
    }
  }
  @Override
  public int onPlayerEnterVehicle(int playerId, int vehicleId, int isPassenger) {
    try {
      IPlayer player = sampObjectPool.getPlayer(playerId);
      IVehicle vehicle = sampObjectPool.getVehicle(vehicleId);

      VehicleEnterEvent event = new VehicleEnterEvent(vehicle, player, isPassenger != 0);

      if (player instanceof Player && vehicle instanceof Vehicle) {
        eventManager.dispatchEvent(event, vehicle, player);
      } else if (player instanceof Player) {
        eventManager.dispatchEvent(event, player);
      } else if (vehicle instanceof Vehicle) {
        eventManager.dispatchEvent(event, vehicle);
      }

      return 1;
    } catch (Exception e) {
      e.printStackTrace();
      return 0;
    }
  }
  @Override
  public int onVehicleDeath(int vehicleId, int killerId) {
    try {
      IVehicle vehicle = sampObjectPool.getVehicle(vehicleId);
      IPlayer killer = sampObjectPool.getPlayer(killerId);

      VehicleDeathEvent event = new VehicleDeathEvent(vehicle, killer);

      if (vehicle instanceof Vehicle && killer instanceof Player) {
        eventManager.dispatchEvent(event, vehicle, killer);
      } else if (vehicle instanceof Vehicle) {
        eventManager.dispatchEvent(event, vehicle);
      } else if (killer instanceof Player) {
        eventManager.dispatchEvent(event, killer);
      }

      return 1;
    } catch (Exception e) {
      e.printStackTrace();
      return 0;
    }
  }
  @Override
  public int onUnoccupiedVehicleUpdate(int vehicleId, int playerId, int passengerSeat) {

    try {
      IVehicle vehicle = sampObjectPool.getVehicle(vehicleId);
      IPlayer player = sampObjectPool.getPlayer(playerId);

      VehicleUnoccupiedUpdateEvent event =
          new VehicleUnoccupiedUpdateEvent(vehicle, player, passengerSeat);

      if (player instanceof Player && vehicle instanceof Vehicle) {
        eventManager.dispatchEvent(event, vehicle, player);
      } else if (player instanceof Player) {
        eventManager.dispatchEvent(event, player);
      } else if (vehicle instanceof Vehicle) {
        eventManager.dispatchEvent(event, vehicle);
      }

      return 1;
    } catch (Exception e) {
      e.printStackTrace();
      return 0;
    }
  }