From 2cbf683b5bfd4d192ba743a002dc35c3d73987ac Mon Sep 17 00:00:00 2001 From: "Lem()nTea_" Date: Sat, 29 Nov 2014 12:30:28 +0900 Subject: [PATCH] Removed duplicate function of CustomSocket. (#15) --- plugin/src/ifteam/CustomPacket/MainLoader.php | 45 ------------------- 1 file changed, 45 deletions(-) diff --git a/plugin/src/ifteam/CustomPacket/MainLoader.php b/plugin/src/ifteam/CustomPacket/MainLoader.php index 617b370..0698dba 100644 --- a/plugin/src/ifteam/CustomPacket/MainLoader.php +++ b/plugin/src/ifteam/CustomPacket/MainLoader.php @@ -50,51 +50,6 @@ public function getDefaultPort() { return $this->option["port"]; } - /** - * ReceivePacket and callEvent ReceivePacketEvent - * or ReceiveJSONPacketEvent (is_numeric check) - * - * @param int|string $data - * @param int $ip - * @param int $port - * - */ - public function receivePacket($data, $ip, $port) { - if(is_numeric($data)){ - $event = new ReceivePacketEvent($data, $ip, $port); - $this->getServer()->getPluginManager()->callEvent($event); - }else{ - $event = new ReceiveJSONPacketEvent(JSON_Decode($data), $ip, $port); - $this->getServer()->getPluginManager()->callEvent($event); - } - } - /** - * SendPacket and callEvent SendPacketEvent - * or SendJSONPacketEvent (is_numeric check) - * - * @param int|string $packet - * @param string $ip - * @param int $port - * - */ - public static function sendPacket($packet, $ip, $port) { - if(is_numeric($packet)){ - $event = new SendPacketEvent($packet, $ip, $port); - $this->getServer ()->getPluginManager ()->callEvent ($event); - if(!$event->isCancelled()){ - $packet = $event->getPacket(); - $this->socket->writePacket($packet, $ip, $port); - } - }else{ - $event = new SendJSONPacketEvent($this, $packet, $ip, $port); - $this->getServer()->getPluginManager()->callEvent($event); - if(!$event->isCancelled()){ - $packet = JSON_Encode($event->getPacket()); - $this->socket->writePacket($packet, $ip, $port); - } - } - } - public function callEvent($type, array $data){ switch($type){ case 'recv':