Skip to content

Commit

Permalink
requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
CalMWolfs committed Apr 23, 2024
1 parent a6985c8 commit 6cd0026
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
14 changes: 8 additions & 6 deletions src/main/java/at/hannibal2/skyhanni/data/PartyAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -168,19 +168,16 @@ object PartyAPI {

// party disbanded
disbandedPattern.matchMatcher(message) {
partyMembers.clear()
partyLeader = null
partyLeft()
}
kickedPattern.matchMatcher(message) {
partyMembers.clear()
partyLeader = null
partyLeft()
}
if (message == "§eYou left the party." ||
message == "§cThe party was disbanded because all invites expired and the party was empty." ||
message == "§cYou are not currently in a party."
) {
partyMembers.clear()
partyLeader = null
partyLeft()
}

// party list
Expand All @@ -206,4 +203,9 @@ object PartyAPI {
if (playerName == LorenzUtils.getPlayerName()) return
partyMembers.add(playerName)
}

private fun partyLeft() {
partyMembers.clear()
partyLeader = null
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import at.hannibal2.skyhanni.data.PartyAPI
import at.hannibal2.skyhanni.data.hypixel.chat.event.PartyChatEvent
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration.Companion.seconds

object PartyChatCommands {

Expand All @@ -20,7 +22,8 @@ object PartyChatCommands {
val executable: (PartyChatEvent) -> Unit,
)

private fun useConfig() = SkyHanniMod.feature.misc.partyCommands
private var lastWarp = SimpleTimeMark.farPast()
private var lastAllInvite = SimpleTimeMark.farPast()

private val allPartyCommands = listOf(
PartyChatCommand(
Expand All @@ -33,17 +36,19 @@ object PartyChatCommands {
),
PartyChatCommand(
listOf("pw", "warp", "warpus"),
{ config.warpCommand },
{ config.warpCommand && lastWarp.passedSince() > 5.seconds },
requiresPartyLead = true,
executable = {
lastWarp = SimpleTimeMark.now()
ChatUtils.sendCommandToServer("party warp")
}
),
PartyChatCommand(
listOf("allinv", "allinvite"),
{ config.allInviteCommand },
{ config.allInviteCommand && lastAllInvite.passedSince() > 2.seconds },
requiresPartyLead = true,
executable = {
lastAllInvite = SimpleTimeMark.now()
ChatUtils.sendCommandToServer("party settings allinvite")
}
),
Expand Down

0 comments on commit 6cd0026

Please sign in to comment.