How can I change the block walkspeed for a specific block like dirt and not for all blocks? Probably a double walkspeed for dirt? Thanks for help
F4BSE You could use the PlayerMoveEvent and check if (player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.DIRT) and then multiply the player's velocity. That's how you would do that!
Thanks. Like this? Code: @EventHandler public void onPlayerMove(PlayerMoveEvent player) { boolean doMultiply = false; Block below = player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.DIRT; MaterialBlock mb = (MaterialBlock) below; if (doMultiply) { mb.setAirSpeedMultiplier(4); mb.setWalkingMultiplier(4); mb.setJumpingMultiplier(1.50); } else { mb.setAirSpeedMultiplier(1); mb.setWalkingMultiplier(1); mb.setJumpingMultiplier(1); } }
you don't want to multiply the velocity vector ;3. Imagine a long strip of dirt . Code: player.setWalkSpeed(0.2); //0.2 is the normal speed // Like, 0.4 is the double. 0.8 is still doable
Plz give me an example . I'm not good in java. I'm learning it. Is this right? Code: @EventHandler public void onPlayerMove(PlayerMoveEvent event) { boolean doMultiply = false; Block below = event.getPlayer().setVelocity(event.getPlayer().getVelocity().multiply(2.0D)); BlockDirt bd = (BlockDirt) below; if (doMultiply) { bd.setAirSpeedMultiplier(0.2); bd.setWalkSpeedMultiplier(0.2); bd.setJumpingMultiplier(0.2); } else { bd.setAirSpeedMultiplier(0.1); bd.setWalkingMultiplier(0.1); bd.setJumpingMultiplier(0.1); } } I get a lot of Issues. Whats my fault? :/ EDIT by Moderator: merged posts, please use the edit button instead of double posting.