how to put 2 things in 1 method

Discussion in 'Plugin Development' started by TImewalkerZ, Sep 9, 2015.

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

    TImewalkerZ

    Code:
            @EventHandler
            public void onCommand(PlayerCommandPreprocessEvent e){} void importer(me.TimewalkerZ.BCevents.BCevents bCevents) {
                Player p = e.getPlayer();
                 if(!p.hasPermission("Broadcastoncommand.silent")) {
                          List<String> cmds = bCevents.getConfig().getStringList("CommandsBC");
                       for (String command : cmds) {
                           if(e.getMessage().toLowerCase().startsWith("/" + command)) {
                           p.sendMessage("§6" + p + "§6 just did the command " + command + "§6 join them if you have the command unlocked.");
                           }
                       }
                 }
            }
    }
    if I do this, e cannot be resolved. If I remove the void importer bCevents cannot be resolved. how do I combine them into one method?
     
  2. Offline

    SuperSniper

    @TImewalkerZ Just curious, why do you need to combine them into one method?
     
  3. Offline

    jthort

    @TImewalkerZ Did you change it like I said to in StackOverflow?

    Anyway, I really don't understand what you're trying to do here, the method with e as the event variable doesn't even have any code.

    Is BCevents another class you have, or is it the same class? Why do you have
    Code:
    void importer(me.TimewalkerZ.BCevents.BCevents bCevents) {
    What are you trying to do here?
     
  4. Offline

    mythbusterma

    @TImewalkerZ

    Two events cannot ever happen at the same time (assuming neither are asynchronous). You need to rethink what you're doing.
     
  5. Offline

    TImewalkerZ

    Im trying to resolve both e and bCevents
     
  6. Offline

    timtower Administrator Administrator Moderator

    That is impossible to do.
     
  7. Offline

    TImewalkerZ

  8. Offline

    timtower Administrator Administrator Moderator

  9. Offline

    TImewalkerZ

  10. Offline

    timtower Administrator Administrator Moderator

    @TImewalkerZ Do you know how to use a constructor to pass the main instance?
     
  11. Offline

    TImewalkerZ

  12. Offline

    timtower Administrator Administrator Moderator

    @TImewalkerZ Then I suggest to learn more about those before you continue, will solve this issue and the issue of your previous thread
     
Thread Status:
Not open for further replies.

Share This Page