diff --git a/MCGalaxy/Commands/Chat/CmdEmote.cs b/MCGalaxy/Commands/Chat/CmdEmote.cs
index b9963edd7..994c46999 100644
--- a/MCGalaxy/Commands/Chat/CmdEmote.cs
+++ b/MCGalaxy/Commands/Chat/CmdEmote.cs
@@ -26,7 +26,7 @@ namespace MCGalaxy.Commands.Chatting {
p.parseEmotes = !p.parseEmotes;
bool addToList = p.parseEmotes != Server.Config.ParseEmotes;
if (!addToList) Server.noEmotes.Remove(p.name);
- else Server.noEmotes.AddUnique(p.name);
+ else Server.noEmotes.Add(p.name);
Server.noEmotes.Save();
p.Message("Emote parsing is {0}.", p.parseEmotes ? "enabled" : "disabled");
}
diff --git a/MCGalaxy/Commands/Information/CmdRules.cs b/MCGalaxy/Commands/Information/CmdRules.cs
index ad95343f3..491d35760 100644
--- a/MCGalaxy/Commands/Information/CmdRules.cs
+++ b/MCGalaxy/Commands/Information/CmdRules.cs
@@ -59,7 +59,7 @@ namespace MCGalaxy.Commands.Info {
if (!Server.Config.AgreeToRulesOnEntry) { p.Message("agree-to-rules-on-entry is not enabled."); return; }
if (!p.hasreadrules) { p.Message("&9You must read %T/Rules &9before agreeing."); return; }
- if (!Server.agreed.AddUnique(p.name)) {
+ if (!Server.agreed.Add(p.name)) {
p.Message("You have already agreed to the rules.");
} else {
p.agreed = true;
diff --git a/MCGalaxy/Commands/Moderation/CmdHide.cs b/MCGalaxy/Commands/Moderation/CmdHide.cs
index 847ab3ac0..32c801c51 100644
--- a/MCGalaxy/Commands/Moderation/CmdHide.cs
+++ b/MCGalaxy/Commands/Moderation/CmdHide.cs
@@ -61,7 +61,7 @@ namespace MCGalaxy.Commands.Moderation {
}
if (!p.opchat) opchat.Use(p, "", data);
- Server.hidden.AddUnique(p.name);
+ Server.hidden.Add(p.name);
} else {
AnnounceOps(p, "To Ops -λNICK%S- is now &fvisible");
p.hideRank = LevelPermission.Banned;
diff --git a/MCGalaxy/Commands/Moderation/CmdIrcControllers.cs b/MCGalaxy/Commands/Moderation/CmdIrcControllers.cs
index 0c5d49b2f..cfe3b4111 100644
--- a/MCGalaxy/Commands/Moderation/CmdIrcControllers.cs
+++ b/MCGalaxy/Commands/Moderation/CmdIrcControllers.cs
@@ -38,7 +38,7 @@ namespace MCGalaxy.Commands.Moderation {
case "add":
if (parts.Length < 2) { p.Message("You need to provide a name to add."); return; }
- if (!Server.ircControllers.AddUnique(parts[1])) {
+ if (!Server.ircControllers.Add(parts[1])) {
p.Message(parts[1] + " is already an IRC controller.");
} else {
Server.ircControllers.Save();
diff --git a/MCGalaxy/Commands/Moderation/CmdVIP.cs b/MCGalaxy/Commands/Moderation/CmdVIP.cs
index 2de1e4a8e..7c4bb4a5a 100644
--- a/MCGalaxy/Commands/Moderation/CmdVIP.cs
+++ b/MCGalaxy/Commands/Moderation/CmdVIP.cs
@@ -48,7 +48,7 @@ namespace MCGalaxy.Commands.Moderation {
name = PlayerInfo.FindMatchesPreferOnline(p, name);
if (name == null) return;
- if (!Server.vip.AddUnique(name)) {
+ if (!Server.vip.Add(name)) {
p.Message(PlayerInfo.GetColoredName(p, name) + " %Sis already a VIP.");
} else {
Server.vip.Save();
diff --git a/MCGalaxy/Commands/Moderation/CmdWhitelist.cs b/MCGalaxy/Commands/Moderation/CmdWhitelist.cs
index 117db8f9f..43b6d5195 100644
--- a/MCGalaxy/Commands/Moderation/CmdWhitelist.cs
+++ b/MCGalaxy/Commands/Moderation/CmdWhitelist.cs
@@ -47,7 +47,7 @@ namespace MCGalaxy.Commands.Moderation {
}
static void Add(Player p, string player) {
- if (!Server.whiteList.AddUnique(player)) {
+ if (!Server.whiteList.Add(player)) {
p.Message(player + " %Sis already on the whitelist!"); return;
} else {
Chat.MessageFromOps(p, "λNICK %Sadded &f" + player + " %Sto the whitelist.");
diff --git a/MCGalaxy/Commands/World/CmdLockdown.cs b/MCGalaxy/Commands/World/CmdLockdown.cs
index 7b063b5b1..bd4214c84 100644
--- a/MCGalaxy/Commands/World/CmdLockdown.cs
+++ b/MCGalaxy/Commands/World/CmdLockdown.cs
@@ -35,16 +35,13 @@ namespace MCGalaxy.Commands.World {
map = Matcher.FindMaps(p, map);
if (map == null) return;
-
- bool unlocking = Server.lockdown.Contains(map);
- string action = unlocking ? "unlocked" : "locked";
- Chat.MessageGlobal("Map " + map + " was " + action);
-
- if (unlocking) {
- Server.lockdown.Remove(map);
+
+ if (Server.lockdown.Remove(map)) {
+ Chat.MessageGlobal("Map " + map + " was unlocked");
Chat.MessageFromOps(p, "Map " + map + " unlocked by: λNICK");
} else {
- Server.lockdown.AddUnique(map);
+ Server.lockdown.Add(map);
+ Chat.MessageGlobal("Map " + map + " was locked");
Chat.MessageFromOps(p, "Map " + map + " locked by: λNICK");
}
Server.lockdown.Save();
diff --git a/MCGalaxy/Database/BlockDB/NameConverter.cs b/MCGalaxy/Database/BlockDB/NameConverter.cs
index 1e5ba5db4..5b1adab8d 100644
--- a/MCGalaxy/Database/BlockDB/NameConverter.cs
+++ b/MCGalaxy/Database/BlockDB/NameConverter.cs
@@ -56,7 +56,7 @@ namespace MCGalaxy.DB {
/// Returns a non-database ID for the given name
public static int InvalidNameID(string name) {
- bool added = Server.invalidIds.AddUnique(name);
+ bool added = Server.invalidIds.Add(name);
if (added) Server.invalidIds.Save();
int index = Server.invalidIds.IndexOf(name);
diff --git a/MCGalaxy/Player/List/PlayerExtList.cs b/MCGalaxy/Player/List/PlayerExtList.cs
index 3f300bc5f..b7b42c555 100644
--- a/MCGalaxy/Player/List/PlayerExtList.cs
+++ b/MCGalaxy/Player/List/PlayerExtList.cs
@@ -23,7 +23,7 @@ using System.Text;
namespace MCGalaxy {
/// Represents a list of player names and simple associated data. Case insensitive. Thread safe.
- public sealed class PlayerExtList {
+ public class PlayerExtList {
public char Separator = ' ';
public string Path;
diff --git a/MCGalaxy/Player/List/PlayerList.cs b/MCGalaxy/Player/List/PlayerList.cs
index f34ac8426..c13314f24 100644
--- a/MCGalaxy/Player/List/PlayerList.cs
+++ b/MCGalaxy/Player/List/PlayerList.cs
@@ -23,7 +23,7 @@ using System.Text;
namespace MCGalaxy {
/// Represents a list of player names. Case insensitive. Thread safe.
- public sealed class PlayerList {
+ public class PlayerList {
public string Path;
List names = new List();
@@ -37,27 +37,11 @@ namespace MCGalaxy {
lock (locker) return new List(names);
}
+ /// Returns number of names that are in this list.
public int Count { get { lock (locker) return names.Count; } }
- public void Add(string name) {
- lock (locker) names.Add(name);
- }
-
- public bool Remove(string name) {
- lock (locker) return names.CaselessRemove(name);
- }
-
- /// Returns whether the given name is caselessly in this list.
- public bool Contains(string name) {
- lock (locker) return names.CaselessContains(name);
- }
-
- /// Removes all names from this list.
- public void Clear() {
- lock (locker) names.Clear();
- }
-
- public bool AddUnique(string name) {
+ /// Returns whether the given name was actually added to this list.
+ public bool Add(string name) {
lock (locker) {
int idx = names.CaselessIndexOf(name);
if (idx >= 0) return false;
@@ -66,8 +50,26 @@ namespace MCGalaxy {
}
return true;
}
+
+ /// Returns whether the given name was removed from this list.
+ public bool Remove(string name) {
+ lock (locker) return names.CaselessRemove(name);
+ }
+
+ /// Returns whether the given name is in this list.
+ public bool Contains(string name) {
+ lock (locker) return names.CaselessContains(name);
+ }
+
+ /// Removes all names from this list.
+ public void Clear() {
+ lock (locker) names.Clear();
+ }
+
+
+ [Obsolete("Use Add instead")]
+ public bool AddUnique(string name) { return Add(name); }
- // only used for NameConverter
internal int IndexOf(string name) {
lock (locker) return names.CaselessIndexOf(name);
}