This repository has been archived by the owner on Apr 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db5f7db
commit 28cd4c5
Showing
34 changed files
with
375 additions
and
101 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ TerrariaServer.exe -config server.config | |
@echo. | ||
@echo Restarting server... | ||
@echo. | ||
goto start | ||
goto start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using System; | ||
using OTA; | ||
using OTA.Command; | ||
using Terraria; | ||
using System.Linq; | ||
|
||
namespace TDSM.Core.Command.Commands | ||
{ | ||
public class ConnectionCommand : CoreCommand | ||
{ | ||
public override void Initialise() | ||
{ | ||
AddCommand("conn") | ||
.WithAccessLevel(AccessLevel.OP) | ||
.WithPermissionNode("tdsm.conn") | ||
.WithHelpText("count") | ||
.WithHelpText("kill <slot>") | ||
.WithHelpText("check") | ||
.Calls((ISender sender, ArgumentList args) => | ||
{ | ||
switch (args.GetString(0).ToLower()) | ||
{ | ||
case "count": | ||
sender.Message("Active connectons: " + (Netplay.Clients.Count(x => x.IsActive))); | ||
break; | ||
case "kill": | ||
var at = args.GetInt(1); | ||
var client = Netplay.Clients[at]; | ||
if (client != null && client.IsActive) | ||
{ | ||
client.PendingTermination = true; | ||
} | ||
break; | ||
case "check": | ||
for (var i = 0; i < Main.player.Length; i++) | ||
{ | ||
var player = Main.player[i]; | ||
var conn = Netplay.Clients[i]; | ||
if (conn == null && player == null) continue; | ||
if (player != null && conn != null) | ||
{ | ||
if (player.active != conn.IsActive) | ||
{ | ||
sender.Message($"Slot {i}, player active: {player.active}, conn active: {conn.IsActive}."); | ||
} | ||
} | ||
else if (player == null && conn.IsActive) | ||
{ | ||
sender.Message($"Player at slot {i} is null, but the connection instance is active."); | ||
} | ||
else if (conn == null && player.active) | ||
{ | ||
sender.Message($"Connection at slot {i} is null, but the player instance is active."); | ||
} | ||
} | ||
break; | ||
} | ||
}); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.