aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/ledger/LogChatCommand.kt
blob: 90b25451ed5129e0eac1ab7b899b54b5f868b262 (plain)
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
package moe.nea.ledger

import moe.nea.ledger.utils.di.Inject
import net.minecraft.command.CommandBase
import net.minecraft.command.ICommandSender

class LogChatCommand : CommandBase() {
	@Inject
	lateinit var logger: LedgerLogger

	override fun getCommandName(): String {
		return "ledgerlogchat"
	}

	override fun canCommandSenderUseCommand(sender: ICommandSender?): Boolean {
		return true
	}

	override fun getCommandUsage(sender: ICommandSender?): String {
		return ""
	}

	override fun processCommand(sender: ICommandSender?, args: Array<out String>?) {
		logger.shouldLog = !logger.shouldLog
		logger.printOut("§eLedger logging toggled " + (if (logger.shouldLog) "§aon" else "§coff") + "§e.")
	}
}