Skip to content

Commit

Permalink
1.3.10: BN Toggle Fix (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
symt authored Mar 29, 2021
1 parent 959bcd2 commit 77cfcd2
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 16 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ compileJava {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
version = "1.3.9"
version = "1.3.10"
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.3.9";
public static final String VERSION = "1.3.10";
public static final String prefix =
EnumChatFormatting.GOLD + "[" + EnumChatFormatting.YELLOW + "BN" + EnumChatFormatting.GOLD + "] " + EnumChatFormatting.RESET;
public static String apiKey = "";
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/dev/meyi/bn/handlers/ChestTickHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class ChestTickHandler {
@SubscribeEvent
public void onChestTick(TickEvent e) {
if (e.phase == Phase.END) {
if (Minecraft.getMinecraft().currentScreen instanceof GuiChest && BazaarNotifier.inBazaar) {
if (Minecraft.getMinecraft().currentScreen instanceof GuiChest && BazaarNotifier.inBazaar && BazaarNotifier.activeBazaar) {

IInventory chest = ((GuiChest) Minecraft.getMinecraft().currentScreen).lowerChestInventory;
String chestName = Utils
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/dev/meyi/bn/handlers/EventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public class EventHandler {

@SubscribeEvent
public void bazaarChatHandler(ClientChatReceivedEvent e) {
if (!BazaarNotifier.activeBazaar) {
return;
}
String message = Utils
.stripString(StringUtils.stripControlCodes(e.message.getUnformattedText()));
if (message.startsWith("Buy Order Setup!") || message.startsWith("Sell Offer Setup!")) {
Expand Down Expand Up @@ -71,6 +74,7 @@ public void bazaarChatHandler(ClientChatReceivedEvent e) {
// e.setCanceled(true);
BazaarNotifier.orders.remove(orderToRemove);
} else {
System.err.println("There is some error in removing your order from the list!!!");
/*
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
BazaarNotifier.prefix + EnumChatFormatting.RED
Expand Down Expand Up @@ -143,15 +147,17 @@ public void disconnectEvent(ClientDisconnectionFromServerEvent e) {

@SubscribeEvent
public void renderBazaarEvent(BackgroundDrawnEvent e) {
if (BazaarNotifier.inBazaar) {
if (BazaarNotifier.inBazaar && BazaarNotifier.activeBazaar) {
BazaarNotifier.modules.drawAllModules();
}
}

@SubscribeEvent
public void renderOutlines(RenderGameOverlayEvent.Post e) {
if (BazaarNotifier.inBazaar) {
if (BazaarNotifier.inBazaar && BazaarNotifier.activeBazaar) {
BazaarNotifier.modules.drawAllOutlines();
}
}

// TODO: Look for fix to old animations?
}
9 changes: 6 additions & 3 deletions src/main/java/dev/meyi/bn/handlers/UpdateHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,15 @@ public void onPlayerJoinEvent(FMLNetworkEvent.ClientConnectedToServerEvent event

if (latestTag.length == 3 && currentTag.length == 3) {
for (int i = 0; i < latestTag.length; i++) {
if (latestTag[i].compareTo(currentTag[i]) != 0) {
if (latestTag[i].compareTo(currentTag[i]) <= -1) {
int latestCheck = Integer.parseInt(latestTag[i]);
int currentCheck = Integer.parseInt(currentTag[i]);

if (latestCheck != currentCheck) {
if (latestCheck < currentCheck) {
Minecraft.getMinecraft().thePlayer.addChatMessage(
new ChatComponentText(BazaarNotifier.prefix + EnumChatFormatting.RED
+ "This version hasn't been released yet. Please report any bugs that you come across."));
} else if (latestTag[i].compareTo(currentTag[i]) >= 1) {
} else {
ChatComponentText updateLink = new ChatComponentText(
EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.BOLD
+ "[UPDATE LINK]");
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/bazaarConversions.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"STRING": "String",
"PACKED_ICE": "Packed Ice",
"WATER_LILY": "Lily Pad",
"RABBIT_FOOT": "Rabbit Foot",
"RABBIT_FOOT": "Rabbit's Foot",
"LOG_2": "Acacia Log",
"REDSTONE": "Redstone",
"ENCHANTED_OBSIDIAN": "Enchanted Obsidian",
Expand All @@ -97,7 +97,7 @@
"ENCHANTED_PRISMARINE_CRYSTALS": "Enchanted Prismarine Crystals",
"ENCHANTED_CARROT_STICK": "Enchanted Carrot On A Stick",
"ENCHANTED_CARROT_ON_A_STICK": "Enchanted Carrot On A Stick",
"ENCHANTED_ENDSTONE": "Enchanted Endstone",
"ENCHANTED_ENDSTONE": "Enchanted End Stone",
"ENCHANTED_LAPIS_LAZULI_BLOCK": "Enchanted Lapis Lazuli Block",
"ENCHANTED_COOKIE": "Enchanted Cookie",
"ENCHANTED_STRING": "Enchanted String",
Expand All @@ -107,7 +107,7 @@
"ENCHANTED_ACACIA_LOG": "Enchanted Acacia Log",
"SNOW_BALL": "Snow Ball",
"ENCHANTED_EGG": "Enchanted Egg",
"QUARTZ": "Quartz",
"QUARTZ": "Nether Quartz",
"RAW_BEEF": "Raw Beef",
"ENCHANTED_EYE_OF_ENDER": "Enchanted Eye of Ender",
"SAND": "Sand",
Expand Down Expand Up @@ -182,7 +182,7 @@
"UNSTABLE_FRAGMENT": "Unstable Dragon Fragment",
"SUPERIOR_FRAGMENT": "Superior Dragon Fragment",
"OLD_FRAGMENT": "Old Dragon Fragment",
"ENCHANTED_FIREWORK_ROCKET": "Enchanted Firework",
"ENCHANTED_FIREWORK_ROCKET": "Enchanted Firework Rocket",
"ENCHANTED_LAVA_BUCKET": "Enchanted Lava Bucket",
"CATALYST": "Catalyst",
"ENCHANTED_REDSTONE_LAMP": "Enchanted Redstone Lamp",
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/bazaarConversionsReversed.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"String": "STRING",
"Packed Ice": "PACKED_ICE",
"Lily Pad": "WATER_LILY",
"Rabbit Foot": "RABBIT_FOOT",
"Rabbit's Foot": "RABBIT_FOOT",
"Acacia Wood": "LOG_2",
"Redstone": "REDSTONE",
"Enchanted Obsidian": "ENCHANTED_OBSIDIAN",
Expand All @@ -96,7 +96,7 @@
"Enchanted Cactus Green": "ENCHANTED_CACTUS_GREEN",
"Enchanted Prismarine Crystals": "ENCHANTED_PRISMARINE_CRYSTALS",
"Enchanted Carrot On A Stick": "ENCHANTED_CARROT_ON_A_STICK",
"Enchanted Endstone": "ENCHANTED_ENDSTONE",
"Enchanted End Stone": "ENCHANTED_ENDSTONE",
"Enchanted Lapis Block": "ENCHANTED_LAPIS_LAZULI_BLOCK",
"Enchanted Cookie": "ENCHANTED_COOKIE",
"Enchanted String": "ENCHANTED_STRING",
Expand All @@ -106,7 +106,7 @@
"Enchanted Acacia Wood": "ENCHANTED_ACACIA_LOG",
"Snowball": "SNOW_BALL",
"Enchanted Egg": "ENCHANTED_EGG",
"Quartz": "QUARTZ",
"Nether Quartz": "QUARTZ",
"Raw Beef": "RAW_BEEF",
"Enchanted Eye of Ender": "ENCHANTED_EYE_OF_ENDER",
"Sand": "SAND",
Expand Down Expand Up @@ -181,7 +181,7 @@
"Unstable Dragon Fragment": "UNSTABLE_FRAGMENT",
"Superior Dragon Fragment": "SUPERIOR_FRAGMENT",
"Old Dragon Fragment": "OLD_FRAGMENT",
"Enchanted Firework": "ENCHANTED_FIREWORK_ROCKET",
"Enchanted Firework Rocket": "ENCHANTED_FIREWORK_ROCKET",
"Enchanted Lava Bucket": "ENCHANTED_LAVA_BUCKET",
"Catalyst": "CATALYST",
"Enchanted Redstone Lamp": "ENCHANTED_REDSTONE_LAMP",
Expand Down

0 comments on commit 77cfcd2

Please sign in to comment.