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

Question Not a command

Discussion in 'Questions about This Forum' started by XCodeMCPE, Apr 6, 2017.

  1. XCodeMCPE

    XCodeMCPE Slime

    Messages:
    96
    GitHub:
    xcodemcpe
    Hi there, is there any way to changing the format message when a command does not exist.

    Exampe:
    /abcdefg
    Message: Server> Oops, that command does not exist.

    Would be even better if there was a plugin for this lol.
     
  2. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Two options I am aware of:
    1) Intercept commands at a high priority in your plugin and replace the message then. This is probably less reliable and hacky.
    2) Edit your pocketmine language file to suit your needs. This would require extracting PocketMine if you use a phar, and repharing it in that case, but it will be way less hacky and far more reliable.
     
  3. XCodeMCPE

    XCodeMCPE Slime

    Messages:
    96
    GitHub:
    xcodemcpe
    I dont use vpn or dedicated
     
  4. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    I would think HIGHEST priority would be better along with a check to make sure the event isn't already cancelled
     
  5. XCodeMCPE

    XCodeMCPE Slime

    Messages:
    96
    GitHub:
    xcodemcpe
    So I am going to buy a VPS server since my hoster doesn't take paypal anymore. So how exactly can I change the Pocketmine Language?
     
  6. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Extract the PocketMine-MP.phar if you use a phar, edit the language files, and recompile it into a phar? Or, you can just run it from the source.
     
  7. TheDiamondYT

    TheDiamondYT Zombie

    Messages:
    298
    GitHub:
    TheDiamondYT1
    How do you even set event priorities?
     
  8. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    I'm not certain, but I believe you do it using doc comments, like this:
    PHP:
     /**
     * The event handler sends events to each listener in varying order based on priority.
     * I believe HIGHEST is last, except for MONITOR, which should be left for use by the server.
     * @var EntityDamageByEntityEvent $event
     * @priority (LOWEST, LOW, NORMAL, HIGH, HIGHEST, etc.)
     */
     
    public function onDamage(EntityDamageEvent $event) {
      
    //Blah blah
     
    }
     
    Last edited: Apr 19, 2017
  9. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10

    using those along with the @priority tag in phpDoc comments for event functions
     
  10. TheDiamondYT

    TheDiamondYT Zombie

    Messages:
    298
    GitHub:
    TheDiamondYT1
    I can't find any code in PocketMine that's reads the PHPDoc comment.
     
  11. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Found it in PluginManager.php.
     
  12. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    The bit under it also checks if the event does or does not ignore being set to cancelled
     
  13. XCodeMCPE

    XCodeMCPE Slime

    Messages:
    96
    GitHub:
    xcodemcpe
    What section do I have to change the language in?
     
  14. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    In the source folder. The path should be pocketmine\lang\locale\eng.ini if you use the English language.
     
  15. XCodeMCPE

    XCodeMCPE Slime

    Messages:
    96
    GitHub:
    xcodemcpe
    ok thanks.
     
  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.