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

new to making plugins

Comments in 'Plugin Development' started by MyAJVideo, May 16, 2015.

  1. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    It's the same code there, did you use my code?
  2. MyAJVideo
    Offline

    MyAJVideo Active Member

    Joined:
    May 16, 2015
    Posts:
    148
    Minecraft User:
    mrAJV2010
  3. MyAJVideo
    Offline

    MyAJVideo Active Member

    Joined:
    May 16, 2015
    Posts:
    148
    Minecraft User:
    mrAJV2010
    I tried your with copy and phase and now syntaks error unexpected '{' on line 8
  4. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Then try to remove the "}"
  5. MyAJVideo
    Offline

    MyAJVideo Active Member

    Joined:
    May 16, 2015
    Posts:
    148
    Minecraft User:
    mrAJV2010
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    What about your plugin.yml?

    And please post your latest code here.

    Oh also, please indent well, it makes life easier.
  7. MyAJVideo
    Offline

    MyAJVideo Active Member

    Joined:
    May 16, 2015
    Posts:
    148
    Minecraft User:
    mrAJV2010
    Here is the code and i think im To dumb to programm plugins :( @PEMapModder
    PHP:
    <?php
    namespace TheMassage;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\CommandExecutor;
    use 
    pocketmine\Player;
    class 
    TheMassage extends PluginBase {
    public function 
    onEnable() {}
    public function 
    onDisable() {}
    public function 
    onCommand(CommandSender $senderCommand $command$label, array $args) {
        switch(
    $command->getName()){
            case 
    "setblock":
                 if (
    $sender instanceof Plyer) {
    $sender->sendMessage("helloooo");
                 return 
    true;
    }}}
    ?>
    Code:
    name: TheMassage
    author: MyAJVideo
    main: TheMassage\TheMassage
    version: 0.1
    api: 1.11.0
    commands:
    setBlock:
    description: says heloo
  8. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    @CraftYourBukkit taught me this:
    Code:
    public function onCommand(CommandSender $sender, Command $cmd, $label, array $args) {
                switch($cmd->getName()){
                    case "Your command here":
                       //What you want, like:
                       $sender->sendMessage("Hey!");
                       return true;
                }
    }
  9. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    PHP:
    <?php
    namespace TheMassage;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\CommandExecutor;
    use 
    pocketmine\Player;
    class 
    TheMassage extends PluginBase{
      public function 
    onEnable(){}
      public function 
    onDisable(){}
      public function 
    onCommand(CommandSender $issuerCommand $cmd$lbl, array $params){
        switch(
    $command->getName()){
        case 
    "setblock":
          if(
    $issuer instanceof Player){
            
    $issuer->sendMessage("helloooo");
            return 
    true;
          }
          
    $issuer->sendMessage("Please run this command in-game.");
          return 
    true;
        }
      }
    }
    Code:
    name: TheMassage
    author: MyAJVideo
    main: TheMassage\TheMassage
    version: 0.1
    api: 1.11.0
    commands:
      setblock:
        description: says heloo
    ^^^ Try this.
  10. MyAJVideo
    Offline

    MyAJVideo Active Member

    Joined:
    May 16, 2015
    Posts:
    148
    Minecraft User:
    mrAJV2010
  11. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I indented it better, changed some coding style conventions according to my own favour and added something and removed something to make it work.
    Also it is meaningless to have empty onEnable() and onDisable() functions.
    TigerHix likes this.
  12. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    yeah. At least have a maybe like "onEnable has been called" message.
  13. MyAJVideo
    Offline

    MyAJVideo Active Member

    Joined:
    May 16, 2015
    Posts:
    148
    Minecraft User:
    mrAJV2010
    OK thank you but now there is a problem with plugin.yml it can't get read
  14. MyAJVideo
    Offline

    MyAJVideo Active Member

    Joined:
    May 16, 2015
    Posts:
    148
    Minecraft User:
    mrAJV2010
    @PEMapModder of I put the plugin.yml file back like before there is the error again with unexpected '{' on line 8 mmm I think I'm doing something so wrong
  15. MyAJVideo
    Offline

    MyAJVideo Active Member

    Joined:
    May 16, 2015
    Posts:
    148
    Minecraft User:
    mrAJV2010
    I found out that the class is not right but what's not right I have no idea I think riding it new but it will couse the same problems @PEMapModder
  16. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    What? Why?
    Which problem? Did you use the code exactly?
    TigerHix likes this.
  17. MyAJVideo
    Offline

    MyAJVideo Active Member

    Joined:
    May 16, 2015
    Posts:
    148
    Minecraft User:
    mrAJV2010
    Yes i Copyed and paseted i send the screenshot what the console says @PEMapModder am I stupid ?

    Attached Files:

  18. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    Code:
    name: TheMassage
    author: MyAJVideo
    main: TheMassage\TheMassage
    version: 0.1
    api: 1.11.0
    commands:
      setblock:
        description: says heloo
        usage: /setblock
        permission: TheMassage.setblock
    
    Try this plugin.yml
  19. MyAJVideo
    Offline

    MyAJVideo Active Member

    Joined:
    May 16, 2015
    Posts:
    148
    Minecraft User:
    mrAJV2010
    @HotFireyDeath does usage have to be in the yml ? That could really be the problem
  20. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    How can it be a problem?

Share This Page

Advertisement