[refactor] Removed Hidden module category

This commit is contained in:
Xiaro 2020-12-26 17:50:22 -05:00
parent 7c7f24509c
commit df62eb804b
No known key found for this signature in database
GPG Key ID: 996D265D6E155377
4 changed files with 14 additions and 21 deletions

View File

@ -25,8 +25,6 @@ object GenerateWebsiteCommand : ClientCommand(
var totalMods = 0
var str = ""
for (module in mods) {
if (!module.isProduction) continue
if (!module.category.toString().equals(modCategory, ignoreCase = true)) continue
totalMods++
str += " <li>" + module.name.value + "<p><i>" + module.description + "</i></p></li>\n"
}

View File

@ -118,7 +118,6 @@ public class KamiGUI extends GUI {
public void initializeGUI() {
HashMap<Module.Category, Pair<Scrollpane, SettingsPanel>> categoryScrollpaneHashMap = new HashMap<>();
for (Module module : ModuleManager.getModules()) {
if (module.getCategory().isHidden()) continue;
Module.Category moduleCategory = module.getCategory();
if (!categoryScrollpaneHashMap.containsKey(moduleCategory)) {
Stretcherlayout stretcherlayout = new Stretcherlayout(1);
@ -187,7 +186,7 @@ public class KamiGUI extends GUI {
for (Map.Entry<Module.Category, Pair<Scrollpane, SettingsPanel>> entry : categoryScrollpaneHashMap.entrySet()) {
Stretcherlayout stretcherlayout = new Stretcherlayout(1);
stretcherlayout.COMPONENT_OFFSET_Y = 1;
Frame frame = new Frame(getTheme(), stretcherlayout, entry.getKey().getCategoryName());
Frame frame = new Frame(getTheme(), stretcherlayout, entry.getKey().getDisplayName());
Scrollpane scrollpane = entry.getValue().getFirst();
frame.addChild(scrollpane);
frame.addChild(entry.getValue().getSecond());

View File

@ -17,6 +17,7 @@ import me.zeroeightsix.kami.util.Bind
import me.zeroeightsix.kami.util.Wrapper
import me.zeroeightsix.kami.util.text.MessageSendHelper
import net.minecraft.client.Minecraft
import org.kamiblue.commons.interfaces.DisplayEnum
import org.lwjgl.input.Keyboard
import java.util.*
@ -55,15 +56,16 @@ open class Module {
*
* @see me.zeroeightsix.kami.module.modules.client.ActiveModules
*/
enum class Category(val categoryName: String, val isHidden: Boolean) {
CHAT("Chat", false),
COMBAT("Combat", false),
CLIENT("Client", false),
HIDDEN("Hidden", true),
MISC("Misc", false),
MOVEMENT("Movement", false),
PLAYER("Player", false),
RENDER("Render", false);
enum class Category(override val displayName: String): DisplayEnum {
CHAT("Chat"),
COMBAT("Combat"),
CLIENT("Client"),
MISC("Misc"),
MOVEMENT("Movement"),
PLAYER("Player"),
RENDER("Render");
override fun toString() = displayName
}
/* End of annotations */
@ -88,7 +90,6 @@ open class Module {
val bindName: String get() = if (bind.value.key < 1) "NONE" else Wrapper.getKeyName(bind.value.key)
val chatName: String get() = "[${name.value}]"
val isOnArray: Boolean get() = showOnArray.value == ShowOnArray.ON
val isProduction: Boolean get() = category != Category.HIDDEN
/* End of properties */

View File

@ -1,5 +1,3 @@
@file:Suppress("DEPRECATION")
package me.zeroeightsix.kami.module.modules.client
import me.zeroeightsix.kami.module.Module
@ -8,7 +6,6 @@ import me.zeroeightsix.kami.setting.Settings
import me.zeroeightsix.kami.util.color.ColorConverter.rgbToHex
import me.zeroeightsix.kami.util.text.MessageSendHelper.sendChatMessage
import org.kamiblue.commons.utils.MathUtils.reverseNumber
import java.awt.Color
@Module.Info(
name = "ActiveModules",
@ -42,17 +39,16 @@ object ActiveModules : Module() {
private val render = register(Settings.s("Render", "105,48,109"))
fun setColor(category: Category, r: Int, g: Int, b: Int) {
val setting = getSettingForCategory(category) ?: return
val setting = getSettingForCategory(category)
setting.value = "$r,$g,$b"
sendChatMessage("Set ${setting.name} colour to $r, $g, $b")
}
private fun getSettingForCategory(category: Category): Setting<String>? {
private fun getSettingForCategory(category: Category): Setting<String> {
return when (category) {
Category.CHAT -> chat
Category.COMBAT -> combat
Category.CLIENT -> client
Category.HIDDEN -> null // This should never be reached
Category.MISC -> misc
Category.MOVEMENT -> movement
Category.PLAYER -> player
@ -69,7 +65,6 @@ object ActiveModules : Module() {
Category.PLAYER -> rgbToHex(getRgb(player.value, 0), getRgb(player.value, 1), getRgb(player.value, 2))
Category.MOVEMENT -> rgbToHex(getRgb(movement.value, 0), getRgb(movement.value, 1), getRgb(movement.value, 2))
Category.MISC -> rgbToHex(getRgb(misc.value, 0), getRgb(misc.value, 1), getRgb(misc.value, 2))
else -> rgbToHex(1, 1, 1)
}
}