Core: Use better format for 'Banned for', also use banner's actual name in it.

This commit is contained in:
UnknownShadow200 2016-10-29 15:00:08 +11:00
parent bcd18c6923
commit 1c394224c4
4 changed files with 13 additions and 13 deletions

View File

@ -27,7 +27,7 @@ namespace MCGalaxy.Commands {
string[] args = message.Split(' '); string[] args = message.Split(' ');
if (message == "" || args.Length < 2) { Help(p); return; } if (message == "" || args.Length < 2) { Help(p); return; }
Player who = PlayerInfo.FindMatches(p, args[0]); Player who = PlayerInfo.FindMatches(p, args[0]);
Group grp = Group.FindMatches(p, args[1]); Group grp = Group.FindMatches(p, args[1]);
if (who == null || grp == null) return; if (who == null || grp == null) return;
if (p != null && who.Rank > p.Rank) { if (p != null && who.Rank > p.Rank) {

View File

@ -20,7 +20,6 @@ using System.Collections.Generic;
using System.Data; using System.Data;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Text;
using MCGalaxy.Eco; using MCGalaxy.Eco;
using MCGalaxy.SQL; using MCGalaxy.SQL;
@ -103,12 +102,13 @@ namespace MCGalaxy {
Item item = GetItem(args[0]); Item item = GetItem(args[0]);
if (item == null) return; if (item == null) return;
if (args[1].CaselessEq("enabled")) if (args[1].CaselessEq("enabled")) {
item.Enabled = args[2].CaselessEq("true"); item.Enabled = args[2].CaselessEq("true");
else if (args[1].CaselessEq("purchaserank")) } else if (args[1].CaselessEq("purchaserank")) {
item.PurchaseRank = (LevelPermission)int.Parse(args[2]); item.PurchaseRank = (LevelPermission)int.Parse(args[2]);
else } else {
item.Parse(line, args); item.Parse(line, args);
}
} }
} }

View File

@ -34,22 +34,22 @@ namespace MCGalaxy {
} }
public static string FormatBan(string banner, string reason) { public static string FormatBan(string banner, string reason) {
return "Banned for \"" + reason + "\" by " + banner; return "Banned by " + banner + ": " + reason;
} }
/// <summary> Adds a ban entry for the given user, and who banned them and why they were banned. </summary> /// <summary> Adds a ban entry for the given user, and who banned them and why they were banned. </summary>
public static void BanPlayer(Player p, string who, string reason, bool stealth, string oldrank) { public static void BanPlayer(Player banner, string target, string reason, bool stealth, string oldrank) {
reason = reason.Replace(" ", "%20"); reason = reason.Replace(" ", "%20");
string player = p == null ? "(console)" : p.name.ToLower(); string player = banner == null ? "(console)" : banner.truename;
AddBanEntry(player, who.ToLower(), reason, stealth.ToString(), FormatDate(), oldrank); AddBanEntry(player, target.ToLower(), reason, stealth.ToString(), FormatDate(), oldrank);
} }
/// <summary> Adds a ban entry for the given user, and who banned them and why they were banned. </summary> /// <summary> Adds a ban entry for the given user, and who banned them and why they were banned. </summary>
public static void UnbanPlayer(Player p, string who, string reason) { public static void UnbanPlayer(Player unbanner, string target, string reason) {
reason = reason.Replace(" ", "%20"); reason = reason.Replace(" ", "%20");
string player = p == null ? "(console)" : p.name.ToLower(); string player = unbanner == null ? "(console)" : unbanner.truename;
AddUnbanEntry(player, who.ToLower(), reason, FormatDate()); AddUnbanEntry(player, target.ToLower(), reason, FormatDate());
} }
static string FormatDate() { static string FormatDate() {

View File

@ -40,7 +40,7 @@ namespace MCGalaxy {
/// <summary> Gets the name and the group name for the given player. </summary> /// <summary> Gets the name and the group name for the given player. </summary>
public static void GetEntry(Player p, Player dst, out string name, out string group) { public static void GetEntry(Player p, Player dst, out string name, out string group) {
string col = Entities.GetSupportedCol(dst, p.color); string col = Entities.GetSupportedCol(dst, p.color);
group = Server.TablistGlobal ? "On " + p.level.name : "&fPlayers"; group = Server.TablistGlobal ? "On " + p.level.name : "&fPlayers";
name = col + p.truename; name = col + p.truename;
IGame game = p.level.CurrentGame(); IGame game = p.level.CurrentGame();
if (game != null) game.GetTabName(p, dst, ref name, ref group); if (game != null) game.GetTabName(p, dst, ref name, ref group);