title: Why does getPlugin method in Cmds.java not work?
body: <p>i want to change from <strong>EventsClass.class</strong> the <em>logged</em> variable which is 
  placed in <strong>Cmds.class</strong>.</p>
  
  <p>But i have a problem with this line:</p>
  
  <pre><code>private EventsClass plugin = EventsClass.getPlugin(EventsClass.class);
  </code></pre>
  
  <p>Compiler cannot resolve getPlugin.</p>
  
  <p><strong>CODE</strong>:</p>
  
  <p><em>Main.java:</em></p>
  
  <pre><code>package com.github.noisersup.serverrust.LoginMe;
  
  import org.bukkit.plugin.java.JavaPlugin;
  
  public class Main extends JavaPlugin {
  
      @Override
      public void onEnable() {
          loadConfig();
          getServer().getPluginManager().registerEvents(new EventsClass(),this);
      }
  
      public void loadConfig(){
          getConfig().options().copyDefaults(true);
          this.saveConfig();
      }
  }
  </code></pre>
  
  <p><em>EventsClass.java:</em></p>
  
  <pre><code>    package com.github.noisersup.serverrust.LoginMe;
  
      import org.bukkit.entity.Player;
      import org.bukkit.event.EventHandler;
      import org.bukkit.event.Listener;
      import org.bukkit.event.player.PlayerJoinEvent;
      import org.bukkit.event.player.PlayerMoveEvent;
  
      import java.util.UUID;
  
      public class EventsClass implements Listener {
  
      public boolean logged;
  
      @EventHandler
      public void onJoin(PlayerJoinEvent e){
  
          Player p = e.getPlayer();
          UUID uuid = p.getUniqueId();
  
          logged = false;
  
          if("player."+uuid+".password"!=null){
  
              //login
              p.sendMessage("§2Welcome again "+p.getName()+"! Please login with command: §6§n/login &lt;password&gt;");
  
  
          }else{
              //register
              p.sendMessage("§2Welcome "+p.getName()+"! Please register with command: + §6§n/register &lt;password&gt; &lt;repeat_password&gt;");
          }
      }
  
      @EventHandler
      public void onMove(PlayerMoveEvent e){
          if(!logged){
              e.setCancelled(true);
          }
  
      }
  }
  </code></pre>
  
  <p><em>Cmds.java:</em></p>
  
  <pre><code>package com.github.noisersup.serverrust.LoginMe;
  
  import org.bukkit.command.Command;
  import org.bukkit.command.CommandExecutor;
  import org.bukkit.command.CommandSender;
  import org.bukkit.entity.Player;
  
  
  import java.util.UUID;
  
  public class Cmds implements CommandExecutor {
  
  
      String cmd1 = "login";
      String cmd2 = "register";
      String cmd3 = "changepassword";
  
      private EventsClass plugin = EventsClass.getPlugin(EventsClass.class);
  
  
      @Override
      public boolean onCommand(CommandSender sender, Command cmd, String s, String[] args) {
  
          if(sender instanceof  Player) {
              Player p = (Player) sender;
              UUID uuid = p.getUniqueId();
  
              if (cmd.getName().equalsIgnoreCase(cmd1)) {
                  if ("player." + uuid + ".password" != null){
                      if(!args[0].isEmpty()) {
                          if (args[0].equals("player." + uuid + ".password")) {
                              p.sendMessage("§2Logged!");
                              logged = true;
                          }else{
                              p.sendMessage("§4Wrong password!");
                          }
                      }else{
                          p.sendMessage("§4Enter password!");
                      }
                  }else{
                      p.sendMessage("§4You must be registered before login.");
                  }
              }
          }
  
          return false;
      }
  }
  </code></pre>