Skip to content

Commit

Permalink
Added player limit and player count of sell chests in shop menu
Browse files Browse the repository at this point in the history
  • Loading branch information
WaterArchery committed Dec 3, 2024
1 parent cb2b75b commit 808d1d9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.waterarchery</groupId>
<artifactId>LitSellChest</artifactId>
<version>1.1.2</version>
<version>1.2.0</version>
<packaging>jar</packaging>

<name>LitSellChest</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public Inventory generateInventory(Player player) {
String name = yaml.getString(menuName + ".name");
name = mHandler.updateColors(name);

int playerChestLimit = chestHandler.getMaxPlaceableChests(player);
int playerChestCount = chestHandler.getChestCount(player);

Inventory shopGUI = Bukkit.createInventory(null, size, name);
for (String path : yaml.getConfigurationSection(menuName + ".items").getKeys(false)) {
ItemStack itemStack = guiHandler.createItem(menuName, path);
Expand All @@ -62,6 +65,8 @@ public Inventory generateInventory(Player player) {
part = part.replace("%sellMultiplier%", sellMultiplier + "");
part = part.replace("%sellInterval%", sellInterval + "");
part = part.replace("%price%", price + "");
part = part.replace("%playerLimit%", playerChestLimit + "");
part = part.replace("%playerCount%", playerChestCount + "");
newLore.add(part);
}
ItemMeta meta = itemStack.getItemMeta();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.waterarchery.litsellchest.handlers;

import lombok.Getter;
import me.waterarchery.litlibs.LitLibs;
import me.waterarchery.litlibs.configuration.ConfigManager;
import me.waterarchery.litlibs.handlers.MessageHandler;
Expand All @@ -22,6 +23,7 @@
import java.util.Optional;


@Getter
public class GUIHandler {

private static GUIHandler instance;
Expand Down Expand Up @@ -108,6 +110,4 @@ public ItemStack parseRawMaterial(String mat, String menuName, String path) {
return itemStack;
}

public DefaultMenu getDefaultMenu() { return defaultMenu; }
public ShopMenu getShopMenu() { return shopMenu; }
}
3 changes: 3 additions & 0 deletions src/main/resources/gui/shop_menu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ shop_menu:
- '&7'
- '&b&lBUY NOW'
- '&7Price: &b%price%'
- '&7Chest Place Limit: &b%playerLimit%/playerCount'
- '&7Click here to &bbuy now!'
chest2:
slot: 13
Expand All @@ -40,6 +41,7 @@ shop_menu:
- '&7'
- '&b&lBUY NOW'
- '&7Price: &b%price%'
- '&7Chest Place Limit: &b%playerLimit%/playerCount'
- '&7Click here to &bbuy now!'
chest3:
slot: 15
Expand All @@ -58,4 +60,5 @@ shop_menu:
- '&7'
- '&b&lBUY NOW'
- '&7Price: &b%price%'
- '&7Chest Place Limit: &b%playerLimit%/playerCount'
- '&7Click here to &bbuy now!'

0 comments on commit 808d1d9

Please sign in to comment.