<commit_before><?php
namespace kvetinac97;

use pocketmine\command\Command;
use pocketmine\command\CommandExecutor;
use pocketmine\command\CommandSender;
use pocketmine\event\player\PlayerInteractEvent;
use pocketmine\utils\TextFormat;
use pocketmine\level\Position;
use pocketmine\event\player\PlayerItemHeldEvent;
use pocketmine\item\Item;
use pocketmine\Player;
use pocketmine\event\Listener;
use pocketmine\math\Vector3;
use pocketmine\block\Block;
use pocketmine\plugin\PluginBase;

class MainClass extends PluginBase implements Listener{

public function onLoad(){
		$this->getLogger()->info(TextFormat::WHITE . "Loaded!");
}
public function onEnable(){
$this->getServer()->getPluginManager()->registerEvents($this, $this);
		$this->getLogger()->info(TextFormat::DARK_GREEN . "InstantBreaking enabled!");
}
public function onDisable(){
		$this->getLogger()->info(TextFormat::DARK_RED . "InstantBreaking disabled");
} 
  
  public function onCommand(CommandSender $sender, Command $command, $label, array $args){
  if ($command->getName() == "ib-on"){
 if ($sender->hasPermission("ib.on")) {
$sender->sendMessage("§7Now hold Iron Shovel");
$sender->getInventory()->addItem(Item::get(256));
return true;}
      else {
      $sender->sendMessage("§o§cError: No permission");
      return true;
      break;}
     }
  if ($command->getName() == "ib-off")
 {if ($sender->hasPermission("ib.off")) 
  {$sender->sendMessage("§o§7Disabled!");
$sender->getInventory()->removeItem(Item::get(256));
  return true;}
      else {$sender->sendMessage("§cError: No permission");}
break;}
return true;}

public function onPlayerItemHeldEvent (PlayerItemHeldEvent $event) {

if ($event->getPlayer()->hasPermission("ib.use")) {
$item = $event->getItem();
$id = $item->getId();

if ($id == 256) {

$player = $event->getPlayer();

$player->sendTip("§aInstantBreaking ENABLED!");
}
}
}

public function onTouch (PlayerInteractEvent $event) {

if ($event->getPlayer()->hasPermission("ib.use")) {
$item = $event->getItem();
$id = $item->getId();

if ($id === 256) {

$block = $event->getBlock();
$x = $block->getX();
$y = $block->getY();
$z = $block->getZ();
$level = $block->getLevel();
$id = $block->getId();

$level->dropItem(new Vector3($x,$y,$z), Item::get($id));
$level->setBlock(new Vector3($x,$y,$z), Block::get(0));

}
}
else {
$player = $event->getPlayer();
$player->sendPopup("§cYou don't have permissions for this!");
}
}
}<commit_msg>Fixed No permission message when hold any items<commit_after><?php
namespace kvetinac97;

use pocketmine\command\Command;
use pocketmine\command\CommandExecutor;
use pocketmine\command\CommandSender;
use pocketmine\event\player\PlayerInteractEvent;
use pocketmine\utils\TextFormat;
use pocketmine\level\Position;
use pocketmine\event\player\PlayerItemHeldEvent;
use pocketmine\item\Item;
use pocketmine\Player;
use pocketmine\event\Listener;
use pocketmine\math\Vector3;
use pocketmine\block\Block;
use pocketmine\plugin\PluginBase;

class MainClass extends PluginBase implements Listener{

public function onLoad(){
		$this->getLogger()->info(TextFormat::WHITE . "Loaded!");
}
public function onEnable(){
$this->getServer()->getPluginManager()->registerEvents($this, $this);
		$this->getLogger()->info(TextFormat::DARK_GREEN . "InstantBreaking enabled!");
}
public function onDisable(){
		$this->getLogger()->info(TextFormat::DARK_RED . "InstantBreaking disabled");
} 
  
  public function onCommand(CommandSender $sender, Command $command, $label, array $args){
  if ($command->getName() == "ib-on"){
 if ($sender->hasPermission("ib.on")) {
$sender->sendMessage("§7Now hold Iron Shovel");
$sender->getInventory()->addItem(Item::get(256));
return true;}
      else {
      $sender->sendMessage("§o§cError: No permission");
      return true;
      break;}
     }
  if ($command->getName() == "ib-off")
 {if ($sender->hasPermission("ib.off")) 
  {$sender->sendMessage("§o§7Disabled!");
$sender->getInventory()->removeItem(Item::get(256));
  return true;}
      else {$sender->sendMessage("§cError: No permission");}
break;}
return true;}

public function onPlayerItemHeldEvent (PlayerItemHeldEvent $event) {

$item = $event->getItem();
$id = $item->getId();

if ($id == 256) {

$player = $event->getPlayer();

$player->sendTip("§aInstantBreaking ENABLED!");
}
}
}

public function onTouch (PlayerInteractEvent $event) {

if ($event->getPlayer()->hasPermission("ib.use")) {
$item = $event->getItem();
$id = $item->getId();

if ($id === 256) {

$block = $event->getBlock();
$x = $block->getX();
$y = $block->getY();
$z = $block->getZ();
$level = $block->getLevel();
$id = $block->getId();

$level->dropItem(new Vector3($x,$y,$z), Item::get($id:$block->getDamage()));
$level->setBlock(new Vector3($x,$y,$z), Block::get(0));

}
}
else {
$player = $event->getPlayer();
$player->sendPopup("§cYou don't have permissions for this!");
}
}
}
{'fraction_non_alphanumeric': 0.19526748971193417, 'fraction_numerical': 0.00823045267489712, 'mean_word_length': 6.0144300144300145, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 84, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1436587', 'n_tokens_mistral': 1617, 'n_tokens_neox': 1590, 'n_words': 319}