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

Chat

Discussion in 'Development' started by LucGamesDE, May 12, 2017.

  1. LucGamesDE

    LucGamesDE Baby Zombie

    Messages:
    170
    How can I send the player the chat from the last server after he transferred using the TransferPacket?
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    That's impossible, unless you have enough permissions on the previous server.
     
  3. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    • Send player from MCPE to CS:GO
    • Add fully functioning parrots in MCPE 1.0.8 without using mods or textures.
    • Scoreboard in MCPE 1.0.8 exactly like the way it looks on PC 1.1
    There was an "unless" exception. What if the player was transferred from LifeBoat to LifeGoat (assuming the OP's server as LifeGoat and not having any permission to interfere with LifeBoat's database).
     
  4. LucGamesDE

    LucGamesDE Baby Zombie

    Messages:
    170
    I own both servers. But how can I now do it?
     
  5. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    MySQL servers are good for data across game servers
     
    SOFe, EdwardHamHam and AnkitM252 like this.
  6. BouncyJeffer

    BouncyJeffer Spider Jockey

    Messages:
    39
    GitHub:
    bouncyjeffer
    If you log the chat, just send the logs to the player onJoin in the other server.
     
    jasonwynn10 likes this.
  7. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    It would theoretically be possible by letting a fake client join the other server and getting the chat :p
     
  8. LucGamesDE

    LucGamesDE Baby Zombie

    Messages:
    170
    Can u give me an example?
     
  9. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    That was meant to be a joke, it's totally impractical because you would need to let the server think that you are an actual player
     
    jasonwynn10 likes this.
  10. KnownUnown

    KnownUnown Spider Jockey Poggit Reviewer

    Messages:
    47
    GitHub:
    knownunown
    This is completely practical. OP is asking how he could implement chat forwarding between two servers he owns.
    You can..

    Communicate between the two servers utilizing TCP. Both servers are listening on a port. When a player is transferred, the origin server opens a connection to the destination server on the specified port, sends ClientID or some other uniquely identifying data to the destination server, then forwards all chat messages captured through some means (command preprocess event? fake player? witch magic? you decide!) to the destination server. The destination server then sends the forwarded messages to the newly connected client with the matching ClientID.

    This is, of course, not the only approach. In fact, there probably are better approaches.
    Implementation is left as an exercise to the reader.
     
    Lowkey, corytortoise and jasonwynn10 like this.
  11. LucGamesDE

    LucGamesDE Baby Zombie

    Messages:
    170
    Can you give me an example? I can make a socket connection between the servers
     
  12. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Using the Hormones API, you can detect PlayerChatEvent and release a hormone onto other servers to display it.
     
  13. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    My reply was meant for the method of using a fake client to connect to a server that the person does NOT own...
     
    jasonwynn10 likes this.
  14. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    In the terminology of Hormones, this is called "Nervous coordinate system". This is not feasible if there are too many servers. Imagine... If you have 5 servers, you need nCr(5, 2) = 10 connections, and if you have 10 servers, you need nCr(10, 2) = 45 connections. Moreover, you need to determine the appropriate port for the server, which is not quite convenient if you have multiple servers on the same machine.
    You may use a relay system like IRC, but it has the same problem with ports, and it might be slow.
    On the other hand, using a system like Hormones might be more efficient with a centralized server that does not require much extra setup. With a kidney, using MySQL isn't a big problem.
     
    KnownUnown and jasonwynn10 like this.
  15. 0x15f

    0x15f Baby Zombie

    Messages:
    145
    GitHub:
    0x15f
    I did it (I think)! HERE is the github repo, I haven't test it yet but it should work.
     
    EdwardHamHam likes this.
  16. LucGamesDE

    LucGamesDE Baby Zombie

    Messages:
    170
    I don't want to create a multi server chat. I only want the chat not cleared after a transfer
     
  17. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    This is client-dependent. I don't think this is possible.
    According to your code, it'd be very slow if you have a lot of other servers to send to, since you're broadcasting in the same thread. Using an async pool for it would be better.
     
  18. 0x15f

    0x15f Baby Zombie

    Messages:
    145
    GitHub:
    0x15f
    I'm working on a new version, it does more than just chat. I threw that together in about 30 min.
     
    jasonwynn10 likes this.
  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.