Skip to content

Commit

Permalink
fix(/tradechest): make command work again
Browse files Browse the repository at this point in the history
  • Loading branch information
CoderCow committed Jun 4, 2017
1 parent 1b44181 commit ed75e15
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions Implementation/PluginCooperationHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ private enum InfiniteChestsChestFlags {

public PluginTrace PluginTrace { get; }
public Configuration Config { get; private set; }
public ChestManager ChestManager { get; private set; }
public ChestManager ChestManager { get; set; }
public bool IsSeconomyAvailable { get; private set; }


public PluginCooperationHandler(PluginTrace pluginTrace, Configuration config, ChestManager chestManager) {
Contract.Requires<ArgumentNullException>(pluginTrace != null);
Contract.Requires<ArgumentNullException>(config != null);
Contract.Requires<ArgumentNullException>(chestManager != null);

this.PluginTrace = pluginTrace;
this.Config = config;
Expand All @@ -49,6 +48,8 @@ public PluginCooperationHandler(PluginTrace pluginTrace, Configuration config, C
public void InfiniteChests_ChestDataImport(
ChestManager chestManager, ProtectionManager protectionManager, out int importedChests, out int protectFailures
) {
Contract.Assert(this.ChestManager != null);

importedChests = 0;
protectFailures = 0;

Expand Down
7 changes: 4 additions & 3 deletions Implementation/ProtectorPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,13 @@ private void Game_PostInitialize(EventArgs e) {
if (!this.InitWorldMetdataHandler())
return;

this.PluginCooperationHandler = new PluginCooperationHandler(this.Trace, this.Config, this.ChestManager);
this.ChestManager = new ChestManager(
this.Trace, this.Config, this.ServerMetadataHandler, this.WorldMetadata, this.PluginCooperationHandler);
this.ProtectionManager = new ProtectionManager(
this.Trace, this.Config, this.ChestManager, this.ServerMetadataHandler, this.WorldMetadata);

this.PluginCooperationHandler = new PluginCooperationHandler(this.Trace, this.Config, this.ChestManager);
this.PluginCooperationHandler.ChestManager = this.ChestManager;

this.InitUserInteractionHandler();
this.UserInteractionHandler.EnsureProtectionData(TSPlayer.Server);
Expand Down Expand Up @@ -209,7 +210,7 @@ private void AddHooks() {
if (this.GetDataHookHandler != null)
throw new InvalidOperationException("Hooks already registered.");

// this hook should ideally be registered BEFORE all other plugins
// this handler should ideally be registered BEFORE all other plugins
this.GetDataHookHandler = new GetDataHookHandler(this, true);
this.GetDataHookHandler.TileEdit += this.Net_TileEdit;
this.GetDataHookHandler.SignEdit += this.Net_SignEdit;
Expand All @@ -224,7 +225,7 @@ private void AddHooks() {
this.GetDataHookHandler.DoorUse += this.Net_DoorUse;
this.GetDataHookHandler.QuickStackNearby += this.Net_QuickStackNearby;

// this hook should ideally be registered AFTER all other plugins
// this handler should ideally be registered AFTER all other plugins
this.GetDataHookHandlerLate = new GetDataHookHandler(this, true, -100);
this.GetDataHookHandlerLate.TileEdit += this.Net_TileEditLate;
this.GetDataHookHandlerLate.ObjectPlacement += this.Net_ObjectPlacement;
Expand Down

0 comments on commit ed75e15

Please sign in to comment.