forked from unimatrix/web
Make existing quest NPC persistence available to DuneMenus
This commit is contained in:
parent
c8fcf9d2e5
commit
53d2e211b3
1 changed files with 37 additions and 12 deletions
|
|
@ -1,5 +1,7 @@
|
|||
package com.dunerealms.menus;
|
||||
|
||||
import com.dunerealms.npc.PolQuestNpc;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -20,6 +22,7 @@ public final class DuneMenusPlugin extends JavaPlugin implements TabExecutor {
|
|||
private static final String PACK_CONTROL = "dunerealms:pack_control";
|
||||
private Backend backend;
|
||||
private NativeMenuRoutes nativeRoutes;
|
||||
private PolQuestNpc questNpcs;
|
||||
private final Map<Player, String> loadedPacks = new HashMap<>();
|
||||
private final Map<UUID, Menu> openMenus = new HashMap<>();
|
||||
|
||||
|
|
@ -54,7 +57,18 @@ public final class DuneMenusPlugin extends JavaPlugin implements TabExecutor {
|
|||
getServer().getPluginManager().registerEvents(new ChatPrompt(this), this);
|
||||
getCommand("dm").setExecutor(this);
|
||||
getCommand("dm").setTabCompleter(this);
|
||||
getServer().getScheduler().runTask(this, () -> nativeRoutes = new NativeMenuRoutes(this));
|
||||
getServer().getScheduler().runTask(this, () -> {
|
||||
nativeRoutes = new NativeMenuRoutes(this);
|
||||
if (!getServer().getPluginManager().isPluginEnabled("DunerealmsGUI")) {
|
||||
File oldPositions = new File(getDataFolder().getParentFile(), "DunerealmsGUI/quest-npc-positions.yml");
|
||||
File positions = new File(getDataFolder(), "quest-npc-positions.yml");
|
||||
if (oldPositions.isFile() && !positions.isFile()) {
|
||||
getLogger().warning("Transfer quest-npc-positions.yml before enabling quest NPC persistence.");
|
||||
} else {
|
||||
questNpcs = new PolQuestNpc(this);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override public void onDisable() {
|
||||
|
|
@ -63,6 +77,10 @@ public final class DuneMenusPlugin extends JavaPlugin implements TabExecutor {
|
|||
|
||||
Backend backend() { return backend; }
|
||||
|
||||
public void updateImperialQuestNpc(UUID uuid, String name, String term) {
|
||||
if (questNpcs != null) questNpcs.imperialAppearance(uuid, name, term);
|
||||
}
|
||||
|
||||
public void warObjective(Player player, com.google.gson.JsonObject target, Runnable capture) {
|
||||
if (!getServer().isPrimaryThread() || !player.isOnline() || !player.hasPermission("dunemenus.use")) return;
|
||||
new WarObjectiveMenu(this, player, target.deepCopy(), capture).open();
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff