Guest User

Untitled

a guest
Jul 19th, 2015
301
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. namespace MP\NoTNTGrief;
  4.  
  5. #___  ____           ______          _        _  
  6. #|  \/  (_)          | ___ \        | |      | |  
  7. #| .  . |_ _ __   ___| |_/ /__   ___| | _____| |_
  8. #| |\/| | | '_ \ / _ \  __/ _ \ / __| |/ / _ \ __|
  9. #| |  | | | | | |  __/ | | (_) | (__|   <  __/ |_
  10. #\_|  |_/_|_| |_|\___\_|  \___/ \___|_|\_\___|\__|
  11. #
  12. # Credit goes to NoExplode and PEMapModder
  13. # Modified by Autonomousperson@minepocket.com
  14. # Designed for use with the minigame "scorched"                                          
  15.                                                
  16.  
  17. use pocketmine\plugin\PluginBase;
  18. use pocketmine\event\Listener;
  19. use pocketmine\event\entity\EntityExplodeEvent;
  20. use pocketmine\level;
  21. use pocketmine\level\Position;
  22. use pocketmine\Player;
  23. use pocketmine\utils\Config;
  24. use pocketmine\math\Vector3;
  25. use pocketmine\utils\TextFormat;
  26. use pocketmine\Server;
  27. use pocketmine\block\Block;
  28.  
  29. class main extends PluginBase implements Listener{
  30.  
  31.  
  32.  
  33.     public function onEnable(){
  34.  
  35.  
  36.             $this->getServer()->getPluginManager()->registerEvents($this, $this);
  37.  
  38.             $this->getLogger()->info(TextFormat::GREEN . "NoTNTGrief Loaded!");
  39.                
  40.             $this->saveDefaultConfig();
  41.             $this->reloadConfig();
  42.            
  43.             $this->worlds = $this->getConfig()->get("worlds");
  44.                    
  45.                 $this->getLogger()->info(TextFormat::GREEN . "Protected Worlds: " . TextFormat::BLUE . implode(", ", $this->worlds));
  46.  
  47.     }
  48.        
  49.     public function onDisable(){
  50.  
  51.             $this->getLogger()->info(TextFormat::RED . "NoTNTGrief Disabled!");
  52.  
  53.     }
  54.    
  55.     public function onExplode(EntityExplodeEvent $explode){
  56.            
  57.             //$this->getLogger()->info(TextFormat::RED . "In No-Explode World? " . in_array($explode->getEntity()->getLevel()->getFolderName(), $this->worlds));
  58.            
  59.             if(in_array($explode->getEntity()->getLevel()->getFolderName(), $this->worlds)){
  60.                
  61.                 $explode->setBlockList([]);
  62.                
  63.                 if($this->getConfig()->get("message-to-console") == "true"){
  64.                
  65.                     $this->getLogger()->info(TextFormat::RED . "TntGrief was prevented in: " . $explode->getEntity()->getLevel()->getFolderName());
  66.                        
  67.                 }
  68.                
  69.             }
  70.  
  71.     }
  72. }
RAW Paste Data