Class SuggestionUtil
java.lang.Object
com.mrbysco.spellchecker.util.SuggestionUtil
Utility class for handling suggestions in the chat box
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Stringstatic final List<SuggestionInfo> static final List<LocationData> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddToDictionary(net.minecraft.client.gui.components.EditBox box, String word) Adds a word to the dictionary and then refreshes the suggestionsgetSuggestions(String misspelledWord) Get suggestions for a wordprotected static booleanhoverBoolean(int mouseX, int mouseY, int x, int y, int width, int height) Checks if the mouse is hovering over a specific areastatic booleanisCommandLikeInput(net.minecraft.client.gui.components.EditBox editBox) Checks if the input in the given EditBox is command-likestatic voidkeepSuggestion(net.minecraft.client.gui.components.EditBox box, int x, int y, String word, ArrayList<String> suggestions) Keeps the suggested wordstatic voidonKeyPressed(net.minecraft.client.input.KeyEvent event, net.minecraft.client.gui.components.EditBox box) Called when a key is pressed in the chat boxstatic voidonMouseClicked(net.minecraft.client.input.MouseButtonEvent event, boolean isDoubleClick, net.minecraft.client.gui.components.EditBox editBox) Called when the mouse is clicked in the chat boxstatic voidrefreshSuggestions(net.minecraft.client.gui.components.EditBox editBox) Refreshes the suggestions for the current inputstatic StringStrips a word of all non-alphanumeric characters
-
Field Details
-
wordSuggestions
-
wordPosition
-
wronglySpelledWords
-
keptSuggestions
-
currentLocale
-
-
Constructor Details
-
SuggestionUtil
public SuggestionUtil()
-
-
Method Details
-
onKeyPressed
public static void onKeyPressed(net.minecraft.client.input.KeyEvent event, net.minecraft.client.gui.components.EditBox box) Called when a key is pressed in the chat box- Parameters:
event- The key eventbox- The edit box where the key was pressed
-
onMouseClicked
public static void onMouseClicked(net.minecraft.client.input.MouseButtonEvent event, boolean isDoubleClick, net.minecraft.client.gui.components.EditBox editBox) Called when the mouse is clicked in the chat box- Parameters:
event- The mouse button eventisDoubleClick- If the mouse was double-clickededitBox- The editbox
-
hoverBoolean
protected static boolean hoverBoolean(int mouseX, int mouseY, int x, int y, int width, int height) Checks if the mouse is hovering over a specific area- Parameters:
mouseX- The x position of the mousemouseY- The y position of the mousex- The x position of the areay- The y position of the areawidth- The width of the areaheight- The height of the area- Returns:
- True if the mouse is hovering over the area, false otherwise
-
addToDictionary
Adds a word to the dictionary and then refreshes the suggestions- Parameters:
box- The edit boxword- The word to add
-
keepSuggestion
public static void keepSuggestion(net.minecraft.client.gui.components.EditBox box, int x, int y, String word, ArrayList<String> suggestions) Keeps the suggested word- Parameters:
box- The edit boxx- The x position of the wordy- The y position of the wordword- The word to keepsuggestions- The suggestions for the word
-
refreshSuggestions
public static void refreshSuggestions(net.minecraft.client.gui.components.EditBox editBox) Refreshes the suggestions for the current input- Parameters:
editBox- The edit box
-
getSuggestions
-
stripWord
-
isCommandLikeInput
public static boolean isCommandLikeInput(net.minecraft.client.gui.components.EditBox editBox) Checks if the input in the given EditBox is command-like- Parameters:
editBox- The EditBox to check- Returns:
- True if the input is command-like, false otherwise
-