Skip to content
This repository has been archived by the owner on Sep 12, 2020. It is now read-only.

Commit

Permalink
removed now all refresh commands commands
Browse files Browse the repository at this point in the history
  • Loading branch information
GrafDimenzio committed Aug 3, 2020
1 parent 13145d8 commit 1536898
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 17 deletions.
43 changes: 43 additions & 0 deletions Synapse/Events/Patches/SynapsePatches/CommandsPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using CommandSystem;
using CommandSystem.Commands;
using Harmony;

namespace Synapse.Events.Patches.SynapsePatches
{
[HarmonyPatch(typeof(GameConsoleCommandHandler), nameof(GameConsoleCommandHandler.LoadGeneratedCommands))]
static class GameCommandsPatch
{
public static bool Prefix(GameConsoleCommandHandler __instance)
{
__instance.RegisterCommand(new CommandSystem.Commands.ArgsCommand());
__instance.RegisterCommand(new CommandSystem.Commands.BuildInfoCommand());
__instance.RegisterCommand(CommandSystem.Commands.ConfigCommand.Create());
__instance.RegisterCommand(new CommandSystem.Commands.HelpCommand(__instance));
return false;
}
}

[HarmonyPatch(typeof(ClientCommandHandler), nameof(ClientCommandHandler.LoadGeneratedCommands))]
static class ClientCommandPatch
{
public static bool Prefix(GameConsoleCommandHandler __instance)
{
__instance.RegisterCommand(new HelpCommand(__instance));
return false;
}
}

[HarmonyPatch(typeof(RemoteAdminCommandHandler), nameof(RemoteAdminCommandHandler.LoadGeneratedCommands))]
static class RemoteCommandsPatch
{
public static bool Prefix(GameConsoleCommandHandler __instance)
{
__instance.RegisterCommand(new CommandSystem.Commands.BuildInfoCommand());
__instance.RegisterCommand(new CommandSystem.Commands.ChangeNameCommand());
__instance.RegisterCommand(CommandSystem.Commands.ConfigCommand.Create());
__instance.RegisterCommand(new CommandSystem.Commands.HelpCommand(__instance));
__instance.RegisterCommand(new CommandSystem.Commands.IntercomTextCommand());
return false;
}
}
}
15 changes: 0 additions & 15 deletions Synapse/Events/Patches/SynapsePatches/RefreshCommandsPatch.cs

This file was deleted.

12 changes: 11 additions & 1 deletion Synapse/Synapse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ internal static void Start()
{
LoadDependencies();

//Clears all the Commands so that the base game refresh command will be removed
Server.ClientCommandHandler.ClearCommands();
Server.GameCoreCommandHandler.ClearCommands();
Server.RaCommandHandler.ClearCommands();

HarmonyPatch();
//Adding all Vanilla Commands back to the Handler but now with the Harmony Patch which removes the command
Server.ClientCommandHandler.LoadGeneratedCommands();
Server.GameCoreCommandHandler.LoadGeneratedCommands();
Server.RaCommandHandler.LoadGeneratedCommands();

foreach (var plugin in Directory.GetFiles(Files.ServerPluginDirectory))
{
if (plugin == "Synapse.dll") continue;
Expand All @@ -63,7 +74,6 @@ internal static void Start()


ConfigManager.InitializeConfigs();
HarmonyPatch();
ServerConsole.ReloadServerName();
_eventHandler = new Events.EventHandlers();
try
Expand Down
2 changes: 1 addition & 1 deletion Synapse/Synapse.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
<Compile Include="Api\Map.cs" />
<Compile Include="Config\ConfigManager.cs" />
<Compile Include="Events\Patches\EventPatches\MapPatches\TeslaTriggerEvent.cs" />
<Compile Include="Events\Patches\SynapsePatches\RefreshCommandsPatch.cs" />
<Compile Include="Events\Patches\SynapsePatches\CommandsPatch.cs" />
<Compile Include="Synapse.cs" />
<Compile Include="Events\Classes\PlayerTagEvent.cs" />
<Compile Include="Events\Classes\PickupItemEvent.cs" />
Expand Down

0 comments on commit 1536898

Please sign in to comment.