Switch to consumer + remove debug message
Dieser Commit ist enthalten in:
Ursprung
50d3252276
Commit
e3eeb3607e
@ -26,13 +26,14 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public class SWAnvilInv {
|
public class SWAnvilInv {
|
||||||
|
|
||||||
private final AnvilGUI.Builder builder;
|
private final AnvilGUI.Builder builder;
|
||||||
private final Player player;
|
private final Player player;
|
||||||
|
|
||||||
private Response 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);
|
builder = new AnvilGUI.Builder().plugin(Core.getInstance()).title(t).text("»").onComplete(this::onResult);
|
||||||
@ -55,7 +56,7 @@ public class SWAnvilInv {
|
|||||||
builder.itemLeft(new SWItem(m, meta, "»", lore, e, null).getItemStack());
|
builder.itemLeft(new SWItem(m, meta, "»", lore, e, null).getItemStack());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCallback(Response callback){
|
public void setCallback(Consumer<String> callback){
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,15 +71,7 @@ public class SWAnvilInv {
|
|||||||
private AnvilGUI.Response onResult(Player player, String s) {
|
private AnvilGUI.Response onResult(Player player, String s) {
|
||||||
if(s.startsWith("»"))
|
if(s.startsWith("»"))
|
||||||
s = s.substring(1);
|
s = s.substring(1);
|
||||||
callback.onResult(s);
|
callback.accept(s);
|
||||||
return AnvilGUI.Response.close();
|
return AnvilGUI.Response.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClose(Player player) {
|
|
||||||
player.sendMessage("Closing");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static interface Response{
|
|
||||||
void onResult(String s);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren