diff --git a/build.gradle.kts b/build.gradle.kts index f2cae74..b89a3c5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -101,7 +101,7 @@ repositories { // Configures the libraries/dependencies for your mod. dependencies { // Adds the OneConfig library, so we can develop with it. - val oneconfig = "1.0.0-alpha.16" + val oneconfig = "1.0.0-alpha.19" implementation("org.polyfrost.oneconfig:config-impl:$oneconfig") implementation("org.polyfrost.oneconfig:commands:$oneconfig") implementation("org.polyfrost.oneconfig:events:$oneconfig") diff --git a/src/main/java/org/polyfrost/hytils/HytilsReborn.java b/src/main/java/org/polyfrost/hytils/HytilsReborn.java index 790bb69..e18612f 100644 --- a/src/main/java/org/polyfrost/hytils/HytilsReborn.java +++ b/src/main/java/org/polyfrost/hytils/HytilsReborn.java @@ -18,7 +18,7 @@ package org.polyfrost.hytils; -import org.polyfrost.oneconfig.api.ui.v1.notifications.Notifications; +import org.polyfrost.oneconfig.api.ui.v1.Notifications; import org.polyfrost.universal.ChatColor; import org.polyfrost.universal.UChat; import org.polyfrost.oneconfig.utils.v1.Multithreading; @@ -142,7 +142,7 @@ public void postInit(FMLPostInitializationEvent event) { if (HytilsConfig.chattingIntegration) { HytilsConfig.chattingIntegration = false; config.save(); - Notifications.INSTANCE.send("Hytils Reborn", "Hytils Reborn has detected Chatting, but it is not the latest version. Please update Chatting to the latest version."); + Notifications.INSTANCE.enqueue(Notifications.Type.Warning, "Hytils Reborn", "Hytils Reborn has detected Chatting, but it is not the latest version. Please update Chatting to the latest version."); } } } diff --git a/src/main/java/org/polyfrost/hytils/command/HytilsCommand.java b/src/main/java/org/polyfrost/hytils/command/HytilsCommand.java index 6f1ee72..adb3518 100644 --- a/src/main/java/org/polyfrost/hytils/command/HytilsCommand.java +++ b/src/main/java/org/polyfrost/hytils/command/HytilsCommand.java @@ -19,7 +19,7 @@ package org.polyfrost.hytils.command; import org.polyfrost.oneconfig.api.commands.v1.factories.annotated.Parameter; -import org.polyfrost.oneconfig.api.ui.v1.notifications.Notifications; +import org.polyfrost.oneconfig.api.ui.v1.Notifications; import org.polyfrost.oneconfig.utils.v1.Multithreading; import org.polyfrost.oneconfig.api.commands.v1.CommandManager; import org.polyfrost.oneconfig.api.commands.v1.factories.annotated.Command; @@ -53,47 +53,45 @@ private void gexp(@Parameter("Username") @Nullable GameProfile player, @Paramete if (player != null) { if (type == null) { if (HypixelAPIUtils.getGEXP(player.getName())) { - Notifications.INSTANCE - .send(HytilsReborn.MOD_NAME, player.getName() + " currently has " + HypixelAPIUtils.gexp + " guild EXP."); + Notifications.INSTANCE.enqueue(Notifications.Type.Info, + HytilsReborn.MOD_NAME, player.getName() + " currently has " + HypixelAPIUtils.gexp + " guild EXP."); } else { - Notifications.INSTANCE - .send(HytilsReborn.MOD_NAME, "There was a problem trying to get " + player.getName() + "'s GEXP."); + Notifications.INSTANCE.enqueue(Notifications.Type.Error, + HytilsReborn.MOD_NAME, "There was a problem trying to get " + player.getName() + "'s GEXP."); } } else { switch (type) { case DAILY: if (HypixelAPIUtils.getGEXP(player.getName())) { - Notifications.INSTANCE - .send( - HytilsReborn.MOD_NAME, + Notifications.INSTANCE.enqueue(Notifications.Type.Info, + HytilsReborn.MOD_NAME, player.getName() + " currently has " + HypixelAPIUtils.gexp + " daily guild EXP." ); } else { - Notifications.INSTANCE - .send(HytilsReborn.MOD_NAME, "There was a problem trying to get " + player.getName() + "'s daily GEXP."); + Notifications.INSTANCE.enqueue(Notifications.Type.Error, + HytilsReborn.MOD_NAME, "There was a problem trying to get " + player.getName() + "'s daily GEXP."); } break; case WEEKLY: if (HypixelAPIUtils.getWeeklyGEXP(player.getName())) { - Notifications.INSTANCE - .send( - HytilsReborn.MOD_NAME, + Notifications.INSTANCE.enqueue(Notifications.Type.Info, + HytilsReborn.MOD_NAME, player.getName() + " currently has " + HypixelAPIUtils.gexp + " weekly guild EXP." ); } else { - Notifications.INSTANCE - .send(HytilsReborn.MOD_NAME, "There was a problem trying to get " + player.getName() + "'s weekly GEXP."); + Notifications.INSTANCE.enqueue(Notifications.Type.Error, + HytilsReborn.MOD_NAME, "There was a problem trying to get " + player.getName() + "'s weekly GEXP."); } break; } } } else { if (HypixelAPIUtils.getGEXP()) { - Notifications.INSTANCE - .send(HytilsReborn.MOD_NAME, "You currently have " + HypixelAPIUtils.gexp + " guild EXP."); + Notifications.INSTANCE.enqueue(Notifications.Type.Info, + HytilsReborn.MOD_NAME, "You currently have " + HypixelAPIUtils.gexp + " guild EXP."); } else { - Notifications.INSTANCE - .send(HytilsReborn.MOD_NAME, "There was a problem trying to get your GEXP."); + Notifications.INSTANCE.enqueue(Notifications.Type.Error, + HytilsReborn.MOD_NAME, "There was a problem trying to get your GEXP."); } } }); @@ -106,37 +104,34 @@ private void winstreak(@Parameter("Username") @Nullable GameProfile player, @Par if (player != null) { if (gamemode != null) { if (HypixelAPIUtils.getWinstreak(player.getName(), gamemode.name())) { - Notifications.INSTANCE - .send( - HytilsReborn.MOD_NAME, + Notifications.INSTANCE.enqueue(Notifications.Type.Info, + HytilsReborn.MOD_NAME, player.getName() + " currently has a " + HypixelAPIUtils.winstreak + " winstreak in " + gamemode.name().toLowerCase(Locale.ENGLISH) + "." ); } else { - Notifications.INSTANCE - .send( - HytilsReborn.MOD_NAME, + Notifications.INSTANCE.enqueue(Notifications.Type.Error, + HytilsReborn.MOD_NAME, "There was a problem trying to get " + player.getName() + "'s winstreak in " + gamemode + "." ); } } else { if (HypixelAPIUtils.getWinstreak(player.getName())) { - Notifications.INSTANCE - .send( - HytilsReborn.MOD_NAME, + Notifications.INSTANCE.enqueue(Notifications.Type.Info, + HytilsReborn.MOD_NAME, player.getName() + " currently has a " + HypixelAPIUtils.winstreak + " winstreak." ); } else { - Notifications.INSTANCE - .send(HytilsReborn.MOD_NAME, "There was a problem trying to get " + player.getName() + "'s winstreak."); + Notifications.INSTANCE.enqueue(Notifications.Type.Error, + HytilsReborn.MOD_NAME, "There was a problem trying to get " + player.getName() + "'s winstreak."); } } } else { if (HypixelAPIUtils.getWinstreak()) { - Notifications.INSTANCE - .send(HytilsReborn.MOD_NAME, "You currently have a " + HypixelAPIUtils.winstreak + " winstreak."); + Notifications.INSTANCE.enqueue(Notifications.Type.Info, + HytilsReborn.MOD_NAME, "You currently have a " + HypixelAPIUtils.winstreak + " winstreak."); } else { - Notifications.INSTANCE - .send(HytilsReborn.MOD_NAME, "There was a problem trying to get your winstreak."); + Notifications.INSTANCE.enqueue(Notifications.Type.Error, + HytilsReborn.MOD_NAME, "There was a problem trying to get your winstreak."); } } }); diff --git a/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java b/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java index ae86886..50b53c4 100644 --- a/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java +++ b/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java @@ -20,7 +20,7 @@ import org.polyfrost.oneconfig.api.config.v1.Config; import org.polyfrost.oneconfig.api.config.v1.annotations.*; -import org.polyfrost.oneconfig.api.ui.v1.notifications.Notifications; +import org.polyfrost.oneconfig.api.ui.v1.Notifications; import org.polyfrost.polyui.color.PolyColor; import org.polyfrost.hytils.HytilsReborn; import org.polyfrost.hytils.handlers.chat.modules.modifiers.GameStartCompactor; @@ -1298,7 +1298,7 @@ public HytilsConfig() { e.printStackTrace(); } - Notifications.INSTANCE.send("Hytils Reborn", "AutoGG settings have been migrated to Hytils Reborn. You can now configure them in the Hytils Reborn settings, and remove Sk1erLLC's AutoGG.", null, Units.seconds(5)); + Notifications.INSTANCE.enqueue(Notifications.Type.Warning, "Hytils Reborn", "AutoGG settings have been migrated to Hytils Reborn. You can now configure them in the Hytils Reborn settings, and remove Sk1erLLC's AutoGG.", Units.seconds(5)); } try { @@ -1391,7 +1391,7 @@ public HytilsConfig() { } if (modified) { - Notifications.INSTANCE.send("Hytils Reborn", "Lobby Sounds settings have been migrated to Hytils Reborn. You can now configure them in the Hytils Reborn settings, and remove Sk1erLLC's Lobby Sounds.", null, Units.seconds(5)); + Notifications.INSTANCE.enqueue(Notifications.Type.Warning, "Hytils Reborn", "Lobby Sounds settings have been migrated to Hytils Reborn. You can now configure them in the Hytils Reborn settings, and remove Sk1erLLC's Lobby Sounds.", Units.seconds(5)); } } catch (ClassNotFoundException ignored) { diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoChatSwapper.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoChatSwapper.java index 1b16640..efd4d9e 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoChatSwapper.java +++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoChatSwapper.java @@ -18,8 +18,6 @@ package org.polyfrost.hytils.handlers.chat.modules.triggers; -import org.polyfrost.oneconfig.api.ui.v1.notifications.Notifications; -import org.polyfrost.polyui.unit.Units; import org.polyfrost.universal.wrappers.message.UTextComponent; import org.polyfrost.oneconfig.utils.v1.Multithreading; import org.polyfrost.chatting.chat.ChatTab; @@ -58,9 +56,10 @@ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { Optional optional = ChatTabs.INSTANCE.getTabs().stream().filter((tab) -> (StringUtils.startsWithIgnoreCase(((ChatTab) tab).getPrefix(), "/ac") || ((ChatTab) tab).getPrefix().isEmpty())).findFirst(); if (optional.isPresent()) { ChatTabs.INSTANCE.setCurrentTab(((ChatTab) optional.get())); - Notifications.INSTANCE.send("Hytils Reborn", "Hytils Reborn has automatically switched to the " + ChatTabs.INSTANCE.getCurrentTab().getName() + " chat tab. Click to revert.", null, Units.seconds(4), null, () -> { - ChatTabs.INSTANCE.setCurrentTab(currentTab); - }); + //Notifications.INSTANCE.send("Hytils Reborn", "Hytils Reborn has automatically switched to the " + ChatTabs.INSTANCE.getCurrentTab().getName() + " chat tab. Click to revert.", null, Units.seconds(4), null, () -> { + // ChatTabs.INSTANCE.setCurrentTab(currentTab); + //}); + //todo } } break; @@ -71,9 +70,10 @@ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { Optional optional = ChatTabs.INSTANCE.getTabs().stream().filter((tab) -> StringUtils.startsWithIgnoreCase(((ChatTab) tab).getPrefix(), "/gc")).findFirst(); if (optional.isPresent()) { ChatTabs.INSTANCE.setCurrentTab(((ChatTab) optional.get())); - Notifications.INSTANCE.send("Hytils Reborn", "Hytils Reborn has automatically switched to the " + ChatTabs.INSTANCE.getCurrentTab().getName() + " chat tab. Click to revert.", null, Units.seconds(4), null, () -> { - ChatTabs.INSTANCE.setCurrentTab(currentTab); - }); + //Notifications.INSTANCE.send("Hytils Reborn", "Hytils Reborn has automatically switched to the " + ChatTabs.INSTANCE.getCurrentTab().getName() + " chat tab. Click to revert.", null, Units.seconds(4), null, () -> { + // ChatTabs.INSTANCE.setCurrentTab(currentTab); + //}); + //todo } } break; @@ -84,9 +84,10 @@ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { Optional optional = ChatTabs.INSTANCE.getTabs().stream().filter((tab) -> StringUtils.startsWithIgnoreCase(((ChatTab) tab).getPrefix(), "/oc")).findFirst(); if (optional.isPresent()) { ChatTabs.INSTANCE.setCurrentTab(((ChatTab) optional.get())); - Notifications.INSTANCE.send("Hytils Reborn", "Hytils Reborn has automatically switched to the " + ChatTabs.INSTANCE.getCurrentTab().getName() + " chat tab. Click to revert.", null, Units.seconds(4), null, () -> { - ChatTabs.INSTANCE.setCurrentTab(currentTab); - }); + //Notifications.INSTANCE.send("Hytils Reborn", "Hytils Reborn has automatically switched to the " + ChatTabs.INSTANCE.getCurrentTab().getName() + " chat tab. Click to revert.", null, Units.seconds(4), null, () -> { + // ChatTabs.INSTANCE.setCurrentTab(currentTab); + //}); + //todo } } break; @@ -99,9 +100,10 @@ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { Optional optional = ChatTabs.INSTANCE.getTabs().stream().filter((tab) -> StringUtils.startsWithIgnoreCase(((ChatTab) tab).getPrefix(), "/pc")).findFirst(); if (optional.isPresent()) { ChatTabs.INSTANCE.setCurrentTab(((ChatTab) optional.get())); - Notifications.INSTANCE.send("Hytils Reborn", "Hytils Reborn has automatically switched to the " + ChatTabs.INSTANCE.getCurrentTab().getName() + " chat tab. Click to revert.", null, Units.seconds(4), null, () -> { - ChatTabs.INSTANCE.setCurrentTab(currentTab); - }); + //Notifications.INSTANCE.enqueue(Notifications.Type.Info, "Hytils Reborn", "Hytils Reborn has automatically switched to the " + ChatTabs.INSTANCE.getCurrentTab().getName() + " chat tab. Click to revert.", null, Units.seconds(4), null, () -> { + // ChatTabs.INSTANCE.setCurrentTab(currentTab); + //}); + //todo } } } diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoFriend.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoFriend.java index e8bae2a..bfc3c0b 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoFriend.java +++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoFriend.java @@ -23,7 +23,7 @@ import org.polyfrost.hytils.handlers.chat.ChatReceiveModule; import net.minecraftforge.client.event.ClientChatReceivedEvent; import org.jetbrains.annotations.NotNull; -import org.polyfrost.oneconfig.api.ui.v1.notifications.Notifications; +import org.polyfrost.oneconfig.api.ui.v1.Notifications; import java.util.regex.Matcher; @@ -46,7 +46,7 @@ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { } event.setCanceled(true); HytilsReborn.INSTANCE.getCommandQueue().queue("/friend " + name); - Notifications.INSTANCE.send(HytilsReborn.MOD_NAME, "Automatically added " + name + " to your friend list."); + Notifications.INSTANCE.enqueue(Notifications.Type.Info, HytilsReborn.MOD_NAME, "Automatically added " + name + " to your friend list."); } } diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoVictory.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoVictory.java index 2c716d1..c5ca758 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoVictory.java +++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoVictory.java @@ -19,7 +19,7 @@ package org.polyfrost.hytils.handlers.chat.modules.triggers; import org.polyfrost.oneconfig.api.hypixel.v0.HypixelUtils; -import org.polyfrost.oneconfig.api.ui.v1.notifications.Notifications; +import org.polyfrost.oneconfig.api.ui.v1.Notifications; import org.polyfrost.universal.wrappers.message.UTextComponent; import org.polyfrost.oneconfig.utils.v1.Multithreading; import org.polyfrost.hytils.HytilsReborn; @@ -80,7 +80,7 @@ private void doNotification() { try { if (HypixelAPIUtils.getGEXP()) { Notifications.INSTANCE - .send( + .enqueue(Notifications.Type.Info, HytilsReborn.MOD_NAME, "You currently have " + HypixelAPIUtils.gexp + " daily guild EXP." ); @@ -90,12 +90,12 @@ private void doNotification() { } Notifications.INSTANCE - .send(HytilsReborn.MOD_NAME, "There was a problem trying to get your GEXP."); + .enqueue(Notifications.Type.Error, HytilsReborn.MOD_NAME, "There was a problem trying to get your GEXP."); } else { try { if (HypixelAPIUtils.getWeeklyGEXP()) { Notifications.INSTANCE - .send( + .enqueue(Notifications.Type.Info, HytilsReborn.MOD_NAME, "You currently have " + HypixelAPIUtils.gexp + " weekly guild EXP." ); @@ -105,13 +105,14 @@ private void doNotification() { } Notifications.INSTANCE - .send(HytilsReborn.MOD_NAME, "There was a problem trying to get your GEXP."); + .enqueue(Notifications.Type.Error, HytilsReborn.MOD_NAME, "There was a problem trying to get your GEXP."); } } if (isSupportedMode(HypixelUtils.getLocation()) && HytilsConfig.autoGetWinstreak) { try { if (HypixelAPIUtils.getWinstreak()) { - Notifications.INSTANCE.send( + Notifications.INSTANCE + .enqueue(Notifications.Type.Info, HytilsReborn.MOD_NAME, "You currently have a " + HypixelAPIUtils.winstreak + " winstreak." ); @@ -121,7 +122,7 @@ private void doNotification() { } Notifications.INSTANCE - .send(HytilsReborn.MOD_NAME, "There was a problem trying to get your winstreak."); + .enqueue(Notifications.Type.Error, HytilsReborn.MOD_NAME, "There was a problem trying to get your winstreak."); } } diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/SilentRemoval.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/SilentRemoval.java index 022e29a..6d67539 100644 --- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/SilentRemoval.java +++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/SilentRemoval.java @@ -23,7 +23,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.client.event.ClientChatReceivedEvent; import org.jetbrains.annotations.NotNull; -import org.polyfrost.oneconfig.api.ui.v1.notifications.Notifications; +import org.polyfrost.oneconfig.api.ui.v1.Notifications; import java.util.HashSet; import java.util.Set; @@ -42,7 +42,7 @@ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { if (matcher.group("player").equalsIgnoreCase(friend)) { HytilsReborn.INSTANCE.getCommandQueue().queue("/f remove " + friend); silentUsers.remove(friend); - Notifications.INSTANCE.send("Hytils Reborn", "Silently removed " + friend + " from your friends list."); + Notifications.INSTANCE.enqueue(Notifications.Type.Warning, "Hytils Reborn", "Silently removed " + friend + " from your friends list."); } } } diff --git a/src/main/java/org/polyfrost/hytils/mixin/EntityLivingBaseMixin_MiningFatigue.java b/src/main/java/org/polyfrost/hytils/mixin/EntityLivingBaseMixin_MiningFatigue.java index 7f1cc4b..c28d6b9 100644 --- a/src/main/java/org/polyfrost/hytils/mixin/EntityLivingBaseMixin_MiningFatigue.java +++ b/src/main/java/org/polyfrost/hytils/mixin/EntityLivingBaseMixin_MiningFatigue.java @@ -25,7 +25,7 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import org.polyfrost.oneconfig.api.hypixel.v0.HypixelUtils; -import org.polyfrost.oneconfig.api.ui.v1.notifications.Notifications; +import org.polyfrost.oneconfig.api.ui.v1.Notifications; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; @@ -40,7 +40,7 @@ public class EntityLivingBaseMixin_MiningFatigue { @Inject(method = "addPotionEffect", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/EntityLivingBase;onNewPotionEffect(Lnet/minecraft/potion/PotionEffect;)V")) private void hytils$onPotionEffect(PotionEffect potioneffectIn, CallbackInfo ci) { if (HytilsConfig.notifyMiningFatigue && potioneffectIn.getPotionID() == Potion.digSlowdown.getId() && (hytils$this instanceof EntityPlayerSP) && (!HytilsConfig.disableNotifyMiningFatigueSkyblock || !(HypixelUtils.getLocation().getGameType().orElse(null) == GameType.SKYBLOCK))) { - Notifications.INSTANCE.send("Hytils Reborn", "You have mining fatigue!"); + Notifications.INSTANCE.enqueue(Notifications.Type.Warning, "Hytils Reborn", "You have mining fatigue!"); } } }