-
Notifications
You must be signed in to change notification settings - Fork 1
Creating Components
To create our own fancy Component, we extend BaseComponent. That's easier than implementing the Component interface. So lets create a new class: public class MyComponent extends BaseComponent { @Override public void updateSync() {
}
@Override
public void drawAsync(Graphics2D g) {
}
}
As you might have seen, the two methods are called on different threads. The updateSync() method is called on the bukkit server thread, so it blocks the whole server, but you can access the full bukkit API.
The drawAsync(...) method is called asynchronous on a differnt thread, so you MUST NOT acces the BukkitAPI. Calling something like Location#getBlock() isn't allowed here. Do this in updateSync()-method!
To be filled
A ComponentsContainerComponent is a Component that display other components. It's generic, so you can easily specify what components may added, removed, etc. See the RadioGroup for an example.