SteamWar/SpigotCore
Archiviert
13
0

Add SWAnvilInv.defaultText #89

Manuell gemergt
Lixfel hat 1 Commits von SWAnvil nach master 2021-01-22 16:29:30 +01:00 zusammengeführt
Nur Änderungen aus Commit 3a26c30ae8 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -32,39 +32,45 @@ public class SWAnvilInv {
private final AnvilGUI.Builder builder;
private final Player player;
private final String defaultText;
private Consumer<String> callback;
public SWAnvilInv(Player p, String t){
builder = new AnvilGUI.Builder().plugin(Core.getInstance()).title(t).text("»").onComplete(this::onResult);
public SWAnvilInv(Player p, String t) {
this(p, t, "");
}
public SWAnvilInv(Player p, String t, String defaultText) {
builder = new AnvilGUI.Builder().plugin(Core.getInstance()).title(t).text("»" + defaultText).onComplete(this::onResult);
this.defaultText = defaultText;
player = p;
}
public void setItem(Material m){
public void setItem(Material m) {
setItem(m, new ArrayList<>(), false);
}
public void setItem(Material m, byte meta){
public void setItem(Material m, byte meta) {
setItem(m, meta, new ArrayList<>(), false);
}
public void setItem(Material m, List<String> lore, boolean e){
public void setItem(Material m, List<String> lore, boolean e) {
setItem(m, (byte)0, lore, e);
}
public void setItem(Material m, byte meta, List<String> lore, boolean e){
builder.itemLeft(new SWItem(m, meta, "»", lore, e, null).getItemStack());
public void setItem(Material m, byte meta, List<String> lore, boolean e) {
builder.itemLeft(new SWItem(m, meta, "»" + defaultText, lore, e, null).getItemStack());
}
public void setCallback(Consumer<String> callback){
public void setCallback(Consumer<String> callback) {
this.callback = callback;
}
public void addCloseCallback(Runnable callback){
public void addCloseCallback(Runnable callback) {
builder.onClose(p -> callback.run());
}
public void open(){
public void open() {
builder.open(player);
}