mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
Make compiling module a proper plugin
This commit is contained in:
parent
9dead7961b
commit
7f7cf7cb52
@ -21,7 +21,7 @@ using MCGalaxy.Commands;
|
||||
|
||||
namespace MCGalaxy.Modules.Compiling
|
||||
{
|
||||
public sealed class CmdCmdCreate : CmdCompile
|
||||
sealed class CmdCmdCreate : CmdCompile
|
||||
{
|
||||
public override string name { get { return "CmdCreate"; } }
|
||||
public override string shortcut { get { return ""; } }
|
||||
|
@ -22,7 +22,7 @@ using MCGalaxy.Scripting;
|
||||
|
||||
namespace MCGalaxy.Modules.Compiling
|
||||
{
|
||||
public class CmdCompile : Command2
|
||||
class CmdCompile : Command2
|
||||
{
|
||||
public override string name { get { return "Compile"; } }
|
||||
public override string type { get { return CommandTypes.Other; } }
|
||||
|
@ -21,7 +21,7 @@ using MCGalaxy.Scripting;
|
||||
|
||||
namespace MCGalaxy.Modules.Compiling
|
||||
{
|
||||
public sealed class CmdCompLoad : CmdCompile
|
||||
sealed class CmdCompLoad : CmdCompile
|
||||
{
|
||||
public override string name { get { return "CompLoad"; } }
|
||||
public override string shortcut { get { return "cml"; } }
|
||||
|
44
MCGalaxy/Modules/Compiling/CompilerPlugin.cs
Normal file
44
MCGalaxy/Modules/Compiling/CompilerPlugin.cs
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
Copyright 2015 MCGalaxy
|
||||
|
||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||
not use this file except in compliance with the Licenses. You may
|
||||
obtain a copy of the Licenses at
|
||||
|
||||
https://opensource.org/license/ecl-2-0/
|
||||
https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licenses are distributed on an "AS IS"
|
||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
#if !MCG_STANDALONE
|
||||
using System;
|
||||
|
||||
namespace MCGalaxy.Modules.Compiling
|
||||
{
|
||||
public sealed class CompilerPlugin : Plugin
|
||||
{
|
||||
public override string name { get { return "Compiler"; } }
|
||||
|
||||
Command cmdCreate = new CmdCmdCreate();
|
||||
Command cmdCompile = new CmdCompile();
|
||||
Command cmdCompLoad = new CmdCompLoad();
|
||||
|
||||
public override void Load(bool startup) {
|
||||
Server.EnsureDirectoryExists(ICompiler.COMMANDS_SOURCE_DIR);
|
||||
|
||||
Command.Register(cmdCreate);
|
||||
Command.Register(cmdCompile);
|
||||
Command.Register(cmdCompLoad);
|
||||
}
|
||||
|
||||
public override void Unload(bool shutdown) {
|
||||
Command.Unregister(cmdCreate, cmdCompile, cmdCompLoad);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@ -93,6 +93,8 @@ namespace MCGalaxy.Modules.Relay.Discord
|
||||
public static DiscordBot Bot = new DiscordBot();
|
||||
|
||||
public override void Load(bool startup) {
|
||||
Server.EnsureDirectoryExists("text/discord");
|
||||
|
||||
Bot.Config = Config;
|
||||
Bot.ReloadConfig();
|
||||
Bot.Connect();
|
||||
|
@ -137,8 +137,12 @@ namespace MCGalaxy
|
||||
LoadCorePlugin(new NotesPlugin());
|
||||
LoadCorePlugin(new DiscordPlugin());
|
||||
LoadCorePlugin(new IRCPlugin());
|
||||
LoadCorePlugin(new IPThrottler());
|
||||
|
||||
LoadCorePlugin(new IPThrottler());
|
||||
|
||||
#if !MCG_STANDALONE
|
||||
LoadCorePlugin(new MCGalaxy.Modules.Compiling.CompilerPlugin());
|
||||
#endif
|
||||
|
||||
LoadCorePlugin(new CountdownPlugin());
|
||||
LoadCorePlugin(new CTFPlugin());
|
||||
LoadCorePlugin(new LSPlugin());
|
||||
|
@ -142,14 +142,14 @@ namespace MCGalaxy
|
||||
EnsureDirectoryExists("extra/bots");
|
||||
EnsureDirectoryExists(Paths.ImportsDir);
|
||||
EnsureDirectoryExists("blockdefs");
|
||||
#if !MCG_STANDALONE
|
||||
EnsureDirectoryExists(MCGalaxy.Modules.Compiling.ICompiler.COMMANDS_SOURCE_DIR); // TODO move to compiling module
|
||||
#endif
|
||||
EnsureDirectoryExists("text/discord"); // TODO move to discord plugin
|
||||
}
|
||||
|
||||
static void EnsureDirectoryExists(string dir) {
|
||||
if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);
|
||||
public static void EnsureDirectoryExists(string dir) {
|
||||
try {
|
||||
if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);
|
||||
} catch (Exception ex) {
|
||||
Logger.LogError("Creating directory " + dir, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static void LoadAllSettings() { LoadAllSettings(false); }
|
||||
|
@ -81,10 +81,10 @@ Compiling - .NET 6 / .NET 5 / .NET Core
|
||||
-----------------
|
||||
|
||||
* Compiling for .NET 6: No changes necessary
|
||||
* Compiling for .NET 5: Change `TargetFramework` in CLI/MCGalaxyCLI_Core.csproj to `net5.0`
|
||||
* Compiling for .NET Core: Change `TargetFramework` in CLI/MCGalaxyCLI_Core.csproj to `netcoreapp3.1`
|
||||
* Compiling for .NET 5: Change `TargetFramework` in CLI/MCGalaxyCLI_dotnet.csproj to `net5.0`
|
||||
* Compiling for .NET Core: Change `TargetFramework` in CLI/MCGalaxyCLI_dotnet.csproj to `netcoreapp3.1`
|
||||
|
||||
Then navigate into `CLI` directory, and then run `dotnet build MCGalaxyCLI_Core.csproj`
|
||||
Then navigate into `CLI` directory, and then run `dotnet build MCGalaxyCLI_dotnet.csproj`
|
||||
|
||||
**You will also need to copy `libsqlite3.so.0` from system libraries to `libsqlite3.so` in the server folder**
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user