@@ -1180,33 +1180,18 @@ public function playerBlockTouch(PlayerInteractEvent $event){
11801180 }
11811181 }
11821182
1183- public function ClearInv ($ player )
1184- {
1185- if (!$ player instanceof Player)
1186- {
1187- unset($ player );
1188- }
1189- $ inv =$ player ->getInventory ();
1190- if (!$ inv instanceof Inventory)
1191- {
1192- unset($ player ,$ inv );
1183+ public function ClearInv ($ player ){
1184+ foreach ($ this ->players as $ player ){
1185+ $ player ->getInventory ()->setItemInHand (new Item (Item::AIR ,0 ,0 ));
1186+ $ player ->getInventory ()->clearAll ();
11931187 }
1194- $ inv ->clearAll ();
1195- unset($ player ,$ inv );
11961188 }
11971189
1198- public function ClearAllInv ()
1199- {
1200- foreach ($ this ->players as $ pl )
1201- {
1202- $ player =$ this ->getServer ()->getPlayer ($ pl ["id " ]);
1203- if (!$ player instanceof Player)
1204- {
1205- continue ;
1206- }
1207- $ this ->ClearInv ($ player );
1190+ public function ClearAllInv ($ player ){
1191+ foreach ($ this ->players as $ player ){
1192+ $ player ->getInventory ()->setItemInHand (new Item (Item::AIR ,0 ,0 ));
1193+ $ player ->getInventory ()->clearAll ();
12081194 }
1209- unset($ pl ,$ player );
12101195 }
12111196
12121197 public function PlayerQuit (PlayerQuitEvent $ event ){
@@ -1233,11 +1218,11 @@ public function PlayerQuit(PlayerQuitEvent $event){
12331218 }
12341219
12351220 public function onDisable (){
1236- $ this ->saveResource ("config.yml " );
1237- $ this ->saveResource ("points.yml " );
12381221 $ this ->getServer ()->getLogger ()->info (TextFormat::GREEN ."[SG] Saving All Data... " );
1239- $ this ->getServer ()->getLogger ()->info (TextFormat::GREEN ."[SG] Please wait........... " );
12401222 $ this ->saveResource ("config.yml " );
1223+ $ this ->saveResource ("points.yml " );
1224+ $ this ->saveResource ("config.yml " );
1225+ $ this ->getServer ()->getLogger ()->info (TextFormat::GREEN ."[SG] Please wait........... " );
12411226 $ this ->getServer ()->getLogger ()->info (TextFormat::GREEN ."[SG] All Data/Settings has been fixed " );
12421227 }
12431228}
0 commit comments