Class TextInputGUI
java.lang.Object
de.placeblock.betterinventories.gui.GUI
de.placeblock.betterinventories.gui.impl.BaseAnvilGUI
de.placeblock.betterinventories.gui.impl.textinput.TextInputGUI
- All Implemented Interfaces:
PlayerGUI<org.bukkit.entity.Player>
GUI for getting Text Input
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTextInputGUI.AbstractBuilder<B extends TextInputGUI.AbstractBuilder<B,G, P>, G extends TextInputGUI, P extends org.bukkit.plugin.java.JavaPlugin> Abstract Builder for creatingTextInputGUIstatic classTextInputGUI.Builder<P extends org.bukkit.plugin.java.JavaPlugin>Builder for creatingTextInputGUI -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.bukkit.MaterialThe input-materialstatic final org.bukkit.MaterialThe result-materialFields inherited from class de.placeblock.betterinventories.gui.GUI
NMS_BRIDGE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTextInputGUI(org.bukkit.plugin.Plugin plugin, net.kyori.adventure.text.TextComponent title, boolean removeItems, org.bukkit.entity.Player player, String text, FinishConsumer onFinish, Consumer<String> onUpdate, Function<String, net.kyori.adventure.text.TextComponent> titleConverter) Creates a new TextInputGUI -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.entity.PlayervoidonClose(org.bukkit.entity.Player player) Is called when the player closes the GUI.booleanCalled when a player clicks on the submit-item and can be overriddenvoidCalled when a player typesvoidupdateText(String text) Is called by theTextInputPacketListenerto update the textMethods inherited from class de.placeblock.betterinventories.gui.impl.BaseAnvilGUI
createBukkitInventory, getSlots, provideItem, renderContent, searchSectionMethods inherited from class de.placeblock.betterinventories.gui.GUI
getPlayers, getView, getView, reloadViews, removePlayer, showPlayer, update, updateTitle
-
Field Details
-
INPUT_MATERIAL
public static final org.bukkit.Material INPUT_MATERIALThe input-material -
RESULT_MATERIAL
public static final org.bukkit.Material RESULT_MATERIALThe result-material
-
-
Constructor Details
-
TextInputGUI
protected TextInputGUI(org.bukkit.plugin.Plugin plugin, net.kyori.adventure.text.TextComponent title, boolean removeItems, org.bukkit.entity.Player player, String text, FinishConsumer onFinish, Consumer<String> onUpdate, Function<String, net.kyori.adventure.text.TextComponent> titleConverter) Creates a new TextInputGUI- Parameters:
plugin- The plugintitle- The title of the GUIplayer- The player which enters texttext- The initial TextonFinish- Is called when the player finishes renaming (by submitting or by aborting)onUpdate- Is called whenever the player types somethingtitleConverter- Is called to convert the current text to the title of the submit itemremoveItems- Whether to remove loose items on close. The first player that closes the gui gets the items
-
-
Method Details
-
updateText
Is called by theTextInputPacketListenerto update the text- Parameters:
text- The new text
-
onClose
public void onClose(org.bukkit.entity.Player player) Is called when the player closes the GUI. Aborts the text-input. -
onUpdate
Called when a player types- Parameters:
text- The new text
-
onFinish
Called when a player clicks on the submit-item and can be overridden- Parameters:
text- The final textabort- Whether the player aborted, e.g. by closing the Inventory- Returns:
- GUI closes when true is returned
-
getPlayer
public org.bukkit.entity.Player getPlayer()
-