sorry for asking alot of questions, im trying to get into new parts of bukkit. What do i need to do in order to get the speed of the minecart. I tried to do this. Code: public void onVehicleEntityCollision(VehicleEntityCollisionEvent event){ Entity entity = event.getEntity(); Vehicle vehicle = event.getVehicle(); if(entity instanceof Player){ Player player = (Player)entity; if (vehicle instanceof Minecart && (vehicle.getVelocity().equals(10))); player.damage(1); } } } i tried to see if the velocity equals 10. But the player gets damaged even when the minecart is standing still.
Velocity is a vector, and can't be compared to an integer. You first have to get it's length: Code: if (vehicle instanceof Minecart && vehicle.getVelocity().length() >= 10) player.damage(1); }
Your problem is actually that you have a semicolon at the end of the if statement, so the line below it is actually not part of the if statement at all, but outside and after it.