Cast "File" to "Plugin" ?

Discussion in 'Plugin Development' started by ServerfromMinecraft, Sep 17, 2012.

Thread Status:
Not open for further replies.
  1. Hi! How i can cast a "File" to a "Plugin" ? Because the loadPlugin method use a file, but the disablePlugin method a Plugin...
     
  2. Offline

    Nick9009

    Am I mistaken in thinking this is because loadPlugin returns a plugin from the plugin's file, and when said plugin is loaded, it can be disabled using disablePlugin? I don't see why you'd need to cast at all.
     
  3. loadPlugin wants a File cause you want to load a plugin that bukkit doesn't know yet, so you have to tell it where to find the jar. But it returns a Plugin object to use, for example with disablePlugin. If you want a already loaded plugin try:
    Bukkit.getPluginManager().getPlugin("PluginName");
    which returns a Plugin object (or null), too.
     
Thread Status:
Not open for further replies.

Share This Page