Skip to content

Commit

Permalink
1.4.12: Fixed alpha chat message changes (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
symt authored Jul 26, 2022
1 parent 07d0742 commit 39a6043
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ compileJava {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
version = "1.4.11"
version = "1.4.12"
group = "dev.meyi.bn"
archivesBaseName = "BazaarNotifier"

Expand Down
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 @@ -28,7 +28,7 @@
public class BazaarNotifier {

public static final String MODID = "BazaarNotifier";
public static final String VERSION = "1.4.11";
public static final String VERSION = "1.4.12";
public static final String prefix =
EnumChatFormatting.GOLD + "[" + EnumChatFormatting.YELLOW + "BN" + EnumChatFormatting.GOLD + "] " + EnumChatFormatting.RESET;
public static String apiKey = "";
Expand Down
18 changes: 14 additions & 4 deletions src/main/java/dev/meyi/bn/handlers/ChestTickHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import dev.meyi.bn.utilities.Utils;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.inventory.IInventory;
Expand Down Expand Up @@ -39,10 +41,18 @@ public static void updateBazaarOrders(IInventory chest) {
lore.add(StringUtils.stripControlCodes(lorePreFilter.getStringTagAt(j)));
}

String displayName = StringUtils
.stripControlCodes(chest.getStackInSlot(i).getDisplayName().split(": ")[1]);
String type = StringUtils.stripControlCodes(
chest.getStackInSlot(i).getDisplayName().split(": ")[0].toLowerCase());
Pattern p = Pattern
.compile("(BUY|SELL):? (.*)");
Matcher m = p.matcher(StringUtils.stripControlCodes(chest.getStackInSlot(i).getDisplayName()));
String displayName = "";
String type = "";
if (m.find()) {
displayName = m.group(2);
type = m.group(1).toLowerCase();
} else {
System.out.println("Bazaar item header incorrect. Aborting!");
return;
}

if (BazaarNotifier.bazaarConversionsReversed.has(displayName)) {
int amountLeft = -1;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/dev/meyi/bn/handlers/EventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void bazaarChatHandler(ClientChatReceivedEvent e) {
return;
}
String message = StringUtils.stripControlCodes(e.message.getUnformattedText());
if (message.startsWith("Buy Order Setup!") || message.startsWith("Sell Offer Setup!")) {
if (message.startsWith("Buy Order Setup!") || message.startsWith("Sell Offer Setup!") || message.startsWith("[Bazaar] Buy Order Setup!") || message.startsWith("[Bazaar] Sell Offer Setup!")) {
if (productVerify[0] != null && productVerify[1] != null && productVerify[0]
.equals(BazaarNotifier.bazaarConversionsReversed
.getString(message.split("x ", 2)[1].split(" for ")[0])) && productVerify[1]
Expand Down Expand Up @@ -70,7 +70,7 @@ public void bazaarChatHandler(ClientChatReceivedEvent e) {
} else {
System.err.println("There is some error in removing your order from the list!!!");
}
} else if (message.startsWith("Cancelled!")) {
} else if (message.startsWith("Cancelled!") || message.startsWith("[Bazaar] Cancelled!")) {
double refund = 0;
int refundAmount = 0;
String itemRefunded = "";
Expand Down Expand Up @@ -102,7 +102,7 @@ public void bazaarChatHandler(ClientChatReceivedEvent e) {
}
}
}
} else if (message.startsWith("Bazaar! Claimed ")) {
} else if (message.startsWith("Bazaar! Claimed ") || message.startsWith("[Bazaar] Claimed ")) {
ChestTickHandler.lastScreenDisplayName = ""; // Force update on next tick
// ChestTickHandler.updateBazaarOrders(
// ((GuiChest) Minecraft.getMinecraft().currentScreen).lowerChestInventory);
Expand Down

0 comments on commit 39a6043

Please sign in to comment.