Hi, I am trying to "freeze" boat by seting speed of the boat to 0, but for some reason the function in bukkit does not work. My code: Code:java Entity e = event.getVehicle(); Boat boat = (Boat)e; p.sendMessage("" + boat.getMaxSpeed()); boat.setMaxSpeed(0.0); p.sendMessage("" + boat.getMaxSpeed()); The debug messages are saying: 0.4 0.4 So the speed of the boat is not changed after boat.setMaxSpeed(0.0); Can someone tell me what I am doing wrong or it is just simply broken in bukkit ?
Welite You might want to try this: Code:java @EventHandlerpublic void onVehicleDrive(VehicleMoveEvent event){Entity vehicle = event.getVehicle();Entity passenger = event.getVehicle().getPassenger();if (vehicle instanceof Boat){if(passenger instanceof Player){Boat boat = (Boat) vehicle;Player player = (Player)passenger;double newMaxSpeed = 0;player.sendMessage("" + boat.getMaxSpeed());boat.setMaxSpeed(newMaxSpeed);player.sendMessage("" + boat.getMaxSpeed());}}} Never worked with this, so idk. Just something what I think that might work. EDIT: Change the event to whatever event you used I do not know which one that was as you did not show it.
Hi, thanks for you message, but it seems like it does not work. I have exactly this code: Code:java @EventHandler public void onVehicleCreate(VehicleCreateEvent event) { for (Player p : Bukkit.getOnlinePlayers()) { if (temp.getString("List.queue").contains(p.getName())) { Entity e = event.getVehicle(); if (e instanceof Boat){ temp.set("List.queue", temp.getString("List.queue").replace(p.getName(), " ")); event.getVehicle().setPassenger(p); event.getVehicle().getUniqueId(); String uuids = temp.getString("Arenas." + getArena(p) + ".UUID"); String newuuids = uuids + " " + event.getVehicle().getUniqueId(); temp.set("Arenas." + getArena(p) + ".UUID", newuuids); saveall(); Boat boat = (Boat)e; p.sendMessage("" + boat.getMaxSpeed()); boat.setMaxSpeed(0.0); p.sendMessage("" + boat.getMaxSpeed()); } } } } And the output is: 0.4 0.4 So it seems like the " boat.setMaxSpeed(0.0);" is totally ignored. Also it is not possible to cancel VehicleMoveEvent so how can I stop for a while moving boat with player and then let him move again ? EDIT by Moderator: merged posts, please use the edit button instead of double posting.