Skip to content

Commit

Permalink
Create DisableCommands.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
ddinan authored Nov 20, 2023
1 parent a083258 commit ee7a711
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions MCGalaxy/Plugins/DisableCommands.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// NOTE: If you have other plugins that add commands, you should probably rename this file to something along the lines of 'zzDisableCommands' so those are disabled as well.

using System;
using System.Collections.Generic;

namespace MCGalaxy
{
public class DisableCommands : Plugin
{
public override string name { get { return "DisableCommands"; } }
public override string MCGalaxy_Version { get { return "1.9.4.9"; } }
public override string creator { get { return "Venk"; } }

public override void Load(bool startup)
{
List<string> commandsToKeep = new List<string> { "help", "commands", "compile", "plugin", "restart", }; // Add all commands you wish to keep
List<Command> commandsToRemove = new List<Command>();

foreach (Command cmd in Command.allCmds)
{
if (commandsToKeep.Contains(cmd.name.ToLower())) continue;
commandsToRemove.Add(cmd);
}

foreach (Command cmd in commandsToRemove) Command.Unregister(cmd);
}

public override void Unload(bool shutdown)
{
}

public override void Help(Player p)
{
}
}
}

0 comments on commit ee7a711

Please sign in to comment.