[REJECTED] command to remove drawing permissions from a user

Fixed bugs, solved problems, and old reports.
Locked
Jonty800
Offline
Posts: 280
Joined: August 21st, 2011, 6:31 am
Location: United Kingdom
Contact:

[REJECTED] command to remove drawing permissions from a user

Post by Jonty800 »

I think it'll be good to have a command that remove all drawing privileges from a user.
Maybe a hidden command for highest rank?

I think it will be a good solution to things like sphere spam without having to separate drawing commands into different permissions.

Code: Select all

public bool StopDraw;
        public bool StartDraw;
        public string StopDrawBy = "";
public bool StopDrawing(string by)
        {
            if (by == null) throw new ArgumentNullException("by");
            if (!StopDraw)
            {
                StopDraw = true;
                StopDrawBy = by;
                return true;
            }
            else
            {
                return false;
            }
        }


        public bool StartDrawing()
        {
            if (StopDraw)
            {
                StopDraw = false;
                return true;
            }
            else
            {
                return false;
            }
        }

Code: Select all

static readonly CommandDescriptor CdStopDraw = new CommandDescriptor
            {
                Name = "removedraw",
                Category = CommandCategory.Moderation,
                IsConsoleSafe = true,
                Permissions = new[] { Permission.Disconnect },
                Help = "Disables drawing commands from a seclected player.  To undo, use /allowdraw PlayerName",
                Usage = "/removedraw PlayerName",
                Handler = StopDraw
            };

            internal static void StopDraw(Player player, Command cmd)
            {
                string name = cmd.Next();
                if (name == null)
                {
                    CdStopDraw.PrintUsage(player);
                    return;
                }

                Player target = Server.FindPlayerOrPrintMatches(player, name, false);
                if (target == null) return;

                if (player.Can(Permission.Disconnect, target.Info.Rank))
                {
                    target.Info.IsHidden = false;
                    if (target.Info.StopDrawing(player.Name))
                    {
                        Server.Message("{0}&S had their drawing commands disabled by {1}",
                                          target.ClassyName, player.ClassyName);
                        
                    }
                    else
                    {
                        player.Message("{0}&s already had their drawing commands disabled", target.ClassyName);
                    }
                }
                else
                {
                    player.Message("You can only use /removedraw on players ranked {0}&S or lower",
                                    player.Info.Rank.GetLimit(Permission.Ban).ClassyName);
                    player.Message("{0}&S is ranked {1}", target.ClassyName, target.Info.Rank.ClassyName);
                }
            }

            static readonly CommandDescriptor CdStartDraw = new CommandDescriptor
            {
                Name = "allowdraw",

                Category = CommandCategory.Moderation,
                IsConsoleSafe = true,
                Permissions = new[] { Permission.Disconnect },
                Usage = "/allowdraw PlayerName",
                Help = "",
                Handler = StartDraw
            };

            internal static void StartDraw(Player player, Command cmd)
            {
                string name = cmd.Next();
                if (name == null)
                {
                    CdUnWarn.PrintUsage(player);
                    return;
                }

                Player target = Server.FindPlayerOrPrintMatches(player, name, false);
                if (target == null) return;

                if (player.Can(Permission.Disconnect, target.Info.Rank))
                {
                    if (target.Info.StartDrawing())
                    {
                        Server.Message("{0}&S had their drawing commands enabled by {1}.", target.ClassyName, player.ClassyName);
                    }
                    else
                    {
                        player.Message("{0}&S can already use drawing commands.", target.ClassyName);
                    }
                }
                else
                {
                    player.Message("You can only use /allowdraw on players ranked {0}&S or lower",
                                    player.Info.Rank.GetLimit(Permission.Ban).ClassyName);
                    player.Message("{0}&S is ranked {1}", target.ClassyName, target.Info.Rank.ClassyName);
                }
            }

Code: Select all

if (player.Info.StopDraw)
            {
                player.Message("&SYour drawing commands are disabled");
                return;
            }
also: make it so when a player is banned, they are first unfrozen to remove the blue star.
You cannot use certain BBCodes: [img].

User avatar
fragmer
fCraft Developer
Offline
Posts: 1386
Joined: May 21st, 2011, 10:53 pm

Re: A command to remove drawing permissions from a user

Post by fragmer »

I think the rank system is flexible enough without this special-purpose command :<

User avatar
cdferg
Trustee
Offline
Posts: 484
Joined: May 24th, 2011, 2:11 am

Re: A command to remove drawing permissions from a user

Post by cdferg »

Do you mean like, if I wanted to take /banall from fragmer, something like /remove banall fragmer would do the trick?
doberman411: I now know that I feel a bit of relief every time the landing gear of my plane lifts off of the runway knowing that I'm one step closer to freedom.

Jonty800
Offline
Posts: 280
Joined: August 21st, 2011, 6:31 am
Location: United Kingdom
Contact:

Re: A command to remove drawing permissions from a user

Post by Jonty800 »

It could be developed into something like that.

It was suggested by one of my admins, so I made it and forwarded on the suggestion :P
You cannot use certain BBCodes: [img].

User avatar
Sanjar Khan
Trustee
Offline
Posts: 1766
Joined: May 24th, 2011, 1:40 pm
Location: Leiden, Zuid Holland

Re: A command to remove drawing permissions from a user

Post by Sanjar Khan »

Jonty800 wrote:I think it'll be good to have a command that remove all drawing privileges from a user.
/demote Jonty800 guest "Multi-level marketing"
Jonty800 wrote: also: make it so when a player is banned, they are first unfrozen to remove the blue star.
Why, he's banned.
Ferrisbuler2: i will stay but i might not post cus of ollieboy

User avatar
fragmer
fCraft Developer
Offline
Posts: 1386
Joined: May 21st, 2011, 10:53 pm

Re: A command to remove drawing permissions from a user

Post by fragmer »

Jonty800 wrote:also: make it so when a player is banned, they are first unfrozen to remove the blue star.
I fixed that. In r918+, banned players are automatically unhidden/unmuted/unfrozen. Next time you spot a bug though, please make a separate thread in the Bugs section. Makes it easier to track fixed bugs.

User avatar
fragmer
fCraft Developer
Offline
Posts: 1386
Joined: May 21st, 2011, 10:53 pm

Re: A command to remove drawing permissions from a user

Post by fragmer »

I'm also looking into the ability to revoke individual permissions (not commands) from individual players. I'll see if there's enough demand from it.

Jonty800
Offline
Posts: 280
Joined: August 21st, 2011, 6:31 am
Location: United Kingdom
Contact:

Re: A command to remove drawing permissions from a user

Post by Jonty800 »

"Commit by fragmer :: r918 /branch-0.60x/fCraft/ (4 files in 3 dirs):
Added /st as an alias for /staff. No longer allowed to /mute for 0 seconds.
Players are not automatically unhidden, unfrozen, and unmuted on-ban. "

Thanks Fragmer :D :D
You cannot use certain BBCodes: [img].

Locked