have toggle for CC:keep

This commit is contained in:
Daniella / Tove 2024-05-26 02:02:54 +02:00
parent 3552b973c3
commit d5ee578f57

View file

@ -68,19 +68,21 @@ public class ChatCrypt extends Feature {
@Gate(1) @Gate(1)
public int boxSize = 256; public int boxSize = 256;
@Config("Allow CC:keep")
@Gate(2)
public boolean allowCCKeep = true;
@Config("Keep Trypt instance") @Config("Keep Trypt instance")
@Gate(2) @Gate(2)
@Marker(3) @Marker(3)
public boolean keepTrypt = false; public boolean keepTrypt = false;
@Config("Warning! More secure, worse QOL")
@MultiGate(and = {3, -2})
@Marker(-2)
public boolean _keep_info = true;
@Config("Reset Trypt") @Config("Reset Trypt")
@MultiGate(and = {2, 3}) @MultiGate(and = {2, 3})
public Button.ClickEvent resetTrypt = btn -> trypt = null; public Button.ClickEvent resetTrypt = btn -> {
trypt = null;
HUD.notifyAndPrint("§c§lChat>§a Trypt instance reset.");
};
private Trypt trypt; private Trypt trypt;
@ -89,7 +91,6 @@ public class ChatCrypt extends Feature {
@Config("Password") @Config("Password")
public String password = "CLICK HERE"; public String password = "CLICK HERE";
@SuppressWarnings("ConstantValue")
public void onEnable() { public void onEnable() {
if(password.isEmpty() || password.equalsIgnoreCase("CLICK HERE")) { if(password.isEmpty() || password.equalsIgnoreCase("CLICK HERE")) {
toggle(); toggle();
@ -135,7 +136,7 @@ public class ChatCrypt extends Feature {
GlobalUtil.LOGGER.debug("Successfully kept Trypt key up-to-date."); GlobalUtil.LOGGER.debug("Successfully kept Trypt key up-to-date.");
} }
else { else {
HUD.notifyAndPrint("§c§lChat>§c Unable to keep Trypt key up-to-date. Disabled keep. (Enable and sync by sending CC:keep)"); HUD.notifyAndPrint("§c§lChat>§c Unable to keep Trypt key up-to-date. Disabled keep." + (allowCCKeep ? " (Enable and sync by sending CC:keep)" : ""));
keepTrypt = false; keepTrypt = false;
} }
} }
@ -143,7 +144,7 @@ public class ChatCrypt extends Feature {
sentEncrypted = null; sentEncrypted = null;
sentOriginal = null; sentOriginal = null;
if(!useSBE && message.equals("CC:keep")) { if(!useSBE && message.equals("CC:keep") && allowCCKeep) {
keepTrypt = true; keepTrypt = true;
trypt = null; trypt = null;
HUD.notifyAndPrint("§c§lChat>§c Enabled and synchronized Trypt keep."); HUD.notifyAndPrint("§c§lChat>§c Enabled and synchronized Trypt keep.");