Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
dan28000 committed Aug 2, 2024
1 parent db90a21 commit 4a79309
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public ShopMenu(Crate crate, Player player) {
public InventoryBuilder build() {
setTopCrates();
setTextureGlass();
setBackButton();
return this;
}

Expand Down Expand Up @@ -65,6 +66,10 @@ public void run(InventoryClickEvent e) {
player.playSound(UltimateMenuStuff.CLICK);
player.openInventory(new ShopMenu(shopMenu, newCrateNum).build().getInventory());
}

if (slot == 49) {
plugin.getCrateManager().getDatabaseManager().getUltimateMenuManager().open(player, shopMenu.getCrate());
}
}

private void setTopCrates() {
Expand Down Expand Up @@ -100,4 +105,8 @@ private void setTopCrates() {
private void setTextureGlass() {
getInventory().setItem(45, UltimateMenuStuff.SHOP_BANNER.getStack());
}

private void setBackButton() {
getInventory().setItem(49, UltimateMenuStuff.MAIN_MENU_SHOP.getStack());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public UltimateMenu(Crate crate, Player player, Component trans) {
this.totalPageAmount = crateSettingsSplit.size();
}

public UltimateMenu(Player player, Component trans, int page, int selectedCrate) {
private UltimateMenu(Player player, Component trans, int page, int selectedCrate) {
super(manager.getCrateSettingsSplit().get(page).get(selectedCrate).getCrate(), player, 54, trans);
this.currentPage = page;
this.selectedCrate = selectedCrate;
Expand All @@ -71,7 +71,7 @@ public UltimateMenu(Player player, Component trans, int page, int selectedCrate)
player.getInventory().clear();
}

public UltimateMenu(UltimateMenu ultimateMenu, Component title, int selectedCrate) {
private UltimateMenu(UltimateMenu ultimateMenu, Component title, int selectedCrate) {
this(ultimateMenu.getPlayer(), title, ultimateMenu.currentPage, selectedCrate);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class UltimateMenuStuff {
.addDisplayLore("<gray>Právě vybraný obchod");
public static final ItemBuilder SHOP_UNSELECTED = getItem(Material.RED_STAINED_GLASS_PANE, 1000007)
.addDisplayLore("<gray>Kliknutím vyberete tento obchod");
public static final ItemBuilder MAIN_MENU_SHOP = getItem(Material.CHEST, 1000008);



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,12 @@ public void onInventoryClick(InventoryClickEvent event) {
int count = rouletteStandard.getCount();
Inventory inv = event.getView().getTopInventory();
long time = rouletteStandard.getTime();
long diff = System.currentTimeMillis() - time;

if (System.currentTimeMillis() - time < 400) return;
if (diff < 400) return;

System.out.println("Count: " + count);
System.out.println("Diff: " + diff);

rouletteStandard.updateTimer();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void open(@NotNull KeyType type, boolean checkHand) {


setItem(37, UltimateMenuStuff.BORDER.getStack());
setItem(8, new ItemBuilder(Material.PLAYER_HEAD).setDisplayName("<green>Skip").getStack());
setItem(8, new ItemBuilder(Material.PLAYER_HEAD).setDisplayName("<green>Skip").setCustomModelData(1000002).getStack());

addCrateTask(new RouletteStandard(this, items, sneak).runAtFixedRate(this.plugin, 1, 2));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public void run() {
lock = true;
builder.setItem(36, glass.setCustomModelData(600).getStack());
if (!skip) builder.setItem(22, prize.getFirst().getPrize().getDisplayItem());
skip = true;
return;
}

Expand Down Expand Up @@ -175,6 +176,7 @@ public void skip() {
modelData = 64;
count = 10;
skip = true;
player.stopAllSounds();
}

public void updateTimer() {
Expand Down

0 comments on commit 4a79309

Please sign in to comment.