Examples of ModManager


Examples of com.gmail.nossr50.util.ModManager

            upgradeManager = new UpgradeManager();

            setupFilePaths();

            modManager = new ModManager();

            loadConfigFiles();

            if (!noErrorsInConfigFiles) {
                return;
View Full Code Here

Examples of com.gmail.nossr50.util.ModManager

    public BlockConfigManager(mcMMO plugin) {
        Pattern middlePattern = Pattern.compile("blocks\\.(?:.+)\\.yml");
        Pattern startPattern = Pattern.compile("(?:.+)\\.blocks\\.yml");
        File dataFolder = new File(mcMMO.getModDirectory());
        File vanilla = new File(dataFolder, "blocks.default.yml");
        ModManager modManager = mcMMO.getModManager();

        if (!vanilla.exists()) {
            plugin.saveResource(vanilla.getParentFile().getName() + File.separator + "blocks.default.yml", false);
        }

        for (String fileName : dataFolder.list()) {
            if (!middlePattern.matcher(fileName).matches() && !startPattern.matcher(fileName).matches()) {
                continue;
            }

            File file = new File(dataFolder, fileName);

            if (file.isDirectory()) {
                continue;
            }

            modManager.registerCustomBlocks(new CustomBlockConfig(fileName));
        }
    }
View Full Code Here

Examples of com.gmail.nossr50.util.ModManager

    public ArmorConfigManager(mcMMO plugin) {
        Pattern middlePattern = Pattern.compile("armor\\.(?:.+)\\.yml");
        Pattern startPattern = Pattern.compile("(?:.+)\\.armor\\.yml");
        File dataFolder = new File(mcMMO.getModDirectory());
        File vanilla = new File(dataFolder, "armor.default.yml");
        ModManager modManager = mcMMO.getModManager();

        if (!vanilla.exists()) {
            plugin.saveResource(vanilla.getParentFile().getName() + File.separator + "armor.default.yml", false);
        }

        for (String fileName : dataFolder.list()) {
            if (!middlePattern.matcher(fileName).matches() && !startPattern.matcher(fileName).matches()) {
                continue;
            }

            File file = new File(dataFolder, fileName);

            if (file.isDirectory()) {
                continue;
            }

            modManager.registerCustomArmor(new CustomArmorConfig(fileName));
        }
    }
View Full Code Here

Examples of com.gmail.nossr50.util.ModManager

    public ToolConfigManager(mcMMO plugin) {
        Pattern middlePattern = Pattern.compile("tools\\.(?:.+)\\.yml");
        Pattern startPattern = Pattern.compile("(?:.+)\\.tools\\.yml");
        File dataFolder = new File(mcMMO.getModDirectory());
        File vanilla = new File(dataFolder, "tools.default.yml");
        ModManager modManager = mcMMO.getModManager();

        if (!vanilla.exists()) {
            plugin.saveResource(vanilla.getParentFile().getName() + File.separator + "tools.default.yml", false);
        }

        for (String fileName : dataFolder.list()) {
            if (!middlePattern.matcher(fileName).matches() && !startPattern.matcher(fileName).matches()) {
                continue;
            }

            File file = new File(dataFolder, fileName);

            if (file.isDirectory()) {
                continue;
            }

            modManager.registerCustomTools(new CustomToolConfig(fileName));
        }
    }
View Full Code Here

Examples of com.gmail.nossr50.util.ModManager

    public EntityConfigManager(mcMMO plugin) {
        Pattern middlePattern = Pattern.compile("entities\\.(?:.+)\\.yml");
        Pattern startPattern = Pattern.compile("(?:.+)\\.entities\\.yml");
        File dataFolder = new File(mcMMO.getModDirectory());
        File vanilla = new File(dataFolder, "entities.default.yml");
        ModManager modManager = mcMMO.getModManager();

        if (!vanilla.exists()) {
            plugin.saveResource(vanilla.getParentFile().getName() + File.separator + "entities.default.yml", false);
        }

        for (String fileName : dataFolder.list()) {
            if (!middlePattern.matcher(fileName).matches() && !startPattern.matcher(fileName).matches()) {
                continue;
            }

            File file = new File(dataFolder, fileName);

            if (file.isDirectory()) {
                continue;
            }

            modManager.registerCustomEntities(new CustomEntityConfig(fileName));
        }
    }
View Full Code Here

Examples of de.mhus.framework.mod.ModManager

    // Enable Trace
    DynamicClassLoader.log.setTrace(true);
   
    // Create Base and Manager
    ClassLoadingBase base = new ClassLoadingBase();
    ModManager manager = new ModManager(base);
   
    // Create Config
    HashConfig c = new HashConfig();
    c.setString("class", ClassLoaderActivator.class.getCanonicalName());
    c.setString("id", "test1");
    c.setString("name", "Loading1");
    IConfig cpath = c.createConfig("classpath");
    IConfig loader = cpath.createConfig("resource");
    loader.setString("jar", "etc/test/test.jar");
   
    // Create Bundle and ModConfig
    IBundle b1 = new ModBundle(new IModConfig[] {new ModConfig(c)}, "test1", false);
   
    // Init Bundle
      List<IModActivator> activators = new LinkedList<IModActivator>();
      manager.initializeBundle(b1,activators);
      manager.enableActivators(activators);
     
      assertEquals("alf aloa", c.getString("result", "") );
     
      // disable and dispose
      manager.disableActivators(activators);
      manager.disposeActivators(activators);

      // stop tracing
    DynamicClassLoader.log.setTrace(false);

  }
View Full Code Here

Examples of de.mhus.framework.mod.ModManager

     * Test the normal Lifecycle functionality
     */
    public void testLifecycle() throws Exception
    {
     
      ModManager manager = new ModManager(base);

      MyConfig a1 = new MyConfig( SimpleActivator.class.getCanonicalName(), new XmlConfig( null, MXml.loadXml("<c name='Test1'/>").getDocumentElement() ) );
      IModConfig[] ac1 = new IModConfig[] { a1 };
      MyBundle b1 = new MyBundle("mybundle", true, ac1 );
     
      List<IModActivator> activators = new LinkedList<IModActivator>();
      manager.initializeBundle(b1,activators);
      IModActivator act = activators.get(0);
      assertTrue( act.getStatus() == IModActivator.STATUS.INITIALIZED );
      manager.enableActivators(activators);
      assertTrue( act.getStatus() == IModActivator.STATUS.ENABLED );
      manager.disableActivators(activators);
      assertTrue( act.getStatus() == IModActivator.STATUS.DISABLED );
      manager.disposeActivators(activators);
      assertTrue( act.getStatus() == IModActivator.STATUS.CLOSED );
     
    }
View Full Code Here

Examples of de.mhus.framework.mod.ModManager

     * Test the fail on init Lifecycle functionality
     */
    public void testLifecycleFailInit() throws Exception
    {
     
      ModManager manager = new ModManager(base);

      MyConfig a1 = new MyConfig( SimpleActivator.class.getCanonicalName(), new XmlConfig( null, MXml.loadXml("<c fail_initialize='1'/>").getDocumentElement() ) );
      IModConfig[] ac1 = new IModConfig[] { a1 };
      MyBundle b1 = new MyBundle("mybundle", true, ac1 );
     
      List<IModActivator> activators = new LinkedList<IModActivator>();
      try {
        manager.initializeBundle(b1,activators);
      } catch (Exception e) {}
      System.out.println("-----------------------------------------------");
      System.out.println(activators.size());
      assertEquals(0, activators.size() );

View Full Code Here

Examples of de.mhus.framework.mod.ModManager

     * On fail the hole bundle is not installed
     */
    public void testConsistentOn() throws Exception
    {
     
      ModManager manager = new ModManager(base);

      MyConfig a1 = new MyConfig( SimpleActivator.class.getCanonicalName(), new XmlConfig( null, MXml.loadXml("<c id='test1' />").getDocumentElement() ) );
      MyConfig a2 = new MyConfig( SimpleActivator.class.getCanonicalName(), new XmlConfig( null, MXml.loadXml("<c id='test2' fail_initialize='1'/>").getDocumentElement() ) );
      IModConfig[] ac1 = new IModConfig[] { a1, a2 };
      MyBundle b1 = new MyBundle("mybundle", true, ac1 );
     
      List<IModActivator> activators = new LinkedList<IModActivator>();
    try {
        manager.initializeBundle(b1,activators);
      } catch (Exception e) {}
      assertTrue( activators.size() == 0 );
      assertTrue( manager.getActivators().size() == 0 );

    }
View Full Code Here

Examples of de.mhus.framework.mod.ModManager

     * On fail the other activators are installed
     */
    public void testConsistentOff() throws Exception
    {
     
      ModManager manager = new ModManager(base);

      MyConfig a1 = new MyConfig( SimpleActivator.class.getCanonicalName(), new XmlConfig( null, MXml.loadXml("<c/>").getDocumentElement() ) );
      MyConfig a2 = new MyConfig( SimpleActivator.class.getCanonicalName(), new XmlConfig( null, MXml.loadXml("<c fail_initialize='1'/>").getDocumentElement() ) );
      IModConfig[] ac1 = new IModConfig[] { a1, a2 };
      MyBundle b1 = new MyBundle("mybundle", false, ac1 );
           
      List<IModActivator> activators = new LinkedList<IModActivator>();
      manager.initializeBundle(b1,activators);
      assertTrue( activators.size() == 1 );
      assertTrue( manager.getActivators().size() == 1 );

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.