Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Crash with /f leader name

Comments in 'Plugin Development' started by matthww, Jun 15, 2015.

  1. matthww
    Offline

    matthww Active Member

    Joined:
    May 13, 2014
    Posts:
    91
    Minecraft User:
    Matthww
    So i'm trying to fix it but nothing works

    Error: http://pastebin.com/PmF71vrL

    Crashdump: http://pastebin.com/QExjQ2dj

    Code:
    PHP:
                        if($args[0] == "leader") {
                            if(!isset(
    $args[1])) {
                                
    $sender->sendMessage($this->plugin->formatMessage("Usage: /f leader <player>"));
                                return 
    true;
                            }
                            if(!
    $this->plugin->isInFaction($sender->getName())) {
                                
    $sender->sendMessage($this->plugin->formatMessage("You must be in a faction to use this!"));
                            }
                            if(!
    $this->plugin->isLeader($player)) {
                                
    $sender->sendMessage($this->plugin->formatMessage("You must be leader to use this"));
                            }
                            if(
    $this->plugin->getPlayerFaction($player) != $this->plugin->getPlayerFaction($args[1])) {
                                
    $sender->sendMessage($this->plugin->formatMessage("Add player to faction first!"));
                            }      
                            if(!
    $this->plugin->getServer()->getPlayerExact($args[1])->isOnline()) {
                                
    $sender->sendMessage($this->plugin->formatMessage("Player not online!"));
                            }
                                
    $factionName $this->plugin->getPlayerFaction($player);
                                
    $factionName $this->plugin->getPlayerFaction($player);
      
                                
    $stmt $this->plugin->db->prepare("INSERT OR REPLACE INTO master (player, faction, rank) VALUES (:player, :faction, :rank);");
                                
    $stmt->bindValue(":player"$player);
                                
    $stmt->bindValue(":faction"$factionName);
                                
    $stmt->bindValue(":rank""Member");
                                
    $result $stmt->execute();
      
                                
    $stmt $this->plugin->db->prepare("INSERT OR REPLACE INTO master (player, faction, rank) VALUES (:player, :faction, :rank);");
                                
    $stmt->bindValue(":player"strtolower($args[1]));
                                
    $stmt->bindValue(":faction"$factionName);
                                
    $stmt->bindValue(":rank""Leader");
                                
    $result $stmt->execute();
      
      
                                
    $sender->sendMessage($this->plugin->formatMessage("You are no longer leader!"true));
                                
    $this->plugin->getServer()->getPlayer($args[1])->sendMessage($this->plugin->formatMessage("You are now leader \nof $factionName!",  true));
                                
    $this->plugin->updateTag($sender->getName());
                                
    $this->plugin->updateTag($this->plugin->getServer()->getPlayer($args[1])->getName());
                            }
                      
    So how can this be fixed?
  2. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    PHP:
     if($args[0] == "leader") {
                            if(!isset(
    $args[1])) {
                                
    $sender->sendMessage($this->plugin->formatMessage("Usage: /f leader <player>"));
                                return 
    true;
                            }
                            if(!
    $this->plugin->isInFaction($sender->getName())) {
                                
    $sender->sendMessage($this->plugin->formatMessage("You must be in a faction to use this!"));
                            }
                            if(!
    $this->plugin->isLeader($player)) {
                                
    $sender->sendMessage($this->plugin->formatMessage("You must be leader to use this"));
                            }
                            if(
    $this->plugin->getPlayerFaction($player) != $this->plugin->getPlayerFaction($args[1])) {
                                
    $sender->sendMessage($this->plugin->formatMessage("Add player to faction first!"));
                            }    
                            
    $p $args[1];
                            if(
    $p != $this->plugin->getServer()->getPlayerExact($args[1])) {
                                
    $sender->sendMessage($this->plugin->formatMessage("Player not online!"));
                            }
                                
    $factionName $this->plugin->getPlayerFaction($player);
                                
    $factionName $this->plugin->getPlayerFaction($player);

                                
    $stmt $this->plugin->db->prepare("INSERT OR REPLACE INTO master (player, faction, rank) VALUES (:player, :faction, :rank);");
                                
    $stmt->bindValue(":player"$player);
                                
    $stmt->bindValue(":faction"$factionName);
                                
    $stmt->bindValue(":rank""Member");
                                
    $result $stmt->execute();

                                
    $stmt $this->plugin->db->prepare("INSERT OR REPLACE INTO master (player, faction, rank) VALUES (:player, :faction, :rank);");
                                
    $stmt->bindValue(":player"strtolower($args[1]));
                                
    $stmt->bindValue(":faction"$factionName);
                                
    $stmt->bindValue(":rank""Leader");
                                
    $result $stmt->execute();


                                
    $sender->sendMessage($this->plugin->formatMessage("You are no longer leader!"true));
                                
    $this->plugin->getServer()->getPlayer($args[1])->sendMessage($this->plugin->formatMessage("You are now leader \nof $factionName!",  true));
                                
    $this->plugin->updateTag($sender->getName());
                                
    $this->plugin->updateTag($this->plugin->getServer()->getPlayer($args[1])->getName());
                            }
                      

Share This Page

Advertisement