@@ -23,7 +23,9 @@ public function event(BlockBreakEvent $event): void
2323 {
2424 $ block = $ event ->getBlock ();
2525 $ inventory = $ event ->getPlayer ()->getInventory ();
26- if (DefaultConfig::isDev () || $ block ->getLevel ()->getName () !== DefaultConfig::getStageLevelName () || TheEndGameEvent::isFinish ()) return ;
26+ if (DefaultConfig::isDev () || $ block ->getLevel ()->getName () !== DefaultConfig::getStageLevelName () || TheEndGameEvent::isFinish ()) {
27+ return ;
28+ }
2729 $ event ->setDrops ([]);
2830 switch ($ block ->getId ()) {
2931 case Block::MELON_BLOCK :
@@ -33,6 +35,7 @@ public function event(BlockBreakEvent $event): void
3335 case Block::WOOD :
3436 if ($ block ->getToolType () !== $ inventory ->getItemInHand ()->getBlockToolType ()) {
3537 $ event ->setCancelled ();
38+
3639 return ;
3740 }
3841 $ inventory ->addItem (Item::get (Item::WOODEN_PLANKS , 0 , 4 ));
@@ -41,6 +44,7 @@ public function event(BlockBreakEvent $event): void
4144 case Block::DIAMOND_ORE :
4245 if ($ block ->getToolType () !== $ inventory ->getItemInHand ()->getBlockToolType ()) {
4346 $ event ->setCancelled ();
47+
4448 return ;
4549 }
4650 $ inventory ->addItem (Item::get (Item::DIAMOND ));
@@ -49,6 +53,7 @@ public function event(BlockBreakEvent $event): void
4953 case Block::EMERALD_ORE :
5054 if ($ block ->getToolType () !== $ inventory ->getItemInHand ()->getBlockToolType ()) {
5155 $ event ->setCancelled ();
56+
5257 return ;
5358 }
5459 $ inventory ->addItem (Item::get (Item::EMERALD , 0 , mt_rand (1 , 3 )));
@@ -57,6 +62,7 @@ public function event(BlockBreakEvent $event): void
5762 case Block::COAL_ORE :
5863 if ($ block ->getToolType () !== $ inventory ->getItemInHand ()->getBlockToolType ()) {
5964 $ event ->setCancelled ();
65+
6066 return ;
6167 }
6268 $ inventory ->addItem (Item::get (Item::COAL ));
@@ -65,6 +71,7 @@ public function event(BlockBreakEvent $event): void
6571 case Block::IRON_ORE :
6672 if ($ block ->getToolType () !== $ inventory ->getItemInHand ()->getBlockToolType ()) {
6773 $ event ->setCancelled ();
74+
6875 return ;
6976 }
7077 $ inventory ->addItem (Item::get (Item::IRON_INGOT ));
@@ -73,6 +80,7 @@ public function event(BlockBreakEvent $event): void
7380 case Block::GOLD_ORE :
7481 if ($ block ->getToolType () !== $ inventory ->getItemInHand ()->getBlockToolType ()) {
7582 $ event ->setCancelled ();
83+
7684 return ;
7785 }
7886 $ inventory ->addItem (Item::get (Item::GOLD_INGOT ));
@@ -81,6 +89,7 @@ public function event(BlockBreakEvent $event): void
8189 default :
8290 if ($ event ->getPlayer ()->getLevel ()->getName () === DefaultConfig::getStageLevelName () && DefaultConfig::isDev () === false ) {
8391 $ event ->setCancelled ();
92+
8493 return ;
8594 }
8695 }
0 commit comments