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

[Solved] How is this even possible?

Discussion in 'Development' started by jasonwynn10, Mar 19, 2017.

  1. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    I have the following Code:
    Screenshot (27).png
    Somehow, it's giving me this error:
    Screenshot (26).png
    Any Ideas why?
     
  2. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Are you using a Config in your plugin? You may need to check and load the config onEnable.
     
  3. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    Look at the code! There is no mention of a config anywhere! It makes no sense why this plugin would be giving me an error like this.
     
  4. PocketKiller

    PocketKiller Slime

    Messages:
    83
    GitHub:
    iPocket
    lol....
    There's some code somewhere down. cuz it also said "Config didn't save"
    sep ur being messy, is WorldShift ur plugin?
    or its the HubTP?
    Copy paste us the whole code, not a "screenshot"
     
  5. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    There are more lines to the plugin I can't see, which is why I asked. My guess is that even though nothing in onEnable is causing the problem, something else in the file is.
     
  6. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    Take a look, there's nothing that is using the config in it.
    PHP:
    <?php
    namespace jasonwynn10;

    use 
    pocketmine\command\Command;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\Player;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\utils\TextFormat as TF;

    class 
    Main extends PluginBase {
        public function 
    onLoad() {
            
    $this->getLogger()->notice(TF::GREEN."Loaded!");
        }
        public function 
    onEnable() {
            
    $this->getLogger()->notice(TF::GREEN."Enabled!");
        }
        public function 
    onCommand(CommandSender $senderCommand $command$label, array $args) {
            if(
    strtolower($command) == "world") {
                if(
    $sender instanceof Player) {
                    if(
    count($args) >= 1) {
                        if((
    $l $this->getServer()->getLevelByName($args[0])) != null and isset($args[1])) {
                            if((
    $p $this->getServer()->getPlayer($args[1])) instanceof Player) {
                                if(
    $this->getServer()->loadLevel($args[0])) {
                                    
    $p->teleport($l->getSpawnLocation());
                                }else{
                                    
    $this->getLogger()->error("Couldn't Load Level");
                                }
                            }else{
                                
    $this->getLogger()->error("Player isn't a player");
                            }
                        }elseif((
    $l $this->getServer()->getLevelByName($args[0])) != null) {
                            if(
    $this->getServer()->loadLevel($args[0])) {
                                
    $sender->teleport($l->getSpawnLocation());
                            }else{
                                
    $this->getLogger()->error("Couldn't Load Level");
                            }
                        }else{
                            
    $this->getLogger()->error("Level isn't a level");
                        }
                    }else{
                        return 
    false;
                    }
                }else{
                    if(
    count($args) >= 2) {
                        if((
    $l $this->getServer()->getLevelByName($args[0])) != null) {
                            if((
    $p $this->getServer()->getPlayer($args[1])) instanceof Player) {
                                if(
    $this->getServer()->loadLevel($args[0])) {
                                    
    $p->teleport($l->getSpawnLocation());
                                }else{
                                    
    $this->getLogger()->error("Couldn't Load Level");
                                }
                            }else{
                                
    $this->getLogger()->error("Player isn't a player");
                            }
                        }else{
                            
    $this->getLogger()->error("Level isn't a level");
                        }
                    }else{
                        return 
    false;
                    }
                }
                return 
    true;
            }
            if(
    strtolower($command) == "worlds") {
                
    $sender->sendMessage(TF::YELLOW."---+---Worlds---+---");
                foreach (
    $this->getServer()->getLevels() as $level) {
                    if(!
    $level->isClosed()) {
                        
    $sender->sendMessage(TF::YELLOW.$level->getName());
                    }
                }
                return 
    true;
            }
            return 
    true;
        }
    }
    @PocketKiller the plugin is WorldShift
     
  7. PocketKiller

    PocketKiller Slime

    Messages:
    83
    GitHub:
    iPocket
    You've probably 2 plugins with the same namespace, which made them squish up.
     
  8. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    Thanks, that makes more sense.
     
  9. PocketKiller

    PocketKiller Slime

    Messages:
    83
    GitHub:
    iPocket
    That happened to me before, so stupid mess.
    I was coding, and like everything I do is no change.
     
    jasonwynn10 likes this.
  10. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    I guess that's why poggit wants different namespaces
     
    Awzaw likes this.
  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.