@@ -3847,7 +3847,6 @@ public CHVersion since() {
38473847 }
38483848
38493849 @ api (environments = {CommandHelperEnvironment .class })
3850- @ hide ("TODO: I'm not sure why this is hidden." )
38513850 public static class pvelocity extends AbstractFunction {
38523851
38533852 @ Override
@@ -3885,21 +3884,20 @@ public Boolean runAsync() {
38853884
38863885 @ Override
38873886 public Construct exec (Target t , Environment environment , Construct ... args ) throws ConfigRuntimeException {
3888- MCPlayer p = environment . getEnv ( CommandHelperEnvironment . class ). GetPlayer () ;
3887+ MCPlayer p ;
38893888 if (args .length == 1 ) {
38903889 p = Static .GetPlayer (args [0 ], t );
3890+ } else {
3891+ p = environment .getEnv (CommandHelperEnvironment .class ).GetPlayer ();
3892+ Static .AssertPlayerNonNull (p , t );
38913893 }
3892- Static .AssertPlayerNonNull (p , t );
3893- CArray vector = CArray .GetAssociativeArray (t );
38943894 Vector3D velocity = p .getVelocity ();
38953895 if (velocity == null ) {
38963896 throw new CRENotFoundException (
38973897 "The players velocity could not be found (Are you running in cmdline mode?)" , t );
38983898 }
3899+ CArray vector = ObjectGenerator .GetGenerator ().vector (velocity , t );
38993900 vector .set ("magnitude" , new CDouble (velocity .length (), t ), t );
3900- vector .set ("x" , new CDouble (velocity .X (), t ), t );
3901- vector .set ("y" , new CDouble (velocity .Y (), t ), t );
3902- vector .set ("z" , new CDouble (velocity .Z (), t ), t );
39033901 return vector ;
39043902 }
39053903
0 commit comments