Skip to content

Commit

Permalink
Subscribe to Request Chat Event
Browse files Browse the repository at this point in the history
- Subscribes to the request chat event for Silence mod
  • Loading branch information
data-bomb committed Mar 3, 2024
1 parent 6889281 commit c3f8ed3
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions Si_ChatSilence/Si_Silence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ You should have received a copy of the GNU General Public License
using System.Linq;


[assembly: MelonInfo(typeof(ChatSilence), "Silence Admin Command", "1.2.0", "databomb", "https://github.com/data-bomb/Silica")]
[assembly: MelonInfo(typeof(ChatSilence), "Silence Admin Command", "1.2.1", "databomb", "https://github.com/data-bomb/Silica")]
[assembly: MelonGame("Bohemia Interactive", "Silica")]
[assembly: MelonOptionalDependencies("Admin Mod")]

Expand All @@ -55,20 +55,16 @@ public override void OnInitializeMelon()

public override void OnLateInitializeMelon()
{
adminModAvailable = RegisteredMelons.Any(m => m.Info.Name == "Admin Mod");
// register commands
HelperMethods.CommandCallback silenceCallback = Command_Silence;
HelperMethods.RegisterAdminCommand("!silence", silenceCallback, Power.Mute);

if (adminModAvailable)
{
HelperMethods.CommandCallback silenceCallback = Command_Silence;
HelperMethods.RegisterAdminCommand("!silence", silenceCallback, Power.Mute);
HelperMethods.CommandCallback unSilenceCallback = Command_UnSilence;
HelperMethods.RegisterAdminCommand("!unsilence", unSilenceCallback, Power.Mute);

HelperMethods.CommandCallback unSilenceCallback = Command_UnSilence;
HelperMethods.RegisterAdminCommand("!unsilence", unSilenceCallback, Power.Mute);
}
else
{
MelonLogger.Warning("Dependency missing: Admin Mod");
}

// subscribe to the OnRequestPlayerChat event
Event_Netcode.OnRequestPlayerChat += OnRequestPlayerChat;
}

public static void Command_Silence(Player callerPlayer, String args)
Expand Down

0 comments on commit c3f8ed3

Please sign in to comment.