diff --git a/Commands/CommandKeywords.cs b/Commands/CommandKeywords.cs
index be517cfbb..f6606cf35 100644
--- a/Commands/CommandKeywords.cs
+++ b/Commands/CommandKeywords.cs
@@ -56,7 +56,6 @@ namespace MCGalaxy.Commands {
new CommandKeywords((new CmdBanEdit()), "reason edit ban");
new CommandKeywords((new CmdBanInfo()), "info ban details");
new CommandKeywords((new CmdBanip()), "ip ban kick mod punish");
- new CommandKeywords((new CmdBanlist()), "list ban info mod");
new CommandKeywords((new CmdBind()), "block replace");
new CommandKeywords((new CmdBlockDB()), "about block change remove del");
new CommandKeywords((new CmdBlocks()), "block info list");
@@ -243,7 +242,7 @@ namespace MCGalaxy.Commands {
new CommandKeywords((new CmdUnflood()), "flood un restore");
new CommandKeywords((new CmdUnload()), "load un map level lvl");
new CommandKeywords((new CmdUnloaded()), "map level lvl list");
- new CommandKeywords((new CmdViewRanks()), "show rank view user player");
+ new CommandKeywords((new CmdViewRanks()), "list info ban show rank view user player");
new CommandKeywords((new CmdVIP()), "list add remove del");
new CommandKeywords((new CmdVoice()), "speak moderate");
new CommandKeywords((new CmdVote()), "yes no ");
diff --git a/Commands/Information/CmdBanInfo.cs b/Commands/Information/CmdBanInfo.cs
index b30899cb0..8898e37cb 100644
--- a/Commands/Information/CmdBanInfo.cs
+++ b/Commands/Information/CmdBanInfo.cs
@@ -29,7 +29,7 @@ namespace MCGalaxy.Commands.Moderation {
if (p == null) { Player.Message(p, "Console must provide a player name."); return; }
message = p.name;
}
- bool banned = Group.findPerm(LevelPermission.Banned).playerList.Contains(message);
+ bool banned = Group.IsBanned(message);
string msg = message + (banned ? " is &CBANNED" : " is not banned");
string[] data = Ban.GetBanData(message);
diff --git a/Commands/Information/CmdClones.cs b/Commands/Information/CmdClones.cs
index 5b8fd5078..996fad66a 100644
--- a/Commands/Information/CmdClones.cs
+++ b/Commands/Information/CmdClones.cs
@@ -68,7 +68,7 @@ namespace MCGalaxy.Commands {
if (alts.CaselessContains(value)) return;
Group grp = Group.findPerm(LevelPermission.Banned);
- if (Ban.IsBanned(value))
+ if (Group.IsBanned(value))
alts.Add(grp.color + value + "%S");
else
alts.Add(value);
diff --git a/Commands/Information/CmdViewRanks.cs b/Commands/Information/CmdViewRanks.cs
index 71fddb47d..95f953523 100644
--- a/Commands/Information/CmdViewRanks.cs
+++ b/Commands/Information/CmdViewRanks.cs
@@ -18,18 +18,16 @@
using System;
using System.Text;
-namespace MCGalaxy.Commands
-{
- public sealed class CmdViewRanks : Command
- {
+namespace MCGalaxy.Commands {
+ public sealed class CmdViewRanks : Command {
public override string name { get { return "viewranks"; } }
public override string shortcut { get { return ""; } }
public override string type { get { return CommandTypes.Information; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
public override CommandAlias[] Aliases {
- get { return new[] { new CommandAlias("ops", "operator"),
- new CommandAlias("admins", "superop"), new CommandAlias("banned", "banned") }; }
+ get { return new[] { new CommandAlias("ops", "operator"), new CommandAlias("admins", "superop"),
+ new CommandAlias("banned", "banned"), new CommandAlias("balist", "banned") }; }
}
public CmdViewRanks() { }
@@ -37,7 +35,8 @@ namespace MCGalaxy.Commands
if (message == "") {
Player.Message(p, "Available ranks: " + Group.concatList()); return;
}
- Group grp = Group.Find(message);
+ Group grp = message.CaselessEq("banned") ?
+ Group.findPerm(LevelPermission.Banned) : Group.Find(message);
if (grp == null) { Player.Message(p, "Could not find group"); return; }
string list = grp.playerList.All().Concatenate(", ");
@@ -50,7 +49,8 @@ namespace MCGalaxy.Commands
}
public override void Help(Player p) {
- Player.Message(p, "/viewranks [rank] - Shows all users who have [rank]");
+ Player.Message(p, "/viewranks [rank] - Shows all players who have [rank]");
+ Player.Message(p, "/viewranks banned - Shows all players who are banned.");
Player.Message(p, "Available ranks: " + Group.concatList());
}
}
diff --git a/Commands/Moderation/CmdBanlist.cs b/Commands/Moderation/CmdBanlist.cs
deleted file mode 100644
index e7ddbf49d..000000000
--- a/Commands/Moderation/CmdBanlist.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/MCGalaxy)
-
- Dual-licensed under the Educational Community License, Version 2.0 and
- the GNU General Public License, Version 3 (the "Licenses"); you may
- not use this file except in compliance with the Licenses. You may
- obtain a copy of the Licenses at
-
- http://www.opensource.org/licenses/ecl2.php
- http://www.gnu.org/licenses/gpl-3.0.html
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the Licenses are distributed on an "AS IS"
- BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- or implied. See the Licenses for the specific language governing
- permissions and limitations under the Licenses.
-*/
-using System.IO;
-using System.Text;
-
-namespace MCGalaxy.Commands.Moderation {
- public sealed class CmdBanlist : Command {
- public override string name { get { return "banlist"; } }
- public override string shortcut { get { return "bl"; } }
- public override string type { get { return CommandTypes.Moderation; } }
- public override bool museumUsable { get { return true; } }
- public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
- public CmdBanlist() { }
-
- public override void Use(Player p, string message) {
- StringBuilder list = new StringBuilder();
- foreach (string line in File.ReadAllLines("ranks/banned.txt")) {
- string col = Ban.IsBanned(line) ? "&a" : "&c";
- list.Append(col).Append(line).Append("%S, ");
- }
-
- if (list.Length == 0) {
- Player.Message(p, "There are no players banned");
- } else {
- string msg = "&9Banned players: %S" + list.ToString(0, list.Length - 2) + "%S.";
- Player.Message(p, msg);
- }
- }
-
- public override void Help(Player p) {
- Player.Message(p, "/banlist - shows who is banned on the server");
- }
- }
-}
diff --git a/Commands/Moderation/CmdUnban.cs b/Commands/Moderation/CmdUnban.cs
index 809f682b6..7698c959c 100644
--- a/Commands/Moderation/CmdUnban.cs
+++ b/Commands/Moderation/CmdUnban.cs
@@ -27,17 +27,9 @@ namespace MCGalaxy.Commands {
public override void Use(Player p, string message) {
if (message == "") { Help(p); return; }
- bool totalUnban = false;
- if (message[0] == '@') {
- totalUnban = true;
- message = message.Remove(0, 1).Trim();
- }
-
Player who = PlayerInfo.Find(message);
string name = who == null ? message : who.name;
Unban(p, name, who);
- if (totalUnban)
- Command.all.Find("unbanip").Use(p, "@" + message);
}
void Unban(Player p, string name, Player who) {
diff --git a/MCGalaxy_.csproj b/MCGalaxy_.csproj
index bdca8f910..ff1e4dadb 100644
--- a/MCGalaxy_.csproj
+++ b/MCGalaxy_.csproj
@@ -271,7 +271,6 @@
-
diff --git a/Player/Ban.cs b/Player/Ban.cs
index 68f5e25b0..4eaedb7b4 100644
--- a/Player/Ban.cs
+++ b/Player/Ban.cs
@@ -50,17 +50,6 @@ namespace MCGalaxy {
return "Banned for \"" + reason + "\" by " + banner;
}
- /// Returns whether the given user is banned.
- public static bool IsBanned(string who) {
- who = who.ToLower();
- foreach (string line in File.ReadAllLines("text/bans.txt")) {
- string[] parts = line.Split(' ');
- if (parts.Length <= 1) continue;
- if (parts[1] == who) return true;
- }
- return false;
- }
-
/// Gives info about the ban of user, as a string array of
/// {banned by, ban reason, date and time, previous rank, stealth},
/// or null if no ban data was found.
diff --git a/Player/Group/Group.cs b/Player/Group/Group.cs
index b53186d75..26af9313e 100644
--- a/Player/Group/Group.cs
+++ b/Player/Group/Group.cs
@@ -224,5 +224,11 @@ namespace MCGalaxy
return returnString.Remove(0, 2);
}
+
+ /// Returns whether the given player is in the banned rank.
+ public static bool IsBanned(string name) {
+ Group grp = findPerm(LevelPermission.Banned);
+ return grp != null && grp.playerList.Contains(name);
+ }
}
}
diff --git a/Server/Server.cs b/Server/Server.cs
index f8075f189..a2d59f433 100644
--- a/Server/Server.cs
+++ b/Server/Server.cs
@@ -624,10 +624,7 @@ namespace MCGalaxy
return "Error";
var whois = new WhoWas(p);
Group grp = Group.Find(whois.rank);
- if (grp != null && grp.Permission == LevelPermission.Banned)
- whois.banned = true;
- else
- whois.banned = Ban.IsBanned(p);
+ whois.banned = grp != null && grp.Permission == LevelPermission.Banned;
if (whois.banned) {
string[] bandata = Ban.GetBanData(p);