組件特性修飾
Clickable 可點擊 / Disable 可禁用
public final class Checkbox extends AbstractComponent implements Clickable {
private final Material checkedIcon, uncheckedIcon;
private final String checkedShow, uncheckedShow;
private final boolean disabled;
private boolean currentValue;
/**
構造器略
**/
@Override
public void onClick(InventoryClickEvent event) {
this.currentValue = !this.currentValue;
attributeController.setAttribute(getItem(), AttributeController.VALUE_TAG, this.currentValue);
itemFactory.lore(List.of("-> "+(this.currentValue ? checkedShow : uncheckedShow)));
itemFactory.material(this.currentValue ? checkedIcon : uncheckedIcon);
this.updateInventory();
}
@Override
public boolean isDisabled() {
return disabled;
}
}Animatable 可執行動畫
Listenable 可監聽 / Activitable 可啓動
最后更新于