diff --git a/MiraAPI/Events/Vanilla/Meeting/Voting/MeetingSelectEvent.cs b/MiraAPI/Events/Vanilla/Meeting/Voting/MeetingSelectEvent.cs
index 71d8a23..bde0592 100644
--- a/MiraAPI/Events/Vanilla/Meeting/Voting/MeetingSelectEvent.cs
+++ b/MiraAPI/Events/Vanilla/Meeting/Voting/MeetingSelectEvent.cs
@@ -3,9 +3,9 @@
namespace MiraAPI.Events.Vanilla.Meeting.Voting;
///
-/// The event that is invoked when the player tries to select another player to vote. If you cancel this, the player will not be selectable.
+/// The event that is invoked when the player tries to select another player to vote.
///
-public class MeetingSelectEvent : MiraCancelableEvent
+public class MeetingSelectEvent : MiraEvent
{
///
/// Gets the instance of the voter's vote data.
@@ -22,15 +22,22 @@ public class MeetingSelectEvent : MiraCancelableEvent
///
public NetworkedPlayerInfo TargetPlayerInfo { get; }
+ ///
+ /// Gets or sets a value indicating whether the player is allowed to vote for the target.
+ ///
+ public bool AllowVote { get; set; }
+
///
/// Initializes a new instance of the class.
///
/// The voter's data.
/// The target's playerId.
- public MeetingSelectEvent(PlayerVoteData playerVoteData, int targetId)
+ /// >Whether the player is allowed to vote for the target.
+ public MeetingSelectEvent(PlayerVoteData playerVoteData, int targetId, bool allowVote)
{
VoteData = playerVoteData;
TargetId = targetId;
TargetPlayerInfo = GameData.Instance.GetPlayerById((byte)targetId);
+ AllowVote = allowVote;
}
}
diff --git a/MiraAPI/Patches/Voting/MeetingHudPatches.cs b/MiraAPI/Patches/Voting/MeetingHudPatches.cs
index b375914..0e65e3a 100644
--- a/MiraAPI/Patches/Voting/MeetingHudPatches.cs
+++ b/MiraAPI/Patches/Voting/MeetingHudPatches.cs
@@ -37,18 +37,13 @@ internal static class MeetingHudPatches
{
var voteData = PlayerControl.LocalPlayer.GetVoteData();
- var @event = new MeetingSelectEvent(voteData, suspectStateIdx);
- MiraEventManager.InvokeEvent(@event);
-
- if (@event.IsCancelled)
- {
- return false;
- }
-
var hasVotes = voteData.VotesRemaining > 0;
var hasVotedFor = voteData.VotedFor((byte)suspectStateIdx);
- return hasVotes && !hasVotedFor;
+ var @event = new MeetingSelectEvent(voteData, suspectStateIdx, hasVotes && !hasVotedFor);
+ MiraEventManager.InvokeEvent(@event);
+
+ return @event.AllowVote;
}
[HarmonyPrefix]