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

Commit 5dc010b

Browse files
committed
Update for SE v165
1 parent cb5f5f4 commit 5dc010b

File tree

5 files changed

+107
-105
lines changed

5 files changed

+107
-105
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
//386
1+
//392
22
//
33
// This code was generated by a tool. Any changes made manually will be lost
44
// the next time this code is regenerated.
55
//
66

77
using System.Reflection;
88

9-
[assembly: AssemblyFileVersion("1.13.7.386")]
10-
[assembly: AssemblyVersion("1.13.7.386")]
9+
[assembly: AssemblyFileVersion("1.13.7.392")]
10+
[assembly: AssemblyVersion("1.13.7.392")]

EssentialsPlugin/ChatHandlers/ChatHandlerBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ public virtual Boolean CanHandle(ulong steamId, String[] words, ref int commandC
2424
{
2525
if ( PluginSettings.Instance.PromotedAdminCommands ) //promoted (Space Master) players can use admin commands
2626
{
27-
if ( steamId != 0 && !MySession.Static.HasPlayerAdminRights( steamId ) )
27+
if ( steamId != 0 && !MySession.Static.IsUserSpaceMaster( steamId ) )
2828
return false;
2929
}
3030
else
3131
{
32-
if ( steamId != 0 && !MyMultiplayer.Static.IsAdmin( steamId ) )
32+
if ( steamId != 0 && !MySession.Static.IsUserAdmin( steamId ) )
3333
return false;
3434
}
3535
}

EssentialsPlugin/Essentials.cs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,9 +1319,9 @@ private void DoInit( string path )
13191319
MyAPIGateway.Multiplayer.RegisterMessageHandler(9005, Communication.ReceiveMessageParts);
13201320
MyAPIGateway.Multiplayer.RegisterMessageHandler( 9007, Communication.HandleAddConcealExempt );
13211321
BlacklistManager.Instance.UpdateBlacklist();
1322-
_drillUpdateVal= (int)typeof(MyDrillConstants).GetField("DRILL_UPDATE_INTERVAL_IN_FRAMES").GetValue(null);
1323-
m_entitiesForUpdate10 = (CachingList<MyEntity>)typeof(MyEntities).GetField("m_entitiesForUpdate10", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null);
1324-
_countdownField = typeof(MyShipDrill).GetField("m_drillFrameCountdown", BindingFlags.NonPublic | BindingFlags.Instance);
1322+
//_drillUpdateVal= (int)typeof(MyDrillConstants).GetField("DRILL_UPDATE_INTERVAL_IN_FRAMES").GetValue(null);
1323+
//m_entitiesForUpdate10 = (CachingList<MyEntity>)typeof(MyEntities).GetField("m_entitiesForUpdate10", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null);
1324+
//_countdownField = typeof(MyShipDrill).GetField("m_drillFrameCountdown", BindingFlags.NonPublic | BindingFlags.Instance);
13251325
Log.Info( "Plugin '{0}' initialized. (Version: {1} ID: {2})", Name, Version, Id );
13261326
}
13271327

@@ -1454,34 +1454,34 @@ public void Shutdown( )
14541454
MyAPIGateway.Multiplayer.UnregisterMessageHandler( 9007, Communication.HandleAddConcealExempt );
14551455
}
14561456

1457-
private int _updateCounter;
1458-
private int _drillUpdateVal;
1459-
static CachingList<MyEntity> m_entitiesForUpdate10;
1460-
private FieldInfo _countdownField;
1457+
//private int _updateCounter;
1458+
//private int _drillUpdateVal;
1459+
//static CachingList<MyEntity> m_entitiesForUpdate10;
1460+
//private FieldInfo _countdownField;
14611461

14621462
public void Update( )
14631463
{
1464-
if (MyAPIGateway.Session == null)
1465-
return;
1464+
// if (MyAPIGateway.Session == null)
1465+
// return;
14661466

1467-
//if (++_updateCounter % 10 != 0)
1468-
// return;
1467+
// //if (++_updateCounter % 10 != 0)
1468+
// // return;
14691469

14701470

1471-
Wrapper.BeginGameAction( ( ) =>
1472-
{
1473-
//foreach (var entity in m_entitiesForUpdate10)
1474-
for(int i = 0; i < m_entitiesForUpdate10.Count; i++)
1475-
{
1476-
var entity = m_entitiesForUpdate10[i];
1477-
if (!( entity is MyShipDrill ))
1478-
continue;
1479-
//Log.Debug( "Update " + entity.DisplayName );
1480-
int val = (int)_countdownField.GetValue( entity );
1481-
val -= PluginSettings.Instance.DrillSpeed / 10;
1482-
_countdownField.SetValue( entity, val );
1483-
}
1484-
}, null, null );
1471+
// Wrapper.BeginGameAction( ( ) =>
1472+
// {
1473+
// //foreach (var entity in m_entitiesForUpdate10)
1474+
// for(int i = 0; i < m_entitiesForUpdate10.Count; i++)
1475+
// {
1476+
// var entity = m_entitiesForUpdate10[i];
1477+
// if (!( entity is MyShipDrill ))
1478+
// continue;
1479+
// //Log.Debug( "Update " + entity.DisplayName );
1480+
// int val = (int)_countdownField.GetValue( entity );
1481+
// val -= PluginSettings.Instance.DrillSpeed / 10;
1482+
// _countdownField.SetValue( entity, val );
1483+
// }
1484+
// }, null, null );
14851485
}
14861486

14871487
#endregion

EssentialsPlugin/EssentialsPlugin.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
<Compile Include="ChatHandlers\Admin\HandleAdminResetAsteroid.cs" />
8787
<Compile Include="ChatHandlers\Admin\HandleAdminPlayerCount.cs" />
8888
<Compile Include="ChatHandlers\Admin\HandleAdminVersion.cs" />
89+
<Compile Include="ChatHandlers\HandleHelp.cs" />
8990
<Compile Include="ChatHandlers\HandleRevoke.cs" />
9091
<Compile Include="ChatHandlers\HandleLastSeen.cs" />
9192
<Compile Include="ChatHandlers\Settings\HandleSettingsEnableBlockEnforcement.cs" />

EssentialsPlugin/NetworkHandlers/SyncPropertyHandler.cs

Lines changed: 76 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Sandbox.Game.Entities;
1010
using Sandbox.Game.Entities.Cube;
1111
using Sandbox.Game.Replication;
12+
using Sandbox.Game.Replication.StateGroups;
1213
using Sandbox.Game.World;
1314
using Sandbox.ModAPI;
1415
using Settings;
@@ -99,81 +100,81 @@ public override bool Handle( ulong remoteUserId, CallSite site, BitStream stream
99100
return false;
100101
}
101102

102-
bool found = false;
103-
foreach ( ProtectedItem item in PluginSettings.Instance.ProtectedItems )
104-
{
105-
if ( !item.Enabled )
106-
continue;
107-
108-
if ( item.EntityId != grid.EntityId )
109-
continue;
110-
111-
if ( !item.ProtectionSettingsDict.Dictionary.ContainsKey( ProtectedItem.ProtectionModeEnum.BlockSettings ) )
112-
continue;
113-
114-
ProtectedItem.ProtectionSettings settings = item.ProtectionSettingsDict[ProtectedItem.ProtectionModeEnum.BlockSettings];
115-
116-
if ( Protection.Instance.CheckPlayerExempt( settings, grid, remoteUserId ) )
117-
continue;
118-
119-
if ( item.LogOnly )
120-
{
121-
Essentials.Log.Info( $"Recieved block settings change request from user {PlayerMap.Instance.GetFastPlayerNameFromSteamId( remoteUserId )}:{remoteUserId} for block {entity.CustomName} on grid {grid.DisplayNameText ?? "ID"}:{item.EntityId}" );
122-
continue;
123-
}
124-
125-
if ( !string.IsNullOrEmpty( settings.PrivateWarningMessage ) )
126-
Communication.Notification( remoteUserId, MyFontEnum.Red, 5000, settings.PrivateWarningMessage );
127-
128-
if ( !string.IsNullOrEmpty( settings.PublicWarningMessage ) )
129-
Communication.SendPublicInformation( settings.PublicWarningMessage.Replace( "%player%", PlayerMap.Instance.GetFastPlayerNameFromSteamId( remoteUserId ) ) );
130-
131-
if ( settings.BroadcastGPS )
132-
{
133-
MyPlayer player = MySession.Static.Players.GetPlayerById( new MyPlayer.PlayerId( remoteUserId, 0 ) );
134-
Vector3D pos = player.GetPosition( );
135-
MyAPIGateway.Utilities.SendMessage( $"GPS:{player.DisplayName}:{pos.X}:{pos.Y}:{pos.Z}:" );
136-
}
137-
138-
Essentials.Log.Info($"Intercepted block settings change request from user {PlayerMap.Instance.GetFastPlayerNameFromSteamId(remoteUserId)}:{remoteUserId} for block {entity.CustomName} on grid {grid.DisplayNameText ?? "ID"}:{item.EntityId}" );
139-
140-
switch ( settings.PunishmentType )
141-
{
142-
case ProtectedItem.PunishmentEnum.Kick:
143-
_kickTimer.Elapsed += ( sender, e ) =>
144-
{
145-
Essentials.Log.Info( $"Kicked user {PlayerMap.Instance.GetFastPlayerNameFromSteamId( remoteUserId )}:{remoteUserId} for changing block settings on protected grid {grid.DisplayNameText ?? "ID"}:{item.EntityId}" );
146-
MyMultiplayer.Static.KickClient( remoteUserId );
147-
};
148-
_kickTimer.AutoReset = false;
149-
_kickTimer.Start( );
150-
break;
151-
case ProtectedItem.PunishmentEnum.Ban:
152-
_kickTimer.Elapsed += ( sender, e ) =>
153-
{
154-
Essentials.Log.Info( $"Banned user {PlayerMap.Instance.GetFastPlayerNameFromSteamId( remoteUserId )}:{remoteUserId} for changing block settings on protected grid {grid.DisplayNameText ?? "ID"}:{item.EntityId}" );
155-
MyMultiplayer.Static.BanClient( remoteUserId, true );
156-
};
157-
_kickTimer.AutoReset = false;
158-
_kickTimer.Start( );
159-
break;
160-
case ProtectedItem.PunishmentEnum.Speed:
161-
Task.Run( ( ) =>
162-
{
163-
lock ( ProcessSpeed.SpeedPlayers )
164-
{
165-
long playerId = PlayerMap.Instance.GetFastPlayerIdFromSteamId( remoteUserId );
166-
ProcessSpeed.SpeedPlayers[playerId] = new Tuple<float, DateTime>( (float)settings.SpeedLimit, DateTime.Now + TimeSpan.FromMinutes( settings.SpeedTime ) );
167-
}
168-
} );
169-
Essentials.Log.Info( $"Limited user {PlayerMap.Instance.GetFastPlayerNameFromSteamId( remoteUserId )} to {settings.SpeedLimit}m/s for {settings.SpeedTime} minutes" );
170-
break;
171-
}
172-
173-
found = true;
174-
}
175-
176-
return found;
103+
//bool found = false;
104+
//foreach ( ProtectedItem item in PluginSettings.Instance.ProtectedItems )
105+
//{
106+
// if ( !item.Enabled )
107+
// continue;
108+
109+
// if ( item.EntityId != grid.EntityId )
110+
// continue;
111+
112+
// if ( !item.ProtectionSettingsDict.Dictionary.ContainsKey( ProtectedItem.ProtectionModeEnum.BlockSettings ) )
113+
// continue;
114+
115+
// ProtectedItem.ProtectionSettings settings = item.ProtectionSettingsDict[ProtectedItem.ProtectionModeEnum.BlockSettings];
116+
117+
// if ( Protection.Instance.CheckPlayerExempt( settings, grid, remoteUserId ) )
118+
// continue;
119+
120+
// if ( item.LogOnly )
121+
// {
122+
// Essentials.Log.Info( $"Recieved block settings change request from user {PlayerMap.Instance.GetFastPlayerNameFromSteamId( remoteUserId )}:{remoteUserId} for block {entity.CustomName} on grid {grid.DisplayNameText ?? "ID"}:{item.EntityId}" );
123+
// continue;
124+
// }
125+
126+
// if ( !string.IsNullOrEmpty( settings.PrivateWarningMessage ) )
127+
// Communication.Notification( remoteUserId, MyFontEnum.Red, 5000, settings.PrivateWarningMessage );
128+
129+
// if ( !string.IsNullOrEmpty( settings.PublicWarningMessage ) )
130+
// Communication.SendPublicInformation( settings.PublicWarningMessage.Replace( "%player%", PlayerMap.Instance.GetFastPlayerNameFromSteamId( remoteUserId ) ) );
131+
132+
// if ( settings.BroadcastGPS )
133+
// {
134+
// MyPlayer player = MySession.Static.Players.GetPlayerById( new MyPlayer.PlayerId( remoteUserId, 0 ) );
135+
// Vector3D pos = player.GetPosition( );
136+
// MyAPIGateway.Utilities.SendMessage( $"GPS:{player.DisplayName}:{pos.X}:{pos.Y}:{pos.Z}:" );
137+
// }
138+
139+
// Essentials.Log.Info($"Intercepted block settings change request from user {PlayerMap.Instance.GetFastPlayerNameFromSteamId(remoteUserId)}:{remoteUserId} for block {entity.CustomName} on grid {grid.DisplayNameText ?? "ID"}:{item.EntityId}" );
140+
141+
// switch ( settings.PunishmentType )
142+
// {
143+
// case ProtectedItem.PunishmentEnum.Kick:
144+
// _kickTimer.Elapsed += ( sender, e ) =>
145+
// {
146+
// Essentials.Log.Info( $"Kicked user {PlayerMap.Instance.GetFastPlayerNameFromSteamId( remoteUserId )}:{remoteUserId} for changing block settings on protected grid {grid.DisplayNameText ?? "ID"}:{item.EntityId}" );
147+
// MyMultiplayer.Static.KickClient( remoteUserId );
148+
// };
149+
// _kickTimer.AutoReset = false;
150+
// _kickTimer.Start( );
151+
// break;
152+
// case ProtectedItem.PunishmentEnum.Ban:
153+
// _kickTimer.Elapsed += ( sender, e ) =>
154+
// {
155+
// Essentials.Log.Info( $"Banned user {PlayerMap.Instance.GetFastPlayerNameFromSteamId( remoteUserId )}:{remoteUserId} for changing block settings on protected grid {grid.DisplayNameText ?? "ID"}:{item.EntityId}" );
156+
// MyMultiplayer.Static.BanClient( remoteUserId, true );
157+
// };
158+
// _kickTimer.AutoReset = false;
159+
// _kickTimer.Start( );
160+
// break;
161+
// case ProtectedItem.PunishmentEnum.Speed:
162+
// Task.Run( ( ) =>
163+
// {
164+
// lock ( ProcessSpeed.SpeedPlayers )
165+
// {
166+
// long playerId = PlayerMap.Instance.GetFastPlayerIdFromSteamId( remoteUserId );
167+
// ProcessSpeed.SpeedPlayers[playerId] = new Tuple<float, DateTime>( (float)settings.SpeedLimit, DateTime.Now + TimeSpan.FromMinutes( settings.SpeedTime ) );
168+
// }
169+
// } );
170+
// Essentials.Log.Info( $"Limited user {PlayerMap.Instance.GetFastPlayerNameFromSteamId( remoteUserId )} to {settings.SpeedLimit}m/s for {settings.SpeedTime} minutes" );
171+
// break;
172+
// }
173+
174+
// found = true;
175+
//}
176+
177+
//return found;
177178
}
178179
}
179180
}

0 commit comments

Comments
 (0)