Method JavaPlugin.setEnabled has a logical flaw

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Minor
    • None
    • Affects Version/s: None
    • 1.20.6-R0.1-SNAPSHOT
    • Yes

      at org.bukkit.plugin.java.JavaPlugin.setEnabled(boolean enabled)

      This code has a logical flaw.It should be

      protected final void setEnabled(boolean enabled) {
          if (this.isEnabled != enabled) {
              if (enabled) {
                  this.onEnable();
              } else {
                  this.onDisable();
              }
              this.isEnabled = enabled;
         }
      
      }

      Because when call method "onEnable()" it may throw an exception and not loaded successfully, but call method "isEnabled()" will get a fake status.This also cause some plugin work incorrect, for example, use PlugManX to load a plugin but throw an exception and loaded unsuccessfully, but call method "isEnabled()" will get a value that "true"!!!

      However, I don't consider a condition that call method "onDisable()" but throw an exception!!!!!!!!

            Assignee:
            Unassigned
            Reporter:
            enderlight3336
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: