Ejemplo n.º 1
0
  public void func_150873_a(EntityPlayer p_150873_1_, StatBase p_150873_2_, int p_150873_3_) {
    int var4 = p_150873_2_.isAchievement() ? this.writeStat(p_150873_2_) : 0;
    super.func_150873_a(p_150873_1_, p_150873_2_, p_150873_3_);
    this.field_150888_e.add(p_150873_2_);

    if (p_150873_2_.isAchievement() && var4 == 0 && p_150873_3_ > 0) {
      this.field_150886_g = true;

      if (this.field_150890_c.isAnnouncingPlayerAchievements()) {
        this.field_150890_c
            .getConfigurationManager()
            .sendChatMsg(
                new ChatComponentTranslation(
                    "chat.type.achievement",
                    new Object[] {p_150873_1_.getDisplayName(), p_150873_2_.func_150955_j()}));
      }
    }

    if (p_150873_2_.isAchievement() && var4 > 0 && p_150873_3_ == 0) {
      this.field_150886_g = true;

      if (this.field_150890_c.isAnnouncingPlayerAchievements()) {
        this.field_150890_c
            .getConfigurationManager()
            .sendChatMsg(
                new ChatComponentTranslation(
                    "chat.type.achievement.taken",
                    new Object[] {p_150873_1_.getDisplayName(), p_150873_2_.func_150955_j()}));
      }
    }
  }
Ejemplo n.º 2
0
  public Map func_150881_a(String p_150881_1_) {
    JsonElement var2 = (new JsonParser()).parse(p_150881_1_);

    if (!var2.isJsonObject()) {
      return Maps.newHashMap();
    } else {
      JsonObject var3 = var2.getAsJsonObject();
      HashMap var4 = Maps.newHashMap();
      Iterator var5 = var3.entrySet().iterator();

      while (var5.hasNext()) {
        Entry var6 = (Entry) var5.next();
        StatBase var7 = StatList.getOneShotStat((String) var6.getKey());

        if (var7 != null) {
          TupleIntJsonSerializable var8 = new TupleIntJsonSerializable();

          if (((JsonElement) var6.getValue()).isJsonPrimitive()
              && ((JsonElement) var6.getValue()).getAsJsonPrimitive().isNumber()) {
            var8.setIntegerValue(((JsonElement) var6.getValue()).getAsInt());
          } else if (((JsonElement) var6.getValue()).isJsonObject()) {
            JsonObject var9 = ((JsonElement) var6.getValue()).getAsJsonObject();

            if (var9.has("value")
                && var9.get("value").isJsonPrimitive()
                && var9.get("value").getAsJsonPrimitive().isNumber()) {
              var8.setIntegerValue(var9.getAsJsonPrimitive("value").getAsInt());
            }

            if (var9.has("progress") && var7.func_150954_l() != null) {
              try {
                Constructor var10 = var7.func_150954_l().getConstructor(new Class[0]);
                IJsonSerializable var11 = (IJsonSerializable) var10.newInstance(new Object[0]);
                var11.func_152753_a(var9.get("progress"));
                var8.setJsonSerializableValue(var11);
              } catch (Throwable var12) {
                logger.warn("Invalid statistic progress in " + this.field_150887_d, var12);
              }
            }
          }

          var4.put(var7, var8);
        } else {
          logger.warn(
              "Invalid statistic in "
                  + this.field_150887_d
                  + ": Don\'t know what "
                  + (String) var6.getKey()
                  + " is");
        }
      }

      return var4;
    }
  }