2018-01-01 01:41:19 +01:00
|
|
|
package us.tastybento.bskyblock.api.flags;
|
|
|
|
|
2018-01-27 17:04:08 +01:00
|
|
|
import org.bukkit.Material;
|
2018-01-01 01:41:19 +01:00
|
|
|
import org.bukkit.event.Listener;
|
2018-01-27 17:04:08 +01:00
|
|
|
import org.bukkit.inventory.ItemStack;
|
2018-01-28 18:47:51 +01:00
|
|
|
|
2018-02-03 20:54:33 +01:00
|
|
|
import us.tastybento.bskyblock.BSkyBlock;
|
2018-01-07 00:23:01 +01:00
|
|
|
import us.tastybento.bskyblock.api.panels.PanelItem;
|
2018-01-27 17:04:08 +01:00
|
|
|
import us.tastybento.bskyblock.api.panels.builders.PanelItemBuilder;
|
2018-01-01 01:41:19 +01:00
|
|
|
|
|
|
|
public class FlagBuilder {
|
|
|
|
|
2018-01-28 13:31:07 +01:00
|
|
|
private String id = "";
|
2018-01-29 05:44:57 +01:00
|
|
|
private PanelItem icon;
|
2018-01-28 18:47:51 +01:00
|
|
|
private Listener listener;
|
2018-01-31 01:59:10 +01:00
|
|
|
private boolean defaultSetting;
|
2018-01-01 01:41:19 +01:00
|
|
|
|
|
|
|
public FlagBuilder id(String id) {
|
|
|
|
this.id = id;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2018-01-27 17:04:08 +01:00
|
|
|
public FlagBuilder icon(Material icon) {
|
|
|
|
icon(new PanelItemBuilder().icon(new ItemStack(icon)).build());
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2018-01-01 01:41:19 +01:00
|
|
|
public FlagBuilder icon(PanelItem icon) {
|
|
|
|
this.icon = icon;
|
2018-01-27 17:04:08 +01:00
|
|
|
//TODO: if icon don't have a clickhandler, add the default one
|
|
|
|
//TODO: if icon don't have a display name, set it to the default reference
|
|
|
|
//TODO: if icon don't have a lore, set it to the default one
|
2018-01-01 01:41:19 +01:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public FlagBuilder listener(Listener listener) {
|
2018-01-28 18:47:51 +01:00
|
|
|
this.listener = listener;
|
2018-01-01 01:41:19 +01:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2018-02-03 20:54:33 +01:00
|
|
|
public Flag build(BSkyBlock plugin) {
|
|
|
|
return new Flag(plugin, id, icon, listener, defaultSetting);
|
2018-01-31 01:59:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the default setting for this flag in the world
|
|
|
|
* @param setting
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public FlagBuilder allowedByDefault(boolean setting) {
|
|
|
|
this.defaultSetting = setting;
|
|
|
|
return this;
|
2018-01-01 01:41:19 +01:00
|
|
|
}
|
|
|
|
}
|