Skip to content

Commit

Permalink
1.7.3: Crash fix, bug fix, and better order tracking (#139)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Detlev1 <[email protected]>
  • Loading branch information
symt and Detlev1 authored Aug 10, 2024
1 parent 2b3cea8 commit 5e86d2c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
10 changes: 5 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {
}

group = "dev.meyi.bazaarnotifier"
version = "1.7.2"
version = "1.7.3"
val mod_id = "bazaarnotifier"

java {
Expand Down Expand Up @@ -48,7 +48,7 @@ dependencies {
mappings("de.oceanlabs.mcp:mcp_stable:22-1.8.9")
forge("net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9")
modCompileOnly("cc.polyfrost:oneconfig-1.8.9-forge:0.2.2-alpha+")
shade("cc.polyfrost:oneconfig-wrapper-launchwrapper:1.0.0-beta+")
shade("cc.polyfrost:oneconfig-wrapper-launchwrapper:1.0.0-beta17")
}


Expand Down Expand Up @@ -131,9 +131,9 @@ tasks{
archiveClassifier.set("")
enabled = false
}
processResources {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
processResources {
duplicatesStrategy = DuplicatesStrategy.INCLUDE

}
}
}
}
2 changes: 1 addition & 1 deletion src/main/java/dev/meyi/bn/BazaarNotifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
public class BazaarNotifier {

public static final String MODID = "BazaarNotifier";
public static final String VERSION = "1.7.2";
public static final String VERSION = "1.7.3";
public static final String prefix =
EnumChatFormatting.GOLD + "[" + EnumChatFormatting.YELLOW + "BN" + EnumChatFormatting.GOLD
+ "] " + EnumChatFormatting.RESET;
Expand Down
12 changes: 10 additions & 2 deletions src/main/java/dev/meyi/bn/json/Order.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class Order {
public OrderStatus orderStatus = OrderStatus.SEARCHING;
public double orderValue;
public OrderType type;
public long creationTime;
private int amountRemaining;

public Order(String product, int startAmount, double pricePerUnit, String priceString,
Expand All @@ -25,6 +26,7 @@ public Order(String product, int startAmount, double pricePerUnit, String priceS
this.priceString = priceString;
this.type = type;
orderValue = startAmount * pricePerUnit;
creationTime = System.currentTimeMillis();
}

public Order(String product, OrderType type, double pricePerUnit, int startAmount) {
Expand Down Expand Up @@ -65,7 +67,10 @@ public void updateStatus() {
}
BazaarItem.BazaarSubItem bazaarSubItem = BazaarNotifier.bazaarDataRaw.products
.get(getProductId()).sell_summary.get(0);
if (this.pricePerUnit < bazaarSubItem.pricePerUnit) {
if(creationTime > BazaarNotifier.bazaarDataRaw.lastUpdated){
newOrderStatus = OrderStatus.SEARCHING;
}
else if (this.pricePerUnit < bazaarSubItem.pricePerUnit) {
newOrderStatus = OrderStatus.OUTDATED;
} else if (this.pricePerUnit == bazaarSubItem.pricePerUnit
&& this.startAmount >= bazaarSubItem.amount
Expand All @@ -89,7 +94,10 @@ public void updateStatus() {
}
BazaarItem.BazaarSubItem bazaarSubItem = BazaarNotifier.bazaarDataRaw.products
.get(getProductId()).buy_summary.get(0);
if (this.pricePerUnit > bazaarSubItem.pricePerUnit) {
if(creationTime > BazaarNotifier.bazaarDataRaw.lastUpdated){
newOrderStatus = OrderStatus.SEARCHING;
}
else if (this.pricePerUnit > bazaarSubItem.pricePerUnit) {
newOrderStatus = OrderStatus.OUTDATED;
} else if (this.pricePerUnit == bazaarSubItem.pricePerUnit
&& this.startAmount >= bazaarSubItem.amount && bazaarSubItem.orders == 1) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/dev/meyi/bn/modules/Module.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public abstract class Module extends Hud {
protected boolean showEverywhere = false;

public Module() {
super(true, 20, 20, 2, 1);
super(true, 0, 0, 0, 1);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ public void highlightOrder(int hoveredText) {
if (item == null
|| Item.itemRegistry.getIDForObject(item.getItem()) == 160
|| Item.itemRegistry.getIDForObject(item.getItem()) == 102
|| Item.itemRegistry.getIDForObject(item.getItem()) == 154
|| Item.itemRegistry.getIDForObject(item.getItem()) == 262) {
continue;
}
Expand Down

0 comments on commit 5e86d2c

Please sign in to comment.