Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature + Fix: Player Chat Rework #1483

Merged
merged 50 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
8608827
create PlayerChatEvent
hannibal002 Apr 18, 2024
0e70bcf
move party chat event into player chat manager
hannibal002 Apr 18, 2024
0b16688
creating NpcChatEvent and using shared AbstractChatEvent
hannibal002 Apr 18, 2024
ca07044
add regex test to global
hannibal002 Apr 18, 2024
32b1adf
cleanup
hannibal002 Apr 18, 2024
ef59df6
adding PlayerShowItemChatEvent
hannibal002 Apr 18, 2024
6871c8a
adding GuildChatEvent
hannibal002 Apr 18, 2024
98d6580
move packets around
hannibal002 Apr 18, 2024
13ce987
create PrivateMessageChatEvent
hannibal002 Apr 18, 2024
029b920
add boop support
hannibal002 Apr 18, 2024
75c88fc
add SystemMessageEvent
hannibal002 Apr 18, 2024
cf5e78e
allow modifying of chatComponent
hannibal002 Apr 18, 2024
590fa3c
code cleanup
hannibal002 Apr 18, 2024
075933e
make it work
hannibal002 Apr 18, 2024
a92ebd2
not needed
hannibal002 Apr 18, 2024
6f2aca1
add private message support
hannibal002 Apr 18, 2024
fdb938d
add todo
hannibal002 Apr 18, 2024
0ca8577
moving player chat symbols into PlayerNameFormatter
hannibal002 Apr 18, 2024
c12a262
add enabled check
hannibal002 Apr 18, 2024
a79654c
add Message Order
hannibal002 Apr 18, 2024
b511229
all players same color in chat
hannibal002 Apr 18, 2024
310609d
all players same color in chat
hannibal002 Apr 18, 2024
c1dfae2
add mark player support
hannibal002 Apr 18, 2024
da68503
move chat filter to new system
hannibal002 Apr 18, 2024
33f7bec
fix bigger emblems
hannibal002 Apr 18, 2024
eb036b9
add todos
hannibal002 Apr 18, 2024
d103641
small fixes
hannibal002 Apr 18, 2024
2051d60
fix guild rank
hannibal002 Apr 18, 2024
d6d633d
dynamic guild rank position
hannibal002 Apr 18, 2024
45e72a4
fix private island rank
hannibal002 Apr 18, 2024
c76477e
party chat support
hannibal002 Apr 18, 2024
2e3231a
private message support
hannibal002 Apr 18, 2024
3aed495
move global chat check into own function
hannibal002 Apr 18, 2024
186fd0a
same order everywhere
hannibal002 Apr 18, 2024
f3bb85a
add docs
hannibal002 Apr 18, 2024
c6bf6cf
add options Hide Level Brackets and Level Color As Name
hannibal002 Apr 18, 2024
e14d67a
code cleanup
hannibal002 Apr 18, 2024
d8d922c
Merge branch 'beta' into player-chat-rework
hannibal002 Apr 18, 2024
e54c8f4
commented out debug code
hannibal002 Apr 18, 2024
defdc57
add todos
hannibal002 Apr 18, 2024
01dae85
Merge branch 'beta' into player-chat-rework
hannibal002 Apr 18, 2024
31510d6
Merge branch 'beta' into player-chat-rework
hannibal002 Apr 18, 2024
8c8a372
fix private island rank with emblem problem
hannibal002 Apr 18, 2024
79fb364
fix show item chat formatting
hannibal002 Apr 18, 2024
7d70dfa
added Private Island Guest
hannibal002 Apr 18, 2024
9b72f27
Merge branch 'beta' into player-chat-rework
hannibal002 Apr 19, 2024
e5fd906
fixed empty line error
hannibal002 Apr 19, 2024
7788836
fix crash
hannibal002 Apr 19, 2024
49420a5
do not remove rank if only selecting use level color for name
hannibal002 Apr 19, 2024
42074ca
Update src/main/java/at/hannibal2/skyhanni/data/PartyAPI.kt
hannibal002 Apr 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ import at.hannibal2.skyhanni.data.TitleData
import at.hannibal2.skyhanni.data.TitleManager
import at.hannibal2.skyhanni.data.ToolTipData
import at.hannibal2.skyhanni.data.TrackerManager
import at.hannibal2.skyhanni.data.hypixel.chat.PlayerChatManager
import at.hannibal2.skyhanni.data.hypixel.chat.PlayerNameFormatter
import at.hannibal2.skyhanni.data.jsonobjects.local.FriendsJson
import at.hannibal2.skyhanni.data.jsonobjects.local.JacobContestsJson
import at.hannibal2.skyhanni.data.jsonobjects.local.KnownFeaturesJson
Expand Down Expand Up @@ -319,7 +321,6 @@ import at.hannibal2.skyhanni.features.misc.PatcherSendCoordinates
import at.hannibal2.skyhanni.features.misc.PetCandyUsedDisplay
import at.hannibal2.skyhanni.features.misc.PetExpTooltip
import at.hannibal2.skyhanni.features.misc.PetItemDisplay
import at.hannibal2.skyhanni.features.misc.PlayerChatSymbols
import at.hannibal2.skyhanni.features.misc.PocketSackInASackDisplay
import at.hannibal2.skyhanni.features.misc.PrivateIslandNoPickaxeAbility
import at.hannibal2.skyhanni.features.misc.QuickModMenuSwitch
Expand Down Expand Up @@ -465,6 +466,8 @@ class SkyHanniMod {
// data
loadModule(this)
loadModule(ChatManager)
loadModule(PlayerChatManager())
loadModule(PlayerNameFormatter())
loadModule(HypixelData())
loadModule(LocationFixData)
loadModule(DungeonAPI)
Expand Down Expand Up @@ -821,7 +824,6 @@ class SkyHanniMod {
loadModule(DungeonRankTabListColor())
loadModule(TerracottaPhase())
loadModule(VolcanoExplosivityDisplay())
loadModule(PlayerChatSymbols())
loadModule(FixNEUHeavyPearls())
loadModule(QuickCraftFeatures())
loadModule(SkyBlockKickDuration())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import com.google.gson.JsonPrimitive
object ConfigUpdaterMigrator {

val logger = LorenzLogger("ConfigMigration")
const val CONFIG_VERSION = 40
const val CONFIG_VERSION = 41
fun JsonElement.at(chain: List<String>, init: Boolean): JsonElement? {
if (chain.isEmpty()) return this
if (this !is JsonObject) return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,16 @@ public class ChatConfig {
@Expose
@ConfigOption(name = "Chat Filter Types", desc = "")
@Accordion
// TODO move into own sub category
public FilterTypesConfig filterType = new FilterTypesConfig();


@Expose
@ConfigOption(name = "Player Messages", desc = "")
@Accordion
// TODO move into own sub category
public PlayerMessagesConfig playerMessage = new PlayerMessagesConfig();

@Expose
@ConfigOption(name = "Player Chat Symbols", desc = "")
@Accordion
public ChatSymbols chatSymbols = new ChatSymbols();

@Expose
@ConfigOption(name = "Dungeon Filter", desc = "Hide specific message types in Dungeons.")
@ConfigEditorDraggableList
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,84 @@
import at.hannibal2.skyhanni.config.FeatureToggle;
import com.google.gson.annotations.Expose;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDraggableList;
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class PlayerMessagesConfig {

@Expose
@ConfigOption(
name = "Part Order",
desc = "Drag text to change the chat message format order for chat messages."
)
@ConfigEditorDraggableList
public List<MessagePart> partsOrder = new ArrayList<>(Arrays.asList(
MessagePart.SKYBLOCK_LEVEL,
MessagePart.PRIVATE_ISLAND_RANK,
MessagePart.PRIVATE_ISLAND_GUEST,
MessagePart.PLAYER_NAME,
MessagePart.GUILD_RANK,
MessagePart.EMBLEM
));

public enum MessagePart {
SKYBLOCK_LEVEL("SkyBlock Level"),
EMBLEM("Emblem"),
PLAYER_NAME("§bPlayer Name"),
GUILD_RANK("Guild Rank"),
PRIVATE_ISLAND_RANK("Private Island Rank"),
PRIVATE_ISLAND_GUEST("Private Island Guest"),
CRIMSON_FACTION("Crimson Faction"),
MODE_IRONMAN("Ironman Mode"),
BINGO_LEVEL("Bingo Level"),
;

private final String str;

MessagePart(String str) {
this.str = str;
}

@Override
public String toString() {
return str;
}
}

@Expose
@ConfigOption(name = "Hide Level Brackets", desc = "Hide the gray brackets in front of and behind the level numbers.")
@ConfigEditorBoolean
public boolean hideLevelBrackets = false;

@Expose
@ConfigOption(name = "Level Color As Name", desc = "Use the color of the SkyBlock level for the player color.")
@ConfigEditorBoolean
public boolean useLevelColorForName = false;

@Expose
@ConfigOption(name = "Player Rank Hider", desc = "Hide player ranks in all chat messages.")
@ConfigEditorBoolean
@FeatureToggle
public boolean playerRankHider = false;

@Expose
@ConfigOption(name = "Ignore YouTube", desc = "Do not remove the rank for YouTubers in chat.")
@ConfigEditorBoolean
public boolean ignoreYouTube = false;

@Expose
@ConfigOption(name = "Chat Filter", desc = "Scan messages sent by players for blacklisted words and gray out the message if any are found.")
@ConfigEditorBoolean
@FeatureToggle
public boolean chatFilter = false;

@Expose
@ConfigOption(name = "Same Chat Color", desc = "All players, also those with ranks, write with the same, white chat color.")
@ConfigEditorBoolean
@FeatureToggle
public boolean sameChatColor = true;
}
25 changes: 7 additions & 18 deletions src/main/java/at/hannibal2/skyhanni/data/PartyAPI.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package at.hannibal2.skyhanni.data

import at.hannibal2.skyhanni.data.hypixel.chat.event.PartyChatEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.PartyChatEvent
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.OSUtils
Expand Down Expand Up @@ -78,16 +78,6 @@ object PartyAPI {
"§dParty Finder §f> (?<name>.*?) §ejoined the dungeon group! \\(§[a-fA-F0-9].* Level \\d+§[a-fA-F0-9]\\)"
)

/**
* REGEX-TEST: §9Party §8> §b§l⚛ §b[MVP§f+§b] Dankbarkeit§f: §rx: -190, y: 5, z: -163
* REGEX-TEST: §9Party §8> §6⚔ §6[MVP§3++§6] RealBacklight§f: §r!warp
* REGEX-TEST: §9Party §8> §b[MVP§3+§b] Eisengolem§f: §r!pt
*/
private val partyChatMessagePattern by patternGroup.pattern(
"chat.message",
"§9Party §8> (?<name>[^:]*): §r(?<message>.*)"
)

val partyMembers = mutableListOf<String>()

var partyLeader: String? = null
Expand All @@ -113,17 +103,16 @@ object PartyAPI {
}
}

@SubscribeEvent
fun onPartyChat(event: PartyChatEvent) {
val name = event.author.cleanPlayerName()
addPlayer(name)
}

@SubscribeEvent
fun onChat(event: LorenzChatEvent) {
val message = event.message.trimWhiteSpace().removeResets()

partyChatMessagePattern.matchMatcher(event.message) {
val name = group("name").cleanPlayerName()
val message = group("message")
addPlayer(name)
PartyChatEvent(name, message, event).postAndCatch()
}

// new member joined
youJoinedPartyPattern.matchMatcher(message) {
val name = group("name").cleanPlayerName()
Expand Down
Loading
Loading