Fix /kill (Thanks StarlightGlimmer)

This commit is contained in:
UnknownShadow200 2017-10-09 15:16:18 +11:00
parent 73caaeeebd
commit f720837e0b
11 changed files with 35 additions and 25 deletions

View File

@ -55,7 +55,7 @@ namespace MCGalaxy.Commands.Chatting {
} else {
color = Matcher.FindColor(p, colName);
if (color == null) return;
if (color == who.color) { Player.Message(p, who.DisplayName + " %Salready has that color."); return; }
if (color == who.color) { Player.Message(p, who.ColoredName + " %Salready has that color."); return; }
Chat.MessageGlobal(who, who.ColoredName + " %Shad their color changed to " + color + Colors.Name(color) + "%S.", false);
who.color = color;

View File

@ -18,6 +18,7 @@
namespace MCGalaxy.Commands.Chatting {
public sealed class CmdSay : Command {
public override string name { get { return "Say"; } }
public override string shortcut { get { return "Broadcast"; } }
public override string type { get { return CommandTypes.Chat; } }
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }

View File

@ -37,7 +37,7 @@ namespace MCGalaxy.Commands.Chatting {
} else {
color = Matcher.FindColor(p, colName);
if (color == null) return;
if (color == who.titlecolor) { Player.Message(p, who.DisplayName + " %Salready has that title color."); return; }
if (color == who.titlecolor) { Player.Message(p, who.ColoredName + " %Salready has that title color."); return; }
Chat.MessageGlobal(who, who.ColoredName + " %Shad their title color changed to " + color + Colors.Name(color) + "%S.", false);
}

View File

@ -33,7 +33,7 @@ namespace MCGalaxy.Commands.Chatting {
p.whisper = true;
p.whisperTo = who.name;
Player.Message(p, "Auto-whisper enabled. All messages will now be sent to " + who.DisplayName + ".");
Player.Message(p, "Auto-whisper enabled. All messages will now be sent to " + who.ColoredName + ".");
}
}

View File

@ -24,8 +24,8 @@ namespace MCGalaxy.Commands.Scripting {
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("PCreate", "pcreate"),
new CommandAlias("PLoad", "pload"), new CommandAlias("PUnload", "punload") }; }
get { return new[] { new CommandAlias("PLoad", "pload"), new CommandAlias("PUnload", "punload"),
new CommandAlias("PCreate", "pcreate"), new CommandAlias("PCreate", "pcreate"), }; }
}
public override bool MessageBlockRestricted { get { return true; } }

View File

@ -46,13 +46,13 @@ namespace MCGalaxy.Commands.Misc {
}
static string GetDeathMessage(string[] args, string killer, ref bool explode) {
if (args.Length < 2) return " was killed by " + killer;
if (args.Length < 2) return "@p %Swas killed by " + killer;
if (args[1].CaselessEq("explode")) {
explode = true;
return " was exploded by " + killer;
return "@p %Swas exploded by " + killer;
}
return " " + args[1];
return "@p %S" + args[1];
}
public override void Help(Player p) {

View File

@ -56,7 +56,7 @@ namespace MCGalaxy.SQL {
return new MySQLParameterisedQuery();
}
internal override ParameterisedQuery GetStaticParameterised() {
protected internal override ParameterisedQuery GetStaticParameterised() {
return queryInstance;
}
@ -65,7 +65,7 @@ namespace MCGalaxy.SQL {
return date.ToString("yyyy-MM-dd HH:mm:ss");
}
internal override void ParseCreate(ref string cmd) {
protected internal override void ParseCreate(ref string cmd) {
// MySQL does not support the format used by the SQLite backend for the primary key
const string priKey = " PRIMARY KEY AUTOINCREMENT";
int priIndex = cmd.ToUpper().IndexOf(priKey);

View File

@ -52,7 +52,7 @@ namespace MCGalaxy.SQL {
return new SQLiteParameterisedQuery();
}
internal override ParameterisedQuery GetStaticParameterised() {
protected internal override ParameterisedQuery GetStaticParameterised() {
return queryInstance;
}

View File

@ -53,11 +53,11 @@ namespace MCGalaxy.SQL {
/// <summary> Returns the shared static ParamterisedQuery instance, that is only used
/// for sql queries with no parameters. </summary>
internal abstract ParameterisedQuery GetStaticParameterised();
protected internal abstract ParameterisedQuery GetStaticParameterised();
public abstract string FastGetDateTime(IDataReader reader, int col);
internal virtual void ParseCreate(ref string cmd) { }
protected internal virtual void ParseCreate(ref string cmd) { }
// == Higher level table management functions ==

View File

@ -214,7 +214,7 @@ namespace MCGalaxy {
DataTable data = Database.Backend.GetRows("Players", "*", "WHERE Name=@0", name);
if (data.Rows.Count == 0) {
PlayerData.Create(this);
SendMessage("Welcome " + DisplayName + "! This is your first visit.");
SendMessage("Welcome " + ColoredName + "! This is your first visit.");
} else {
PlayerData.Load(data, this);
SendMessage("Welcome back " + FullName + "%S! You've been here " + TimesVisited + " times!");
@ -226,12 +226,12 @@ namespace MCGalaxy {
void CheckState() {
if (Server.muted.Contains(name)) {
muted = true;
Chat.MessageGlobal(this, DisplayName + " &cis still muted from previously.", false);
Chat.MessageGlobal(this, ColoredName + " &cis still muted from previously.", false);
}
if (Server.frozen.Contains(name)) {
frozen = true;
Chat.MessageGlobal(this, DisplayName + " &cis still frozen from previously.", false);
Chat.MessageGlobal(this, ColoredName + " &cis still frozen from previously.", false);
}
}

View File

@ -77,11 +77,22 @@ namespace MCGalaxy.Scripting {
sw.WriteLine(syntax);
}
/// <summary> Compiles a written function from source into a DLL. </summary>
/// <summary> Compiles a command from source into a DLL. </summary>
/// <param name="commandName">Name of the command file to be compiled (without the extension)</param>
/// <returns> True on successful compile, false on failure. </returns>
public bool Compile(string cmdName) {
string path = SourceDir + "Cmd" + cmdName + Ext;
if (!Directory.Exists(DllDir)) {
Directory.CreateDirectory(DllDir);
}
return Compile(SourceDir + "Cmd" + cmdName, DllDir + "Cmd" + cmdName);
}
/// <summary> Compiles a written function from source into a DLL. </summary>
/// <param name="baseName"> Path to file to be compiled (**without** the extension) </param>
/// <param name="baseOutName"> Path of file to be compiled to (**without** the extension) </param>
/// <returns> True on successful compile, false on failure. </returns>
public bool Compile(string baseName, string baseOutName) {
string path = baseName + Ext;
StringBuilder sb = null;
bool exists = File.Exists(ErrorPath);
@ -89,18 +100,15 @@ namespace MCGalaxy.Scripting {
sb = new StringBuilder();
using (StreamWriter w = new StreamWriter(ErrorPath, exists)) {
AppendDivider(sb, exists);
sb.AppendLine("File not found: Cmd" + cmdName + ".cs");
sb.AppendLine("File not found: " + path);
w.Write(sb.ToString());
}
return false;
}
if (!Directory.Exists(DllDir))
Directory.CreateDirectory(DllDir);
CompilerParameters args = new CompilerParameters();
args.GenerateExecutable = false;
args.MainClass = cmdName;
args.OutputAssembly = DllDir + "Cmd" + cmdName + ".dll";
args.OutputAssembly = baseOutName + ".dll";
string source = ReadSourceCode(path, args);
results = CompileSource(source, args);
@ -116,8 +124,9 @@ namespace MCGalaxy.Scripting {
sb.AppendLine("Line: " + err.Line);
first = false;
}
using (StreamWriter w = new StreamWriter(ErrorPath, exists))
using (StreamWriter w = new StreamWriter(ErrorPath, exists)) {
w.Write(sb.ToString());
}
return false;
}