hello, i have a problem with setting pitch of player. code: Code: if(commandLabel.equalsIgnoreCase("pitch")) { p.getLocation().setPitch(2); p.sendMessage("You've changed your pitch!"); } it does nothing except send the message. please help thank you.
StickyMan Try changing it from Code: p.getLocation().setPitch(2); To Code: Location pitch = p.getLocation(); pitch.setPitch(2);
StickyMan Then you can't set a pitch …. if you don't mind me asking why are you trying to set pitch ?
player.getLocation() (actually getLocation() for any entity) returns a copy of the player's location, not the actual location object. So just changing the pitch of the object you get won't affect the player. You need to follow up with a player.setLocation(pitch);
getLocation() returns an Location Object. If you change this it will never affect the player. Use this: Code: if(commandLabel.equalsIgnoreCase("pitch")) { p.teleport(p.getLocation().setPitch(2)); p.sendMessage("You've changed your pitch!"); }
Yeah, sorry; use player.teleport(pitch) - that should work fine. PHP: Location pitch = p.getLocation();pitch.setPitch(2);p.teleport(pitch);
Than you can rename an variable. p should be the Player who used this command Btw it would be better if you say WHAT shall be renamed
Oneric-1st http://gyazo.com/0027af9eedb9f6f34c0136774f8a60cb what is the f? (in yellow in the picture)
StickyMan Pitch and yaw are in angles, that value is a number representing N/S/E/W, the number in the paranthesis is what you need, -178, which you need to use on yaw, not pitch.
The '2' there is just the major compass direction the player is facing - it ranges from 0..3 for the four compass points. The -178.75244 is the player's yaw, -180 being due north. The player's pitch (up/down facing) is not shown at all by F3. StickyMan if you're getting errors, we need to see your full code. You clearly have a syntax error in your code somewhere.