first time connect and add treasure command
All checks were successful
Build / build (push) Successful in 1m50s
All checks were successful
Build / build (push) Successful in 1m50s
This commit is contained in:
parent
8598028321
commit
eb68064f7f
1 changed files with 2 additions and 10 deletions
|
@ -3,7 +3,6 @@ package me.unurled.sacredrealms.sr.components.item.abilities;
|
|||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
|
@ -29,15 +28,8 @@ public class AbilityDeserializer implements JsonDeserializer<Ability> {
|
|||
public Ability deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
|
||||
throws JsonParseException {
|
||||
try {
|
||||
JsonObject jsonObject = json.getAsJsonObject();
|
||||
|
||||
String name = jsonObject.get("name").getAsString();
|
||||
String description = jsonObject.get("description").getAsString();
|
||||
Integer cooldown = jsonObject.get("cooldown").getAsInt();
|
||||
Integer manaCost = jsonObject.get("manaCost").getAsInt();
|
||||
Integer damage = jsonObject.get("damage").getAsInt();
|
||||
|
||||
return new Ability(name, description, cooldown, manaCost, damage);
|
||||
String id = json.getAsString();
|
||||
return Ability.getAbility(id);
|
||||
} catch (Exception e) {
|
||||
throw new JsonParseException("Error deserializing Ability: " + e.getMessage());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue