Class NetServer

java.lang.Object
mindustry.core.NetServer
All Implemented Interfaces:
ApplicationListener

public class NetServer extends Object implements ApplicationListener
  • Field Details

    • admins

      public Administration admins
    • clientCommands

      public CommandHandler clientCommands
    • assigner

      public NetServer.TeamAssigner assigner
    • chatFormatter

      public NetServer.ChatFormatter chatFormatter
      Converts a message + NULLABLE player sender into a single string. Override for custom prefixes/suffixes.
    • invalidHandler

      public NetServer.InvalidCommandHandler invalidHandler
      Handles an incorrect command response. Returns text that will be sent to player. Override for customisation.
    • currentlyKicking

      @Nullable public NetServer.VoteSession currentlyKicking
      Current kick session.
    • kickDuration

      public static int kickDuration
      Duration of a kick in seconds.
    • voteDuration

      public static float voteDuration
      Voting round duration in seconds.
    • voteCooldown

      public static int voteCooldown
      Cooldown between votes in seconds.
  • Constructor Details

    • NetServer

      public NetServer()
  • Method Details

    • init

      public void init()
      Description copied from interface: ApplicationListener
      Called when the Application is first created. Only gets called if the application is created before the listener is added.
      Specified by:
      init in interface ApplicationListener
    • votesRequired

      public int votesRequired()
    • assignTeam

      public Team assignTeam(mindustry.gen.Player current)
    • assignTeam

      public Team assignTeam(mindustry.gen.Player current, Iterable<mindustry.gen.Player> players)
    • sendWorldData

      public void sendWorldData(mindustry.gen.Player player)
    • addPacketHandler

      public void addPacketHandler(String type, Cons2<mindustry.gen.Player,String> handler)
    • getPacketHandlers

      public Seq<Cons2<mindustry.gen.Player,String>> getPacketHandlers(String type)
    • onDisconnect

      public static void onDisconnect(mindustry.gen.Player player, String reason)
    • requestDebugStatus

      public static void requestDebugStatus(mindustry.gen.Player player)
    • debugStatusClient

      public static void debugStatusClient(int value, int lastClientSnapshot, int snapshotsSent)
    • debugStatusClientUnreliable

      public static void debugStatusClientUnreliable(int value, int lastClientSnapshot, int snapshotsSent)
    • serverPacketReliable

      public static void serverPacketReliable(mindustry.gen.Player player, String type, String contents)
    • serverPacketUnreliable

      public static void serverPacketUnreliable(mindustry.gen.Player player, String type, String contents)
    • clientSnapshot

      public static void clientSnapshot(mindustry.gen.Player player, int snapshotID, int unitID, boolean dead, float x, float y, float pointerX, float pointerY, float rotation, float baseRotation, float xVelocity, float yVelocity, Tile mining, boolean boosting, boolean shooting, boolean chatting, boolean building, @Nullable Queue<BuildPlan> plans, float viewX, float viewY, float viewWidth, float viewHeight)
    • adminRequest

      public static void adminRequest(mindustry.gen.Player player, mindustry.gen.Player other, Packets.AdminAction action, Object params)
    • connectConfirm

      public static void connectConfirm(mindustry.gen.Player player)
    • isWaitingForPlayers

      public boolean isWaitingForPlayers()
    • update

      public void update()
      Description copied from interface: ApplicationListener
      Called when the Application should update itself.
      Specified by:
      update in interface ApplicationListener
    • buildHealthUpdate

      public void buildHealthUpdate(mindustry.gen.Building build)
      Queues a building health update. This will be sent in a Call.buildHealthUpdate packet later.
    • openServer

      public void openServer()
      Should only be used on the headless backend.
    • kickAll

      public void kickAll(Packets.KickReason reason)
    • writeBlockSnapshots

      public void writeBlockSnapshots() throws IOException
      Sends a block snapshot to all players.
      Throws:
      IOException
    • writeEntitySnapshot

      public void writeEntitySnapshot(mindustry.gen.Player player) throws IOException
      Throws:
      IOException
    • fixName

      public String fixName(String name)
    • checkColor

      public String checkColor(String str)