1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
package cc.woverflow.chatting.config
import cc.woverflow.chatting.Chatting
import cc.woverflow.chatting.chat.ChatShortcuts
import cc.woverflow.chatting.chat.ChatTab
import cc.woverflow.chatting.chat.ChatTabs
import cc.woverflow.chatting.gui.ChatShortcutViewGui
import cc.woverflow.chatting.updater.DownloadGui
import cc.woverflow.chatting.updater.Updater
import gg.essential.api.EssentialAPI
import gg.essential.vigilance.Vigilant
import gg.essential.vigilance.data.Category
import gg.essential.vigilance.data.Property
import gg.essential.vigilance.data.PropertyType
import gg.essential.vigilance.data.SortingBehavior
import java.io.File
object ChattingConfig : Vigilant(File(Chatting.modDir, "${Chatting.ID}.toml"), Chatting.NAME, sortingBehavior = ConfigSorting) {
@Property(
type = PropertyType.SELECTOR,
name = "Text Render Type",
description = "Choose the type of rendering for the text.",
category = "General",
options = ["No Shadow", "Shadow", "Full Shadow"]
)
var textRenderType = 1
@Property(
type = PropertyType.SWITCH,
name = "Remove Tooltip Background",
description = "Remove the tooltip background.",
category = "General"
)
var removeTooltipBackground = false
@Property(
type = PropertyType.SWITCH,
name = "Inform for Alternatives",
description = "Inform the user if a mod they are using can be replaced by a feature in Chatting.",
category = "General"
)
var informForAlternatives = true
@Property(
type = PropertyType.SWITCH,
name = "Custom Chat Height",
description = "Allows you to change the height of chat to heights greater than before.",
category = "Chat Window"
)
var customChatHeight = true
@Property(
type = PropertyType.SLIDER,
min = 180,
max = 10000,
name = "Focused Height",
description = "Height in pixels.",
category = "Chat Window"
)
var focusedHeight = 180
@Property(
type = PropertyType.SLIDER,
min = 180,
max = 10000,
name = "Unfocused Height",
description = "Height in pixels.",
category = "Chat Window"
)
var unfocusedHeight = 180
@Property(
type = PropertyType.SELECTOR,
name = "Screenshot Mode",
description = "The mode in which screenshotting will work.",
category = "Screenshotting",
options = [
"Save To System",
"Add To Clipboard",
"Both"
]
)
var copyMode = 0
@Property(
type = PropertyType.SWITCH,
name = "Chat Searching",
description = "Add a chat search bar.",
category = "Searching"
)
var chatSearch = true
@Property(
type = PropertyType.SWITCH,
name = "Chat Tabs",
description = "Add chat tabs.",
category = "Tabs"
)
var chatTabs = true
get() {
if (!field) return false
return if (hypixelOnlyChatTabs) {
EssentialAPI.getMinecraftUtil().isHypixel()
} else {
true
}
}
@Property(
type = PropertyType.SWITCH,
name = "Enable Tabs Only on Hypixel",
description = "Enable chat tabs only in Hypixel.",
category = "Tabs"
)
var hypixelOnlyChatTabs = true
@Property(
type = PropertyType.SWITCH,
name = "Chat Shortcuts",
description = "Add chat shortcuts.",
category = "Shortcuts"
)
var chatShortcuts = false
get() {
if (!field) return false
return if (hypixelOnlyChatShortcuts) {
EssentialAPI.getMinecraftUtil().isHypixel()
} else {
true
}
}
@Property(
type = PropertyType.SWITCH,
name = "Enable Shortcuts Only on Hypixel",
description = "Enable chat shortcuts only in Hypixel.",
category = "Shortcuts"
)
var hypixelOnlyChatShortcuts = true
@Property(
type = PropertyType.BUTTON,
name = "Edit Chat Shortcuts",
description = "Edit chat shortcuts.",
category = "Shortcuts"
)
fun openChatShortcutsGUI() {
EssentialAPI.getGuiUtil().openScreen(ChatShortcutViewGui())
}
@Property(
type = PropertyType.SWITCH,
name = "Show Update Notification",
description = "Show a notification when you start Minecraft informing you of new updates.",
category = "Updater"
)
var showUpdate = true
@Property(
type = PropertyType.BUTTON,
name = "Update Now",
description = "Update by clicking the button.",
category = "Updater"
)
fun update() {
if (Updater.shouldUpdate) EssentialAPI.getGuiUtil()
.openScreen(DownloadGui()) else EssentialAPI.getNotifications()
.push(
Chatting.NAME,
"No update had been detected at startup, and thus the update GUI has not been shown."
)
}
@Property(
type = PropertyType.SWITCH,
name = "First Launch",
category = "General",
hidden = true
)
var firstLaunch = true
init {
initialize()
registerListener("chatTabs") { funny: Boolean ->
chatTabs = funny
ChatTabs.initialize()
if (!funny) {
val dummy = ChatTab(true, "ALL", false, null, null, null, null, null, "")
dummy.initialize()
ChatTabs.currentTab = dummy
} else {
ChatTabs.currentTab = ChatTabs.tabs[0]
}
}
registerListener("chatShortcuts") { funny: Boolean ->
chatShortcuts = funny
ChatShortcuts.initialize()
}
}
private object ConfigSorting : SortingBehavior() {
override fun getCategoryComparator(): Comparator<in Category> = Comparator { o1, o2 ->
if (o1.name == "General") return@Comparator -1
if (o2.name == "General") return@Comparator 1
else compareValuesBy(o1, o2) {
it.name
}
}
}
}
|