Class LanServerPinger

java.lang.Object
java.lang.Thread
net.minecraft.server.LanServerPinger
All Implemented Interfaces:
Runnable

@Environment(CLIENT)
public class LanServerPinger
extends Thread
Used to send UDP multicasts to notify other clients of a local game on the same network.

These multicasts will always be sent to 224.0.2.60:4445 where other clients can listen for local games.

  • Field Details

    • THREAD_ID

      private static final AtomicInteger THREAD_ID
    • LOGGER

      private static final Logger LOGGER
    • motd

      private final String motd
    • socket

      private final DatagramSocket socket
    • running

      private boolean running
    • addressPort

      private final String addressPort
  • Constructor Details

  • Method Details

    • run

      public void run()
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • interrupt

      public void interrupt()
      Overrides:
      interrupt in class Thread
    • createAnnouncement

      public static String createAnnouncement​(String motd, String addressPort)
      Creates a server announcement.
       
      [MOTD]
      // Specifies the beginning of the message of the day
      A message of the day
      // The message of the day
      [/MOTD]
      // Specifies the end of the message of the day.
      [AD]
      // Specifies the beginning of the address and the port of the local server.
      the address of the local server.
      // Such as 192.146.2.1:23132
      [/AD]
      // Specifies the end of the address and port of the local server.

      An example of a complete announcement: [MOTD]A Player's Server[/MOTD][AD]192.168.0.33[/AD]

      Parameters:
      motd - the message of the day
      addressPort - the address of the server including the IP address and port
    • parseAnnouncementMotd

      public static String parseAnnouncementMotd​(String announcement)
    • parseAnnouncementAddressPort

      public static String parseAnnouncementAddressPort​(String announcement)