Package mindustry.core
Class NetServer
java.lang.Object
mindustry.core.NetServer
- All Implemented Interfaces:
ApplicationListener
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
static interface
class
-
Field Summary
Modifier and TypeFieldDescriptionConverts a message + NULLABLE player sender into a single string.Current kick session.Handles an incorrect command response.static int
Duration of a kick in seconds.static int
Cooldown between votes in seconds.static float
Voting round duration in seconds. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addPacketHandler
(String type, Cons2<mindustry.gen.Player, String> handler) static void
adminRequest
(mindustry.gen.Player player, mindustry.gen.Player other, Packets.AdminAction action, Object params) assignTeam
(mindustry.gen.Player current) assignTeam
(mindustry.gen.Player current, Iterable<mindustry.gen.Player> players) void
buildHealthUpdate
(mindustry.gen.Building build) Queues a building health update.checkColor
(String str) 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, Queue<BuildPlan> plans, float viewX, float viewY, float viewWidth, float viewHeight) static void
connectConfirm
(mindustry.gen.Player player) static void
debugStatusClient
(int value, int lastClientSnapshot, int snapshotsSent) static void
debugStatusClientUnreliable
(int value, int lastClientSnapshot, int snapshotsSent) getPacketHandlers
(String type) void
init()
Called when theApplication
is first created.boolean
void
kickAll
(Packets.KickReason reason) static void
onDisconnect
(mindustry.gen.Player player, String reason) void
Should only be used on the headless backend.static void
requestDebugStatus
(mindustry.gen.Player player) void
sendWorldData
(mindustry.gen.Player player) static void
serverPacketReliable
(mindustry.gen.Player player, String type, String contents) static void
serverPacketUnreliable
(mindustry.gen.Player player, String type, String contents) void
update()
Called when theApplication
should update itself.int
void
Sends a block snapshot to all players.void
writeEntitySnapshot
(mindustry.gen.Player player) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface arc.ApplicationListener
dispose, exit, fileDropped, pause, resize, resume
-
Field Details
-
admins
-
clientCommands
-
assigner
-
chatFormatter
Converts a message + NULLABLE player sender into a single string. Override for custom prefixes/suffixes. -
invalidHandler
Handles an incorrect command response. Returns text that will be sent to player. Override for customisation. -
currentlyKicking
Current kick session. -
kickDuration
public static int kickDurationDuration of a kick in seconds. -
voteDuration
public static float voteDurationVoting round duration in seconds. -
voteCooldown
public static int voteCooldownCooldown between votes in seconds.
-
-
Constructor Details
-
NetServer
public NetServer()
-
-
Method Details
-
init
public void init()Description copied from interface:ApplicationListener
Called when theApplication
is first created. Only gets called if the application is created before the listener is added.- Specified by:
init
in interfaceApplicationListener
-
votesRequired
public int votesRequired() -
assignTeam
-
assignTeam
-
sendWorldData
public void sendWorldData(mindustry.gen.Player player) -
addPacketHandler
-
getPacketHandlers
-
onDisconnect
-
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
-
serverPacketUnreliable
-
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 theApplication
should update itself.- Specified by:
update
in interfaceApplicationListener
-
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
-
writeBlockSnapshots
Sends a block snapshot to all players.- Throws:
IOException
-
writeEntitySnapshot
- Throws:
IOException
-
fixName
-
checkColor
-