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

Need Help with plugin

Comments in 'Plugin Development' started by Hittmana, Dec 11, 2015.

  1. Hittmana
    Offline

    Hittmana Active Member

    Joined:
    Jul 26, 2015
    Posts:
    224
    Minecraft User:
    move_it
    I am new to plugin dev and can not get my first plugin to work properly. I need help! .zip file included that contains the code for my plugin. I get this error when i use the .zip to phar converter by PeMapModder:

    • Classpath
      • Inspection result: Passed
      • Info
        • Main class scanned: Tutorial\MainClass
        • Main class file found at src/Tutorial/MainClass.php
    • Bad practice
      • Inspection result: Passed
    • Syntax errors
      • Inspection result: Error
      • Errors
        • Could not open input file: /var/www/tmp/5/Tutorial
      • Info
        • 0 good PHP file(s) and 1 bad PHP file(s) found.
        • Checked with PHP 5.6.11-1+deb.sury.org~trusty+1
      Error is in bold print. Please help me I am new to plugin dev!

    Attached Files:

  2. Hittmana
    Offline

    Hittmana Active Member

    Joined:
    Jul 26, 2015
    Posts:
    224
    Minecraft User:
    move_it
    BTW any help would be greatly appreciated!
  3. Hittmana
    Offline

    Hittmana Active Member

    Joined:
    Jul 26, 2015
    Posts:
    224
    Minecraft User:
    move_it
    .zip file contains all code for the plugin besides, of course the Pocketmine source code.
  4. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    whoops, i am too much confused working on too many things, sorry.
  5. Hittmana
    Offline

    Hittmana Active Member

    Joined:
    Jul 26, 2015
    Posts:
    224
    Minecraft User:
    move_it
    LOL i feel the same!
  6. Hittmana
    Offline

    Hittmana Active Member

    Joined:
    Jul 26, 2015
    Posts:
    224
    Minecraft User:
    move_it
    I will put a sign, of whoever helps me first, in my minecraft server
    Last edited: Dec 11, 2015
  7. TomasOlsson
    Offline

    TomasOlsson New Member

    Joined:
    Nov 23, 2015
    Posts:
    5
    Minecraft User:
    VMe89
    Run the server with the plugin and post the error.
  8. Hittmana
    Offline

    Hittmana Active Member

    Joined:
    Jul 26, 2015
    Posts:
    224
    Minecraft User:
    move_it
    I already have run it here is the crash dump:

    Attached Files:

  9. TomasOlsson
    Offline

    TomasOlsson New Member

    Joined:
    Nov 23, 2015
    Posts:
    5
    Minecraft User:
    VMe89
    use pocketmine\command\CommandSender;

    Add that
    Hittmana likes this.
  10. Hittmana
    Offline

    Hittmana Active Member

    Joined:
    Jul 26, 2015
    Posts:
    224
    Minecraft User:
    move_it
    to before onCommand ?
  11. Hittmana
    Offline

    Hittmana Active Member

    Joined:
    Jul 26, 2015
    Posts:
    224
    Minecraft User:
    move_it
    nevermind not paying attention
  12. Hittmana
    Offline

    Hittmana Active Member

    Joined:
    Jul 26, 2015
    Posts:
    224
    Minecraft User:
    move_it
    I will try this.
  13. Hittmana
    Offline

    Hittmana Active Member

    Joined:
    Jul 26, 2015
    Posts:
    224
    Minecraft User:
    move_it
    still get:

    Syntax errors
    • Inspection result: Error
    • Errors
      • Could not open input file: /var/www/tmp/5/Tutorial
    • Info
      • 0 good PHP file(s) and 1 bad PHP file(s) found.
      • Checked with PHP 5.6.11-1+deb.sury.org~trusty+1
    when i compile it.
    Will test on my server.
  14. Hittmana
    Offline

    Hittmana Active Member

    Joined:
    Jul 26, 2015
    Posts:
    224
    Minecraft User:
    move_it
    Looks like it worked! My server does not crash now! THANK YOU SO MUCH!!
  15. Hittmana
    Offline

    Hittmana Active Member

    Joined:
    Jul 26, 2015
    Posts:
    224
    Minecraft User:
    move_it
    DOES NOT WORK!! here is crash dump:

    Attached Files:

  16. TomasOlsson
    Offline

    TomasOlsson New Member

    Joined:
    Nov 23, 2015
    Posts:
    5
    Minecraft User:
    VMe89
    change: public function onCommand(pocketmine\command\CommandSender $sender, pocketmine\command\Command $command, $label, array $args)
    To: public function onCommand(CommandSender $sender, Command $command, $label, array $args){

    and add use pocketmine\command\CommandSender; under namespace
  17. Hittmana
    Offline

    Hittmana Active Member

    Joined:
    Jul 26, 2015
    Posts:
    224
    Minecraft User:
    move_it
    I already added the use pocketmine\command\CommandSender

    and it is set as public function onCommand (CommandSender $sender, Command $command, $label, array $args) already
  18. Hittmana
    Offline

    Hittmana Active Member

    Joined:
    Jul 26, 2015
    Posts:
    224
    Minecraft User:
    move_it
    PHP:
    <?php

    namespace Tutorial;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\utils\TextFormat as Color;
    use 
    pocketmine\Player;

    class 
    MainClass extends PluginBase{
      
        public function 
    onEnable() {
            
    $this->getLogger()->info(Color::GREEN"[HAW] HAW has been enabled");
        }
       
        public function 
    onDisable() {
           
           
    $this->getLogger()->info(Color::GREEN"[HAW] HAW has been enabled");
        }  
       
       
          public function 
    onCommand(CommandSender $senderCommand $command$label, array $args) {
              if(
    $sender instanceof Player) {
                
    $name $sender->getName();  
              if(
    $strtolower($command->getName()) === "tutorial")
                if(
    count($args) < 1) {
                  
    $sender->sendMessage(Color::GOLD"[Server] Hello $name welcome to our server!") ;
                  return;
                }
                 else {
                    
    $sender->sendMessage(Color::RED"[Server] sorry $name this command doesn't need arguments") ;
                  return;
                }
            }
            
    $sender->sendMessage(Color::RED"[HAW] You must be a player to execute this command!") ;
                  return;
        }
    }
    ---
    name: Tutorial
    author: Hittmana
    main: Tutorial\MainClass
    version: 1.0.0
    api: [1.12.0]
    description: Test plugin
    command:
    tutorial:
    description: Send a message to the user
    permission: tutorial.cmd
    permissions:
    tutorial.cmd:
    default: true
    description: "Send a message to the user"
    ...
  19. Hittmana
    Offline

    Hittmana Active Member

    Joined:
    Jul 26, 2015
    Posts:
    224
    Minecraft User:
    move_it
    code and .yml
  20. Hittmana
    Offline

    Hittmana Active Member

    Joined:
    Jul 26, 2015
    Posts:
    224
    Minecraft User:
    move_it
    the main problem is I keep getting this error:

    • Errors
      • Could not open input file: /var/www/tmp/5/Tutorial
    and i do not even have a file /var/www/tmp/5/Tutorial

Share This Page

Advertisement