From 1994bed8691e917d42d0176d994622fa5f27c94a Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 27 Feb 2018 13:00:48 +1100 Subject: [PATCH] Make /zone set alpha more intuitive, add help for /zone set --- MCGalaxy/Commands/Alias.cs | 2 +- MCGalaxy/Commands/Bots/CmdBot.cs | 4 +-- MCGalaxy/Commands/Command.cs | 4 +-- MCGalaxy/Commands/Moderation/ZoneCmds.cs | 39 +++++++++++++++--------- MCGalaxy/Commands/World/CmdOverseer.cs | 10 +++--- MCGalaxy/Commands/other/CmdFakerank.cs | 2 +- MCGalaxy/CorePlugin/ModActionHandler.cs | 2 +- MCGalaxy/Plugins/Plugin.cs | 4 +-- MCGalaxy/Scripting/Backends.cs | 8 ++--- 9 files changed, 43 insertions(+), 32 deletions(-) diff --git a/MCGalaxy/Commands/Alias.cs b/MCGalaxy/Commands/Alias.cs index c350c0231..d99be9fa0 100644 --- a/MCGalaxy/Commands/Alias.cs +++ b/MCGalaxy/Commands/Alias.cs @@ -64,7 +64,7 @@ namespace MCGalaxy.Commands { using (StreamWriter sw = new StreamWriter(Paths.AliasesFile)) { sw.WriteLine("# The format goes trigger : command"); sw.WriteLine("# For example, \"y : help me\" means that when /y is typed,"); - sw.WriteLine("# it is treated as /help me ."); + sw.WriteLine("# it is treated as /Help me ."); foreach (Alias a in aliases) { if (a.Prefix == null) { diff --git a/MCGalaxy/Commands/Bots/CmdBot.cs b/MCGalaxy/Commands/Bots/CmdBot.cs index 44b206b71..4519c7b6c 100644 --- a/MCGalaxy/Commands/Bots/CmdBot.cs +++ b/MCGalaxy/Commands/Bots/CmdBot.cs @@ -155,11 +155,11 @@ namespace MCGalaxy.Commands.Bots { Player.Message(p, "%H If [name] is \"all\", removes all bots on your map"); Player.Message(p, "%T/Bot text [name] "); Player.Message(p, "%HSets the text shown when a player clicks on this bot"); - Player.Message(p, "%HSee %T/help mb %Hfor more details on "); + Player.Message(p, "%HSee %T/Help mb %Hfor more details on "); Player.Message(p, "%T/Bot deathmessage [name] "); Player.Message(p, "%HSets the message shown when this bot kills a player"); Player.Message(p, "%T/Bot rename [name] [new name] %H- Renames a bot"); - Player.Message(p, "%H Note: To only change name tag of a bot, use %T/nick bot"); + Player.Message(p, "%H Note: To only change name tag of a bot, use %T/Nick bot"); } } } diff --git a/MCGalaxy/Commands/Command.cs b/MCGalaxy/Commands/Command.cs index 12ef7e9ed..ee146e722 100644 --- a/MCGalaxy/Commands/Command.cs +++ b/MCGalaxy/Commands/Command.cs @@ -35,10 +35,10 @@ namespace MCGalaxy { public virtual LevelPermission defaultRank { get { return LevelPermission.Guest; } } /// Executes this command. public abstract void Use(Player p, string message); - /// Outputs usage information about this command, for when a user does /help [command]. + /// Outputs usage information about this command, for when a user does /Help [command]. public abstract void Help(Player p); - /// Outputs further usage information about this command, for when a user does /help [command] [message]. + /// Outputs further usage information about this command, for when a user does /Help [command] [message]. /// Defaults to just calling Help(p). public virtual void Help(Player p, string message) { Help(p); Formatter.PrintCommandInfo(p, this); } /// Extra permissions required to use certain aspects of this command. diff --git a/MCGalaxy/Commands/Moderation/ZoneCmds.cs b/MCGalaxy/Commands/Moderation/ZoneCmds.cs index 99104ec94..8c68c0b34 100644 --- a/MCGalaxy/Commands/Moderation/ZoneCmds.cs +++ b/MCGalaxy/Commands/Moderation/ZoneCmds.cs @@ -111,29 +111,32 @@ namespace MCGalaxy.Commands.Moderation { void SetZoneProp(Player p, string[] args, Zone zone) { ColorDesc desc = default(ColorDesc); - string opt = args[2], value = args[3]; + if (args.Length < 4) { + Player.Message(p, "No value provided. See %T/Help zone properties"); + return; + } + string opt = args[2], value = args[3]; Predicate selector = pl => pl.ZoneIn == zone; - if (opt.CaselessEq("col")) { + if (opt.CaselessEq("alpha")) { + float alpha = 0; + if (!CommandParser.GetReal(p, value, "Alpha", ref alpha, 0, 1)) return; + + zone.UnshowAll(p.level); + zone.Config.ShowAlpha = (byte)(alpha * 255); + zone.ShowAll(p.level); + } else if (opt.CaselessEq("col")) { if (!CommandParser.GetHex(p, value, ref desc)) return; zone.Config.ShowColor = value; zone.ShowAll(p.level); - } else if (opt.CaselessEq("alpha")) { - byte alpha = 0; - if (!CommandParser.GetByte(p, value, "Alpha", ref alpha)) return; - - zone.UnshowAll(p.level); - zone.Config.ShowAlpha = alpha; - zone.ShowAll(p.level); } else if (opt.CaselessEq("motd")) { zone.Config.MOTD = value; OnChangedZone(zone); } else if (CmdEnvironment.Handle(p, selector, opt, value, zone.Config, "zone " + zone.ColoredName)) { OnChangedZone(zone); - } else { - Player.Message(p, "?????"); - return; + } else { + Help(p, "properties"); return; } p.level.Save(true); } @@ -154,12 +157,20 @@ namespace MCGalaxy.Commands.Moderation { Player.Message(p, "%HSets build permissions for the given zone"); Player.Message(p, "%H For syntax of permissions, see %T/Help PerBuild"); Player.Message(p, "%T/Zone set [property] [value]"); - Player.Message(p, "%HSets a property of this zone. See %T/help zone properties"); + Player.Message(p, "%HSets a property of this zone. See %T/Help zone properties"); } public override void Help(Player p, string message) { if (message.CaselessEq("properties")) { - + Player.Message(p, "%T/Zone set alpha [value]"); + Player.Message(p, "%HSets how solid the box shown around the zone is"); + Player.Message(p, "%H0 - not shown at all, 0.5 - half solid, 1 - fully solid"); + Player.Message(p, "%T/Zone set color [hex color]"); + Player.Message(p, "%HSets the color of the box shown around the zone"); + Player.Message(p, "%T/Zone set motd [value]"); + Player.Message(p, "%HSets the MOTD applied when in the zone. See %T/Help map motd"); + Player.Message(p, "%T/Zone set [env property] [value]"); + Player.Message(p, "%HSets an env setting applied when in the zone. See %T/Help env"); } else { base.Help(p, message); } diff --git a/MCGalaxy/Commands/World/CmdOverseer.cs b/MCGalaxy/Commands/World/CmdOverseer.cs index d1fe11c39..09a5f0f23 100644 --- a/MCGalaxy/Commands/World/CmdOverseer.cs +++ b/MCGalaxy/Commands/World/CmdOverseer.cs @@ -64,7 +64,7 @@ namespace MCGalaxy.Commands.World { Player.Message(p, "%T/os [command] [args]"); Player.Message(p, "%HAllows you to modify and manage your personal realms."); Player.Message(p, "%HCommands: %S{0}", subCommands.Keys.Join()); - Player.Message(p, "%HType %T/help os [command] %Hfor more details"); + Player.Message(p, "%HType %T/Help os [command] %Hfor more details"); } @@ -125,7 +125,7 @@ namespace MCGalaxy.Commands.World { static string[] blockPropsHelp = new string[] { "%T/os blockprops [id] [action] %H- Manages properties for custom blocks on your map.", - "%H See %T/help blockprops %Hfor a list of actions", + "%H See %T/Help blockprops %Hfor a list of actions", }; static string[] envHelp = new string[] { @@ -155,13 +155,13 @@ namespace MCGalaxy.Commands.World { static string[] levelBlockHelp = new string[] { "%T/os lb [action] %H- Manages custom blocks on your map.", - "%H See %T/help lb %Hfor a list of actions", + "%H See %T/Help lb %Hfor a list of actions", }; static string[] mapHelp = new string[] { "%T/os map add [type - default is flat] %H- Creates your map (128x64x128)", "%T/os map add [width] [height] [length] [type]", - "%H See %T/help newlvl types %Hfor a list of map types.", + "%H See %T/Help newlvl types %Hfor a list of map types.", "%T/os map physics [level] %H- Sets the physics on your map.", "%T/os map delete %H- Deletes your map", "%T/os map restore [num] %H- Restores backup [num] of your map", @@ -172,7 +172,7 @@ namespace MCGalaxy.Commands.World { "%T/os map texture [url] %H- Sets terrain.png for your map", "%T/os map texturepack [url] %H- Sets texture pack .zip for your map", "%T/os map [option] %H- Toggles that map option.", - "%H See %T/help map %Hfor a list of map options", + "%H See %T/Help map %Hfor a list of map options", }; static string[] presetHelp = new string[] { diff --git a/MCGalaxy/Commands/other/CmdFakerank.cs b/MCGalaxy/Commands/other/CmdFakerank.cs index ae27d39e5..fab5b7f0c 100644 --- a/MCGalaxy/Commands/other/CmdFakerank.cs +++ b/MCGalaxy/Commands/other/CmdFakerank.cs @@ -45,7 +45,7 @@ namespace MCGalaxy.Commands.Misc { string rankMsg = who.ColoredName + direction + newRank.ColoredName + "%S. (" + reason + "%S)"; Chat.MessageGlobal(rankMsg); - Player.Message(who, "You are now ranked {0}%S, type /help for your new set of commands.", + Player.Message(who, "You are now ranked {0}%S, type /Help for your new set of commands.", newRank.ColoredName); } diff --git a/MCGalaxy/CorePlugin/ModActionHandler.cs b/MCGalaxy/CorePlugin/ModActionHandler.cs index 6d597fba1..055460940 100644 --- a/MCGalaxy/CorePlugin/ModActionHandler.cs +++ b/MCGalaxy/CorePlugin/ModActionHandler.cs @@ -197,7 +197,7 @@ namespace MCGalaxy.Core { LogAction(e, who, action + newRank.ColoredName); if (who != null) { - who.SendMessage("You are now ranked " + newRank.ColoredName + "%S, type /help for your new set of commands."); + who.SendMessage("You are now ranked " + newRank.ColoredName + "%S, type /Help for your new set of commands."); } if (Server.tempRanks.Remove(e.Target)) { ModerationTasks.TemprankCalcNextRun(); diff --git a/MCGalaxy/Plugins/Plugin.cs b/MCGalaxy/Plugins/Plugin.cs index 5df10e9c1..0e67b407e 100644 --- a/MCGalaxy/Plugins/Plugin.cs +++ b/MCGalaxy/Plugins/Plugin.cs @@ -39,8 +39,8 @@ namespace MCGalaxy { /// True if plugin is being auto unloaded due to server shutting down, false if manually. public abstract void Unload(bool shutdown); - /// Called when a player does /help on the plugin. Typically, shows to the player what this plugin is about. - /// Player who is doing /help. + /// 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. diff --git a/MCGalaxy/Scripting/Backends.cs b/MCGalaxy/Scripting/Backends.cs index 0d46bef48..3b0bbe281 100644 --- a/MCGalaxy/Scripting/Backends.cs +++ b/MCGalaxy/Scripting/Backends.cs @@ -48,7 +48,7 @@ namespace MCGalaxy \t\t// Command's shortcut (please take care not to use an existing one, or you may have issues.) \t\tpublic override string shortcut {{ get {{ return """"; }} }} -\t\t// Determines which submenu this command displays in under /help. +\t\t// Determines which submenu this command displays in under /Help. \t\tpublic override string type {{ get {{ return ""other""; }} }} \t\t// Determines whether or not this command can be used in a museum. Block/map altering commands should be made false to avoid errors. @@ -66,7 +66,7 @@ namespace MCGalaxy \t\t\tPlayer.Message(p, ""Hello World!""); \t\t}} -\t\t// This one controls what happens when you use /help [commandname]. +\t\t// This one controls what happens when you use /Help [commandname]. \t\tpublic override void Help(Player p) \t\t{{ \t\t\tPlayer.Message(p, ""/{1} - Does stuff. Example command.""); @@ -113,7 +113,7 @@ Namespace MCGalaxy \t\t\tEnd Get \t\tEnd Property -' Determines which submenu this command displays in under /help. +' Determines which submenu this command displays in under /Help. \t\tPublic Overrides ReadOnly Property type() As String \t\t\tGet \t\t\t\tReturn ""other"" @@ -142,7 +142,7 @@ Namespace MCGalaxy \t\t\tPlayer.Message(p, ""Hello World!"") \t\tEnd Sub -' This one controls what happens when you use /help [commandname]. +' This one controls what happens when you use /Help [commandname]. \t\tPublic Overrides Sub Help(p As Player) \t\t\tPlayer.Message(p, ""/{1} - Does stuff. Example command."")