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

How to fix

Discussion in 'Facepalm' started by NotRedd, Jun 12, 2017.

  1. NotRedd

    NotRedd Silverfish

    Messages:
    17
    PHP:
    TypeError"strtolower() expects parameter 1 to be string,
    integer given" 
    (EXCEPTIONin "/src/pocketmine/Server" at line 1224
    [14:34:26criticalTypeError"strtolower() expects parameter 1 to be string,
    integer given" 
    (EXCEPTIONin "/src/pocketmine/Server" at line 1224
     

    Attached Files:

  2. NotRedd

    NotRedd Silverfish

    Messages:
    17
    Could we possibly pm?
     
  3. NotRedd

    NotRedd Silverfish

    Messages:
    17
    This is the full code
    PHP:
    <?php

    namespace UHC\Commands;

    use 
    UHC\Loader;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\Player;
    use 
    pocketmine\Server;
    use 
    pocketmine\utils\TextFormat as TF;
    use 
    pocketmine\level\Position;
    use 
    pocketmine\math\Vector3;
    use 
    pocketmine\item\Item;
    use 
    pocketmine\inventory\PlayerInventory;
    use 
    pocketmine\entity\Effect;
    use 
    pocketmine\network\mcpe\protocol\SetDifficultyPacket;

    class 
    UHCCommand extends BaseCommand
    {
        
        public function 
    __construct(Loader $plugin)
        {
            
    $this->plugin $plugin;
            
    parent::__construct($plugin"uhc""Main UHC command!""/uhc [help|start]", []);
            
    $this->setPermission("uhc.op");
        }
        
        public function 
    execute(CommandSender $sender$commandLabel, array $args)
        {
            if (!
    $this->testPermission($sender)) {
                return 
    false;
            }
            
            if (
    count($args) < 1) {
                
    $sender->sendMessage(TF::RED $this->usageMessage);
                return 
    true;
            }
            
            if (isset(
    $args[0])) {
                switch (
    $args[0]) {
                    case 
    "help":
                        
    $sender->sendMessage("§7--- §aHosting Help §7---");
                        
    $sender->sendMessage("§7/uhc start");
                        
    $sender->sendMessage("§7/uhc restart");
                        
    $sender->sendMessage("§7/uhc reset");
                        
    $sender->sendMessage("§7/uhc tpall");
                        
    $sender->sendMessage("§7/uhc rtpall");
                        
    $sender->sendMessage("§7/uhc food");
                        
    $sender->sendMessage("§7/uhc healall");
                        
    $sender->sendMessage("§7/uhc ban");
                        break;
                }
            }
            
            if (isset(
    $args[0])) {
                switch (
    $args[0]) {
                    case 
    "start":
                        foreach (
    Server::getInstance()->getOnlinePlayers() as $p) {
                            
    $p->addEffect(Effect::getEffect(Effect::NIGHT_VISION)->setAmplifier(1)->setDuration(1000000));
                            
    $p->addEffect(Effect::getEffect(Effect::FIRE_RESISTANCE)->setAmplifier(1)->setDuration(100000));
                            
    $p->getInventory()->clearAll();
                            
    $p->getInventory()->addItem(Item::get(Item::STONE_PICKAXE01));
                            
    $p->getInventory()->addItem(Item::get(Item::STEAK064));
                            
    $this->plugin->getServer()->setConfigInt("white-list"true);
                            
    $this->plugin->getServer()->addWhitelist($p->getName());
                            
    $p->sendMessage("§e× §aGoodluck. The event started");
                            
                            
                            break;
                        }
                }
            }
            
            if (isset(
    $args[0])) {
                switch (
    $args[0]) {
                    case 
    "tpall":
                        foreach (
    Server::getInstance()->getOnlinePlayers() as $p) {
                            
    $p->teleport(new Vector3($sender->x$sender->y$sender->z$sender->getLevel()));
                            
    $p->sendMessage("§e× §9Teleporting...");
                            
                        }
                }
            }
            
            if (isset(
    $args[0])) {
                switch (
    $args[0]) {
                    case 
    "heal":
                        foreach (
    Server::getInstance()->getOnlinePlayers() as $p) {
                            
    $p->setHealth(20);
                            
    $p->setFood(20);
                            
                            
    $p->sendMessage("§e× §aEveryone has been healed");
                        }
                }
            }
            
            if (isset(
    $args[0])) {
                switch (
    $args[0]) {
                    case 
    "rtpall":
                        foreach (
    Server::getInstance()->getOnlinePlayers() as $p) {
                            
    $x mt_rand(-9090);
                            
    $y mt_rand(70200);
                            
    $z mt_rand(-9090);
                            
    $p->teleport(new Vector3($x$y$z));
                            
    $p->sendMessage("§e× §aRandomly spreading players around the map!");
                        }
                }
            }
            
            if (isset(
    $args[0])) {
                switch (
    $args[0]) {
                    case 
    "clear":
                        foreach (
    Server::getInstance()->getOnlinePlayers() as $p) {
                            
    $p->getInventory()->clearAll();
                            
    $p->removeAllEffects();
                            
    $p->setHealth(20);
                            
    $p->setFood(20);
                            
    $p->sendMessage("§e× §3This round has been reset");
                        }
                }
            }
            
            if (isset(
    $args[0])) {
                switch (
    $args[0]) {
                    case 
    "pvp":
                        switch (
    $args[1]) {
                            case 
    "on":
                                
    $this->plugin->getServer()->getConfigInt("difficulty"3);
                                
    $pk             = new SetDifficultyPacket();
                                
    $pk->difficulty $this->plugin->getServer()->getDifficulty();
                                foreach (
    Server::getInstance()->getOnlinePlayers() as $p) {
                                    
    $p->sendMessage("§e× §aPvP toggled on");
                                }
                        }
                        
                        switch (
    $args[1]) {
                            case 
    "off":
                                
    $this->plugin->getServer()->getConfigInt("difficulty"0);
                                
    $pk             = new SetDifficultyPacket();
                                
    $pk->difficulty $this->plugin->getServer()->getDifficulty();
                                foreach (
    Server::getInstance()->getOnlinePlayers() as $p) {
                                    
    $p->sendMessage("§e× §cPvP toggled off");
                                }
                        }
                }
            }
        }
    }
     
  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.