예제 #1
0
  public static void spawnFixedNPCS(NPCHandler handle) {
    loader.read();
    io.read();

    for (SyncWrapper wrap : io.getReadableData()) {
      if (!wrap.getTag().equalsIgnoreCase("NULL")) {
        presetNPCs.add(wrap.getTag());
      }
    }

    QuestX.logDebug("wrapper length = " + loader.getReadableData().size());
    for (SyncWrapper wrapper : loader.getReadableData()) {
      if (wrapper.getTag().equalsIgnoreCase("NPC_COUNT")) {
        continue;
      }
      String npcName = wrapper.getTag();
      if (FileLocator.doesNPCNameExist(npcName)) {
        SyncLocation sl = (SyncLocation) wrapper.getObject();
        Location spawnLocation = sl.getBukkitLocation();

        LoadNPCTemplate tempLoader = new LoadNPCTemplate(npcName);

        tempLoader.loadProperties();
        NPCTemplate template = tempLoader.getLoadedNPCTemplate();

        SimpleNPC npc = template.registerSimpleNPCFixedSpawn(handle, spawnLocation);

        npc.setAllowedToMove(false);

        if (io.doesObjectExist(npcName)) {
          PresetPath path = (PresetPath) io.getObject(npcName);
          npc.setPresetPath(path);
        }

        npc.setAllowedToMove(true);

        fixedSpawns.put(npcName, spawnLocation);

      } else {
        QuestX.logError("Tried to load NPC '" + npcName + "' but no NPC file was found.");
      }
    }
    FixedSpawnsDisplay.updateSoftReference();
    PresetPathsDisplay.updateSoftReference();
  }
예제 #2
0
  public static void spawnFixedNPC(NPCHandler handle, String name) {
    loader.read();
    io.read();
    SyncLocation sl = (SyncLocation) loader.getObject(name);
    Location spawnLocation = sl.getBukkitLocation();
    LoadNPCTemplate tempLoader = new LoadNPCTemplate(name);

    tempLoader.loadProperties();

    NPCTemplate template = tempLoader.getLoadedNPCTemplate();

    SimpleNPC npc = template.registerSimpleNPCFixedSpawn(handle, spawnLocation);

    npc.setAllowedToMove(false);

    if (io.doesObjectExist(name)) {
      PresetPath path = (PresetPath) io.getObject(name);
      npc.setPresetPath(path);
    }

    npc.setAllowedToMove(true);
  }