iTXTech / SynapsePM

Synapse client for PocketMine like server software. Supports multiple connections.
21 stars 17 forks source link

what code i need?! #5

Closed StephanToGo closed 7 years ago

StephanToGo commented 7 years ago

i love your work, really!!! but i cant write down a plugin that can transfer player... i didnt find the right using of synapse. can someone help? i missed something maybe...

have someone more infos as $this->getServer()->getPluginManager()->getPlugin('SynapsePM')->getSynapses(); it doesnt work to get the ways...

ps. all runs fine, synapse server and my lobby server is connected. but cant tranfer a player from lobby to another server because i dont know how xD

tarik02 commented 7 years ago

Hello. Your solution:

// Transfer $player
foreach ($player->getSynapse()->getClientData() as $hash => $cdata)
{
    if ($cdata["description"] == 'lobby') // to lobby
    {
        $player->transfer($hash);
        break;
    }
}
NyaomiDEV commented 7 years ago

can $player be a pocketmine\Player instance or we need an instance of synapse\Player? If so, how can we get that instance? I'm getting mad.

xZeroMCPE commented 7 years ago

pocketmine\Player

doesnt really matter.......

iPocket commented 7 years ago

no. synpase\Player where the getSynapse() method

xZeroMCPE commented 7 years ago

@iPocket

I used pocketmine\Player, and it still worked for me. No matter which one is being used.

NyaomiDEV commented 7 years ago

@iPocket how to get synapse\Player instance if there isn't a getSynapsePlayer($player) function in SynapsePM's Main class?

tarik02 commented 7 years ago

@AryToNeX synapse\Player is extended from pocketmine\Player. So, if $player instanceof \synapse\Player is true, then $player instanceof \pocketmine\Player is also true.

xZeroMCPE commented 7 years ago

@Tarik02 That's mostly what i was trying to them tell....

But @iPocket got it all wrong....