-
-
Notifications
You must be signed in to change notification settings - Fork 79
Small fixes #712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
vicente-pixel
wants to merge
4
commits into
Swofty-Developments:master
from
vicente-pixel:small-fixes
Closed
Small fixes #712
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,10 +37,10 @@ public ItemStack.Builder getItem(HypixelPlayer p) { | |
| return ItemStackCreator.getStack("§aYour whole purse", Material.CHEST, 64, | ||
| "§8Bank deposit", | ||
| " ", | ||
| "§7Current balance: §6" + StringUtility.decimalify( | ||
| player.getSkyblockDataHandler().get(net.swofty.type.skyblockgeneric.data.SkyBlockDataHandler.Data.BANK_DATA, DatapointBankData.class).getValue().getAmount(), 1 | ||
| "§7Current balance: §6" + formatCoinAmount( | ||
| player.getSkyblockDataHandler().get(net.swofty.type.skyblockgeneric.data.SkyBlockDataHandler.Data.BANK_DATA, DatapointBankData.class).getValue().getAmount() | ||
| ), | ||
| "§7Amount to deposit: §6" + StringUtility.decimalify(player.getCoins(), 1), | ||
| "§7Amount to deposit: §6" + formatCoinAmount(player.getCoins()), | ||
| " ", | ||
| "§eClick to deposit coins!" | ||
| ); | ||
|
|
@@ -61,10 +61,10 @@ public ItemStack.Builder getItem(HypixelPlayer p) { | |
| return ItemStackCreator.getStack("§aHalf of your purse", Material.CHEST, 32, | ||
| "§8Bank deposit", | ||
| " ", | ||
| "§7Current balance: §6" + StringUtility.decimalify( | ||
| player.getSkyblockDataHandler().get(net.swofty.type.skyblockgeneric.data.SkyBlockDataHandler.Data.BANK_DATA, DatapointBankData.class).getValue().getAmount(), 1 | ||
| "§7Current balance: §6" + formatCoinAmount( | ||
| player.getSkyblockDataHandler().get(net.swofty.type.skyblockgeneric.data.SkyBlockDataHandler.Data.BANK_DATA, DatapointBankData.class).getValue().getAmount() | ||
| ), | ||
| "§7Amount to deposit: §6" + StringUtility.decimalify(player.getCoins() / 2, 1), | ||
| "§7Amount to deposit: §6" + formatCoinAmount(player.getCoins() / 2), | ||
| " ", | ||
| "§eClick to deposit coins!" | ||
| ); | ||
|
|
@@ -107,8 +107,8 @@ public ItemStack.Builder getItem(HypixelPlayer p) { | |
| return ItemStackCreator.getStack("§aCustom amount", Material.OAK_SIGN, 1, | ||
| "§8Bank deposit", | ||
| " ", | ||
| "§7Current balance: §6" + StringUtility.decimalify( | ||
| player.getSkyblockDataHandler().get(net.swofty.type.skyblockgeneric.data.SkyBlockDataHandler.Data.BANK_DATA, DatapointBankData.class).getValue().getAmount(), 1 | ||
| "§7Current balance: §6" + formatCoinAmount( | ||
| player.getSkyblockDataHandler().get(net.swofty.type.skyblockgeneric.data.SkyBlockDataHandler.Data.BANK_DATA, DatapointBankData.class).getValue().getAmount() | ||
| ), | ||
| "§7Amount to deposit: §6Custom", | ||
| " ", | ||
|
|
@@ -151,8 +151,8 @@ private void attemptDeposit(SkyBlockPlayer player, double amount) { | |
| player.getUsername() | ||
| )); | ||
|
|
||
| player.sendMessage("§aYou have deposited §6" + StringUtility.decimalify(amount, 1) + " coins§a! You now have §6" + | ||
| StringUtility.decimalify(bankData.getAmount(), 1) | ||
| player.sendMessage("§aYou have deposited §6" + formatCoinAmount(amount) + " coins§a! You now have §6" + | ||
| formatCoinAmount(bankData.getAmount()) | ||
| + " coins§a in your account."); | ||
| return; | ||
| } | ||
|
|
@@ -178,8 +178,8 @@ private void attemptDeposit(SkyBlockPlayer player, double amount) { | |
| latestBankData.addTransaction(new DatapointBankData.Transaction( | ||
| System.currentTimeMillis(), amount, player.getUsername())); | ||
|
|
||
| player.sendMessage("§aYou have deposited §6" + StringUtility.decimalify(amount, 1) + | ||
| " coins§a! You now have §6" + StringUtility.decimalify(latestBankData.getAmount(), 1) + | ||
| player.sendMessage("§aYou have deposited §6" + formatCoinAmount(amount) + | ||
| " coins§a! You now have §6" + formatCoinAmount(latestBankData.getAmount()) + | ||
| " coins§a in your account."); | ||
|
|
||
| return latestBankData; // Return modified data to be propagated to all servers | ||
|
|
@@ -199,4 +199,11 @@ public boolean allowHotkeying() { | |
| public void onBottomClick(InventoryPreClickEvent e) { | ||
| e.setCancelled(true); | ||
| } | ||
|
|
||
| private String formatCoinAmount(double amount) { | ||
| if (amount >= 1000) { | ||
| return StringUtility.shortenNumber(amount).replace("K", "k"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please make a StringUtility#formatCurrency |
||
| } | ||
| return StringUtility.decimalify(amount, 1); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,7 @@ | |
|
|
||
| import java.util.ArrayList; | ||
| import java.util.Arrays; | ||
| import java.util.List; | ||
| import java.util.Objects; | ||
| import java.util.stream.Collectors; | ||
|
|
||
|
|
@@ -57,7 +58,16 @@ public void layout(ViewLayout<CraftingState> layout, CraftingState state, ViewCo | |
| Material borderMaterial = canCraft ? Material.LIME_STAINED_GLASS_PANE : Material.RED_STAINED_GLASS_PANE; | ||
| Components.fill(layout); | ||
| layout.slots(Layouts.row(5), (s, c) -> ItemStackCreator.createNamedItemStack(borderMaterial)); | ||
| Components.close(layout, 49); | ||
| layout.slot(49, (s, c) -> ItemStack.builder(Material.ARROW) | ||
| .set(DataComponents.CUSTOM_NAME, Component.text("§aGo Back")) | ||
| .set(DataComponents.LORE, List.of(Component.text("§7To SkyBlock Menu") | ||
| .decoration(TextDecoration.ITALIC, false))), | ||
| (click, c) -> { | ||
| ViewNavigator navigator = ViewNavigator.get(c.player()); | ||
| if (!navigator.pop()) { | ||
| c.player().closeInventory(); | ||
| } | ||
| }); | ||
|
Comment on lines
+61
to
+70
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the proper component that we have for this... |
||
|
|
||
| Components.containerGrid( | ||
| layout, | ||
|
|
@@ -228,4 +238,3 @@ public boolean onBottomClick(ClickContext<CraftingState> click, ViewContext ctx) | |
| public record CraftingState(int lastGridHash, SkyBlockRecipe<?> lastParsedRecipe) { | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just remove the field if you're going to do this