Skip to content

Commit

Permalink
add statistic key constructors that do not accept a StorageType (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gegy committed Jan 16, 2022
1 parent af36c78 commit ec5dc92
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/main/java/xyz/nucleoid/plasmid/game/stats/StatisticKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,66 @@ public String getTranslationKey() {
return Util.createTranslationKey("statistic", this.id);
}

public static StatisticKey<Integer> intKey(Identifier id) {
return new StatisticKey<>(id, ValueType.INT, StorageType.TOTAL, false);
}

public static StatisticKey<Float> floatKey(Identifier id) {
return new StatisticKey<>(id, ValueType.FLOAT, StorageType.TOTAL, false);
}

public static StatisticKey<Double> doubleKey(Identifier id) {
return new StatisticKey<>(id, ValueType.FLOAT, StorageType.TOTAL, false);
}

public StatisticKey<T> hidden(boolean hidden) {
return new StatisticKey<>(this.id, this.valueType, this.storageType, hidden);
}

/**
* @deprecated {@link StorageType} is not used, instead use {@link StatisticKey#intKey(Identifier)}
*/
@Deprecated
public static StatisticKey<Integer> intKey(Identifier id, StorageType storageType) {
return new StatisticKey<>(id, ValueType.INT, storageType, false);
}

/**
* @deprecated {@link StorageType} is not used, instead use {@link StatisticKey#floatKey(Identifier)}
*/
@Deprecated
public static StatisticKey<Float> floatKey(Identifier id, StorageType storageType) {
return new StatisticKey<>(id, ValueType.FLOAT, storageType, false);
}

/**
* @deprecated {@link StorageType} is not used, instead use {@link StatisticKey#doubleKey(Identifier)}
*/
@Deprecated
public static StatisticKey<Double> doubleKey(Identifier id, StorageType storageType) {
return new StatisticKey<>(id, ValueType.FLOAT, storageType, false);
}

/**
* @deprecated {@link StorageType} is not used, instead use {@link StatisticKey#intKey(Identifier)}
*/
@Deprecated
public static StatisticKey<Integer> hiddenIntKey(Identifier id, StorageType storageType) {
return new StatisticKey<>(id, ValueType.INT, storageType, true);
}

/**
* @deprecated {@link StorageType} is not used, instead use {@link StatisticKey#floatKey(Identifier)}
*/
@Deprecated
public static StatisticKey<Float> hiddenFloatKey(Identifier id, StorageType storageType) {
return new StatisticKey<>(id, ValueType.FLOAT, storageType, true);
}

/**
* @deprecated {@link StorageType} is not used, instead use {@link StatisticKey#doubleKey(Identifier)}
*/
@Deprecated
public static StatisticKey<Double> hiddenDoubleKey(Identifier id, StorageType storageType) {
return new StatisticKey<>(id, ValueType.FLOAT, storageType, true);
}
Expand Down

0 comments on commit ec5dc92

Please sign in to comment.