Skip to content
This repository has been archived by the owner on Apr 22, 2021. It is now read-only.

Commit

Permalink
Added an option to disable kami command feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
5HT2 committed May 7, 2020
1 parent 0167563 commit cea3c69
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.Objects;

import static me.zeroeightsix.kami.util.MessageSendHelper.sendChatMessage;
import static me.zeroeightsix.kami.util.MessageSendHelper.sendErrorMessage;

/**
* Created by d1gress/Qther on 25/11/2017, updated on 16/12/2019
Expand Down Expand Up @@ -42,7 +43,7 @@ public void call(String[] args) {
EntityLivingBase entity = (EntityLivingBase) mc.player.getRidingEntity();
sendChatMessage("&6Entity Stats:\n&cMax Health: &b" + entity.getMaxHealth() + " &2HP" + "\n&cSpeed: &b" + round(43.17 * entity.getAIMoveSpeed(), 2) + " &2m/s");
} else {
sendChatMessage("&4&lError: &cNot riding a compatible entity.");
sendErrorMessage("&4&lError: &cNot riding a compatible entity.");
}
}

Expand Down
16 changes: 13 additions & 3 deletions src/main/java/me/zeroeightsix/kami/util/MessageSendHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.module.modules.client.CommandConfig;
import net.minecraft.client.Minecraft;
import net.minecraft.launchwrapper.LogWrapper;
import net.minecraft.network.play.client.CPacketChatMessage;
Expand All @@ -15,15 +16,24 @@

public class MessageSendHelper {
public static void sendChatMessage(String message) {
sendRawChatMessage("&7[&9" + KamiMod.KAMI_KANJI + "&7] &r" + message);
CommandConfig commandConfig = MODULE_MANAGER.getModuleT(CommandConfig.class);
if (commandConfig.logLevel.getValue().equals(CommandConfig.LogLevel.ALL)) {
sendRawChatMessage("&7[&9" + KamiMod.KAMI_KANJI + "&7] &r" + message);
}
}

public static void sendWarningMessage(String message) {
sendRawChatMessage("&7[&6" + KamiMod.KAMI_KANJI + "&7] &r" + message);
CommandConfig commandConfig = MODULE_MANAGER.getModuleT(CommandConfig.class);
if (commandConfig.logLevel.getValue().equals(CommandConfig.LogLevel.ALL) || commandConfig.logLevel.getValue().equals(CommandConfig.LogLevel.WARN)) {
sendRawChatMessage("&7[&6" + KamiMod.KAMI_KANJI + "&7] &r" + message);
}
}

public static void sendErrorMessage(String message) {
sendRawChatMessage("&7[&4" + KamiMod.KAMI_KANJI + "&7] &r" + message);
CommandConfig commandConfig = MODULE_MANAGER.getModuleT(CommandConfig.class);
if (commandConfig.logLevel.getValue().equals(CommandConfig.LogLevel.ALL) || commandConfig.logLevel.getValue().equals(CommandConfig.LogLevel.WARN) || commandConfig.logLevel.getValue().equals(CommandConfig.LogLevel.ERROR)) {
sendRawChatMessage("&7[&4" + KamiMod.KAMI_KANJI + "&7] &r" + message);
}
}

public static void sendKamiCommand(String command, boolean addToHistory) {
Expand Down

0 comments on commit cea3c69

Please sign in to comment.