Make /zone set alpha more intuitive, add help for /zone set

This commit is contained in:
UnknownShadow200 2018-02-27 13:00:48 +11:00
parent dd207a7682
commit 1994bed869
9 changed files with 43 additions and 32 deletions

View File

@ -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 <args given by user>.");
sw.WriteLine("# it is treated as /Help me <args given by user>.");
foreach (Alias a in aliases) {
if (a.Prefix == null) {

View File

@ -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] <text>");
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 <text>");
Player.Message(p, "%HSee %T/Help mb %Hfor more details on <text>");
Player.Message(p, "%T/Bot deathmessage [name] <message>");
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");
}
}
}

View File

@ -35,10 +35,10 @@ namespace MCGalaxy {
public virtual LevelPermission defaultRank { get { return LevelPermission.Guest; } }
/// <summary> Executes this command. </summary>
public abstract void Use(Player p, string message);
/// <summary> Outputs usage information about this command, for when a user does /help [command]. </summary>
/// <summary> Outputs usage information about this command, for when a user does /Help [command]. </summary>
public abstract void Help(Player p);
/// <summary> Outputs further usage information about this command, for when a user does /help [command] [message]. </summary>
/// <summary> Outputs further usage information about this command, for when a user does /Help [command] [message]. </summary>
/// <remarks> Defaults to just calling Help(p). </remarks>
public virtual void Help(Player p, string message) { Help(p); Formatter.PrintCommandInfo(p, this); }
/// <summary> Extra permissions required to use certain aspects of this command. </summary>

View File

@ -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<Player> 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;
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);
}

View File

@ -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] <args> %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] <args> %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] <value> %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[] {

View File

@ -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);
}

View File

@ -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();

View File

@ -39,8 +39,8 @@ namespace MCGalaxy {
/// <param name="shutdown"> True if plugin is being auto unloaded due to server shutting down, false if manually. </param>
public abstract void Unload(bool shutdown);
/// <summary> Called when a player does /help on the plugin. Typically, shows to the player what this plugin is about. </summary>
/// <param name="p"> Player who is doing /help. </param>
/// <summary> Called when a player does /Help on the plugin. Typically, shows to the player what this plugin is about. </summary>
/// <param name="p"> Player who is doing /Help. </param>
public abstract void Help(Player p);
/// <summary> Name of the plugin. </summary>

View File

@ -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."")