forked from MinecraftUtilities/Backend
move models to the model package
This commit is contained in:
27
src/main/java/cc/fascinated/model/player/Cape.java
Normal file
27
src/main/java/cc/fascinated/model/player/Cape.java
Normal file
@ -0,0 +1,27 @@
|
||||
package cc.fascinated.model.player;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter @AllArgsConstructor
|
||||
public class Cape {
|
||||
|
||||
/**
|
||||
* The URL of the cape
|
||||
*/
|
||||
private final String url;
|
||||
|
||||
/**
|
||||
* Gets the cape from a {@link JsonObject}.
|
||||
*
|
||||
* @param json the JSON object
|
||||
* @return the cape
|
||||
*/
|
||||
public static Cape fromJson(JsonObject json) {
|
||||
if (json == null) {
|
||||
return null;
|
||||
}
|
||||
return new Cape(json.get("url").getAsString());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user