Skip to content

Commit

Permalink
Update to EXILED 5.2.1
Browse files Browse the repository at this point in the history
Fixes #45
Fixes #43
Fixes #35
Fixes #26
  • Loading branch information
joker-119 committed May 19, 2022
1 parent 4e99b26 commit 5d1d0be
Show file tree
Hide file tree
Showing 16 changed files with 181 additions and 457 deletions.
64 changes: 28 additions & 36 deletions AdminTools/AdminTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
<AssemblyName>AdminTools</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<LangVersion>9</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
Expand All @@ -24,7 +25,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x64</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
Expand All @@ -34,58 +35,50 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\Assembly-CSharp-Publicized.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\References\Assembly-CSharp-Publicized.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\References\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="CommandSystem.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\packages\EXILED.5.1.0-beta.8\lib\net472\CommandSystem.Core.dll</HintPath>
<Private>True</Private>
<Reference Include="CommandSystem.Core, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\CommandSystem.Core.dll</HintPath>
</Reference>
<Reference Include="Exiled.API, Version=5.1.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\packages\EXILED.5.1.0-beta.8\lib\net472\Exiled.API.dll</HintPath>
<Private>True</Private>
<Reference Include="Exiled.API, Version=5.2.1.0, Culture=neutral, processorArchitecture=Amd64">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\Exiled.API.dll</HintPath>
</Reference>
<Reference Include="Exiled.Bootstrap, Version=5.1.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\packages\EXILED.5.1.0-beta.8\lib\net472\Exiled.Bootstrap.dll</HintPath>
<Private>True</Private>
<Reference Include="Exiled.Bootstrap, Version=5.2.1.0, Culture=neutral, processorArchitecture=Amd64">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\Exiled.Bootstrap.dll</HintPath>
</Reference>
<Reference Include="Exiled.CreditTags, Version=5.1.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\packages\EXILED.5.1.0-beta.8\lib\net472\Exiled.CreditTags.dll</HintPath>
<Private>True</Private>
<Reference Include="Exiled.CreditTags, Version=5.2.1.0, Culture=neutral, processorArchitecture=Amd64">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\Exiled.CreditTags.dll</HintPath>
</Reference>
<Reference Include="Exiled.CustomItems, Version=5.1.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\packages\EXILED.5.1.0-beta.8\lib\net472\Exiled.CustomItems.dll</HintPath>
<Private>True</Private>
<Reference Include="Exiled.CustomItems, Version=5.2.1.0, Culture=neutral, processorArchitecture=Amd64">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\Exiled.CustomItems.dll</HintPath>
</Reference>
<Reference Include="Exiled.CustomRoles, Version=5.1.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\packages\EXILED.5.1.0-beta.8\lib\net472\Exiled.CustomRoles.dll</HintPath>
<Private>True</Private>
<Reference Include="Exiled.CustomRoles, Version=5.2.1.0, Culture=neutral, processorArchitecture=Amd64">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\Exiled.CustomRoles.dll</HintPath>
</Reference>
<Reference Include="Exiled.Events, Version=5.1.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\packages\EXILED.5.1.0-beta.8\lib\net472\Exiled.Events.dll</HintPath>
<Private>True</Private>
<Reference Include="Exiled.Events, Version=5.2.1.0, Culture=neutral, processorArchitecture=Amd64">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\Exiled.Events.dll</HintPath>
</Reference>
<Reference Include="Exiled.Loader, Version=5.1.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\packages\EXILED.5.1.0-beta.8\lib\net472\Exiled.Loader.dll</HintPath>
<Private>True</Private>
<Reference Include="Exiled.Loader, Version=5.2.1.0, Culture=neutral, processorArchitecture=Amd64">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\Exiled.Loader.dll</HintPath>
</Reference>
<Reference Include="Exiled.Permissions, Version=5.1.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\packages\EXILED.5.1.0-beta.8\lib\net472\Exiled.Permissions.dll</HintPath>
<Private>True</Private>
<Reference Include="Exiled.Permissions, Version=5.2.1.0, Culture=neutral, processorArchitecture=Amd64">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\Exiled.Permissions.dll</HintPath>
</Reference>
<Reference Include="Exiled.Updater, Version=3.1.1.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\packages\EXILED.5.1.0-beta.8\lib\net472\Exiled.Updater.dll</HintPath>
<Private>True</Private>
<Reference Include="Exiled.Updater, Version=3.1.1.0, Culture=neutral, processorArchitecture=Amd64">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\Exiled.Updater.dll</HintPath>
</Reference>
<Reference Include="Mirror, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\References\Mirror.dll</HintPath>
</Reference>
<Reference Include="NorthwoodLib, Version=1.2.1.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\packages\EXILED.5.1.0-beta.8\lib\net472\NorthwoodLib.dll</HintPath>
<Private>True</Private>
<Reference Include="NorthwoodLib, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\EXILED.5.2.1\lib\net472\NorthwoodLib.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down Expand Up @@ -155,7 +148,6 @@
<Compile Include="Commands\Unmute\ICom.cs" />
<Compile Include="Commands\Unmute\Unmute.cs" />
<Compile Include="Commands\Unmute\RoundStart.cs" />
<Compile Include="Components\BreakDoorComponent.cs" />
<Compile Include="Commands\Kick\Kick.cs" />
<Compile Include="Components\RegenerationComponent.cs" />
<Compile Include="Config.cs" />
Expand Down
2 changes: 1 addition & 1 deletion AdminTools/Commands/Ahp/Ahp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected override bool ExecuteParent(ArraySegment<string> arguments, ICommandSe
return false;
}

List<Player> players = new List<Player>();
List<Player> players = new();
if (!float.TryParse(arguments.At(1), out float value))
{
response = $"Invalid value for AHP: {value}";
Expand Down
2 changes: 1 addition & 1 deletion AdminTools/Commands/Ball/Ball.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected override bool ExecuteParent(ArraySegment<string> arguments, ICommandSe
return false;
}

List<Player> players = new List<Player>();
List<Player> players = new();
switch (arguments.At(0))
{
case "*":
Expand Down
182 changes: 20 additions & 162 deletions AdminTools/Commands/BreakDoors/BreakDoors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

namespace AdminTools.Commands.BreakDoors
{
using System.Collections.Generic;

[CommandHandler(typeof(RemoteAdminCommandHandler))]
[CommandHandler(typeof(GameConsoleCommandHandler))]
public class BreakDoors : ParentCommand
Expand All @@ -29,181 +31,37 @@ protected override bool ExecuteParent(ArraySegment<string> arguments, ICommandSe
return false;
}

if (arguments.Count < 1)
{
response = "Usage:\nbreakdoors ((player id / name) or (all / *)) ((doors) or (all))" +
"\nbreakdoors clear" +
"\nbreakdoors list" +
"\nbreakdoors remove (player id / name)";
return false;
}

List<Player> players = new();
switch (arguments.At(0))
{
case "clear":
if (arguments.Count != 1)
{
response = "Usage: breakdoors clear";
return false;
}

foreach (Player ply in Plugin.BdHubs.Keys)
if (ply.ReferenceHub.TryGetComponent(out BreakDoorComponent bdCom))
UnityEngine.Object.Destroy(bdCom);

response = "Breaking doors has been removed from everyone";
return true;
case "list":
if (arguments.Count != 1)
{
response = "Usage: breakdoors list";
return false;
}

StringBuilder playerLister = StringBuilderPool.Shared.Rent(Plugin.BdHubs.Count != 0 ? "Players with break doors on:\n" : "No players currently online have breaking doors on");
if (Plugin.BdHubs.Count == 0)
{
response = playerLister.ToString();
return true;
}

foreach (Player ply in Plugin.BdHubs.Keys)
{
playerLister.Append(ply.Nickname);
playerLister.Append(", ");
}

string msg = playerLister.ToString().Substring(0, playerLister.ToString().Length - 2);
StringBuilderPool.Shared.Return(playerLister);
response = msg;
return true;
case "remove":
if (arguments.Count != 2)
{
response = "Usage: breakdoors remove (player id / name)";
return false;
}

Player pl = Player.Get(arguments.At(1));
if (pl == null)
{
response = $"Player not found: {arguments.At(1)}";
return false;
}

if (pl.ReferenceHub.TryGetComponent(out BreakDoorComponent bdComponent))
{
Plugin.BdHubs.Remove(pl);
UnityEngine.Object.Destroy(bdComponent);
response = $"Breaking doors is off for {pl.Nickname}";
}
else
response = $"Player {pl.Nickname} does not have the ability to break doors";
return true;
case "*":
case "all":
if (arguments.Count != 2)
{
response = "Usage: breakdoors (all / *) ((doors) or (all))";
return false;
}

if (!Enum.TryParse(arguments.At(1), true, out BreakType type))
{
response = $"Invalid breaking type: {arguments.At(1)}";
return false;
}

foreach (Player ply in Player.List)
{
if (!ply.ReferenceHub.TryGetComponent(out BreakDoorComponent bdCom))
{
ply.GameObject.AddComponent<BreakDoorComponent>();
switch (type)
{
case BreakType.Doors:
ply.ReferenceHub.GetComponent<BreakDoorComponent>().breakAll = false;
ply.IsBypassModeEnabled = false;
break;
case BreakType.All:
ply.ReferenceHub.GetComponent<BreakDoorComponent>().breakAll = true;
ply.IsBypassModeEnabled = true;
break;
}
}
else
{
switch (type)
{
case BreakType.Doors:
bdCom.breakAll = false;
ply.IsBypassModeEnabled = false;
break;
case BreakType.All:
bdCom.breakAll = true;
ply.IsBypassModeEnabled = true;
break;
}
}
}
foreach (Player player in Player.List)
players.Add(player);

response = $"Breaking {((type == BreakType.Doors) ? "doors" : "everything")} is on for everyone now";
return true;
break;
default:
if (arguments.Count != 2)
Player ply = Player.Get(arguments.At(0));
if (ply is null)
{
response = "Usage: breakdoors (player id / name) ((doors) or (all))";
response = $"Player {arguments.At(0)} not found.";
return false;
}

Player plyr = Player.Get(arguments.At(0));
if (plyr == null)
{
response = $"Player not found: {arguments.At(0)}";
return false;
}

if (!Enum.TryParse(arguments.At(1), true, out BreakType T))
{
response = $"Invalid breaking type: {arguments.At(1)}";
return false;
}
players.Add(ply);

if (!plyr.ReferenceHub.TryGetComponent(out BreakDoorComponent bdComp))
{
plyr.GameObject.AddComponent<BreakDoorComponent>();
switch (T)
{
case BreakType.Doors:
plyr.ReferenceHub.GetComponent<BreakDoorComponent>().breakAll = false;
plyr.IsBypassModeEnabled = false;
break;
case BreakType.All:
plyr.ReferenceHub.GetComponent<BreakDoorComponent>().breakAll = true;
plyr.IsBypassModeEnabled = true;
break;
}
break;
}

response = $"Breaking {((T == BreakType.Doors) ? "doors" : "all")} is on for {plyr.Nickname}";
}
else
{
switch (T)
{
case BreakType.Doors:
bdComp.breakAll = false;
plyr.IsBypassModeEnabled = false;
break;
case BreakType.All:
bdComp.breakAll = true;
plyr.IsBypassModeEnabled = true;
break;
}
foreach (Player player in players)
if (EventHandlers.BreakDoorsList.Contains(player))
EventHandlers.BreakDoorsList.Remove(player);
else
EventHandlers.BreakDoorsList.Add(player);

response = $"Breaking {((T == BreakType.Doors) ? "doors" : "all")} is on for {plyr.Nickname}";
}
return true;
}
response =
$"{players.Count} players have been updated. (Players with BD were removed, those without it were added)";
return true;
}
}
}
6 changes: 3 additions & 3 deletions AdminTools/Commands/Broadcast/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected override bool ExecuteParent(ArraySegment<string> arguments, ICommandSe
}

string[] users = arguments.At(1).Split(',');
List<Player> plyList = new List<Player>();
List<Player> plyList = new();
foreach (string s in users)
{
if (int.TryParse(s, out int id) && Player.Get(id) != null)
Expand Down Expand Up @@ -146,7 +146,7 @@ protected override bool ExecuteParent(ArraySegment<string> arguments, ICommandSe
}

string[] groups = arguments.At(1).Split(',');
List<string> groupList = new List<string>();
List<string> groupList = new();
foreach (string s in groups)
{
UserGroup broadGroup = ServerStatic.PermissionsHandler.GetGroup(s);
Expand Down Expand Up @@ -213,7 +213,7 @@ protected override bool ExecuteParent(ArraySegment<string> arguments, ICommandSe
}

string[] roles = arguments.At(1).Split(',');
List<RoleType> roleList = new List<RoleType>();
List<RoleType> roleList = new();
foreach (string s in roles)
{
if (Enum.TryParse(s, true, out RoleType r))
Expand Down
7 changes: 1 addition & 6 deletions AdminTools/Commands/Enums/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ public override void LoadGeneratedCommands() { }
protected override bool ExecuteParent(ArraySegment<string> arguments, ICommandSender sender, out string response)
{
StringBuilder listBuilder = StringBuilderPool.Shared.Rent();
listBuilder.Append("Here are the following enums you can use in commands:\n\nBreakType: ");
foreach (BreakType bt in Enum.GetValues(typeof(BreakType)))
{
listBuilder.Append(bt.ToString());
listBuilder.Append(" ");
}
listBuilder.Append("Here are the following enums you can use in commands:");
listBuilder.AppendLine();
listBuilder.Append("GrenadeType: ");
foreach (GrenadeType gt in Enum.GetValues(typeof(GrenadeType)))
Expand Down
Loading

0 comments on commit 5d1d0be

Please sign in to comment.