Skip to content

Commit

Permalink
fix #100 by updating spacegui for adding cooldown
Browse files Browse the repository at this point in the history
  • Loading branch information
mastercake10 committed Oct 17, 2021
1 parent 0eeb7bc commit 842d0b8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>de.Linus122.TimeIsMoney</groupId>
<artifactId>parent</artifactId>
<version>1.9.6.20</version>
<version>1.9.6.22</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
12 changes: 7 additions & 5 deletions Plugin/src/main/java/de/Linus122/TimeIsMoney/ATM.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import net.milkbowl.vault.economy.EconomyResponse;
import net.milkbowl.vault.economy.EconomyResponse.ResponseType;
import xyz.spaceio.spacegui.SpaceGUI;
import xyz.spaceio.spacegui.helpers.StackBuilder;
import xyz.spaceio.spaceitem.DecorationMaterial;
import xyz.spaceio.spaceitem.SpaceItem;

Expand Down Expand Up @@ -87,7 +88,7 @@ public ATM(Main plugin) {

worths = Doubles.toArray(Main.finalconfig.getDoubleList("atm_worth_gradation"));

gui = new SpaceGUI().title("§cATM").size(9*3).fillBackground(new SpaceItem().setStack(DecorationMaterial.BACKGROUND_GRAY));
gui = new SpaceGUI().title("§cATM").size(9*3).fillBackground(new SpaceItem().setStack(DecorationMaterial.GRAY_STAINED_GLASS_PANE.get()));

FileConfiguration fileConfig = new YamlConfiguration();

Expand All @@ -102,16 +103,17 @@ public ATM(Main plugin) {
}

// balance item
SpaceItem balanceItem = gui.getOrCreateItem(new SpaceItem().setStack(Material.GOLD_NUGGET, 1, CC("&cBalance &a%s")).setLabel("balance"), 4 + 9)

SpaceItem balanceItem = gui.getOrCreateItem(new SpaceItem().setStack(new StackBuilder(Material.GOLD_NUGGET).setDisplayname(CC("&cBalance &a%s"))).setLabel("balance"), 4 + 9)
.setFormat((p) ->
Main.economy.format(ATM.getBankBalance(p))
);

Material[] mats = new Material[] {Material.getMaterial("CLAY_BRICK") == null ? Material.getMaterial("BRICK") : Material.getMaterial("CLAY_BRICK"), Material.IRON_INGOT, Material.GOLD_INGOT, Material.DIAMOND};
for(int i = 0; i < 4; i++) {
final int index = i;
gui.getOrCreateItem(new SpaceItem().setStack(new StackBuilder(mats[i]).setDisplayname(CC("&cWithdraw &a%s"))).setLabel("witdraw-" + i), 3 - i + 9)

gui.getOrCreateItem(new SpaceItem().setStack(mats[i], 1, CC("&cWithdraw &a%s")).setLabel("witdraw-" + i), 3 - i + 9)
.addAction((p, action) -> {
ATM.interactWithdraw(p, worths[index]);
action.getView().update(balanceItem);
Expand All @@ -120,8 +122,8 @@ public ATM(Main plugin) {
}
for(int i = 0; i < 4; i++) {
final int index = i;

gui.getOrCreateItem(new SpaceItem().setStack(mats[i], 1, CC("&cDeposit &a%s")).setLabel("deposit-" + i), 5 + i + 9)
gui.getOrCreateItem(new SpaceItem().setStack(new StackBuilder(mats[i]).setDisplayname(CC("&cDeposit &a%s"))).setLabel("deposit-" + i), 5 + i + 9)

.addAction((p, action) -> {
ATM.interactDeposit(p, worths[index]);
action.getView().update(balanceItem);
Expand Down
2 changes: 1 addition & 1 deletion Tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>de.Linus122.TimeIsMoney</groupId>
<artifactId>parent</artifactId>
<version>1.9.6.20</version>
<version>1.9.6.22</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
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>de.Linus122.TimeIsMoney</groupId>
<artifactId>parent</artifactId>
<version>1.9.6.20</version>
<version>1.9.6.22</version>
<name>TimeIsMoney</name>
<url>https://www.spigotmc.org/resources/time-is-money.12409/</url>
<packaging>pom</packaging>
Expand Down

0 comments on commit 842d0b8

Please sign in to comment.