Skip to content

Treasure Hunter Waypoints #1246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
package de.hysky.skyblocker.skyblock.barn;

import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.utils.Constants;
import de.hysky.skyblocker.utils.chat.ChatFilterResult;
import de.hysky.skyblocker.utils.chat.ChatPatternListener;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.ClickEvent;
import net.minecraft.text.HoverEvent;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import org.jetbrains.annotations.NotNull;

import java.util.HashMap;
import java.util.Map;
Expand All @@ -28,10 +34,22 @@ public boolean onMatch(Text message, Matcher matcher) {
String hint = matcher.group(1);
String location = locations.get(hint);
if (location == null) return false;
client.player.sendMessage(Text.of("§e[NPC] Treasure Hunter§f: Go mine around " + location + "."), false);
client.player.sendMessage(Text.of("§e[NPC] Treasure Hunter§f: Go mine around " + location), false);
requestWaypoint(location);
return true;
}

private static void requestWaypoint(String location) {
String command = "/skyblocker waypoints individual " + location + " Treasure";
MutableText requestMessage = Constants.PREFIX.get().append(Text.translatable("skyblocker.config.chat.waypoints.display").formatted(Formatting.AQUA)
.styled(style -> style
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.translatable("skyblocker.config.chat.waypoints.display")))
.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command.trim()))
)
);
MinecraftClient.getInstance().player.sendMessage(requestMessage, false);
}

static {
locations = new HashMap<>();
locations.put("There's a treasure chest somewhere in a small cave in the gorge.", "258 70 -492");
Expand Down