Skip to content

Commit

Permalink
Resolved tab spacing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
UserR00T committed Mar 24, 2019
1 parent aa7b4ab commit deed1ce
Show file tree
Hide file tree
Showing 81 changed files with 2,202 additions and 2,197 deletions.
86 changes: 43 additions & 43 deletions source/BP-Essentials/Chat/Announce.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,59 +10,59 @@
namespace BP_Essentials
{
public class Announcer
{
public System.Timers.Timer Timer { get; private set; }
public List<string> Announcements { get; set; } = new List<string>();
public double Interval
{
get => Timer.Interval;
set
{
Timer.Enabled = false;
Timer.Interval = value * 1000;
Timer.Enabled = true;
}
}
public Announcer(List<string> announcements) : this()
{
Announcements = announcements;
}
public Announcer()
{
public System.Timers.Timer Timer { get; private set; }
public List<string> Announcements { get; set; } = new List<string>();
public double Interval
{
get => Timer.Interval;
set
{
Timer.Enabled = false;
Timer.Interval = value * 1000;
Timer.Enabled = true;
}
}
public Announcer(List<string> announcements) : this()
{
Announcements = announcements;
}
public Announcer()
{
try
{
Timer = new System.Timers.Timer();
Timer = new System.Timers.Timer();

Timer.Elapsed += (sender, e) => OnTime();
if (TimeBetweenAnnounce == 0)
{
Timer.Enabled = false;
return;
}
Timer.Interval = TimeBetweenAnnounce * 1000;
Timer.Enabled = true;
Timer.Elapsed += (sender, e) => OnTime();
if (TimeBetweenAnnounce == 0)
{
Timer.Enabled = false;
return;
}
Timer.Interval = TimeBetweenAnnounce * 1000;
Timer.Enabled = true;
}
catch (Exception ex)
{
ErrorLogging.Run(ex);
}
}

void OnTime()
{
if (Announcements == null || Announcements.Count == 0)
return;
if (++AnnounceIndex > Announcements.Count - 1)
AnnounceIndex = 0;
if (string.IsNullOrWhiteSpace(Announcements[AnnounceIndex]))
return;
var lines = Announcements[AnnounceIndex].Split(new[] { "\r\n", "\r", "\n", "\\r\\n", "\\r", "\\n" }, StringSplitOptions.None);
foreach (var player in SvMan.players)
{
foreach (var line in lines)
player.Value.svPlayer.Send(SvSendType.Self, Channel.Reliable, ClPacket.GameMessage, line);
}
Debug.Log($"{PlaceholderParser.ParseTimeStamp()} [INFO] Announcement made...");
}
void OnTime()
{
if (Announcements == null || Announcements.Count == 0)
return;
if (++AnnounceIndex > Announcements.Count - 1)
AnnounceIndex = 0;
if (string.IsNullOrWhiteSpace(Announcements[AnnounceIndex]))
return;
var lines = Announcements[AnnounceIndex].Split(new[] { "\r\n", "\r", "\n", "\\r\\n", "\\r", "\\n" }, StringSplitOptions.None);
foreach (var player in SvMan.players)
{
foreach (var line in lines)
player.Value.svPlayer.Send(SvSendType.Self, Channel.Reliable, ClPacket.GameMessage, line);
}
Debug.Log($"{PlaceholderParser.ParseTimeStamp()} [INFO] Announcement made...");
}
}
}
34 changes: 17 additions & 17 deletions source/BP-Essentials/Chat/Commands/Admin/Arrest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ namespace BP_Essentials.Commands
{
class Arrest
{
public static void Run(SvPlayer player, string message)
{
string arg1 = GetArgument.Run(1, false, true, message);
if (string.IsNullOrEmpty(arg1))
{
player.SendChatMessage(ArgRequired);
return;
}
var shPlayer = GetShByStr.Run(arg1);
if (shPlayer == null)
{
player.SendChatMessage(NotFoundOnline);
return;
}
shPlayer.svPlayer.Restrain(shPlayer.manager.handcuffed);
player.SendChatMessage($"<color={infoColor}>Arrested</color> <color={argColor}>{shPlayer.username}</color><color={infoColor}>.</color>");
}
public static void Run(SvPlayer player, string message)
{
string arg1 = GetArgument.Run(1, false, true, message);
if (string.IsNullOrEmpty(arg1))
{
player.SendChatMessage(ArgRequired);
return;
}
var shPlayer = GetShByStr.Run(arg1);
if (shPlayer == null)
{
player.SendChatMessage(NotFoundOnline);
return;
}
shPlayer.svPlayer.Restrain(shPlayer.manager.handcuffed);
player.SendChatMessage($"<color={infoColor}>Arrested</color> <color={argColor}>{shPlayer.username}</color><color={infoColor}>.</color>");
}
}
}
28 changes: 14 additions & 14 deletions source/BP-Essentials/Chat/Commands/Admin/Back.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@

namespace BP_Essentials.Commands
{
class Back
{
public static void Run(SvPlayer player, string message)
{
var lastLocation = PlayerList[player.player.ID].LastLocation;
if (!lastLocation.HasPositionSet())
{
player.SendChatMessage($"<color={errorColor}>There is no location to teleport to.</color>");
return;
}
player.ResetAndSavePosition(lastLocation.Position, lastLocation.Rotation, lastLocation.PlaceIndex);
player.SendChatMessage($"<color={infoColor}>You've been teleported to your last known location.</color>");
}
}
class Back
{
public static void Run(SvPlayer player, string message)
{
var lastLocation = PlayerList[player.player.ID].LastLocation;
if (!lastLocation.HasPositionSet())
{
player.SendChatMessage($"<color={errorColor}>There is no location to teleport to.</color>");
return;
}
player.ResetAndSavePosition(lastLocation.Position, lastLocation.Rotation, lastLocation.PlaceIndex);
player.SendChatMessage($"<color={infoColor}>You've been teleported to your last known location.</color>");
}
}
}
44 changes: 22 additions & 22 deletions source/BP-Essentials/Chat/Commands/Admin/Ban.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@
namespace BP_Essentials.Commands {
public class Ban
{
public static void Run(SvPlayer player, string message)
{
var arg1 = GetArgument.Run(1, false, false, message);
var arg2 = GetArgument.Run(2, false, true, message);
if (string.IsNullOrEmpty(arg1) || string.IsNullOrEmpty(arg2))
{
player.SendChatMessage(ArgRequired);
return;
}
var shPlayer = GetShByStr.Run(arg1, true);
if (shPlayer == null)
{
player.SendChatMessage(NotFoundOnlineIdOnly);
return;
}
LogMessage.LogOther($"{PlaceholderParser.ParseTimeStamp()} [INFO] {shPlayer.username} Got banned by {player.playerData.username} (Reason: {arg2}");
player.Send(SvSendType.All, Channel.Unsequenced, ClPacket.GameMessage, $"<color={argColor}>{shPlayer.username}</color> <color={warningColor}>Just got banned by</color> <color={argColor}>{player.playerData.username}</color> <color={warningColor}>(Reason: </color><color={argColor}>{arg2}</color><color={warningColor}>)</color>");
SendDiscordMessage.BanMessage(shPlayer.username, player.playerData.username, arg2);
player.SendChatMessage($"<color={infoColor}>Banned</color> <color={argColor}>{shPlayer.username}</color><color={infoColor}>. (Reason: {arg2})</color>");
player.svManager.AddBanned(shPlayer);
player.svManager.Disconnect(shPlayer.svPlayer.connection, DisconnectTypes.Banned);
}
public static void Run(SvPlayer player, string message)
{
var arg1 = GetArgument.Run(1, false, false, message);
var arg2 = GetArgument.Run(2, false, true, message);
if (string.IsNullOrEmpty(arg1) || string.IsNullOrEmpty(arg2))
{
player.SendChatMessage(ArgRequired);
return;
}
var shPlayer = GetShByStr.Run(arg1, true);
if (shPlayer == null)
{
player.SendChatMessage(NotFoundOnlineIdOnly);
return;
}
LogMessage.LogOther($"{PlaceholderParser.ParseTimeStamp()} [INFO] {shPlayer.username} Got banned by {player.playerData.username} (Reason: {arg2}");
player.Send(SvSendType.All, Channel.Unsequenced, ClPacket.GameMessage, $"<color={argColor}>{shPlayer.username}</color> <color={warningColor}>Just got banned by</color> <color={argColor}>{player.playerData.username}</color> <color={warningColor}>(Reason: </color><color={argColor}>{arg2}</color><color={warningColor}>)</color>");
SendDiscordMessage.BanMessage(shPlayer.username, player.playerData.username, arg2);
player.SendChatMessage($"<color={infoColor}>Banned</color> <color={argColor}>{shPlayer.username}</color><color={infoColor}>. (Reason: {arg2})</color>");
player.svManager.AddBanned(shPlayer);
player.svManager.Disconnect(shPlayer.svPlayer.connection, DisconnectTypes.Banned);
}
}
}
90 changes: 45 additions & 45 deletions source/BP-Essentials/Chat/Commands/Admin/CheckAlts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,50 +11,50 @@ namespace BP_Essentials.Commands
{
class CheckAlts
{
public static void Run(SvPlayer player, string message)
{
var arg1 = GetArgument.Run(1, false, false, message);
var found = 0;
if (string.IsNullOrEmpty(arg1))
{
player.SendChatMessage(GetArgument.Run(0, false, false, message) + "[IP/IGN] [Arg2] Eg " + GetArgument.Run(0, false, false, message) + " ip 127.0.0.1");
return;
}
var arg2 = GetArgument.Run(2, false, true, message);
if (arg1.Equals("ip", StringComparison.InvariantCultureIgnoreCase))
{
var content = "Possible accounts using the IP " + arg2 + ":\r\n\r\n";
var builder = new StringBuilder();
builder.Append(content);
foreach (var line in File.ReadAllLines(IpListFile))
{
if (line.EndsWith(arg2, StringComparison.CurrentCulture))
{
++found;
builder.Append(line.Replace(": " + arg2, string.Empty) + "\r\n");
}
}
content = builder.ToString();
content += "\r\n\r\n" + arg2 + " occurred " + found + " times in the iplog file." + "\r\n";
player.Send(SvSendType.Self, Channel.Reliable, ClPacket.ServerInfo, content);
}
else if (arg1.Equals("ign", StringComparison.InvariantCultureIgnoreCase) || (arg1.Equals(nameof(player), StringComparison.InvariantCultureIgnoreCase)))
{
var content = "Possible logins on the account " + arg2 + " using the following IP's:\r\n\r\n";
var builder = new StringBuilder();
builder.Append(content);
foreach (var line in File.ReadAllLines(IpListFile))
{
if (line.StartsWith(arg2 + ": ", StringComparison.CurrentCulture))
{
++found;
builder.Append(line.Replace(arg2 + ": ", string.Empty) + "\r\n");
}
}
content = builder.ToString();
content = content + "\r\n\r\n" + arg2 + " occurred " + found + " times in the iplog file." + "\r\n";
player.Send(SvSendType.Self, Channel.Reliable, ClPacket.ServerInfo, content);
}
}
public static void Run(SvPlayer player, string message)
{
var arg1 = GetArgument.Run(1, false, false, message);
var found = 0;
if (string.IsNullOrEmpty(arg1))
{
player.SendChatMessage(GetArgument.Run(0, false, false, message) + "[IP/IGN] [Arg2] Eg " + GetArgument.Run(0, false, false, message) + " ip 127.0.0.1");
return;
}
var arg2 = GetArgument.Run(2, false, true, message);
if (arg1.Equals("ip", StringComparison.InvariantCultureIgnoreCase))
{
var content = "Possible accounts using the IP " + arg2 + ":\r\n\r\n";
var builder = new StringBuilder();
builder.Append(content);
foreach (var line in File.ReadAllLines(IpListFile))
{
if (line.EndsWith(arg2, StringComparison.CurrentCulture))
{
++found;
builder.Append(line.Replace(": " + arg2, string.Empty) + "\r\n");
}
}
content = builder.ToString();
content += "\r\n\r\n" + arg2 + " occurred " + found + " times in the iplog file." + "\r\n";
player.Send(SvSendType.Self, Channel.Reliable, ClPacket.ServerInfo, content);
}
else if (arg1.Equals("ign", StringComparison.InvariantCultureIgnoreCase) || (arg1.Equals(nameof(player), StringComparison.InvariantCultureIgnoreCase)))
{
var content = "Possible logins on the account " + arg2 + " using the following IP's:\r\n\r\n";
var builder = new StringBuilder();
builder.Append(content);
foreach (var line in File.ReadAllLines(IpListFile))
{
if (line.StartsWith(arg2 + ": ", StringComparison.CurrentCulture))
{
++found;
builder.Append(line.Replace(arg2 + ": ", string.Empty) + "\r\n");
}
}
content = builder.ToString();
content = content + "\r\n\r\n" + arg2 + " occurred " + found + " times in the iplog file." + "\r\n";
player.Send(SvSendType.Self, Channel.Reliable, ClPacket.ServerInfo, content);
}
}
}
}
44 changes: 22 additions & 22 deletions source/BP-Essentials/Chat/Commands/Admin/Clear.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@ namespace BP_Essentials.Commands
{
public class Clear
{
public static void Run(SvPlayer player, string message)
{
string arg1 = GetArgument.Run(1, false, true, message);
if (string.IsNullOrEmpty(arg1))
{
player.SendChatMessage(ArgRequired);
return;
}
var shPlayer = GetShByStr.Run(arg1);
if (shPlayer == null)
{
player.SendChatMessage(NotFoundOnline);
return;
}
var tempList = new List<InventoryItem>();
foreach (var item in shPlayer.myItems.Values)
tempList.Add(item);
for (int i = 0; i < tempList.Count; i++)
shPlayer.TransferItem(2, tempList[i].item.index, shPlayer.MyItemCount(tempList[i].item.index), true);
player.SendChatMessage($"<color={infoColor}>You cleared the inventory of</color> <color={argColor}>{shPlayer.username}</color><color={infoColor}>.</color>");
shPlayer.svPlayer.SendChatMessage($"<color={warningColor}>Your inventory has been cleared by</color> <color={argColor}>{player.playerData.username}</color><color={warningColor}>.</color>");
}
public static void Run(SvPlayer player, string message)
{
string arg1 = GetArgument.Run(1, false, true, message);
if (string.IsNullOrEmpty(arg1))
{
player.SendChatMessage(ArgRequired);
return;
}
var shPlayer = GetShByStr.Run(arg1);
if (shPlayer == null)
{
player.SendChatMessage(NotFoundOnline);
return;
}
var tempList = new List<InventoryItem>();
foreach (var item in shPlayer.myItems.Values)
tempList.Add(item);
for (int i = 0; i < tempList.Count; i++)
shPlayer.TransferItem(2, tempList[i].item.index, shPlayer.MyItemCount(tempList[i].item.index), true);
player.SendChatMessage($"<color={infoColor}>You cleared the inventory of</color> <color={argColor}>{shPlayer.username}</color><color={infoColor}>.</color>");
shPlayer.svPlayer.SendChatMessage($"<color={warningColor}>Your inventory has been cleared by</color> <color={argColor}>{player.playerData.username}</color><color={warningColor}>.</color>");
}
}
}
Loading

0 comments on commit deed1ce

Please sign in to comment.