(3.0.0 - 3.25.6) 2.1.0 (3.0.0 - 3.25.6) 1.1.1 (3.0.0 - 3.25.6) 1.1.0 (3.0.0 - 3.25.6) 1.0.1 (3.0.0 - 3.25.6) 1.0.0
This is stable and fast plugin for pmmp that allows server connect to WaterDog plugin StarGate. It make easier communication between server. Includes API fur custom packets, transferring players and more Download here!
More features will be added very soon
You can access StarGate-Atlantis by StarGateAtlantis::getInstance()
transferPlayer(Player player, string server)
This we use to transfer Player between serversRegisterPacket(StarGatePacket packet)
Really simple method for registring PacketputPacket(StarGatePacket packet)
This allows you to send packet. Packet must be registered firstkickPlayer(Player player, string reason)
Kick player from any server connected to StarGate networkisOnline(Player player)
Check if player is online. Sends back response 'true!server' or 'false'. Examples here.forwardPacket(string client, StarGatePacket packet)
Using ForwardPacket you can forward packet to other client/server$player = PLUGIN::getInstance()->getPlayer("alemiz003");
$server = "lobby2";
StarGateAtlantis::getInstance()->transferPlayer($player, $server);
To more examples look here!
Received Packets are handled by CustomPacketEvent
. Official Packets are handled (if needed) automaticly
Accessing Packet from Event:
public function getPacket() {
return $this->packet;
}
Response checking is useful when we want to get some data created by packet back to client. PHP allows you to use simple closures to handle result:
$closure = function ($response){
StarGateAtlantis::getInstance()->getLogger()->info("§a".$response);
};
StarGateAtlantis::getInstance()->isOnline("alemiz0003", $closure);
For more info please consider looking here.
For better understanding please read StarGatePacket and WelcomePacket
Convertor is used for encoding
and decoding
packets. We can use it for static and nonstatic usage
Functions:
packetStringData(string packetString)
Exports packetString to data array
putInt(int integer)
Pushes Integer to array
putString(string string)
Pushes String to array
getString(int key)
Returns String from array by key value
getPacketString()
Returns packetString from array data
static getInt(string string)
Returns Integer from String
static getForcePacketString(array strings)
Returns packetString from given array
static getPacketStringData(string packetString)
Returns array data from given string
$convertor = new Convertor($this->getID());
$convertor->putString($this->server);
$convertor->putInt($this->tps);
$this->encoded = $convertor->getPacketString();
$data = Convertor::getPacketStringData($packetString);
$packetId = (int) $data[0];