mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
Combine /pass, /setpass, and /resetpass into one command.
This commit is contained in:
parent
5a0e96788f
commit
b0ee528cb3
@ -60,7 +60,7 @@ namespace MCGalaxy.Commands {
|
||||
BotsFile.UpdateBot(bot);
|
||||
return;
|
||||
} else if (ai == "kill") {
|
||||
if (!CheckExtraPerm(p)) { MessageNeedPerms(p, "can toggle a bot's killer instinct."); return; }
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, "can toggle a bot's killer instinct."); return; }
|
||||
bot.kill = !bot.kill;
|
||||
if (p != null) Chat.GlobalChatLevel(p, bot.ColoredName + "%S's kill instinct: " + bot.kill, false);
|
||||
Server.s.Log(bot.name + "'s kill instinct: " + bot.kill);
|
||||
|
@ -70,7 +70,7 @@ namespace MCGalaxy.Commands.CPE {
|
||||
if (p != null && who != null && who.group.Permission > p.group.Permission) {
|
||||
MessageTooHighRank(p, "change the model of", true); return;
|
||||
}
|
||||
if ((isBot || who != p) && !CheckExtraPerm(p)) { MessageNeedPerms(p, "can change the model of others."); return; }
|
||||
if ((isBot || who != p) && !CheckExtraPerm(p)) { MessageNeedExtra(p, "can change the model of others."); return; }
|
||||
|
||||
if (isBot) {
|
||||
bot.model = model;
|
||||
|
@ -61,7 +61,7 @@ namespace MCGalaxy.Commands.CPE {
|
||||
if (p != null && who != null && who.group.Permission > p.group.Permission) {
|
||||
MessageTooHighRank(p, "change the skin of", true); return;
|
||||
}
|
||||
if ((isBot || who != p) && !CheckExtraPerm(p)) { MessageNeedPerms(p, "can change the skin of others."); return; }
|
||||
if ((isBot || who != p) && !CheckExtraPerm(p)) { MessageNeedExtra(p, "can change the skin of others."); return; }
|
||||
if (skin[0] == '+')
|
||||
skin = "http://skins.minecraft.net/MinecraftSkins/" + skin.Substring(1) + ".png";
|
||||
|
||||
|
@ -105,7 +105,7 @@ namespace MCGalaxy.Commands {
|
||||
}
|
||||
|
||||
void HandleCreate(Player p, string[] parts) {
|
||||
if (!CheckExtraPerm(p, 1)) { MessageNeedPerms(p, "can create a chatroom.", 1); return; }
|
||||
if (!CheckExtraPerm(p, 1)) { MessageNeedExtra(p, "can create a chatroom.", 1); return; }
|
||||
if (parts.Length <= 1) {
|
||||
Player.Message(p, "You need to provide a new chatroom name.");
|
||||
return;
|
||||
@ -170,7 +170,7 @@ namespace MCGalaxy.Commands {
|
||||
}
|
||||
|
||||
void HandleSpy(Player p, string[] parts) {
|
||||
if (!CheckExtraPerm(p, 4)) { MessageNeedPerms(p, "can spy on a chatroom.", 4); return; }
|
||||
if (!CheckExtraPerm(p, 4)) { MessageNeedExtra(p, "can spy on a chatroom.", 4); return; }
|
||||
if (parts.Length <= 1) {
|
||||
Player.Message(p, "You need to provide a chatroom name to spy on.");
|
||||
return;
|
||||
@ -194,7 +194,7 @@ namespace MCGalaxy.Commands {
|
||||
}
|
||||
|
||||
void HandleForceJoin(Player p, string[] parts) {
|
||||
if (!CheckExtraPerm(p, 5)) { MessageNeedPerms(p, "can force players to join a chatroom.", 5); return; }
|
||||
if (!CheckExtraPerm(p, 5)) { MessageNeedExtra(p, "can force players to join a chatroom.", 5); return; }
|
||||
if (parts.Length <= 2) {
|
||||
Player.Message(p, "You need to provide a player name, then a chatroom name.");
|
||||
return;
|
||||
@ -223,7 +223,7 @@ namespace MCGalaxy.Commands {
|
||||
}
|
||||
|
||||
void HandleKick(Player p, string[] parts) {
|
||||
if (!CheckExtraPerm(p, 6)) { MessageNeedPerms(p, "can kick players from a chatroom.", 6); return; }
|
||||
if (!CheckExtraPerm(p, 6)) { MessageNeedExtra(p, "can kick players from a chatroom.", 6); return; }
|
||||
if (parts.Length <= 1) {
|
||||
Player.Message(p, "You need to provide a player name.");
|
||||
return;
|
||||
|
@ -50,7 +50,7 @@ namespace MCGalaxy.Commands {
|
||||
if (p != null && who != null && who.group.Permission > p.group.Permission) {
|
||||
MessageTooHighRank(p, "change the color of", true); return;
|
||||
}
|
||||
if ((isBot || who != p) && !CheckExtraPerm(p)) { MessageNeedPerms(p, "can change the color of others."); return; }
|
||||
if ((isBot || who != p) && !CheckExtraPerm(p)) { MessageNeedExtra(p, "can change the color of others."); return; }
|
||||
if (isBot) SetBotColor(p, pBot, args);
|
||||
else SetColor(p, who, args);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ namespace MCGalaxy.Commands {
|
||||
if (p != null && who != null && who.group.Permission > p.group.Permission) {
|
||||
MessageTooHighRank(p, "change the nick of", true); return;
|
||||
}
|
||||
if ((isBot || who != p) && !CheckExtraPerm(p)) { MessageNeedPerms(p, "can change the nick of others."); return; }
|
||||
if ((isBot || who != p) && !CheckExtraPerm(p)) { MessageNeedExtra(p, "can change the nick of others."); return; }
|
||||
if (isBot) SetBotNick(p, pBot, args);
|
||||
else SetNick(p, who, args);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ namespace MCGalaxy.Commands {
|
||||
if (p != null && who.group.Permission > p.group.Permission) {
|
||||
MessageTooHighRank(p, "change the title color of", true); return;
|
||||
}
|
||||
if (who != p && !CheckExtraPerm(p)) { MessageNeedPerms(p, "can change the title color of others."); return; }
|
||||
if (who != p && !CheckExtraPerm(p)) { MessageNeedExtra(p, "can change the title color of others."); return; }
|
||||
SetTColor(p, who, args);
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ namespace MCGalaxy.Commands {
|
||||
if (p != null && who.group.Permission > p.group.Permission) {
|
||||
MessageTooHighRank(p, "change the title of", true); return;
|
||||
}
|
||||
if (who != p && !CheckExtraPerm(p)) { MessageNeedPerms(p, "can change the title of others."); return; }
|
||||
if (who != p && !CheckExtraPerm(p)) { MessageNeedExtra(p, "can change the title of others."); return; }
|
||||
SetTitle(p, who, args);
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ namespace MCGalaxy {
|
||||
return p == null || (int)p.group.Permission >= CommandOtherPerms.GetPerm(this, num);
|
||||
}
|
||||
|
||||
protected void MessageNeedPerms(Player p, string action, int num = 1) {
|
||||
protected void MessageNeedExtra(Player p, string action, int num = 1) {
|
||||
int perm = CommandOtherPerms.GetPerm(this, num);
|
||||
MessageNeedMinPerm(p, action, perm);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace MCGalaxy.Commands {
|
||||
}
|
||||
|
||||
void HandleSetup(Player p, string message, string[] args) {
|
||||
if (!CheckExtraPerm(p)) { MessageNeedPerms(p, "can setup the economy."); return; }
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, "can setup the economy."); return; }
|
||||
|
||||
switch (args[0].ToLower()) {
|
||||
case "apply":
|
||||
|
@ -117,7 +117,7 @@ namespace MCGalaxy.Commands {
|
||||
}
|
||||
|
||||
void HandleCreate(Player p, string[] args) {
|
||||
if (!CheckExtraPerm(p)) { MessageNeedPerms(p, "can create a team.", 1); return; }
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, "can create a team.", 1); return; }
|
||||
Team team = p.Game.Team;
|
||||
if (team != null) { Player.Message(p, "You need to leave your current team before you can create one."); return; }
|
||||
if (args.Length == 1) {
|
||||
|
@ -39,7 +39,7 @@ namespace MCGalaxy.Commands
|
||||
|
||||
Player who = p;
|
||||
if (message != "") {
|
||||
if (!CheckExtraPerm(p)) { MessageNeedPerms(p, "can send the rules to a player."); return; }
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, "can send the rules to a player."); return; }
|
||||
who = PlayerInfo.FindMatches(p, message);
|
||||
if (who == null) return;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ namespace MCGalaxy.Commands
|
||||
}
|
||||
bool messageOps = true;
|
||||
if (message.CaselessEq("silent")) {
|
||||
if (!CheckExtraPerm(p)) { MessageNeedPerms(p, "can hide silently"); return; }
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, "can hide silently"); return; }
|
||||
messageOps = false;
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ namespace MCGalaxy.Commands {
|
||||
}
|
||||
|
||||
void HandleView(Player p) {
|
||||
if (!CheckExtraPerm(p, 1)) { MessageNeedPerms(p, "can view the review queue.", 1); return; }
|
||||
if (!CheckExtraPerm(p, 1)) { MessageNeedExtra(p, "can view the review queue.", 1); return; }
|
||||
|
||||
if (Server.reviewlist.Count == 0) {
|
||||
Player.Message(p, "There are no players in the review queue."); return;
|
||||
@ -126,7 +126,7 @@ namespace MCGalaxy.Commands {
|
||||
|
||||
void HandleNext(Player p) {
|
||||
if (p == null) { Player.Message(p, "Console cannot answer the review queue."); return; }
|
||||
if (!CheckExtraPerm(p, 2)) { MessageNeedPerms(p, "can teleport to next in the review queue.", 2); return; }
|
||||
if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, "can teleport to next in the review queue.", 2); return; }
|
||||
if (Server.reviewlist.Count == 0) {
|
||||
Player.Message(p, "There are no players in the review queue."); return;
|
||||
}
|
||||
@ -150,7 +150,7 @@ namespace MCGalaxy.Commands {
|
||||
}
|
||||
|
||||
void HandleClear(Player p) {
|
||||
if (!CheckExtraPerm(p, 3)) { MessageNeedPerms(p, "can clear the review queue.", 3); return; }
|
||||
if (!CheckExtraPerm(p, 3)) { MessageNeedExtra(p, "can clear the review queue.", 3); return; }
|
||||
Server.reviewlist.Clear();
|
||||
Player.Message(p, "The review queue has been cleared");
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ namespace MCGalaxy.Commands {
|
||||
Player.Message(p, "Place a block where you would like to check for zones.");
|
||||
p.MakeSelection(1, null, CheckZone);
|
||||
} else if (args[0].CaselessEq("add")) {
|
||||
if (!CheckExtraPerm(p, 3)) { MessageNeedPerms(p, "can create zones.", 3); return; }
|
||||
if (!CheckExtraPerm(p, 3)) { MessageNeedExtra(p, "can create zones.", 3); return; }
|
||||
if (args.Length == 1) { Help(p); return; }
|
||||
|
||||
if (Group.Find(args[1]) != null)
|
||||
@ -49,7 +49,7 @@ namespace MCGalaxy.Commands {
|
||||
Player.Message(p, "Zone for: &b" + args[1] + ".");
|
||||
p.MakeSelection(2, args[1], AddZone);
|
||||
} else if (args[0].CaselessEq("del") && args.Length > 1 && args[1].CaselessEq("all")) {
|
||||
if (!CheckExtraPerm(p, 2)) { MessageNeedPerms(p, "can delete all zones.", 2); return; }
|
||||
if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, "can delete all zones.", 2); return; }
|
||||
|
||||
for (int i = 0; i < p.level.ZoneList.Count; i++) {
|
||||
Level.Zone Zn = p.level.ZoneList[i];
|
||||
@ -60,7 +60,7 @@ namespace MCGalaxy.Commands {
|
||||
i--;
|
||||
}
|
||||
} else if (args[0].CaselessEq("del")) {
|
||||
if (!CheckExtraPerm(p, 1)) { MessageNeedPerms(p, "can delete zones.", 1); return; }
|
||||
if (!CheckExtraPerm(p, 1)) { MessageNeedExtra(p, "can delete zones.", 1); return; }
|
||||
|
||||
if (p.canBuild) { //Checks if player can build there
|
||||
Player.Message(p, "Place a block where you would like to delete a zone.");
|
||||
|
@ -35,7 +35,7 @@ namespace MCGalaxy.Commands.World {
|
||||
}
|
||||
PlayerActions.ChangeMap(p, Server.mainLevel.name);
|
||||
} else {
|
||||
if (!CheckExtraPerm(p)) { MessageNeedPerms(p, "change the main level"); return; }
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, "change the main level"); return; }
|
||||
if (!ValidName(p, message, "level")) return;
|
||||
|
||||
string map = LevelInfo.FindMapMatches(p, message);
|
||||
|
@ -72,7 +72,7 @@ namespace MCGalaxy.Commands.World {
|
||||
if (lvl == null || message.Split(' ')[0].ToLower() == "ps" || message.Split(' ')[0].ToLower() == "rp") lvl = p.level;
|
||||
else message = message.Substring(message.IndexOf(' ') + 1);
|
||||
}
|
||||
if (!CheckExtraPerm(p)) { MessageNeedPerms(p, "can set map options."); return; }
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, "can set map options."); return; }
|
||||
|
||||
string foundStart;
|
||||
if (message.IndexOf(' ') == -1) foundStart = message.ToLower();
|
||||
|
@ -60,7 +60,7 @@ namespace MCGalaxy.Commands {
|
||||
SuperRequiresArgs(name + " all", p, "level name"); return false;
|
||||
}
|
||||
|
||||
if (!CheckExtraPerm(p)) { MessageNeedPerms(p, "can reload all players in a map."); return false; }
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, "can reload all players in a map."); return false; }
|
||||
Player[] players = PlayerInfo.Online.Items;
|
||||
foreach (Player who in players) {
|
||||
if (who.level == lvl)
|
||||
|
@ -146,13 +146,13 @@ namespace MCGalaxy.Commands.Building {
|
||||
}
|
||||
|
||||
bool CheckUndoPerms(Player p, Group grp) {
|
||||
if (!CheckExtraPerm(p)) { MessageNeedPerms(p, "can undo other players."); return false; }
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, "can undo other players."); return false; }
|
||||
if (grp.Permission > p.group.Permission) { MessageTooHighRank(p, "undo", true); return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
void UndoLevelPhysics(Player p, long seconds) {
|
||||
if (!CheckExtraPerm(p, 2)) { MessageNeedPerms(p, "can undo physics.", 2); return; }
|
||||
if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, "can undo physics.", 2); return; }
|
||||
if (p != null && !p.group.CanExecute("physics")) {
|
||||
Player.Message(p, "You can only undo physics if you can use /physics."); return;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
|
||||
Copyright 2012 MCForge
|
||||
Written by Jack1312
|
||||
Copyright 2011-2012 MCForge
|
||||
|
||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||
@ -16,7 +16,7 @@
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
|
||||
*/
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
using MCGalaxy.Util;
|
||||
@ -28,79 +28,91 @@ namespace MCGalaxy.Commands {
|
||||
public override string type { get { return CommandTypes.Other; } }
|
||||
public override bool museumUsable { get { return true; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||
|
||||
public CmdPass() { }
|
||||
|
||||
public override void Use(Player p, string message)
|
||||
{
|
||||
|
||||
if (p.group.Permission < Server.verifyadminsrank)
|
||||
{
|
||||
Player.Message(p, "You do not have the &crequired rank to use this command!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Server.verifyadmins)
|
||||
{
|
||||
Player.Message(p, "Verification of admins is &cdisabled!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!p.adminpen)
|
||||
{
|
||||
Player.Message(p, "You have &calready verified.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (p.passtries >= 3)
|
||||
{
|
||||
p.Kick("Did you really think you could keep on guessing?");
|
||||
return;
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(message.Trim()))
|
||||
{
|
||||
Help(p);
|
||||
return;
|
||||
}
|
||||
|
||||
int number = message.Split(' ').Length;
|
||||
|
||||
if (number > 1)
|
||||
{
|
||||
Player.Message(p, "Your password must be &cone %Sword!");
|
||||
return;
|
||||
public override CommandAlias[] Aliases {
|
||||
get { return new[] { new CommandAlias("setpass", "set"), new CommandAlias("resetpass", "reset") }; }
|
||||
}
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (!Directory.Exists("extra/passwords"))
|
||||
{
|
||||
Player.Message(p, "You have not &cset a password, %Suse &a/setpass [Password] &cto set one!");
|
||||
return;
|
||||
Directory.CreateDirectory("extra/passwords");
|
||||
if (p.group.Permission < Server.verifyadminsrank) {
|
||||
MessageNeedMinPerm(p, "verify or set a password", (int)Server.verifyadminsrank); return;
|
||||
}
|
||||
if (!Server.verifyadmins) { Player.Message(p, "Admin verficiation is not currently enabled."); return; }
|
||||
if (message == "") { Help(p); return; }
|
||||
|
||||
string[] args = message.SplitSpaces(2);
|
||||
if (args.Length == 2 && args[1].CaselessEq("set"))
|
||||
SetPassword(p, args[1]);
|
||||
else if (args.Length == 2 && args[1].CaselessEq("reset"))
|
||||
ResetPassword(p, args[1]);
|
||||
else
|
||||
VerifyPassword(p, message);
|
||||
}
|
||||
|
||||
if (!File.Exists("extra/passwords/" + p.name + ".dat"))
|
||||
{
|
||||
Player.Message(p, "You have not &cset a password, %Suse &a/setpass [Password] &cto set one!");
|
||||
return;
|
||||
void VerifyPassword(Player p, string message) {
|
||||
if (!p.adminpen) { Player.Message(p, "You are &calready verified."); return; }
|
||||
if (p.passtries >= 3) { p.Kick("Did you really think you could keep on guessing?"); return; }
|
||||
|
||||
if (message.IndexOf(' ') >= 0) { Player.Message(p, "Your password must be &cone %Sword!"); return; }
|
||||
if (!File.Exists("extra/passwords/" + p.name + ".dat")) {
|
||||
Player.Message(p, "You have not &cset a password, %Suse &a/setpass [Password] &cto set one!"); return;
|
||||
}
|
||||
|
||||
if (PasswordHasher.MatchesPass(p.name, message))
|
||||
{
|
||||
Player.Message(p, "Thank you, " + p.color + p.name + "%S! You have now &averified %Sand have &aaccess to admin commands and features!");
|
||||
if (PasswordHasher.MatchesPass(p.name, message)) {
|
||||
Player.Message(p, "You are now &averified %Sand have &aaccess to admin commands and features.");
|
||||
p.adminpen = false;
|
||||
} else {
|
||||
p.passtries++;
|
||||
Player.Message(p, "&cWrong Password. %SRemember your password is &ccase sensitive.");
|
||||
Player.Message(p, "Forgot your password? %SContact the owner so they can reset it.");
|
||||
}
|
||||
}
|
||||
|
||||
void SetPassword(Player p, string message) {
|
||||
if (p.adminpen && File.Exists("extra/passwords/" + p.name + ".dat")) {
|
||||
Player.Message(p, "&cYou already have a password set. %SYou &ccannot change %Sit unless &cyou verify it with &a/pass [Password]. " +
|
||||
"%SIf you have &cforgotten %Syour password, contact &c" + Server.server_owner + " %Sand they can &creset it!");
|
||||
return;
|
||||
}
|
||||
if (message.IndexOf(' ') >= 0) { Player.Message(p, "Your password must be one word!"); return; }
|
||||
|
||||
p.passtries++;
|
||||
Player.Message(p, "&cWrong Password. %SRemember your password is &ccase sensitive!");
|
||||
Player.Message(p, "Forgot your password? %SContact the owner so they can reset it!");
|
||||
PasswordHasher.StoreHash(p.name, message);
|
||||
Player.Message(p, "Your password has &asuccessfully &abeen set to:");
|
||||
Player.Message(p, "&c" + message);
|
||||
}
|
||||
|
||||
public override void Help(Player p)
|
||||
{
|
||||
Player.Message(p, "/pass [Password] - If you are an admin, use this command to verify");
|
||||
Player.Message(p, "your login. You will need to use this to be given access to commands");
|
||||
Player.Message(p, "Note: If you do not have a password, use /setpass [Password]");
|
||||
void ResetPassword(Player p, string message) {
|
||||
if (message == "") { Help(p); return; }
|
||||
Player who = PlayerInfo.FindMatches(p, message);
|
||||
if (who == null) return;
|
||||
if (p != null && p.adminpen) {
|
||||
Player.Message(p, "&cYou must first verify with %T/pass [Password]"); return;
|
||||
}
|
||||
|
||||
if (p != null && (Server.server_owner == "Notch" || Server.server_owner == "")) {
|
||||
Player.Message(p, "Please tell the server owner to set the 'Server Owner' property.");
|
||||
return;
|
||||
}
|
||||
if (p != null && Server.server_owner != p.name) {
|
||||
Player.Message(p, "Only console and the server owner may reset passwords."); return;
|
||||
}
|
||||
|
||||
if (!File.Exists("extra/passwords/" + who.name + ".dat")) {
|
||||
Player.Message(p, "That player does not have a password."); return;
|
||||
}
|
||||
File.Delete("extra/passwords/" + who.name + ".dat");
|
||||
Player.Message(p, "Password sucessfully removed for " + who.ColoredName + "%S.");
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "%T/pass reset [Player] %H- Resets the password for that player");
|
||||
Player.Message(p, "%H Note: Can only be used by console and the server owner.");
|
||||
Player.Message(p, "%T/pass set [Password] %H- Sets your password to [password]");
|
||||
Player.Message(p, "%H Note: &cDo NOT set this as your Minecraft password!");
|
||||
Player.Message(p, "%T/pass [Password]");
|
||||
Player.Message(p, "%HIf you are an admin, use this command to verify your login. " +
|
||||
"You will need to be verified to be able to use commands.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ namespace MCGalaxy.Commands {
|
||||
}
|
||||
|
||||
void HandleList(Player p, string[] args) {
|
||||
if (!CheckExtraPerm(p)) { MessageNeedPerms(p, "can see the list of reports."); return; }
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, "can see the list of reports."); return; }
|
||||
|
||||
bool foundone = false;
|
||||
string[] files = Directory.GetFiles("extra/reported", "*.txt");
|
||||
@ -81,7 +81,7 @@ namespace MCGalaxy.Commands {
|
||||
if (args.Length != 2) {
|
||||
Player.Message(p, "You need to provide a player's name."); return;
|
||||
}
|
||||
if (!CheckExtraPerm(p)) { MessageNeedPerms(p, "can view the details of a report."); return; }
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, "can view the details of a report."); return; }
|
||||
if (!ValidName(p, args[1], "player")) return;
|
||||
|
||||
if (!File.Exists("extra/reported/" + args[1] + ".txt")) {
|
||||
@ -95,7 +95,7 @@ namespace MCGalaxy.Commands {
|
||||
if (args.Length != 2) {
|
||||
Player.Message(p, "You need to provide a player's name."); return;
|
||||
}
|
||||
if (!CheckExtraPerm(p)) { MessageNeedPerms(p, "can delete reports."); return; }
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, "can delete reports."); return; }
|
||||
if (!ValidName(p, args[1], "player")) return;
|
||||
|
||||
if (!File.Exists("extra/reported/" + args[1] + ".txt")) {
|
||||
@ -113,7 +113,7 @@ namespace MCGalaxy.Commands {
|
||||
}
|
||||
|
||||
void HandleClear(Player p, string[] args) {
|
||||
if (!CheckExtraPerm(p)) { MessageNeedPerms(p, "can clear the list of reports."); return; }
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, "can clear the list of reports."); return; }
|
||||
if (!Directory.Exists("extra/reportedbackups"))
|
||||
Directory.CreateDirectory("extra/reportedbackups");
|
||||
string[] files = Directory.GetFiles("extra/reported", "*.txt");
|
||||
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
Written by Jack1312
|
||||
|
||||
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.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace MCGalaxy.Commands {
|
||||
|
||||
public class CmdResetPass : Command {
|
||||
public override string name { get { return "resetpass"; } }
|
||||
public override string shortcut { get { return ""; } }
|
||||
public override string type { get { return CommandTypes.Other; } }
|
||||
public override bool museumUsable { get { return true; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Admin; } }
|
||||
public CmdResetPass() { }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (message == "") { Help(p); return; }
|
||||
Player who = PlayerInfo.FindMatches(p, message);
|
||||
if (who == null) return;
|
||||
|
||||
if (p != null && (Server.server_owner == "Notch" || Server.server_owner == "")) {
|
||||
Player.Message(p, "Please tell the server owner to change the 'Server Owner' property.");
|
||||
return;
|
||||
}
|
||||
if (p != null && Server.server_owner != p.name) {
|
||||
Player.Message(p, "You're not the server owner!"); return;
|
||||
}
|
||||
|
||||
if (!File.Exists("extra/passwords/" + who.name + ".dat")) {
|
||||
Player.Message(p, "The player you specified does not have a password!"); return;
|
||||
}
|
||||
File.Delete("extra/passwords/" + who.name + ".dat");
|
||||
Player.Message(p, "The admin password has sucessfully been removed for " + who.ColoredName + "!");
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "%T/resetpass [Player]");
|
||||
Player.Message(p, "%HResets the password for the specified player.");
|
||||
Player.Message(p, "%HNote: Can only be used by console and the server owner.");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
/*
|
||||
|
||||
Copyright 2012 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 MCGalaxy.Util;
|
||||
|
||||
namespace MCGalaxy.Commands {
|
||||
public sealed class CmdSetPass : Command {
|
||||
public override string name { get { return "setpass"; } }
|
||||
public override string shortcut { get { return ""; } }
|
||||
public override string type { get { return CommandTypes.Other; } }
|
||||
public override bool museumUsable { get { return true; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||
public CmdSetPass() { }
|
||||
|
||||
public override void Use(Player p, string message)
|
||||
{
|
||||
if (!Directory.Exists("extra/passwords"))
|
||||
Directory.CreateDirectory("extra/passwords");
|
||||
if (p.group.Permission < Server.verifyadminsrank)
|
||||
{
|
||||
Player.Message(p, "You do not have the &crequired rank %Sto use this command!");
|
||||
return;
|
||||
}
|
||||
if (!Server.verifyadmins)
|
||||
{
|
||||
Player.Message(p, "Verification of admins is &cdisabled!");
|
||||
return;
|
||||
}
|
||||
if (p.adminpen)
|
||||
{
|
||||
if (File.Exists("extra/passwords/" + p.name + ".dat"))
|
||||
{
|
||||
Player.Message(p, "&cYou already have a password set. %SYou &ccannot change %Sit unless &cyou verify it with &a/pass [Password]. " +
|
||||
"%SIf you have &cforgotten %Syour password, contact &c" + Server.server_owner + " %Sand they can &creset it!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (String.IsNullOrEmpty(message.Trim()))
|
||||
{
|
||||
Help(p);
|
||||
return;
|
||||
|
||||
}
|
||||
int number = message.Split(' ').Length;
|
||||
if (number > 1)
|
||||
{
|
||||
Player.Message(p, "Your password must be one word!");
|
||||
return;
|
||||
}
|
||||
PasswordHasher.StoreHash(p.name, message);
|
||||
Player.Message(p, "Your password has &asuccessfully &abeen set to:");
|
||||
Player.Message(p, "&c" + message);
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "%T/setpass [Password]");
|
||||
Player.Message(p, "%HSets your admin password to [password].");
|
||||
Player.Message(p, "%HNote: &cDo NOT set this as your Minecraft password!");
|
||||
}
|
||||
}
|
||||
}
|
@ -56,7 +56,7 @@ namespace MCGalaxy.Commands
|
||||
p.modeType = Block.bigtnt;
|
||||
Player.Message(p, "TNT (Big) mode is now &aON%S.");
|
||||
} else {
|
||||
MessageNeedPerms(p, "can use big TNT mode.", 1); return;
|
||||
MessageNeedExtra(p, "can use big TNT mode.", 1); return;
|
||||
}
|
||||
} else if (message.ToLower() == "nuke") {
|
||||
if (!p.allowTnt) {
|
||||
@ -67,20 +67,20 @@ namespace MCGalaxy.Commands
|
||||
p.modeType = Block.nuketnt;
|
||||
Player.Message(p, "TNT (Nuke) mode is now &aON%S.");
|
||||
} else {
|
||||
MessageNeedPerms(p, "can use nuke TNT mode.", 3); return;
|
||||
MessageNeedExtra(p, "can use nuke TNT mode.", 3); return;
|
||||
}
|
||||
} else if (message.ToLower() == "allow") {
|
||||
if (CheckExtraPerm(p, 2)) {
|
||||
p.allowTnt = true; Player.Message(p, "&cTnt usage has now been enabled!");
|
||||
} else {
|
||||
MessageNeedPerms(p, "can allow TNT usage.", 2); return;
|
||||
MessageNeedExtra(p, "can allow TNT usage.", 2); return;
|
||||
}
|
||||
return;
|
||||
} else if (message.ToLower() == "disallow") {
|
||||
if (CheckExtraPerm(p, 2)) {
|
||||
p.allowTnt = false; Player.Message(p, "&cTnt usage has now been disabled!");
|
||||
} else {
|
||||
MessageNeedPerms(p, "can disallow TNT usage.", 2); return;
|
||||
MessageNeedExtra(p, "can disallow TNT usage.", 2); return;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
|
@ -86,7 +86,7 @@ namespace MCGalaxy.Commands
|
||||
}
|
||||
}
|
||||
}
|
||||
else { MessageNeedPerms(p, "can create warps.", 1); return; }
|
||||
else { MessageNeedExtra(p, "can create warps.", 1); return; }
|
||||
}
|
||||
|
||||
if (par0 == "delete" || par0 == "remove" || par0 == "d" || par0 == "r")
|
||||
@ -111,7 +111,7 @@ namespace MCGalaxy.Commands
|
||||
}
|
||||
}
|
||||
}
|
||||
else { MessageNeedPerms(p, "can delete warps.", 2); return; }
|
||||
else { MessageNeedExtra(p, "can delete warps.", 2); return; }
|
||||
}
|
||||
|
||||
if (par0 == "move" || par0 == "change" || par0 == "edit" || par0 == "m" || par0 == "e")
|
||||
@ -137,7 +137,7 @@ namespace MCGalaxy.Commands
|
||||
}
|
||||
}
|
||||
}
|
||||
else { MessageNeedPerms(p, "can move warps.", 3); return; }
|
||||
else { MessageNeedExtra(p, "can move warps.", 3); return; }
|
||||
}
|
||||
|
||||
else
|
||||
|
@ -346,11 +346,9 @@
|
||||
<Compile Include="Commands\other\CmdPass.cs" />
|
||||
<Compile Include="Commands\other\CmdRepeat.cs" />
|
||||
<Compile Include="Commands\other\CmdReport.cs" />
|
||||
<Compile Include="Commands\other\CmdResetPass.cs" />
|
||||
<Compile Include="Commands\other\CmdRide.cs" />
|
||||
<Compile Include="Commands\other\CmdSendCmd.cs" />
|
||||
<Compile Include="Commands\other\CmdServer.cs" />
|
||||
<Compile Include="Commands\other\CmdSetPass.cs" />
|
||||
<Compile Include="Commands\other\CmdSummon.cs" />
|
||||
<Compile Include="Commands\other\CmdTimer.cs" />
|
||||
<Compile Include="Commands\other\CmdTnt.cs" />
|
||||
|
@ -62,8 +62,8 @@ namespace MCGalaxy {
|
||||
|
||||
if ( !canBuild ) { RevertBlock(x, y, z); return; }
|
||||
|
||||
if ( Server.verifyadmins && adminpen ) {
|
||||
SendMessage("&cYou must use &a/pass [Password]&c to verify!");
|
||||
if (Server.verifyadmins && adminpen) {
|
||||
SendMessage("&cYou must first verify with %T/pass [Password]");
|
||||
RevertBlock(x, y, z); return;
|
||||
}
|
||||
|
||||
@ -1235,8 +1235,8 @@ return;
|
||||
if (jailed) {
|
||||
SendMessage("You cannot use any commands while jailed."); return false;
|
||||
}
|
||||
if (Server.verifyadmins && adminpen && !(cmd == "pass" || cmd == "setpass")) {
|
||||
SendMessage("&cYou must use &a/pass [Password]&c to verify!"); return false;
|
||||
if (Server.verifyadmins && adminpen && cmd != "pass") {
|
||||
SendMessage("&cYou must verify first with %T/pass [Password]"); return false;
|
||||
}
|
||||
|
||||
//DO NOT REMOVE THE TWO COMMANDS BELOW, /PONY AND /RAINBOWDASHLIKESCOOLTHINGS. -EricKilla
|
||||
@ -1309,14 +1309,11 @@ return;
|
||||
|
||||
bool UseCommand(Command command, string message) {
|
||||
string cmd = command.name;
|
||||
if (!(cmd == "repeat" || cmd == "pass" || cmd == "setpass")) {
|
||||
if (cmd != "repeat" && cmd != "pass") {
|
||||
lastCMD = cmd + " " + message;
|
||||
lastCmdTime = DateTime.Now;
|
||||
}
|
||||
|
||||
if (!(cmd == "pass" || cmd == "setpass")) {
|
||||
Server.s.CommandUsed(name + " used /" + cmd + " " + message);
|
||||
}
|
||||
if (cmd != "pass") Server.s.CommandUsed(name + " used /" + cmd + " " + message);
|
||||
|
||||
try { //opstats patch (since 5.5.11)
|
||||
if (Server.opstats.Contains(cmd) || (cmd == "review" && message.ToLower() == "next" && Server.reviewlist.Count > 0)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user