broken-arrow

Untitled

Dec 6th, 2021
1,084
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package org.brokenarrow.storage.menus;
  2.  
  3. import org.brokenarrow.storage.CustomContainersMainClass;
  4. import org.brokenarrow.storage.Settings.ChatMessages;
  5. import org.brokenarrow.storage.Settings.LoadSettingsContainers;
  6. import org.brokenarrow.storage.Settings.MainSettings;
  7. import org.brokenarrow.storage.api.ContainerRegistryAPI;
  8. import org.brokenarrow.storage.api.PreferenceSettingsRegisteryApi;
  9. import org.brokenarrow.storage.hock.economy.PriceProvided;
  10. import org.brokenarrow.storage.util.GuiTempletsYaml;
  11. import org.brokenarrow.storage.util.ItemUtily;
  12. import org.brokenarrow.storage.util.MetadataEnumsForGui;
  13. import org.brokenarrow.storage.util.YamlSettingsContainers;
  14. import org.brokenarrow.storage.util.effects.CreateBorderEffect;
  15. import org.brokenarrow.storage.util.effects.SpawnBorderEffects;
  16. import org.bukkit.Bukkit;
  17. import org.bukkit.Location;
  18. import org.bukkit.entity.Player;
  19. import org.bukkit.event.inventory.ClickType;
  20. import org.bukkit.inventory.ItemStack;
  21. import org.bukkit.metadata.FixedMetadataValue;
  22. import org.bukkit.scheduler.BukkitTask;
  23. import org.mineacademy.fo.Common;
  24. import org.mineacademy.fo.SerializeUtil;
  25. import org.mineacademy.fo.menu.Menu;
  26. import org.mineacademy.fo.menu.button.Button;
  27. import org.mineacademy.fo.remain.CompMetadata;
  28.  
  29. import java.util.HashMap;
  30. import java.util.List;
  31. import java.util.Map;
  32. import java.util.Set;
  33. import java.util.logging.Level;
  34.  
  35. import static org.brokenarrow.storage.util.blockVisualization.BlockVisualize.visulizeBlock;
  36.  
  37. public class HopperGuiUpgrades extends Menu implements PriceProvided {
  38.  
  39.     private static final Map<Integer, Button> buttons = new HashMap<>();
  40.     private final MetadataEnumsForGui metadataActivateLinkMode = MetadataEnumsForGui.AKTIVATE_LINK_TOCONTAINER;
  41.     public boolean linkedAction = false;
  42.     private boolean visualize;
  43.     private final Button LinkButton;
  44.     private final Button UpgradeButton;
  45.     private final Button whiteBlackListButton;
  46.     private final Button showBorder;
  47.     private static int number;
  48.     private static BukkitTask linkingmodeOn;
  49.     boolean filterSetting = true;
  50.     private final MainSettings.settingsData mainSettingsdata = MainSettings.getInstance().getSettings();
  51.  
  52.     public HopperGuiUpgrades() {
  53.  
  54.         //setSlotNumbersVisible();
  55.         //setSound();
  56.         /*setInfoButtonTitle("&6Cheststorage");
  57.         setInfoButtonMaterial(CompMaterial.POLISHED_BLACKSTONE);
  58.         getInfoButtonPosition();*/
  59.         ContainerRegistryAPI registry = ContainerRegistryAPI.getInstance();
  60.         LoadSettingsContainers containers = LoadSettingsContainers.getInstance();
  61.         MetadataEnumsForGui metadataplayer = MetadataEnumsForGui.CHEST_METADATA;
  62.         PreferenceSettingsRegisteryApi preferenceRegistery = PreferenceSettingsRegisteryApi.getInstance();
  63.         MainSettings mainsettings = MainSettings.getInstance();
  64.  
  65.         setTitle(GuiTempletsYaml.getGuiTitle("Link_Suction_Hopper_Gui"));
  66.         setSize(GuiTempletsYaml.getGuiSize("Link_Suction_Hopper_Gui"));
  67.  
  68.         LinkButton = new Button() {
  69.             final MetadataEnumsForGui metadataGui = MetadataEnumsForGui.AKTIVATE_LINK_TOCONTAINER;
  70.  
  71.             @Override
  72.             public void onClickedInMenu(Player player, Menu menu, ClickType clickType) {
  73.                 restartMenu();
  74.                 Location location = SerializeUtil.deserializeLocation(CompMetadata.getMetadata(player, metadataplayer.toString()));
  75.                 CustomContainersMainClass plugin = CustomContainersMainClass.getInstance();
  76.  
  77.                 List<Location> locationss = registry.getLinkContainerLinkedToLocation(location);
  78.  
  79.                 linkedAction = clickType.isLeftClick();
  80.                 if (linkedAction && !player.hasMetadata(metadataGui.toString()) && player.hasPermission(plugin.getName() + ".link.suction.menu.linkcontainer")) {
  81.                     player.setMetadata(metadataGui.toString(), new FixedMetadataValue(metadataGui.getPlugin(), linkedAction));
  82.                     if (locationss != null) {
  83.                         for (Location loc : locationss) {
  84.                             visulizeBlock(loc.getBlock(), location, true);
  85.                         }
  86.  
  87.                         visualize = true;
  88.                         Common.runLater(30, player::closeInventory);
  89.                         if (preferenceRegistery.isTimerSettingWhenLinkHopper(player.getUniqueId())) {
  90.                             ChatMessages.WHEN_ACTIVATE_LINKMODE.sendMessage(player, mainsettings.getSettings().getTimeBeforeItTurnOff(), location.getWorld().getName(), location.getX(), location.getY(), location.getZ());
  91.  
  92.                             linkingmodeOn = Common.runLater(mainsettings.getSettings().getTimeBeforeItTurnOff() * 20, () -> {
  93.                                 player.removeMetadata(metadataActivateLinkMode.toString(), metadataActivateLinkMode.getPlugin());
  94.                                 ChatMessages.WHEN_LINKMODE_TURNOFF.sendMessage(player);
  95.  
  96.                                 for (Location loc : locationss) {
  97.                                     visulizeBlock(loc.getBlock(), location, false);
  98.                                 }
  99.                                 visualize = false;
  100.                             });
  101.  
  102.                         } else {
  103.                             ChatMessages.WHEN_ACTIVATE_LINKMODE_NO_TIME_LIMIT.sendMessage(player, location.getWorld().getName(), location.getX(), location.getY(), location.getZ());
  104.                         }
  105.                     }
  106.                     restartMenu();
  107.  
  108.                 } else if (!linkedAction && player.hasMetadata(metadataGui.toString()) && player.hasPermission(plugin.getName() + ".link.suction.menu.linkcontainer")) {
  109.                     player.removeMetadata(metadataGui.toString(), metadataGui.getPlugin());
  110.                     if (linkingmodeOn != null && (Bukkit.getScheduler().isCurrentlyRunning(linkingmodeOn.getTaskId()) || Bukkit.getScheduler().isQueued(linkingmodeOn.getTaskId()))) {
  111.                         ChatMessages.WHEN_LINKMODE_TURNOFF.sendMessage(player);
  112.                         linkingmodeOn.cancel();
  113.                     } else if (linkingmodeOn == null)
  114.                         ChatMessages.WHEN_LINKMODE_TURNOFF.sendMessage(player);
  115.                     if (locationss != null) {
  116.                         for (Location loc : locationss) {
  117.                             visulizeBlock(loc.getBlock(), location, false);
  118.                         }
  119.                         visualize = false;
  120.                     }
  121.                     restartMenu();
  122.                 } else if (!player.hasPermission(plugin.getName() + ".link.suction.menu.linkcontainer") && mainSettingsdata.isShowNeedPermissionsInConsole())
  123.                     plugin.sendLogMsg(Level.INFO, "You has not " + plugin.getName().toLowerCase() + ".link.suction.menu.linkcontainer permission");
  124.                 else if (!player.hasPermission(plugin.getName() + ".link.suction.menu.linkcontainer"))
  125.                     ChatMessages.NO_PERMISSION.sendMessage(player);
  126.             }
  127.  
  128.             @Override
  129.             public ItemStack getItem() {
  130.  
  131.                 CustomContainersMainClass plugin = CustomContainersMainClass.getInstance();
  132.                 Player player = getViewer();
  133.                 String hasMetadata = CompMetadata.getMetadata(player, metadataGui.toString());
  134.                 if (hasMetadata == null && player.hasPermission(plugin.getName() + ".link.suction.menu.linkcontainer"))
  135.                     return ItemUtily.createItemStack(GuiTempletsYaml.getIcon("Link_Suction_Hopper_Gui", "Link_To_Container", null),
  136.                             GuiTempletsYaml.getDisplayName(getViewer(), "Link_Suction_Hopper_Gui", "Link_To_Container"),
  137.                             GuiTempletsYaml.getLore(getViewer(), "Link_Suction_Hopper_Gui", "Link_To_Container"));
  138.  
  139.                 else if (hasMetadata != null && player.hasPermission(plugin.getName() + ".link.suction.menu.linkcontainer"))
  140.                     return ItemUtily.createItemStack(GuiTempletsYaml.getIcon("Link_Suction_Hopper_Gui", "Link_To_Container_Active", null),
  141.                             GuiTempletsYaml.getDisplayName(getViewer(), "Link_Suction_Hopper_Gui", "Link_To_Container_Active"),
  142.                             GuiTempletsYaml.getLore(getViewer(), "Link_Suction_Hopper_Gui", "Link_To_Container_Active"));
  143.  
  144.                 else
  145.                     return ItemUtily.createItemStack(GuiTempletsYaml.getIcon("Link_Suction_Hopper_Gui", "Link_To_Container_No_Permission", null),
  146.                             GuiTempletsYaml.getDisplayName(getViewer(), "Link_Suction_Hopper_Gui", "Link_To_Container_No_Permission"),
  147.                             GuiTempletsYaml.getLore(getViewer(), "Link_Suction_Hopper_Gui", "Link_To_Container_No_Permission"));
  148.             }
  149.         };
  150.  
  151.         UpgradeButton = new Button() {
  152.             @Override
  153.             public void onClickedInMenu(Player player, Menu menu, ClickType clickType) {
  154.                 Location location = SerializeUtil.deserializeLocation(CompMetadata.getMetadata(player, metadataplayer.toString()));
  155.                 String container = registry.getContainerFileName(location);
  156.                 String nextUpdate = YamlSettingsContainers.getUpdate(container, registry.getCurrentUpdate(location));
  157.                 String currentUpdate = registry.getCurrentUpdate(location);
  158.                 CustomContainersMainClass plugin = CustomContainersMainClass.getInstance();
  159.  
  160.                 try {
  161.                     if (player.hasPermission(plugin.getName() + ".link.suction.menu.upgrade") && nextUpdate != null && !nextUpdate.equals("")) {
  162.                         if (plugin.getEconomyProvider().getProvider().getBalance(Bukkit.getOfflinePlayer(player.getUniqueId())) >= YamlSettingsContainers.getCostForUpdate(container, nextUpdate)) {
  163.                             plugin.getEconomyProvider().getProvider().withdrawAmont(Bukkit.getOfflinePlayer(player.getUniqueId()), YamlSettingsContainers.getCostForUpdate(container, nextUpdate));
  164.                             registry.setNextUppdate(location, YamlSettingsContainers.getUpdate(registry.getContainerFileName(location), currentUpdate));
  165.                             //todo Do I need this method?
  166.                             //TeleportAndPickupItemsApi.getInstance().removeCachedContainerInventory(location);
  167.  
  168.                             if (preferenceRegistery.isShowSuctionBorderWhenPlaceContainer(player.getUniqueId())) {
  169.                                 Set<Location> locations = CreateBorderEffect.spawnEffects(location, YamlSettingsContainers.getSuctionRange(registry.getContainerFileName(location), nextUpdate), 1.0, 1.0, 1.0);
  170.                                 Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> plugin.getHeavyTasks().addLoad(new SpawnBorderEffects(locations, player, location, -1, 15)));
  171.                             }
  172.                         } else
  173.                             ChatMessages.PLAYER_NOT_HAS_MONEY.sendMessage(player, YamlSettingsContainers.getCostForUpdate(container, nextUpdate));
  174.                     } else if (!player.hasPermission(plugin.getName() + ".link.suction.menu.upgrade") && mainSettingsdata.isShowNeedPermissionsInConsole())
  175.                         plugin.sendLogMsg(Level.INFO, "You has not " + plugin.getName().toLowerCase() + ".link.suction.upgrade permission");
  176.                     else if (!player.hasPermission(plugin.getName() + ".link.suction.menu.upgrade"))
  177.                         ChatMessages.NO_PERMISSION.sendMessage(player);
  178.  
  179.                     restartMenu();
  180.                 } catch (Exception ex) {
  181.                     ex.printStackTrace();
  182.                 }
  183.                 restartMenu();
  184.             }
  185.  
  186.             @Override
  187.             public ItemStack getItem() {
  188.                 Player player = getViewer().getPlayer();
  189.                 MetadataEnumsForGui metadataplayer = MetadataEnumsForGui.CHEST_METADATA;
  190.                 Location location = SerializeUtil.deserializeLocation(CompMetadata.getMetadata(player, metadataplayer.toString()));
  191.                 String containerFileName = registry.getContainerFileName(location);
  192.                 String nextUpdate = YamlSettingsContainers.getUpdate(containerFileName, registry.getCurrentUpdate(location));
  193.                 String currentUpdate = registry.getCurrentUpdate(location);
  194.                 CustomContainersMainClass plugin = CustomContainersMainClass.getInstance();
  195.                 List<String> lore;
  196.                 double currentBalance = plugin.getEconomyProvider().getProvider().getBalance(Bukkit.getOfflinePlayer(player.getUniqueId()));
  197.  
  198.                 if (!YamlSettingsContainers.getUpdate(containerFileName, currentUpdate).equals("") && YamlSettingsContainers.getUpdate(containerFileName, currentUpdate) != null)
  199.                     lore = GuiTempletsYaml.getLore(getViewer(), "Link_Suction_Hopper_Gui", currentBalance >= YamlSettingsContainers.getCostForUpdate(containerFileName, nextUpdate) ? "Upgrade" : "No_Money_Upgrade",
  200.                             YamlSettingsContainers.getCostForUpdate(containerFileName, currentUpdate),
  201.                             currentUpdate,
  202.                             YamlSettingsContainers.getLinkRangePlaceholder(containerFileName, currentUpdate),
  203.                             YamlSettingsContainers.getSuctionRangePlaceholder(containerFileName, currentUpdate),
  204.                             YamlSettingsContainers.getSecondsForPickupTeleport(containerFileName, currentUpdate),
  205.                             YamlSettingsContainers.getMaxAmountContainersCanBeLinked(containerFileName, currentUpdate),
  206.                             !registry.getLinkContainerLinkedToLocation(location).isEmpty(),
  207.                             registry.getLinkContainerLinkedToLocation(location).size(),
  208.  
  209.                             YamlSettingsContainers.getCostForUpdate(containerFileName, nextUpdate),
  210.                             YamlSettingsContainers.getUpdate(containerFileName, currentUpdate),
  211.                             YamlSettingsContainers.getLinkRangePlaceholder(containerFileName, nextUpdate),
  212.                             YamlSettingsContainers.getSuctionRangePlaceholder(containerFileName, nextUpdate),
  213.                             YamlSettingsContainers.getSecondsForPickupTeleport(containerFileName, nextUpdate),
  214.                             YamlSettingsContainers.getMaxAmountContainersCanBeLinked(containerFileName, currentUpdate));
  215.                 else
  216.                     lore = GuiTempletsYaml.getLore(getViewer(), "Link_Suction_Hopper_Gui", "Max_Upgrade",
  217.                             YamlSettingsContainers.getContainerType(containerFileName, currentUpdate),
  218.                             currentUpdate,
  219.                             YamlSettingsContainers.getLinkRangePlaceholder(containerFileName, currentUpdate),
  220.                             YamlSettingsContainers.getSuctionRangePlaceholder(containerFileName, currentUpdate),
  221.                             YamlSettingsContainers.getSecondsForPickupTeleport(containerFileName, currentUpdate),
  222.                             YamlSettingsContainers.getMaxAmountContainersCanBeLinked(containerFileName, currentUpdate),
  223.                             !registry.getLinkContainerLinkedToLocation(location).isEmpty(),
  224.                             registry.getLinkContainerLinkedToLocation(location).size());
  225.  
  226.  
  227.                 if (player.hasPermission(plugin.getName() + ".link.suction.menu.upgrade") && !YamlSettingsContainers.getUpdate(containerFileName, currentUpdate).equals("") && YamlSettingsContainers.getUpdate(containerFileName, currentUpdate) != null && (currentBalance >= YamlSettingsContainers.getCostForUpdate(containerFileName, nextUpdate)))
  228.                     return ItemUtily.createItemStack(GuiTempletsYaml.getIcon("Link_Suction_Hopper_Gui", "Upgrade", null),
  229.                             GuiTempletsYaml.getDisplayName(getViewer(), "Link_Suction_Hopper_Gui", "Upgrade"),
  230.                             lore);
  231.                 else if (player.hasPermission(plugin.getName() + ".link.suction.menu.upgrade") && (YamlSettingsContainers.getUpdate(containerFileName, currentUpdate).equals("") || YamlSettingsContainers.getUpdate(containerFileName, currentUpdate) == null))
  232.                     return ItemUtily.createItemStack(GuiTempletsYaml.getIcon("Link_Suction_Hopper_Gui", "Upgrade", null),
  233.                             GuiTempletsYaml.getDisplayName(getViewer(), "Link_Suction_Hopper_Gui", "Upgrade"),
  234.                             lore);
  235.                 else if (player.hasPermission(plugin.getName() + ".link.suction.menu.upgrade") && !YamlSettingsContainers.getUpdate(containerFileName, currentUpdate).equals("") && !(currentBalance >= YamlSettingsContainers.getCostForUpdate(containerFileName, nextUpdate)))
  236.                     return ItemUtily.createItemStack(GuiTempletsYaml.getIcon("Link_Suction_Hopper_Gui", "Upgrade", null),
  237.                             GuiTempletsYaml.getDisplayName(getViewer(), "Link_Suction_Hopper_Gui", "Upgrade"),
  238.                             lore);
  239.                 else if (!(player.hasPermission(plugin.getName() + ".link.suction.menu.upgrade")))
  240.                     return ItemUtily.createItemStack(GuiTempletsYaml.getIcon("Link_Suction_Hopper_Gui", "Upgrade_No_Permisssion", null),
  241.                             GuiTempletsYaml.getDisplayName(getViewer(), "Link_Suction_Hopper_Gui", "Upgrade_No_Permisssion"),
  242.                             GuiTempletsYaml.getLore(getViewer(), "Link_Suction_Hopper_Gui", "Upgrade_No_Permisssion",
  243.                                     YamlSettingsContainers.getCostForUpdate(containerFileName, currentUpdate),
  244.                                     currentUpdate,
  245.                                     YamlSettingsContainers.getLinkRangePlaceholder(containerFileName, currentUpdate),
  246.                                     YamlSettingsContainers.getSuctionRangePlaceholder(containerFileName, currentUpdate),
  247.                                     YamlSettingsContainers.getSecondsForPickupTeleport(containerFileName, currentUpdate),
  248.                                     YamlSettingsContainers.getMaxAmountContainersCanBeLinked(containerFileName, currentUpdate),
  249.                                     !registry.getLinkContainerLinkedToLocation(location).isEmpty(),
  250.                                     registry.getLinkContainerLinkedToLocation(location).size(),
  251.  
  252.                                     YamlSettingsContainers.getCostForUpdate(containerFileName, nextUpdate),
  253.                                     YamlSettingsContainers.getUpdate(containerFileName, currentUpdate),
  254.                                     YamlSettingsContainers.getLinkRangePlaceholder(containerFileName, nextUpdate),
  255.                                     YamlSettingsContainers.getSuctionRangePlaceholder(containerFileName, nextUpdate),
  256.                                     YamlSettingsContainers.getSecondsForPickupTeleport(containerFileName, nextUpdate),
  257.                                     YamlSettingsContainers.getMaxAmountContainersCanBeLinked(containerFileName, currentUpdate)));
  258.  
  259.                 else return null;
  260.             }
  261.         };
  262.  
  263.         whiteBlackListButton = new Button() {
  264.             private final MetadataEnumsForGui metadataFilterItemsGui = MetadataEnumsForGui.INVENTORY_FILTERGUI;
  265.             private final MetadataEnumsForGui metadataplayer = MetadataEnumsForGui.CHEST_METADATA;
  266.  
  267.             @Override
  268.             public void onClickedInMenu(Player player, Menu menu, ClickType click) {
  269.                 CustomContainersMainClass plugin = CustomContainersMainClass.getInstance();
  270.  
  271.                 Location location = SerializeUtil.deserializeLocation(CompMetadata.getMetadata(player, metadataplayer.toString()));
  272.                 boolean action = click.isLeftClick();
  273.                 if (action && player.hasPermission(plugin.getName() + ".link.suction.menu.whiteblacklist"))
  274.                     try {
  275.  
  276.                         player.setMetadata(this.metadataFilterItemsGui.toString(), new FixedMetadataValue(this.metadataFilterItemsGui.getPlugin(), this.metadataFilterItemsGui.getMetadataKey()));
  277.                         MenuHolder whiteblackmenu = plugin.getClassinstans().createObjektMenu(location, player);
  278.                         whiteblackmenu.createMenuForPlayer(player, location);
  279.  
  280.                     } catch (Exception ex) {
  281.                         ex.printStackTrace();
  282.                     }
  283.                 else if (!action && player.hasPermission(plugin.getName() + ".link.suction.menu.whiteblacklist")) {
  284.                     registry.setFilterWhiteBlack(location, !registry.isFilterWhiteBlack(location));
  285.                     menu.restartMenu();
  286.  
  287.                 } else
  288.                     ChatMessages.NO_PERMISSION.sendMessage(player);
  289.  
  290.                 if (!player.hasPermission(plugin.getName() + ".link.suction.menu.whiteblacklist") && mainSettingsdata.isShowNeedPermissionsInConsole())
  291.                     plugin.sendLogMsg(Level.INFO, "You has not " + plugin.getName().toLowerCase() + ".link.suction.menu.whiteblacklist permission");
  292.  
  293.             }
  294.  
  295.             @Override
  296.             public ItemStack getItem() {
  297.                 CustomContainersMainClass plugin = CustomContainersMainClass.getInstance();
  298.                 Player player = getViewer().getPlayer();
  299.  
  300.                 Location location = SerializeUtil.deserializeLocation(CompMetadata.getMetadata(player, metadataplayer.toString()));
  301.                 ContainerRegistryAPI registry = ContainerRegistryAPI.getInstance();
  302.  
  303.                 if (getViewer().hasPermission(plugin.getName() + ".link.suction.menu.whiteblacklist"))
  304.                     return ItemUtily.createItemStack(GuiTempletsYaml.getIcon("Link_Suction_Hopper_Gui", "White_And_Black_List", null),
  305.                             GuiTempletsYaml.getDisplayName(getViewer(), "Link_Suction_Hopper_Gui", "White_And_Black_List"),
  306.                             GuiTempletsYaml.getLore(getViewer(), "Link_Suction_Hopper_Gui", "White_And_Black_List", languageMessages(registry.isFilterWhiteBlack(location))));
  307.                 return ItemUtily.createItemStack(GuiTempletsYaml.getIcon("Link_Suction_Hopper_Gui", "White_And_Black_List_No_Permission", null),
  308.                         GuiTempletsYaml.getDisplayName(getViewer(), "Link_Suction_Hopper_Gui", "White_And_Black_List_No_Permission"),
  309.                         GuiTempletsYaml.getLore(getViewer(), "Link_Suction_Hopper_Gui", "White_And_Black_List_No_Permission", registry.isFilterWhiteBlack(location)));
  310.             }
  311.         };
  312.  
  313.         showBorder = new Button() {
  314.  
  315.             @Override
  316.             public void onClickedInMenu(Player player, Menu menu, ClickType clickType) {
  317.                 Location location = SerializeUtil.deserializeLocation(CompMetadata.getMetadata(player, metadataplayer.toString()));
  318.                 CustomContainersMainClass plugin = CustomContainersMainClass.getInstance();
  319.                 String currentUpdate = registry.getCurrentUpdate(location);
  320.  
  321.                 if (clickType.isLeftClick() && preferenceRegistery.isShowSuctionBorderWhenPlaceContainer(player.getUniqueId())) {
  322.                     Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
  323.                         Set<Location> locations = CreateBorderEffect.spawnEffects(location, YamlSettingsContainers.getSuctionRange(registry.getContainerFileName(location), currentUpdate), 1.0, 1.0, 1.0);
  324.                         SpawnBorderEffects borderEffects = new SpawnBorderEffects(locations, player, location, number, 12);
  325.                         if (!plugin.getHeavyTasks().isContainsMaxAmountInQueue(player, 5)) {
  326.                             plugin.getHeavyTasks().addLoad(borderEffects);
  327.                             plugin.getHeavyTasks().setMaxAmountEachEntityCanQueue(player, System.currentTimeMillis() + 1000 * 2, borderEffects);
  328.                         } else
  329.                             System.out.println("you has max amount ");
  330.                     });
  331.                     Common.runLater(1, player::closeInventory);
  332.                 }
  333.                 if (clickType.isRightClick()) {
  334.                     number += 1;
  335.                     if (number < 0) {
  336.                         number = 1;
  337.                     } else if (number == mainSettingsdata.getMaxShowtimeborder() + 1) {
  338.                         number = 1;
  339.                     }
  340.                 }
  341.                 menu.restartMenu();
  342.             }
  343.  
  344.             @Override
  345.             public ItemStack getItem() {
  346.                 return ItemUtily.createItemStack(GuiTempletsYaml.getIcon("Link_Suction_Hopper_Gui", "Show_Suction_Border", null),
  347.                         GuiTempletsYaml.getDisplayName(getViewer(), "Link_Suction_Hopper_Gui", "Show_Suction_Border", number, mainSettingsdata.getMaxShowtimeborder()),
  348.                         GuiTempletsYaml.getLore(getViewer(), "Link_Suction_Hopper_Gui", "Show_Suction_Border", number, mainSettingsdata.getMaxShowtimeborder()));
  349.             }
  350.         };
  351.     }
  352.  
  353.  
  354.     @Override
  355.     public ItemStack getItemAt(int slot) {
  356.  
  357.         if (GuiTempletsYaml.getSlot("Link_Suction_Hopper_Gui", "Link_To_Container").contains(slot))
  358.             return LinkButton.getItem();
  359.  
  360.         if (GuiTempletsYaml.getSlot("Link_Suction_Hopper_Gui", "Upgrade").contains(slot))
  361.             return UpgradeButton.getItem();
  362.  
  363.         if (GuiTempletsYaml.getSlot("Link_Suction_Hopper_Gui", "Show_Suction_Border").contains(slot))
  364.             return showBorder.getItem();
  365.  
  366.         if (GuiTempletsYaml.getSlot("Link_Suction_Hopper_Gui", "White_And_Black_List").contains(slot))
  367.             return whiteBlackListButton.getItem();
  368.  
  369.         return null;
  370.     }
  371.  
  372.     public String languageMessages(boolean value) {
  373.         if (value)
  374.             return ChatMessages.WHITE_LIST.languageMessages();
  375.         return ChatMessages.BLACK_LIST.languageMessages();
  376.     }
  377. /*
  378.     public List<String> translateLores(String currentUpdate, String nextUpdate, LoadSettingsContainers
  379.             containers, String containerType) {
  380.  
  381.         List<String> colectLore = new ArrayList<>();
  382.         if (containers != null) {
  383.             if (containers.getContainerType(containerType).get(currentUpdate).getNextUppgrade() != null)
  384.                 for (String lores : GuiTempletsYaml.getLore("Link_Suction_Hopper_Gui", "Link_Suction_Hopper_Gui_Upgrade")) {
  385.  
  386.                     String lore = lores.replace("{0}", String.valueOf(containers.getContainerType(containerType).get(currentUpdate).getCostUpgrade()))
  387.                             .replace("{1}", String.valueOf(currentUpdate))
  388.                             .replace("{2}", String.valueOf(containers.getContainerType(containerType).get(currentUpdate).getLinkedRange()))
  389.                             .replace("{3}", String.valueOf(containers.getContainerType(containerType).get(currentUpdate).getSuctionRange()))
  390.                             .replace("{4}", String.valueOf(containers.getContainerType(containerType).get(currentUpdate).getLinkAmont()))
  391.                             .replace("{5}", String.valueOf(containers.getContainerType(containerType).get(nextUpdate).getCostUpgrade()))
  392.                             .replace("{6}", containers.getContainerType(containerType).get(currentUpdate).getNextUppgrade())
  393.                             .replace("{7}", String.valueOf(containers.getContainerType(containerType).get(nextUpdate).getLinkedRange()))
  394.                             .replace("{8}", String.valueOf(containers.getContainerType(containerType).get(nextUpdate).getSuctionRange()))
  395.                             .replace("{9}", String.valueOf(containers.getContainerType(containerType).get(nextUpdate).getLinkAmont()));
  396.  
  397.                     colectLore.add(ChatColor.translateAlternateColorCodes('&', lore));
  398.                 }
  399.             else
  400.                 for (String loreMaxUpdate : GuiTempletsYaml.getLore("Link_Suction_Hopper_Gui", "Link_Suction_Hopper_Gui_Max_Upgrade")) {
  401.                     String loreMax = loreMaxUpdate.replace("{0}", String.valueOf(containers.getContainerType(containerType).get(currentUpdate).getCostUpgrade()))
  402.                             .replace("{1}", String.valueOf(currentUpdate))
  403.                             .replace("{2}", String.valueOf(containers.getContainerType(containerType).get(currentUpdate).getLinkedRange()))
  404.                             .replace("{3}", String.valueOf(containers.getContainerType(containerType).get(currentUpdate).getSuctionRange()))
  405.                             .replace("{4}", String.valueOf(containers.getContainerType(containerType).get(currentUpdate).getLinkAmont()));
  406.  
  407.                     colectLore.add(ChatColor.translateAlternateColorCodes('&', loreMax));
  408.                 }
  409.         }
  410.         return colectLore;
  411.     }*/
  412.  
  413.  
  414. }
  415.  
RAW Paste Data