NotificationService für Fehler rein

This commit is contained in:
Luke
2021-07-05 11:33:04 +02:00
parent f70218e85a
commit 84c3a84ed0
10 changed files with 111 additions and 103 deletions

View File

@@ -10,6 +10,7 @@ using ReallifeGamemode.Server.Util;
using ReallifeGamemode.Server.WeaponDeal;
using ReallifeGamemode.Server.Managers;
using ReallifeGamemode.Server.Job;
using ReallifeGamemode.Server.Services;
namespace ReallifeGamemode.Server.Events
{
@@ -37,7 +38,7 @@ namespace ReallifeGamemode.Server.Events
return;
}
player.StopAnimation();
player.SendNotification("~r~Du darfst dieses Fahrzeug nicht benutzen!", true);
NotificationService.SendErrorNotification(player, "Du darfst dieses Fahrzeug nicht benutzen!", true);
return;
}
}
@@ -46,7 +47,7 @@ namespace ReallifeGamemode.Server.Events
if (jveh.JobId != player.GetUser().JobId && !(u.IsAdmin(AdminLevel.HEADADMIN) && player.IsAdminDuty()))
{
player.StopAnimation();
player.SendNotification("~r~Du darfst dieses Fahrzeug nicht benutzen!", true);
NotificationService.SendErrorNotification(player, "Du darfst dieses Fahrzeug nicht benutzen!", true);
return;
}
else if (u.IsAdmin(AdminLevel.HEADADMIN) && player.IsAdminDuty())
@@ -89,13 +90,13 @@ namespace ReallifeGamemode.Server.Events
if (!player.HasData("ActiveSchool") && !(u.IsAdmin(AdminLevel.HEADADMIN) && player.IsAdminDuty()))
{
player.StopAnimation();
player.SendNotification("~r~Du darfst dieses Fahrzeug nicht benutzen!", true);
NotificationService.SendErrorNotification(player, "Du darfst dieses Fahrzeug nicht benutzen!", true);
return;
}
if (sVeh.SchoolId != player.GetData<int>("ActiveSchool"))
{
player.StopAnimation();
player.SendNotification("~r~Du darfst dieses Fahrzeug nicht benutzen!", true);
NotificationService.SendErrorNotification(player, "Du darfst dieses Fahrzeug nicht benutzen!", true);
return;
}
}
@@ -106,7 +107,7 @@ namespace ReallifeGamemode.Server.Events
if (player.GetUser().PlayedMinutes > 1800)
{
player.StopAnimation();
player.SendNotification("~r~Du hast schon über 30 Spielstunden!", true);
NotificationService.SendErrorNotification(player, "Du hast schon über 30 Spielstunden!", true);
return;
}
}
@@ -121,13 +122,13 @@ namespace ReallifeGamemode.Server.Events
if (player.GetUser().PlayedMinutes > 1800)
{
player.StopAnimation();
player.SendNotification("~r~Du hast schon über 30 Spielstunden!", true);
NotificationService.SendErrorNotification(player, "Du hast schon über 30 Spielstunden!", true);
return;
}
if (player.GetData<bool>("HatNoobSpawnVehicle") == true)
{
player.StopAnimation();
player.SendNotification("~r~Du hast bereits einen Roller!", true);
NotificationService.SendErrorNotification(player, "Du hast bereits einen Roller!", true);
return;
}
else
@@ -223,7 +224,7 @@ namespace ReallifeGamemode.Server.Events
if (player.GetUser().PlayedMinutes > 1800)
{
player.StopAnimation();
player.SendNotification("~r~Du hast schon über 30 Spielstunden!", true);
NotificationService.SendErrorNotification(player, "Du hast schon über 30 Spielstunden!", true);
return;
}
else

View File

@@ -641,12 +641,12 @@ namespace ReallifeGamemode.Server.Events
{
if (user.GetData<bool>("duty"))
{
player.SendNotification("~r~Im Dienst kannst du keine Kleidung kaufen", false);
NotificationService.SendErrorNotification(player, "Im Dienst kannst du keine Kleidung kaufen", false);
return;
}
if (JobBase.GetPlayerInJob().Contains(player))
{
player.SendNotification("~r~Im aktiven Job kannst du keine Kleidung kaufen", false);
NotificationService.SendErrorNotification(player, "Im aktiven Job kannst du keine Kleidung kaufen", false);
return;
}
nearestClotheShopPoint.clotheShop.LoadShopNUI(player);
@@ -659,12 +659,12 @@ namespace ReallifeGamemode.Server.Events
{
if (user.GetData<bool>("duty"))
{
player.SendNotification("~r~Im Dienst wirst du nicht vom Friseur bedient", false);
NotificationService.SendErrorNotification(player, "Im Dienst wirst du nicht vom Friseur bedient", false);
return;
}
if (JobBase.GetPlayerInJob().Contains(player))
{
player.SendNotification("~r~Im aktiven Job wirst du nicht vom Friseur bedient", false);
NotificationService.SendErrorNotification(player, "Im aktiven Job wirst du nicht vom Friseur bedient", false);
return;
}
nearestFriseurPoint.friseurShop.LoadShopNUI(player);
@@ -673,7 +673,7 @@ namespace ReallifeGamemode.Server.Events
{
if (!user.WeaponLicense)
{
player.SendNotification("~r~Du besitzt keinen Waffenschein");
NotificationService.SendErrorNotification(player, "Du besitzt keinen Waffenschein");
}
else
{
@@ -685,17 +685,17 @@ namespace ReallifeGamemode.Server.Events
//{
// if (user.GetData<bool>("duty"))
// {
// player.SendNotification("~r~Im Dienst kannst du nicht operiert werden", false);
// NotificationService.SendErrorNotification(player, "Im Dienst kannst du nicht operiert werden", false);
// return;
// }
// if (JobBase.GetPlayerInJob().Contains(player))
// {
// player.SendNotification("~r~Im aktiven Job kannst du nicht operiert werden", false);
// NotificationService.SendErrorNotification(player, "Im aktiven Job kannst du nicht operiert werden", false);
// return;
// }
// if (user.Wanteds > 0)
// {
// player.SendNotification("~r~Wenn du gesucht wirst kannst du nicht operiert werden", false);
// NotificationService.SendErrorNotification(player, "Wenn du gesucht wirst kannst du nicht operiert werden", false);
// return;
// }
@@ -751,12 +751,12 @@ namespace ReallifeGamemode.Server.Events
{
if (user.GetData<bool>("duty"))
{
player.SendNotification("~r~Im Dienst kannst du keinen Job ausführen", false);
NotificationService.SendErrorNotification(player, "Im Dienst kannst du keinen Job ausführen", false);
return;
}
if (user.Wanteds > 0)
{
player.SendNotification("~r~Mit Wanteds kannst du keinen Job starten", false);
NotificationService.SendErrorNotification(player, "Mit Wanteds kannst du keinen Job starten", false);
return;
}
if (player.GetUser().JobId == 3)
@@ -779,7 +779,7 @@ namespace ReallifeGamemode.Server.Events
}
else
{
player.SendNotification("~r~[Fehler] ~w~ Du hast diesen Job nicht angenommen.");
NotificationService.SendErrorNotification(player, "Du hast diesen Job nicht angenommen");
return;
}
}
@@ -1030,7 +1030,7 @@ namespace ReallifeGamemode.Server.Events
{
player.ResetData("SellVehicleDecision");
player.ResetData("VehicleToSell");
player.SendNotification("~r~Du hast den Fahrzeugverkauf abgebrochen");
NotificationService.SendErrorNotification(player, "Du hast den Fahrzeugverkauf abgebrochen");
return;
}
@@ -1044,7 +1044,7 @@ namespace ReallifeGamemode.Server.Events
if (NAPI.Entity.GetEntityVelocity(v).Length() > 1 && v.Class != 16)
{
player.SendNotification("~r~Der Motor kann nur im Stand betätigt werden.", true);
NotificationService.SendErrorNotification(player, "Der Motor kann nur im Stand betätigt werden", true);
return;
}
@@ -1071,7 +1071,7 @@ namespace ReallifeGamemode.Server.Events
}
else if (!fV.GetOwners().Contains(u.FactionId ?? 0) && !state && !(u.IsAdmin(AdminLevel.HEADADMIN) && player.IsAdminDuty()))
{
player.SendNotification("~r~Du hast keinen Schlüssel.");
NotificationService.SendErrorNotification(player, "Du hast keinen Schlüssel");
return;
}
}
@@ -1079,7 +1079,7 @@ namespace ReallifeGamemode.Server.Events
{
if (gV.GroupId != u.Group.Id && !state && !u.IsAdmin(AdminLevel.ADMIN3) && player.IsAdminDuty())
{
player.SendNotification("~r~Du hast keinen Schlüssel.");
NotificationService.SendErrorNotification(player, "Du hast keinen Schlüssel");
return;
}
}
@@ -1087,7 +1087,7 @@ namespace ReallifeGamemode.Server.Events
{
if (jV.JobId != player.GetUser().JobId && !state && !(u.IsAdmin(AdminLevel.HEADADMIN) && player.IsAdminDuty()))
{
player.SendNotification("~r~Du hast keinen Schlüssel.");
NotificationService.SendErrorNotification(player, "Du hast keinen Schlüssel");
return;
}
else
@@ -1106,7 +1106,7 @@ namespace ReallifeGamemode.Server.Events
}
else if (uV.UserId != u.Id && !u.IsAdmin(AdminLevel.HEADADMIN))
{
player.SendNotification("~r~Du hast keinen Schlüssel.");
NotificationService.SendErrorNotification(player, "Du hast keinen Schlüssel");
return;
}
}

View File

@@ -10,6 +10,7 @@ using ReallifeGamemode.Server.Util;
using ReallifeGamemode.Server.WeaponDeal;
using ReallifeGamemode.Server.Log;
using ReallifeGamemode.Server.Managers;
using ReallifeGamemode.Server.Services;
namespace ReallifeGamemode.Server.Events
{
@@ -30,7 +31,7 @@ namespace ReallifeGamemode.Server.Events
if (NAPI.Entity.GetEntityVelocity(v).Length() > 1 && v.Class != 16)
{
player.SendNotification("~r~Der Motor kann nur im Stand betätigt werden.", true);
NotificationService.SendErrorNotification(player, "Der Motor kann nur im Stand betätigt werden", true);
return;
}
@@ -52,7 +53,7 @@ namespace ReallifeGamemode.Server.Events
}
else if (!fV.GetOwners().Contains(u.FactionId ?? 0) && !state && !(u.IsAdmin(AdminLevel.HEADADMIN) && player.IsAdminDuty()))
{
player.SendNotification("~r~Du hast keinen Schlüssel.");
NotificationService.SendErrorNotification(player, "Du hast keinen Schlüssel");
return;
}
}
@@ -60,7 +61,7 @@ namespace ReallifeGamemode.Server.Events
{
if (gV.GroupId != u.Group.Id && !state && !u.IsAdmin(AdminLevel.ADMIN3))
{
player.SendNotification("~r~Du hast keinen Schlüssel.");
NotificationService.SendErrorNotification(player, "Du hast keinen Schlüssel");
return;
}
}
@@ -68,7 +69,7 @@ namespace ReallifeGamemode.Server.Events
{
if (jV.JobId != player.GetUser().JobId && !state && !(u.IsAdmin(AdminLevel.HEADADMIN) && player.IsAdminDuty()))
{
player.SendNotification("~r~Du hast keinen Schlüssel.");
NotificationService.SendErrorNotification(player, "Du hast keinen Schlüssel");
return;
}
else
@@ -123,7 +124,7 @@ namespace ReallifeGamemode.Server.Events
{
if (uV.UserId != u.Id)
{
player.SendNotification("~r~Du hast keinen Schlüssel.");
NotificationService.SendErrorNotification(player, "Du hast keinen Schlüssel");
return;
}
}
@@ -238,7 +239,7 @@ namespace ReallifeGamemode.Server.Events
{
if (uV.UserId != u.Id && (!u.IsAdmin(AdminLevel.HEADADMIN) || !player.IsTSupport()))
{
player.SendNotification("~r~Du darfst dieses Fahrzeug nicht parken.");
NotificationService.SendErrorNotification(player, "Du darfst dieses Fahrzeug nicht parken");
return;
}
}
@@ -246,7 +247,7 @@ namespace ReallifeGamemode.Server.Events
{
if ((!fV.GetOwners().Contains(u.FactionId ?? 0) || !u.FactionLeader) && (!u.IsAdmin(AdminLevel.HEADADMIN) || !player.IsTSupport()))
{
player.SendNotification("~r~Du darfst dieses Fahrzeug nicht parken.");
NotificationService.SendErrorNotification(player, "Du darfst dieses Fahrzeug nicht parken");
return;
}
}
@@ -254,18 +255,18 @@ namespace ReallifeGamemode.Server.Events
{
if (gV.GroupId != u.Group.Id || u.GroupRank < GroupRank.MANAGER)
{
player.SendNotification("~r~Du darfst dieses Fahrzeug nicht parken.");
NotificationService.SendErrorNotification(player, "Du darfst dieses Fahrzeug nicht parken");
return;
}
}
else if (sV is JobVehicle)
{
player.SendNotification("~r~Du darfst dieses Fahrzeug nicht parken.");
NotificationService.SendErrorNotification(player, "Du darfst dieses Fahrzeug nicht parken");
return;
}
else if (sV is SchoolVehicle)
{
player.SendNotification("~r~Du darfst dieses Fahrzeug nicht parken.");
NotificationService.SendErrorNotification(player, "Du darfst dieses Fahrzeug nicht parken");
return;
}