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

How to get a player's default language.

Comments in 'Plugin Development' started by RekkuzaRage, Jun 13, 2015.

  1. RekkuzaRage
    Offline

    RekkuzaRage Active Member

    Joined:
    Apr 15, 2014
    Posts:
    251
    Minecraft User:
    RekkuzaRage
    0.11 was released a few weeks ago. New feature was added. Language support. I noticed that PocketMine support languages, but I am not sure how to get a player's language. Can someone show some code example on how to get a player's language?
  2. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    Not Sure. I don't know if an external server can get that data from the client device.
  3. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    get Player´s IP all countries have their own IP (the first 2 numbers)
  4. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Where can I find them? And how can I just check the first 2 numbers of the IP?
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    No, the language the player selected in MCPE isn't available server-side.
    RekkuzaRage and DunxandMinecraft like this.
  6. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    I thought the first two triples.
  7. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
    Yes. Good idea. You can get the IP location
    RekkuzaRage likes this.
  8. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
    Hmm...
    And how can PocketMine send translated messages to the client?
    I think they are translated by PocketMine and not from MCPE. Maybe a new UDP packet to send language data has been implemented on MCPE 0.11.0
    CraftYourBukkit likes this.
  9. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    I saw this setting in pocketmine.yml ...

    Code:
    settings:
       #Three-letter language code for server-side localization
       #Check your language code on https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes
       language: "spa"
       #Whether to send all strings translated to server locale or let the device handle them
       force-language: false
    
  10. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    PocketMine sends the translation codes (e.g. discoonectReason.serverFull) plus the arguments. See https://github.com/pocketmine/pocke...ocketmine/network/protocol/TextPacket.php#L76 for proof that PocketMine sends the parameters in a different place.
    RekkuzaRage likes this.
  11. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
  12. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
  13. Thunder33345
    Offline

    Thunder33345 Notable Member

    Joined:
    Apr 3, 2014
    Posts:
    755
    Minecraft User:
    Thunder33345
    no dont do that
    That is very annoying
    what country dont mean you will prefer your country language
    the best is when a player register ask them what they prefer
    Andrey Nazarchuk and PEMapModder like this.
  14. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    This could be used to redirect a player to a server in their own country, for lower pings so less lag for the player.
  15. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Use an AsyncTask to query the player's country from an online API like http://ipinfo.IO
    Though, IP may not always be accurate.
  16. Thunder33345
    Offline

    Thunder33345 Notable Member

    Joined:
    Apr 3, 2014
    Posts:
    755
    Minecraft User:
    Thunder33345
    or just let the player to chose
    since what if they want to play with friends
  17. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    Well you can always do that, just many players have friends that live close to them, and everyone prefers less lag.
  18. Thunder33345
    Offline

    Thunder33345 Notable Member

    Joined:
    Apr 3, 2014
    Posts:
    755
    Minecraft User:
    Thunder33345
    well that will never work for a meetup
    like youtuber meetup
    and not all friends live close like internet friends
    CraftYourBukkit and Legoboy0215 like this.
  19. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    Alright then allow them to choose where they want to go, because most players aren't playing with friends... People prefer less lag without having to do anything to get it except join.

Share This Page

Advertisement