Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 4 additions & 30 deletions src/main/java/xyz/omegaware/addon/OmegawareAddons.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
import meteordevelopment.meteorclient.utils.Utils;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.metadata.ModMetadata;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ServerInfo;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import xyz.omegaware.addon.commands.LinkCommand;
import xyz.omegaware.addon.commands.ShulkerQueueCommand;
import xyz.omegaware.addon.hud.OnlineTSRMembersHUD;
Expand All @@ -30,37 +26,12 @@ public class OmegawareAddons extends MeteorAddon {
public static ModMetadata MOD_META;
public static final Logger LOG = LogUtils.getLogger();
public static final Category CATEGORY = new Category("OmegaWare");
@SuppressWarnings("unused")
public static final HudGroup HUD_GROUP = new HudGroup("OmegaWare");

public static File GetConfigFile(String key, String filename) {
return new File(new File(new File(new File(MeteorClient.FOLDER, "omegaware"), key), Utils.getFileWorldName()), filename);
}

public static String getCurrentServerAddress() {
ServerInfo server = MinecraftClient.getInstance().getCurrentServerEntry();
if (server == null) {
return "singleplayer";
}

if (server.address == null || server.address.isEmpty()) {
return "unknown";
}

return MinecraftClient.getInstance().getCurrentServerEntry().address;
}

@SuppressWarnings("BooleanMethodIsAlwaysInverted")
public static boolean is6B6T() {
String serverAddress = getCurrentServerAddress();
return serverAddress.contains("6b6t.org");
}

public static final Text PREFIX = Text.empty()
.append(Text.literal("[").formatted(Formatting.WHITE))
.append(Text.literal("OmegaWare").formatted(Formatting.AQUA))
.append(Text.literal("] ").formatted(Formatting.WHITE));

@Override
public void onInitialize() {
LOG.info("Initializing OmegaWare Addons");
Expand All @@ -71,10 +42,13 @@ public void onInitialize() {
Modules.get().add(new TPAAutomationModule());
Modules.get().add(new BeaconRangeModule());
Modules.get().add(new ChatFilterModule());
//Modules.get().add(new TSRKitBotModule()); // Commented out because it is not ready yet
Modules.get().add(new ItemFrameDupeModule());
Modules.get().add(new BetterStashFinderModule());

if (FabricLoader.getInstance().isDevelopmentEnvironment()) {
Modules.get().add(new TSRKitBotModule()); // Is not ready yet
}

if (BaritoneUtils.IS_AVAILABLE) {
Modules.get().add(new BetterBaritoneBuild());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package xyz.omegaware.addon.commands;


import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import meteordevelopment.meteorclient.commands.Command;
Expand Down
77 changes: 15 additions & 62 deletions src/main/java/xyz/omegaware/addon/commands/ShulkerQueueCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import meteordevelopment.meteorclient.commands.Command;
import meteordevelopment.meteorclient.utils.player.ChatUtils;
import net.minecraft.command.CommandSource;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import xyz.omegaware.addon.OmegawareAddons;
import xyz.omegaware.addon.modules.ItemFrameDupeModule;
import xyz.omegaware.addon.utils.Logger;

public class ShulkerQueueCommand extends Command {
public ShulkerQueueCommand() {
Expand All @@ -19,116 +17,71 @@ public ShulkerQueueCommand() {
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.then(literal("add").executes(context -> {
if (mc.player == null) {
Text msg = OmegawareAddons.PREFIX.copy()
.append(Text.literal("Error: ").formatted(Formatting.RED))
.append(Text.literal("Player was somehow null").formatted(Formatting.WHITE));
ChatUtils.sendMsg(msg);

Logger.error("Player was somehow null");
return SINGLE_SUCCESS;
}

ItemStack stack = mc.player.getMainHandStack();
if (stack.isEmpty()) {
Text msg = OmegawareAddons.PREFIX.copy()
.append(Text.literal("Error: ").formatted(Formatting.RED))
.append(Text.literal("You must hold an item in your main hand").formatted(Formatting.WHITE));
ChatUtils.sendMsg(msg);

Logger.error("You must hold an item in your main hand");
return SINGLE_SUCCESS;
}
ItemFrameDupeModule.shulkerQueue.add(stack.copy());

Text msg = OmegawareAddons.PREFIX.copy()
.append(Text.literal("Added ").formatted(Formatting.GREEN))
.append(stack.toHoverableText())
.append(Text.literal(" to the shulker queue").formatted(Formatting.WHITE));
ChatUtils.sendMsg(msg);
Logger.info("%sAdded %s to the shulker queue", Formatting.GREEN, stack.toHoverableText());

return SINGLE_SUCCESS;
}));

builder.then(literal("remove").executes(context -> {
if (mc.player == null) {
Text msg = OmegawareAddons.PREFIX.copy()
.append(Text.literal("Error: ").formatted(Formatting.RED))
.append(Text.literal("Player was somehow null").formatted(Formatting.WHITE));
ChatUtils.sendMsg(msg);

Logger.error("Player was somehow null");
return SINGLE_SUCCESS;
}

ItemStack stack = mc.player.getMainHandStack();
if (stack.isEmpty()) {
Text msg = OmegawareAddons.PREFIX.copy()
.append(Text.literal("Error: ").formatted(Formatting.RED))
.append(Text.literal("You must hold an item in your main hand").formatted(Formatting.WHITE));
ChatUtils.sendMsg(msg);

Logger.error("You must hold an item in your main hand");
return SINGLE_SUCCESS;
}
if (!ItemFrameDupeModule.shulkerQueue.contains(stack.copy())) {
Text msg = OmegawareAddons.PREFIX.copy()
.append(Text.literal("Error: ").formatted(Formatting.RED))
.append(Text.literal("Item is not in the shulker queue").formatted(Formatting.WHITE));
ChatUtils.sendMsg(msg);

Logger.error("Item is not in the shulker queue");
return SINGLE_SUCCESS;
}

ItemFrameDupeModule.shulkerQueue.remove(stack.copy());

Text msg = OmegawareAddons.PREFIX.copy()
.append(Text.literal("Removed ").formatted(Formatting.RED))
.append(stack.toHoverableText())
.append(Text.literal(" from the shulker queue").formatted(Formatting.WHITE));
ChatUtils.sendMsg(msg);

Logger.info("%sRemoved%s %s from the shulker queue", Formatting.RED, Formatting.WHITE ,stack.toHoverableText());
return SINGLE_SUCCESS;
}));

builder.then(literal("list").executes(context -> {
if (mc.player == null) {
Text msg = OmegawareAddons.PREFIX.copy()
.append(Text.literal("Error: ").formatted(Formatting.RED))
.append(Text.literal("Player was somehow null").formatted(Formatting.WHITE));
ChatUtils.sendMsg(msg);

Logger.error("Player was somehow null");
return SINGLE_SUCCESS;
}

if (ItemFrameDupeModule.shulkerQueue.isEmpty()) {
Text msg = OmegawareAddons.PREFIX.copy()
.append(Text.literal("Shulker queue is empty").formatted(Formatting.WHITE));
ChatUtils.sendMsg(msg);
Logger.info("Shulker queue is empty");
} else {
Text msg = OmegawareAddons.PREFIX.copy()
.append(Text.literal("Shulker queue: ").formatted(Formatting.YELLOW));
ChatUtils.sendMsg(msg);

ItemFrameDupeModule.shulkerQueue.forEach(itemStack -> {
Text itemText = itemStack.toHoverableText();
ChatUtils.sendMsg(itemText);
});
StringBuilder sb = new StringBuilder("Shulker queue: ");
ItemFrameDupeModule.shulkerQueue.forEach(itemStack -> sb.append(itemStack.toHoverableText().getString()).append("\n"));
Logger.info(sb.toString());
}

return SINGLE_SUCCESS;
}));

builder.then(literal("clear").executes(context -> {
if (mc.player == null) {
Text msg = OmegawareAddons.PREFIX.copy()
.append(Text.literal("Error: ").formatted(Formatting.RED))
.append(Text.literal("Player was somehow null").formatted(Formatting.WHITE));
ChatUtils.sendMsg(msg);
Logger.error("Player was somehow null");

return SINGLE_SUCCESS;
}

ItemFrameDupeModule.shulkerQueue.clear();

Text msg = OmegawareAddons.PREFIX.copy()
.append(Text.literal("Cleared the shulker queue").formatted(Formatting.WHITE));
ChatUtils.sendMsg(msg);
Logger.info("Cleared the shulker queue");

return SINGLE_SUCCESS;
}));
Expand Down
Loading