Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 31 additions & 31 deletions JPCC/Commands/SubHandler/RunVoteSubHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,29 +39,29 @@ public void StartVoteHandler(string[] command, ClientStructure client)
// What type of vote do we have?
if (_votingTracker.VoteType == "resetworld")
{
_messageDispatcherHandler.DispatchMessageToAllClients($"Player {client.PlayerName} has initiated a vote on resetting the world!{Environment.NewLine}Please use the commands /yes or /no to cast your vote!");
JPCCLog.Normal($"{client.PlayerName} has started a vote on resetting the world!");
_messageDispatcherHandler.DispatchMessageToAllClients($"{client.PlayerName} started a vote on resetting the world!{Environment.NewLine}Use the commands /yes or /no to cast your vote.");
JPCCLog.Normal($"{client.PlayerName} started a vote on resetting the world.");

VoteTimerAsync(command, client);
}
if (_votingTracker.VoteType == "kickplayer")
{
_messageDispatcherHandler.DispatchMessageToAllClients($"Player {client.PlayerName} has initiated a vote on kicking {command[1]} from the server!{Environment.NewLine}Please use the commands /yes or /no to cast your vote!");
JPCCLog.Normal($"{client.PlayerName} has started a vote on kicking {command[1]} from the server!");
_messageDispatcherHandler.DispatchMessageToAllClients($"{client.PlayerName} started a vote on kicking {command[1]} from the server!{Environment.NewLine}Use the commands /yes or /no to cast your vote.");
JPCCLog.Normal($"{client.PlayerName} started a vote on kicking {command[1]} from the server.");

VoteTimerAsync(command, client);
}
if (_votingTracker.VoteType == "banplayer")
{
_messageDispatcherHandler.DispatchMessageToAllClients($"Player {client.PlayerName} has initiated a vote on banning {command[1]} from the server!{Environment.NewLine}Please use the commands /yes or /no to cast your vote!");
JPCCLog.Normal($"{client.PlayerName} has started a vote on banning {command[1]} from the server!");
_messageDispatcherHandler.DispatchMessageToAllClients($"{client.PlayerName} started a vote on banning {command[1]} from the server!{Environment.NewLine}Use the commands /yes or /no to cast your vote.");
JPCCLog.Normal($"{client.PlayerName} started a vote on banning {command[1]} from the server.");

VoteTimerAsync(command, client);
}
}
else
{
_messageDispatcherHandler.DispatchMessageToSingleClient("Vote is currently running, can not start a new one!", client);
_messageDispatcherHandler.DispatchMessageToSingleClient("Vote is currently running, cannot start a new one.", client);
}
}

Expand All @@ -70,17 +70,17 @@ private async Task VoteTimerAsync(string[] command, ClientStructure client)
{
await Task.Delay(5000);

_messageDispatcherHandler.DispatchMessageToAllClients("30 seconds left to vote!");
_messageDispatcherHandler.DispatchMessageToAllClients("30 seconds left to vote.");
JPCCLog.Debug($"Vote has 30 seconds left!");

await Task.Delay(10000);

_messageDispatcherHandler.DispatchMessageToAllClients("20 seconds left to vote!");
_messageDispatcherHandler.DispatchMessageToAllClients("20 seconds left to vote.");
JPCCLog.Debug($"Vote has 20 seconds left!");

await Task.Delay(10000);

_messageDispatcherHandler.DispatchMessageToAllClients("10 seconds left to vote!");
_messageDispatcherHandler.DispatchMessageToAllClients("10 seconds left to vote.");
JPCCLog.Debug($"Vote has 10 seconds left!");

await Task.Delay(10000);
Expand Down Expand Up @@ -131,12 +131,12 @@ private async Task HandleResetVoteResults(string[] command, ClientStructure clie
// Do we have enough votes?
if (_votingTracker.VotedYesCount > _votingTracker.VotedNoCount)
{
_messageDispatcherHandler.DispatchMessageToAllClients($"Vote has succeeded! Enough players voted yes. World will be reset.");
JPCCLog.Normal($"Vote has succeeded! Enough players voted yes. World will be reset.");
_messageDispatcherHandler.DispatchMessageToAllClients($"Enough players voted yes, so the world will be reset.");
JPCCLog.Normal($"Enough players voted yes, the world will be reset.");
await Task.Delay(4000);

_messageDispatcherHandler.DispatchMessageToAllClients($"Server will reboot in 5 seconds...");
JPCCLog.Normal($"Server will reboot in 5 seconds...");
_messageDispatcherHandler.DispatchMessageToAllClients($"Server will restart in 5 seconds...");
JPCCLog.Normal($"Server will restart in 5 seconds...");

await Task.Delay(5000);

Expand All @@ -149,8 +149,8 @@ private async Task HandleResetVoteResults(string[] command, ClientStructure clie
}
else
{
_messageDispatcherHandler.DispatchMessageToAllClients($"Vote has failed! Not enough players voted yes. World will not be reset.");
JPCCLog.Normal($"Vote has failed! Not enough players voted yes. World will not be reset.");
_messageDispatcherHandler.DispatchMessageToAllClients($"Not enough players voted yes, so the world won't be reset.");
JPCCLog.Normal($"Not enough players voted yes, so the world won't be reset.");
}
}

Expand All @@ -162,8 +162,8 @@ private async Task HandleKickVoteResults(string[] command, ClientStructure clien
// Do we have enough votes, and do we have more yes than no votes?
if ((_votingTracker.VotedYesCount > _votingTracker.VotedNoCount) && _votingTracker.PlayersWhoVoted.Count() >= 1)
{
_messageDispatcherHandler.DispatchMessageToAllClients($"Vote has succeeded! Enough players voted yes. Player {command[1]} will be kicked.");
JPCCLog.Normal($"Vote has succeeded! Enough players voted yes. Player {command[1]} will be kicked.");
_messageDispatcherHandler.DispatchMessageToAllClients($"Enough players voted yes, so {command[1]} will be kicked.");
JPCCLog.Normal($"Enough players voted yes, so {command[1]} will be kicked.");

await Task.Delay(2000);

Expand All @@ -176,19 +176,19 @@ private async Task HandleKickVoteResults(string[] command, ClientStructure clien
var kickMessage = "The server voted to kick you out!";
CommandHandler.Commands["kick"].Func($"{player.PlayerName} {kickMessage}");

_messageDispatcherHandler.DispatchMessageToAllClients($"{command[1]} has been kicked!");
JPCCLog.Normal($"{command[1]} has been kicked!");
_messageDispatcherHandler.DispatchMessageToAllClients($"{command[1]} has been kicked.");
JPCCLog.Normal($"{command[1]} has been kicked.");
}
else
{
_messageDispatcherHandler.DispatchMessageToAllClients($"Error, {command[1]} could not be kicked as they are no longer on the server!");
JPCCLog.Normal($"Error, {command[1]} could not be kicked as they are no longer on the server!");
_messageDispatcherHandler.DispatchMessageToAllClients($"Can't kick {command[1]}, since they left the server.");
JPCCLog.Normal($"Can't kick {command[1]}, since they left the server.");
}
}
else
{
_messageDispatcherHandler.DispatchMessageToAllClients($"Vote has failed! Not enough players voted yes. Player {command[1]} will not be kicked.");
JPCCLog.Normal($"Vote has failed! Not enough players voted yes. Player {command[1]} will not be kicked.");
_messageDispatcherHandler.DispatchMessageToAllClients($"Not enough players voted yes, so {command[1]} will not be kicked.");
JPCCLog.Normal($"Not enough players voted yes, so {command[1]} will not be kicked.");
}
}

Expand All @@ -200,8 +200,8 @@ private async Task HandleBanVoteResults(string[] command, ClientStructure client
// Do we have enough votes and more yes than no votes?
if ((_votingTracker.VotedYesCount > _votingTracker.VotedNoCount) && _votingTracker.PlayersWhoVoted.Count() >= 2)
{
_messageDispatcherHandler.DispatchMessageToAllClients($"Vote has succeeded! Enough players voted yes. Player {command[1]} will be banned.");
JPCCLog.Normal($"Vote has succeeded! Enough players voted yes. Player {command[1]} will be banned.");
_messageDispatcherHandler.DispatchMessageToAllClients($"Enough players voted yes, so {command[1]} will be banned.");
JPCCLog.Normal($"Enough players voted yes, so {command[1]} will be banned.");

await Task.Delay(2000);

Expand All @@ -215,19 +215,19 @@ private async Task HandleBanVoteResults(string[] command, ClientStructure client
var banMessage = "The server voted to ban you!";
CommandHandler.Commands["ban"].Func($"{player.PlayerName} {banMessage}");

_messageDispatcherHandler.DispatchMessageToAllClients($"{command[1]} has been banned!");
_messageDispatcherHandler.DispatchMessageToAllClients($"{command[1]} has been struck by the Ban Hammer!");
JPCCLog.Normal($"{command[1]} has been banned!");
}
else
{
_messageDispatcherHandler.DispatchMessageToAllClients($"Error, {command[1]} could not be banned as they are no longer on the server!");
JPCCLog.Normal($"Error, {command[1]} could not be banned as they are no longer on the server!");
_messageDispatcherHandler.DispatchMessageToAllClients($"Can't ban {command[1]}, since they left the server.");
JPCCLog.Normal($"Can't ban {command[1]}, since they left the server.");
}
}
else
{
_messageDispatcherHandler.DispatchMessageToAllClients($"Vote has failed! Not enough players voted yes. Player {command[1]} will not be banned.");
JPCCLog.Normal($"Vote has failed! Not enough players voted yes. Player {command[1]} will not be banned.");
_messageDispatcherHandler.DispatchMessageToAllClients($"Not enough players voted yes, so command[1]} won't be banned.");
JPCCLog.Normal($"Not enough players voted yes, so command[1]} won't be banned.");
}
}
}
Expand Down