Fixed false bans when picking up liquid.

Added 3 permissions (canlava, canwater, logs)
'canlava' and 'canwater' are in the default group. Without them you cannot manipulate water/lava.
Users with the 'logs' permission get sent information. For example when someone uses a command they don't have access to.
This commit is contained in:
high 2011-06-08 10:36:56 -04:00
parent 55000158ee
commit 0dc39e15f5
5 changed files with 92 additions and 50 deletions

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.Xna.Framework;
using Terraria;
namespace TShockAPI
@ -85,24 +86,60 @@ namespace TShockAPI
Log.Info("Broadcast: " + msg);
}
public static void Broadcast(string msg, float[] color)
public static void Broadcast(string msg, float red, float green, float blue)
{
for (int i = 0; i < Main.player.Length; i++)
{
SendMessage(i, msg, color);
SendMessage(i, msg, red, green, blue);
}
Log.Info("Broadcast: " + msg);
}
[Obsolete("STOP USING THIS")]
public static void SendMessage(int ply, string msg, float[] colors)
{
SendMessage(ply, msg, colors[0],colors[1],colors[2]);
}
/// <summary>
/// Sends a message out to a single player
/// </summary>
/// <param name="ply">int socket thingy for the player from the server socket</param>
/// <param name="msg">String message</param>
public static void SendMessage(int ply, string msg, float red, float green, float blue)
{
NetMessage.SendData(0x19, ply, -1, msg, 255, red, green, blue);
}
/// <summary>
/// Sends a message out to a single player
/// </summary>
/// <param name="ply">int socket thingy for the player from the server socket</param>
/// <param name="msg">String message</param>
/// <param name="color">Float containing red, blue, and green color values</param>
public static void SendMessage(int ply, string msg, float[] color)
public static void SendMessage(int ply, string msg, Color color)
{
NetMessage.SendData(0x19, ply, -1, msg, 255, color[0], color[1], color[2]);
NetMessage.SendData(0x19, ply, -1, msg, 255, color.R, color.G, color.B);
}
/// <summary>
/// Sends message to all users with 'logs' permission.
/// </summary>
/// <param name="log"></param>
/// <param name="color"></param>
public static void SendLogs(string log, Color color)
{
Log.Info(log);
for (int i = 0; i < Main.maxPlayers; i++)
{
if (TShock.players[i] == null)
continue;
if (!TShock.players[i].group.HasPermission("logs"))
continue;
SendMessage(i, log, color);
}
}
/// <summary>