@@ -19,7 +19,6 @@ You should have received a copy of the GNU General Public License
1919using  System . Collections . Generic ; 
2020using  System . Linq ; 
2121using  Terraria . ID ; 
22- using  TShockAPI . Net ; 
2322using  Terraria ; 
2423using  Microsoft . Xna . Framework ; 
2524using  TShockAPI . Localization ; 
@@ -29,6 +28,7 @@ You should have received a copy of the GNU General Public License
2928using  Terraria . Localization ; 
3029using  TShockAPI . Models . PlayerUpdate ; 
3130using  System . Threading . Tasks ; 
31+ using  OTAPI ; 
3232using  Terraria . GameContent . Tile_Entities ; 
3333
3434namespace  TShockAPI 
@@ -137,6 +137,7 @@ internal Bouncer()
137137			GetDataHandlers . KillMe  +=  OnKillMe ; 
138138			GetDataHandlers . FishOutNPC  +=  OnFishOutNPC ; 
139139			GetDataHandlers . FoodPlatterTryPlacing  +=  OnFoodPlatterTryPlacing ; 
140+ 			OTAPI . Hooks . Chest . QuickStack  +=  OnChestOnQuickStack ; 
140141
141142
142143			// The following section is based off Player.PlaceThing_Tiles_PlaceIt and Player.PlaceThing_Tiles_PlaceIt_GetLegacyTileStyle. 
@@ -2505,7 +2506,7 @@ internal void OnPlaceItemFrame(object sender, GetDataHandlers.PlaceItemFrameEven
25052506				Main . item [ num ] . playerIndexTheItemIsReservedFor  =  args . Player . Index ; 
25062507				NetMessage . SendData ( ( int ) PacketTypes . ItemDrop ,  args . Player . Index ,  - 1 ,  NetworkText . Empty ,  num ,  1f ) ; 
25072508				NetMessage . SendData ( ( int ) PacketTypes . ItemOwner ,  args . Player . Index ,  - 1 ,  NetworkText . Empty ,  num ) ; 
2508- 				 
2509+ 
25092510				TShock . Log . ConsoleDebug ( GetString ( "Bouncer / OnPlaceItemFrame rejected permissions from {0}" ,  args . Player . Name ) ) ; 
25102511				NetMessage . SendData ( ( int ) PacketTypes . UpdateTileEntity ,  - 1 ,  - 1 ,  NetworkText . Empty ,  args . ItemFrame . ID ,  0 ,  1 ) ; 
25112512				args . Handled  =  true ; 
@@ -2871,6 +2872,44 @@ internal void OnFoodPlatterTryPlacing(object sender, GetDataHandlers.FoodPlatter
28712872			} 
28722873		} 
28732874
2875+ 		/// <summary> 
2876+ 		/// Called when a player is trying to put an item into chest through Quick Stack. 
2877+ 		/// </summary> 
2878+ 		/// <param name="sender"></param> 
2879+ 		/// <param name="args"></param> 
2880+ 		internal  void  OnChestOnQuickStack ( object  sender ,  OTAPI . Hooks . Chest . QuickStackEventArgs  args ) 
2881+ 		{ 
2882+ 			var  id  =  args . ChestIndex ; 
2883+ 			var  plr  =  TShock . Players [ args . PlayerId ] ; 
2884+ 
2885+ 			if  ( plr  is  not {  Active :  true  } ) 
2886+ 			{ 
2887+ 				args . Result  =  HookResult . Cancel ; 
2888+ 				return ; 
2889+ 			} 
2890+ 
2891+ 			if  ( plr . IsBeingDisabled ( ) ) 
2892+ 			{ 
2893+ 				TShock . Log . ConsoleDebug ( GetString ( "Bouncer / OnQuickStack rejected from disable from {0}" ,  plr . Name ) ) ; 
2894+ 				args . Result  =  HookResult . Cancel ; 
2895+ 				return ; 
2896+ 			} 
2897+ 
2898+ 			if  ( ! plr . HasBuildPermission ( Main . chest [ id ] . x ,  Main . chest [ id ] . y )  &&  TShock . Config . Settings . RegionProtectChests ) 
2899+ 			{ 
2900+ 				TShock . Log . ConsoleDebug ( GetString ( "Bouncer / OnQuickStack rejected from region protection? from {0}" ,  plr . Name ) ) ; 
2901+ 				args . Result  =  HookResult . Cancel ; 
2902+ 				return ; 
2903+ 			} 
2904+ 
2905+ 			if  ( ! plr . IsInRange ( Main . chest [ id ] . x ,  Main . chest [ id ] . y ,  600 / 16 ) ) 
2906+ 			{ 
2907+ 				TShock . Log . ConsoleDebug ( GetString ( "Bouncer / OnQuickStack rejected from range check from {0}" ,  plr . Name ) ) ; 
2908+ 				args . Result  =  HookResult . Cancel ; 
2909+ 				return ; 
2910+ 			} 
2911+ 		} 
2912+ 
28742913		internal  void  OnSecondUpdate ( ) 
28752914		{ 
28762915			Task . Run ( ( )  => 
0 commit comments