11package be .isach .ultracosmetics .version ;
22
3+ import be .isach .ultracosmetics .UltraCosmeticsData ;
4+
35import org .apache .commons .lang .Validate ;
46import org .bukkit .Bukkit ;
57import org .bukkit .Material ;
1618import org .bukkit .inventory .meta .ItemMeta ;
1719import org .bukkit .plugin .Plugin ;
1820
19- import be .isach .ultracosmetics .UltraCosmeticsData ;
20- import be .isach .ultracosmetics .abstraction .IAnvilWrapper ;
21-
2221import java .util .function .BiFunction ;
2322import java .util .function .Consumer ;
2423
@@ -66,7 +65,7 @@ public class AnvilGUI {
6665 /**
6766 * An {@link BiFunction} that is called when the {@link Slot#OUTPUT} slot has been clicked
6867 */
69- private final BiFunction <Player , String , Response > completeFunction ;
68+ private final BiFunction <Player ,String ,Response > completeFunction ;
7069
7170 /**
7271 * An {@link Consumer} that is called when the {@link Slot#INPUT_LEFT} slot has been clicked
@@ -100,13 +99,13 @@ public class AnvilGUI {
10099 *
101100 * @param plugin A {@link org.bukkit.plugin.java.JavaPlugin} instance
102101 * @param holder The {@link Player} to open the inventory for
103- * @param insert What to have the text already set to
102+ * @param insert What to have the text already set to
104103 * @param biFunction A {@link BiFunction} that is called when the player clicks the {@link Slot#OUTPUT} slot
105104 * @throws NullPointerException If the server version isn't supported
106105 * @deprecated As of version 1.2.3, use {@link AnvilGUI.Builder}
107106 */
108107 @ Deprecated
109- public AnvilGUI (Plugin plugin , Player holder , String insert , BiFunction <Player , String , String > biFunction ) {
108+ public AnvilGUI (Plugin plugin , Player holder , String insert , BiFunction <Player ,String ,String > biFunction ) {
110109 this (plugin , holder , "Repair & Name" , insert , null , null , false , null , null , null , (player , text ) -> {
111110 String response = biFunction .apply (player , text );
112111 if (response != null ) {
@@ -140,8 +139,7 @@ private AnvilGUI(
140139 Consumer <Player > closeListener ,
141140 Consumer <Player > inputLeftClickListener ,
142141 Consumer <Player > inputRightClickListener ,
143- BiFunction <Player , String , Response > completeFunction
144- ) {
142+ BiFunction <Player ,String ,Response > completeFunction ) {
145143 this .plugin = plugin ;
146144 this .player = player ;
147145 this .inventoryTitle = inventoryTitle ;
@@ -200,6 +198,7 @@ public void closeInventory() {
200198
201199 /**
202200 * Closes the inventory if it's open, only sending the close inventory packets if the arg is true
201+ *
203202 * @param sendClosePacket Whether to send the close inventory event, packet, etc
204203 */
205204 private void closeInventory (boolean sendClosePacket ) {
@@ -238,10 +237,8 @@ private class ListenUp implements Listener {
238237
239238 @ EventHandler
240239 public void onInventoryClick (InventoryClickEvent event ) {
241- if (
242- event .getInventory ().equals (inventory ) &&
243- (event .getRawSlot () < 3 || event .getAction ().equals (InventoryAction .MOVE_TO_OTHER_INVENTORY ))
244- ) {
240+ if (event .getInventory ().equals (inventory ) &&
241+ (event .getRawSlot () < 3 || event .getAction ().equals (InventoryAction .MOVE_TO_OTHER_INVENTORY ))) {
245242 event .setCancelled (true );
246243 final Player clicker = (Player ) event .getWhoClicked ();
247244 if (event .getRawSlot () == Slot .OUTPUT ) {
@@ -250,8 +247,7 @@ public void onInventoryClick(InventoryClickEvent event) {
250247
251248 final Response response = completeFunction .apply (
252249 clicker ,
253- clicked .hasItemMeta () ? clicked .getItemMeta ().getDisplayName () : ""
254- );
250+ clicked .hasItemMeta () ? clicked .getItemMeta ().getDisplayName () : "" );
255251 if (response .getText () != null ) {
256252 final ItemMeta meta = clicked .getItemMeta ();
257253 meta .setDisplayName (response .getText ());
@@ -322,7 +318,7 @@ public static class Builder {
322318 /**
323319 * An {@link BiFunction} that is called when the anvil output slot has been clicked
324320 */
325- private BiFunction <Player , String , Response > completeFunction ;
321+ private BiFunction <Player ,String ,Response > completeFunction ;
326322 /**
327323 * The {@link Plugin} that this anvil GUI is associated with
328324 */
@@ -396,7 +392,7 @@ public Builder onRightInputClick(Consumer<Player> inputRightClickListener) {
396392 * @return The {@link Builder} instance
397393 * @throws IllegalArgumentException when the completeFunction is null
398394 */
399- public Builder onComplete (BiFunction <Player , String , Response > completeFunction ) {
395+ public Builder onComplete (BiFunction <Player ,String ,Response > completeFunction ) {
400396 Validate .notNull (completeFunction , "Complete function cannot be null" );
401397 this .completeFunction = completeFunction ;
402398 return this ;
@@ -569,7 +565,7 @@ public static Response openInventory(Inventory inventory) {
569565 */
570566 public static class Slot {
571567
572- private static final int [] values = new int []{ Slot .INPUT_LEFT , Slot .INPUT_RIGHT , Slot .OUTPUT };
568+ private static final int [] values = new int [] { Slot .INPUT_LEFT , Slot .INPUT_RIGHT , Slot .OUTPUT };
573569
574570 /**
575571 * The slot on the far left, where the first input is inserted. An {@link ItemStack} is always inserted
@@ -597,4 +593,3 @@ public static int[] values() {
597593 }
598594
599595}
600-
0 commit comments