de.placeblock.betterinventories.builder.content.GUIButtonBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of BetterInventories Show documentation
Show all versions of BetterInventories Show documentation
Easy to use and extensive InventoryAPI for Spigot
package de.placeblock.betterinventories.builder.content;
import de.placeblock.betterinventories.content.item.ClickData;
import de.placeblock.betterinventories.content.item.GUIButton;
import de.placeblock.betterinventories.gui.GUI;
/**
* Builder for creating GUIButtons
*/
public class GUIButtonBuilder extends BaseGUIButtonBuilder {
/**
* Creates a new GUIButtonBuilder
* @param gui The GUI for the Button
*/
public GUIButtonBuilder(GUI gui) {
super(gui);
}
/**
* Buildes the GUIButton
* @return The new GUIButton
*/
@Override
public GUIButton build() {
return new GUIButton(this.getGui(), this.getItem(), this.getCooldown(), this.getClickSound(), this.getPermission()) {
@Override
public void onClick(ClickData data) {
if (GUIButtonBuilder.this.getOnClick() == null) return;
GUIButtonBuilder.this.getOnClick().accept(data);
}
@Override
public void onLeftClick(ClickData data) {
if (GUIButtonBuilder.this.getOnLeftClick() == null) return;
GUIButtonBuilder.this.getOnLeftClick().accept(data);
}
@Override
public void onRightClick(ClickData data) {
if (GUIButtonBuilder.this.getOnRightClick() == null) return;
GUIButtonBuilder.this.getOnRightClick().accept(data);
}
@Override
public void onShiftClick(ClickData data) {
if (GUIButtonBuilder.this.getOnShiftClick() == null) return;
GUIButtonBuilder.this.getOnShiftClick().accept(data);
}
@Override
public void onShiftLeftClick(ClickData data) {
if (GUIButtonBuilder.this.getOnShiftLeftClick() == null) return;
GUIButtonBuilder.this.getOnShiftLeftClick().accept(data);
}
@Override
public void onShiftRightClick(ClickData data) {
if (GUIButtonBuilder.this.getOnShiftRightClick() == null) return;
GUIButtonBuilder.this.getOnShiftRightClick().accept(data);
}
};
}
}