Cast "File" to "Plugin" ?

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

  1. Offline

    ServerfromMinecraft

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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. Offline

    V10lator

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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.

    This post has been edited 1 time. It was last edited by V10lator Sep 17, 2012.
  4. Offline

    ServerfromMinecraft

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)

Share This Page