Skip to content

Commit

Permalink
project files
Browse files Browse the repository at this point in the history
  • Loading branch information
xNexusACS authored Jun 4, 2024
1 parent 62a26d5 commit fdd182b
Show file tree
Hide file tree
Showing 6 changed files with 199 additions and 0 deletions.
16 changes: 16 additions & 0 deletions BetterPlayerListCommand.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BetterPlayerListCommand", "BetterPlayerListCommand\BetterPlayerListCommand.csproj", "{838AF997-F3B8-4302-BADA-F2A6F747715E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{838AF997-F3B8-4302-BADA-F2A6F747715E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{838AF997-F3B8-4302-BADA-F2A6F747715E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{838AF997-F3B8-4302-BADA-F2A6F747715E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{838AF997-F3B8-4302-BADA-F2A6F747715E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
84 changes: 84 additions & 0 deletions BetterPlayerListCommand/BetterPlayerListCommand.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"
Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"/>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{838AF997-F3B8-4302-BADA-F2A6F747715E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BetterPlayerListCommand</RootNamespace>
<AssemblyName>BetterPlayerListCommand</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<LangVersion>12</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>..\..\Universe\UniverseModule\bin\Debug\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\Universe\UniverseModule\bin\Debug\Assembly-CSharp-Publicized.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>..\..\Universe\UniverseModule\bin\Debug\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="CommandSystem.Core">
<HintPath>..\..\Universe\UniverseModule\bin\Debug\CommandSystem.Core.dll</HintPath>
</Reference>
<Reference Include="Mirror">
<HintPath>..\..\Universe\UniverseModule\bin\Debug\Mirror_publicized.dll</HintPath>
</Reference>
<Reference Include="PluginAPI, Version=13.1.2.0, Culture=neutral, processorArchitecture=Amd64">
<HintPath>..\packages\Northwood.PluginAPI.13.1.2\lib\net48\PluginAPI.dll</HintPath>
</Reference>
<Reference Include="System"/>
<Reference Include="System.Core"/>
<Reference Include="System.Data"/>
<Reference Include="System.Xml"/>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\Universe\UniverseModule\bin\Debug\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="YamlDotNet, Version=11.0.0.0, Culture=neutral, PublicKeyToken=ec19458f3c15af5e, processorArchitecture=MSIL">
<HintPath>..\packages\YamlDotNet.11.0.1\lib\net45\YamlDotNet.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="EntryPoint.cs" />
<Compile Include="PlayerListCommandPatch.cs" />
<Compile Include="Properties\AssemblyInfo.cs"/>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->

</Project>
17 changes: 17 additions & 0 deletions BetterPlayerListCommand/EntryPoint.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using HarmonyLib;
using PluginAPI.Core;
using PluginAPI.Core.Attributes;

namespace BetterPlayerListCommand;

public class EntryPoint
{
[PluginEntryPoint("BetterPlayerListCommand", "1.0.0.0", "Improves the Players Command", "xNexusACS")]
private void Load()
{
Log.Info("BetterPlayerListCommand Loaded");

Harmony harmony = new("com.xnexusacs.patches");
harmony.PatchAll();
}
}
42 changes: 42 additions & 0 deletions BetterPlayerListCommand/PlayerListCommandPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Text;
using CentralAuth;
using CommandSystem;
using CommandSystem.Commands.Console;
using HarmonyLib;

namespace BetterPlayerListCommand;

[HarmonyPatch(typeof(PlayersCommand), nameof(PlayersCommand.Execute))]
public static class PlayerListCommandPatch
{
[HarmonyPrefix]
public static bool OnExecute(PlayersCommand __instance, ref bool __result, ArraySegment<string> arguments, ICommandSender sender, out string response)
{
if (ReferenceHub.LocalHub == null)
{
response = "The Dedicated Server is not connected or crashed.";
return false;
}

HashSet<ReferenceHub> allHubs = ReferenceHub.AllHubs;
StringBuilder stringBuilder = new StringBuilder();

stringBuilder.AppendLine(allHubs.Count is 0
? "<color=red>No players found.</color>"
: $"<color=red>All Players: ({(ServerStatic.IsDedicated ? allHubs.Count - 1 : allHubs.Count)})</color>");

foreach (ReferenceHub referenceHub in allHubs)
{
if (referenceHub.Mode is ClientInstanceMode.DedicatedServer)
continue;

stringBuilder.AppendLine($"<color=yellow>{(referenceHub.nicknameSync.Network_myNickSync ?? "(no nickname)")}</color>\n <color=cyan>User Id: {(referenceHub.authManager.UserId ?? "(no User ID)")} Ip Address: ({(referenceHub.queryProcessor._ipAddress ?? "no Ip Address")}) Player Id: [{referenceHub.PlayerId}]</color>\n");
}

response = stringBuilder.ToString();
__result = true;
return false;
}
}
35 changes: 35 additions & 0 deletions BetterPlayerListCommand/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("BetterPlayerListCommand")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BetterPlayerListCommand")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("838AF997-F3B8-4302-BADA-F2A6F747715E")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
5 changes: 5 additions & 0 deletions BetterPlayerListCommand/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Northwood.PluginAPI" version="13.1.2" targetFramework="net48" />
<package id="YamlDotNet" version="11.0.1" targetFramework="net48" />
</packages>

0 comments on commit fdd182b

Please sign in to comment.