mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-26 06:43:25 -04:00
Core: Fix autoload commands for unix, where file names are case sensitive
also make all the scripting commands Nobody by default.
This commit is contained in:
parent
c794c5dfe4
commit
44ed2fd088
@ -24,7 +24,7 @@ namespace MCGalaxy.Commands {
|
||||
public override string shortcut { get { return ""; } }
|
||||
public override string type { get { return CommandTypes.Other; } }
|
||||
public override bool museumUsable { get { return true; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Admin; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Nobody; } }
|
||||
public CmdCmdCreate() { }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
|
@ -24,7 +24,7 @@ namespace MCGalaxy.Commands {
|
||||
public override string shortcut { get { return ""; } }
|
||||
public override string type { get { return CommandTypes.Other; } }
|
||||
public override bool museumUsable { get { return true; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Admin; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Nobody; } }
|
||||
public CmdCompile() { }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
|
@ -22,7 +22,7 @@ namespace MCGalaxy.Commands
|
||||
public override string name { get { return "compload"; } }
|
||||
public override string shortcut { get { return "cml"; } }
|
||||
public override string type { get { return CommandTypes.Other; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Admin; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Nobody; } }
|
||||
public override bool museumUsable { get { return true; } }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
|
@ -137,11 +137,11 @@ namespace MCGalaxy {
|
||||
if (!File.Exists(AutoloadFile)) { File.Create(AutoloadFile); return; }
|
||||
string[] list = File.ReadAllLines(AutoloadFile);
|
||||
|
||||
foreach (string cmd in list) {
|
||||
if (cmd == "") continue;
|
||||
string error = Scripting.Load("Cmd" + cmd.ToLower());
|
||||
foreach (string cmdName in list) {
|
||||
if (cmdName == "") continue;
|
||||
string error = Scripting.Load("Cmd" + cmdName);
|
||||
if (error != null) { Server.s.Log(error); continue; }
|
||||
Server.s.Log("AUTOLOAD: Loaded " + cmd.ToLower() + ".dll");
|
||||
Server.s.Log("AUTOLOAD: Loaded Cmd" + cmdName + ".dll");
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,8 +149,7 @@ namespace MCGalaxy {
|
||||
/// <param name="command">Name of the command to be loaded (make sure it's prefixed by Cmd before bringing it in here or you'll have problems).</param>
|
||||
/// <returns>Error string on failure, null on success.</returns>
|
||||
public static string Load(string command) {
|
||||
if (command.Length < 3 || command.Substring(0, 3).ToLower() != "cmd")
|
||||
return "Invalid command name specified.";
|
||||
if (!command.CaselessStarts("cmd")) return "Invalid command name specified.";
|
||||
try {
|
||||
byte[] data = File.ReadAllBytes(DllDir + command + ".dll");
|
||||
Assembly lib = Assembly.Load(data); // TODO: Assembly.LoadFile instead?
|
||||
|
Loading…
x
Reference in New Issue
Block a user