Package net.aufdemrand.denizen

Examples of net.aufdemrand.denizen.Denizen


    }

    @EventHandler
    public void playerJoin(PlayerJoinEvent event) {

        Denizen denizen = DenizenAPI.getCurrentInstance();
        dPlayer player = new dPlayer(event.getPlayer());

        // Any saves quest listeners in progress?
        if (!denizen.getSaves().contains("Listeners." + player.getSaveName())) return;
        Set<String> inProgress = denizen.getSaves().getConfigurationSection("Listeners." + player.getSaveName()).getKeys(false);
        // If empty, no quest listeners to load.
        if (inProgress.isEmpty()) return;

        // TODO: Players.SAVENAME.Listeners?
        String path = "Listeners." + player.getSaveName() + ".";

        // If not empty, let's do the loading process for each.
        for (String listenerId : inProgress) {
            // People tend to worry when they see long-ass stacktraces.. let's catch them.
            try {
                String type = denizen.getSaves().getString(path + listenerId + ".Listener Type");
                dNPC npc = null;
                if (denizen.getSaves().contains(path + listenerId + ".Linked NPCID"))
                    npc = DenizenAPI.getDenizenNPC(CitizensAPI.getNPCRegistry().getById(denizen.getSaves().getInt(path + listenerId + ".Linked NPCID")));
                if (get(type) == null) return;
                dB.log(event.getPlayer().getName() + " has a LISTENER in progress. Loading '" + listenerId + "'.");
                get(type).createInstance(dPlayer.mirrorBukkitPlayer(event.getPlayer()), listenerId).load(dPlayer.mirrorBukkitPlayer(event.getPlayer()), npc, listenerId, type);
            } catch (Exception e) {
                dB.log(event.getPlayer() + " has a saved listener named '" + listenerId + "' that may be corrupt. Skipping for now, but perhaps check the contents of your saves.yml for problems?");
View Full Code Here


        }
    }


    public void deconstructPlayer(dPlayer player) {
        Denizen denizen = DenizenAPI.getCurrentInstance();

        // Clear previous MemorySection in saves
        denizen.getSaves().set("Listeners." + player.getSaveName(), null);

        // If no quest listeners in progress, nothing else to do.
        if (!listeners.containsKey(player.getName())) {
            return;
        }
View Full Code Here

TOP

Related Classes of net.aufdemrand.denizen.Denizen

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.