mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-23 04:32:50 -04:00
Remove /deltemprank, /temprankinfo, /tempranklist and combine them into /temprank.
This commit is contained in:
parent
9205b4faf5
commit
08186c876c
@ -84,7 +84,6 @@ namespace MCGalaxy.Commands {
|
||||
new CommandKeywords((new CmdCuboid()), "box set area block");
|
||||
new CommandKeywords((new CmdDelete()), "del mode");
|
||||
new CommandKeywords((new CmdDeleteLvl()), "delete remove level lvl");
|
||||
new CommandKeywords((new CmdDelTempRank()), "del remove temp rank");
|
||||
new CommandKeywords((new CmdDemote()), "rank lower");
|
||||
new CommandKeywords((new CmdDevs()), "dev MCGalaxy forgeware forgecraft");
|
||||
new CommandKeywords((new CmdDisagree()), "no rules");
|
||||
@ -212,7 +211,7 @@ namespace MCGalaxy.Commands {
|
||||
new CommandKeywords((new CmdSay()), "speak broad cast");
|
||||
new CommandKeywords((new CmdSearch()), "find block command player rank");
|
||||
new CommandKeywords((new CmdSeen()), "saw last user");
|
||||
new CommandKeywords((new CmdServerReport()), "report server");
|
||||
new CommandKeywords((new CmdServerInfo()), "report server");
|
||||
new CommandKeywords((new CmdServer()), "setting option");
|
||||
new CommandKeywords((new CmdSetRank()), "rank set user player");
|
||||
new CommandKeywords((new CmdSetspawn()), "spawn set map level lvl");
|
||||
@ -228,8 +227,6 @@ namespace MCGalaxy.Commands {
|
||||
new CommandKeywords((new CmdTColor()), "title color set");
|
||||
new CommandKeywords((new CmdTempBan()), "temp ban");
|
||||
new CommandKeywords((new CmdTempRank()), "temp rank");
|
||||
new CommandKeywords((new CmdTempRankInfo()), "temp rank info");
|
||||
new CommandKeywords((new CmdTempRankList()), "temp rank list");
|
||||
new CommandKeywords((new CmdTime()), "server");
|
||||
new CommandKeywords((new CmdTimer()), "count down");
|
||||
new CommandKeywords((new CmdTitle()), "set user");
|
||||
|
@ -71,6 +71,7 @@ namespace MCGalaxy.Commands {
|
||||
Server.ProcessCounter = new PerformanceCounter("Process", "% Processor Time", proc.ProcessName);
|
||||
Server.ProcessCounter.BeginInit();
|
||||
Server.ProcessCounter.NextValue();
|
||||
System.Threading.Thread.Sleep(500);
|
||||
}
|
||||
|
||||
// Private Bytes because it is what the process has reserved for itself
|
||||
|
@ -1,55 +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 System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace MCGalaxy.Commands.Moderation {
|
||||
public sealed class CmdDelTempRank : Command {
|
||||
public override string name { get { return "deltemprank"; } }
|
||||
public override string shortcut { get { return "dtr"; } }
|
||||
public override string type { get { return CommandTypes.Moderation; } }
|
||||
public override bool museumUsable { get { return true; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||
const StringComparison comp = StringComparison.OrdinalIgnoreCase;
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
bool assigned = false;
|
||||
StringBuilder all = new StringBuilder();
|
||||
Player who = PlayerInfo.Find(message);
|
||||
|
||||
foreach (string line in File.ReadAllLines("text/tempranks.txt")) {
|
||||
if (!line.StartsWith(message, comp)) { all.AppendLine(line); continue; }
|
||||
|
||||
string[] parts = line.Split(' ');
|
||||
Group newgroup = Group.Find(parts[2]);
|
||||
Command.all.Find("setrank").Use(null, message + " " + newgroup.name + " temp rank unassigned");
|
||||
Player.Message(p, "&eTemp rank of &a" + message + "&e has been unassigned");
|
||||
if (who != null)
|
||||
Player.Message(who, "&eYour temp rank has been unassigned");
|
||||
assigned = true;
|
||||
}
|
||||
|
||||
if (!assigned) {
|
||||
Player.Message(p, "&a" + message + "&c has not been assigned a temp rank."); return;
|
||||
}
|
||||
File.WriteAllText("text/tempranks.txt", all.ToString());
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "/dtr <player> - Deletes that player's temp rank");
|
||||
}
|
||||
}
|
||||
}
|
@ -14,18 +14,42 @@ permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace MCGalaxy.Commands.Moderation {
|
||||
public sealed class CmdTempRank : Command {
|
||||
namespace MCGalaxy.Commands.Moderation {
|
||||
public sealed class CmdTempRank : Command {
|
||||
public override string name { get { return "temprank"; } }
|
||||
public override string shortcut { get { return "tr"; } }
|
||||
public override string type { get { return CommandTypes.Moderation; } }
|
||||
public override bool museumUsable { get { return true; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||
public override CommandAlias[] Aliases {
|
||||
get { return new[] { new CommandAlias("deltemprank", null, "delete"),
|
||||
new CommandAlias("dtr", null, "delete"), new CommandAlias("temprankinfo", null, "info"),
|
||||
new CommandAlias("trl", null, "list"), new CommandAlias("tempranklist", null, "list") }; }
|
||||
}
|
||||
const StringComparison comp = StringComparison.OrdinalIgnoreCase;
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
string[] args = message.Split(' ');
|
||||
if (args.Length < 3) { Help(p); return; }
|
||||
if (args.Length >= 3) {
|
||||
Assign(p, args);
|
||||
} else if (args.Length == 1) {
|
||||
if (args[0].CaselessEq("list")) {
|
||||
List(p);
|
||||
} else {
|
||||
Help(p);
|
||||
}
|
||||
} else if (args[1].CaselessEq("delete") || args[1].CaselessEq("remove")) {
|
||||
Delete(p, args[0]);
|
||||
} else if (args[1].CaselessEq("information") || args[1].CaselessEq("info")) {
|
||||
Info(p, args[0]);
|
||||
} else {
|
||||
Help(p);
|
||||
}
|
||||
}
|
||||
|
||||
static void Assign(Player p, string[] args) {
|
||||
string player = args[0], rank = args[1], period = args[2];
|
||||
Player who = PlayerInfo.Find(player);
|
||||
if (who == null) {
|
||||
@ -60,16 +84,85 @@ namespace MCGalaxy.Commands.Moderation {
|
||||
DateTime now = DateTime.Now;
|
||||
string assigner = p == null ? "Console" : p.name;
|
||||
string data = player + " " + rank + " " + pGroup.name + " " + period + " " + now.Minute + " " +
|
||||
now.Hour + " " + now.Day + " " + now.Month + " " + now.Year + " " + assigner;
|
||||
now.Hour + " " + now.Day + " " + now.Month + " " + now.Year + " " + assigner;
|
||||
Server.TempRanks.Append(data);
|
||||
|
||||
Command.all.Find("setrank").Use(null, who.name + " " + group.name + " assigning temp rank");
|
||||
Player.Message(p, "Temporary rank (" + rank + ") assigned succesfully to " + player + " for " + period + " hours");
|
||||
Player.Message(who, "Your Temporary rank (" + rank + ") is assigned succesfully for " + period + " hours");
|
||||
Command.all.Find("setrank").Use(null, player + " " + group.name + " assigning temp rank");
|
||||
Player.Message(p, "Temp ranked {0} to {1}%S for {2} hours", player, group.ColoredName, period);
|
||||
if (who != null)
|
||||
Player.Message(who, "You have been temp ranked to {0}%S for {1} hours", group.ColoredName, period);
|
||||
}
|
||||
|
||||
static void Delete(Player p, string name) {
|
||||
bool assigned = false;
|
||||
StringBuilder all = new StringBuilder();
|
||||
Player who = PlayerInfo.Find(name);
|
||||
|
||||
foreach (string line in File.ReadAllLines("text/tempranks.txt")) {
|
||||
if (!line.StartsWith(name, comp)) { all.AppendLine(line); continue; }
|
||||
|
||||
string[] parts = line.Split(' ');
|
||||
Group newgroup = Group.Find(parts[2]);
|
||||
Command.all.Find("setrank").Use(null, name + " " + newgroup.name + " temp rank unassigned");
|
||||
Player.Message(p, "&eTemp rank of &a{0}&e has been unassigned", name);
|
||||
if (who != null)
|
||||
Player.Message(who, "&eYour temp rank has been unassigned");
|
||||
assigned = true;
|
||||
}
|
||||
|
||||
if (!assigned) {
|
||||
Player.Message(p, "&a{0}&c has not been assigned a temp rank.", name); return;
|
||||
}
|
||||
File.WriteAllText("text/tempranks.txt", all.ToString());
|
||||
}
|
||||
|
||||
static void Info(Player p, string name) {
|
||||
foreach (string line in File.ReadAllLines("text/tempranks.txt")) {
|
||||
if (!line.StartsWith(name, comp)) continue;
|
||||
PrintTempRankInfo(p, line); return;
|
||||
}
|
||||
Player.Message(p, "&cPlayer &a{0}&chas not been assigned a temporary rank.", name);
|
||||
}
|
||||
|
||||
static void List(Player p) {
|
||||
int count = 0;
|
||||
foreach (string line in File.ReadAllLines("text/tempranks.txt")) {
|
||||
if (count == 0)
|
||||
Player.Message(p, "&ePlayers with a temporary rank assigned:");
|
||||
PrintTempRankInfo(p, line);
|
||||
count++;
|
||||
}
|
||||
if (count == 0)
|
||||
Player.Message(p, "&cThere are no players with a temporary rank assigned.");
|
||||
}
|
||||
|
||||
static void PrintTempRankInfo(Player p, string line) {
|
||||
string[] args = line.Split(' ');
|
||||
string temprank = args[1], oldrank = args[2], tempranker = args[9];
|
||||
int minutes = Convert.ToInt32(args[4]), hours = Convert.ToInt32(args[5]);
|
||||
int days = Convert.ToInt32(args[6]), months = Convert.ToInt32(args[7]);
|
||||
int years = Convert.ToInt32(args[8]);
|
||||
|
||||
int period = Convert.ToInt32(args[3]);
|
||||
Group oldGrp = Group.Find(oldrank), tempGrp = Group.Find(temprank);
|
||||
string oldCol = oldGrp == null ? "" : oldGrp.color;
|
||||
string tempCol = tempGrp == null ? "" : tempGrp.color;
|
||||
|
||||
DateTime assignmentDate = new DateTime(years, months, days, hours, minutes, 0);
|
||||
DateTime expireDate = assignmentDate.AddHours(Convert.ToDouble(period));
|
||||
Player.Message(p, "Temp rank information for {0}:", args[0]);
|
||||
Player.Message(p, " From {0} %Sto {1}%S, by {2} on &a{3}%S, expires on &a{4}",
|
||||
oldCol + oldrank, tempCol + temprank, tempranker,
|
||||
assignmentDate, expireDate);
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "/temprank <player> <rank> <period(hours)> - Sets a temporary rank for the specified player.");
|
||||
Player.Message(p, "%T/temprank <player> <rank> <period(hours)>");
|
||||
Player.Message(p, "%HSets a temporary rank for the specified player.");
|
||||
Player.Message(p, "%T/temprank <player> info");
|
||||
Player.Message(p, "%HLists information about the temp rank for the given player.");
|
||||
Player.Message(p, "%T/temprank <player> delete %H- Removes player's temp rank.");
|
||||
Player.Message(p, "%T/temprank list %H- Lists all current temp ranks.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,61 +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 System.IO;
|
||||
|
||||
namespace MCGalaxy.Commands.Moderation {
|
||||
public sealed class CmdTempRankInfo : Command {
|
||||
public override string name { get { return "temprankinfo"; } }
|
||||
public override string shortcut { get { return ""; } }
|
||||
public override string type { get { return CommandTypes.Moderation; } }
|
||||
public override bool museumUsable { get { return true; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (message == "") { Help(p); return; }
|
||||
|
||||
foreach (string line in File.ReadAllLines("text/tempranks.txt")) {
|
||||
if (!line.Contains(message)) continue;
|
||||
PrintTempRankInfo(p, line); return;
|
||||
}
|
||||
Player.Message(p, "&cPlayer &a" + message + "&chas not been assigned a temporary rank.");
|
||||
}
|
||||
|
||||
internal static void PrintTempRankInfo(Player p, string line) {
|
||||
string[] args = line.Split(' ');
|
||||
string temprank = args[1], oldrank = args[2], tempranker = args[9];
|
||||
int minutes = Convert.ToInt32(args[4]), hours = Convert.ToInt32(args[5]);
|
||||
int days = Convert.ToInt32(args[6]), months = Convert.ToInt32(args[7]);
|
||||
int years = Convert.ToInt32(args[8]);
|
||||
|
||||
int period = Convert.ToInt32(args[3]);
|
||||
Group oldGrp = Group.Find(oldrank), tempGrp = Group.Find(temprank);
|
||||
string oldCol = oldGrp == null ? "" : oldGrp.color;
|
||||
string tempCol = tempGrp == null ? "" : tempGrp.color;
|
||||
|
||||
DateTime assignmentDate = new DateTime(years, months, days, hours, minutes, 0);
|
||||
DateTime expireDate = assignmentDate.AddHours(Convert.ToDouble(period));
|
||||
Player.Message(p, "Temp rank information for " + args[0] + ":");
|
||||
Player.Message(p, "From " + oldCol + oldrank + " %Sto "
|
||||
+ tempCol + temprank + "%S, by " + tempranker);
|
||||
Player.Message(p, "Ranked on &a" + assignmentDate.ToString() +
|
||||
"%S, expires &a" + expireDate.ToString());
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "/tri <player> - Lists the info about the temp rank of the given player");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,43 +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.IO;
|
||||
|
||||
namespace MCGalaxy.Commands.Moderation {
|
||||
public sealed class CmdTempRankList : Command {
|
||||
public override string name { get { return "tempranklist"; } }
|
||||
public override string shortcut { get { return "trl"; } }
|
||||
public override string type { get { return CommandTypes.Moderation; } }
|
||||
public override bool museumUsable { get { return true; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (message != "") { Help(p); return; }
|
||||
|
||||
int count = 0;
|
||||
foreach (string line in File.ReadAllLines("text/tempranks.txt")) {
|
||||
if (count == 0)
|
||||
Player.Message(p, "&ePlayers with a temporary rank assigned:");
|
||||
CmdTempRankInfo.PrintTempRankInfo(p, line);
|
||||
count++;
|
||||
}
|
||||
if (count == 0)
|
||||
Player.Message(p, "&cThere are no players with a temporary rank assigned.");
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "/trl - Lists every user with a temporary rank");
|
||||
}
|
||||
}
|
||||
}
|
@ -276,7 +276,6 @@
|
||||
<Compile Include="Commands\Moderation\CmdBlockSpeed.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdCmdSet.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdCrashServer.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdDelTempRank.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdDemote.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdExplode.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdFollow.cs" />
|
||||
@ -312,8 +311,6 @@
|
||||
<Compile Include="Commands\Moderation\CmdShutdown.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdTempBan.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdTempRank.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdTempRankInfo.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdTempRankList.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdTrust.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdUnban.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdUnbanip.cs" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user