1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

My plugin crashed

Discussion in 'Plugin Help' started by dragonflex, Feb 20, 2017.

  1. dragonflex

    dragonflex Spider Jockey

    Messages:
    44
    Please edit this code, code was crashed my serwer :_:
    PHP:
        public function onBreak(BlockBreakEvent $event){
          if(!(
    $event->getPlayer()->hasPermission("turbodrop.blokada"))) {      
            if(
    $this->disableTurboDrop) {        
            
    $player $event->getPlayer();
            
    $block $event->getBlock();
            
    $gracz $event->getPlayer()->getName();
            if(
    $event->getBlock()->getId() == 1){
                switch(
    mt_rand(1,200)){
           case 
    1:
           
    $player->sendMessage("§a • [DROP] Wydropiłeś - (1) diamond • ");
             
    $player->getInventory()->addItem(Item::get(26401));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
           break;
             case 
    2:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (2) diamond • ");
             
    $player->getInventory()->addItem(Item::get(26402));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    3:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (3) diamond • ");
             
    $player->getInventory()->addItem(Item::get(26403));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    4:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (1) iron ingot • ");
             
    $player->getInventory()->addItem(Item::get(26501));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    5:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (2) iron ingot • ");
             
    $player->getInventory()->addItem(Item::get(26502));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    6:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (3) iron ingot • ");
             
    $player->getInventory()->addItem(Item::get(26503));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    7:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (1) gold ingot • ");
             
    $player->getInventory()->addItem(Item::get(26601));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    8:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (2) gold ingot • ");
             
    $player->getInventory()->addItem(Item::get(26602));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    9:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (3) gold ingot • ");
             
    $player->getInventory()->addItem(Item::get(26603));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    10:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (1) emerald • ");
             
    $player->getInventory()->addItem(Item::get(38801));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    11:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (2) emerald • ");
             
    $player->getInventory()->addItem(Item::get(38802));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    12:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (3) emerald • ");
             
    $player->getInventory()->addItem(Item::get(38803));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    13;
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (1) lapis lazuli • ");
             
    $player->getInventory()->addItem(Item::get(35141));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    14;
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (2) lapis lazuli • ");
             
    $player->getInventory()->addItem(Item::get(35142));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    15;
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (3) lapis lazuli • ");
             
    $player->getInventory()->addItem(Item::get(35143));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    16:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (1) redstone • ");
             
    $player->getInventory()->addItem(Item::get(33101));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    17:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (2) redstone • ");
             
    $player->getInventory()->addItem(Item::get(33102));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    18:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (3) redstone • ");
             
    $player->getInventory()->addItem(Item::get(33103));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
           case 
    19:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (1) coal • ");
             
    $player->getInventory()->addItem(Item::get(26301));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
           case 
    20:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (2) coal • ");
             
    $player->getInventory()->addItem(Item::get(26302));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
           case 
    21:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (3) coal • ");
             
    $player->getInventory()->addItem(Item::get(26303));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    22:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (1) obsidian • ");
             
    $player->getInventory()->addItem(Item::get(4901));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    23:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (2) obsidian • ");
             
    $player->getInventory()->addItem(Item::get(4902));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    24:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (3) obsidian • ");
             
    $player->getInventory()->addItem(Item::get(4903));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    25:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (1) apple • ");
             
    $player->getInventory()->addItem(Item::get(26001));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    26:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (2) apple • ");
             
    $player->getInventory()->addItem(Item::get(26002));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    27:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (3) apple • ");
             
    $player->getInventory()->addItem(Item::get(26003));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break; 
             case 
    28:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - Szybkie kopanie • ");
             
    $effect Effect::getEffect(3);
             
    $effect->setDuration(600);
             
    $player->addEffect($effect);
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    29:
           
    $monety1 "givemonety $gracz 500";
           
    $this->getServer()->dispatchCommand(new ConsoleCommandSender,$monety1);
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (500) monet • ");
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    30:
           
    $monety2 "givemonety $gracz 750";
           
    $this->getServer()->dispatchCommand(new ConsoleCommandSender,$monety2);
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (750) monet • ");
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    31:
           
    $monety3  "givemonety $gracz 1000";
           
    $this->getServer()->dispatchCommand(new ConsoleCommandSender,$monety3);
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (1000) monet • ");
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    32:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (1) TnT • ");
             
    $player->getInventory()->addItem(Item::get(4601));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    33:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (2) TnT • ");
             
    $player->getInventory()->addItem(Item::get(4602));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
             case 
    34:
             
    $player->sendMessage("§a • [DROP] Wydropiłeś - (3) TnT • ");
             
    $player->getInventory()->addItem(Item::get(4603));
             
    $player->addExperience(5);
             
    $event->setCancelled(true);
             break;
        }

        public function 
    onCommand(CommandSender $senderCommand $command$label, array $args){
            switch(
    $command->getName()){
                   case 
    "turbodrop":
                 if(!(isset(
    $args[0]))){
                    
    $sender->sendMessage("§a • Informacje o - (TurboDrop) • ");
                    
    $sender->sendMessage("§f • Wpisz - /turbodrop on Aby włączyć turbodrop • ");
                    
    $sender->sendMessage("§f • Wpisz - /chat off Aby wyłączyć turbodrop• ");
                    return 
    true;
                    }
                if(
    $args[0] == "off"){
                   
    $sender->sendMessage("§c • TurboDrop został wyłączony • ");
                 
    $this->disableTurboDrop true;
                return 
    true;
                }
                elseif(
    $args[0] == "on"){
                   
    $sender->sendMessage("§a • TurboDrop został włączony • ");
                   
    $this->disableTurboDrop false;
                   return 
    true;
     
  2. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    don't hardcode that much -_-
    and also: please show us the error message. We're not a throwcodeatusandwewillfixit service.
     
    Sandertv likes this.
  3. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    My eyeeesssss, they buuuurn!!!
     
  4. dragonflex

    dragonflex Spider Jockey

    Messages:
    44
    This is error message
    |
    \/
     

    Attached Files:

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.