示例#1
0
  private void sendMapData(Player player) {
    if (this.cachedDataPacket == null) {
      RenderData data = this.getRenderData();
      this.cachedDataPacket =
          new PacketPlayOutMap(
              this.getMapId(), (byte) 3, new ArrayList<MapIcon>(), data.buffer, 0, 0, 128, 128);
    }

    if (player != null) PacketSender.addPacketToQueue(player, this.cachedDataPacket);
  }
 /** Deactivates this <tt>UDPSlaveTerminal</tt>. */
 public void deactivate() {
   try {
     if (m_Active) {
       // 1. stop receiver
       m_PacketReceiver.stop();
       m_Receiver.join();
       // 2. stop sender gracefully
       m_PacketSender.stop();
       m_Sender.join();
       // 3. close socket
       m_Socket.close();
       m_ModbusTransport = null;
       m_Active = false;
     }
   } catch (Exception ex) {
     ex.printStackTrace();
   }
 }