Example #1
0
 public static void fullReset(final Arena arena, final Player player) {
   playersetHealth(player, arena.getArenaConfig().getInt(CFG.PLAYER_HEALTH));
   player.setFireTicks(0);
   player.setFallDistance(0);
   player.setVelocity(new Vector());
   player.setFoodLevel(arena.getArenaConfig().getInt(CFG.PLAYER_FOODLEVEL));
   player.setSaturation(arena.getArenaConfig().getInt(CFG.PLAYER_SATURATION));
   player.setExhaustion((float) arena.getArenaConfig().getDouble(CFG.PLAYER_EXHAUSTION));
   player.setLevel(0);
   player.setExp(0);
   player.setGameMode(GameMode.getByValue(arena.getArenaConfig().getInt(CFG.GENERAL_GAMEMODE)));
   PlayerState.removeEffects(player);
 }
Example #2
0
  public static PlayerState undump(final YamlConfiguration cfg, final String pName) {
    debug.i("restoring backed up PlayerState of " + pName, pName);
    final PlayerState pState = new PlayerState(Bukkit.getPlayer(pName));

    pState.fireticks = cfg.getInt("state.fireticks", 0);
    pState.foodlevel = cfg.getInt("state.foodlevel", 0);
    pState.gamemode = cfg.getInt("state.gamemode", 0);
    pState.health = cfg.getInt("state.health", 1);
    pState.maxhealth = cfg.getInt("state.maxhealth", 20);
    pState.exhaustion = (float) cfg.getDouble("state.exhaustion", 1);
    pState.experience = (float) cfg.getDouble("state.experience", 0);
    pState.explevel = cfg.getInt("state.explevel", 0);
    pState.saturation = (float) cfg.getDouble("state.saturation", 0);
    pState.displayname = cfg.getString("state.displayname", pName);

    return pState;
  }