55 lines
1.4 KiB
Java
55 lines
1.4 KiB
Java
package xyz.etztech.serverapi.web.api;
|
|
|
|
import com.expediagroup.graphql.annotations.GraphQLDescription;
|
|
import com.expediagroup.graphql.annotations.GraphQLName;
|
|
import org.bukkit.plugin.Plugin;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
@GraphQLName("Plugin")
|
|
@GraphQLDescription("Plugin GraphQL")
|
|
public class PluginAPI {
|
|
private final String name;
|
|
private final String version;
|
|
private final List<String> authors;
|
|
private final String website;
|
|
|
|
|
|
public PluginAPI(String name, String version, List<String> authors, String website) {
|
|
this.name = name;
|
|
this.version = version;
|
|
this.authors = authors != null ? authors : new ArrayList<>();
|
|
this.website = website != null ? website : "";
|
|
}
|
|
|
|
@GraphQLName("name")
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
@GraphQLName("version")
|
|
public String getVersion() {
|
|
return version;
|
|
}
|
|
|
|
@GraphQLName("authors")
|
|
public List<String> getAuthors() {
|
|
return authors;
|
|
}
|
|
|
|
@GraphQLName("website")
|
|
public String getWebsite() {
|
|
return website;
|
|
}
|
|
|
|
public static PluginAPI fromMinecraft(Plugin plugin) {
|
|
return new PluginAPI(
|
|
plugin.getName(),
|
|
plugin.getDescription().getVersion(),
|
|
plugin.getDescription().getAuthors(),
|
|
plugin.getDescription().getWebsite()
|
|
);
|
|
}
|
|
}
|