Added AutoExcuse(#840) (#1024)

Co-authored-by: Dominika <sokolov.dominika@gmail.com>
This commit is contained in:
sourTaste000 2020-07-11 13:21:00 -07:00 committed by GitHub
parent 71db98f588
commit 60d10cefc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 66 additions and 0 deletions

3
.gitignore vendored
View File

@ -317,3 +317,6 @@ gradle-app.setting
# End of https://www.gitignore.io/api/linux,gradle,eclipse,windows,forgegradle,intellij+all,emacs,vim
/target/
# macOS system generate files
.DS_Store

View File

@ -0,0 +1,63 @@
package me.zeroeightsix.kami.module.modules.chat
import me.zero.alpine.listener.EventHandler
import me.zero.alpine.listener.EventHook
import me.zero.alpine.listener.Listener
import me.zeroeightsix.kami.event.events.GuiScreenEvent.Displayed
import me.zeroeightsix.kami.module.Module
import me.zeroeightsix.kami.util.MessageSendHelper.sendServerMessage
import net.minecraft.client.gui.GuiGameOver
import java.util.*
/**
* @author sourTaste000
* @since 7/8/2020
* most :smoothbrain: code ever
*/
@Module.Info(
name = "AutoExcuse",
description = "Makes an excuse for you when you die",
category = Module.Category.CHAT
)
class AutoExcuse : Module() {
private val rand = Random()
private val excuses = arrayOf(
"sorry, im using ",
"my ping is so bad",
"i was changing my config :(",
"why did my autototem break",
"i was desynced",
"stupid hackers killed me",
"wow, so many tryhards",
"lagggg"
)
private val clients = arrayOf(
"future",
"salhack",
"impact"
)
private fun getExcuse(): String {
val excuse = rand.nextInt(excuses.size)
return if (excuse == 0) {
excuses[0] + clients.random()
} else {
excuses[excuse]
}
}
/* it's not actually unreachable, thanks intellij */
@Suppress("UNREACHABLE_CODE")
@EventHandler
var listener = Listener(EventHook { event: Displayed ->
if (event.screen is GuiGameOver) {
do {
sendServerMessage(getExcuse())
break
} while (!(mc.player.isDead))
}
})
}