Overall I think this is pretty lazy work and you did not spend the time to understand C# as a programming language, this release has not only loads of problems but big design mistakes everywhere (in matter of fact every class pretty much).
Code:
/// <summary>
/// Gets a handshake type.
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public static HandshakeType GetHandshakeType(int id)
{
return ((HandshakeType[])Enum.GetValues(typeof(HandshakeType))).FirstOrDefault(a => (int)a == id);
}
}
You are running a LINQ extension function to acquire an enum value by integer first by casting the enum to an array however the iteration with LINQ is absolutely unneccessary, you could simplify it like this with casting and without iteration! (honestly this static getter should not even exist):
Code:
public static HandshakeType GetHandshakeType(int id) => (HandshakeType) id;
Constants should be named with PascalCamelCase (I see you are using java-like naming), this same has happen with enums they should be named with pascal camel casing. Also using DotNetty is not that great in C# unlike in Java.
There are in HandshakeDecoder
Code:
if (message.GetType() == typeof(GamePacketRequest))
While you can just simplify it:
Code:
if (message is GamePacketRequest request)
Also I see you are using the sealed class modifier incorrectly at lots of classes (have you read https://docs.microsoft.com/en-us/dot...eywords/sealed )
There are loads and I mean LOADS of problems and design issues:
Code:
/// <summary>
/// The appearance manager.
/// </summary>
private readonly AppearanceManager appearanceManager;
/// <summary>
/// Gets the appearance manager.
/// </summary>
/// <returns></returns>
public AppearanceManager GetAppearanceManager()
{
return appearanceManager;
}
This is not a thing in C#. What you CAN do here is using a property:
Code:
public AppearanceManager Appearence { get; private set; } //assuming this is not set from ctor
In this you could finally use System.LINQ correctly:
Code:
foreach (var b in player.GetActorRenderer().GetUpdateBlocks())
{
if (b != null)
mask |= b.GetMask();
}
As LINQ
Code:
int mask = player.GetActorRenderer().GetUpdateBlocks().Where(b => b != null).Aggregate(0x0, (current, b) => current | b.GetMask());
Don't take my comment negative but constructive.