Source:
public String playerHeight(@Sender EntityRef client, @CommandParam("height") float amount) { try { ClientComponent clientComp = client.getComponent(ClientComponent.class); CharacterMovementComponent move = clientComp.character.getComponent(CharacterMovementComponent.class); CharacterComponent charComp=clientComp.character.getComponent(CharacterComponent.class); EntityRef player = client.getComponent(ClientComponent.class).character; GazeMountPointComponent gazeMountPointComponent = player.getComponent(GazeMountPointComponent.class); float ratio = amount / 1.6f; float constant= function1(amount); if (move != null && gazeMountPointComponent != null) { float prevHeight = move.height; move.height = amount; gazeMountPointComponent.translate.y = amount; move.jumpSpeed = 12 * constant; move.stepHeight = 0.35f * ratio; move.distanceBetweenFootsteps = ratio; move.runFactor = function2(amount); charComp.interactionRange = 5 * constant; Location.removeChild(player, gazeMountPointComponent.gazeEntity); Location.attachChild(player, gazeMountPointComponent.gazeEntity, gazeMountPointComponent.translate, new Quat4f(Quat4f.IDENTITY)); player.saveComponent(gazeMountPointComponent); clientComp.character.saveComponent(move); return "Height of player set to " + amount + " (was " + prevHeight + ")"; } return ""; } catch (NullPointerException e) { e.printStackTrace(); return ""; } }

Target:
public String playerHeight(@Sender EntityRef client, @CommandParam("height") float amount) { if (amount >= 1 && amount <= 25) { try { ClientComponent clientComp = client.getComponent(ClientComponent.class); CharacterMovementComponent move = clientComp.character.getComponent(CharacterMovementComponent.class); CharacterComponent charComp = clientComp.character.getComponent(CharacterComponent.class); EntityRef player = clientComp.character; GazeMountPointComponent gazeMountPointComponent = player.getComponent(GazeMountPointComponent.class); Prefab playerDefaults = Assets.getPrefab("engine:player").get(); CharacterMovementComponent moveDefault = playerDefaults.getComponent(CharacterMovementComponent.class); CharacterComponent characterDefault = playerDefaults.getComponent(CharacterComponent.class); if (move != null && gazeMountPointComponent != null) { float prevHeight = move.height; float defaultEyeHeight = config.getPlayer().getEyeHeight(); float foreHeadSize = moveDefault.height - defaultEyeHeight; float ratio = amount / moveDefault.height; move.height = amount; move.jumpSpeed = getJumpSpeed(ratio, moveDefault.jumpSpeed); move.stepHeight = ratio * moveDefault.stepHeight; move.distanceBetweenFootsteps = ratio * moveDefault.distanceBetweenFootsteps; move.runFactor = getRunFactor(ratio, moveDefault.runFactor); charComp.interactionRange = getInteractionRange(ratio, characterDefault.interactionRange); gazeMountPointComponent.translate.y = amount - foreHeadSize; Location.removeChild(player, gazeMountPointComponent.gazeEntity); Location.attachChild(player, gazeMountPointComponent.gazeEntity, gazeMountPointComponent.translate, new Quat4f(Quat4f.IDENTITY)); player.saveComponent(gazeMountPointComponent); clientComp.character.saveComponent(move); return "Height of player set to " + amount + " (was " + prevHeight + ")"; } return ""; } catch (NullPointerException e) { e.printStackTrace(); return ""; } } else { return "Invalid input. Accepted values: [1 to 25]"; } }