Getting stuff working
This commit is contained in:
1 parent
ee0243dd7e
commit
c6ebd6bbd3
14 files changed
+347
-31
No files matched your search
@@ -1,16 +1,20 @@
|
||||
package io.github.darkkronicle.advancedchathud;
|
||||
|
||||
import fi.dy.masa.malilib.MaLiLib;
|
||||
import fi.dy.masa.malilib.event.InitializationHandler;
|
||||
import io.github.darkkronicle.advancedchathud.tabs.MainChatTab;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class AdvancedChatHud implements ClientModInitializer {
|
||||
|
||||
public static final String MOD_ID = "advancedchathud";
|
||||
public static MainChatTab MAIN_CHAT_TAB;
|
||||
public static Logger LOGGER = LogManager.getLogger("AdvancedChatHUD");
|
||||
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
|
||||
@@ -4,6 +4,7 @@ import fi.dy.masa.malilib.config.ConfigManager;
|
||||
import fi.dy.masa.malilib.event.RenderEventHandler;
|
||||
import fi.dy.masa.malilib.interfaces.IInitializationHandler;
|
||||
import fi.dy.masa.malilib.util.StringUtils;
|
||||
import io.github.darkkronicle.advancedchatcore.AdvancedChatCore;
|
||||
import io.github.darkkronicle.advancedchatcore.chat.ChatHistory;
|
||||
import io.github.darkkronicle.advancedchatcore.chat.ChatScreenSectionHolder;
|
||||
import io.github.darkkronicle.advancedchatcore.config.gui.GuiConfigHandler;
|
||||
@@ -23,6 +24,7 @@ public class HudInitHandler implements IInitializationHandler {
|
||||
|
||||
@Override
|
||||
public void registerModHandlers() {
|
||||
AdvancedChatCore.FORWARD_TO_HUD = false;
|
||||
ConfigManager
|
||||
.getInstance()
|
||||
.registerConfigHandler(
|
||||
@@ -70,15 +72,7 @@ public class HudInitHandler implements IInitializationHandler {
|
||||
.addOnClear(() -> HudChatMessageHolder.getInstance().clear());
|
||||
ChatHistory
|
||||
.getInstance()
|
||||
.addOnUpdate((message, type) -> {
|
||||
if (type == IChatMessageProcessor.UpdateType.ADDED) {
|
||||
HudChatMessageHolder
|
||||
.getInstance()
|
||||
.addMessage(new HudChatMessage(message));
|
||||
} else if (type == IChatMessageProcessor.UpdateType.REMOVE) {
|
||||
HudChatMessageHolder.getInstance().remove(message);
|
||||
}
|
||||
});
|
||||
.addOnUpdate(HudChatMessageHolder.getInstance());
|
||||
RenderEventHandler
|
||||
.getInstance()
|
||||
.registerGameOverlayRenderer(WindowManager.getInstance());
|
||||
|
||||
@@ -12,8 +12,10 @@ import io.github.darkkronicle.advancedchatcore.config.options.ConfigSimpleColor;
|
||||
import io.github.darkkronicle.advancedchatcore.interfaces.IJsonSave;
|
||||
import io.github.darkkronicle.advancedchatcore.util.ColorUtil;
|
||||
import io.github.darkkronicle.advancedchatcore.util.FindType;
|
||||
import io.github.darkkronicle.advancedchathud.AdvancedChatHud;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import lombok.Data;
|
||||
@@ -28,6 +30,8 @@ public class ChatTab {
|
||||
return StringUtils.translate("advancedchathud.config.tab." + key);
|
||||
}
|
||||
|
||||
private UUID uuid = UUID.randomUUID();
|
||||
|
||||
private ConfigStorage.SaveableConfig<ConfigString> name = ConfigStorage.SaveableConfig.fromConfig(
|
||||
"name",
|
||||
new ConfigString(
|
||||
@@ -127,13 +131,26 @@ public class ChatTab {
|
||||
showUnread
|
||||
);
|
||||
|
||||
/**
|
||||
* Options that the main tab can use
|
||||
*/
|
||||
private final ImmutableList<ConfigStorage.SaveableConfig<?>> mainEditableOptions = ImmutableList.of(
|
||||
name,
|
||||
startingMessage,
|
||||
abbreviation,
|
||||
mainColor,
|
||||
borderColor,
|
||||
innerColor,
|
||||
showUnread
|
||||
);
|
||||
|
||||
public FindType getFind() {
|
||||
return (FindType) findType.config.getOptionListValue();
|
||||
}
|
||||
|
||||
public List<String> getWidgetHoverLines() {
|
||||
String translated = StringUtils.translate(
|
||||
"advancedchat.config.filterdescription"
|
||||
"advancedchathud.config.tabdescription"
|
||||
);
|
||||
ArrayList<String> hover = new ArrayList<>();
|
||||
for (String s : translated.split("\n")) {
|
||||
@@ -181,6 +198,18 @@ public class ChatTab {
|
||||
option.setValueFromJsonElement(obj.get(conf.key));
|
||||
}
|
||||
}
|
||||
if (obj.has("uuid")) {
|
||||
try {
|
||||
t.setUuid(UUID.fromString(obj.get("uuid").getAsString()));
|
||||
} catch (Exception e) {
|
||||
// Failed, but a new one will happen
|
||||
AdvancedChatHud.LOGGER.warn(
|
||||
"Tab " +
|
||||
t.getName().config.getStringValue() +
|
||||
" did not have a UUID. New one will be generated."
|
||||
);
|
||||
}
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
@@ -190,6 +219,7 @@ public class ChatTab {
|
||||
for (ConfigStorage.SaveableConfig<?> option : tab.getOptions()) {
|
||||
obj.add(option.key, option.config.getAsJsonElement());
|
||||
}
|
||||
obj.addProperty("uuid", tab.getUuid().toString());
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import fi.dy.masa.malilib.gui.GuiConfigsBase;
|
||||
import fi.dy.masa.malilib.gui.button.ButtonBase;
|
||||
import fi.dy.masa.malilib.gui.button.ButtonGeneric;
|
||||
import fi.dy.masa.malilib.gui.button.IButtonActionListener;
|
||||
import fi.dy.masa.malilib.util.GuiUtils;
|
||||
import fi.dy.masa.malilib.util.KeyCodes;
|
||||
import fi.dy.masa.malilib.util.StringUtils;
|
||||
import io.github.darkkronicle.advancedchatcore.config.ConfigStorage;
|
||||
import io.github.darkkronicle.advancedchathud.AdvancedChatHud;
|
||||
@@ -16,16 +18,22 @@ import net.minecraft.client.gui.screen.Screen;
|
||||
public class GuiTabEditor extends GuiConfigsBase {
|
||||
|
||||
private final ChatTab tab;
|
||||
private final boolean main;
|
||||
|
||||
public GuiTabEditor(Screen parent, ChatTab tab) {
|
||||
this(parent, tab, false);
|
||||
}
|
||||
|
||||
public GuiTabEditor(Screen parent, ChatTab tab, boolean main) {
|
||||
super(
|
||||
10,
|
||||
50,
|
||||
AdvancedChatHud.MOD_ID,
|
||||
null,
|
||||
parent,
|
||||
tab.getName().config.getStringValue()
|
||||
);
|
||||
this.tab = tab;
|
||||
this.main = main;
|
||||
this.setParent(parent);
|
||||
}
|
||||
|
||||
@@ -70,7 +78,13 @@ public class GuiTabEditor extends GuiConfigsBase {
|
||||
@Override
|
||||
public List<ConfigOptionWrapper> getConfigs() {
|
||||
ArrayList<IConfigBase> config = new ArrayList<>();
|
||||
for (ConfigStorage.SaveableConfig<? extends IConfigBase> s : tab.getOptions()) {
|
||||
List<ConfigStorage.SaveableConfig<? extends IConfigBase>> options;
|
||||
if (main) {
|
||||
options = tab.getMainEditableOptions();
|
||||
} else {
|
||||
options = tab.getOptions();
|
||||
}
|
||||
for (ConfigStorage.SaveableConfig<? extends IConfigBase> s : options) {
|
||||
config.add(s.config);
|
||||
}
|
||||
|
||||
@@ -98,6 +112,30 @@ public class GuiTabEditor extends GuiConfigsBase {
|
||||
closeGui(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyTyped(int keyCode, int scanCode, int modifiers) {
|
||||
// Override so that on escape stuff still gets saved
|
||||
if (this.activeKeybindButton != null) {
|
||||
this.activeKeybindButton.onKeyPressed(keyCode);
|
||||
return true;
|
||||
} else {
|
||||
if (this.getListWidget().onKeyTyped(keyCode, scanCode, modifiers)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (
|
||||
keyCode == KeyCodes.KEY_ESCAPE &&
|
||||
this.parentScreen != GuiUtils.getCurrentScreen()
|
||||
) {
|
||||
// Make sure to save
|
||||
closeGui(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ButtonListener implements IButtonActionListener {
|
||||
|
||||
private final GuiTabEditor parent;
|
||||
|
||||
@@ -20,6 +20,7 @@ import io.github.darkkronicle.advancedchatcore.config.ConfigStorage;
|
||||
import io.github.darkkronicle.advancedchatcore.config.options.ConfigSimpleColor;
|
||||
import io.github.darkkronicle.advancedchatcore.util.ColorUtil;
|
||||
import io.github.darkkronicle.advancedchathud.AdvancedChatHud;
|
||||
import io.github.darkkronicle.advancedchathud.gui.WindowManager;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -348,6 +349,7 @@ public class HudConfigStorage implements IConfigHandler {
|
||||
JsonElement tab = root.get("maintab");
|
||||
if (tab.isJsonObject()) {
|
||||
MAIN_TAB = tabJson.load(tab.getAsJsonObject());
|
||||
AdvancedChatHud.MAIN_CHAT_TAB.refreshOptions();
|
||||
}
|
||||
JsonElement tabs = root.get("tabs");
|
||||
TABS.clear();
|
||||
@@ -358,6 +360,17 @@ public class HudConfigStorage implements IConfigHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
AdvancedChatHud.MAIN_CHAT_TAB.setUpTabs();
|
||||
|
||||
JsonElement windows = root.get("windows");
|
||||
if (windows != null && windows.isJsonArray()) {
|
||||
WindowManager
|
||||
.getInstance()
|
||||
.loadFromJson(windows.getAsJsonArray());
|
||||
} else {
|
||||
WindowManager.getInstance().loadFromJson(null);
|
||||
}
|
||||
|
||||
ConfigStorage.readOptions(
|
||||
root,
|
||||
General.NAME,
|
||||
@@ -397,6 +410,7 @@ public class HudConfigStorage implements IConfigHandler {
|
||||
tabs.add(tabJson.save(tab));
|
||||
}
|
||||
root.add("tabs", tabs);
|
||||
root.add("windows", WindowManager.getInstance().saveJson());
|
||||
root.add("config_version", new JsonPrimitive(CONFIG_VERSION));
|
||||
|
||||
ConfigStorage.writeJsonToFile(
|
||||
@@ -424,7 +438,7 @@ public class HudConfigStorage implements IConfigHandler {
|
||||
|
||||
private static String translate(String key) {
|
||||
return StringUtils.translate(
|
||||
"advancedchat.config.hudlinetype." + key
|
||||
"advancedchathud.config.hudlinetype." + key
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,10 @@ package io.github.darkkronicle.advancedchathud.config;
|
||||
|
||||
import fi.dy.masa.malilib.gui.interfaces.ISelectionListener;
|
||||
import fi.dy.masa.malilib.gui.widgets.WidgetListBase;
|
||||
import io.github.darkkronicle.advancedchathud.AdvancedChatHud;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
|
||||
@@ -43,6 +46,10 @@ public class WidgetListTabs extends WidgetListBase<ChatTab, WidgetTabEntry> {
|
||||
|
||||
@Override
|
||||
protected Collection<ChatTab> getAllEntries() {
|
||||
return HudConfigStorage.TABS;
|
||||
ArrayList<ChatTab> tabs = new ArrayList<>(
|
||||
Collections.singleton(HudConfigStorage.MAIN_TAB)
|
||||
);
|
||||
tabs.addAll(HudConfigStorage.TABS);
|
||||
return tabs;
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ public class WidgetTabEntry extends WidgetListEntryBase<ChatTab> {
|
||||
private final List<String> hoverLines;
|
||||
private final int buttonStartX;
|
||||
private final ChatTab tab;
|
||||
private boolean main = true;
|
||||
|
||||
public WidgetTabEntry(
|
||||
int x,
|
||||
@@ -46,7 +47,11 @@ public class WidgetTabEntry extends WidgetListEntryBase<ChatTab> {
|
||||
y += 1;
|
||||
int pos = x + width - 2;
|
||||
|
||||
pos -= addButton(pos, y, ButtonListener.Type.REMOVE);
|
||||
if (listIndex != 0) {
|
||||
main = false;
|
||||
// If it's 0 it's the main tab
|
||||
pos -= addButton(pos, y, ButtonListener.Type.REMOVE);
|
||||
}
|
||||
pos -= addButton(pos, y, ButtonListener.Type.CONFIGURE);
|
||||
|
||||
buttonStartX = pos;
|
||||
@@ -163,7 +168,11 @@ public class WidgetTabEntry extends WidgetListEntryBase<ChatTab> {
|
||||
}
|
||||
if (type == Type.CONFIGURE) {
|
||||
GuiBase.openGui(
|
||||
new GuiTabEditor(parent.parent.getParent(), parent.tab)
|
||||
new GuiTabEditor(
|
||||
parent.parent.getParent(),
|
||||
parent.tab,
|
||||
parent.main
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -179,7 +188,7 @@ public class WidgetTabEntry extends WidgetListEntryBase<ChatTab> {
|
||||
}
|
||||
|
||||
private static String translate(String key) {
|
||||
return "advancedchat.config.tabmenu." + key;
|
||||
return "advancedchathud.config.tabmenu." + key;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package io.github.darkkronicle.advancedchathud.gui;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import fi.dy.masa.malilib.render.RenderUtils;
|
||||
import fi.dy.masa.malilib.util.StringUtils;
|
||||
import io.github.darkkronicle.advancedchatcore.chat.ChatHistory;
|
||||
import io.github.darkkronicle.advancedchatcore.chat.ChatMessage;
|
||||
import io.github.darkkronicle.advancedchatcore.config.ConfigStorage;
|
||||
import io.github.darkkronicle.advancedchatcore.interfaces.IJsonSave;
|
||||
import io.github.darkkronicle.advancedchatcore.util.ColorUtil;
|
||||
import io.github.darkkronicle.advancedchatcore.util.EasingMethod;
|
||||
import io.github.darkkronicle.advancedchatcore.util.FluidText;
|
||||
@@ -18,6 +19,7 @@ import io.github.darkkronicle.advancedchathud.config.HudConfigStorage;
|
||||
import io.github.darkkronicle.advancedchathud.tabs.AbstractChatTab;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.fabricmc.api.EnvType;
|
||||
@@ -51,6 +53,8 @@ public class ChatWindow {
|
||||
|
||||
private final MinecraftClient client;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
private HudConfigStorage.Visibility visibility = (HudConfigStorage.Visibility) HudConfigStorage.General.VISIBILITY.config.getOptionListValue();
|
||||
|
||||
private List<ChatMessage> lines;
|
||||
@@ -738,4 +742,58 @@ public class ChatWindow {
|
||||
public void clearLines() {
|
||||
this.lines.clear();
|
||||
}
|
||||
|
||||
public static class ChatWindowSerializer implements IJsonSave<ChatWindow> {
|
||||
|
||||
@Override
|
||||
public ChatWindow load(JsonObject obj) {
|
||||
if (!obj.has("tabuuid")) {
|
||||
return null;
|
||||
}
|
||||
String uuidEl = obj.get("tabuuid").getAsString();
|
||||
UUID uuid = UUID.fromString(uuidEl);
|
||||
AbstractChatTab tab = AdvancedChatHud.MAIN_CHAT_TAB.fromUUID(uuid);
|
||||
if (tab == null) {
|
||||
AdvancedChatHud.LOGGER.warn(
|
||||
"Tab with UUID " + uuidEl + " could not be found!"
|
||||
);
|
||||
return null;
|
||||
}
|
||||
ChatWindow window = new ChatWindow(tab);
|
||||
window.setSelected(obj.get("selected").getAsBoolean());
|
||||
window.setPosition(
|
||||
obj.get("x").getAsInt(),
|
||||
obj.get("y").getAsInt()
|
||||
);
|
||||
window.setVisibility(
|
||||
HudConfigStorage.Visibility.fromVisibilityString(
|
||||
obj.get("visibility").getAsString()
|
||||
)
|
||||
);
|
||||
window.setDimensions(
|
||||
obj.get("width").getAsInt(),
|
||||
obj.get("height").getAsInt()
|
||||
);
|
||||
return window;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonObject save(ChatWindow chatWindow) {
|
||||
JsonObject obj = new JsonObject();
|
||||
obj.addProperty("x", chatWindow.getX());
|
||||
obj.addProperty("y", chatWindow.getY());
|
||||
obj.addProperty("width", chatWindow.getWidth());
|
||||
obj.addProperty("height", chatWindow.getHeight());
|
||||
obj.addProperty(
|
||||
"visibility",
|
||||
chatWindow.getVisibility().getStringValue()
|
||||
);
|
||||
obj.addProperty(
|
||||
"tabuuid",
|
||||
chatWindow.getTab().getUuid().toString()
|
||||
);
|
||||
obj.addProperty("selected", chatWindow.isSelected());
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
package io.github.darkkronicle.advancedchathud.gui;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import fi.dy.masa.malilib.interfaces.IRenderer;
|
||||
import io.github.darkkronicle.advancedchatcore.chat.AdvancedChatScreen;
|
||||
import io.github.darkkronicle.advancedchatcore.chat.ChatMessage;
|
||||
import io.github.darkkronicle.advancedchathud.AdvancedChatHud;
|
||||
import io.github.darkkronicle.advancedchathud.HudChatMessage;
|
||||
import io.github.darkkronicle.advancedchathud.tabs.AbstractChatTab;
|
||||
import java.util.LinkedList;
|
||||
@@ -32,6 +35,49 @@ public class WindowManager implements IRenderer {
|
||||
client = MinecraftClient.getInstance();
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
windows.clear();
|
||||
}
|
||||
|
||||
public void loadFromJson(JsonArray array) {
|
||||
reset();
|
||||
if (array == null || array.size() == 0) {
|
||||
ChatWindow base = new ChatWindow(AdvancedChatHud.MAIN_CHAT_TAB);
|
||||
base.setSelected(true);
|
||||
windows.add(base);
|
||||
return;
|
||||
}
|
||||
ChatWindow.ChatWindowSerializer serializer = new ChatWindow.ChatWindowSerializer();
|
||||
for (JsonElement e : array) {
|
||||
if (!e.isJsonObject()) {
|
||||
continue;
|
||||
}
|
||||
ChatWindow w;
|
||||
try {
|
||||
w = serializer.load(e.getAsJsonObject());
|
||||
if (w == null) {
|
||||
continue;
|
||||
}
|
||||
} catch (Exception err) {
|
||||
AdvancedChatHud.LOGGER.error(
|
||||
"Error while loading in ChatWindow ",
|
||||
err
|
||||
);
|
||||
continue;
|
||||
}
|
||||
windows.add(w);
|
||||
}
|
||||
}
|
||||
|
||||
public JsonArray saveJson() {
|
||||
JsonArray array = new JsonArray();
|
||||
ChatWindow.ChatWindowSerializer serializer = new ChatWindow.ChatWindowSerializer();
|
||||
for (ChatWindow w : windows) {
|
||||
array.add(serializer.save(w));
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderGameOverlayPost(MatrixStack matrixStack) {
|
||||
for (int i = windows.size() - 1; i >= 0; i--) {
|
||||
|
||||
@@ -6,7 +6,6 @@ import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.gui.hud.ChatHud;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Style;
|
||||
import net.minecraft.text.Text;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
@@ -30,13 +29,4 @@ public class MixinChatHud {
|
||||
private void render(MatrixStack stack, int delta, CallbackInfo ci) {
|
||||
ci.cancel();
|
||||
}
|
||||
|
||||
@Inject(
|
||||
at = @At("HEAD"),
|
||||
method = "addMessage(Lnet/minecraft/text/Text;I)V",
|
||||
cancellable = true
|
||||
)
|
||||
private void add(Text message, int messageId, CallbackInfo ci) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.github.darkkronicle.advancedchathud.tabs;
|
||||
|
||||
import io.github.darkkronicle.advancedchatcore.util.ColorUtil;
|
||||
import java.util.UUID;
|
||||
import lombok.Data;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
@@ -19,6 +20,7 @@ public abstract class AbstractChatTab {
|
||||
protected ColorUtil.SimpleColor mainColor;
|
||||
protected ColorUtil.SimpleColor borderColor;
|
||||
protected ColorUtil.SimpleColor innerColor;
|
||||
protected UUID uuid;
|
||||
private int unread = 0;
|
||||
protected boolean showUnread;
|
||||
|
||||
@@ -28,7 +30,8 @@ public abstract class AbstractChatTab {
|
||||
ColorUtil.SimpleColor mainColor,
|
||||
ColorUtil.SimpleColor borderColor,
|
||||
ColorUtil.SimpleColor innerColor,
|
||||
boolean showUnread
|
||||
boolean showUnread,
|
||||
UUID uuid
|
||||
) {
|
||||
this.name = name;
|
||||
this.abreviation = abreviation;
|
||||
@@ -36,6 +39,7 @@ public abstract class AbstractChatTab {
|
||||
this.showUnread = showUnread;
|
||||
this.innerColor = innerColor;
|
||||
this.borderColor = borderColor;
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public void addNewUnread() {
|
||||
|
||||
@@ -38,7 +38,8 @@ public class CustomChatTab extends AbstractChatTab {
|
||||
storage.getMainColor().config.getSimpleColor(),
|
||||
storage.getBorderColor().config.getSimpleColor(),
|
||||
storage.getInnerColor().config.getSimpleColor(),
|
||||
storage.getShowUnread().config.getBooleanValue()
|
||||
storage.getShowUnread().config.getBooleanValue(),
|
||||
storage.getUuid()
|
||||
);
|
||||
this.storage = storage;
|
||||
this.findType = storage.getFind();
|
||||
|
||||
@@ -5,6 +5,7 @@ import io.github.darkkronicle.advancedchathud.HudChatMessageHolder;
|
||||
import io.github.darkkronicle.advancedchathud.config.ChatTab;
|
||||
import io.github.darkkronicle.advancedchathud.config.HudConfigStorage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
@@ -26,7 +27,8 @@ public class MainChatTab extends AbstractChatTab {
|
||||
HudConfigStorage.MAIN_TAB.getMainColor().config.getSimpleColor(),
|
||||
HudConfigStorage.MAIN_TAB.getBorderColor().config.getSimpleColor(),
|
||||
HudConfigStorage.MAIN_TAB.getInnerColor().config.getSimpleColor(),
|
||||
HudConfigStorage.MAIN_TAB.getShowUnread().config.getBooleanValue()
|
||||
HudConfigStorage.MAIN_TAB.getShowUnread().config.getBooleanValue(),
|
||||
HudConfigStorage.MAIN_TAB.getUuid()
|
||||
);
|
||||
setUpTabs();
|
||||
}
|
||||
@@ -42,6 +44,7 @@ public class MainChatTab extends AbstractChatTab {
|
||||
HudConfigStorage.MAIN_TAB.getBorderColor().config.getSimpleColor();
|
||||
this.showUnread =
|
||||
HudConfigStorage.MAIN_TAB.getShowUnread().config.getBooleanValue();
|
||||
this.uuid = HudConfigStorage.MAIN_TAB.getUuid();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,5 +75,15 @@ public class MainChatTab extends AbstractChatTab {
|
||||
}
|
||||
message.setTabs(tabs);
|
||||
}
|
||||
this.refreshOptions();
|
||||
}
|
||||
|
||||
public AbstractChatTab fromUUID(UUID uuid) {
|
||||
for (AbstractChatTab tab : allChatTabs) {
|
||||
if (tab.getUuid().equals(uuid)) {
|
||||
return tab;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
{
|
||||
"advancedchat.config.yes": "Correct!",
|
||||
|
||||
"advancedchathud.gui.button.addtab": "New Chat Tab",
|
||||
"advancedchathud.tab.general": "§9Chat HUD",
|
||||
"advancedchathud.tab.tabs": "§bChat Tabs",
|
||||
|
||||
"advancedchathud.config.general.timeformat": "Time Format",
|
||||
"advancedchathud.config.general.info.timeformat": "How time is displayed if §6Show Time§r is enabled for both the §9Chat HUD§r and the §aChat Log§r. \nSee the §6SimpleDateFormat§r class for the format ",
|
||||
"advancedchathud.config.general.chatheads": "Display Chat Heads",
|
||||
"advancedchathud.config.general.info.chatheads": "Whether or not the §6head of the message sender§r displays beside their message",
|
||||
|
||||
"advancedchathud.config.general.width": "Chat Width",
|
||||
"advancedchathud.config.general.info.width": "The §6width §rof the §9Chat HUD \nOverrides Vanilla chat width!",
|
||||
"advancedchathud.config.general.height": "Chat Height",
|
||||
"advancedchathud.config.general.info.height": "The §6height §rof the §9Chat HUD \nOverrides Vanilla chat width!",
|
||||
"advancedchathud.config.general.showtabs": "Show Chat Tabs",
|
||||
"advancedchathud.config.general.info.showtabs": "Whether or not §bChat Tabs §rare visible on the §6side§r of the §9Chat HUD",
|
||||
"advancedchathud.config.general.leftpad": "Left-Side Chat Padding",
|
||||
"advancedchathud.config.general.info.leftpad": "The amount of space between the §6left side§r of the chat box to where the §6text starts",
|
||||
"advancedchathud.config.general.rightpad": "Right-Side Chat Padding",
|
||||
"advancedchathud.config.general.info.rightpad": "The amount of space between the §6right side§r of the chat box to where the §6text breaks",
|
||||
"advancedchathud.config.general.bottompad": "Bottom-Side Chat Padding",
|
||||
"advancedchathud.config.general.info.bottompad": "The amount of space between the §6bottom§r of the chat box to the §6newest message",
|
||||
"advancedchathud.config.general.toppad": "Top-Side Chat Padding",
|
||||
"advancedchathud.config.general.info.toppad": "The amount of space between the §6top§r of the chat box to the §6old",
|
||||
"advancedchathud.config.general.tabsidechars": "Max Abbreviation Length",
|
||||
"advancedchathud.config.general.info.tabsidechars": "The most amount of characters used for §6abbreviations§r of §bChat Tabs§r \nAffects the appearence of chat tabs §6beside§r the §9Chat HUD",
|
||||
"advancedchathud.config.general.visibility": "Chat Visibility",
|
||||
"advancedchathud.config.general.info.visibility": "What the behavior of the §6visibility§r the §9Chat HUD§r should be \n§6Vanilla §r- §9Chat HUD §rrenders as it does in §6Vanilla \n§aAlways §r- Renders the §9Chat HUD §6at all times \n§cFocus Only §r- Renders the §9Chat HUD §6only §rif the §6Chat Box§r is open",
|
||||
"advancedchathud.config.visibility.vanilla": "§6Vanilla",
|
||||
"advancedchathud.config.visibility.always": "§aAlways",
|
||||
"advancedchathud.config.visibility.focus_only": "§cFocus Only",
|
||||
"advancedchathud.config.general.linespace": "Spacing Between Lines",
|
||||
"advancedchathud.config.general.info.linespace": "The §6space§r (in pixels) between lines of chat",
|
||||
"advancedchathud.config.general.x": "Chat X",
|
||||
"advancedchathud.config.general.info.x": "The §6x-coodinate §rof the chat box, starting at the §6bottom-left §rside of the screen",
|
||||
"advancedchathud.config.general.y": "Chat Y",
|
||||
"advancedchathud.config.general.info.y": "The §6y-coodinate §rof the chat box, starting at the §6bottom-left §rside of the screen",
|
||||
"advancedchathud.config.general.messagespace": "Padding Between Messages",
|
||||
"advancedchathud.config.general.info.messagespace": "How much space should be between §6individual messages",
|
||||
"advancedchathud.config.general.chatscale": "Chat Scale",
|
||||
"advancedchathud.config.general.info.chatscale": "How §6big or small §rthe text §6inside§r of the chat box is. Does not affect the size of the §9Chat HUD§r!",
|
||||
"advancedchathud.config.general.fadetime": "Fade Speed",
|
||||
"advancedchathud.config.general.info.fadetime": "How quickly messages take to §6fade-out§r",
|
||||
"advancedchathud.config.general.fadestart": "Time Until Fade",
|
||||
"advancedchathud.config.general.info.fadestart": "The §6number of ticks §rbefore newly received messages begin to disappear",
|
||||
"advancedchathud.config.general.fadetype": "Fade Style",
|
||||
"advancedchathud.config.general.info.fadetype": "The §6easing function§r used for the fade animation \nVanilla uses §6linear §reasing",
|
||||
"advancedchat.config.easing.linear": "§cLinear",
|
||||
"advancedchat.config.easing.sine": "§6Sinusoidal",
|
||||
"advancedchat.config.easing.quad": "§eQuadratic",
|
||||
"advancedchat.config.easing.quart": "§aQuartic",
|
||||
"advancedchat.config.easing.circ": "§bCircular",
|
||||
"advancedchathud.config.general.hudbackgroundcolor": "HUD Background Color",
|
||||
"advancedchathud.config.general.info.hudbackgroundcolor": "The color of the §6background §rof the §9Chat HUD",
|
||||
"advancedchathud.config.general.emptytextcolor": "Empty Text Color",
|
||||
"advancedchathud.config.general.info.emptytextcolor": "The color of text with §6no formatting §r(such as text formatted with §6§r)",
|
||||
"advancedchathud.config.general.hudlinetype": "Background Line Style",
|
||||
"advancedchathud.config.general.info.hudlinetype": "How the §6background §rof the §6unfocused §9Chat HUD §ris fitted to the messages \n§6Full §r- Fits the background to the §6width §r of the §9Chat HUD §r \n§bCompact §r- Fits the background to the length of each respective §6line§r",
|
||||
"advancedchathud.config.hudlinetype.full": "§6Full",
|
||||
"advancedchathud.config.hudlinetype.compact": "§bCompact",
|
||||
"advancedchathud.config.general.alternatelines": "Striped Messages",
|
||||
"advancedchathud.config.general.info.alternatelines": "Whether or not the backgrounds of §6every other message §ris colored differently to create a §6striped§r effect \n§7Helps to differentiate between messages",
|
||||
"advancedchathud.config.general.showtime": "Show Time",
|
||||
"advancedchathud.config.general.info.showtime": "Whether or not the §6time §ris displayed in the §9Chat HUD §r \nThe format can be configured in §7General§r",
|
||||
"advancedchathud.config.general.storedlines": "Stored Lines",
|
||||
"advancedchathud.config.general.info.storedlines": "The §6maximum§r amount of lines stored in the §9Chat HUD§r \n§7Excessively large values may result in out-of-memory errors!",
|
||||
"advancedchathud.config.general.persistenttext": "Persistent Text",
|
||||
"advancedchathud.config.general.info.persistenttext": "Whether or not messages that are §6typed but not sent§r are kept after closing the §9Chat Box",
|
||||
"advancedchathud.config.general.moretext": "Extended Text Limit",
|
||||
"advancedchathud.config.general.info.moretext": "Whether or not messages that are §6over the 256 character limit§r are broken into multiple chat messages",
|
||||
"advancedchathud.config.general.sendtocurrenttab": "Always Send Message to Focused Tab",
|
||||
"advancedchathud.config.general.info.sendtocurrenttab": "Whether or not messages §6sent by you§r are displayed in the currently focused tab, §6regardless of the chat filter",
|
||||
|
||||
"advancedchathud.config.tabmenu.configure": "§bConfigure",
|
||||
"advancedchathud.config.tabmenu.remove": "§cDelete",
|
||||
"advancedchathud.config.tabdescription": "§7Name§r: <name> \n§aFind String§r: <find>\n§eFind Type§r: <findtype>",
|
||||
|
||||
"advancedchathud.gui.button.import": "Import Tab",
|
||||
"advancedchathud.config.tab.name": "Tab Name",
|
||||
"advancedchathud.config.tab.info.name": "What the tab shows up as §6in the config \n§7§oIt is good practice to name your tabs meaningfully!",
|
||||
"advancedchathud.config.tab.startingmessage": "Starting Message",
|
||||
"advancedchathud.config.tab.info.startingmessage": "What text shows up §6when the tab is focused§r",
|
||||
"advancedchathud.config.tab.abbreviation": "Tab HUD Abbreviation",
|
||||
"advancedchathud.config.tab.info.abbreviation": "What the tab shows up as §6on the side of the §9Chat HUD§r if §6Show Chat Tabs§r is enabled under §9Chat HUD§r settings",
|
||||
"advancedchathud.config.tab.forward": "Forward Messages to Main",
|
||||
"advancedchathud.config.tab.info.forward": "Whether or not messages sent to this chat tab also show up in the §6main chat tab§r",
|
||||
"advancedchathud.config.tab.forwardtoggle": "%s",
|
||||
"advancedchathud.config.tab.findstring": "Find String",
|
||||
"advancedchathud.config.tab.info.findstring": "The string that will be §6searached§r and §6diverted to this tab§r",
|
||||
"advancedchathud.config.tab.findtype": "Find Type",
|
||||
"advancedchathud.config.tab.info.findtype": "How matches will be found\n§6Literal §r- Matches §6exactly §rthe string\n§eUpper-Lower §r- Like §6Literal, §rbut not §6case-sensitive\n§bRegEx §r - Parses the string as a §6regular expression\n§dAll §r- Passes §6all §rtext through to the tab, regardless of the string to find",
|
||||
"advancedchathud.config.tab.maincolor": "Accent Color",
|
||||
"advancedchathud.config.tab.info.maincolor": "The §6accent color§r of the §bchat tab§r",
|
||||
"advancedchathud.config.tab.bordercolor": "Border Color",
|
||||
"advancedchathud.config.tab.info.bordercolor": "The color of the §6outline§r of the §6chat tab§r",
|
||||
"advancedchathud.config.tab.innercolor": "Background Color",
|
||||
"advancedchathud.config.tab.info.innercolor": "The color of the §6background§r of the §bchat tab",
|
||||
"advancedchathud.config.tab.showunread": "Show Unread Messages",
|
||||
"advancedchathud.config.tab.info.showunread": "Whether or not the number of §6unread messages§r are displayed for the §bchat tab§r",
|
||||
|
||||
"advancedchat.config.findtype.literal": "§6Literal",
|
||||
"advancedchat.config.findtype.upperlower": "§eUpper-Lower",
|
||||
"advancedchat.config.findtype.regex": "§bRegEx",
|
||||
"advancedchat.config.findtype.all": "§dAll"
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user