mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
Remove pointless /banlist command.
This commit is contained in:
parent
a4aec8a80e
commit
a3f123c15d
@ -56,7 +56,6 @@ namespace MCGalaxy.Commands {
|
|||||||
new CommandKeywords((new CmdBanEdit()), "reason edit ban");
|
new CommandKeywords((new CmdBanEdit()), "reason edit ban");
|
||||||
new CommandKeywords((new CmdBanInfo()), "info ban details");
|
new CommandKeywords((new CmdBanInfo()), "info ban details");
|
||||||
new CommandKeywords((new CmdBanip()), "ip ban kick mod punish");
|
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 CmdBind()), "block replace");
|
||||||
new CommandKeywords((new CmdBlockDB()), "about block change remove del");
|
new CommandKeywords((new CmdBlockDB()), "about block change remove del");
|
||||||
new CommandKeywords((new CmdBlocks()), "block info list");
|
new CommandKeywords((new CmdBlocks()), "block info list");
|
||||||
@ -243,7 +242,7 @@ namespace MCGalaxy.Commands {
|
|||||||
new CommandKeywords((new CmdUnflood()), "flood un restore");
|
new CommandKeywords((new CmdUnflood()), "flood un restore");
|
||||||
new CommandKeywords((new CmdUnload()), "load un map level lvl");
|
new CommandKeywords((new CmdUnload()), "load un map level lvl");
|
||||||
new CommandKeywords((new CmdUnloaded()), "map level lvl list");
|
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 CmdVIP()), "list add remove del");
|
||||||
new CommandKeywords((new CmdVoice()), "speak moderate");
|
new CommandKeywords((new CmdVoice()), "speak moderate");
|
||||||
new CommandKeywords((new CmdVote()), "yes no ");
|
new CommandKeywords((new CmdVote()), "yes no ");
|
||||||
|
@ -29,7 +29,7 @@ namespace MCGalaxy.Commands.Moderation {
|
|||||||
if (p == null) { Player.Message(p, "Console must provide a player name."); return; }
|
if (p == null) { Player.Message(p, "Console must provide a player name."); return; }
|
||||||
message = p.name;
|
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 msg = message + (banned ? " is &CBANNED" : " is not banned");
|
||||||
|
|
||||||
string[] data = Ban.GetBanData(message);
|
string[] data = Ban.GetBanData(message);
|
||||||
|
@ -68,7 +68,7 @@ namespace MCGalaxy.Commands {
|
|||||||
if (alts.CaselessContains(value)) return;
|
if (alts.CaselessContains(value)) return;
|
||||||
|
|
||||||
Group grp = Group.findPerm(LevelPermission.Banned);
|
Group grp = Group.findPerm(LevelPermission.Banned);
|
||||||
if (Ban.IsBanned(value))
|
if (Group.IsBanned(value))
|
||||||
alts.Add(grp.color + value + "%S");
|
alts.Add(grp.color + value + "%S");
|
||||||
else
|
else
|
||||||
alts.Add(value);
|
alts.Add(value);
|
||||||
|
@ -18,18 +18,16 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace MCGalaxy.Commands
|
namespace MCGalaxy.Commands {
|
||||||
{
|
public sealed class CmdViewRanks : Command {
|
||||||
public sealed class CmdViewRanks : Command
|
|
||||||
{
|
|
||||||
public override string name { get { return "viewranks"; } }
|
public override string name { get { return "viewranks"; } }
|
||||||
public override string shortcut { get { return ""; } }
|
public override string shortcut { get { return ""; } }
|
||||||
public override string type { get { return CommandTypes.Information; } }
|
public override string type { get { return CommandTypes.Information; } }
|
||||||
public override bool museumUsable { get { return true; } }
|
public override bool museumUsable { get { return true; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
|
||||||
public override CommandAlias[] Aliases {
|
public override CommandAlias[] Aliases {
|
||||||
get { return new[] { new CommandAlias("ops", "operator"),
|
get { return new[] { new CommandAlias("ops", "operator"), new CommandAlias("admins", "superop"),
|
||||||
new CommandAlias("admins", "superop"), new CommandAlias("banned", "banned") }; }
|
new CommandAlias("banned", "banned"), new CommandAlias("balist", "banned") }; }
|
||||||
}
|
}
|
||||||
public CmdViewRanks() { }
|
public CmdViewRanks() { }
|
||||||
|
|
||||||
@ -37,7 +35,8 @@ namespace MCGalaxy.Commands
|
|||||||
if (message == "") {
|
if (message == "") {
|
||||||
Player.Message(p, "Available ranks: " + Group.concatList()); return;
|
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; }
|
if (grp == null) { Player.Message(p, "Could not find group"); return; }
|
||||||
|
|
||||||
string list = grp.playerList.All().Concatenate(", ");
|
string list = grp.playerList.All().Concatenate(", ");
|
||||||
@ -50,7 +49,8 @@ namespace MCGalaxy.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void Help(Player p) {
|
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());
|
Player.Message(p, "Available ranks: " + Group.concatList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -27,17 +27,9 @@ namespace MCGalaxy.Commands {
|
|||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
if (message == "") { Help(p); return; }
|
if (message == "") { Help(p); return; }
|
||||||
bool totalUnban = false;
|
|
||||||
if (message[0] == '@') {
|
|
||||||
totalUnban = true;
|
|
||||||
message = message.Remove(0, 1).Trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
Player who = PlayerInfo.Find(message);
|
Player who = PlayerInfo.Find(message);
|
||||||
string name = who == null ? message : who.name;
|
string name = who == null ? message : who.name;
|
||||||
Unban(p, name, who);
|
Unban(p, name, who);
|
||||||
if (totalUnban)
|
|
||||||
Command.all.Find("unbanip").Use(p, "@" + message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unban(Player p, string name, Player who) {
|
void Unban(Player p, string name, Player who) {
|
||||||
|
@ -271,7 +271,6 @@
|
|||||||
<Compile Include="Commands\Moderation\CmdBan.cs" />
|
<Compile Include="Commands\Moderation\CmdBan.cs" />
|
||||||
<Compile Include="Commands\Moderation\CmdBanEdit.cs" />
|
<Compile Include="Commands\Moderation\CmdBanEdit.cs" />
|
||||||
<Compile Include="Commands\Moderation\CmdBanip.cs" />
|
<Compile Include="Commands\Moderation\CmdBanip.cs" />
|
||||||
<Compile Include="Commands\Moderation\CmdBanlist.cs" />
|
|
||||||
<Compile Include="Commands\Moderation\CmdBlockSet.cs" />
|
<Compile Include="Commands\Moderation\CmdBlockSet.cs" />
|
||||||
<Compile Include="Commands\Moderation\CmdBlockSpeed.cs" />
|
<Compile Include="Commands\Moderation\CmdBlockSpeed.cs" />
|
||||||
<Compile Include="Commands\Moderation\CmdCmdSet.cs" />
|
<Compile Include="Commands\Moderation\CmdCmdSet.cs" />
|
||||||
|
@ -50,17 +50,6 @@ namespace MCGalaxy {
|
|||||||
return "Banned for \"" + reason + "\" by " + banner;
|
return "Banned for \"" + reason + "\" by " + banner;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Returns whether the given user is banned. </summary>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary> Gives info about the ban of user, as a string array of
|
/// <summary> Gives info about the ban of user, as a string array of
|
||||||
/// {banned by, ban reason, date and time, previous rank, stealth},
|
/// {banned by, ban reason, date and time, previous rank, stealth},
|
||||||
/// or null if no ban data was found. </summary>
|
/// or null if no ban data was found. </summary>
|
||||||
|
@ -224,5 +224,11 @@ namespace MCGalaxy
|
|||||||
|
|
||||||
return returnString.Remove(0, 2);
|
return returnString.Remove(0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary> Returns whether the given player is in the banned rank. </summary>
|
||||||
|
public static bool IsBanned(string name) {
|
||||||
|
Group grp = findPerm(LevelPermission.Banned);
|
||||||
|
return grp != null && grp.playerList.Contains(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -624,10 +624,7 @@ namespace MCGalaxy
|
|||||||
return "Error";
|
return "Error";
|
||||||
var whois = new WhoWas(p);
|
var whois = new WhoWas(p);
|
||||||
Group grp = Group.Find(whois.rank);
|
Group grp = Group.Find(whois.rank);
|
||||||
if (grp != null && grp.Permission == LevelPermission.Banned)
|
whois.banned = grp != null && grp.Permission == LevelPermission.Banned;
|
||||||
whois.banned = true;
|
|
||||||
else
|
|
||||||
whois.banned = Ban.IsBanned(p);
|
|
||||||
|
|
||||||
if (whois.banned) {
|
if (whois.banned) {
|
||||||
string[] bandata = Ban.GetBanData(p);
|
string[] bandata = Ban.GetBanData(p);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user