load buttons

This commit is contained in:
Ryder Belserion 2024-10-12 17:24:12 -04:00
parent 2ee5286b54
commit 92c76b642d
No known key found for this signature in database
3 changed files with 47 additions and 2 deletions

View File

@ -8,14 +8,15 @@ import com.badbones69.crazyauctions.api.guis.types.AuctionsMenu;
import com.badbones69.crazyauctions.api.guis.types.CategoriesMenu;
import com.badbones69.crazyauctions.api.guis.types.CurrentMenu;
import com.badbones69.crazyauctions.api.guis.types.ExpiredMenu;
import com.badbones69.crazyauctions.api.guis.types.transactions.BidMenu;
import com.badbones69.crazyauctions.api.guis.types.transactions.BuyingMenu;
import com.badbones69.crazyauctions.api.guis.types.other.BidMenu;
import com.badbones69.crazyauctions.api.guis.types.other.BuyingMenu;
import com.badbones69.crazyauctions.api.support.MetricsWrapper;
import com.badbones69.crazyauctions.commands.AuctionCommand;
import com.badbones69.crazyauctions.commands.AuctionTab;
import com.badbones69.crazyauctions.controllers.MarcoListener;
import com.badbones69.crazyauctions.controllers.MiscListener;
import com.badbones69.crazyauctions.currency.VaultSupport;
import com.badbones69.crazyauctions.tasks.InventoryManager;
import com.ryderbelserion.vital.paper.Vital;
import com.ryderbelserion.vital.paper.util.scheduler.FoliaRunnable;
import org.bukkit.OfflinePlayer;
@ -56,6 +57,8 @@ public class CrazyAuctions extends Vital {
.addFile(new File(getDataFolder(), "messages.yml"))
.init();
InventoryManager.loadButtons();
this.crazyManager = new CrazyManager();
FileConfiguration configuration = Files.data.getConfiguration();

View File

@ -92,6 +92,8 @@ public class AuctionCommand implements CommandExecutor {
this.crazyManager.load();
InventoryManager.loadButtons();
sender.sendMessage(Messages.RELOAD.getMessage(sender));
return true;

View File

@ -0,0 +1,40 @@
package com.badbones69.crazyauctions.tasks;
import com.badbones69.crazyauctions.api.builders.ItemBuilder;
import com.badbones69.crazyauctions.api.enums.misc.Files;
import com.badbones69.crazyauctions.api.enums.misc.Keys;
import com.badbones69.crazyauctions.api.guis.Holder;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
public class InventoryManager {
private static ItemBuilder nextButton;
private static ItemBuilder backButton;
public static void loadButtons() {
FileConfiguration config = Files.config.getConfiguration();
String next = "Settings.GUISettings.OtherSettings.NextPage";
nextButton = new ItemBuilder().setMaterial(config.getString(next + ".Item"))
.setName(config.getString(next + ".Name"))
.setLore(config.getStringList(next + ".Lore"))
.addString("NextPage", Keys.auction_button.getNamespacedKey());
final String back = "Settings.GUISettings.OtherSettings.PreviousPage";
backButton = new ItemBuilder().setMaterial(config.getString(back + ".Item"))
.setName(config.getString(back + ".Name"))
.setLore(config.getStringList(back + ".Lore"))
.addString("PreviousPage", Keys.auction_button.getNamespacedKey());
}
public static ItemBuilder getNextButton(final Player player, final Holder holder) {
return nextButton.addLorePlaceholder("{page}", String.valueOf(holder.getPage() - 1)).setTarget(player);
}
public static ItemBuilder getBackButton(final Player player, final Holder holder) {
return backButton.addLorePlaceholder("{page}", String.valueOf(holder.getPage() - 1)).setTarget(player);
}
}