Class TextInputGUI
java.lang.Object
de.placeblock.betterinventories.gui.GUI
de.placeblock.betterinventories.gui.impl.AnvilGUI
de.placeblock.betterinventories.gui.impl.textinput.TextInputGUI
- All Implemented Interfaces:
PlayerGUI<org.bukkit.entity.Player>,org.bukkit.event.Listener
GUI for getting Text Input
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.bukkit.MaterialThe input-materialstatic final org.bukkit.MaterialThe result-material -
Constructor Summary
ConstructorsConstructorDescriptionTextInputGUI(org.bukkit.plugin.Plugin plugin, net.kyori.adventure.text.TextComponent title, org.bukkit.entity.Player player, String text, FinishConsumer onFinish) Creates a new TextInputGUITextInputGUI(org.bukkit.plugin.Plugin plugin, net.kyori.adventure.text.TextComponent title, org.bukkit.entity.Player player, String text, FinishConsumer onFinish, Consumer<String> onUpdate, Function<String, net.kyori.adventure.text.TextComponent> titleConverter) Creates a new TextInputGUITextInputGUI(org.bukkit.plugin.Plugin plugin, net.kyori.adventure.text.TextComponent title, org.bukkit.entity.Player player, String text, FinishConsumer onFinish, Function<String, net.kyori.adventure.text.TextComponent> titleConverter) Creates a new TextInputGUITextInputGUI(org.bukkit.plugin.Plugin plugin, net.kyori.adventure.text.TextComponent title, org.bukkit.entity.Player player, String text, 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.AnvilGUI
createBukkitInventory, getClickedSection, getSlots, renderContentMethods inherited from class de.placeblock.betterinventories.gui.GUI
getPlayers, getView, getView, onInventoryClick, onInventoryClose, onInventoryDrag, registerInteractionHandler, reloadViews, render, showPlayer, unregisterInteractionHandler, update, updateViews
-
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
public TextInputGUI(org.bukkit.plugin.Plugin plugin, net.kyori.adventure.text.TextComponent title, org.bukkit.entity.Player player, String text, FinishConsumer onFinish) 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)
-
TextInputGUI
public TextInputGUI(org.bukkit.plugin.Plugin plugin, net.kyori.adventure.text.TextComponent title, org.bukkit.entity.Player player, String text, FinishConsumer onFinish, 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)titleConverter- Is called to convert the current text to the title of the submit item
-
TextInputGUI
public TextInputGUI(org.bukkit.plugin.Plugin plugin, net.kyori.adventure.text.TextComponent title, org.bukkit.entity.Player player, String text, 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 TexttitleConverter- Is called to convert the current text to the title of the submit item
-
TextInputGUI
public TextInputGUI(org.bukkit.plugin.Plugin plugin, net.kyori.adventure.text.TextComponent title, 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 item
-
-
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()
-