Skip to content

Commit

Permalink
Merge branch 'hannibal002:beta' into openInElitebotDotDev-NO_COMMAND
Browse files Browse the repository at this point in the history
  • Loading branch information
RayDeeUx authored Jan 16, 2024
2 parents b8c8e26 + 7245a6a commit 4a131f7
Show file tree
Hide file tree
Showing 19 changed files with 222 additions and 40 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ban-imports.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Check banned imports
on:
- pull_request
- push
- workflow_dispatch
permissions: {}
jobs:
check-imports:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Checkout code
- name: Check imports
run: |
while IFS=' ' read search banned; do
echo Banning $banned from $search
grep -nrE -- "import $banned" src/main/java/"$search"|sed -E 's/^(.*):([0-9]+):(.*)/::error file=\1,line=\2::Illegal \3/g'|tee -a temp
done<<<$(cat .github/workflows/illegal-imports.txt|sed -E 's/#.*//;/^$/d')
found=$(wc -l temp|cut -d ' ' -f 1)
echo Found "$found" invalid imports. Check the files tab for more information.
if [[ "$found" -ne 0 ]]; then
exit 1
fi
6 changes: 6 additions & 0 deletions .github/workflows/illegal-imports.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ban some packages from importing some other packages.
# Lines starting with # are ignored
# Every other line needs to be in the format
# <directory without src/main/java prefix> <illegal import>

at/hannibal2/skyhanni/ scala.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,15 @@
#### Chat Changes

+ Hide new Fire Sale message format. - Thunderblade73
+ Added Hypixel Lobby chat messages "SMP" and "Snow Particles" to the Spam Filter. - walker
+ Added more messages to Hypixel Lobby spam hider.
+ SMP and Snow Particles. - walker
+ Earned mystery dust. - alexia

#### Misc Changes

+ Tia Relay Helper: Suggest /togglemusic. - alexia
+ Added option to ignore Everything Chroma in the chat. - VixidDev

### Fixes

Expand All @@ -110,6 +115,7 @@
+ Fixed Daily Kuudra part of Crimson Isle Reputation Helper not detecting completed runs. - hannibal2
+ Fixed wrong calculation when zero bosses killed in slayer profit trackers. - hannibal2
+ Hide No Fishing Bait warning during Kuudra fight. - hannibal2
+ Fixed Dungeon and Kuudra party finder join message not detecting in party member tab complete. - CalMWolfs

#### Mining Fixes

Expand All @@ -132,6 +138,7 @@
+ Fixed hide non-clickable items not working in some bazaar pages. - hannibal2
+ Fixed rogue sword ability taking into account mage cooldown reduction. - Empa
+ Reset item ability cooldowns on the world switch. - hannibal2
+ Fixed Crap Hat of Celebration not getting detected as accessory in Hide Not Clickable Items. - Empa

#### Bingo Fixes

Expand All @@ -146,6 +153,12 @@
#### GUI Fixes

+ Fixed items in SkyHanni GUI elements rendering over minecraft menus. - Thunderblade73
+ Fixed GUI Editor hotkey working while inside a NEU PV text box. - Thunderblade73

#### Winter Fixes

+ Fixed Unique Gifting Opportunities working with Golden Gift. - CalMWolfs
+ Fixed Frozen Treasure Tracker showing wrong Compact Procs number. - CalMWolfs

#### Misc Fixes

Expand Down Expand Up @@ -174,6 +187,10 @@
+ Tell people how to name a pattern variable. - CalMWolfs
+ Typo fixes in contributing md. - CalMWolfs
+ Make Repo Pattern keys more consistent for Farming Gear. - CalMWolfs
+ Added options to ban specific imports in some packages. - nea
+ Don't allow uppercase Repo Pattern keys and added a more descriptive error. - CalMWolfs
+ Moved party API chat messages to Repo Pattern. - CalMWolfs
+ Allowing nullable parameters for regex functions matches() and find(). - hannibal2

## Version 0.22

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ plugins {
}

group = "at.hannibal2.skyhanni"
version = "0.23.Beta.7"
version = "0.23.Beta.8"

val gitHash by lazy {
val baos = ByteArrayOutputStream()
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ import org.apache.logging.log4j.Logger
clientSideOnly = true,
useMetadata = true,
guiFactory = "at.hannibal2.skyhanni.config.ConfigGuiForgeInterop",
version = "0.23.Beta.7",
version = "0.23.Beta.8",
)
class SkyHanniMod {
@Mod.EventHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,17 @@ public String toString() {
@ConfigEditorBoolean
public boolean allChroma = false;

@Expose
@ConfigOption(name = "Ignore Chat", desc = "Prevents Everything Chroma from applying to the chat if you unironically use that feature...")
@ConfigEditorBoolean
public boolean ignoreChat = false;

private void resetChromaSettings() {
SkyHanniMod.getFeature().chroma.chromaSize = 30f;
SkyHanniMod.getFeature().chroma.chromaSpeed = 6f;
SkyHanniMod.getFeature().chroma.chromaSaturation = 0.75f;
SkyHanniMod.getFeature().chroma.allChroma = false;
SkyHanniMod.getFeature().chroma.ignoreChat = false;
SkyHanniMod.getFeature().chroma.chromaDirection = Direction.FORWARD_RIGHT;
}
}
12 changes: 9 additions & 3 deletions src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzKeyPressEvent
import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.getPropertiesWithType
import at.hannibal2.skyhanni.utils.LorenzUtils.isRancherSign
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField
import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.inventory.GuiChest
Expand All @@ -33,7 +35,7 @@ class GuiEditManager {
if (isInGui()) return

Minecraft.getMinecraft().currentScreen?.let {
if (it !is GuiInventory && it !is GuiChest && it !is GuiEditSign && it !is GuiProfileViewer) return
if (it !is GuiInventory && it !is GuiChest && it !is GuiEditSign && !(it is GuiProfileViewer && !it.anyTextBoxFocused())) return
if (it is GuiEditSign && !it.isRancherSign()) return
}

Expand All @@ -51,6 +53,7 @@ class GuiEditManager {
}

companion object {

var currentPositions = mutableMapOf<String, Position>()
private var latestPositions = mapOf<String, Position>()
private var currentBorderSize = mutableMapOf<String, Pair<Int, Int>>()
Expand All @@ -77,8 +80,8 @@ class GuiEditManager {
lastHotkeyReminded = SimpleTimeMark.now()
LorenzUtils.chat(
"§eTo edit hidden GUI elements:\n" +
" §7- §e1. Set a key in /sh edit.\n" +
" §7- §e2. Click that key while the GUI element is visible."
" §7- §e1. Set a key in /sh edit.\n" +
" §7- §e2. Click that key while the GUI element is visible."
)
}
}
Expand Down Expand Up @@ -111,6 +114,9 @@ class GuiEditManager {
fun Position.getAbsX() = getAbsX0(getDummySize(true).x)

fun Position.getAbsY() = getAbsY0(getDummySize(true).y)

fun GuiProfileViewer.anyTextBoxFocused() =
this.getPropertiesWithType<GuiElementTextField>().any{it.focus}
}
}

Expand Down
97 changes: 76 additions & 21 deletions src/main/java/at/hannibal2/skyhanni/data/PartyAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,68 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.StringUtils.removeResets
import at.hannibal2.skyhanni.utils.StringUtils.trimWhiteSpaceAndResets
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.random.Random

object PartyAPI {
// TODO USE SH-REPO
private val youJoinedPartyPattern = "§eYou have joined (?<name>.*)'s §eparty!".toPattern()
private val othersJoinedPartyPattern = "(?<name>.*) §ejoined the party.".toPattern()
private val othersInThePartyPattern = "§eYou'll be partying with: (?<names>.*)".toPattern()
private val otherLeftPattern = "(?<name>.*) §ehas left the party.".toPattern()
private val otherKickedPattern = "(?<name>.*) §ehas been removed from the party.".toPattern()
private val otherOfflineKickedPattern = "§eKicked (?<name>.*) because they were offline.".toPattern()
private val otherDisconnectedPattern =
"(?<name>.*) §ewas removed from your party because they disconnected.".toPattern()
private val transferPattern = "The party was transferred to .* because (?<name>.*) left".toPattern()
private val disbandedPattern = ".* §ehas disbanded the party!".toPattern()
private val kickedPattern = "§eYou have been kicked from the party by .* §e".toPattern()
private val partyMembersStartPattern = "§6Party Members \\(\\d+\\)".toPattern()
private val partyMemberListPattern = "Party (?:Leader|Moderators|Members): (?<names>.*)".toPattern()
private val patternGroup = RepoPattern.group("data.party")
private val youJoinedPartyPattern by patternGroup.pattern(
"you.joined",
"§eYou have joined (?<name>.*)'s §eparty!"
)
private val othersJoinedPartyPattern by patternGroup.pattern(
"others.joined",
"(?<name>.*) §ejoined the party\\."
)
private val othersInThePartyPattern by patternGroup.pattern(
"others.inparty",
"§eYou'll be partying with: (?<names>.*)"
)
private val otherLeftPattern by patternGroup.pattern(
"others.left",
"(?<name>.*) §ehas left the party\\."
)
private val otherKickedPattern by patternGroup.pattern(
"others.kicked",
"(?<name>.*) §ehas been removed from the party\\."
)
private val otherOfflineKickedPattern by patternGroup.pattern(
"others.offline",
"§eKicked (?<name>.*) because they were offline\\."
)
private val otherDisconnectedPattern by patternGroup.pattern(
"others.disconnect",
"(?<name>.*) §ewas removed from your party because they disconnected\\."
)
private val transferPattern by patternGroup.pattern(
"others.transfer",
"The party was transferred to .* because (?<name>.*) left"
)
private val disbandedPattern by patternGroup.pattern(
"others.disband",
".* §ehas disbanded the party!"
)
private val kickedPattern by patternGroup.pattern(
"you.kicked",
"§eYou have been kicked from the party by .* §e"
)
private val partyMembersStartPattern by patternGroup.pattern(
"members.start",
"§6Party Members \\(\\d+\\)"
)
private val partyMemberListPattern by patternGroup.pattern(
"members.list",
"Party (?:Leader|Moderators|Members): (?<names>.*)"
)
private val kuudraFinderJoinPattern by patternGroup.pattern(
"kuudrafinder.join",
"§dParty Finder §f> (?<name>.*?) §ejoined the group! \\(§[a-fA-F0-9]+Combat Level \\d+§e\\)"
)
private val dungeonFinderJoinPattern by patternGroup.pattern(
"dungeonfinder.join",
"§dParty Finder §f> (?<name>.*?) §ejoined the dungeon group! \\(§[a-fA-F0-9].* Level \\d+§[a-fA-F0-9]\\)"
)

val partyMembers = mutableListOf<String>()

Expand All @@ -51,21 +95,27 @@ object PartyAPI {
val message = event.message.trimWhiteSpaceAndResets().removeResets()

// new member joined

youJoinedPartyPattern.matchMatcher(message) {
val name = group("name").cleanPlayerName()
if (!partyMembers.contains(name)) partyMembers.add(name)
addPlayer(name)
}
othersJoinedPartyPattern.matchMatcher(message) {
val name = group("name").cleanPlayerName()
if (!partyMembers.contains(name)) partyMembers.add(name)
addPlayer(name)
}
othersInThePartyPattern.matchMatcher(message) {
for (name in group("names").split(", ")) {
val playerName = name.cleanPlayerName()
if (!partyMembers.contains(playerName)) partyMembers.add(playerName)
addPlayer(name.cleanPlayerName())
}
}
kuudraFinderJoinPattern.matchMatcher(message) {
val name = group("name").cleanPlayerName()
addPlayer(name)
}
dungeonFinderJoinPattern.matchMatcher(message) {
val name = group("name").cleanPlayerName()
addPlayer(name)
}

// one member got removed
otherLeftPattern.matchMatcher(message) {
Expand Down Expand Up @@ -111,9 +161,14 @@ object PartyAPI {
partyMemberListPattern.matchMatcher(message.removeColor()) {
for (name in group("names").split("")) {
val playerName = name.replace("", "").cleanPlayerName()
if (playerName == LorenzUtils.getPlayerName()) continue
if (!partyMembers.contains(playerName)) partyMembers.add(playerName)
addPlayer(playerName)
}
}
}

private fun addPlayer(playerName: String) {
if (partyMembers.contains(playerName)) return
if (playerName == LorenzUtils.getPlayerName()) return
partyMembers.add(playerName)
}
}
11 changes: 10 additions & 1 deletion src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,18 @@ class ChatFilter {
// player join
"(?: §b>§c>§a>§r §r)?.* §6(?:joined|(?:spooked|slid) into) the lobby!(?:§r §a<§c<§b<)?".toPattern(),

// Hypixel SMP
"§2[\\s]*?§aYou can now create your own Hypixel SMP server![\\s]*?".toPattern(),

// Snow Particles in the Lobby
"[\\s]*?.*§bFor the best experience, click the text below to enable Snow[\\s]§.*§bParticles in this lobby![\\s]*?.*§3§lClick to enable Snow Particles[\\s]*?".toPattern(),

// mystery box
"§b✦ §r.* §r§7found a §r§e.* §r§bMystery Box§r§7!".toPattern(),
"§b✦ §r.* §r§7found (a|an) §r.* §r§7in a §r§a(Holiday )?Mystery Box§r§7!".toPattern()
"§b✦ §r.* §r§7found (a|an) §r.* §r§7in a §r§a(Holiday )?Mystery Box§r§7!".toPattern(),

// mystery dust
"§b✦ §r§7You earned §r§b\\d+ §r§7Mystery Dust!".toPattern(),
)

private val lobbyMessages = listOf(
Expand Down
Loading

0 comments on commit 4a131f7

Please sign in to comment.