Skip to content

Commit

Permalink
oneconfig v1 alpha 19
Browse files Browse the repository at this point in the history
  • Loading branch information
Wyvest committed Jul 24, 2024
1 parent e2e57b8 commit e343a7e
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 67 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/polyfrost/hytils/HytilsReborn.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.");
}
}
}
Expand Down
63 changes: 29 additions & 34 deletions src/main/java/org/polyfrost/hytils/command/HytilsCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.");
}
}
});
Expand All @@ -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.");
}
}
});
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/polyfrost/hytils/config/HytilsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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."
);
Expand All @@ -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."
);
Expand All @@ -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."
);
Expand All @@ -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.");
}
}

Expand Down
Loading

0 comments on commit e343a7e

Please sign in to comment.