-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finally decoding/encoding packets in plugins manner
- Loading branch information
Showing
89 changed files
with
1,316 additions
and
741 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
src/Void.Proxy.API/Events/Handshake/SearchChannelBuilderEvent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
using System.Net.Sockets; | ||
using Void.Proxy.API.Network.IO.Channels; | ||
using Void.Proxy.API.Network.Protocol.Services; | ||
using Void.Proxy.API.Players; | ||
|
||
namespace Void.Proxy.API.Events.Handshake; | ||
|
||
public class SearchChannelBuilderEvent : IEventWithResult<Func<NetworkStream, Task<IMinecraftChannel>>> | ||
public class SearchChannelBuilderEvent : IEventWithResult<ChannelBuilder> | ||
{ | ||
public required Memory<byte> Buffer { get; init; } | ||
public Func<NetworkStream, Task<IMinecraftChannel>>? Result { get; set; } | ||
public required IPlayer Player { get; init; } | ||
public ChannelBuilder? Result { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Void.Proxy.API.Network; | ||
using Void.Proxy.API.Network.IO.Channels; | ||
using Void.Proxy.API.Network.IO.Messages; | ||
using Void.Proxy.API.Players; | ||
using Void.Proxy.API.Servers; | ||
|
||
namespace Void.Proxy.API.Events.Network; | ||
|
||
public class MessageReceivedEvent : IEventWithResult<bool> | ||
{ | ||
public required Side From { get; init; } | ||
public required Direction To { get; init; } | ||
public required IMinecraftMessage Message { get; init; } | ||
public required IPlayer Player { get; init; } | ||
public required IServer Server { get; init; } | ||
public required IMinecraftChannel PlayerChannel { get; init; } | ||
public required IMinecraftChannel ServerChannel { get; init; } | ||
|
||
/// <summary> | ||
/// <see langword="true" /> if packet should not be sent | ||
/// </summary> | ||
public bool Result { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Void.Proxy.API.Network; | ||
using Void.Proxy.API.Network.IO.Channels; | ||
using Void.Proxy.API.Network.IO.Messages; | ||
using Void.Proxy.API.Players; | ||
using Void.Proxy.API.Servers; | ||
|
||
namespace Void.Proxy.API.Events.Network; | ||
|
||
public class MessageSentEvent : IEvent | ||
{ | ||
public required Side From { get; init; } | ||
public required Direction To { get; init; } | ||
public required IMinecraftMessage Message { get; init; } | ||
public required IPlayer Player { get; init; } | ||
public required IServer Server { get; init; } | ||
public required IMinecraftChannel PlayerChannel { get; init; } | ||
public required IMinecraftChannel ServerChannel { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using Void.Proxy.API.Players; | ||
|
||
namespace Void.Proxy.API.Events.Player; | ||
|
||
public class PlayerConnectedEvent : IEvent | ||
{ | ||
public required IPlayer Player { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using Void.Proxy.API.Players; | ||
|
||
namespace Void.Proxy.API.Events.Player; | ||
|
||
public class PlayerDisconnectedEvent : IEvent | ||
{ | ||
public required IPlayer Player { get; init; } | ||
} |
10 changes: 10 additions & 0 deletions
10
src/Void.Proxy.API/Events/Player/PlayerSearchServerEvent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Void.Proxy.API.Players; | ||
using Void.Proxy.API.Servers; | ||
|
||
namespace Void.Proxy.API.Events.Player; | ||
|
||
public class PlayerSearchServerEvent : IEventWithResult<IServer> | ||
{ | ||
public required IPlayer Player { get; init; } | ||
public IServer? Result { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using Void.Proxy.API.Plugins; | ||
|
||
namespace Void.Proxy.API.Events.Plugins; | ||
|
||
public class PluginLoadEvent : IEvent | ||
{ | ||
public required IPlugin Plugin { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using Void.Proxy.API.Plugins; | ||
|
||
namespace Void.Proxy.API.Events.Plugins; | ||
|
||
public class PluginUnloadEvent : IEvent | ||
{ | ||
public required IPlugin Plugin { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace Void.Proxy.API.Extensions; | ||
|
||
public static class TaskExtensions | ||
{ | ||
public static Task CatchExceptions(this Task task) | ||
{ | ||
return task.ContinueWith(completedTask => | ||
{ | ||
if (completedTask.Exception != null) | ||
Console.WriteLine("Unhandled task Exception:\n" + completedTask.Exception.InnerException); | ||
}, | ||
TaskContinuationOptions.OnlyOnFaulted); | ||
} | ||
|
||
public static Task CatchExceptions(this ValueTask task) | ||
{ | ||
return task.AsTask() | ||
.CatchExceptions(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace Void.Proxy.API.Forwarding; | ||
|
||
public interface IForwarding | ||
{ | ||
public string Name { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Void.Proxy.API.Forwarding; | ||
|
||
public interface IForwardingService | ||
{ | ||
IReadOnlyList<IForwarding> All { get; } | ||
|
||
void Register(IForwarding forwarding); | ||
void RegisterDefault(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.