1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

commands

Discussion in 'Development' started by Teamblocket, Apr 30, 2017.

  1. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    Code:
    name: CustomEnchants
    main: TB\Main
    version: 1.0
    api: [3.0.1, 3.0.0]
    author: Teamblocket
    commands:
        ce:
            description: "Custom Enchant Command!"
    hey , so i made a plugin to test some custom enchant / custom name theorys and their are no errors but the commands won't output any messages or error .
    PHP:
    public function onCommand(CommandSender $senderCommand $command$label, array $args) {

        switch (
    strtolower($command->getName())) {

            case 
    "ce":

            if(isset(
    $args[0])) {
                switch(
    $args[0]) {

                    case 
    "gset":

                    
    $this->onGSet($sender);

                    return 
    true;
            break;

                    case 
    "noting":

                    
    $sender->sendMessage("Noting , lol");

                    return 
    true;
            break;

                }

            }
            else {
                
    $sender->sendMessage(" -- Custom Enchants Help -- ");
                
    $sender->sendMessage(" - /ce gset");
                
    $sender->sendMessage(" - /ce noting");

            }

            return 
    true;
    break;

        }

    }
     
  2. xBeastMode

    xBeastMode Shog Chips

    Messages:
    0
    Does your class extend \pocketmine\plugin\PluginBase?
     
    Teamblocket likes this.
  3. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    yes

    PHP:
    <?php

    namespace CustomEnchants;

    use 
    pocketmine\Server;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\Player;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\event\player\PlayerMoveEvent;
    use 
    pocketmine\entity\Effect;
    use 
    pocketmine\item\Item;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\command\CommandExecutor;

    class 
    Main extends PluginBase implements Listener {
     
  4. TheDiamondYT

    TheDiamondYT Zombie

    Messages:
    298
    GitHub:
    TheDiamondYT1
    Unrelated: Your target API is a bit behind as the current is 3.0.0-ALPHA5
     
  5. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    ok I've updated that but noting... of course
     
  6. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    ok after converting the plugin into a phar i finally got some type of output , can someone tell me what this error means?
    Code:
    30.04 15:43:39 [Server] CRITICAL ClassNotFoundException: "Class TB\Main not found" (EXCEPTION) in "/src/spl/BaseClassLoader" at line 131
     
  7. Thouv

    Thouv Slime

    Messages:
    84
    GitHub:
    adeynes
    What's your directory structure like? Maybe you forgot src?
     
  8. TheDiamondYT

    TheDiamondYT Zombie

    Messages:
    298
    GitHub:
    TheDiamondYT1
    Read the original post...he did
     
  9. Thouv

    Thouv Slime

    Messages:
    84
    GitHub:
    adeynes
    What? He didn't post his directory structure, just plugin.yml
    Maybe he forgot the src or TB folder?
    Anyways, you got the wrong namespace. If your main class is TB\Main, your namespace should be TB and not custom enchants
     
    corytortoise likes this.
  10. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    thx , i had the namespace wrong
     
  11. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    Code:
    30.04 16:29:03 [Server] CRITICAL ClassNotFoundException: "Class TB\Sever not found" (EXCEPTION) in "/src/spl/BaseClassLoader" at line 144
    ok i fixed every syntax error this is the last error , how do i fix it?
     
  12. Thouv

    Thouv Slime

    Messages:
    84
    GitHub:
    adeynes
    It's TB\Main not TB\Sever?
    Change it in plugin.yml
     
  13. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    it is TB\Main in the plugin.yml
     
  14. Thouv

    Thouv Slime

    Messages:
    84
    GitHub:
    adeynes
    The error says class TB\Sever not found
     
  15. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    My guess is that you tried to use the pocketmine\Server class, but made a typo and put "Sever" instead.
     
    XdmingXD likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.