Skip to content

Commit

Permalink
smoll fix for stop command
Browse files Browse the repository at this point in the history
  • Loading branch information
Antoniofo committed Aug 12, 2024
1 parent b4cf2de commit f5477dd
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions PlaySound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected override bool ExecuteParent(ArraySegment<string> arguments, ICommandSe
}
if (arguments.Count <= 0)
{
response = "No arguments given\nUsage: audio|audioplayer play/playurl/list/stop [filename] [displayName]";
response = "No arguments given\nUsage: audio|audioplayer play/playurl/list/stop [[filename]|[true/false]] [displayName]";
return false;
}

Expand All @@ -58,7 +58,7 @@ protected override bool ExecuteParent(ArraySegment<string> arguments, ICommandSe
case "play":
if (arguments.Count < 3)
{
response = "Not enough argument to play a sound\nUsage: audio|audioplayer play/playurl/list/stop [filename] [displayName]";
response = "Not enough argument to play a sound\nUsage: audio|audioplayer play/playurl/list/stop [[filename]|[true/false]] [displayName]";
return false;
}

Expand All @@ -76,7 +76,7 @@ protected override bool ExecuteParent(ArraySegment<string> arguments, ICommandSe
case "playurl":
if (arguments.Count < 3)
{
response = "Not enough argument to play a sound\nUsage: audio|audioplayer play/playurl/list/stop [filename] [displayName]";
response = "Not enough argument to play a sound\nUsage: audio|audioplayer play/playurl/list/stop [[filename]|[true/false]] [displayName]";
return false;
}
string urlsound = arguments.At(1);
Expand All @@ -92,8 +92,30 @@ protected override bool ExecuteParent(ArraySegment<string> arguments, ICommandSe
response = "Last sound not finished or file doesn't exist";
return false;
}
case "stop":
List<ReferenceHub> listofshit = Plugin.AudioPlayers.Where(x => !x.nicknameSync.Network_myNickSync.Equals("Facility Announcement")).ToList();
case "stop":
List<ReferenceHub> listofshit;

bool excludeFacilityAnnouncement = true;

if (arguments.Count >= 2)
{
if (bool.TryParse(arguments.At(1), out bool includeAllPlayers))
{
excludeFacilityAnnouncement = !includeAllPlayers;
}
}

if (excludeFacilityAnnouncement)
{
listofshit = Plugin.AudioPlayers
.Where(player => !player.nicknameSync.Network_myNickSync.Equals("Facility Announcement"))
.ToList();
}
else
{
listofshit = Plugin.AudioPlayers.ToList();
}

for (int i = 0; i < listofshit.Count; i++)
{
var audioPlayer = AudioPlayerBase.Get(listofshit[i]);
Expand Down

0 comments on commit f5477dd

Please sign in to comment.