aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md3
-rw-r--r--FEATURES.md3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/Features.java4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/CommandsFeatures.java13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/commands/WikiCommand.kt35
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt21
7 files changed, 81 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e9f80804b..034e68ff2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,9 @@
## Version 0.6
+### New Features
+- /wiki command (using hypixel-skyblock.fandom.com instead of Hypixel wiki)
+
## Version 0.5 - Minions and RNG Meter
### New Features
diff --git a/FEATURES.md b/FEATURES.md
index 803fec086..891fc8196 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -1,5 +1,8 @@
# SkyHanni - List of all Features
+## Commands
+- /wiki (using hypixel-skyblock.fandom.com instead of Hypixel wiki)
+
## Chat Filter
- Hiding annoying messages in the Hub of Hypixel (MVP player joins, other player loot boxes, prototype message, radiating generosity, HyPixel tournaments)
- Hiding Empty messages
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
index 843d4b231..81ccc5658 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
@@ -17,6 +17,7 @@ import at.hannibal2.skyhanni.features.chat.ChatFilter;
import at.hannibal2.skyhanni.features.chat.ChatManager;
import at.hannibal2.skyhanni.features.chat.NewChatFilter;
import at.hannibal2.skyhanni.features.chat.PlayerChatFilter;
+import at.hannibal2.skyhanni.features.commands.WikiCommand;
import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager;
import at.hannibal2.skyhanni.features.dungeon.*;
import at.hannibal2.skyhanni.features.fishing.SeaCreatureManager;
@@ -93,6 +94,7 @@ public class SkyHanniMod {
registerEvent(new MinionFeatures());
registerEvent(new RealTime());
registerEvent(new RngMeterInventory());
+ registerEvent(new WikiCommand());
Commands.init();
diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java
index 75674ca78..e167e9142 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/Features.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java
@@ -110,6 +110,10 @@ public class Features {
public Misc misc = new Misc();
@Expose
+ @Category(name = "Commands", desc = "Enable or disable mod commands")
+ public CommandsFeatures commands = new CommandsFeatures();
+
+ @Expose
@Category(name = "Api", desc = "Api Data")
public ApiData apiData = new ApiData();
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/CommandsFeatures.java b/src/main/java/at/hannibal2/skyhanni/config/features/CommandsFeatures.java
new file mode 100644
index 000000000..2e1c5ea8f
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/CommandsFeatures.java
@@ -0,0 +1,13 @@
+package at.hannibal2.skyhanni.config.features;
+
+import at.hannibal2.skyhanni.config.gui.core.config.annotations.ConfigEditorBoolean;
+import at.hannibal2.skyhanni.config.gui.core.config.annotations.ConfigOption;
+import com.google.gson.annotations.Expose;
+
+public class CommandsFeatures {
+
+ @Expose
+ @ConfigOption(name = "Fandom Wiki", desc = "Using §ehypixel-skyblock.fandom.com §7instead of Hypixel wiki")
+ @ConfigEditorBoolean
+ public boolean useFandomWiki = false;
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/WikiCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/WikiCommand.kt
new file mode 100644
index 000000000..d4769e651
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/commands/WikiCommand.kt
@@ -0,0 +1,35 @@
+package at.hannibal2.skyhanni.features.commands
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.PacketEvent
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.OSUtils
+import net.minecraft.network.play.client.C01PacketChatMessage
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class WikiCommand {
+
+ @SubscribeEvent
+ fun onSendPacket(event: PacketEvent.SendEvent) {
+ val packet = event.packet
+
+ if (!SkyHanniMod.feature.commands.useFandomWiki) return
+
+ if (packet is C01PacketChatMessage) {
+ val message = packet.message.lowercase()
+ if (message == "/wiki") {
+ event.isCanceled = true
+ OSUtils.openBrowser("https://hypixel-skyblock.fandom.com/wiki/Hypixel_SkyBlock_Wiki")
+ LorenzUtils.chat("§e[SkyHanni] Opening the Fandom Wiki..")
+ }
+ if (message.startsWith("/wiki ")) {
+ event.isCanceled = true
+ val search = packet.message.substring(6)
+ LorenzUtils.chat("§e[SkyHanni] Searching the Fandom Wiki for §c$search")
+
+ val url = "https://www.google.com/search?q=inurl%3Ahypixel-skyblock.fandom.com $search&hl=en"
+ OSUtils.openBrowser(url.replace(' ', '+'))
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt
new file mode 100644
index 000000000..5633e7f72
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt
@@ -0,0 +1,21 @@
+package at.hannibal2.skyhanni.utils
+
+import java.awt.Desktop
+import java.io.IOException
+import java.net.URI
+
+object OSUtils {
+
+ fun openBrowser(url: String) {
+ if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
+ try {
+ Desktop.getDesktop().browse(URI(url))
+ } catch (e: IOException) {
+ e.printStackTrace()
+ LorenzUtils.error("[SkyHanni] Error opening website!")
+ }
+ } else {
+ LorenzUtils.warning("[SkyHanni] Web browser is not supported!")
+ }
+ }
+} \ No newline at end of file