mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-26 06:43:25 -04:00
Simplify extra permission checking
This commit is contained in:
parent
8cd6f83dbd
commit
96185e14ac
@ -60,7 +60,7 @@ namespace MCGalaxy.Commands.Bots {
|
||||
UpdateBot(p, bot, "'s hunt instinct: " + bot.hunt);
|
||||
return;
|
||||
} else if (ai.CaselessEq("kill")) {
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; }
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
bot.kill = !bot.kill;
|
||||
UpdateBot(p, bot, "'s kill instinct: " + bot.kill);
|
||||
return;
|
||||
|
@ -37,7 +37,7 @@ namespace MCGalaxy.Commands.Chatting {
|
||||
Player.Message(p, p.Ping.Format());
|
||||
}
|
||||
} else {
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p); return; }
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
Player[] players = PlayerInfo.Online.Items;
|
||||
Player.Message(p, "Ping/latency list for online players:");
|
||||
|
||||
|
@ -107,7 +107,7 @@ namespace MCGalaxy.Commands.Chatting {
|
||||
}
|
||||
|
||||
void HandleCreate(Player p, string[] parts) {
|
||||
if (!CheckExtraPerm(p, 1)) { MessageNeedExtra(p, 1); return; }
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
if (parts.Length <= 1) {
|
||||
Player.Message(p, "You need to provide a new chatroom name."); return;
|
||||
}
|
||||
@ -127,8 +127,8 @@ namespace MCGalaxy.Commands.Chatting {
|
||||
return;
|
||||
}
|
||||
string room = parts[1];
|
||||
bool canDeleteForce = CheckExtraPerm(p, 3);
|
||||
bool canDelete = CheckExtraPerm(p, 2);
|
||||
bool canDeleteForce = HasExtraPerm(p, 3);
|
||||
bool canDelete = HasExtraPerm(p, 2);
|
||||
if (!canDelete && !canDeleteForce) {
|
||||
Player.Message(p, "You aren't a high enough rank to delete a chatroon.");
|
||||
return;
|
||||
@ -169,7 +169,7 @@ namespace MCGalaxy.Commands.Chatting {
|
||||
}
|
||||
|
||||
void HandleSpy(Player p, string[] parts) {
|
||||
if (!CheckExtraPerm(p, 4)) { MessageNeedExtra(p, 4); return; }
|
||||
if (!CheckExtraPerm(p, 4)) return;
|
||||
if (parts.Length <= 1) {
|
||||
Player.Message(p, "You need to provide a chatroom name to spy on."); return;
|
||||
}
|
||||
@ -192,7 +192,7 @@ namespace MCGalaxy.Commands.Chatting {
|
||||
}
|
||||
|
||||
void HandleForceJoin(Player p, string[] parts) {
|
||||
if (!CheckExtraPerm(p, 5)) { MessageNeedExtra(p, 5); return; }
|
||||
if (!CheckExtraPerm(p, 5)) return;
|
||||
if (parts.Length <= 2) {
|
||||
Player.Message(p, "You need to provide a player name, then a chatroom name."); return;
|
||||
}
|
||||
@ -219,7 +219,7 @@ namespace MCGalaxy.Commands.Chatting {
|
||||
}
|
||||
|
||||
void HandleKick(Player p, string[] parts) {
|
||||
if (!CheckExtraPerm(p, 6)) { MessageNeedExtra(p, 6); return; }
|
||||
if (!CheckExtraPerm(p, 6)) return;
|
||||
if (parts.Length <= 1) {
|
||||
Player.Message(p, "You need to provide a player name.");
|
||||
return;
|
||||
@ -241,7 +241,7 @@ namespace MCGalaxy.Commands.Chatting {
|
||||
void HandleAll(Player p, string[] parts, string message) {
|
||||
int length = parts.Length > 1 ? parts[0].Length + 1 : parts[0].Length;
|
||||
message = message.Substring( length );
|
||||
if (CheckExtraPerm(p, 7)) {
|
||||
if (HasExtraPerm(p, 7)) {
|
||||
Chat.MessageAllChatRooms(p, message, true);
|
||||
return;
|
||||
}
|
||||
@ -276,21 +276,21 @@ namespace MCGalaxy.Commands.Chatting {
|
||||
Player.Message(p, "/chatroom join [room] - joins a room");
|
||||
Player.Message(p, "/chatroom leave [room] - leaves a room");
|
||||
|
||||
if (CheckExtraPerm(p, 1))
|
||||
if (HasExtraPerm(p, 1))
|
||||
Player.Message(p, "/chatroom create [room] - creates a new room");
|
||||
if (CheckExtraPerm(p, 3))
|
||||
if (HasExtraPerm(p, 3))
|
||||
Player.Message(p, "/chatroom delete [room] - deletes a room");
|
||||
else if (CheckExtraPerm(p, 2))
|
||||
else if (HasExtraPerm(p, 2))
|
||||
Player.Message(p, "/chatroom delete [room] - deletes a room only if all people have left");
|
||||
|
||||
if (CheckExtraPerm(p, 4))
|
||||
if (HasExtraPerm(p, 4))
|
||||
Player.Message(p, "/chatroom spy [room] - spy on a chatroom");
|
||||
if (CheckExtraPerm(p, 5))
|
||||
if (HasExtraPerm(p, 5))
|
||||
Player.Message(p, "/chatroom forcejoin [player] [room] - forces a player to join a room");
|
||||
if (CheckExtraPerm(p, 6))
|
||||
if (HasExtraPerm(p, 6))
|
||||
Player.Message(p, "/chatroom kick [player] - kicks the player from their current room");
|
||||
|
||||
if (CheckExtraPerm(p, 7))
|
||||
if (HasExtraPerm(p, 7))
|
||||
Player.Message(p, "/chatroom all [message] - sends a global message to all rooms");
|
||||
else
|
||||
Player.Message(p, "/chatroom all [message] - sends a global message to all rooms " +
|
||||
|
@ -36,7 +36,7 @@ namespace MCGalaxy.Commands.Chatting {
|
||||
ClearChat(p);
|
||||
Player.Message(p, "%4Chat cleared.");
|
||||
} else {
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p); return; }
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
|
||||
Player[] players = PlayerInfo.Online.Items;
|
||||
foreach (Player pl in players) {
|
||||
|
@ -39,7 +39,7 @@ namespace MCGalaxy.Commands.Chatting {
|
||||
if (hugType == null) { TryMessageAction(p, args[0], "{0} %Shugged {1}.", false); return; }
|
||||
|
||||
if (hugType == "deadly") {
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; }
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
if (p != null && who.Rank > p.Rank) {
|
||||
MessageTooHighRank(p, "&cdeath-hug%S", true); return;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ namespace MCGalaxy {
|
||||
|
||||
protected bool CheckSuper(Player p, string message, string type) {
|
||||
if (message.Length > 0 || !Player.IsSuper(p)) return false;
|
||||
SuperRequiresArgs(name, p, type);
|
||||
SuperRequiresArgs(name, p, type);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -52,14 +52,17 @@ namespace MCGalaxy {
|
||||
Player.Message(p, "When using /{0} from {2}, you must provide a {1}.", cmd, type, src);
|
||||
}
|
||||
|
||||
protected bool CheckExtraPerm(Player p, int num = 1) {
|
||||
protected bool HasExtraPerm(Player p, int num) {
|
||||
return p == null || p.Rank >= CommandExtraPerms.MinPerm(name, num);
|
||||
}
|
||||
|
||||
protected void MessageNeedExtra(Player p, int num = 1) {
|
||||
protected bool CheckExtraPerm(Player p, int num) {
|
||||
if (HasExtraPerm(p, num)) return true;
|
||||
|
||||
LevelPermission perm = CommandExtraPerms.MinPerm(name, num);
|
||||
string action = ExtraPerms[num - 1].Description;
|
||||
Formatter.MessageNeedMinPerm(p, action, perm);
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static void MessageTooHighRank(Player p, string action, bool canAffectOwnRank) {
|
||||
|
@ -34,7 +34,7 @@ namespace MCGalaxy.Commands.Eco {
|
||||
string[] args = new string[] { "", "", "", "", "", "", "", "" };
|
||||
for (int i = 0; i < Math.Min(args.Length, raw.Length); i++)
|
||||
args[i] = raw[i];
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; }
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
|
||||
if (args[0].CaselessEq("apply")) {
|
||||
Economy.Load();
|
||||
|
@ -33,9 +33,7 @@ namespace MCGalaxy.Commands {
|
||||
if (bot == null && who == null) return;
|
||||
|
||||
if (isBot) {
|
||||
if (!CheckExtraPerm(p, 2)) {
|
||||
MessageNeedExtra(p, 2); return;
|
||||
}
|
||||
if (!CheckExtraPerm(p, 2)) return;
|
||||
|
||||
if (p != null && !bot.level.BuildAccess.CheckDetailed(p)) {
|
||||
Player.Message(p, "Hence, you cannot change the " + type + " of that bot.");
|
||||
@ -43,9 +41,7 @@ namespace MCGalaxy.Commands {
|
||||
}
|
||||
SetBotData(p, bot, args.Length > 2 ? args[2] : "");
|
||||
} else {
|
||||
if (p != who && !CheckExtraPerm(p, 1)) {
|
||||
MessageNeedExtra(p, 1); return;
|
||||
}
|
||||
if (p != who && !CheckExtraPerm(p, 1)) return;
|
||||
|
||||
if (p != null && who.Rank > p.Rank) {
|
||||
MessageTooHighRank(p, "change the " + type + " of", true); return;
|
||||
@ -65,7 +61,7 @@ namespace MCGalaxy.Commands {
|
||||
if (p != null && who.Rank > p.Rank) {
|
||||
MessageTooHighRank(p, "change the " + type + " of", true); return;
|
||||
}
|
||||
if (p != who && !CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; }
|
||||
if (p != who && !CheckExtraPerm(p, 1)) return;
|
||||
SetPlayerData(p, who, args.Length > 1 ? args[1] : "");
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
|
||||
void HandleRules(Player p, string target) {
|
||||
Player who = p;
|
||||
if (target.Length > 0 && CheckExtraPerm(p, 1)) {
|
||||
if (target.Length > 0 && HasExtraPerm(p, 1)) {
|
||||
who = PlayerInfo.FindMatches(p, target);
|
||||
if (who == null) return;
|
||||
|
||||
@ -177,7 +177,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
|
||||
|
||||
void HandleGenerate(Player p, CountdownGame game, string x, string y, string z) {
|
||||
if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; }
|
||||
if (!CheckExtraPerm(p, 2)) return;
|
||||
|
||||
int width, height, length;
|
||||
if(!int.TryParse(x, out width) || !int.TryParse(y, out height) || !int.TryParse(z, out length)) {
|
||||
@ -192,7 +192,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
}
|
||||
|
||||
void HandleEnable(Player p, CountdownGame game) {
|
||||
if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; }
|
||||
if (!CheckExtraPerm(p, 2)) return;
|
||||
|
||||
if (game.Status == CountdownGameStatus.Disabled) {
|
||||
game.Enable(p);
|
||||
@ -202,7 +202,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
}
|
||||
|
||||
void HandleDisable(Player p, CountdownGame game) {
|
||||
if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; }
|
||||
if (!CheckExtraPerm(p, 2)) return;
|
||||
|
||||
if (game.Status == CountdownGameStatus.Disabled) {
|
||||
Player.Message(p, "Countdown is not running."); return;
|
||||
@ -212,7 +212,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
|
||||
|
||||
void HandleStart(Player p, CountdownGame game, string speed, string mode) {
|
||||
if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; }
|
||||
if (!CheckExtraPerm(p, 2)) return;
|
||||
|
||||
switch (game.Status) {
|
||||
case CountdownGameStatus.Disabled:
|
||||
@ -245,7 +245,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
}
|
||||
|
||||
void HandleEnd(Player p, CountdownGame game) {
|
||||
if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; }
|
||||
if (!CheckExtraPerm(p, 2)) return;
|
||||
|
||||
switch (game.Status) {
|
||||
case CountdownGameStatus.Disabled:
|
||||
@ -258,7 +258,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
}
|
||||
|
||||
void HandleReset(Player p, CountdownGame game, string type) {
|
||||
if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; }
|
||||
if (!CheckExtraPerm(p, 2)) return;
|
||||
|
||||
switch (game.Status) {
|
||||
case CountdownGameStatus.Disabled:
|
||||
@ -278,11 +278,11 @@ namespace MCGalaxy.Commands.Fun {
|
||||
Player.Message(p, "%T/CD join/leave %H- joins/leaves the game");
|
||||
Player.Message(p, "%T/CD players %H- lists players currently playing");
|
||||
Player.Message(p, "%T/CD rules %H- view the rules of countdown");
|
||||
if (CheckExtraPerm(p, 1)) {
|
||||
if (HasExtraPerm(p, 1)) {
|
||||
Player.Message(p, "%T/CD rules [player] %H- sends rules to that player.");
|
||||
}
|
||||
|
||||
if (!CheckExtraPerm(p, 2)) return;
|
||||
if (!HasExtraPerm(p, 2)) return;
|
||||
Player.Message(p, "%T/CD generate [width] [height] [length] %H- generates the countdown map (default is 32x32x32)");
|
||||
Player.Message(p, "%T/CD enable/disable %H- enables/disables countdown");
|
||||
Player.Message(p, "%T/CD start <speed> <mode> %H- starts a round of countdown");
|
||||
|
@ -61,7 +61,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
}
|
||||
|
||||
void HandleStart(Player p, string[] args) {
|
||||
if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; }
|
||||
if (!CheckExtraPerm(p, 2)) return;
|
||||
|
||||
string map = args.Length > 1 ? args[1] : "";
|
||||
switch (Server.lava.Start(map)) {
|
||||
@ -74,7 +74,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
}
|
||||
|
||||
void HandleStop(Player p, string[] args) {
|
||||
if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; }
|
||||
if (!CheckExtraPerm(p, 2)) return;
|
||||
|
||||
switch (Server.lava.Stop()) {
|
||||
case 0: Chat.MessageGlobal("Lava Survival has ended! We hope you had fun!"); return;
|
||||
@ -84,7 +84,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
}
|
||||
|
||||
void HandleEnd(Player p, string[] args) {
|
||||
if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; }
|
||||
if (!CheckExtraPerm(p, 2)) return;
|
||||
|
||||
if (!Server.lava.active) { Player.Message(p, "There isn't an active Lava Survival game."); return; }
|
||||
if (Server.lava.roundActive) Server.lava.EndRound();
|
||||
@ -93,7 +93,8 @@ namespace MCGalaxy.Commands.Fun {
|
||||
}
|
||||
|
||||
void HandleSetup(Player p, string[] args) {
|
||||
if (!CheckExtraPerm(p, 1)) { MessageNeedExtra(p, 1); return; }
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
|
||||
if (p == null) { Player.Message(p, "/{0} setup can only be used in-game.", name); return; }
|
||||
if (args.Length < 2) { SetupHelp(p); return; }
|
||||
if (Server.lava.active) { Player.Message(p, "You cannot configure Lava Survival while a game is active."); return; }
|
||||
@ -263,12 +264,12 @@ namespace MCGalaxy.Commands.Fun {
|
||||
Player.Message(p, "%T/LS go %H- Join the fun!");
|
||||
Player.Message(p, "%T/LS info %H- View current round info and time.");
|
||||
|
||||
if (CheckExtraPerm(p, 1)) {
|
||||
if (HasExtraPerm(p, 1)) {
|
||||
Player.Message(p, "%T/LS start <map> %H- Starts Lava Survival, optionally on the given map.");
|
||||
Player.Message(p, "%T/LS stop %H- Stops the current Lava Survival game.");
|
||||
Player.Message(p, "%T/LS end %H- End the current round or vote.");
|
||||
}
|
||||
if (CheckExtraPerm(p, 2)) {
|
||||
if (HasExtraPerm(p, 2)) {
|
||||
Player.Message(p, "%T/LS setup %H- Setup lava survival, use it for more info.");
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
}
|
||||
|
||||
void HandleCreate(Player p, string[] args) {
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; }
|
||||
if (!CheckExtraPerm(p, 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) {
|
||||
|
@ -190,7 +190,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
Player.Message(p, "TNT Wars Rules:");
|
||||
SendRules(p); return;
|
||||
}
|
||||
if (!CheckExtraPerm(p)) return;
|
||||
if (!HasExtraPerm(p, 1)) return;
|
||||
|
||||
switch (text[1]) {
|
||||
case "all":
|
||||
@ -329,7 +329,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
}
|
||||
|
||||
void DoSetup(Player p, string[] text) {
|
||||
if (!CheckExtraPerm(p)) {
|
||||
if (!HasExtraPerm(p, 1)) {
|
||||
Player.Message(p, "Sorry, you aren't a high enough rank for that!"); return;
|
||||
}
|
||||
|
||||
@ -1138,7 +1138,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
Player.Message(p, "/tw players {p} - view the current players in your game");
|
||||
Player.Message(p, "/tw health {hp} - view your currrent amount of health left");
|
||||
|
||||
if (CheckExtraPerm(p)) {
|
||||
if (HasExtraPerm(p, 1)) {
|
||||
Player.Message(p, "/tw rules <all/level/players/<playername>> - send the rules to yourself, all, your map, all players in your game or to one person!");
|
||||
Player.Message(p, "/tw setup {s} - setup the game (do '/tntwars setup help' for more info!");
|
||||
} else {
|
||||
|
@ -40,7 +40,7 @@ namespace MCGalaxy.Commands.Info {
|
||||
|
||||
Player who = p;
|
||||
if (message.Length > 0) {
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; }
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
who = PlayerInfo.FindMatches(p, message);
|
||||
if (who == null) return;
|
||||
}
|
||||
@ -79,7 +79,7 @@ namespace MCGalaxy.Commands.Info {
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
if (CheckExtraPerm(p)) {
|
||||
if (HasExtraPerm(p, 1)) {
|
||||
Player.Message(p, "%T/Rules <player>");
|
||||
Player.Message(p, "%HDisplays server rules to <player>.");
|
||||
Player.Message(p, "%HIf <player> is not given, the rules are displayed to you.");
|
||||
|
@ -58,8 +58,7 @@ namespace MCGalaxy.Commands.Info {
|
||||
else
|
||||
Player.Message(p, "Console state: &3{0}", ServerConfig.ConsoleName);
|
||||
|
||||
if (CheckExtraPerm(p))
|
||||
ShowServerStats(p);
|
||||
if (HasExtraPerm(p, 1)) ShowServerStats(p);
|
||||
}
|
||||
|
||||
static int GetPlayerCount() {
|
||||
|
@ -42,7 +42,7 @@ namespace MCGalaxy.Commands.Moderation {
|
||||
}
|
||||
bool messageOps = true;
|
||||
if (message.CaselessEq("silent")) {
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; }
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
messageOps = false;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ namespace MCGalaxy.Commands.Moderation {
|
||||
}
|
||||
|
||||
void HandleList(Player p, string[] args) {
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; }
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
|
||||
bool foundone = false;
|
||||
string[] files = Directory.GetFiles("extra/reported", "*.txt");
|
||||
@ -79,7 +79,7 @@ namespace MCGalaxy.Commands.Moderation {
|
||||
if (args.Length != 2) {
|
||||
Player.Message(p, "You need to provide a player's name."); return;
|
||||
}
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; }
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
if (!Formatter.ValidName(p, args[1], "player")) return;
|
||||
|
||||
if (!File.Exists("extra/reported/" + args[1] + ".txt")) {
|
||||
@ -93,7 +93,7 @@ namespace MCGalaxy.Commands.Moderation {
|
||||
if (args.Length != 2) {
|
||||
Player.Message(p, "You need to provide a player's name."); return;
|
||||
}
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; }
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
if (!Formatter.ValidName(p, args[1], "player")) return;
|
||||
|
||||
if (!File.Exists("extra/reported/" + args[1] + ".txt")) {
|
||||
@ -111,7 +111,7 @@ namespace MCGalaxy.Commands.Moderation {
|
||||
}
|
||||
|
||||
void HandleClear(Player p, string[] args) {
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; }
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
if (!Directory.Exists("extra/reportedbackups"))
|
||||
Directory.CreateDirectory("extra/reportedbackups");
|
||||
string[] files = Directory.GetFiles("extra/reported", "*.txt");
|
||||
@ -151,7 +151,7 @@ namespace MCGalaxy.Commands.Moderation {
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "%T/Report [Player] [Reason] %H- Reports that player for the given reason.");
|
||||
if (!CheckExtraPerm(p)) return;
|
||||
if (!HasExtraPerm(p, 1)) return;
|
||||
Player.Message(p, "%T/Report list %H- Outputs the list of reported players.");
|
||||
Player.Message(p, "%T/Report check [Player] %H- Views report for that player.");
|
||||
Player.Message(p, "%T/Report delete [Player] %H- Deletes report for that player.");
|
||||
|
@ -95,7 +95,7 @@ namespace MCGalaxy.Commands.Moderation {
|
||||
}
|
||||
|
||||
void HandleView(Player p) {
|
||||
if (!CheckExtraPerm(p, 1)) { MessageNeedExtra(p, 1); return; }
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
|
||||
if (Server.reviewlist.Count == 0) {
|
||||
Player.Message(p, "There are no players in the review queue."); return;
|
||||
@ -128,7 +128,7 @@ namespace MCGalaxy.Commands.Moderation {
|
||||
|
||||
void HandleNext(Player p) {
|
||||
if (p == null) { Player.Message(p, "Console cannot answer the review queue."); return; }
|
||||
if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; }
|
||||
if (!CheckExtraPerm(p, 2)) return;
|
||||
if (Server.reviewlist.Count == 0) {
|
||||
Player.Message(p, "There are no players in the review queue."); return;
|
||||
}
|
||||
@ -153,7 +153,7 @@ namespace MCGalaxy.Commands.Moderation {
|
||||
}
|
||||
|
||||
void HandleClear(Player p) {
|
||||
if (!CheckExtraPerm(p, 3)) { MessageNeedExtra(p, 3); return; }
|
||||
if (!CheckExtraPerm(p, 3)) return;
|
||||
Server.reviewlist.Clear();
|
||||
Player.Message(p, "The review queue has been cleared");
|
||||
}
|
||||
|
@ -53,10 +53,10 @@ namespace MCGalaxy.Commands.Moderation {
|
||||
ZoneAll(p.level, args[1]);
|
||||
Player.Message(p, "Added zone for &b" + args[1]);
|
||||
} else if (args[0].CaselessEq("del") && args.Length > 1 && args[1].CaselessEq("all")) {
|
||||
if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; }
|
||||
if (!CheckExtraPerm(p, 2)) return;
|
||||
DeleteAll(p);
|
||||
} else if (args[0].CaselessEq("del")) {
|
||||
if (!CheckExtraPerm(p, 1)) { MessageNeedExtra(p, 1); return; }
|
||||
if (!CheckExtraPerm(p, 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.");
|
||||
@ -109,7 +109,7 @@ namespace MCGalaxy.Commands.Moderation {
|
||||
}
|
||||
|
||||
bool CheckAdd(Player p, string[] args, string cmd) {
|
||||
if (!CheckExtraPerm(p, 3)) { MessageNeedExtra(p, 3); return false; }
|
||||
if (!CheckExtraPerm(p, 3)) return false;
|
||||
if (args.Length == 1) { Help(p); return false; }
|
||||
if (!Formatter.ValidName(p, args[1], "player or rank")) return false;
|
||||
|
||||
|
@ -40,7 +40,7 @@ namespace MCGalaxy.Commands.World {
|
||||
PlayerActions.ChangeMap(p, Server.mainLevel);
|
||||
}
|
||||
} else {
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; }
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
if (!Formatter.ValidName(p, message, "level")) return;
|
||||
|
||||
string map = Matcher.FindMaps(p, message);
|
||||
|
@ -60,10 +60,8 @@ namespace MCGalaxy.Commands.World {
|
||||
value = args.Length > 2 ? args[2] : "";
|
||||
}
|
||||
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; }
|
||||
if (opt.CaselessEq("realmowner") && !CheckExtraPerm(p, 2)) {
|
||||
MessageNeedExtra(p, 2); return;
|
||||
}
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
if (opt.CaselessEq("realmowner") && !CheckExtraPerm(p, 2)) return;
|
||||
|
||||
if (SetMapOption(p, lvl, opt, value)) return;
|
||||
Player.Message(p, "Could not find option entered.");
|
||||
|
@ -62,9 +62,7 @@ namespace MCGalaxy.Commands.World {
|
||||
if (LevelInfo.MapExists(name)) {
|
||||
Player.Message(p, "Level \"{0}\" already exists", name); return null;
|
||||
}
|
||||
if (!MapGen.IsSimpleTheme(args[4]) && !CheckExtraPerm(p)) {
|
||||
MessageNeedExtra(p, 1); return null;
|
||||
}
|
||||
if (!MapGen.IsSimpleTheme(args[4]) && !CheckExtraPerm(p, 1)) return null;
|
||||
|
||||
if (p != null && Interlocked.CompareExchange(ref p.GeneratingMap, 1, 0) == 1) {
|
||||
Player.Message(p, "You are already generating a map, please wait until that map has finished generating first.");
|
||||
|
@ -55,7 +55,7 @@ namespace MCGalaxy.Commands.World {
|
||||
SuperRequiresArgs(name + " all", p, "level name"); return false;
|
||||
}
|
||||
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return false; }
|
||||
if (!CheckExtraPerm(p, 1)) return false;
|
||||
Player[] players = PlayerInfo.Online.Items;
|
||||
foreach (Player who in players) {
|
||||
if (who.level == lvl)
|
||||
|
@ -86,7 +86,7 @@ namespace MCGalaxy.Commands.Building {
|
||||
}
|
||||
|
||||
bool CheckCommand(Player p, string message) {
|
||||
bool allCmds = CheckExtraPerm(p);
|
||||
bool allCmds = HasExtraPerm(p, 1);
|
||||
string[] parts = message.SplitSpaces(2);
|
||||
string alias = parts[0], cmdArgs = "";
|
||||
Command.Search(ref alias, ref cmdArgs);
|
||||
|
@ -76,7 +76,7 @@ namespace MCGalaxy.Commands.Building {
|
||||
}
|
||||
|
||||
void UndoPhysics(Player p, TimeSpan delta) {
|
||||
if (!CheckExtraPerm(p, 1)) { MessageNeedExtra(p, 1); return; }
|
||||
if (!CheckExtraPerm(p, 1)) return;
|
||||
if (p != null && !p.group.CanExecute("physics")) {
|
||||
Player.Message(p, "You can only undo physics if you can use %T/Physics."); return;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ namespace MCGalaxy.Commands.Misc {
|
||||
public override void Use(Player p, string message) {
|
||||
if (message.Length == 0) { Help(p); return; }
|
||||
if (message.CaselessEq("all")) {
|
||||
if (CheckExtraPerm(p)) SummonAll(p);
|
||||
if (HasExtraPerm(p, 1)) SummonAll(p);
|
||||
} else {
|
||||
SummonPlayer(p, message);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ namespace MCGalaxy.Commands.Misc {
|
||||
|
||||
string name = args[1];
|
||||
if (cmd == "create" || cmd == "add") {
|
||||
if (CheckExtraPerms && !CheckExtraPerm(p, 1)) { MessageNeedExtra(p, 1); return; }
|
||||
if (CheckExtraPerms && !CheckExtraPerm(p, 1)) return;
|
||||
if (warps.Exists(name)) { Player.Message(p, "{0} already exists", group); return; }
|
||||
|
||||
Player who = args.Length == 2 ? p : PlayerInfo.FindMatches(p, args[2]);
|
||||
@ -67,14 +67,14 @@ namespace MCGalaxy.Commands.Misc {
|
||||
warps.Create(name, who);
|
||||
Player.Message(p, "{0} {1} created.", group, name);
|
||||
} else if (cmd == "delete" || cmd == "remove") {
|
||||
if (CheckExtraPerms && !CheckExtraPerm(p, 2)) { MessageNeedExtra(p, 2); return; }
|
||||
if (CheckExtraPerms && !CheckExtraPerm(p, 2)) return;
|
||||
Warp warp = Matcher.FindWarps(p, warps, name);
|
||||
if (warp == null) return;
|
||||
|
||||
warps.Remove(warp, p);
|
||||
Player.Message(p, "{0} {1} deleted.", group, warp.Name);
|
||||
} else if (cmd == "move" || cmd == "update") {
|
||||
if (CheckExtraPerms && !CheckExtraPerm(p, 3)) { MessageNeedExtra(p, 3); return; }
|
||||
if (CheckExtraPerms && !CheckExtraPerm(p, 3)) return;
|
||||
Warp warp = Matcher.FindWarps(p, warps, name);
|
||||
if (warp == null) return;
|
||||
|
||||
@ -94,11 +94,11 @@ namespace MCGalaxy.Commands.Misc {
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "%T/Warp [name] %H- Move to that warp");
|
||||
Player.Message(p, "%T/Warp list %H- List all the warps");
|
||||
if (CheckExtraPerm(p, 1))
|
||||
if (HasExtraPerm(p, 1))
|
||||
Player.Message(p, "%T/Warp create [name] <player> %H- Create a warp, if a <player> is given, it will be created where they are");
|
||||
if (CheckExtraPerm(p, 2))
|
||||
if (HasExtraPerm(p, 2))
|
||||
Player.Message(p, "%T/Warp delete [name] %H- Deletes a warp");
|
||||
if (CheckExtraPerm(p, 3))
|
||||
if (HasExtraPerm(p, 3))
|
||||
Player.Message(p, "%T/Warp move [name] <player> %H- Moves a warp, if a <player> is given, it will be created where they are");
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace MCGalaxy.Commands.Misc {
|
||||
protected override bool CheckExtraPerms { get { return false; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
UseCore(p, message, p.Waypoints, "Waypoint");
|
||||
UseCore(p, message, p.Waypoints, "Waypoint");
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user