Merge pull request 'Add SWAnvilInv.defaultText' (#89) from SWAnvil into master
Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Commit
d67a8657b3
@ -32,39 +32,45 @@ public class SWAnvilInv {
|
|||||||
|
|
||||||
private final AnvilGUI.Builder builder;
|
private final AnvilGUI.Builder builder;
|
||||||
private final Player player;
|
private final Player player;
|
||||||
|
private final String defaultText;
|
||||||
|
|
||||||
private Consumer<String> callback;
|
private Consumer<String> callback;
|
||||||
|
|
||||||
public SWAnvilInv(Player p, String t){
|
public SWAnvilInv(Player p, String t) {
|
||||||
builder = new AnvilGUI.Builder().plugin(Core.getInstance()).title(t).text("»").onComplete(this::onResult);
|
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;
|
player = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setItem(Material m){
|
public void setItem(Material m) {
|
||||||
setItem(m, new ArrayList<>(), false);
|
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);
|
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);
|
setItem(m, (byte)0, lore, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setItem(Material m, byte meta, List<String> lore, boolean e){
|
public void setItem(Material m, byte meta, List<String> lore, boolean e) {
|
||||||
builder.itemLeft(new SWItem(m, meta, "»", lore, e, null).getItemStack());
|
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;
|
this.callback = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addCloseCallback(Runnable callback){
|
public void addCloseCallback(Runnable callback) {
|
||||||
builder.onClose(p -> callback.run());
|
builder.onClose(p -> callback.run());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void open(){
|
public void open() {
|
||||||
builder.open(player);
|
builder.open(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren