Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Can't Load another PluginBase Class

Comments in 'Plugin Development' started by Samueljh1H8sLag, Jul 16, 2015.

  1. Samueljh1H8sLag
    Offline

    Samueljh1H8sLag Active Member

    Joined:
    Jun 20, 2015
    Posts:
    168
    Minecraft User:
    Samueljh1_
    Hi, i am trying to change my skywars plugin so I can have a GameLoader Class (main) - which creates new instances of the new Game class which is the actual game code itself.

    When i try to init the class (
    PHP:
    new Game(params...)
    )

    I get this error:

    Code:
    [CRITICAL] pocketmine\utils\PluginException:
    "Plugin attempted to register Samueljh1\Samcraft
    \Minigames\Skywars\Game while not enabled"
     (EXCEPTION) in "/src/pocketmine/plugin/
    PluginManager" at line 700
    
    Also, both classes extend pluginbase
  2. Samueljh1H8sLag
    Offline

    Samueljh1H8sLag Active Member

    Joined:
    Jun 20, 2015
    Posts:
    168
    Minecraft User:
    Samueljh1_
    u don't say xD its another plugin class in a loaded plugin
    ahoj_truhliku likes this.
  3. ahoj_truhliku
    Offline

    ahoj_truhliku Banned

    Joined:
    Jul 9, 2015
    Posts:
    89
    Minecraft User:
    Creeperface001
    :D maybe you canĀ“t extend PluginBase in two classes
    i make an instance from main class
  4. ahoj_truhliku
    Offline

    ahoj_truhliku Banned

    Joined:
    Jul 9, 2015
    Posts:
    89
    Minecraft User:
    Creeperface001
    why are not you banned when you created another account? and i was banned for creating multiple accounts when i was banned on another account.
  5. Samueljh1H8sLag
    Offline

    Samueljh1H8sLag Active Member

    Joined:
    Jun 20, 2015
    Posts:
    168
    Minecraft User:
    Samueljh1_
    im unbanned, but it lags crazy on the other account
    ahoj_truhliku likes this.
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    So this account is...
    How are you actually using the other class?
  7. Samueljh1H8sLag
    Offline

    Samueljh1H8sLag Active Member

    Joined:
    Jun 20, 2015
    Posts:
    168
    Minecraft User:
    Samueljh1_
    So basically what I am currently doing on my skywars server is copying and pasting my plugin, where the "Game" class is the main. This is really stupid because its the biggest CPU destroyer xD

    Then I realised I could just make the game into a separate class and then create new instances of it with different options such as the sign coordinates and map.

    So I now have 2 classes: GameLoader and Game. Game has all the "Game" code. GameLoader is a new class, and now the main class, which has code like this in the onEnable(),

    PHP:
    new Game("Param1""Param2"," etc");
    Then I replaced the on enable on the Game glass to __construct.

    The only issue is that this Game class extends PluginBase, which means it has to be loaded.

    The question is: how?

    Are you allowed to load multiple PluginBase classes?
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Don't make it extend PluginBase. PluginBase is initialized with its methods from PocketMine core, but you didn't do that. PluginBase actually just means nothing.
    And how does that help with CPU?
  9. ahoj_truhliku
    Offline

    ahoj_truhliku Banned

    Joined:
    Jul 9, 2015
    Posts:
    89
    Minecraft User:
    Creeperface001
    WOW you found out dragonet :D
    PEMapModder likes this.

Share This Page

Advertisement