Skip to content

Commit

Permalink
[GenericChatCommands] Initial version of the Generic Chat Commands VMod
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiteFang5 committed Aug 6, 2022
1 parent 88c197f commit 803681a
Show file tree
Hide file tree
Showing 12 changed files with 1,958 additions and 2 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,8 @@
* Fixed an issue related to retrieving Inventories from the NetworkIdMapping causing the mod to crash/not work correctly

### v1.0.0
* Initial release
* Initial release

## Generic Chat Commands
### v1.0.0
* Initial release
30 changes: 30 additions & 0 deletions GenericChatCommands/Configs/GenericChatCommandsConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using BepInEx.Configuration;

namespace VMods.GenericChatCommands
{
public static class GenericChatCommandsConfig
{
#region Properties

public static ConfigEntry<bool> GenericChatCommandsAnnounceRename { get; private set; }
public static ConfigEntry<bool> GenericChatCommandsAnnounceBloodMoonSkip { get; private set; }
public static ConfigEntry<bool> GenericChatCommandsAllowNextBloodMoonServerWideAnnouncing { get; private set; }
public static ConfigEntry<bool> GenericChatCommandsAnnounceGlobalCommandChanges { get; private set; }
public static ConfigEntry<bool> GenericChatCommandsAnnounceAdminLevelChanges { get; private set; }

#endregion

#region Public Methods

public static void Initialize(ConfigFile config)
{
GenericChatCommandsAnnounceRename = config.Bind(nameof(GenericChatCommandsConfig), nameof(GenericChatCommandsAnnounceRename), true, "When enabled, the renaming of players is announced server-wide.");
GenericChatCommandsAnnounceBloodMoonSkip = config.Bind(nameof(GenericChatCommandsConfig), nameof(GenericChatCommandsAnnounceBloodMoonSkip), true, "When enabled, the skipping to the next bloodmoon is announced server-wide.");
GenericChatCommandsAllowNextBloodMoonServerWideAnnouncing = config.Bind(nameof(GenericChatCommandsConfig), nameof(GenericChatCommandsAllowNextBloodMoonServerWideAnnouncing), true, "When enabled, it is possible to announce the time until the next blood moon server-wide.");
GenericChatCommandsAnnounceGlobalCommandChanges = config.Bind(nameof(GenericChatCommandsConfig), nameof(GenericChatCommandsAnnounceGlobalCommandChanges), true, "When enabled, all the commands starting with 'global-' will be announced server-wide.");
GenericChatCommandsAnnounceAdminLevelChanges = config.Bind(nameof(GenericChatCommandsConfig), nameof(GenericChatCommandsAnnounceAdminLevelChanges), true, "When enabled, all the changes made to a player's admin-level will be announced server-wide.");
}

#endregion
}
}
28 changes: 28 additions & 0 deletions GenericChatCommands/Configs/MutePlayerChatConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using BepInEx.Configuration;

namespace VMods.GenericChatCommands
{
public static class MutePlayerChatConfig
{
#region Properties

public static ConfigEntry<bool> GenericChatCommandsMutingEnabled { get; private set; }
public static ConfigEntry<bool> GenericChatCommandsModsCanMute { get; private set; }
public static ConfigEntry<bool> GenericChatCommandsAnnounceMutes { get; private set; }
public static ConfigEntry<bool> GenericChatCommandsAnnounceUnmutes { get; private set; }

#endregion

#region Public Methods

public static void Initialize(ConfigFile config)
{
GenericChatCommandsMutingEnabled = config.Bind(nameof(MutePlayerChatConfig), nameof(GenericChatCommandsMutingEnabled), true, "Enabled/disable the Mute Player Chat system.");
GenericChatCommandsModsCanMute = config.Bind(nameof(MutePlayerChatConfig), nameof(GenericChatCommandsModsCanMute), true, "When enabled, players with the Moderator permission level can use the Mute Player Chat system commands.");
GenericChatCommandsAnnounceMutes = config.Bind(nameof(MutePlayerChatConfig), nameof(GenericChatCommandsAnnounceMutes), true, "When enabled, the muting of players is announced server-wide.");
GenericChatCommandsAnnounceUnmutes = config.Bind(nameof(MutePlayerChatConfig), nameof(GenericChatCommandsAnnounceUnmutes), true, "When enabled, the unmiting of players is announced server-wide.");
}

#endregion
}
}
479 changes: 479 additions & 0 deletions GenericChatCommands/GenericChatCommands.csproj

Large diffs are not rendered by default.

64 changes: 64 additions & 0 deletions GenericChatCommands/Plugin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using BepInEx;
using BepInEx.IL2CPP;
using HarmonyLib;
using System.Reflection;
using VMods.Shared;
using Wetstone.API;

namespace VMods.GenericChatCommands
{
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
[BepInDependency("xyz.molenzwiebel.wetstone")]
[Reloadable]
public class Plugin : BasePlugin
{
#region Variables

private Harmony _hooks;

#endregion

#region Public Methods

public sealed override void Load()
{
if(VWorld.IsClient)
{
Log.LogMessage($"{PluginInfo.PLUGIN_NAME} only needs to be installed server side.");
return;
}
Utils.Initialize(Log, PluginInfo.PLUGIN_NAME);

CommandSystemConfig.Initialize(Config);
GenericChatCommandsConfig.Initialize(Config);
MutePlayerChatConfig.Initialize(Config);

CommandSystem.Initialize();
GenericChatCommandsSystem.Initialize();
MutePlayerChatSystem.Initialize();

_hooks = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly());

Log.LogInfo($"Plugin {PluginInfo.PLUGIN_NAME} (v{PluginInfo.PLUGIN_VERSION}) is loaded!");
}

public sealed override bool Unload()
{
if(VWorld.IsClient)
{
return true;
}
VModStorage.SaveAll();

_hooks?.UnpatchSelf();
MutePlayerChatSystem.Deinitialize();
GenericChatCommandsSystem.Deinitialize();
CommandSystem.Deinitialize();
Config.Clear();
Utils.Deinitialize();
return true;
}

#endregion
}
}
Loading

0 comments on commit 803681a

Please sign in to comment.