# PaintingAPI
Static accessor for the Painting API. Holds the `IPaintingAPI` instance registered by the platform plugin during enable.
---
## Source
```java
package gg.lode.paintingapi;
import org.jetbrains.annotations.NotNull;
public final class PaintingAPI {
private static IPaintingAPI instance;
private PaintingAPI() {}
public static void setApi(@NotNull IPaintingAPI api) {
if (instance != null) {
throw new IllegalStateException("PaintingAPI already set");
}
instance = api;
}
public static @NotNull IPaintingAPI get() {
if (instance == null) {
throw new IllegalStateException("PaintingAPI not initialized — Painting plugin not loaded?");
}
return instance;
}
public static boolean isAvailable() {
return instance != null;
}
}
```
---
## Related Pages
- [[Painting/API/IPaintingAPI]] — interface backing this accessor
- [[Painting/Developers/Overview]] — usage examples