Fixed kick, SendData sets kill when sending packet 0x2. Also when a socket is killed players are resynced.
This commit is contained in:
parent
1e1216f090
commit
cf736cbb30
1 changed files with 307 additions and 301 deletions
|
|
@ -1,7 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Terraria;
|
using Terraria;
|
||||||
|
|
||||||
|
|
@ -18,6 +15,7 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
return mess.Split(':')[0];
|
return mess.Split(':')[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used for some places where a list of players might be used.
|
/// Used for some places where a list of players might be used.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -41,6 +39,7 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// It's a clamp function
|
/// It's a clamp function
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -59,6 +58,7 @@ namespace TShockAPI
|
||||||
result = min;
|
result = min;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Broadcasts a message to all players
|
/// Broadcasts a message to all players
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -70,6 +70,7 @@ namespace TShockAPI
|
||||||
SendMessage(i, msg);
|
SendMessage(i, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a message out to a single player
|
/// Sends a message out to a single player
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -80,6 +81,7 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
NetMessage.SendData(0x19, ply, -1, msg, 255, color[0], color[1], color[2]);
|
NetMessage.SendData(0x19, ply, -1, msg, 255, color[0], color[1], color[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a green message to a player
|
/// Sends a green message to a player
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -89,6 +91,7 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
NetMessage.SendData(0x19, ply, -1, message, 255, 0f, 255f, 0f);
|
NetMessage.SendData(0x19, ply, -1, message, 255, 0f, 255f, 0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The number of active players on the server.
|
/// The number of active players on the server.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -105,6 +108,7 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Finds the name of the player of the int given
|
/// Finds the name of the player of the int given
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -123,6 +127,7 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
return pl;
|
return pl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the given player's name
|
/// Gets the given player's name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -139,6 +144,7 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
return "null";
|
return "null";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates an NPC
|
/// Creates an NPC
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -148,7 +154,6 @@ namespace TShockAPI
|
||||||
/// <param name="target">int player that the npc targets</param>
|
/// <param name="target">int player that the npc targets</param>
|
||||||
public static void NewNPC(int type, int x, int y, int target)
|
public static void NewNPC(int type, int x, int y, int target)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case 0: //World Eater
|
case 0: //World Eater
|
||||||
|
|
@ -166,10 +171,9 @@ namespace TShockAPI
|
||||||
int enpeecee = NPC.NewNPC(x, y, 0x23, 0);
|
int enpeecee = NPC.NewNPC(x, y, 0x23, 0);
|
||||||
Main.npc[enpeecee].netUpdate = true;
|
Main.npc[enpeecee].netUpdate = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Finds a player, reads admins.txt, and determines if their IP address is on that list.
|
/// Finds a player, reads admins.txt, and determines if their IP address is on that list.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -188,6 +192,7 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Finds a player based on their name, reads admins.txt, and determines if thier IP address is on that list.
|
/// Finds a player based on their name, reads admins.txt, and determines if thier IP address is on that list.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -206,6 +211,7 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Kicks a player from the server.
|
/// Kicks a player from the server.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -214,8 +220,6 @@ namespace TShockAPI
|
||||||
public static void Kick(int ply, string reason)
|
public static void Kick(int ply, string reason)
|
||||||
{
|
{
|
||||||
NetMessage.SendData(0x2, ply, -1, reason, 0x0, 0f, 0f, 0f);
|
NetMessage.SendData(0x2, ply, -1, reason, 0x0, 0f, 0f, 0f);
|
||||||
Netplay.serverSock[ply].kill = true;
|
|
||||||
NetMessage.syncPlayers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -257,6 +261,7 @@ namespace TShockAPI
|
||||||
Tools.Broadcast(cheater + " was " + (ConfigurationManager.banCheater ? "banned " : "kicked ") + "for greifing.");
|
Tools.Broadcast(cheater + " was " + (ConfigurationManager.banCheater ? "banned " : "kicked ") + "for greifing.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shows a MOTD to the player
|
/// Shows a MOTD to the player
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -296,6 +301,7 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
tr.Close();
|
tr.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Tools() { }
|
public Tools() { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue