Skip to content

Commit

Permalink
Merge pull request #37 from r3back/feature/the-assistant-update
Browse files Browse the repository at this point in the history
Updated the assistant
  • Loading branch information
r3back authored Mar 9, 2024
2 parents 255a43d + 6f4601c commit 579e55c
Show file tree
Hide file tree
Showing 91 changed files with 155 additions and 155 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ public IndividualRecipeGUI(final Box box, final BrewingRecipe brewingRecipe) {
final Item output = this.config.getOutputItem();
final Item input = this.config.getInputItem();

this.inventory.setItem(fuel.slot, ItemStackUtils.makeItem(fuel, placeholders, getIfNull(this.brewingRecipe.getFuel())));
this.inventory.setItem(output.slot, ItemStackUtils.makeItem(output, placeholders, getIfNull(this.brewingRecipe.getOutPut())));
this.inventory.setItem(input.slot, ItemStackUtils.makeItem(input, placeholders, getIfNull(this.brewingRecipe.getInput())));
this.inventory.setItem(fuel.getSlot(), ItemStackUtils.makeItem(fuel, placeholders, getIfNull(this.brewingRecipe.getFuel())));
this.inventory.setItem(output.getSlot(), ItemStackUtils.makeItem(output, placeholders, getIfNull(this.brewingRecipe.getOutPut())));
this.inventory.setItem(input.getSlot(), ItemStackUtils.makeItem(input, placeholders, getIfNull(this.brewingRecipe.getInput())));

setItem(this.config.getCloseGUI());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void onInventoryClick(final InventoryClickEvent event) {
ItemStack newItemInInv = ItemStackUtils.makeItem(config.getCombinedFilledItem(), getPlaceholders(newItem), newItem, false, false);


inventory.setItem(config.getCombinedFilledItem().slot, newItemInInv);
inventory.setItem(config.getCombinedFilledItem().getSlot(), newItemInInv);

config.getReadyToCombineSlots().forEach(slot -> inventory.setItem(slot, ItemStackUtils.makeItem(config.getReadyToCombineItem())));
//Anvil
Expand All @@ -90,7 +90,7 @@ public void onInventoryClick(final InventoryClickEvent event) {
}

if(!BukkitItemUtil.isNull(session.getResult()))
inventory.setItem(config.getCombinedFilledItem().slot, ItemStackUtils.makeItem(config.getCombinedFilledItem(), getPlaceholders(session.getResult()), session.getResult()));
inventory.setItem(config.getCombinedFilledItem().getSlot(), ItemStackUtils.makeItem(config.getCombinedFilledItem(), getPlaceholders(session.getResult()), session.getResult()));


if(answer.isError())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ public boolean isUpgradeSlot() {
}

public boolean isClickToCombineSlot() {
return slot == config.getCombineFilledItem().slot;
return slot == config.getCombineFilledItem().getSlot();
}

public boolean isPickUpSlot() {
return slot == config.getCombinedFilledItem().slot;
return slot == config.getCombinedFilledItem().getSlot();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
@UtilityClass
public final class ClickSlot {
public boolean isSlot(final int slot, final Item item) {
return item != null && item.enabled && item.slot == slot;
return item != null && item.isEnabled() && item.getSlot() == slot;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ private static List<AuctionItem> getNoExpiredItems(final AuctionSearcher searche
addContent();

if (this.page > 1) {
inventory.setItem(this.config.getPreviousPage().slot, ItemStackUtils.makeItem(this.config.getPreviousPage()));
inventory.setItem(this.config.getPreviousPage().getSlot(), ItemStackUtils.makeItem(this.config.getPreviousPage()));
}


if (hasNext) {
inventory.setItem(this.config.getNextPage().slot, ItemStackUtils.makeItem(this.config.getNextPage()));
inventory.setItem(this.config.getNextPage().getSlot(), ItemStackUtils.makeItem(this.config.getNextPage()));
}

setItem(this.config.getSortItem(), getSortPlaceholders());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public ConfirmAuctionGUI(final Box boxUtil, final UUID uuid, final AuctionSearch
.with(new Placeholder("auction_to_confirm_price", this.auctionPrice))
.get());

inventory.setItem(this.config.getAuctionItem().slot, ItemStackUtils.
inventory.setItem(this.config.getAuctionItem().getSlot(), ItemStackUtils.
makeItem(this.config.getAuctionItem(), placeholders, this.auctionItem.getItemStack()));

return inventory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ public CreateAuctionGUI(final Box boxUtil, final Player player, final AuctionSea
setItem(this.config.getCurrentItemEmpty());
setItem(this.config.getCreateAuctionEmpty(), Collections.singletonList(getIsBuyItNowPlaceholder(auctionItem)));
} else {
inventory.setItem(this.config.getCurrentItemFilled().slot, ItemStackUtils.
inventory.setItem(this.config.getCurrentItemFilled().getSlot(), ItemStackUtils.
makeItem(this.config.getCurrentItemFilled(), placeholders, auctionItem.getItemStack()));

inventory.setItem(this.config.getCreateAuctionFilled().slot, ItemStackUtils.
inventory.setItem(this.config.getCreateAuctionFilled().getSlot(), ItemStackUtils.
makeItem(this.config.getCreateAuctionFilled(), placeholders));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void addContent() {

final List<IPlaceholder> placeholders = getPlaceholders();

inventory.setItem(this.config.getAuctionItem().slot, ItemStackUtils.makeItem(this.config.getAuctionItem(), PlaceholderBuilder.create(placeholders)
inventory.setItem(this.config.getAuctionItem().getSlot(), ItemStackUtils.makeItem(this.config.getAuctionItem(), PlaceholderBuilder.create(placeholders)
.with(getBidPlaceholders(this.auctionItem))
.get(), this.auctionItem.getItemStack()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void addContent() {

final List<IPlaceholder> placeholders = getPlaceholders();

inventory.setItem(this.config.getAuctionItem().slot, ItemStackUtils.makeItem(this.config.getAuctionItem(), PlaceholderBuilder.create(placeholders)
inventory.setItem(this.config.getAuctionItem().getSlot(), ItemStackUtils.makeItem(this.config.getAuctionItem(), PlaceholderBuilder.create(placeholders)
.with(getBidPlaceholders(this.auctionItem))
.get(), this.auctionItem.getItemStack()));

Expand Down Expand Up @@ -126,9 +126,9 @@ public void addContent() {


if (this.auctionItem.getBids().size() <= 1) {
inventory.setItem(this.config.getBidHistoryEmpty().slot, ItemStackUtils.makeItem(this.config.getBidHistoryEmpty()));
inventory.setItem(this.config.getBidHistoryEmpty().getSlot(), ItemStackUtils.makeItem(this.config.getBidHistoryEmpty()));
} else {
inventory.setItem(this.config.getBidHistoryFilled().slot, ItemStackUtils.makeItem(this.config.getBidHistoryFilled(), getPlaceholders()));
inventory.setItem(this.config.getBidHistoryFilled().getSlot(), ItemStackUtils.makeItem(this.config.getBidHistoryFilled(), getPlaceholders()));

setItem(this.config.getGoBack());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ public static ItemStack makeCategoryItem(final Item item,
final LoreWrapper wrapper) {
try {
final Item item1 = ItemBuilder.of(guiDisplayItem.getIcon(), 1, 1, "", Collections.emptyList()).headData(guiDisplayItem.getTexture())
.enchanted(item.enchanted)
.enchanted(item.isEnchanted())
.build();

final ItemStack firstProcess = ItemStackUtils.makeItem(
guiDisplayItem.getIcon(),
1,
StringUtils.processMulti(item.displayName, placeholders),
StringUtils.processMulti(item.lore, placeholders));
StringUtils.processMulti(item.getDisplayName(), placeholders),
StringUtils.processMulti(item.getLore(), placeholders));

return ItemStackUtils.getFinalItem(item1, firstProcess, placeholders, wrapper);
} catch (NullPointerException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ public class BankItemStackUtils {
public static ItemStack makeUpgradeItem(Item item, List<IPlaceholder> placeholders, GUIDisplayItem guiDisplayItem, LoreWrapper wrapper){
try {
Item item1 = ItemBuilder.of(guiDisplayItem.getItem(), 1, 1, "", Collections.emptyList()).headData(guiDisplayItem.getTexture())
.enchanted(item.enchanted)
.enchanted(item.isEnchanted())
.build();

ItemStack firstProcess = ItemStackUtils.makeItem(
guiDisplayItem.getItem(),
1,
StringUtils.processMulti(item.displayName, placeholders),
StringUtils.processMulti(item.lore, placeholders));
StringUtils.processMulti(item.getDisplayName(), placeholders),
StringUtils.processMulti(item.getLore(), placeholders));

return ItemStackUtils.getFinalItem(item1, firstProcess, placeholders, wrapper);
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.qualityplus.assistant.api.util.IPlaceholder;
import com.qualityplus.assistant.lib.eu.okaeri.injector.annotation.Inject;
import com.qualityplus.assistant.util.StringUtils;
import com.qualityplus.assistant.util.number.NumberUtil;
import com.qualityplus.assistant.api.util.NumberUtil;
import com.qualityplus.assistant.util.placeholder.Placeholder;
import com.qualityplus.collections.api.box.Box;
import com.qualityplus.collections.base.collection.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.qualityplus.assistant.api.util.IPlaceholder;
import com.qualityplus.assistant.lib.eu.okaeri.injector.annotation.Inject;
import com.qualityplus.assistant.util.StringUtils;
import com.qualityplus.assistant.util.number.NumberUtil;
import com.qualityplus.assistant.api.util.NumberUtil;
import com.qualityplus.assistant.util.placeholder.Placeholder;
import com.qualityplus.collections.api.box.Box;
import com.qualityplus.collections.base.collection.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private void setCategoryItem(CollectionCategory category, UserData data){
.with(CollectionsPlaceholderUtil.getCategoryStatePlaceholder(data, category, box))
.get();

inventory.setItem(config.getCategoryItem().slot, CollectionsItemStackUtil.makeItem(config.getCategoryItem(), placeholders, category.getGuiOptions()));
inventory.setItem(config.getCategoryItem().getSlot(), CollectionsItemStackUtil.makeItem(config.getCategoryItem(), placeholders, category.getGuiOptions()));
}

private void setCollectionItems(CollectionCategory category, UserData data){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public CollectionGUI(Box box, Player player, Collection collection) {

int count = (maxPerPage * page) - maxPerPage;

inventory.setItem(config.getCategoryItem().slot, CollectionsItemStackUtil.makeItem(
inventory.setItem(config.getCategoryItem().getSlot(), CollectionsItemStackUtil.makeItem(
config.getCategoryItem(),
CollectionsPlaceholderUtil.getCollectionsPlaceholders(data, collection),
collection.getGuiOptions()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public static ItemStack makeItem(Item item, List<IPlaceholder> placeholders, GUI
ItemStack firstProcess = ItemStackUtils.makeItem(
guiOptions.getItem(),
1,
StringUtils.processMulti(item.displayName, placeholders),
StringUtils.processMulti(item.lore, placeholders));
StringUtils.processMulti(item.getDisplayName(), placeholders),
StringUtils.processMulti(item.getLore(), placeholders));

BukkitItemUtil.addCustomModelData(firstProcess, guiOptions.getCustomModelData());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.qualityplus.assistant.api.util.IPlaceholder;
import com.qualityplus.assistant.util.actionbar.ActionBarUtils;
import com.qualityplus.assistant.util.number.NumberUtil;
import com.qualityplus.assistant.api.util.NumberUtil;
import com.qualityplus.assistant.util.placeholder.Placeholder;
import com.qualityplus.assistant.util.placeholder.PlaceholderBuilder;
import com.qualityplus.collections.api.box.Box;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.qualityplus.assistant.api.util.IPlaceholder;
import com.qualityplus.assistant.lib.eu.okaeri.injector.annotation.Inject;
import com.qualityplus.assistant.util.StringUtils;
import com.qualityplus.assistant.util.number.NumberUtil;
import com.qualityplus.assistant.api.util.NumberUtil;
import com.qualityplus.crafting.api.box.Box;
import com.qualityplus.crafting.api.edition.EditionObject;
import com.qualityplus.crafting.api.edition.RecipeEdition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public RecipeBookMainGUI(Box box, UUID uuid, RecipeEdition edition) {
public @NotNull Inventory getInventory() {
InventoryUtils.fillInventory(inventory, config.getBackground());

inventory.setItem(config.getGeneralProgressItem().slot, ItemStackUtils.makeItem(
inventory.setItem(config.getGeneralProgressItem().getSlot(), ItemStackUtils.makeItem(
config.getGeneralProgressItem(),
getCategoryPlaceholders(new ArrayList<>(Recipes.values()))));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public RecipeBookSubGUI(Box box, UUID uuid, Category category, int page, RecipeE
public @NotNull Inventory getInventory() {
InventoryUtils.fillInventory(inventory, config.getBackground());

inventory.setItem(config.getCategoryItem().slot, CraftingItemStackUtil.makeCategoryItem(
inventory.setItem(config.getCategoryItem().getSlot(), CraftingItemStackUtil.makeCategoryItem(
config.getCategoryItem(),
getCategoryPlaceholders(category),
category));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
public class CraftingItemStackUtil {
public static ItemStack makeCategoryItem(Item item, List<IPlaceholder> placeholders, Category category){
try {
Item item1 = ItemBuilder.of(category.getIcon(), 1, 1, item.displayName, item.lore).headData(category.getIconTexture()).build();
Item item1 = ItemBuilder.of(category.getIcon(), 1, 1, item.getDisplayName(), item.getLore()).headData(category.getIconTexture()).build();

ItemStack firstProcess = ItemStackUtils.makeItem(
category.getIcon(),
1,
StringUtils.processMulti(item.displayName, placeholders),
StringUtils.processMulti(item.lore, placeholders));
StringUtils.processMulti(item.getDisplayName(), placeholders),
StringUtils.processMulti(item.getLore(), placeholders));

return ItemStackUtils.makeItem(item1, placeholders, firstProcess);
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.qualityplus.assistant.lib.eu.okaeri.injector.annotation.Inject;
import com.qualityplus.assistant.util.StringUtils;
import com.qualityplus.assistant.util.itemstack.ItemStackUtils;
import com.qualityplus.assistant.util.number.NumberUtil;
import com.qualityplus.assistant.api.util.NumberUtil;
import com.qualityplus.dragon.api.box.Box;
import com.qualityplus.dragon.util.DragonItemStackUtil;
import com.qualityplus.assistant.lib.eu.okaeri.commons.bukkit.time.MinecraftTimeEquivalent;;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ public Inventory getInventory() {
}

if (page > 1)
inventory.setItem(config.getPreviousPage().slot, ItemStackUtils.makeItem(config.getPreviousPage()));
inventory.setItem(config.getPreviousPage().getSlot(), ItemStackUtils.makeItem(config.getPreviousPage()));
if (hasNext)
inventory.setItem(config.getNextPage().slot, ItemStackUtils.makeItem(config.getNextPage()));
inventory.setItem(config.getNextPage().getSlot(), ItemStackUtils.makeItem(config.getNextPage()));

inventory.setItem(config.getBackToMainMenu().slot, ItemStackUtils.makeItem(config.getBackToMainMenu()));
inventory.setItem(config.getBackToMainMenu().getSlot(), ItemStackUtils.makeItem(config.getBackToMainMenu()));

inventory.setItem(config.getCloseGUI().slot, ItemStackUtils.makeItem(config.getCloseGUI()));
inventory.setItem(config.getCloseGUI().getSlot(), ItemStackUtils.makeItem(config.getCloseGUI()));

return inventory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public void onInventoryClick(InventoryClickEvent e) {
public Inventory getInventory() {
InventoryUtils.fillInventory(inventory, config.getBackground());

inventory.setItem(config.getConfirmItem().slot, ItemStackUtils.makeItem(config.getConfirmItem()));
inventory.setItem(config.getConfirmItem().getSlot(), ItemStackUtils.makeItem(config.getConfirmItem()));

inventory.setItem(config.getCancelItem().slot, ItemStackUtils.makeItem(config.getCancelItem()));
inventory.setItem(config.getCancelItem().getSlot(), ItemStackUtils.makeItem(config.getCancelItem()));

setItem(config.getCloseGUI());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ public DragonCrystalsGUI(Box box, int page) {
}

if(hasNext)
inventory.setItem(config.getNextPage().slot, ItemStackUtils.makeItem(config.getNextPage()));
inventory.setItem(config.getNextPage().getSlot(), ItemStackUtils.makeItem(config.getNextPage()));
if(page > 1)
inventory.setItem(config.getPreviousPage().slot, ItemStackUtils.makeItem(config.getPreviousPage()));
inventory.setItem(config.getPreviousPage().getSlot(), ItemStackUtils.makeItem(config.getPreviousPage()));

inventory.setItem(config.getBackToMainMenu().slot, ItemStackUtils.makeItem(config.getBackToMainMenu()));
inventory.setItem(config.getBackToMainMenu().getSlot(), ItemStackUtils.makeItem(config.getBackToMainMenu()));

inventory.setItem(config.getCloseGUI().slot, ItemStackUtils.makeItem(config.getCloseGUI()));
inventory.setItem(config.getCloseGUI().getSlot(), ItemStackUtils.makeItem(config.getCloseGUI()));

return inventory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public DragonsGUI(Box box) {
slot++;
}

inventory.setItem(config.getBackToMainMenu().slot, ItemStackUtils.makeItem(config.getBackToMainMenu()));
inventory.setItem(config.getBackToMainMenu().getSlot(), ItemStackUtils.makeItem(config.getBackToMainMenu()));

inventory.setItem(config.getCloseGUI().slot, ItemStackUtils.makeItem(config.getCloseGUI()));
inventory.setItem(config.getCloseGUI().getSlot(), ItemStackUtils.makeItem(config.getCloseGUI()));

return inventory;
}
Expand Down
Loading

0 comments on commit 579e55c

Please sign in to comment.