Add p.Rank as shortcut for p.group.Permission

This commit is contained in:
UnknownShadow200 2016-07-14 22:22:31 +10:00
parent f2b60e488e
commit e3f2875111
72 changed files with 126 additions and 131 deletions

View File

@ -38,7 +38,7 @@ namespace MCGalaxy.BlockBehaviour {
DataRow row = Portals.Rows[last];
string map = row["ExitMap"].ToString();
if (p.level.name != map) {
if (p.level.permissionvisit > p.group.Permission) {
if (p.level.permissionvisit > p.Rank) {
Player.Message(p, "You do not have the adequate rank to visit this map!"); return true;
}

View File

@ -362,7 +362,7 @@ namespace MCGalaxy
public static bool canPlace(Player p, byte type) {
Blocks b = BlockList[type];
LevelPermission perm = p.group.Permission;
LevelPermission perm = p.Rank;
return (perm >= b.lowestRank || (b.allow != null && b.allow.Contains(perm)))
&& (b.disallow == null || !b.disallow.Contains(perm));
}

View File

@ -78,7 +78,7 @@ namespace MCGalaxy {
public static void GlobalMessageMinPerms(string message, LevelPermission minPerm) {
Player[] players = PlayerInfo.Online.Items;
foreach (Player p in players) {
if (p.group.Permission >= minPerm)
if (p.Rank >= minPerm)
Player.Message(p, message);
}
}
@ -210,7 +210,7 @@ namespace MCGalaxy {
string displayName = p == null ? "(console)" : p.ColoredName;
string name = p == null ? "(console)" : p.name;
Chat.GlobalMessageOps("To Ops &f-" + displayName + "&f- " + text);
if (p != null && p.group.Permission < Server.opchatperm )
if (p != null && p.Rank < Server.opchatperm )
p.SendMessage("To Ops &f-" + displayName + "&f- " + text);
Server.s.Log("(OPs): " + name + ": " + text);
@ -223,7 +223,7 @@ namespace MCGalaxy {
string displayName = p == null ? "(console)" : p.ColoredName;
string name = p == null ? "(console)" : p.name;
Chat.GlobalMessageAdmins("To Admins &f-" + displayName + "&f- " + text);
if (p != null && p.group.Permission < Server.adminchatperm)
if (p != null && p.Rank < Server.adminchatperm)
p.SendMessage("To Admins &f-" + displayName + "&f- " + text);
Server.s.Log("(Admins): " + name + ": " + text);

View File

@ -67,7 +67,7 @@ namespace MCGalaxy.Commands.CPE {
}
model = model.ToLower();
if (p != null && who != null && who.group.Permission > p.group.Permission) {
if (p != null && who != null && who.Rank > p.Rank) {
MessageTooHighRank(p, "change the model of", true); return;
}
if ((isBot || who != p) && !CheckExtraPerm(p)) { MessageNeedExtra(p, "can change the model of others."); return; }

View File

@ -58,7 +58,7 @@ namespace MCGalaxy.Commands.CPE {
}
if (!ValidName(p, skin, "skin")) return;
if (p != null && who != null && who.group.Permission > p.group.Permission) {
if (p != null && who != null && who.Rank > p.Rank) {
MessageTooHighRank(p, "change the skin of", true); return;
}
if ((isBot || who != p) && !CheckExtraPerm(p)) { MessageNeedExtra(p, "can change the skin of others."); return; }

View File

@ -84,8 +84,8 @@ namespace MCGalaxy.Commands {
if (parts.Length > 1 && Server.Chatrooms.Contains(parts[1])) {
string room = parts[1];
if (p.spyChatRooms.Contains(room)) {
Player.Message(p, "The chat room '" + room + "' has been removed " +
"from your spying list because you are joining the room.");
Player.Message(p, "The chat room '{0}' has been removed " +
"from your spying list because you are joining the room.", room);
p.spyChatRooms.Remove(room);
}
@ -113,10 +113,10 @@ namespace MCGalaxy.Commands {
string room = parts[1];
if (Server.Chatrooms.Contains(parts[1])) {
Player.Message(p, "The chatoom '" + room + "' already exists");
Player.Message(p, "The chatoom '{0}' already exists", room);
} else {
Server.Chatrooms.Add(room);
Player.GlobalMessage("A new chat room '" + room + "' has been created");
Player.GlobalMessage("A new chat room '{0}' has been created", room);
}
}
@ -134,16 +134,14 @@ namespace MCGalaxy.Commands {
}
if (!Server.Chatrooms.Contains(room)) {
Player.Message(p, "There is no chatroom with the name '" + room + "'");
return;
Player.Message(p, "There is no chatroom with the name '{0}'", room); return;
}
if (!canDeleteForce) {
Player[] players = PlayerInfo.Online.Items;
foreach (Player pl in players) {
if (pl != p && pl.Chatroom == room) {
Player.Message(p, "Sorry, someone else is in the chatroom");
return;
Player.Message(p, "Sorry, someone else is in the chatroom"); return;
}
}
}
@ -157,7 +155,7 @@ namespace MCGalaxy.Commands {
foreach (Player pl in online) {
if (pl.Chatroom == room) {
pl.Chatroom = null;
Player.Message(pl, "You left the chatroom '" + room + "' because it is being deleted");
Player.Message(pl, "You left the chatroom '{0}' because it is being deleted", room);
}
if (pl.spyChatRooms.Contains(room)) {
@ -172,8 +170,7 @@ namespace MCGalaxy.Commands {
void HandleSpy(Player p, string[] parts) {
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;
Player.Message(p, "You need to provide a chatroom name to spy on."); return;
}
string room = parts[1];
@ -183,43 +180,40 @@ namespace MCGalaxy.Commands {
}
if (p.spyChatRooms.Contains(room)) {
Player.Message(p, "'" + room + "' is already in your spying list.");
Player.Message(p, "'{0}' is already in your spying list.", room);
} else {
p.spyChatRooms.Add(room);
Player.Message(p, "'" + room + "' has been added to your chat room spying list");
Player.Message(p, "'{0}' has been added to your chat room spying list", room);
}
} else {
Player.Message(p, "There is no chatroom with the name '" + room + "'");
Player.Message(p, "There is no chatroom with the name '{0}'", room);
}
}
void HandleForceJoin(Player p, string[] parts) {
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;
Player.Message(p, "You need to provide a player name, then a chatroom name."); return;
}
string name = parts[1], room = parts[2];
Player pl = PlayerInfo.FindMatches(p, name);
if (pl == null) return;
if (!Server.Chatrooms.Contains(room)) {
Player.Message(p, "There is no chatroom with the name '" + room + "'");
return;
}
if (pl.group.Permission >= p.group.Permission) {
MessageTooHighRank(p, "force-join", false); return;
Player.Message(p, "There is no chatroom with the name '{0}'", room); return;
}
if (pl.Rank >= p.Rank) { MessageTooHighRank(p, "force-join", false); return;}
if (pl.spyChatRooms.Contains(room)) {
Player.Message(pl, "The chat room '" + room + "' has been removed from your spying list " +
"because you are force joining the room '" + room + "'");
Player.Message(pl, "The chat room '{0}' has been removed from your spying list " +
"because you are force joining the room '{0}'", room);
pl.spyChatRooms.Remove(room);
}
Player.Message(pl, "You've been forced to join the chat room '" + room + "'");
Player.Message(pl, "You've been forced to join the chat room '{0}'", room);
Chat.ChatRoom(pl, pl.ColoredName + " %Shas force joined your chat room", false, room);
pl.Chatroom = room;
Player.Message(p, pl.ColoredName + " %Swas forced to join the chatroom '" + room + "' by you");
Player.Message(p, pl.ColoredName + " %Swas forced to join the chatroom '{0}' by you", room);
}
void HandleKick(Player p, string[] parts) {
@ -232,7 +226,7 @@ namespace MCGalaxy.Commands {
string name = parts[1];
Player pl = PlayerInfo.FindMatches(p, name);
if (pl == null) return;
if (pl.group.Permission >= p.group.Permission) {
if (pl.Rank >= p.Rank) {
MessageTooHighRank(p, "kick from a chatroom", false); return;
}

View File

@ -47,7 +47,7 @@ namespace MCGalaxy.Commands {
else who = PlayerInfo.FindMatches(p, args[0]);
if (pBot == null && who == null) return;
if (p != null && who != null && who.group.Permission > p.group.Permission) {
if (p != null && who != null && who.Rank > p.Rank) {
MessageTooHighRank(p, "change the color of", true); return;
}
if ((isBot || who != p) && !CheckExtraPerm(p)) { MessageNeedExtra(p, "can change the color of others."); return; }

View File

@ -47,10 +47,10 @@ namespace MCGalaxy.Commands {
}
if (type == "deadly") {
if (p != null && p.group.Permission < LevelPermission.Operator) {
if (p != null && p.Rank < LevelPermission.Operator) {
Player.Message(p, "You cannot %cdeath-hug %Sat your current rank."); return;
}
if (p != null && who.group.Permission > p.group.Permission) {
if (p != null && who.Rank > p.Rank) {
MessageTooHighRank(p, "&cdeath-hug%S", true); return;
}
who.HandleDeath(Block.rock, " died from a %cdeadly hug.");

View File

@ -48,7 +48,7 @@ namespace MCGalaxy.Commands {
else who = PlayerInfo.FindMatches(p, args[0]);
if (pBot == null && who == null) return;
if (p != null && who != null && who.group.Permission > p.group.Permission) {
if (p != null && who != null && who.Rank > p.Rank) {
MessageTooHighRank(p, "change the nick of", true); return;
}
if ((isBot || who != p) && !CheckExtraPerm(p)) { MessageNeedExtra(p, "can change the nick of others."); return; }

View File

@ -41,7 +41,7 @@ namespace MCGalaxy.Commands {
Player who = PlayerInfo.FindMatches(p, args[0]);
if (who == null) return;
if (p != null && who.group.Permission > p.group.Permission) {
if (p != null && who.Rank > p.Rank) {
MessageTooHighRank(p, "change the title color of", true); return;
}
if (who != p && !CheckExtraPerm(p)) { MessageNeedExtra(p, "can change the title color of others."); return; }

View File

@ -42,7 +42,7 @@ namespace MCGalaxy.Commands {
Player who = PlayerInfo.FindMatches(p, args[0]);
if (who == null) return;
if (p != null && who.group.Permission > p.group.Permission) {
if (p != null && who.Rank > p.Rank) {
MessageTooHighRank(p, "change the title of", true); return;
}
if (who != p && !CheckExtraPerm(p)) { MessageNeedExtra(p, "can change the title of others."); return; }

View File

@ -62,7 +62,7 @@ namespace MCGalaxy {
}
protected bool CheckExtraPerm(Player p, int num = 1) {
return p == null || (int)p.group.Permission >= CommandOtherPerms.GetPerm(this, num);
return p == null || (int)p.Rank >= CommandOtherPerms.GetPerm(this, num);
}
protected void MessageNeedExtra(Player p, string action, int num = 1) {
@ -97,7 +97,7 @@ namespace MCGalaxy {
internal void MessageCannotUse(Player p) {
var perms = GrpCommands.allowedCommands.Find(C => C.commandName == name);
if (perms.disallow.Contains(p.group.Permission)) {
if (perms.disallow.Contains(p.Rank)) {
Player.Message(p, "Your rank cannot use /%T" + name); return;
}

View File

@ -203,7 +203,7 @@ namespace MCGalaxy.Commands {
Player who = PlayerInfo.FindMatches(p, target);
if (who == null) return;
if (p.group.Permission < who.group.Permission) {
if (p.Rank < who.Rank) {
MessageTooHighRank(p, "send countdown rules", true); return;
} else {
Player.Message(who, "Countdown rules sent to you by " + p.ColoredName);

View File

@ -50,7 +50,7 @@ namespace MCGalaxy.Commands
Server.lava.AnnounceTimeLeft(!Server.lava.flooded, true, p, p == null);
return;
}
if (p == null || p.group.Permission >= Server.lava.controlRank)
if (p == null || p.Rank >= Server.lava.controlRank)
{
if (s[0] == "start")
{
@ -97,7 +97,7 @@ namespace MCGalaxy.Commands
return;
}
}
if (p == null || p.group.Permission >= Server.lava.setupRank)
if (p == null || p.Rank >= Server.lava.setupRank)
{
if (s[0] == "setup")
{
@ -309,13 +309,13 @@ namespace MCGalaxy.Commands
Player.Message(p, "The following params are available:");
Player.Message(p, "go - Join the fun!");
Player.Message(p, "info - View the current round info and time.");
if (p == null || p.group.Permission >= Server.lava.controlRank)
if (p == null || p.Rank >= Server.lava.controlRank)
{
Player.Message(p, "start [map] - Start the Lava Survival game, optionally on the specified map.");
Player.Message(p, "stop - Stop the current Lava Survival game.");
Player.Message(p, "end - End the current round or vote.");
}
if (p == null || p.group.Permission >= Server.lava.setupRank)
if (p == null || p.Rank >= Server.lava.setupRank)
{
Player.Message(p, "setup - Setup lava survival, use it for more info.");
}

View File

@ -39,12 +39,12 @@ namespace MCGalaxy.Commands {
Player[] players = PlayerInfo.Online.Items;
foreach (Player pl in players) {
if (pl.level == lvl && pl.group.Permission < p.group.Permission)
if (pl.level == lvl && pl.Rank < p.Rank)
DoSlap(p, pl);
}
return;
}
if (p != null && who.group.Permission > p.group.Permission) {
if (p != null && who.Rank > p.Rank) {
MessageTooHighRank(p, "slap", true); return;
}
DoSlap(p, who);

View File

@ -36,7 +36,7 @@ namespace MCGalaxy.Commands {
string canVisit = "", canBuild = "";
Level[] loaded = LevelInfo.Loaded.Items;
foreach (Level lvl in loaded) {
if (p == null || lvl.permissionvisit <= p.group.Permission) {
if (p == null || lvl.permissionvisit <= p.Rank) {
if (Group.findPerm(lvl.permissionbuild) != null)
canVisit += ", " + Group.findPerm(lvl.permissionbuild).color + lvl.name + " &b[&f" + lvl.physics + "&b]";
else

View File

@ -39,7 +39,7 @@ namespace MCGalaxy.Commands
if (message != "") {
who = PlayerInfo.FindMatches(p, message);
if (who == null) return;
if (p != null && p.group.Permission < who.group.Permission) {
if (p != null && p.Rank < who.Rank) {
MessageTooHighRank(p, "send /oprules", false); return;
}
}

View File

@ -79,7 +79,7 @@ namespace MCGalaxy.Commands {
bool loadOnGoto;
RetrieveProps(level, out visitP, out buildP, out loadOnGoto);
string visit = loadOnGoto && (p == null || p.group.Permission >= visitP) ? "%aYes" : "%cNo";
string visit = loadOnGoto && (p == null || p.Rank >= visitP) ? "%aYes" : "%cNo";
builder.Append(", ").Append(Group.findPerm(buildP).color + level + " &b[" + visit + "&b]");
}
return builder;

View File

@ -28,10 +28,10 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message) {
if (message.ToLower() != "force") {
if (p == null || p.group.Permission > defaultRank) MCGalaxy.Gui.App.UpdateCheck(false, p);
if (p == null || p.Rank > defaultRank) MCGalaxy.Gui.App.UpdateCheck(false, p);
else Player.Message(p, "Ask an " + Group.findPerm(defaultRank).name + "+ to do it!");
} else {
if (p == null || p.group.Permission > defaultRank) MCGalaxy.Gui.App.PerformUpdate();
if (p == null || p.Rank > defaultRank) MCGalaxy.Gui.App.PerformUpdate();
else Player.Message(p, "Ask an " + Group.findPerm(defaultRank).name + "+ to do it!");
}
}

View File

@ -61,7 +61,7 @@ namespace MCGalaxy.Commands {
+ "%S, and is currently &aonline");
Player.Message(p, " Logged in &a{0} %Stimes, &c{1} %Sof which ended in a kick", who.Logins, who.Kicks);
if (who.Group.Permission == LevelPermission.Banned) {
if (who.Rank == LevelPermission.Banned) {
string[] data = Ban.GetBanData(who.Name);
if (data != null)
Player.Message(p, " is banned for " + data[1] + " by " + data[0]);

View File

@ -83,7 +83,7 @@ namespace MCGalaxy.Commands.Moderation {
if (group.Permission == LevelPermission.Banned) {
Player.Message(p, name + " is already banned."); return false;
}
if (p != null && group.Permission >= p.group.Permission) {
if (p != null && group.Permission >= p.Rank) {
MessageTooHighRank(p, "ban", false); return false;
}

View File

@ -74,7 +74,7 @@ namespace MCGalaxy.Commands.Moderation {
foreach (string opname in opNamesWithThatIP) {
// If one of these guys matches a player with a higher rank don't allow the ipban to proceed!
Group grp = Group.findPlayerGroup(opname);
if (grp == null || grp.Permission < p.group.Permission) continue;
if (grp == null || grp.Permission < p.Rank) continue;
Player.Message(p, "You can only ipban IPs used by players with a lower rank.");
Player.Message(p, opname + "(" + grp.ColoredName + "%S) uses that IP.");

View File

@ -34,7 +34,7 @@ namespace MCGalaxy.Commands
if (foundBlock == Block.Zero) { Player.Message(p, "Could not find block entered"); return; }
LevelPermission newPerm = Level.PermissionFromName(message.Split(' ')[1]);
if (newPerm == LevelPermission.Null) { Player.Message(p, "Could not find rank specified"); return; }
if (p != null && newPerm > p.group.Permission) { Player.Message(p, "Cannot set to a rank higher than yourself."); return; }
if (p != null && newPerm > p.Rank) { Player.Message(p, "Cannot set to a rank higher than yourself."); return; }
if (p != null && !Block.canPlace(p, foundBlock)) { Player.Message(p, "Cannot modify a block set for a higher rank"); return; }

View File

@ -34,7 +34,7 @@ namespace MCGalaxy.Commands {
Group grp = Group.FindOrShowMatches(p, args[1]);
if (grp == null) return;
if (p != null && grp.Permission > p.group.Permission) {
if (p != null && grp.Permission > p.Rank) {
Player.Message(p, "Cannot set permissions to a rank higher than yours."); return;
}
@ -50,7 +50,7 @@ namespace MCGalaxy.Commands {
allowed.allow.Add(grp.Permission);
UpdatePermissions(cmd, p, " can now be used by " + grp.ColoredName);
} else if (args[2].CaselessEq("disallow")) {
if (p != null && p.group.Permission == grp.Permission) {
if (p != null && p.Rank == grp.Permission) {
Player.Message(p, "You cannot disallow your own rank from using a command."); return;
}

View File

@ -65,7 +65,7 @@ namespace MCGalaxy.Commands {
Player who = PlayerInfo.FindMatches(p, name);
if (who == null) return;
if (who == p) { Player.Message(p, "Cannot follow yourself."); return; }
if (who.group.Permission >= p.group.Permission) { MessageTooHighRank(p, "follow", false); return;}
if (who.Rank >= p.Rank) { MessageTooHighRank(p, "follow", false); return;}
if (who.following != "") { Player.Message(p, who.DisplayName + " is already following " + who.following); return; }
if (!p.hidden) Command.all.Find("hide").Use(p, "");

View File

@ -31,7 +31,7 @@ namespace MCGalaxy.Commands
Player who = PlayerInfo.FindMatches(p, message);
if (who == null) return;
if (p == who) { Player.Message(p, "Cannot freeze yourself."); return; }
if (p != null && who.group.Permission >= p.group.Permission) {
if (p != null && who.Rank >= p.Rank) {
MessageTooHighRank(p, "freeze", false); return;
}

View File

@ -77,10 +77,10 @@ namespace MCGalaxy.Commands {
Group grp = Group.FindOrShowMatches(p, parts[1]);
if (grp == null) return;
if (p != null && Server.ircControllerRank > p.group.Permission) {
if (p != null && Server.ircControllerRank > p.Rank) {
Player.Message(p, "Cannot change the IRC controllers rank, as it is currently a rank higher than yours."); return;
}
if (p != null && grp.Permission > p.group.Permission) {
if (p != null && grp.Permission > p.Rank) {
Player.Message(p, "Cannot set the IRC controllers rank to a rank higher than yours."); return;
}

View File

@ -39,7 +39,7 @@ namespace MCGalaxy.Commands
if (who == null) return;
if (!who.jailed) {
if (p != null &&who.group.Permission >= p.group.Permission) {
if (p != null &&who.Rank >= p.Rank) {
MessageTooHighRank(p, "jail", false); return;
}
Player.Message(p, "You jailed " + who.DisplayName);

View File

@ -37,7 +37,7 @@ namespace MCGalaxy.Commands {
Player who = PlayerInfo.FindMatches(p, message);
if (who == null) return;
if (p != null && who.group.Permission > p.group.Permission) {
if (p != null && who.Rank > p.Rank) {
MessageTooHighRank(p, "joker", true); return;
}

View File

@ -36,7 +36,7 @@ namespace MCGalaxy.Commands {
else message = "You were kicked by " + p.DisplayName + ".";
if (p != null && p == who) { Player.Message(p, "You cannot kick yourself."); return; }
if (p != null && who.group.Permission >= p.group.Permission) {
if (p != null && who.Rank >= p.Rank) {
Player.SendChatFrom(p, p.ColoredName + "%S tried to kick "
+ who.ColoredName + "%S but failed.", false);
return;

View File

@ -29,7 +29,7 @@ namespace MCGalaxy.Commands {
Player[] players = PlayerInfo.Online.Items;
foreach (Player pl in players) {
if (p == null || pl.group.Permission < p.group.Permission)
if (p == null || pl.Rank < p.Rank)
PlayerActions.ChangeMap(pl, level.name);
else
Player.Message(p, "You cannot move " + pl.ColoredName + " %Sbecause they are of equal or higher rank");

View File

@ -45,7 +45,7 @@ namespace MCGalaxy.Commands.Moderation {
Player.SendChatFrom(who, who.ColoredName + " %Swas &bun-muted", false);
Server.muted.Remove(who.name);
} else {
if (p != null && who.group.Permission >= p.group.Permission) {
if (p != null && who.Rank >= p.Rank) {
MessageTooHighRank(p, "mute", false); return;
}
who.muted = true;

View File

@ -33,12 +33,12 @@ namespace MCGalaxy.Commands
string[] args = message.Split(' ');
Player who = PlayerInfo.FindMatches(p, args[0]);
if (who == null) return;
if (who.group.Permission >= p.group.Permission) {
if (who.Rank >= p.Rank) {
MessageTooHighRank(p, "hide", false); return;
}
if (args.Length >= 2 && args[1].CaselessEq("myrank")) {
who.oHideRank = p.group.Permission;
who.oHideRank = p.Rank;
Command.all.Find("hide").Use(who, "myrank");
Player.Message(p, "Used /hide myrank on " + who.ColoredName + "%S.");
} else {

View File

@ -36,7 +36,7 @@ namespace MCGalaxy.Commands {
Player target = PlayerInfo.FindMatches(p, args[1]);
if (source == null || target == null) return;
if (p.group.Permission < source.group.Permission) {
if (p.Rank < source.group.Permission) {
MessageTooHighRank(p, "teleport", true); return;
}
Player.Message(p, "Attempting to teleport " + source.name + " to " + target.name + ".");

View File

@ -35,7 +35,7 @@ namespace MCGalaxy.Commands {
public override void Use(Player p, string message) {
if (!Directory.Exists("extra/passwords"))
Directory.CreateDirectory("extra/passwords");
if (p.group.Permission < Server.verifyadminsrank) {
if (p.Rank < 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; }

View File

@ -56,7 +56,7 @@ namespace MCGalaxy.Commands {
} else {
Player who = PlayerInfo.FindMatches(p, message);
if (who == null) return;
if (who.group.Permission >= p.group.Permission) {
if (who.Rank >= p.Rank) {
MessageTooHighRank(p, "possess", false); return;
}

View File

@ -72,7 +72,7 @@ namespace MCGalaxy.Commands {
Player[] players = PlayerInfo.Online.Items;
LevelPermission nextPerm = (LevelPermission)CommandOtherPerms.GetPerm(this, 2);
foreach (Player pl in players) {
if (pl.group.Permission >= nextPerm && Entities.CanSee(p, pl)) {
if (pl.Rank >= nextPerm && Entities.CanSee(p, pl)) {
opsOn = true; break;
}
}

View File

@ -67,7 +67,7 @@ namespace MCGalaxy.Commands.Moderation {
who.SetPrefix();
who.SendMessage("You are now ranked " + newRank.ColoredName + "%S, type /help for your new set of commands.");
who.SendUserType(Block.canPlace(who.group.Permission, Block.blackrock));
who.SendUserType(Block.canPlace(who.Rank, Block.blackrock));
Entities.SpawnEntities(who, false);
}
Server.IRC.Say(rankMsg);
@ -83,10 +83,10 @@ namespace MCGalaxy.Commands.Moderation {
if (group == banned || newRank == banned) {
Player.Message(p, "Cannot change the rank to or from \"" + banned.name + "\"."); return false;
}
if (p != null && (group.Permission >= p.group.Permission || newRank.Permission >= p.group.Permission)) {
if (p != null && (group.Permission >= p.Rank || newRank.Permission >= p.Rank)) {
MessageTooHighRank(p, "change the rank of", false); return false;
}
if (p != null && (newRank.Permission >= p.group.Permission)) {
if (p != null && (newRank.Permission >= p.Rank)) {
Player.Message(p, "Cannot change the rank of a player to a rank equal or higher to yours."); return false;
}

View File

@ -33,7 +33,7 @@ namespace MCGalaxy.Commands.Moderation {
string target = who == null ? args[0] : who.name;
if (!ValidName(p, target, "player")) return;
Group grp = who == null ? PlayerInfo.GetGroup(target) : who.group;
if (p != null && grp.Permission >= p.group.Permission) {
if (p != null && grp.Permission >= p.Rank) {
MessageTooHighRank(p, "temp ban", false); return;
}

View File

@ -74,10 +74,10 @@ namespace MCGalaxy.Commands.Moderation {
Player.Message(p, "&cYou cannot assign yourself a temporary rank."); return;
}
Group pGroup = who != null ? who.group : Group.findPlayerGroup(player);
if (p != null && pGroup.Permission >= p.group.Permission) {
if (p != null && pGroup.Permission >= p.Rank) {
Player.Message(p, "Cannot change the temporary rank of someone equal or higher to yourself."); return;
}
if (p != null && group.Permission >= p.group.Permission) {
if (p != null && group.Permission >= p.Rank) {
Player.Message(p, "Cannot change the temporary rank to a higher rank than yourself."); return;
}

View File

@ -51,7 +51,7 @@ namespace MCGalaxy.Commands {
}
void UndoOnlinePlayer(Player p, Player who, UndoArgs args, Vec3S32[] marks) {
if (p != who && who.group.Permission >= p.group.Permission) {
if (p != who && who.Rank >= p.Rank) {
MessageTooHighRank(p, "undo", false); return;
}
@ -69,7 +69,7 @@ namespace MCGalaxy.Commands {
void UndoOfflinePlayer(Player p, string whoName, UndoArgs args, Vec3S32[] marks) {
Group group = Group.findPlayerGroup(whoName);
if (group.Permission >= p.group.Permission) {
if (group.Permission >= p.Rank) {
MessageTooHighRank(p, "undo", false); return;
}

View File

@ -28,7 +28,7 @@ namespace MCGalaxy.Commands {
if (message == "" && p == null) { Help(p); return; }
Player who = message == "" ? p : PlayerInfo.FindMatches(p, message);
if (who == null) return;
if (p != null && who.group.Permission > p.group.Permission) {
if (p != null && who.Rank > p.Rank) {
MessageTooHighRank(p, "voice", true); return;
}

View File

@ -36,7 +36,7 @@ namespace MCGalaxy.Commands {
Player who = PlayerInfo.FindMatches(p, message);
if (who == null) return;
if (who.group.Permission >= p.group.Permission) {
if (who.Rank >= p.Rank) {
Player.SendChatFrom(p, p.ColoredName + " %Stried to votekick " + who.ColoredName + " %Sbut failed!", false);
return;
}

View File

@ -31,7 +31,7 @@ namespace MCGalaxy.Commands.Moderation {
if (who == null) { WarnOffline(p, args); return; }
if (who == p) { Player.Message(p, "you can't warn yourself"); return; }
if (p != null && p.group.Permission <= who.group.Permission) {
if (p != null && p.Rank <= who.Rank) {
MessageTooHighRank(p, "warn", false); return;
}

View File

@ -38,7 +38,7 @@ namespace MCGalaxy.Commands {
Player muter = PlayerInfo.FindMatches(p, args[0]);
if (muter == null) return;
if (p != null && muter.group.Permission > p.group.Permission) {
if (p != null && muter.group.Permission > p.Rank) {
MessageTooHighRank(p, "xmute", true); return;
}
if (p == muter) {

View File

@ -137,10 +137,10 @@ namespace MCGalaxy.Commands {
if (zn.Owner.Length >= 3 && zn.Owner.StartsWith("grp")) {
string grpName = zn.Owner.Substring(3);
if (p.group.Permission < Group.Find(grpName).Permission) continue;
if (p.Rank < Group.Find(grpName).Permission) continue;
} else if (zn.Owner != "" && !zn.Owner.CaselessEq(p.name)) {
Group group = Group.findPlayerGroup(zn.Owner);
if (p.group.Permission < group.Permission) continue;
if (p.Rank < group.Permission) continue;
}
LevelDB.DeleteZone(lvl.name, zn);

View File

@ -34,13 +34,13 @@ namespace MCGalaxy.Commands.World {
if (map == null) return;
Level lvl = LevelInfo.FindExact(map);
if (lvl != null && p != null && lvl.permissionbuild > p.group.Permission) {
if (lvl != null && p != null && lvl.permissionbuild > p.Rank) {
Player.Message(p, "%cYou can't delete levels with a perbuild rank higher than yours!"); return;
}
if (lvl == Server.mainLevel) { Player.Message(p, "Cannot delete the main level."); return; }
LevelPermission perbuild = GetPerBuildPermission(map);
if (p != null && perbuild > p.group.Permission) {
if (p != null && perbuild > p.Rank) {
Player.Message(p, "%cYou can't delete levels with a perbuild rank higher than yours!"); return;
}
Player.Message(p, "Created backup.");

View File

@ -56,7 +56,7 @@ namespace MCGalaxy.Commands {
if (who == null) return;
if (!who.jailed) {
if (p != null && who.group.Permission >= p.group.Permission) {
if (p != null && who.Rank >= p.Rank) {
Player.Message(p, "Cannot lock down someone of equal or greater rank."); return;
}
if (p != null && who.level != p.level) {

View File

@ -100,7 +100,7 @@ namespace MCGalaxy.Commands.World {
break;
case "overload":
if (int.Parse(message.Split(' ')[1]) < 500) { Player.Message(p, "Cannot go below 500 (default is 1500)"); return; }
if (p != null && p.group.Permission < LevelPermission.Admin && int.Parse(message.Split(' ')[1]) > 2500) { Player.Message(p, "Only SuperOPs may set higher than 2500"); return; }
if (p != null && p.Rank < LevelPermission.Admin && int.Parse(message.Split(' ')[1]) > 2500) { Player.Message(p, "Only SuperOPs may set higher than 2500"); return; }
lvl.overload = int.Parse(message.Split(' ')[1]);
lvl.ChatLevel("Physics overload: &b" + lvl.overload);
break;

View File

@ -49,7 +49,7 @@ namespace MCGalaxy.Commands.World {
}
if (p != null) {
int limit = p.group.Permission < LevelPermission.Admin ?
int limit = p.Rank < LevelPermission.Admin ?
Server.MapGenLimit : Server.MapGenLimitAdmin;
if ((long)x * y * z > limit ) {
string text = "You cannot create a map with over ";

View File

@ -40,7 +40,7 @@ namespace MCGalaxy.Commands {
} else {
Player who = PlayerInfo.FindMatches(p, parts[0]);
if (who == null) return;
if (p != null && who.group.Permission > p.group.Permission) {
if (p != null && who.Rank > p.Rank) {
MessageTooHighRank(p, "reload the map for", true); return;
}
ReloadMap(p, who, true);

View File

@ -36,7 +36,7 @@ namespace MCGalaxy.Commands.World {
Player.Message(p, "Not a valid rank"); return;
}
if (p != null && getter(level) > p.group.Permission) {
if (p != null && getter(level) > p.Rank) {
if (skipNobodyPerm || (getter(level) != LevelPermission.Nobody)) {
Player.Message(p, "You cannot change the " + target + " of a level " +
"with a " + target + " higher than your rank.");
@ -44,7 +44,7 @@ namespace MCGalaxy.Commands.World {
}
}
if (p != null && newRank > p.group.Permission) {
if (p != null && newRank > p.Rank) {
if (skipNobodyPerm || (newRank != LevelPermission.Nobody)) {
Player.Message(p, "You cannot change the " + target + " of a level " +
"to a " + target + " higher than your rank.");
@ -85,7 +85,7 @@ namespace MCGalaxy.Commands.World {
Player.Message(p, "You cannot " + mode + " yourself."); return;
}
if (p != null && getter(level) > p.group.Permission) {
if (p != null && getter(level) > p.Rank) {
Player.Message(p, "You cannot change the " + target + " " + mode +
" permissions for a player higher than your rank."); return;
}
@ -93,7 +93,7 @@ namespace MCGalaxy.Commands.World {
Player.Message(p, "You cannot change " + target + " " +
"permissions as you are blacklisted."); return;
}
if (p != null && PlayerInfo.GetGroup(name).Permission > p.group.Permission) {
if (p != null && PlayerInfo.GetGroup(name).Permission > p.Rank) {
Player.Message(p, "You cannot whitelist/blacklist players of a higher rank."); return;
}

View File

@ -67,7 +67,7 @@ namespace MCGalaxy.Commands.Building {
bool CheckCommand(Player p, string message) {
bool allCmds = CheckExtraPerm(p);
foreach (Command cmd in Command.all.commands) {
if (cmd.defaultRank <= p.group.Permission && (allCmds || !cmd.type.Contains("mod"))) continue;
if (cmd.defaultRank <= p.Rank && (allCmds || !cmd.type.Contains("mod"))) continue;
if (IsCommand(message, cmd.name)) {
p.SendMessage("You cannot use that command in a messageblock."); return false;

View File

@ -147,7 +147,7 @@ namespace MCGalaxy.Commands.Building {
bool CheckUndoPerms(Player p, Group grp) {
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, "can undo other players."); return false; }
if (grp.Permission > p.group.Permission) { MessageTooHighRank(p, "undo", true); return false; }
if (grp.Permission > p.Rank) { MessageTooHighRank(p, "undo", true); return false; }
return true;
}

View File

@ -30,7 +30,7 @@ namespace MCGalaxy.Commands
public override void Use(Player p, string message) {
if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
if (p.level.permissionbuild > p.group.Permission) {
if (p.level.permissionbuild > p.Rank) {
Player.Message(p, "You cannot build on this map!"); return;
}

View File

@ -32,7 +32,7 @@ namespace MCGalaxy.Commands {
Player.Message(p, "This command can only be used if agree-to-rules-on-entry is enabled in the console!");
return;
}
if (p.group.Permission > LevelPermission.Guest) {
if (p.Rank > LevelPermission.Guest) {
Player.Message(p, "Your awesomeness prevents you from using this command"); return;
}
p.Leave("If you don't agree with the rules, consider playing elsewhere.");

View File

@ -32,7 +32,7 @@ namespace MCGalaxy.Commands {
if (who == null || message == "") {Help(p); return; }
if (who.muted) { Player.Message(p, "Cannot impersonate a muted player"); return; }
if (p == null || p == who || p.group.Permission > who.group.Permission) {
if (p == null || p == who || p.Rank > who.Rank) {
Player.SendChatFrom(who, args[1]);
} else {
MessageTooHighRank(p, "impersonate", false); return;

View File

@ -29,7 +29,7 @@ namespace MCGalaxy.Commands {
Player who = message == "" ? p : PlayerInfo.FindMatches(p, message);
if (who == null) return;
if (p != null && who.group.Permission > p.group.Permission) {
if (p != null && who.Rank > p.Rank) {
MessageTooHighRank(p, "toggle invinciblity", true); return;
}
who.invincible = !who.invincible;

View File

@ -49,7 +49,7 @@ namespace MCGalaxy.Commands {
return;
}
if (p != null && who.group.Permission > p.group.Permission) {
if (p != null && who.Rank > p.Rank) {
p.HandleDeath(Block.rock, " was killed by " + who.ColoredName);
MessageTooHighRank(p, "kill", true); return;
}

View File

@ -47,7 +47,7 @@ namespace MCGalaxy.Commands
Player who = PlayerInfo.FindMatches(p, args[0]);
Level where = LevelInfo.FindMatches(p, args[1]);
if (who == null || where == null) return;
if (p != null && who.group.Permission > p.group.Permission) {
if (p != null && who.Rank > p.Rank) {
MessageTooHighRank(p, "move", true); return;
}
@ -65,7 +65,7 @@ namespace MCGalaxy.Commands
if (args.Length == 4) {
who = PlayerInfo.FindMatches(p, args[0]);
if (who == null) return;
if (p != null && who.group.Permission > p.group.Permission) {
if (p != null && who.Rank > p.Rank) {
MessageTooHighRank(p, "move", true); return;
}
offset = 1;

View File

@ -31,7 +31,7 @@ namespace MCGalaxy.Commands {
string[] parts = message.SplitSpaces(3);
Player target = PlayerInfo.FindMatches(p, parts[0]);
if (target == null) return;
if (p != null && p.group.Permission < target.group.Permission) {
if (p != null && p.Rank < target.group.Permission) {
MessageTooHighRank(p, "send commands for", true); return;
}
if (parts.Length == 1) {

View File

@ -36,7 +36,7 @@ namespace MCGalaxy.Commands {
if (message.CaselessEq("all")) {
Player[] players = PlayerInfo.Online.Items;
foreach (Player pl in players) {
if (pl.level == p.level && pl != p && p.group.Permission > pl.group.Permission) {
if (pl.level == p.level && pl != p && p.Rank > pl.Rank) {
pl.SendOwnHeadPos(p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0);
pl.SendMessage("You were summoned by " + p.ColoredName + "%S.");
}
@ -47,7 +47,7 @@ namespace MCGalaxy.Commands {
Player who = PlayerInfo.FindMatches(p, message);
if (who == null) return;
if (p.group.Permission < who.group.Permission) {
if (p.Rank < who.Rank) {
MessageTooHighRank(p, "summon", true); return;
}

View File

@ -66,7 +66,7 @@ namespace MCGalaxy.Commands {
Player.Message(p, target.ColoredName + " %Sis in a museum."); return false;
}
if (!Server.higherranktp && p.group.Permission < target.group.Permission) {
if (!Server.higherranktp && p.Rank < target.group.Permission) {
MessageTooHighRank(p, "teleport to", true); return false;
}

View File

@ -98,8 +98,8 @@ namespace MCGalaxy.Eco {
Thread.Sleep(250);
Level level = LevelInfo.Find(name);
if (level.permissionbuild > p.group.Permission) { level.permissionbuild = p.group.Permission; }
if (level.permissionvisit > p.group.Permission) { level.permissionvisit = p.group.Permission; }
if (level.permissionbuild > p.Rank) { level.permissionbuild = p.Rank; }
if (level.permissionvisit > p.Rank) { level.permissionvisit = p.Rank; }
PlayerActions.ChangeMap(p, name);
Player.Message(p, "%aSuccessfully created your map: '%f" + name + "%a'");

View File

@ -73,7 +73,7 @@ namespace MCGalaxy.Eco {
Player.Message(p, "%cYou cannot provide a rank name, use %a/buy rank %cto buy the NEXT rank."); return;
}
Group maxrank = Group.Find(MaxRank);
if (p.group.Permission >= maxrank.Permission) {
if (p.Rank >= maxrank.Permission) {
Player.Message(p, "%cYou cannot buy anymore ranks, because you passed the max buyable rank: " + maxrank.color + maxrank.name);
return;
}
@ -111,7 +111,7 @@ namespace MCGalaxy.Eco {
case "maximumrank":
Group grp = Group.Find(args[2]);
if (grp == null) { Player.Message(p, "%cThat wasn't a rank!"); return; }
if (p != null && p.group.Permission < grp.Permission) { Player.Message(p, "%cCan't set a maxrank that is higher than yours!"); return; }
if (p != null && p.Rank < grp.Permission) { Player.Message(p, "%cCan't set a maxrank that is higher than yours!"); return; }
MaxRank = args[2].ToLower();
Player.Message(p, "%aSuccessfully set max rank to: " + grp.ColoredName);
UpdatePrices();
@ -123,7 +123,7 @@ namespace MCGalaxy.Eco {
protected internal override void OnStoreOverview(Player p) {
Group maxrank = Group.Find(MaxRank);
if (p == null || p.group.Permission >= maxrank.Permission) {
if (p == null || p.Rank >= maxrank.Permission) {
Player.Message(p, "Rankup - &calready at max rank."); return;
}
Rank rnk = NextRank(p);

View File

@ -197,7 +197,7 @@ namespace MCGalaxy {
void Player_PlayerDisconnect(Player p, string reason) {
if (!IsConnected()) return;
if (!Server.guestLeaveNotify && p.group.Permission <= LevelPermission.Guest) return;
if (!Server.guestLeaveNotify && p.Rank <= LevelPermission.Guest) return;
string msg = p.DisplayName + " %Sleft the game (" + reason + ")";
msg = ConvertMessage(msg, true);
@ -206,7 +206,7 @@ namespace MCGalaxy {
void Player_PlayerConnect(Player p) {
if (!IsConnected()) return;
if (!Server.guestJoinNotify && p.group.Permission <= LevelPermission.Guest) return;
if (!Server.guestJoinNotify && p.Rank <= LevelPermission.Guest) return;
string msg = p.DisplayName + " %Sjoined the game";
msg = ConvertMessage(msg, true);

View File

@ -183,7 +183,7 @@ namespace MCGalaxy {
bool CheckZonePerms(Player p, ushort x, ushort y, ushort z,
ref bool AllowBuild, ref bool inZone, ref string Owners) {
if (p.group.Permission < LevelPermission.Admin) {
if (p.Rank < LevelPermission.Admin) {
bool foundDel = FindZones(p, x, y, z, ref inZone, ref AllowBuild, ref Owners);
if (!AllowBuild) {
if (p.ZoneSpam.AddSeconds(2) <= DateTime.UtcNow) {
@ -212,7 +212,7 @@ namespace MCGalaxy {
inZone = true;
if (zn.Owner.Length >= 3 && zn.Owner.StartsWith("grp")) {
string grpName = zn.Owner.Substring(3);
if (Group.Find(grpName).Permission <= p.group.Permission) {
if (Group.Find(grpName).Permission <= p.Rank) {
AllowBuild = true; break;
}
AllowBuild = false;
@ -229,7 +229,7 @@ namespace MCGalaxy {
}
bool CheckRank(Player p, bool AllowBuild, bool inZone) {
if (p.group.Permission < permissionbuild && (!inZone || !AllowBuild)) {
if (p.Rank < permissionbuild && (!inZone || !AllowBuild)) {
if (p.ZoneSpam.AddSeconds(2) <= DateTime.UtcNow) {
Player.Message(p, "Must be at least " + PermissionToName(permissionbuild) + " to build here");
p.ZoneSpam = DateTime.UtcNow;
@ -237,7 +237,7 @@ namespace MCGalaxy {
return false;
}
if (p.group.Permission > perbuildmax && (!inZone || !AllowBuild) && !p.group.CanExecute("perbuildmax")) {
if (p.Rank > perbuildmax && (!inZone || !AllowBuild) && !p.group.CanExecute("perbuildmax")) {
if (p.ZoneSpam.AddSeconds(2) <= DateTime.UtcNow) {
Player.Message(p, "Your rank must be " + perbuildmax + " or lower to build here!");
p.ZoneSpam = DateTime.UtcNow;

View File

@ -373,10 +373,10 @@ namespace MCGalaxy
}
bool whitelisted = VisitWhitelist.CaselessContains(p.name);
if (!p.ignorePermission && !whitelisted && p.group.Permission < permissionvisit) {
if (!p.ignorePermission && !whitelisted && p.Rank < permissionvisit) {
Player.Message(p, "You are not allowed to go to {0}.", name); return false;
}
if (!p.ignorePermission && !whitelisted && p.group.Permission > pervisitmax && !p.group.CanExecute("pervisitmax")) {
if (!p.ignorePermission && !whitelisted && p.Rank > pervisitmax && !p.group.CanExecute("pervisitmax")) {
Player.Message(p, "Your rank must be ranked {1} or lower to go to {0}.", name, pervisitmax); return false;
}
if (File.Exists("text/lockdown/map/" + name)) {
@ -648,7 +648,7 @@ namespace MCGalaxy
Player[] players = PlayerInfo.Online.Items;
foreach (Player pl in players) {
if (pl.level != this) continue;
if (pl.group.Permission < minPerm) continue;
if (pl.Rank < minPerm) continue;
pl.SendMessage(message);
}
}

View File

@ -173,8 +173,8 @@ namespace MCGalaxy {
/// <summary> Returns whether the given player is able to see the other player (e.g. in /who). </summary>
public static bool CanSee(Player p, Player target) {
if (p == null || !target.hidden || p == target) return true;
if (target.otherRankHidden) return p.group.Permission >= target.oHideRank;
return p.group.Permission > target.group.Permission;
if (target.otherRankHidden) return p.Rank >= target.oHideRank;
return p.Rank > target.group.Permission;
}
/// <summary> Returns whether the given player is able to see the other player as an in-game entity. </summary>
@ -186,8 +186,8 @@ namespace MCGalaxy {
&& Server.zombie.Running) return false;
if (target.Game.Invisible && !p.Game.Referee
&& Server.zombie.Running) return false;
if (target.otherRankHidden) return p.group.Permission >= target.oHideRank;
return p.group.Permission >= target.group.Permission;
if (target.otherRankHidden) return p.Rank >= target.oHideRank;
return p.Rank >= target.group.Permission;
}
/// <summary> Updates the model of the entity with the specified id to all other players. </summary>

View File

@ -283,6 +283,7 @@ namespace MCGalaxy {
public WarpList Waypoints = new WarpList(true);
public Random random = new Random();
public LevelPermission Rank { get { return group.Permission; } }
//Global Chat
public bool loggedIn;

View File

@ -397,7 +397,7 @@ namespace MCGalaxy {
if (foundGrp.Permission > LevelPermission.Guest) return true;
online = PlayerInfo.Online.Items;
int curGuests = online.Count(pl => pl.group.Permission <= LevelPermission.Guest);
int curGuests = online.Count(pl => pl.Rank <= LevelPermission.Guest);
if (curGuests < Server.maxGuests) return true;
if (Server.guestLimitNotify) Chat.GlobalMessageOps("Guest " + DisplayName + " couldn't log in - too many guests.");

View File

@ -29,7 +29,7 @@ namespace MCGalaxy {
/// <summary> Adds the given player to that player's tab list (if their client supports it). </summary>
public static void Add(Player dst, Player p, byte id) {
if (!dst.hasExtList) return;
byte grpPerm = (byte)(offset - p.group.Permission);
byte grpPerm = (byte)(offset - p.Rank);
if (!Server.TablistRankSorted) grpPerm = 0;
string name, group;