|
|
@ -21,6 +21,11 @@ package net.william278.husksync.data;
|
|
|
|
|
|
|
|
|
|
|
|
import com.google.common.collect.Sets;
|
|
|
|
import com.google.common.collect.Sets;
|
|
|
|
import com.google.gson.annotations.SerializedName;
|
|
|
|
import com.google.gson.annotations.SerializedName;
|
|
|
|
|
|
|
|
import lombok.AccessLevel;
|
|
|
|
|
|
|
|
import lombok.AllArgsConstructor;
|
|
|
|
|
|
|
|
import lombok.Getter;
|
|
|
|
|
|
|
|
import lombok.NoArgsConstructor;
|
|
|
|
|
|
|
|
import lombok.experimental.Accessors;
|
|
|
|
import net.kyori.adventure.key.Key;
|
|
|
|
import net.kyori.adventure.key.Key;
|
|
|
|
import net.william278.husksync.HuskSync;
|
|
|
|
import net.william278.husksync.HuskSync;
|
|
|
|
import net.william278.husksync.user.OnlineUser;
|
|
|
|
import net.william278.husksync.user.OnlineUser;
|
|
|
@ -334,17 +339,34 @@ public interface Data {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
record Modifier(
|
|
|
|
@Getter
|
|
|
|
@NotNull UUID uuid,
|
|
|
|
@Accessors(fluent = true)
|
|
|
|
@NotNull String name,
|
|
|
|
@AllArgsConstructor
|
|
|
|
double amount,
|
|
|
|
@NoArgsConstructor
|
|
|
|
@SerializedName("operation") int operationType,
|
|
|
|
final class Modifier {
|
|
|
|
@SerializedName("equipment_slot") int equipmentSlot
|
|
|
|
@Getter(AccessLevel.NONE)
|
|
|
|
) {
|
|
|
|
@Nullable
|
|
|
|
|
|
|
|
@SerializedName("uuid")
|
|
|
|
|
|
|
|
private UUID uuid;
|
|
|
|
|
|
|
|
@SerializedName("name")
|
|
|
|
|
|
|
|
private String name;
|
|
|
|
|
|
|
|
@SerializedName("amount")
|
|
|
|
|
|
|
|
private double amount;
|
|
|
|
|
|
|
|
@SerializedName("operation")
|
|
|
|
|
|
|
|
private int operationType;
|
|
|
|
|
|
|
|
@SerializedName("equipment_slot")
|
|
|
|
|
|
|
|
private int equipmentSlot;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Modifier(@NotNull String name, double amount, int operationType, int equipmentSlot) {
|
|
|
|
|
|
|
|
this.name = name;
|
|
|
|
|
|
|
|
this.amount = amount;
|
|
|
|
|
|
|
|
this.operationType = operationType;
|
|
|
|
|
|
|
|
this.equipmentSlot = equipmentSlot;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean equals(Object obj) {
|
|
|
|
public boolean equals(Object obj) {
|
|
|
|
return obj instanceof Modifier modifier && modifier.uuid.equals(uuid);
|
|
|
|
return obj instanceof Modifier modifier && modifier.uuid().equals(uuid());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public double modify(double value) {
|
|
|
|
public double modify(double value) {
|
|
|
@ -355,6 +377,12 @@ public interface Data {
|
|
|
|
default -> value;
|
|
|
|
default -> value;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@NotNull
|
|
|
|
|
|
|
|
public UUID uuid() {
|
|
|
|
|
|
|
|
return uuid != null ? uuid : UUID.nameUUIDFromBytes(name.getBytes());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
default Optional<Attribute> getAttribute(@NotNull Key key) {
|
|
|
|
default Optional<Attribute> getAttribute(@NotNull Key key) {
|
|
|
|