From 7d0875bf2218c9e03712f549baa6471221ff7140 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 10 Jun 2023 11:32:32 +0200 Subject: Added City Project Daily Reminder --- .../java/at/hannibal2/skyhanni/config/Storage.java | 3 + .../hannibal2/skyhanni/config/commands/Commands.kt | 2 + .../hannibal2/skyhanni/config/features/Misc.java | 5 ++ .../skyhanni/features/misc/CityProjectFeatures.kt | 91 ++++++++++++++++++---- 4 files changed, 85 insertions(+), 16 deletions(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/config/Storage.java b/src/main/java/at/hannibal2/skyhanni/config/Storage.java index 1807e2e22..2de960a30 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Storage.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Storage.java @@ -186,5 +186,8 @@ public class Storage { public Map farmingItems = new HashMap<>(); } } + + @Expose + public long nextCityProjectParticipationTime = 0L; } } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index 147734b30..bcddda8df 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -18,6 +18,7 @@ import at.hannibal2.skyhanni.features.garden.farming.GardenStartLocation import at.hannibal2.skyhanni.features.garden.fortuneguide.CaptureFarmingGear import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI import at.hannibal2.skyhanni.features.minion.MinionFeatures +import at.hannibal2.skyhanni.features.misc.CityProjectFeatures import at.hannibal2.skyhanni.features.misc.CollectionCounter import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager import at.hannibal2.skyhanni.features.misc.discordrpc.DiscordRPCManager @@ -61,6 +62,7 @@ object Commands { registerCommand("shshareinquis") { InquisitorWaypointShare.sendInquisitor() } registerCommand("shrpcstart") { DiscordRPCManager.startCommand() } registerCommand("shcropstartlocation") { GardenStartLocation.setLocationCommand() } + registerCommand("shstopcityprojectreminder") { CityProjectFeatures.disable() } // for users - fix bugs registerCommand("shupdaterepo") { SkyHanniMod.repo.updateRepo() } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java index bf2baef35..97a885cdc 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java @@ -381,6 +381,11 @@ public class Misc { @ConfigEditorBoolean public boolean showReady = true; + @Expose + @ConfigOption(name = "Daily Reminder", desc = "Remind every 24 hours to participate.") + @ConfigEditorBoolean + public boolean dailyReminder = true; + @Expose public Position pos = new Position(150, 150, false, true); } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CityProjectFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CityProjectFeatures.kt index bc71d58a3..3d3a0035d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CityProjectFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CityProjectFeatures.kt @@ -1,10 +1,12 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryOpenEvent +import at.hannibal2.skyhanni.features.garden.contest.FarmingContestAPI import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name @@ -12,6 +14,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.RenderUtils.highlight import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.renderables.Renderable import net.minecraft.client.Minecraft @@ -20,11 +23,53 @@ import net.minecraft.client.gui.inventory.GuiEditSign import net.minecraft.inventory.ContainerChest import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent class CityProjectFeatures { - private val config get() = SkyHanniMod.feature.misc.cityProject private var display = listOf>() private var inInventory = false + private var tick = 0 + private var lastReminderSend = 0L + private val contributeAgainPattern = "§7Contribute again: §e(?