diff --git a/Core/AttachedData.cs b/Core/AttachedData.cs index 493c47a..e25c00c 100644 --- a/Core/AttachedData.cs +++ b/Core/AttachedData.cs @@ -6,7 +6,7 @@ namespace Chireiden.TShock.Omni; public partial class Plugin { - private readonly ConditionalWeakTable _playerData = new ConditionalWeakTable(); + private readonly ConditionalWeakTable _playerData = []; public AttachedData? this[TShockAPI.TSPlayer player] { @@ -62,7 +62,7 @@ public AttachedData(TShockAPI.TSPlayer player, int logCount, List(logCount); this.RecentPings = Terraria.Main.item.Select(_ => new PendingAck()).ToArray(); - this.DelayCommands = new List(); + this.DelayCommands = []; this.ChatSpamRestrict = chatLimiter.Select(lc => (Limiter) lc).ToArray(); } diff --git a/Core/CliConfig.cs b/Core/CliConfig.cs index b8e6544..3530289 100644 --- a/Core/CliConfig.cs +++ b/Core/CliConfig.cs @@ -116,7 +116,6 @@ internal enum PendingConfig /// /// /// - MaxPlayers, /// @@ -154,7 +153,6 @@ internal enum PendingConfig /// Port, - /// /// Order: /// diff --git a/Core/Enhancements.cs b/Core/Enhancements.cs index 3b449f9..b7bfe8e 100644 --- a/Core/Enhancements.cs +++ b/Core/Enhancements.cs @@ -99,7 +99,7 @@ private void TAHook_NameCollision(TerrariaApi.Server.NameCollisionEventArgs args } internal Dictionary _localizedCommandsMap = []; - private readonly System.Runtime.CompilerServices.ConditionalWeakTable> _addedAlias = new(); + private readonly System.Runtime.CompilerServices.ConditionalWeakTable> _addedAlias = []; private string Detour_HelpAliases(Func orig, object _instance, TShockAPI.Command command) { var ac = this.config.Enhancements.Value.ShowCommandAlias.Value; diff --git a/Core/FirstChance.cs b/Core/FirstChance.cs index cadbcec..d8456a8 100644 --- a/Core/FirstChance.cs +++ b/Core/FirstChance.cs @@ -6,7 +6,7 @@ namespace Chireiden.TShock.Omni; public partial class Plugin { private readonly ThreadLocal inFirstChance = new ThreadLocal(() => 0); - private readonly HashSet exceptions = new HashSet(); + private readonly HashSet exceptions = []; private void FirstChanceExceptionHandler(object? sender, FirstChanceExceptionEventArgs args) { diff --git a/Core/Json.cs b/Core/Json.cs index 3baf86a..97c15d1 100644 --- a/Core/Json.cs +++ b/Core/Json.cs @@ -7,16 +7,15 @@ namespace Chireiden.TShock.Omni.Json; - public static class JsonUtils { - private static readonly List _jsonconverters = new List - { + private static readonly List _jsonconverters = + [ new OptionalConverter(), new LimiterConverter(), new StringEnumConverter(), new PacketFilterConverter(), - }; + ]; public static T DeserializeConfig(string value) { diff --git a/Core/Modded.cs b/Core/Modded.cs index 81698fc..2c703fe 100644 --- a/Core/Modded.cs +++ b/Core/Modded.cs @@ -2,7 +2,7 @@ public partial class Plugin { - private readonly HashSet AllowedPackets = new HashSet(); + private readonly HashSet AllowedPackets = []; private void OTHook_Modded_GetData(object? sender, OTAPI.Hooks.MessageBuffer.GetDataEventArgs args) { static bool ModdedEarlyChatSpam(int whoAmI, PacketTypes packetId, HashSet allowedPackets) diff --git a/Core/PacketSpam.cs b/Core/PacketSpam.cs index cbde9df..1a47e79 100644 --- a/Core/PacketSpam.cs +++ b/Core/PacketSpam.cs @@ -9,7 +9,7 @@ public partial class Plugin internal class ConnectionStore { public ConcurrentDictionary Connections { get; } = new ConcurrentDictionary(); - public ConditionalWeakTable AttachedData { get; } = new ConditionalWeakTable(); + public ConditionalWeakTable AttachedData { get; } = []; internal class Connection { diff --git a/Core/Plugin.cs b/Core/Plugin.cs index 4820d9a..908e284 100644 --- a/Core/Plugin.cs +++ b/Core/Plugin.cs @@ -28,6 +28,12 @@ public Plugin(Main game) : base(game) Utils.AssemblyMutex(this); AppDomain.CurrentDomain.AssemblyResolve += this.AssemblyResolveHandler; AppDomain.CurrentDomain.FirstChanceException += this.FirstChanceExceptionHandler; + var pa = System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture; + if (pa is not System.Runtime.InteropServices.Architecture.X64 and not System.Runtime.InteropServices.Architecture.X86) + { + Console.WriteLine($"TShock is running under {pa}, some features may not work."); + } + this.Order = -1_000_000; this.ReadConfig(Utils.ConsolePlayer.Instance, true); diff --git a/Core/Plugin.csproj b/Core/Plugin.csproj index 0976160..fcd6d2f 100644 --- a/Core/Plugin.csproj +++ b/Core/Plugin.csproj @@ -31,10 +31,9 @@ - + ContentFiles - diff --git a/Misc/Misc.csproj b/Misc/Misc.csproj index e20636f..a2041a7 100644 --- a/Misc/Misc.csproj +++ b/Misc/Misc.csproj @@ -39,10 +39,9 @@ - + ContentFiles - diff --git a/SourceGen/SourceGen.csproj b/SourceGen/SourceGen.csproj index a1f8c22..62ee203 100644 --- a/SourceGen/SourceGen.csproj +++ b/SourceGen/SourceGen.csproj @@ -10,8 +10,8 @@ - - + +