Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Commit

Permalink
Fix chat crash. Refactor reserved slot system. Admins and whitelisted…
Browse files Browse the repository at this point in the history
… players can simply bypass the player limit set on the server.
  • Loading branch information
rexxar-tc committed Jun 1, 2017
1 parent 6835df0 commit eccb2b8
Show file tree
Hide file tree
Showing 7 changed files with 248 additions and 305 deletions.
74 changes: 0 additions & 74 deletions EssentialsPlugin.sln.DotSettings

This file was deleted.

6 changes: 3 additions & 3 deletions EssentialsPlugin/AssemblyFileVersion.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//421
//430
//
// This code was generated by a tool. Any changes made manually will be lost
// the next time this code is regenerated.
//

using System.Reflection;

[assembly: AssemblyFileVersion("1.13.7.421")]
[assembly: AssemblyVersion("1.13.7.421")]
[assembly: AssemblyFileVersion("1.13.7.430")]
[assembly: AssemblyVersion("1.13.7.430")]
30 changes: 15 additions & 15 deletions EssentialsPlugin/Essentials.cs
Original file line number Diff line number Diff line change
Expand Up @@ -951,21 +951,21 @@ public bool ReservedSlotsEnabled
}
}

[Category( "Reserved Slots" )]
[Description( "Number of slots to reserve." )]
[Browsable( true )]
[ReadOnly( false )]
public int ReservedSlotsCount
{
get
{
return PluginSettings.Instance.ReservedSlotsCount;
}
set
{
PluginSettings.Instance.ReservedSlotsCount = value;
}
}
//[Category( "Reserved Slots" )]
//[Description( "Number of slots to reserve." )]
//[Browsable( true )]
//[ReadOnly( false )]
//public int ReservedSlotsCount
//{
// get
// {
// return PluginSettings.Instance.ReservedSlotsCount;
// }
// set
// {
// PluginSettings.Instance.ReservedSlotsCount = value;
// }
//}

[Category( "Reserved Slots" )]
[Description( "Group ID number. Players in this group can occupy a reserved slot." )]
Expand Down
52 changes: 26 additions & 26 deletions EssentialsPlugin/NetworkHandlers/SyncPropertyHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,44 +61,44 @@ public override bool Handle( ulong remoteUserId, CallSite site, BitStream stream
{
//TODO
return false;
MyPropertySyncStateGroup sync = (MyPropertySyncStateGroup)obj;
//MyPropertySyncStateGroup sync = (MyPropertySyncStateGroup)obj;

var properties = (ListReader<SyncBase>)sync.GetType().GetField("m_properties", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(sync);
//var properties = (ListReader<SyncBase>)sync.GetType().GetField("m_properties", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(sync);

byte index = 0;
BitReaderWriter bits = new BitReaderWriter();
//byte index = 0;
//BitReaderWriter bits = new BitReaderWriter();

Serialize(site.MethodInfo, stream, ref index, ref bits);
//Serialize(site.MethodInfo, stream, ref index, ref bits);

MyTerminalBlock entity = null;
//MyTerminalBlock entity = null;

MyExternalReplicable<MySyncedBlock> rep = sync.Owner as MyExternalReplicable<MySyncedBlock>;
//MyExternalReplicable<MySyncedBlock> rep = sync.Owner as MyExternalReplicable<MySyncedBlock>;

if ( rep == null )
{
//there are lots of reasons this wouldn't be MySyncedBlock, so just ignore it and move on
return false;
}
//if ( rep == null )
//{
// //there are lots of reasons this wouldn't be MySyncedBlock, so just ignore it and move on
// return false;
//}

entity = rep.Instance as MyTerminalBlock;
//entity = rep.Instance as MyTerminalBlock;

MyCubeGrid grid = entity?.CubeGrid;
//MyCubeGrid grid = entity?.CubeGrid;

if ( grid == null )
{
Essentials.Log.Info( "Null grid in SyncPropertyHandler" );
return false;
}
//if ( grid == null )
//{
// Essentials.Log.Info( "Null grid in SyncPropertyHandler" );
// return false;
//}


Essentials.Log.Warn( $"{entity.CustomName} | {index} | {properties[index].ValueType}" );
//Essentials.Log.Warn( $"{entity.CustomName} | {index} | {properties[index].ValueType}" );

if (entity is MyLandingGear)
{
//clients sometimes send updates for landing gear for no discernable reason?
//just ignore it, it's mostly harmless
return false;
}
//if (entity is MyLandingGear)
//{
// //clients sometimes send updates for landing gear for no discernable reason?
// //just ignore it, it's mostly harmless
// return false;
//}

//bool found = false;
//foreach ( ProtectedItem item in PluginSettings.Instance.ProtectedItems )
Expand Down
Loading

0 comments on commit eccb2b8

Please sign in to comment.