Solved Get the original Pluginobject

Discussion in 'Plugin Development' started by TheA13X, Jul 22, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    TheA13X

    Hi.
    So. I have to get a Hashmap from my other Plugin, but I don't know, how to do this. Can I just make a new Instance of it? I mean that would be just a new Instance, where this HashMap is empty, like by default, or not?
     
  2. Offline

    blablubbabc

    Could you be more precise about what you try to achieve? Maybe (I guess so) there is an alternative to having to create a new instance of your other plguin to achieve the same result.
     
  3. Offline

    TheA13X

    I have one Plugin, which selects a zone(like WorldEdit). The two edgepoints are saved in a Hashmap as a Locationarray. The key is the name of the player selecting the points and I've made a Method, which returns this array. So how can I connect to this Plugin to use this method?

    P.S. No, I won't use WorldEdit for this, because I want my server to use only my plugins
     
  4. Offline

    blablubbabc

    In your other plugin you could get the plugin class via:

    MySelectionPlugin selectionPlugin = (MySelectionPlugin) Bukkit.getServer().getPluginManager().getPlugin("the_name_of_you_selection_plugin_from_plugin.yml");

    Make sure you have added your SelectionPlugin to the build path of your other plugin and you have made the necesarry imports.

    Then in you selection plugin you could make a public method like:

    public Location[] getSelection(String playerName) {
    return selectionsMap.get(playerName);
    }

    And then in the other plugin call it like:

    Location[] selection = selectionPlugin.getSelection("blablubbabc");
     
  5. Offline

    TheA13X

    Thnk you for this, Guy with the very difficult name! This was very helpful.:D
     
Thread Status:
Not open for further replies.

Share This Page