Skip to content
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

Added sound for Outdated order #126

Merged
merged 9 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ Join the discord server: https://discord.com/invite/wjpJSVSwvD

<hr/>

<sub>[License](https://github.com/symt/BazaarNotifier/blob/master/license.txt) | [Site](https://meyi.dev)</sub>
<sub>[License](https://github.com/symt/BazaarNotifier/blob/master/LICENSE.txt) | [Site](https://meyi.dev)</sub>
5 changes: 5 additions & 0 deletions src/main/java/dev/meyi/bn/config/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ public Configuration() {
)
public boolean showChatMessages = Defaults.SEND_CHAT_MESSAGES;

@JsonName("sendSound")
@Switch(name = "Send Sound for Outdated Orders")

public boolean sendSound = Defaults.SEND_SOUND;

@JsonName("collectionCheck")
@Switch(name = "Collection checks",
category = "Crafting Module",
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/dev/meyi/bn/json/Order.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package dev.meyi.bn.json;


import dev.meyi.bn.BazaarNotifier;
import dev.meyi.bn.json.resp.BazaarItem;
import dev.meyi.bn.utilities.RenderUtils;

public class Order {

public String product;
public int startAmount;
public double pricePerUnit;
Expand Down Expand Up @@ -113,6 +111,7 @@ public void updateStatus() {
RenderUtils.chatNotification(this, "MATCHED");
} else if (OrderStatus.OUTDATED.equals(newOrderStatus)) {
RenderUtils.chatNotification(this, "OUTDATED");
RenderUtils.sendSound(); // might be loud if multiple become oudated at the same time
}
this.orderStatus = newOrderStatus;
}
Expand All @@ -129,4 +128,4 @@ public enum OrderType {
this.longName = longName;
}
}
}
}
1 change: 1 addition & 0 deletions src/main/java/dev/meyi/bn/utilities/Defaults.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class Defaults {
public static final boolean PROFIT_PER_MIL = true;
public static final boolean COLLECTION_CHECKING = false;
public static final boolean SEND_CHAT_MESSAGES = true;
public static final boolean SEND_SOUND = false;
public static final boolean USE_BUY_ORDERS = true;
public static final boolean SUGGESTION_SHOW_ENCHANTMENTS = true;
public static final boolean BANK_RAW_DIFFERENCE = false;
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/dev/meyi/bn/utilities/RenderUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ public static int getStringWidth(String string) {
return fontRenderer.getStringWidth(string);
}

public static void sendSound() {
if (BazaarNotifier.config.sendSound) {
Minecraft.getMinecraft().thePlayer.playSound("mob.horse.donkey.death", 2.0F, 1.0F);
// TODO: add option for which sound to play (possibly)
}
}
public static void chatNotification(Order order, String notification) {
if (!BazaarNotifier.config.showChatMessages) {
return;
Expand Down
Loading