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

sendMessage Doesnt Work

Comments in 'Plugin Development' started by Jon, Oct 6, 2014.

  1. Jon
    Offline

    Jon Active Member Plugin Developer

    Joined:
    Sep 1, 2013
    Posts:
    201
    Plugins:
    3
    Minecraft User:
    Heromine14
    Hi
    I am working on a color plugin
    But when i type the command /color the server doesnt send me the message "you have enabled/disabled colors..."

    Here is the string
    PHP:
    public function onCommand(CommandSender $senderCommand $command$label, array $args){
          
    $cmd $command->getName();
          if(
    $sender instanceof Player){
             if(
    $cmd=="color"){
                if(
    in_array($sender->getName(),$this->coloredChatPlayers)){
                   unset(
    $this->coloredChatPlayers[$sender->getName()]);
                   
    $sender->sendMessage("You have disabled color chat!");
                }else{
                   
    array_push($this->coloredChatPlayers,$sender->getName());
                   
    $sender->sendMessage("You have enabled color chat!");
                }
             }
          }
       }
    }
    Can anyone make me an alternative string or tell me why it dont work?
  2. GmWM
    Offline

    GmWM Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    181
    Plugins:
    3
    Minecraft PE and PocketMine-MP does not have the Color Chat support.
    Why are you trying to do something that not exists?
  3. Jon
    Offline

    Jon Active Member Plugin Developer

    Joined:
    Sep 1, 2013
    Posts:
    201
    Plugins:
    3
    Minecraft User:
    Heromine14
    Blocklauncher yes
    Screenshot_2014-10-06-14-54-05.png
  4. GmWM
    Offline

    GmWM Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    181
    Plugins:
    3
    These are mods dude. That means that you modded/modified the game or something like this.

    Plugin ≠ Mod
    PocketKiller and LDX like this.
  5. Jon
    Offline

    Jon Active Member Plugin Developer

    Joined:
    Sep 1, 2013
    Posts:
    201
    Plugins:
    3
    Minecraft User:
    Heromine14
    So,
    Can you help me or not?
  6. GmWM
    Offline

    GmWM Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    181
    Plugins:
    3
    On what platform are you developing this? Adroid, iOS or PC programs?
  7. Jon
    Offline

    Jon Active Member Plugin Developer

    Joined:
    Sep 1, 2013
    Posts:
    201
    Plugins:
    3
    Minecraft User:
    Heromine14
    PC and android but i dont understand the sense of the question
  8. GmWM
    Offline

    GmWM Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    181
    Plugins:
    3
    If you want to develop a mod direct on Android you can use an app called ModScript.
  9. Jon
    Offline

    Jon Active Member Plugin Developer

    Joined:
    Sep 1, 2013
    Posts:
    201
    Plugins:
    3
    Minecraft User:
    Heromine14
    This is a plugin not a mod
  10. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
    Pocketmine TextColor translates code in ANSI codes. ANSI codes are available only for PC Command Shells.
    Then TextColor function works only on Pocketmine console. If you send a message to client with text color, Pocketmine will replace the ANSI code with null before sending the message.

    Please Like if I helped you :)
    PocketKiller likes this.
  11. GmWM
    Offline

    GmWM Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    181
    Plugins:
    3
    You don't understand that PocketMine-MP does not support color chat?
  12. GmWM
    Offline

    GmWM Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    181
    Plugins:
    3
    A better explication...
    Thanks EvolSoft.
  13. Jon
    Offline

    Jon Active Member Plugin Developer

    Joined:
    Sep 1, 2013
    Posts:
    201
    Plugins:
    3
    Minecraft User:
    Heromine14
    I already know this
    And its only my problem not your...
    Can you only answer the question please?
  14. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
    Idea! Try to send messages without using the TextColor function. Try with this:
    PHP:
    //§ should translate color codes in BlockLauncher
    $player->sendMessage("§cTest");
    Replace TextColor function with "§", but remember that it should work only on BlockLauncher and maybe in PocketMine console.

    Please Like if I helped you :)
  15. Jon
    Offline

    Jon Active Member Plugin Developer

    Joined:
    Sep 1, 2013
    Posts:
    201
    Plugins:
    3
    Minecraft User:
    Heromine14
    Well, the question is...why
    PHP:
    $sender->sendMessage("You have enabled color chat!");
    Is not working?
  16. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
    Should the /color command enable/disable the chat color?
  17. Jon
    Offline

    Jon Active Member Plugin Developer

    Joined:
    Sep 1, 2013
    Posts:
    201
    Plugins:
    3
    Minecraft User:
    Heromine14
    Yes
  18. Jon
    Offline

    Jon Active Member Plugin Developer

    Joined:
    Sep 1, 2013
    Posts:
    201
    Plugins:
    3
    Minecraft User:
    Heromine14
    I am not talking about MOD but PLUGIN



    Maybe i am wrong
  19. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
    Are you sure that all variables are stored in array correctly?
    Do a debug. Print the array in console and see if it's not empty.
    If the array is empty, try to use self:: functio
  20. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12

Share This Page

Advertisement