From d54e1bb0625c8d786a687707371f31e4ac62c9d0 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Fri, 29 Mar 2024 23:10:54 +0100 Subject: Add persian SkyHanni support (#1310) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- src/main/java/at/hannibal2/skyhanni/config/Features.java | 16 +++++++++++++++- .../skyhanni/config/features/dev/DebugConfig.java | 5 +++++ src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt | 7 +++++++ 3 files changed, 27 insertions(+), 1 deletion(-) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java index 5b44c1b12..7da53c5a2 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Features.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java @@ -18,10 +18,13 @@ import at.hannibal2.skyhanni.config.features.rift.RiftConfig; import at.hannibal2.skyhanni.config.features.skillprogress.SkillProgressConfig; import at.hannibal2.skyhanni.config.features.slayer.SlayerConfig; import at.hannibal2.skyhanni.config.storage.Storage; +import at.hannibal2.skyhanni.utils.LorenzUtils; import com.google.gson.annotations.Expose; import io.github.moulberry.moulconfig.Config; import io.github.moulberry.moulconfig.Social; import io.github.moulberry.moulconfig.annotations.Category; +import io.github.moulberry.moulconfig.gui.HorizontalAlign; +import io.github.moulberry.moulconfig.processor.ProcessedCategory; import net.minecraft.util.ResourceLocation; import java.util.Arrays; @@ -38,6 +41,13 @@ public class Features extends Config { return true; } + @Override + public HorizontalAlign alignCategory(ProcessedCategory category, boolean isSelected) { + if (LorenzUtils.INSTANCE.isAprilFoolsDay()) + return HorizontalAlign.RIGHT; + return super.alignCategory(category, isSelected); + } + @Override public List getSocials() { return Arrays.asList( @@ -54,7 +64,11 @@ public class Features extends Config { @Override public String getTitle() { - return "SkyHanni " + SkyHanniMod.getVersion() + " by §channibal2§r, config by §5Moulberry §rand §5nea89"; + String modName = "SkyHanni"; + if (LorenzUtils.INSTANCE.isAprilFoolsDay()) + modName = new StringBuilder().append("اسکای هانی").reverse().toString(); // Minecraft does not render RTL strings very nicely, so we reverse the string here. Not authentic, but close enough. + + return modName + " " + SkyHanniMod.getVersion() + " by §channibal2§r, config by §5Moulberry §rand §5nea89"; } /* diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/dev/DebugConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/dev/DebugConfig.java index 97d378e2d..ba57d123c 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/dev/DebugConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/dev/DebugConfig.java @@ -118,6 +118,11 @@ public class DebugConfig { @ConfigEditorBoolean public boolean currentAreaDebug = true; + @Expose + @ConfigOption(name = "Always April Fools", desc = "Always show april fools jokes.") + @ConfigEditorBoolean + public boolean alwaysFunnyTime = false; + @Expose public Position trackSoundPosition = new Position(0, 0); } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index de6793c10..6249ec54a 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -28,6 +28,8 @@ import net.minecraft.util.ChatComponentText import net.minecraftforge.fml.common.FMLCommonHandler import java.text.DecimalFormat import java.text.SimpleDateFormat +import java.time.LocalDate +import java.time.Month import java.util.Timer import java.util.TimerTask import java.util.regex.Matcher @@ -67,6 +69,11 @@ object LorenzUtils { val lastWorldSwitch get() = HypixelData.joinedWorld + val isAprilFoolsDay: Boolean + get() = SkyHanniMod.feature.dev.debug.alwaysFunnyTime || LocalDate.now().let { + it.month == Month.APRIL && it.dayOfMonth == 1 + } + fun SimpleDateFormat.formatCurrentTime(): String = this.format(System.currentTimeMillis()) fun stripVanillaMessage(originalMessage: String): String { -- cgit