diff --git a/MCGalaxy/Commands/Moderation/CmdVoteKick.cs b/MCGalaxy/Commands/Moderation/CmdVoteKick.cs deleted file mode 100644 index 7374f4456..000000000 --- a/MCGalaxy/Commands/Moderation/CmdVoteKick.cs +++ /dev/null @@ -1,91 +0,0 @@ -/* - Copyright 2011 MCForge - - 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; -using MCGalaxy.Commands.Chatting; -using MCGalaxy.Tasks; - -namespace MCGalaxy.Commands.Moderation { - public sealed class CmdVoteKick : Command { - public override string name { get { return "VoteKick"; } } - public override string type { get { return CommandTypes.Moderation; } } - public override LevelPermission defaultRank { get { return LevelPermission.Operator; } } - public override bool SuperUseable { get { return false; } } - - public override void Use(Player p, string message) { - if (message.Length == 0 || message.IndexOf(' ') != -1) { Help(p); return; } - if (!MessageCmd.CanSpeak(p, name)) return; - - if (Server.voteKickInProgress) { Player.Message(p, "Please wait for the current vote to finish!"); return; } - - Player who = PlayerInfo.FindMatches(p, message); - if (who == null) return; - - if (who.Rank >= p.Rank) { - Chat.MessageGlobal(p, p.ColoredName + " %Stried to votekick " + who.ColoredName + " %Sbut failed!", false); - return; - } - - Chat.MessageOps(p.ColoredName + " %Sused &a/votekick"); - Chat.MessageGlobal("&9A vote to kick {0} %Shas been called!", who.ColoredName); - Chat.MessageGlobal("&9Type &aY %Sor &cN %Sto vote."); - - // 1/3rd of the players must vote or nothing happens - // Keep it at 0 to disable min number of votes - Server.voteKickVotesNeeded = 3; //(int)(PlayerInfo.players.Count / 3) + 1; - Server.voteKickInProgress = true; - Server.MainScheduler.QueueOnce(VoteTimerCallback, who.name, TimeSpan.FromSeconds(30)); - } - - void VoteTimerCallback(SchedulerTask task) { - Server.voteKickInProgress = false; - int votesYes = 0, votesNo = 0; - Player[] players = PlayerInfo.Online.Items; - foreach (Player pl in players) { - if (pl.voteKickChoice == VoteKickChoice.Yes) votesYes++; - if (pl.voteKickChoice == VoteKickChoice.No) votesNo++; - pl.voteKickChoice = VoteKickChoice.NotYetVoted; - } - - string name = (string)task.State; - Player who = PlayerInfo.FindExact(name); - if (who == null) { - Chat.MessageGlobal("{0} was not kicked, as they already left the server.", name); return; - } - - int netVotesYes = votesYes - votesNo; - // Should we also send this to players? - Chat.MessageOps("Vote Ended. Results: &aY: " + votesYes + " &cN: " + votesNo); - Logger.Log(LogType.UserActivity, "VoteKick results for {0}: {1} yes and {2} no votes.", - who.DisplayName, votesYes, votesNo); - - if (votesYes + votesNo < Server.voteKickVotesNeeded) { - Chat.MessageGlobal("Not enough votes were made. {0} %Sshall remain!", who.ColoredName); - } else if (netVotesYes > 0) { - Chat.MessageGlobal("The people have spoken, {0} %Sis gone!", who.ColoredName); - who.Kick("Vote-Kick: The people have spoken!"); - } else { - Chat.MessageGlobal("{0} %Sshall remain!", who.ColoredName); - } - } - - public override void Help(Player p) { - Player.Message(p, "%T/VoteKick [player]"); - Player.Message(p, "%HCalls a 30sec vote to kick [player]"); - } - } -} diff --git a/MCGalaxy/MCGalaxy_.csproj b/MCGalaxy/MCGalaxy_.csproj index ece279845..de1507fbd 100644 --- a/MCGalaxy/MCGalaxy_.csproj +++ b/MCGalaxy/MCGalaxy_.csproj @@ -322,7 +322,6 @@ - diff --git a/MCGalaxy/Player/Player.Fields.cs b/MCGalaxy/Player/Player.Fields.cs index ee2b229dd..e140a51e4 100644 --- a/MCGalaxy/Player/Player.Fields.cs +++ b/MCGalaxy/Player/Player.Fields.cs @@ -26,8 +26,6 @@ using BlockID = System.UInt16; namespace MCGalaxy { - public enum VoteKickChoice { NotYetVoted, Yes, No } - public partial class Player : IDisposable { public static VolatileArray pending = new VolatileArray(false); @@ -205,9 +203,6 @@ namespace MCGalaxy { public string summonedMap; internal Position tempPos; - // CmdVoteKick - public VoteKickChoice voteKickChoice = VoteKickChoice.NotYetVoted; - // Extra storage for custom commands public ExtrasCollection Extras = new ExtrasCollection(); diff --git a/MCGalaxy/Player/Player.Handlers.cs b/MCGalaxy/Player/Player.Handlers.cs index 28ef352a7..337408f35 100644 --- a/MCGalaxy/Player/Player.Handlers.cs +++ b/MCGalaxy/Player/Player.Handlers.cs @@ -618,18 +618,6 @@ namespace MCGalaxy { } bool IsHandledMessage(string text) { - if (Server.voteKickInProgress && text.Length == 1) { - if (text.CaselessEq("y")) { - voteKickChoice = VoteKickChoice.Yes; - SendMessage("Thanks for voting!"); - return true; - } else if (text.CaselessEq("n")) { - voteKickChoice = VoteKickChoice.No; - SendMessage("Thanks for voting!"); - return true; - } - } - if (Server.voting) { string test = text.ToLower(); if (CheckVote(test, this, "y", "yes", ref Server.YesVotes) || diff --git a/MCGalaxy/Server/Server.Fields.cs b/MCGalaxy/Server/Server.Fields.cs index 41e1a17c4..736f20f7b 100644 --- a/MCGalaxy/Server/Server.Fields.cs +++ b/MCGalaxy/Server/Server.Fields.cs @@ -79,10 +79,6 @@ namespace MCGalaxy { public static string moneys; public static string IP; public static string RestartPath; - - //Global VoteKick In Progress Flag - public static bool voteKickInProgress = false; - public static int voteKickVotesNeeded = 0; // Extra storage for custom commands public static ExtrasCollection Extras = new ExtrasCollection();