diff --git a/MCGalaxy/Commands/Fun/ZombieSurvival/CmdAlive.cs b/MCGalaxy/Commands/Fun/ZombieSurvival/CmdAlive.cs index ee4cef3c6..782979a79 100644 --- a/MCGalaxy/Commands/Fun/ZombieSurvival/CmdAlive.cs +++ b/MCGalaxy/Commands/Fun/ZombieSurvival/CmdAlive.cs @@ -28,7 +28,7 @@ namespace MCGalaxy.Commands.Fun { if (alive.Length == 0) { Player.Message(p, "No one is alive."); return; } Player.Message(p, "Players who are &2alive %Sare:"); - Player.Message(p, alive.Join(pl => pl.ColoredName + "%S")); + Player.Message(p, alive.Join(pl => pl.ColoredName)); } public override void Help(Player p) { diff --git a/MCGalaxy/Commands/Scripting/CmdScripting.cs b/MCGalaxy/Commands/Scripting/CmdPlugin.cs similarity index 78% rename from MCGalaxy/Commands/Scripting/CmdScripting.cs rename to MCGalaxy/Commands/Scripting/CmdPlugin.cs index 93c4cb121..229b3c4f6 100644 --- a/MCGalaxy/Commands/Scripting/CmdScripting.cs +++ b/MCGalaxy/Commands/Scripting/CmdPlugin.cs @@ -20,28 +20,34 @@ using System.IO; using MCGalaxy.Scripting; namespace MCGalaxy.Commands.Scripting { - public sealed class CmdScripting : Command { - public override string name { get { return "Scripting"; } } + public sealed class CmdPlugin : Command { + public override string name { get { return "Plugin"; } } public override string type { get { return CommandTypes.Other; } } public override LevelPermission defaultRank { get { return LevelPermission.Nobody; } } public override CommandAlias[] Aliases { - get { return new[] { new CommandAlias("PLoad", "pload"), new CommandAlias("PUnload", "punload"), - new CommandAlias("PCreate", "pcreate"), new CommandAlias("PCompile", "pcompile") }; } + get { return new[] { new CommandAlias("PLoad", "load"), new CommandAlias("PUnload", "unload"), + new CommandAlias("PCreate", "create"), new CommandAlias("PCompile", "compile"), + new CommandAlias("Plugins", "list") }; } } public override bool MessageBlockRestricted { get { return true; } } - public override void Use(Player p, string message) { + public override void Use(Player p, string message) { + if (message.CaselessEq("list")) { + Player.Message(p, "Loaded plugins: " + Plugin.all.Join(pl => pl.name)); + return; + } + string[] parts = message.SplitSpaces(2); if (parts.Length == 1) { Help(p); return; } if (!Formatter.ValidName(p, parts[1], "plugin")) return; - if (parts[0].CaselessEq("pload")) { + if (parts[0].CaselessEq("load")) { LoadPlugin(p, parts[1]); - } else if (parts[0].CaselessEq("punload")) { + } else if (parts[0].CaselessEq("unload")) { UnloadPlugin(p, parts[1]); - } else if (parts[0].CaselessEq("pcreate")) { + } else if (parts[0].CaselessEq("create")) { CreatePlugin(p, parts[1]); - } else if (parts[0].CaselessEq("pcompile")) { + } else if (parts[0].CaselessEq("compile")) { CompilePlugin(p, parts[1]); } else { Help(p); @@ -126,14 +132,16 @@ namespace MCGalaxy }}"; public override void Help(Player p) { - Player.Message(p, "%T/Scripting pcreate [name]"); + Player.Message(p, "%T/Plugin create [name]"); Player.Message(p, "%HCreate a example .cs plugin file"); - Player.Message(p, "%T/Scripting pcompile [name]"); + Player.Message(p, "%T/Plugin compile [name]"); Player.Message(p, "%HCompiles a .cs plugin file"); - Player.Message(p, "%T/Scripting pload [filename]"); + Player.Message(p, "%T/Plugin load [filename]"); Player.Message(p, "%HLoad a plugin from your plugins folder"); - Player.Message(p, "%T/Scripting punload [name]"); + Player.Message(p, "%T/Plugin unload [name]"); Player.Message(p, "%HUnloads a currently loaded plugin"); + Player.Message(p, "%T/Plugin list"); + Player.Message(p, "%HLists all loaded plugins"); } } } diff --git a/MCGalaxy/MCGalaxy_.csproj b/MCGalaxy/MCGalaxy_.csproj index 3c7a02da6..90cec692d 100644 --- a/MCGalaxy/MCGalaxy_.csproj +++ b/MCGalaxy/MCGalaxy_.csproj @@ -353,7 +353,7 @@ - + diff --git a/MCGalaxy/Plugins/Plugin.cs b/MCGalaxy/Plugins/Plugin.cs index cdc3dc650..5df10e9c1 100644 --- a/MCGalaxy/Plugins/Plugin.cs +++ b/MCGalaxy/Plugins/Plugin.cs @@ -31,60 +31,43 @@ namespace MCGalaxy { /// This class provides for more advanced modification to MCGalaxy public abstract partial class Plugin { - /// Use this to load all your events and everything you need. - /// True if this was used from the server startup and not loaded from the command. + /// Hooks into events and initalises states/resources etc + /// True if plugin is being auto loaded due to server starting up, false if manually. public abstract void Load(bool startup); - /// Use this method to dispose of everything you used. - /// True if this was used by the server shutting down and not a command. + /// Unhooks from events and disposes of state/resources etc + /// True if plugin is being auto unloaded due to server shutting down, false if manually. public abstract void Unload(bool shutdown); - /// This method is runned when a player does /help - /// Use it to show player's what this command is about. - /// Player who runned this command. + /// Called when a player does /help on the plugin. Typically, shows to the player what this plugin is about. + /// Player who is doing /help. public abstract void Help(Player p); /// Name of the plugin. - public abstract string name { get; } - + public abstract string name { get; } /// Your website. - public abstract string website { get; } - + public abstract string website { get; } /// Oldest version of MCGalaxy the plugin is compatible with. - public abstract string MCGalaxy_Version { get; } - + public abstract string MCGalaxy_Version { get; } /// Version of your plugin. - public abstract int build { get; } - + public abstract int build { get; } /// Message to display once plugin is loaded. - public abstract string welcome { get; } - + public abstract string welcome { get; } /// The creator/author of this plugin. (Your name) - public abstract string creator { get; } - - /// Whether or not to load this plugin at startup. + public abstract string creator { get; } + /// Whether or not to auto load this plugin on server startup. public abstract bool LoadAtStartup { get; } } public abstract class Plugin_Simple : Plugin { - - /// This method is runned when a player does /help - /// Use it to show player's what this command is about. - /// Player who runned this command. + public override void Help(Player p) { Player.Message(p, "No help is available for this plugin."); } - /// Your website. public override string website { get { return "http://www.example.org"; } } - - /// Version of your plugin. public override int build { get { return 0; } } - - /// Message to display once plugin is loaded. public override string welcome { get { return "Plugin " + name + " loaded."; } } - - /// Whether or not to load this plugin at startup. public override bool LoadAtStartup { get { return true; } } } }