public UserInteractionHandler( PluginTrace pluginTrace, PluginInfo pluginInfo, Configuration config, WorldMetadata worldMetadata, PluginCooperationHandler pluginCooperationHandler, Action reloadConfigurationCallback ): base(pluginTrace) { Contract.Requires<ArgumentNullException>(pluginTrace != null); Contract.Requires<ArgumentNullException>(config != null); Contract.Requires<ArgumentNullException>(worldMetadata != null); Contract.Requires<ArgumentNullException>(pluginCooperationHandler != null); Contract.Requires<ArgumentNullException>(reloadConfigurationCallback != null); this.PluginInfo = pluginInfo; this.Config = config; this.WorldMetadata = worldMetadata; this.PluginCooperationHandler = pluginCooperationHandler; this.ReloadConfigurationCallback = reloadConfigurationCallback; this.RegisterCommand(new[] { "advancedcircuits", "ac" }, this.RootCommand_Exec); }
public ProtectorPlugin(Main game) : base(game) { this.pluginInfo = new PluginInfo( "Protector", Assembly.GetAssembly(typeof(ProtectorPlugin)).GetName().Version, "Beta", "CoderCow", "Protects blocks and objects from being changed." ); this.Order = 1; #if DEBUG if (Debug.Listeners.Count == 0) Debug.Listeners.Add(new ConsoleTraceListener()); #endif this.trace = new PluginTrace(ProtectorPlugin.TracePrefix); ProtectorPlugin.latestInstance = this; }
public UserInteractionHandler( PluginTrace trace, PluginInfo pluginInfo, Configuration config, HousingManager housingManager, Func<Configuration> reloadConfigurationCallback ) : base(trace) { Contract.Requires<ArgumentNullException>(trace != null); Contract.Requires<ArgumentException>(!pluginInfo.Equals(PluginInfo.Empty)); Contract.Requires<ArgumentNullException>(config != null); Contract.Requires<ArgumentNullException>(housingManager != null); Contract.Requires<ArgumentNullException>(reloadConfigurationCallback != null); this.PluginInfo = pluginInfo; this.Config = config; this.HousingManager = housingManager; this.ReloadConfigurationCallback = reloadConfigurationCallback; #region Command Setup base.RegisterCommand( new[] { "house", "housing" }, this.RootCommand_Exec, this.RootCommand_HelpCallback ); #endregion }
public UserInteractionHandler( PluginTrace trace, PluginInfo pluginInfo, Configuration config, ServerMetadataHandler serverMetadataHandler, WorldMetadata worldMetadata, ProtectionManager protectionManager, ChestManager chestManager, PluginCooperationHandler pluginCooperationHandler, Func<Configuration> reloadConfigurationCallback ) : base(trace) { Contract.Requires<ArgumentNullException>(trace != null); Contract.Requires<ArgumentException>(!pluginInfo.Equals(PluginInfo.Empty)); Contract.Requires<ArgumentNullException>(config != null); Contract.Requires<ArgumentNullException>(serverMetadataHandler != null); Contract.Requires<ArgumentNullException>(worldMetadata != null); Contract.Requires<ArgumentNullException>(protectionManager != null); Contract.Requires<ArgumentNullException>(pluginCooperationHandler != null); Contract.Requires<ArgumentNullException>(reloadConfigurationCallback != null); this.PluginInfo = pluginInfo; this.Config = config; this.ServerMetadataHandler = serverMetadataHandler; this.WorldMetadata = worldMetadata; this.ChestManager = chestManager; this.ProtectionManager = protectionManager; this.PluginCooperationHandler = pluginCooperationHandler; this.ReloadConfigurationCallback = reloadConfigurationCallback; this.PlayerIndexChestDictionary = new Dictionary<int,DPoint>(20); this.ChestPlayerIndexDictionary = new Dictionary<DPoint,int>(20); #region Command Setup base.RegisterCommand( new[] { "protector" }, this.RootCommand_Exec, this.RootCommand_HelpCallback ); base.RegisterCommand( new[] { "protect", "pt" }, this.ProtectCommand_Exec, this.ProtectCommand_HelpCallback, ProtectorPlugin.ManualProtect_Permission, allowServer: false ); base.RegisterCommand( new[] { "deprotect", "dp" }, this.DeprotectCommand_Exec, this.DeprotectCommand_HelpCallback, ProtectorPlugin.ManualDeprotect_Permission, allowServer: false ); base.RegisterCommand( new[] { "protectioninfo", "ptinfo", "pi" }, this.ProtectionInfoCommand_Exec, this.ProtectionInfoCommand_HelpCallback, allowServer: false ); base.RegisterCommand( new[] { "share" }, this.ShareCommand_Exec, this.ShareCommandHelpCallback, allowServer: false ); base.RegisterCommand( new[] { "unshare" }, this.UnshareCommand_Exec, this.UnshareCommand_HelpCallback, allowServer: false ); base.RegisterCommand( new[] { "sharepublic" }, this.SharePublicCommand_Exec, this.SharePublicCommandHelpCallback, allowServer: false ); base.RegisterCommand( new[] { "unsharepublic" }, this.UnsharePublicCommand_Exec, this.UnsharePublicCommand_HelpCallback, allowServer: false ); base.RegisterCommand( new[] { "sharegroup" }, this.ShareGroupCommand_Exec, this.ShareGroupCommand_HelpCallback, ProtectorPlugin.ShareWithGroups_Permission, allowServer: false ); base.RegisterCommand( new[] { "unsharegroup" }, this.UnshareGroupCommand_Exec, this.UnshareGroup_HelpCallback, ProtectorPlugin.ShareWithGroups_Permission, allowServer: false ); base.RegisterCommand( new[] { "lockchest", "lchest" }, this.LockChestCommand_Exec, this.LockChestCommand_HelpCallback, ProtectorPlugin.Utility_Permission, allowServer: false ); base.RegisterCommand( new[] { "swapchest", "schest" }, this.SwapChestCommand_Exec, this.SwapChestCommand_HelpCallback, ProtectorPlugin.Utility_Permission, allowServer: false ); base.RegisterCommand( new[] { "refillchest", "rchest" }, this.RefillChestCommand_Exec, this.RefillChestCommand_HelpCallback, ProtectorPlugin.SetRefillChests_Permission, allowServer: false ); base.RegisterCommand( new[] { "refillchestmany", "rchestmany" }, this.RefillChestManyCommand_Exec, this.RefillChestManyCommand_HelpCallback, ProtectorPlugin.Utility_Permission ); base.RegisterCommand( new[] { "bankchest", "bchest" }, this.BankChestCommand_Exec, this.BankChestCommand_HelpCallback, ProtectorPlugin.SetBankChests_Permission, allowServer: false ); base.RegisterCommand( new[] { "dumpbankchest", "dbchest" }, this.DumpBankChestCommand_Exec, this.DumpBankChestCommand_HelpCallback, ProtectorPlugin.DumpBankChests_Permission, allowServer: false ); base.RegisterCommand( new[] { "tradechest", "tchest" }, this.TradeChestCommand_Exec, this.TradeChestCommand_HelpCallback, ProtectorPlugin.SetTradeChests_Permission, allowServer: false ); #endregion #if DEBUG base.RegisterCommand(new[] { "fc" }, args => { for (int i= 0; i < Main.chest.Length; i++) { if (i != ChestManager.DummyChestIndex) Main.chest[i] = Main.chest[i] ?? new Chest(); } }, requiredPermission: Permissions.maintenance); base.RegisterCommand(new[] { "fcnames" }, args => { for (int i= 0; i < Main.chest.Length; i++) { if (i != ChestManager.DummyChestIndex) { Main.chest[i] = Main.chest[i] ?? new Chest(); Main.chest[i].name = "Chest!"; } } }, requiredPermission: Permissions.maintenance); #endif }
public UserInteractionHandler( PluginTrace trace, PluginInfo pluginInfo, Configuration config, ServerMetadataHandler serverMetadataHandler, WorldMetadata worldMetadata, ProtectionManager protectionManager, PluginCooperationHandler pluginCooperationHandler, Func<Configuration> reloadConfigurationCallback ) : base(trace) { Contract.Requires<ArgumentNullException>(trace != null); Contract.Requires<ArgumentException>(!pluginInfo.Equals(PluginInfo.Empty)); Contract.Requires<ArgumentNullException>(config != null); Contract.Requires<ArgumentNullException>(serverMetadataHandler != null); Contract.Requires<ArgumentNullException>(worldMetadata != null); Contract.Requires<ArgumentNullException>(protectionManager != null); Contract.Requires<ArgumentNullException>(pluginCooperationHandler != null); Contract.Requires<ArgumentNullException>(reloadConfigurationCallback != null); this.PluginInfo = pluginInfo; this.Config = config; this.ServerMetadataHandler = serverMetadataHandler; this.WorldMetadata = worldMetadata; this.ProtectionManager = protectionManager; this.PluginCooperationHandler = pluginCooperationHandler; this.ReloadConfigurationCallback = reloadConfigurationCallback; #region Command Setup base.RegisterCommand( new[] { "protector" }, this.RootCommand_Exec, this.RootCommand_HelpCallback ); base.RegisterCommand( new[] { "protect", "pt" }, this.ProtectCommand_Exec, this.ProtectCommand_HelpCallback, ProtectorPlugin.ManualProtect_Permission, allowServer: false ); base.RegisterCommand( new[] { "deprotect", "dp" }, this.DeprotectCommand_Exec, this.DeprotectCommand_HelpCallback, ProtectorPlugin.ManualDeprotect_Permission, allowServer: false ); base.RegisterCommand( new[] { "protectioninfo", "ptinfo", "pi" }, this.ProtectionInfoCommand_Exec, this.ProtectionInfoCommand_HelpCallback, allowServer: false ); base.RegisterCommand( new[] { "share" }, this.ShareCommand_Exec, this.ShareCommandHelpCallback, allowServer: false ); base.RegisterCommand( new[] { "unshare" }, this.UnshareCommand_Exec, this.UnshareCommand_HelpCallback, allowServer: false ); base.RegisterCommand( new[] { "sharepublic" }, this.SharePublicCommand_Exec, this.SharePublicCommandHelpCallback, allowServer: false ); base.RegisterCommand( new[] { "unsharepublic" }, this.UnsharePublicCommand_Exec, this.UnsharePublicCommand_HelpCallback, allowServer: false ); base.RegisterCommand( new[] { "sharegroup" }, this.ShareGroupCommand_Exec, this.ShareGroupCommand_HelpCallback, ProtectorPlugin.ShareWithGroups_Permission, allowServer: false ); base.RegisterCommand( new[] { "unsharegroup" }, this.UnshareGroupCommand_Exec, this.UnshareGroup_HelpCallback, ProtectorPlugin.ShareWithGroups_Permission, allowServer: false ); base.RegisterCommand( new[] { "lockchest", "lchest" }, this.LockChestCommand_Exec, this.LockChestCommand_HelpCallback, ProtectorPlugin.Utility_Permission, allowServer: false ); base.RegisterCommand( new[] { "refillchest", "rchest" }, this.RefillChestCommand_Exec, this.RefillChestCommand_HelpCallback, ProtectorPlugin.SetRefillChests_Permission, allowServer: false ); base.RegisterCommand( new[] { "refillchestmany", "rchestmany" }, this.RefillChestManyCommand_Exec, this.RefillChestManyCommand_HelpCallback, ProtectorPlugin.Utility_Permission ); base.RegisterCommand( new[] { "bankchest", "bchest" }, this.BankChestCommand_Exec, this.BankChestCommand_HelpCallback, ProtectorPlugin.SetBankChests_Permission, allowServer: false ); base.RegisterCommand( new[] { "dumpbankchest", "dbchest" }, this.DumpBankChestCommand_Exec, this.DumpBankChestCommand_HelpCallback, ProtectorPlugin.DumpBankChests_Permission, allowServer: false ); #endregion }