proper disable method

This commit is contained in:
Bella 2020-03-20 17:50:06 -04:00
parent 11b79dd197
commit 44e2ac8efc
No known key found for this signature in database
GPG Key ID: 815562EA23BFE344
9 changed files with 27 additions and 3 deletions

View File

@ -2,6 +2,7 @@ package me.zeroeightsix.kami.command;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.syntax.SyntaxChunk;
import me.zeroeightsix.kami.module.ModuleManager;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
import me.zeroeightsix.kami.util.Wrapper;
@ -53,6 +54,15 @@ public abstract class Command {
for (String s : messages) sendRawChatMessage(s);
}
public static void sendDisableMessage(String moduleName) {
sendErrorMessage("Error: The " + moduleName + " module is only for configuring the GUI element. In order to show the GUI element you need to hit the pin in the upper left of the module");
ModuleManager.getModuleByName(moduleName).enable();
}
public static void sendAutoDisableMessage(String moduleName, boolean startup) {
if (startup) sendWarningMessage("Note: The " + moduleName + " module has automatic startup enabled. If you want to keep it disabled, disable the automatic startup setting");
}
public static void sendRawChatMessage(String message) {
if (Minecraft.getMinecraft().player != null) {
Wrapper.getPlayer().sendMessage(new ChatMessage(message));

View File

@ -2,6 +2,7 @@ package me.zeroeightsix.kami.module.modules.capes;
import com.google.gson.Gson;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.util.Wrapper;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
@ -152,4 +153,6 @@ public class Capes extends Module {
textureManager.loadTexture(location, textureCape);
}
}
public void onDisable() { Command.sendAutoDisableMessage(getName(), startupGlobal.getValue()); }
}

View File

@ -76,4 +76,6 @@ public class CustomChat extends Module {
startTime = System.currentTimeMillis();
}
}
public void onDisable() { Command.sendAutoDisableMessage(getName(), startupGlobal.getValue()); }
}

View File

@ -1,5 +1,6 @@
package me.zeroeightsix.kami.module.modules.gui;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
@ -25,4 +26,5 @@ public class CleanGUI extends Module {
return INSTANCE.isEnabled();
}
public void onDisable() { Command.sendAutoDisableMessage(getName(), startupGlobal.getValue()); }
}

View File

@ -16,6 +16,7 @@ import net.minecraft.util.text.TextFormatting;
import java.util.ArrayList;
import static me.zeroeightsix.kami.command.Command.sendDisableMessage;
import static me.zeroeightsix.kami.util.ColourUtils.getStringColour;
/**
@ -119,5 +120,5 @@ public class InfoOverlay extends Module {
return infoContents;
}
public void onDisable() { enable(); }
public void onDisable() { sendDisableMessage(getName()); }
}

View File

@ -164,6 +164,5 @@ public class InventoryViewer extends Module {
GlStateManager.popMatrix();
}
@Override
public void onDisable() { enable(); }
public void onDisable() { sendDisableMessage(getName()); }
}

View File

@ -1,5 +1,6 @@
package me.zeroeightsix.kami.module.modules.gui;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
@ -7,4 +8,6 @@ import me.zeroeightsix.kami.setting.Settings;
@Module.Info(name = "PrefixChat", category = Module.Category.GUI, description = "Opens chat with prefix inside when prefix is pressed.", showOnArray = Module.ShowOnArray.OFF)
public class PrefixChat extends Module {
public Setting<Boolean> startupGlobal = register(Settings.b("Enable Automatically", true));
public void onDisable() { Command.sendAutoDisableMessage(getName(), startupGlobal.getValue()); }
}

View File

@ -68,4 +68,5 @@ public class DiscordSettings extends Module {
}
}
public void onDisable() { Command.sendAutoDisableMessage(getName(), startupGlobal.getValue()); }
}

View File

@ -1,6 +1,7 @@
package me.zeroeightsix.kami.module.modules.render;
import me.zeroeightsix.kami.KamiMod;
import me.zeroeightsix.kami.command.Command;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
@ -23,4 +24,6 @@ public class TabFriends extends Module {
if (Friends.isFriend(dname)) return String.format("%sa%s", KamiMod.colour, dname);
return dname;
}
public void onDisable() { Command.sendAutoDisableMessage(getName(), startupGlobal.getValue()); }
}