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

ColorTag

Comments in 'Plugin Development' started by Skullex, Feb 27, 2016.

  1. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    Im starting to feel slow on the amount of attempts I've put in to fix the parse errors. Since it's 1:11 here and my pc is in another room charging I'm on my phone and I suck at coding on it so, may I receive some quick assistance?

    PHP:
    <?php

    namespace ColorTag;

    /*
    |    #####  ###### #     ###### #####
    |#    #  #    # #     #    # #   #
    |#       #    # #     #    # #   #
    |#       #    # #     #    # #  #
    |#       #    # #     #    # #   #
    |#    #  #    # #     #    # #   #
    |    #####  ###### ##### ###### #   #
    |
    |##### ##### ######
    |  #   #   # #     #
    |  #   ##### #
    |  #   #   # #
    |  #   #   # #    ##
    |  #   #   # #     #
    |  #   #   #  ######
    */

    use pocketmine\plugin\PluginBase;



    use 
    pocketmine\plugin\Plugin;



    use 
    pocketmine\Player;



    use 
    pocketmine\event\EventExecutor;



    use 
    pocketmine\event\EventPriority;



    use 
    pocketmine\event\Listener;



    use 
    pocketmine\command\CommandExecutor;



    use 
    pocketmine\command\CommandSender;



    use 
    pocketmine\command\Command;



    use 
    pocketmine\command\PluginCommand;

    /*
    By Skullex
                        :3
    */



    class Main extends PluginBase implements Listener {
         public function 
    onEnable(){
              
    $this->getLogger()->info("ColorTag has been enabled");
         }
        
         public function 
    onDisable(){
              
    $this->getLogger()->info("ColorTag has been disabled");
         }

         public function 
    onCommand(CommandSender $issuerCommand $cmd, array $args){
                       if(
    $issuer->hasPermission("hidetag.command")){
                   if(
    $issuer instanceof Player){
              switch(
    $cmd->getName()){
              case 
    "color":
              if(
    $sender->hasPermission("color.command.blue") or $sender->hasPermission("color.command")){
              switch(
    $args[0]){
                            case 
    "blue":
              if(
    $sender->hasPermission("color.command.blue") or $sender->hasPermission("color.command")){
              
    $currentTag $sender->getName();
              
    $sender->setNameTag("§9$currentTag");
              
    $sender->sendMessage("§e[§1C§2o§3l§4o§5r§6T§7a§8g§e]§a Your Name has been changed to §9blue");       
                            return 
    true;
                  }else{
        
    $sender->sendMessage("You do not have permission to use this command.");           
        
                  }
                                        
                            break;
                            case 
    "red":
         if(
    $sender->hasPermission("tag.command.red") or $sender->hasPermission("color.command")){
        
    $currentTag $issuer->getName();     
              
    $sender->setNameTag("§c$currentTag");
              
    $sender->sendMessage("§e[§1C§2o§3l§4o§5r§6T§7a§8g§e]§a Your Name has been changed to §cred"); 
              
                                              }else{
        
    $sender->sendMessage("You do not have permission to use this command.");
            return 
    true;
                                              }

                          
                            break;
                            case 
    "green":
                                if(
    $sender->hasPermission("color.command.green") or $sender->hasPermission("color.command")){
                                        
    $currentTag $issuer->getName();
              
    $sender->setNameTag("§a$currentTag");
              
    $sender->sendMessage("§e[§1C§2o§3l§4o§5r§6T§7a§8g§e]§a Your Name has been changed to §2green");
                                           return 
    true;
                                              }else{
        
    $sender->sendMessage("You do not have permission to use this command.");
            return 
    true;
                                              }
                break;
                            case 
    "yellow":
                    if(
    $sender->hasPermission("color.command.yellow") or $sender->hasPermission("color.command")) {
                   
    $currentTag $issuer->getName();
              
    $sender->setNameTag("§e$currentTag");
              
    $sender->sendMessage("§e[§1C§2o§3l§4o§5r§6T§7a§8g§e]§a Your Name has been changed to §eyellow");
                 return 
    true;     
                                              }else{
        
    $sender->sendMessage("You do not have permission to use this command.");
            return 
    true;
                                              }
                                        
                break;
        case 
    "reset":
      if(
    $sender->hasPermission("color.command.reset") or $sender->hasPermission("color.command")){
                     
    $currentTag $issuer->getName();
             
    $sender->setNameTag($sender->getName());
              
    $sender->sendMessage("§e[§1C§2o§3l§4o§5r§6T§7a§8g§e]§f All color has been removed§a!");
                            return 
    true;
                                              }else{
        
    $sender->sendMessage("You do not have permission to use this command.");
            return 
    true;
                                              }
                                           }
    }
    Thanks in advance :p
  2. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    You should rather tell us the error(s) than telling you where your PC and Phone is.
  3. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    I said Parse errors, but since I was descriptive then here..
    Code:
    Errors
    
    PHP Parse error: syntax error, unexpected end of file, expecting case (T_CASE) or default (T_DEFAULT) or '}' in /var/www/tmp/5/ColorTag/src/ColorTag/Main.php on line 146
    
    Errors parsing
    /var/www/tmp/5/ColorTag/src/ColorTag/Main.php
    I kept changing and deleting the line 146 and then it went to 145 and then 144 and I became oblivious
    Last edited: Feb 27, 2016
  4. TheDeibo
    Offline

    TheDeibo Notable Member Plugin Developer

    Joined:
    Sep 8, 2014
    Posts:
    692
    Plugins:
    1
    Minecraft User:
    TheDeibo
    PHP:
    <?php

    namespace ColorTag;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\plugin\Plugin;
    use 
    pocketmine\Player;
    use 
    pocketmine\event\EventExecutor;
    use 
    pocketmine\event\EventPriority;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\command\CommandExecutor;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\command\PluginCommand;

    /*
    By Skullex
                        :3
    */

    class Main extends PluginBase implements Listener {
         public function 
    onEnable(){
              
    $this->getLogger()->info("ColorTag has been enabled");
         }
         
         public function 
    onDisable(){
              
    $this->getLogger()->info("ColorTag has been disabled");
         }

         public function 
    onCommand(CommandSender $issuerCommand $cmd, array $args){
                       if(
    $issuer->hasPermission("hidetag.command")){
                   if(
    $issuer instanceof Player){
              switch(
    $cmd->getName()){
              case 
    "color":
              if(
    $sender->hasPermission("color.command.blue") or $sender->hasPermission("color.command")){
              switch(
    $args[0]){
                            case 
    "blue":
              if(
    $sender->hasPermission("color.command.blue") or $sender->hasPermission("color.command")){
              
    $currentTag $sender->getName();
              
    $sender->setNameTag("§9$currentTag");
              
    $sender->sendMessage("§e[§1C§2o§3l§4o§5r§6T§7a§8g§e]§a Your Name has been changed to §9blue");        
                            return 
    true;
                  }else{
        
    $sender->sendMessage("You do not have permission to use this command.");            
         
                  }
                                         
                            break;
                            case 
    "red":
         if(
    $sender->hasPermission("tag.command.red") or $sender->hasPermission("color.command")){
        
    $currentTag $issuer->getName();      
              
    $sender->setNameTag("§c$currentTag");
              
    $sender->sendMessage("§e[§1C§2o§3l§4o§5r§6T§7a§8g§e]§a Your Name has been changed to §cred");  
               
                                              }else{
        
    $sender->sendMessage("You do not have permission to use this command.");
            return 
    true;
                                              }

                           
                            break;
                            case 
    "green":
                                if(
    $sender->hasPermission("color.command.green") or $sender->hasPermission("color.command")){
                                        
    $currentTag $issuer->getName();
              
    $sender->setNameTag("§a$currentTag");
              
    $sender->sendMessage("§e[§1C§2o§3l§4o§5r§6T§7a§8g§e]§a Your Name has been changed to §2green");
                                           return 
    true;
                                              }else{
        
    $sender->sendMessage("You do not have permission to use this command.");
            return 
    true;
                                              }
                break;
                            case 
    "yellow":
                    if(
    $sender->hasPermission("color.command.yellow") or $sender->hasPermission("color.command")) {
                   
    $currentTag $issuer->getName();
              
    $sender->setNameTag("§e$currentTag");
              
    $sender->sendMessage("§e[§1C§2o§3l§4o§5r§6T§7a§8g§e]§a Your Name has been changed to §eyellow"); 
                 return 
    true;      
                                              }else{
        
    $sender->sendMessage("You do not have permission to use this command.");
            return 
    true;
                                              }
                                         
                break;
        case 
    "reset":
      if(
    $sender->hasPermission("color.command.reset") or $sender->hasPermission("color.command")){
                     
    $currentTag $issuer->getName();
             
    $sender->setNameTag($sender->getName());
              
    $sender->sendMessage("§e[§1C§2o§3l§4o§5r§6T§7a§8g§e]§f All color has been removed§a!");
                            return 
    true;
                                              }else{
        
    $sender->sendMessage("You do not have permission to use this command.");
            return 
    true;
                                              }
                                           }
              }
    }
    Corrected. ( sorry, i got rid of the comments... i just didn't like them because they annoyed me too much)
    The correction was, you needed a extra "}" read the crash...
    Skullex and CraftYourBukkit like this.
  5. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    Use an IDE like AWD. Cuz that syntax could get someone seriously hurt.
    Skullex likes this.
  6. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    lmao, i feel so slow for not reading that correctly

Share This Page

Advertisement