plugins/DuneRealmsGUI/src/main/java/com/dunerealms/gui/LetoQuestContacts.java

54 lines
2.6 KiB
Java

package com.dunerealms.gui;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.plugin.java.JavaPlugin;
/** Golden Path contacts, using the existing persistent Citizens quest registry. */
final class LetoQuestContacts {
private static final String BRANCH = "leto-search";
private record Contact(String role, String name, String world, int offset, int[] tabr) {}
private static final List<Contact> CONTACTS = List.of(
new Contact("leto_runner", "Ishaq the Runner", "guild_lobby", 9, null),
new Contact("leto_steward", "Sietch Steward", "arrakis", 0, new int[]{768, 69, 1426}),
new Contact("leto_waterkeeper", "Keeper of the Water Basin", "arrakis", 0, new int[]{817, 69, 1440}),
new Contact("leto_ecologist", "Sietch Ecologist", "arrakis", 0, new int[]{792, 69, 1422}),
new Contact("leto_archivist", "Atreides Archivist", "caladan", 11, null),
new Contact("leto_informer", "Pit Informer", "giedi_prime", 10, null),
new Contact("leto_courtier", "Court Archivist", "kaitain", 11, null),
new Contact("leto_tleilaxu_ghola", "Tleilaxu Go-Between", "sigma_draconis_iv", 11, null),
new Contact("leto_navigator", "Guild Navigator's Agent", "sigma_draconis_iv:end", 10, null),
new Contact("leto_stilgar", "Sietch Steward of the Hall of Rites", "arrakis", 0, new int[]{792, 69, 1437})
);
static List<PolQuestNpc.Role> roles(JavaPlugin plugin, World world) {
if (!plugin.getConfig().getBoolean("golden-path.enabled", false)) return List.of();
var result = new ArrayList<PolQuestNpc.Role>();
for (var contact : CONTACTS) {
boolean matches = contact.world().equals(world.getName());
if (contact.world().equals("sigma_draconis_iv:end")) {
matches = world.getEnvironment() == World.Environment.THE_END
&& Bukkit.getWorld("sigma_draconis_iv") != null;
}
if (matches) result.add(new PolQuestNpc.Role(contact.role(), contact.name(),
world.getName(), "*", Set.of(BRANCH), contact.offset()));
}
return result;
}
static Location tabrLocation(String role, World world) {
for (var contact : CONTACTS) {
if (contact.role().equals(role) && contact.tabr() != null && world.getName().equals("arrakis")) {
var point = contact.tabr();
return new Location(world, point[0] + .5, point[1], point[2] + .5);
}
}
return null;
}
}