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

Solved getDeathMessage() translation?

Comments in 'Plugin Development' started by Legoboy0215, Dec 6, 2015.

  1. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    How would I translate the getDeathMessage() back into a normal message again? TranslationContainer?
  2. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    What do you mean by "Back into a normal message"
  3. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    It returns death.attack.player and those kind of stuff.
  4. CookieSteve
    Offline

    CookieSteve Active Member

    Joined:
    Apr 22, 2014
    Posts:
    132
    Minecraft User:
    iStrqfeChris
    Update your PocketMine thats just a bug
  5. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    In code I mean.
  6. CookieSteve
    Offline

    CookieSteve Active Member

    Joined:
    Apr 22, 2014
    Posts:
    132
    Minecraft User:
    iStrqfeChris
    Cancel the PlayerDeathEvent and maybe Sent a message to all players
  7. xBeastMode
    Offline

    xBeastMode Active Member

    Joined:
    Nov 27, 2015
    Posts:
    292
    It's not cancellable. o_O

    Maybe try setDeathMessage()?
  8. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    I am trying to do $event->getDeathMessage() and send it to all players. How would I do that?
  9. CookieSteve
    Offline

    CookieSteve Active Member

    Joined:
    Apr 22, 2014
    Posts:
    132
    Minecraft User:
    iStrqfeChris
    PHP:
    $p->sendMessage($event->getDeathMessage());
  10. CookieSteve
    Offline

    CookieSteve Active Member

    Joined:
    Apr 22, 2014
    Posts:
    132
    Minecraft User:
    iStrqfeChris
    I Dont use DeathEvent Much MY Bad didnt know if you could Cancel it or not
  11. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    PHP:
    Server::getInstance()->broadcastMessage(new TranslationContainer("death.attack.magic", [$event->getPlayer()->getName()])); 
  12. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Try the force language option in pocketmine.ynl
    Legoboy0215 likes this.
  13. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    What does it do?
  14. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    When I do var_dump($event->getDeathMessage()), I get this now:
    Code:
    object(pocketmine\event\TranslationContainer)#31819 (2) {
      ["params":protected]=>
      array(2) {
        [0]=>
        string(8) "Hello1"
        [1]=>
        string(8) "Hello2"
      }
      ["text":protected]=>
      string(19) "death.attack.player"
    }
    Now how do I change it? I changed force-language without any success.
  15. jojoe77777
    Offline

    jojoe77777 Notable Member Plugin Developer

    Joined:
    May 28, 2015
    Posts:
    653
    Plugins:
    1
    Minecraft User:
    jojoe77777
    If you just need to get those messages out, you can use
    PHP:
    $msg $event->getDeathMessage();
    $hello1 $msg->params[0]; // Returns "Hello1" from your example
    $hello2 $msg->params[1]; // Returns "Hello2" from your example
    $text $msg->text// Returns "death.attack.player" from your example
  16. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    I want to get the messages that the players receive.
  17. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Players receive death.attack.player, nothing else. The translation part is client side.
    Last edited: Dec 6, 2015
    Legoboy0215 likes this.
  18. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Oh! I found a way to solve it :)

Share This Page

Advertisement