package dev.crucifixbeta.mod.modules.impl.misc;

import dev.crucifixbeta.api.events.eventbus.EventListener;
import dev.crucifixbeta.api.events.impl.SendMessageEvent;
import dev.crucifixbeta.mod.modules.Module;
import dev.crucifixbeta.mod.modules.settings.impl.StringSetting;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;

@Environment(EnvType.CLIENT)
public class ChatAppend extends Module {
   public static ChatAppend INSTANCE;
   private final StringSetting message = this.add(new StringSetting("Text", "crucifixbeta"));

   public ChatAppend() {
      super("ChatAppend", Module.Category.Misc);
      this.setChinese("\u6d88\u606f\u540e\u7f00");
      INSTANCE = this;
   }

   @EventListener
   public void onSendMessage(SendMessageEvent event) {
      if (!nullCheck() && !event.isCancelled() && !AutoReconnect.inQueueServer) {
         String var2 = event.message;
         if (!var2.startsWith("/")
            && !var2.startsWith("!")
            && !var2.startsWith("$")
            && !var2.startsWith("#")
            && !var2.endsWith(this.message.getValue())) {
            String var3 = this.message.getValue();
            event.message = var2 + " " + var3;
         }
      }
   }
}
