Minor refactors
This commit is contained in:
parent
93a7b0aafe
commit
c7a6d044f4
5 changed files with 18 additions and 25 deletions
|
|
@ -31,7 +31,7 @@ namespace TShockAPI.Handlers.NetModules
|
|||
/// <param name="rejectPacket"></param>
|
||||
public void HandlePacket(TSPlayer player, out bool rejectPacket)
|
||||
{
|
||||
if (!CheckPermission(PowerType, player))
|
||||
if (!HasPermission(PowerType, player))
|
||||
{
|
||||
rejectPacket = true;
|
||||
return;
|
||||
|
|
@ -46,7 +46,7 @@ namespace TShockAPI.Handlers.NetModules
|
|||
/// <param name="powerType"></param>
|
||||
/// <param name="player"></param>
|
||||
/// <returns></returns>
|
||||
public static bool CheckPermission(CreativePowerTypes powerType, TSPlayer player)
|
||||
public static bool HasPermission(CreativePowerTypes powerType, TSPlayer player)
|
||||
{
|
||||
if (!PowerToPermissionMap.ContainsKey(powerType))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ namespace TShockAPI.Handlers.NetModules
|
|||
/// <param name="data"></param>
|
||||
public void Deserialize(MemoryStream data)
|
||||
{
|
||||
// For whatever reason Terraria writes '0' to the stream at the beginning of this packet.
|
||||
// If this value is not 0 then its been crafted by a non-vanilla client.
|
||||
// We don't actually know why the 0 is written, so we're just going to call this UnknownField for now
|
||||
UnknownField = data.ReadInt8();
|
||||
if (UnknownField == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ namespace TShockAPI.Handlers.NetModules
|
|||
/// <summary>
|
||||
/// Handles packet 82 - Load Net Module packets
|
||||
/// </summary>
|
||||
public class NetModulePacketHandler : IPacketHandler<LoadNetModuleEventArgs>
|
||||
public class NetModulePacketHandler : IPacketHandler<ReadNetModuleEventArgs>
|
||||
{
|
||||
/// <summary>
|
||||
/// Maps net module types to handlers for the net module type. Add to or edit this dictionary to customise handling
|
||||
|
|
@ -29,7 +29,7 @@ namespace TShockAPI.Handlers.NetModules
|
|||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="args"></param>
|
||||
public void OnReceive(object sender, LoadNetModuleEventArgs args)
|
||||
public void OnReceive(object sender, ReadNetModuleEventArgs args)
|
||||
{
|
||||
INetModuleHandler handler;
|
||||
|
||||
|
|
@ -39,17 +39,8 @@ namespace TShockAPI.Handlers.NetModules
|
|||
}
|
||||
else
|
||||
{
|
||||
// As of 1.4.x.x, this is now used for more things:
|
||||
// NetCreativePowersModule
|
||||
// NetCreativePowerPermissionsModule
|
||||
// NetLiquidModule
|
||||
// NetParticlesModule
|
||||
// NetPingModule
|
||||
// NetTeleportPylonModule
|
||||
// NetTextModule
|
||||
// I (particles) have disabled the original return here, which means that we need to
|
||||
// handle this more. In the interm, this unbreaks parts of vanilla. Originally
|
||||
// we just blocked this because it was a liquid exploit.
|
||||
// We don't have handlers for NetModuleType.Ping and NetModuleType.Particles.
|
||||
// These net modules are fairly innocuous and can be processed normally by the game
|
||||
args.Handled = false;
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue