simplify invinte / add uninvite
This commit is contained in:
@@ -71,12 +71,6 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
#endregion
|
||||
#region Leader Commands
|
||||
[Command("invite", "~m~Benutzung: ~s~/invite [Name]")]
|
||||
public void CmdFactionInvite(Client player, string name)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[Command("giverank", "~m~Benutzung: ~s~/giverank [Name] [Rang]", GreedyArg = true)]
|
||||
public void CmdFactionGiverank(Client player, string name, string rank)
|
||||
{
|
||||
@@ -120,48 +114,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
[Command("uninvite", "~m~Benutzung: ~s~/uninvite [Name]")]
|
||||
public void CmdFactionUninvite(Client player, string name)
|
||||
{
|
||||
if (player.GetUser()?.FactionId == null || player.GetUser().FactionLeader == false)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
|
||||
Client target = ClientService.GetClientByNameOrId(name);
|
||||
if (target == null || !target.IsLoggedIn())
|
||||
{
|
||||
ChatService.PlayerNotFound(player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.GetUser()?.FactionId != player.GetUser()?.FactionId)
|
||||
{
|
||||
ChatService.Error(player, "Dieser Spieler ist nicht in deiner Fraktion");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.Handle == target.Handle)
|
||||
{
|
||||
ChatService.Error(player, "Du kannst dich nicht selber uninviten");
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.GetUser()?.FactionLeader ?? false)
|
||||
{
|
||||
ChatService.Error(player, "Du kannst keinen Leader uninviten");
|
||||
return;
|
||||
}
|
||||
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
|
||||
target.GetUser(dbContext).FactionRankId = null;
|
||||
target.GetUser(dbContext).FactionId = null;
|
||||
|
||||
player.SendChatMessage("!{02FCFF}Du hast " + target.Name + " aus der Fraktion geworfen.");
|
||||
target.SendChatMessage("!{02FCFF}Du wurdest von " + player.Name + " aus der Fraktion geworfen.");
|
||||
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Command("lc", "~m~Benutzung: ~s~/lc [Nachricht]", GreedyArg = true)]
|
||||
|
||||
Reference in New Issue
Block a user