Skip to content

Commit

Permalink
fix(bump): Resolved any compile time issues related to BP version bum…
Browse files Browse the repository at this point in the history
…p v1.3
  • Loading branch information
UserR00T committed Nov 4, 2022
1 parent 38e7de0 commit d1e1fe0
Show file tree
Hide file tree
Showing 74 changed files with 222 additions and 529 deletions.
2 changes: 1 addition & 1 deletion dist/localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"warn_remove_error_null_or_negative": "WarnId {0} cannot be negative or null.",
"warn_remove_error_not_existent": "The Warn {0} does not exist",
"player_warn_removed": "Removed the Warn {0}",
"warn_toString": "{0} by {1} on {2} expiring after {3} days. {4}",
"warn_toString": "{0} by {1} on {2} expiring after {3} days.",
"command_disabled": "The Command {0} is disabled.",
"command_failed_cuffed": "This Command cannot be used when cuffed!",
"command_failed_jail": "This Command cannot be used when in jail!",
Expand Down
6 changes: 6 additions & 0 deletions src/BPEssentials.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.28917.182
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPEssentials", "BPEssentials\BPEssentials.csproj", "{AFE6CE3D-2FE4-4C67-B71C-7DA67FA73766}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BP-CoreLib", "..\..\BP-CoreLib\src\BP-CoreLib\BP-CoreLib.csproj", "{573A3947-382A-409B-95E6-176E8D5BC686}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -15,6 +17,10 @@ Global
{AFE6CE3D-2FE4-4C67-B71C-7DA67FA73766}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AFE6CE3D-2FE4-4C67-B71C-7DA67FA73766}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AFE6CE3D-2FE4-4C67-B71C-7DA67FA73766}.Release|Any CPU.Build.0 = Release|Any CPU
{573A3947-382A-409B-95E6-176E8D5BC686}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{573A3947-382A-409B-95E6-176E8D5BC686}.Debug|Any CPU.Build.0 = Debug|Any CPU
{573A3947-382A-409B-95E6-176E8D5BC686}.Release|Any CPU.ActiveCfg = Release|Any CPU
{573A3947-382A-409B-95E6-176E8D5BC686}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace BPEssentials.Abstractions
{
public abstract class Command
public abstract class BpeCommand
{
public virtual bool LastArgSpaces { get; }

Expand Down
402 changes: 38 additions & 364 deletions src/BPEssentials/BPEssentials.csproj

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions src/BPEssentials/ChatHandlers/GlobalChat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ public void OnEvent(ShPlayer player, string message)
{
return;
}

if (player.GetExtendedPlayer().Muted)
if (CommandHandler.OnEvent(player, message)) // 'true' if message starts with command prefix
{
player.TS("muted_player");
return;
}

if (CommandHandler.OnEvent(player, message)) // 'true' if message starts with command prefix
if (player.GetExtendedPlayer().Muted)
{
player.TS("muted_player");
return;
}

Expand All @@ -48,4 +46,4 @@ public void OnEvent(ShPlayer player, string message)
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/BPEssentials/Commands/Chat/PmUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace BPEssentials.Commands
{
public class PmUser : Command
public class PmUser : BpeCommand
{
public override bool LastArgSpaces => true;

Expand Down
2 changes: 1 addition & 1 deletion src/BPEssentials/Commands/Chat/ReplyUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace BPEssentials.Commands
{
public class ReplyUser : Command
public class ReplyUser : BpeCommand
{
public override bool LastArgSpaces => true;

Expand Down
2 changes: 1 addition & 1 deletion src/BPEssentials/Commands/Chat/Sudo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace BPEssentials.Commands
{
public class Sudo : Command
public class Sudo : BpeCommand
{
public void Invoke(ShPlayer player, ShPlayer target, string message)
{
Expand Down
2 changes: 1 addition & 1 deletion src/BPEssentials/Commands/Chat/ToggleChat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace BPEssentials.Commands
{
public class ToggleChat : Command
public class ToggleChat : BpeCommand
{
public void Invoke(ShPlayer player)
{
Expand Down
2 changes: 1 addition & 1 deletion src/BPEssentials/Commands/Essentials.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace BPEssentials.Commands
{
public class Essentials : Command
public class Essentials : BpeCommand
{
public override bool LastArgSpaces => true;

Expand Down
2 changes: 1 addition & 1 deletion src/BPEssentials/Commands/General/OnlinePlayers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace BPEssentials.Commands
{
public class OnlinePlayers : Command
public class OnlinePlayers : BpeCommand
{
public void Invoke(ShPlayer player)
{
Expand Down
19 changes: 11 additions & 8 deletions src/BPEssentials/Commands/Home/Home.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,29 @@

namespace BPEssentials.Commands
{
public class Home : Command
public class Home : BpeCommand
{
public void Invoke(ShPlayer player, int homeNumber = 1)
{

var apartments = new List<ShApartment>(player.ownedApartments.Keys);
if (apartments.Count == 0)
{
player.TS("no_appartments");
return;
}
if (apartments.Count < homeNumber)
{

player.TS("you_only_own", apartments.Count.ToString());
return;
}

if (apartments.Count == 0)
var offset = new Vector3(-1, 0, -1);
var apartment = apartments[Math.Max(0, --homeNumber)];
if (apartment.GetRotation.y < 0.9)
{
player.TS("no_appartments");
return;
offset = new Vector3(1, 0, 2);
}
var apartment = apartments[Math.Max(0, --homeNumber)];
player.GetExtendedPlayer().ResetAndSavePosition(apartment.spawnPoint.position, apartment.spawnPoint.rotation, apartment.GetPlaceIndex);
player.GetExtendedPlayer().ResetAndSavePosition(apartment.GetPosition + offset, apartment.GetRotation, apartment.GetPlaceIndex);
}
}
}
2 changes: 1 addition & 1 deletion src/BPEssentials/Commands/Kits/Kit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace BPEssentials.Commands
{
public class Kit : Command
public class Kit : BpeCommand
{
public void Invoke(ShPlayer player, string kit)
{
Expand Down
2 changes: 1 addition & 1 deletion src/BPEssentials/Commands/Kits/KitCreate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace BPEssentials.Commands
{
public class KitCreate : Command
public class KitCreate : BpeCommand
{
public void Invoke(ShPlayer player, string kit, int price = 0, int delay = 0)
{
Expand Down
2 changes: 1 addition & 1 deletion src/BPEssentials/Commands/Kits/KitDelete.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace BPEssentials.Commands
{
public class KitDelete : Command
public class KitDelete : BpeCommand
{
public void Invoke(ShPlayer player, string kit)
{
Expand Down
2 changes: 1 addition & 1 deletion src/BPEssentials/Commands/Kits/KitList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace BPEssentials.Commands
{
public class KitList : Command
public class KitList : BpeCommand
{
public void Invoke(ShPlayer player)
{
Expand Down
2 changes: 1 addition & 1 deletion src/BPEssentials/Commands/Misc/Launch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace BPEssentials.Commands
{
public class Launch : Command
public class Launch : BpeCommand
{
public void Invoke(ShPlayer player, ShPlayer target = null, float thrust = 6500f)
{
Expand Down
2 changes: 1 addition & 1 deletion src/BPEssentials/Commands/Misc/Slap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace BPEssentials.Commands
{
public class Slap : Command
public class Slap : BpeCommand
{
public void Invoke(ShPlayer player, ShPlayer target)
{
Expand Down
2 changes: 1 addition & 1 deletion src/BPEssentials/Commands/Moderation/Ban.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace BPEssentials.Commands
{
public class Ban : Command
public class Ban : BpeCommand
{
public override bool LastArgSpaces { get; } = true;

Expand Down
2 changes: 1 addition & 1 deletion src/BPEssentials/Commands/Moderation/Disconnect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace BPEssentials.Commands
{
public class Disconnect : Command
public class Disconnect : BpeCommand
{
public void Invoke(ShPlayer player, ShPlayer target)
{
Expand Down
8 changes: 4 additions & 4 deletions src/BPEssentials/Commands/Moderation/Info.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
using BrokeProtocol.LiteDB;
using System.Linq;
using System.Text;
using BrokeProtocol.Managers;

namespace BPEssentials.Commands
{
public class Info : Command
public class Info : BpeCommand
{
public override bool LastArgSpaces => true;

Expand All @@ -22,7 +23,7 @@ public void Invoke(ShPlayer player, string targetStr)
}
else
{
var target = Core.Instance.SvManager.database.Users.FindById(targetStr);
var target = SvManager.Instance.database.Users.FindById(targetStr);
if (target != null)
{
sb = GetOfflineInfo(target);
Expand Down Expand Up @@ -57,7 +58,6 @@ private StringBuilder GetOfflineInfo(User target)
.Append(" - PlaceIndex: ").AppendLine(target.Character.PlaceIndex.ToString())
.Append(" - SkinIndex: ").AppendLine(target.Character.SkinIndex.ToString())

.Append(" - JailTime: ").AppendLine(target.Character.JailTime.ToString())
.Append(" - MapName: ").AppendLine(target.Character.MapName)

.Append(" - Apartments: ").Append(target.Character.Apartments.Count).Append(", Indexes: ").Append(string.Join(", ", target.Character.Apartments.Select(x => x.Index)))
Expand Down Expand Up @@ -89,4 +89,4 @@ private StringBuilder GetOnlineInfo(ShPlayer target)
return sb;
}
}
}
}
33 changes: 23 additions & 10 deletions src/BPEssentials/Commands/Moderation/Jail.cs
Original file line number Diff line number Diff line change
@@ -1,34 +1,47 @@
using BPEssentials.Abstractions;
using System.Linq;
using BPEssentials.Abstractions;
using BPEssentials.ExtensionMethods;
using BrokeProtocol.API;
using BrokeProtocol.Entities;
using BrokeProtocol.GameSource;
using BrokeProtocol.GameSource.Types;
using BrokeProtocol.Utility;
using BrokeProtocol.Utility.Networking;

namespace BPEssentials.Commands
{
public class Jail : Command
public class Jail : BpeCommand
{
public void Invoke(ShPlayer player, ShPlayer target, float timeInSeconds)
{
var jail = Core.Instance.SvManager.jails.GetRandom();
var jail = LifeManager.jails.GetRandom();
if (jail == null)
{
return;
}
if (target.IsDead || target.svPlayer.job.info.shared.jobIndex == BPAPI.Instance.PrisonerIndex)
if (target.IsDead || target.svPlayer.IsPrisoner())
{
return;
}
var getPositionT = jail.mainT;
target.svPlayer.SvTrySetJob(BPAPI.Instance.PrisonerIndex, true, false);
target.svPlayer.SvSetJob(BPAPI.Jobs[LifeCore.prisonerIndex], true, false);
target.GetExtendedPlayer().ResetAndSavePosition(getPositionT.position, getPositionT.rotation, getPositionT.parent.GetSiblingIndex());
target.svPlayer.SvClearCrimes();
target.svPlayer.RemoveItemsJail();
target.StartCoroutine(target.svPlayer.JailTimer(timeInSeconds));
target.svPlayer.Send(SvSendType.Self, Channel.Reliable, ClPacket.ShowTimer, timeInSeconds);
target.LifePlayer().ClearCrimes();
foreach (var i in player.myItems.Values.ToArray())
{
if (!i.item.illegal)
{
continue;
}

player.TransferItem(DeltaInv.RemoveFromMe, i.item.index, i.count);
}
if (LifeManager.pluginPlayers.TryGetValue(player, out var pluginPlayer))
{
pluginPlayer.StartJailTimer(timeInSeconds);
}
player.TS("player_jail", target.username.CleanerMessage(), timeInSeconds);
target.TS("target_jail", player.username.CleanerMessage(), timeInSeconds);
}
}
}
}
2 changes: 1 addition & 1 deletion src/BPEssentials/Commands/Moderation/Kick.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace BPEssentials.Commands
{
public class Kick : Command
public class Kick : BpeCommand
{
public override bool LastArgSpaces { get; } = true;

Expand Down
4 changes: 2 additions & 2 deletions src/BPEssentials/Commands/Moderation/Kill.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace BPEssentials.Commands
{
public class Kill : Command
public class Kill : BpeCommand
{
public void Invoke(ShPlayer player, ShPlayer target)
{
target.svPlayer.SvDestroySelf();
target.Die();
player.TS("killed", target.username.CleanerMessage());
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/BPEssentials/Commands/Moderation/StaffChat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace BPEssentials.Commands
{
public class StaffChat : Command
public class StaffChat : BpeCommand
{
public void Invoke(ShPlayer player, string text = "")
{
Expand Down
2 changes: 1 addition & 1 deletion src/BPEssentials/Commands/Moderation/ToggleBypass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace BPEssentials.Commands
{
public class ToggleBypass : Command
public class ToggleBypass : BpeCommand
{
public void Invoke(ShPlayer player)
{
Expand Down
2 changes: 1 addition & 1 deletion src/BPEssentials/Commands/Moderation/ToggleSpyChat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace BPEssentials.Commands
{
public class ToggleSpyChat : Command
public class ToggleSpyChat : BpeCommand
{
public void Invoke(ShPlayer player)
{
Expand Down
Loading

0 comments on commit d1e1fe0

Please sign in to comment.