mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-20 09:59:42 +00:00
Merge remote-tracking branch 'origin/dev' into syntax-highlighter-unified
# Conflicts: # src/api # src/main/java/kamkeel/npcs/util/BukkitUtil.java # src/main/java/kamkeel/npcs/util/VaultUtil.java # src/main/java/noppes/npcs/CustomNpcsPermissions.java
This commit is contained in:
commit
ba7e4cc3b2
50 files changed
+2663
-766
No files matched your search
@@ -27,6 +27,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public abstract class GuiNPCInterface extends GuiScreen {
|
||||
@@ -52,6 +53,7 @@ public abstract class GuiNPCInterface extends GuiScreen {
|
||||
public Supplier<Boolean> closeOnEscSupplier = null;
|
||||
public int guiLeft, guiTop, xSize, ySize;
|
||||
private SubGuiInterface subgui;
|
||||
private Consumer<SubGuiInterface> pendingSubGuiResult;
|
||||
public int mouseX, mouseY, mouseScroll;
|
||||
public float bgScale = 1;
|
||||
public float bgScaleX = 1;
|
||||
@@ -518,7 +520,21 @@ public abstract class GuiNPCInterface extends GuiScreen {
|
||||
initGui();
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a sub-gui with a result handler that will be called when the sub-gui closes.
|
||||
* The handler survives initGui() rebuilds since it lives on the parent, not the builder.
|
||||
*/
|
||||
public void setSubGuiWithResult(SubGuiInterface gui, Consumer<SubGuiInterface> resultHandler) {
|
||||
this.pendingSubGuiResult = resultHandler;
|
||||
setSubGui(gui);
|
||||
}
|
||||
|
||||
public void closeSubGui(SubGuiInterface gui) {
|
||||
if (pendingSubGuiResult != null) {
|
||||
Consumer<SubGuiInterface> handler = pendingSubGuiResult;
|
||||
pendingSubGuiResult = null;
|
||||
handler.accept(gui);
|
||||
}
|
||||
subgui = null;
|
||||
initGui();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user