mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-10-04 02:52:21 -04:00
Plugin.Load should take path instead of name
This commit is contained in:
parent
3aac7112c9
commit
6b83f56b1e
@ -71,7 +71,7 @@ namespace MCGalaxy.Commands.Scripting {
|
||||
static void LoadPlugin(Player p, string name) {
|
||||
string path = IScripting.PluginPath(name);
|
||||
if (File.Exists(path)) {
|
||||
if (Plugin.Load(name, false)) {
|
||||
if (Plugin.Load(path, false)) {
|
||||
p.Message("Plugin loaded successfully.");
|
||||
} else {
|
||||
p.Message("%WError loading plugin. See error logs for more information.");
|
||||
|
@ -28,12 +28,10 @@ namespace MCGalaxy {
|
||||
internal static List<Plugin> core = new List<Plugin>();
|
||||
public static List<Plugin> all = new List<Plugin>();
|
||||
|
||||
/// <summary> Loads all plugins from the given plugin .dll name. </summary>
|
||||
public static bool Load(string name, bool startup) {
|
||||
string path = IScripting.PluginPath(name);
|
||||
|
||||
/// <summary> Loads all plugins from the given path. </summary>
|
||||
public static bool Load(string path, bool startup) {
|
||||
try {
|
||||
byte[] data = File.ReadAllBytes(path);
|
||||
byte[] data = File.ReadAllBytes(path);
|
||||
Assembly lib = Assembly.Load(data);
|
||||
List<Plugin> plugins = IScripting.LoadTypes<Plugin>(lib);
|
||||
|
||||
@ -97,10 +95,8 @@ namespace MCGalaxy {
|
||||
LoadCorePlugin(new NotesPlugin());
|
||||
|
||||
if (Directory.Exists("plugins")) {
|
||||
foreach (string path in Directory.GetFiles("plugins", "*.dll")) {
|
||||
string name = Path.GetFileNameWithoutExtension(path);
|
||||
Load(name, true);
|
||||
}
|
||||
string[] files = Directory.GetFiles("plugins", "*.dll");
|
||||
foreach (string path in files) { Load(path, true); }
|
||||
} else {
|
||||
Directory.CreateDirectory("plugins");
|
||||
}
|
||||
|
@ -17,8 +17,6 @@
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using MCGalaxy.Games;
|
||||
using MCGalaxy.Network;
|
||||
using MCGalaxy.Tasks;
|
||||
|
||||
@ -35,7 +33,6 @@ namespace MCGalaxy {
|
||||
public static ServerConfig Config = new ServerConfig();
|
||||
|
||||
public static IRCBot IRC;
|
||||
public static Thread locationChecker;
|
||||
public static DateTime StartTime;
|
||||
|
||||
public static PlayerExtList AutoloadMaps;
|
||||
|
Loading…
x
Reference in New Issue
Block a user