Skip to content

Commit

Permalink
Update b2.1
Browse files Browse the repository at this point in the history
KevinClient b2.1 !!!!!!!
  • Loading branch information
RMCQAZ committed Aug 15, 2022
1 parent defe71e commit 39b12aa
Show file tree
Hide file tree
Showing 55 changed files with 2,020 additions and 309 deletions.
4 changes: 4 additions & 0 deletions src/minecraft/kevin/command/CommandManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ class CommandManager {
commands[arrayOf("ReloadScripts","ReloadScript")] = ScriptManager

commands[arrayOf("Admin")] = AdminDetector

commands[arrayOf("DisableAllModule")] = DisableAllCommand()

commands[arrayOf("ClearMainConfig")] = ClearMainConfigCommand()
}

fun execCommand(message: String): Boolean{
Expand Down
18 changes: 18 additions & 0 deletions src/minecraft/kevin/command/commands/ClearMainConfigCommand.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package kevin.command.commands

import kevin.command.ICommand
import kevin.main.KevinClient
import kevin.script.ScriptManager
import kevin.utils.ChatUtils

class ClearMainConfigCommand : ICommand {
override fun run(args: Array<out String>?) {
KevinClient.moduleManager.getModules().forEach { KevinClient.eventManager.unregisterListener(it) }
KevinClient.eventManager.unregisterListener(KevinClient.moduleManager)
KevinClient.moduleManager.getModules().clear()
KevinClient.moduleManager.load()
ScriptManager.reAdd()
KevinClient.fileManager.saveConfig(KevinClient.fileManager.modulesConfig)
ChatUtils.messageWithStart("§aCleared main config.")
}
}
12 changes: 12 additions & 0 deletions src/minecraft/kevin/command/commands/DisableAllCommand.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package kevin.command.commands

import kevin.command.ICommand
import kevin.main.KevinClient
import kevin.utils.ChatUtils

class DisableAllCommand : ICommand {
override fun run(args: Array<out String>?) {
KevinClient.moduleManager.getModules().forEach { it.state = false }
ChatUtils.messageWithStart("§aDisabled all modules.")
}
}
4 changes: 3 additions & 1 deletion src/minecraft/kevin/command/commands/HelpCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class HelpCommand : ICommand {
ChatUtils.message("§a.AutoDisableSet <ModuleName> <add/remove> <World/SetBack/All> §9Add/Remove a module to AutoDisable List.")
ChatUtils.message("§a.reloadScripts §9Reload Scripts.")
ChatUtils.message("§a.reloadScript §9Reload Scripts.")
ChatUtils.message("§a.Admin <Add/Remove> <Name> Add admin name to detect list.")
ChatUtils.message("§a.Admin <Add/Remove> <Name> §9Add admin name to detect list.")
ChatUtils.message("§a.DisableAllModule §9Disable all modules.")
ChatUtils.message("§a.ClearMainConfig §9Clear main config.")
}
}
2 changes: 1 addition & 1 deletion src/minecraft/kevin/file/ConfigManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ object ConfigManager {
warns["$key-AutoDisableValue"] = "The AutoDisable attribute of the module is not saved in the config file(OldConfig?)."
for (moduleValue in module.values) {
val element = jsonModule[moduleValue.name]
if (element != null) moduleValue.fromJson(element) else warns["$key-$moduleValue"] = "The config file does not have a value for this option."
if (element != null) moduleValue.fromJson(element) else warns["$key-${moduleValue.name}"] = "The config file does not have a value for this option."
}
} else warns[key] = "Module does not exist."
}
Expand Down
23 changes: 23 additions & 0 deletions src/minecraft/kevin/file/ImageManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import com.google.gson.JsonObject
import com.google.gson.JsonParser
import kevin.main.KevinClient
import net.minecraft.client.Minecraft
import net.minecraft.client.renderer.texture.DynamicTexture
import net.minecraft.util.ResourceLocation
import org.apache.commons.io.IOUtils
import java.awt.image.BufferedImage
import java.io.*
Expand All @@ -13,7 +15,28 @@ import javax.imageio.ImageIO
object ImageManager {
var saveServerIcon = false
private val jsonFile = File(KevinClient.fileManager.serverIconsDir,"config.json")
//load some textures
val resourceShadow1 = ResourceLocation("kevin/shadows/PanelBottom.png")
val resourceShadow2 = ResourceLocation("kevin/shadows/PanelBottomLeft.png")
val resourceShadow3 = ResourceLocation("kevin/shadows/PanelBottomRight.png")
val resourceShadow4 = ResourceLocation("kevin/shadows/PanelLeft.png")
val resourceShadow5 = ResourceLocation("kevin/shadows/PanelRight.png")
val resourceShadow6 = ResourceLocation("kevin/shadows/PanelTop.png")
val resourceShadow7 = ResourceLocation("kevin/shadows/PanelTopLeft.png")
val resourceShadow8 = ResourceLocation("kevin/shadows/PanelTopRight.png")

fun load(){
val mc = Minecraft.getMinecraft()
mc.addScheduledTask{
mc.textureManager.loadTexture(resourceShadow1, DynamicTexture(ImageIO.read(javaClass.getResourceAsStream("/resources/shadows/PanelBottom.png"))))
mc.textureManager.loadTexture(resourceShadow2, DynamicTexture(ImageIO.read(javaClass.getResourceAsStream("/resources/shadows/PanelBottomLeft.png"))))
mc.textureManager.loadTexture(resourceShadow3, DynamicTexture(ImageIO.read(javaClass.getResourceAsStream("/resources/shadows/PanelBottomRight.png"))))
mc.textureManager.loadTexture(resourceShadow4, DynamicTexture(ImageIO.read(javaClass.getResourceAsStream("/resources/shadows/PanelLeft.png"))))
mc.textureManager.loadTexture(resourceShadow5, DynamicTexture(ImageIO.read(javaClass.getResourceAsStream("/resources/shadows/PanelRight.png"))))
mc.textureManager.loadTexture(resourceShadow6, DynamicTexture(ImageIO.read(javaClass.getResourceAsStream("/resources/shadows/PanelTop.png"))))
mc.textureManager.loadTexture(resourceShadow7, DynamicTexture(ImageIO.read(javaClass.getResourceAsStream("/resources/shadows/PanelTopLeft.png"))))
mc.textureManager.loadTexture(resourceShadow8, DynamicTexture(ImageIO.read(javaClass.getResourceAsStream("/resources/shadows/PanelTopRight.png"))))
}
if (!jsonFile.exists()) return
val json = JsonParser().parse(IOUtils.toString(FileInputStream(jsonFile),"utf-8")).asJsonObject
if (json.has("state")){
Expand Down
Loading

0 comments on commit 39b12aa

Please sign in to comment.