protected void checkWorldNameAfterChange() {
   String newText = worldNameText.getText().toString();
   if (!newText.equals(EditorActivity.level.getLevelName())) {
     EditorActivity.level.setLevelName(newText);
     EditorActivity.save(this);
   }
 }
 private void warpPlayerToSpawn() {
   Vector3f loc = EditorActivity.level.getPlayer().getLocation();
   Level level = EditorActivity.level;
   loc.setX(level.getSpawnX());
   loc.setY(level.getSpawnY());
   loc.setZ(level.getSpawnZ());
   EditorActivity.save(this);
   updatePlayerPositionText();
 }
 public void checkStopTimeInputAfterChange() {
   long newTime = 0;
   try {
     newTime = Long.parseLong(dayCycleStopTimeText.getText().toString());
     dayCycleStopTimeText.setError(null);
     if (newTime != EditorActivity.level.getDayCycleStopTime()) {
       EditorActivity.level.setDayCycleStopTime(newTime);
       EditorActivity.save(this);
     }
   } catch (NumberFormatException e) {
     dayCycleStopTimeText.setError(this.getResources().getText(R.string.invalid_number));
   }
 }
 public void checkHealthInputAfterChange() {
   short newHealth = 0;
   try {
     newHealth = Short.parseShort(healthText.getText().toString());
     healthText.setError(null);
     if (newHealth != EditorActivity.level.getPlayer().getHealth()) {
       EditorActivity.level.getPlayer().setHealth(newHealth);
       EditorActivity.save(this);
     }
   } catch (NumberFormatException e) {
     healthText.setError(this.getResources().getText(R.string.invalid_number));
   }
 }
 public void onClick(View v) {
   if (v == gameModeChangeButton) {
     showDialog(DIALOG_CHANGE_GAME_MODE);
   } else if (v == spawnToPlayerButton) {
     setSpawnToPlayerPosition();
     EditorActivity.save(this);
   } else if (v == timeToMorningButton) {
     setTimeToMorning();
     updateTimeText();
   } else if (v == timeToNightButton) {
     setTimeToNight();
     updateTimeText();
   } else if (v == fullHealthButton) {
     setPlayerHealthToFull();
   } else if (v == infiniteHealthButton) {
     setPlayerHealthToInfinite();
   } else if (v == warpToSpawnButton) {
     warpPlayerToSpawn();
   } else if (v == sidewaysOnButton) {
     playerSideways(true);
   } else if (v == sidewaysOffButton) {
     playerSideways(false);
   } else if (v == movePlayerButton) {
     showDialog(DIALOG_MOVE_PLAYER);
   } else if (v == flyingBox) {
     Player player = EditorActivity.level.getPlayer();
     player.getAbilities().flying = flyingBox.isChecked();
     EditorActivity.save(this);
   } else if (v == invulnerableBox) {
     Player player = EditorActivity.level.getPlayer();
     player.getAbilities().invulnerable = invulnerableBox.isChecked();
     EditorActivity.save(this);
   } else if (v == instaBuildBox) {
     Player player = EditorActivity.level.getPlayer();
     player.getAbilities().instabuild = instaBuildBox.isChecked();
     EditorActivity.save(this);
   } else if (v == mayFlyBox) {
     Player player = EditorActivity.level.getPlayer();
     player.getAbilities().mayFly = mayFlyBox.isChecked();
     EditorActivity.save(this);
   } else if (v == spawnMobsBox) {
     EditorActivity.level.setSpawnMobs(instaBuildBox.isChecked());
     EditorActivity.save(this);
   }
 }
 private void playerSideways(boolean doThis) {
   EditorActivity.level.getPlayer().setDeathTime(doThis ? Short.MAX_VALUE : 0);
   EditorActivity.save(this);
 }
 private void setPlayerHealthToInfinite() {
   EditorActivity.level.getPlayer().setHealth(Short.MAX_VALUE);
   EditorActivity.save(this);
   updatePlayerHealthText();
 }
 private void setPlayerHealthToFull() {
   EditorActivity.level.getPlayer().setHealth((short) 20);
   EditorActivity.save(this);
   updatePlayerHealthText();
 }
 private void setTimeToNight() {
   EditorActivity.level.setTime(
       ((EditorActivity.level.getTime() / DAY_LENGTH) * DAY_LENGTH) + (DAY_LENGTH / 2));
   EditorActivity.save(this);
 }
 private void setTimeToMorning() {
   EditorActivity.level.setTime((EditorActivity.level.getTime() / DAY_LENGTH) * DAY_LENGTH);
   EditorActivity.save(this);
 }