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

KillCash what error

Comments in 'Plugin Development' started by Praxthisnovcht, Feb 25, 2015.

  1. Praxthisnovcht
    Offline

    Praxthisnovcht Notable Member Plugin Developer

    Joined:
    Mar 10, 2014
    Posts:
    702
    Plugins:
    4
    Minecraft User:
    PraxHellTag
    hi guys!

    I need a hand to solve the problem of this plugin.
    Code:
    21:35:01 [WARNING] RuntimeException: "yaml_parse(): end of stream reached without finding document 0" (E_WARNING) in "/src/pocketmine/utils/Config" at line 137
    21:35:01 [INFO] Disabling KillCash v1.0.0
    21:35:01 [INFO] [KillCash] KillCash Error!
    
    PHP:
    <?php


    namespace Praxthisnovcht\KillCash;

    use 
    pocketmine\Player;
    use 
    pocketmine\Server;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\utils\TextFormat;
    use 
    pocketmine\utils\Config;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\event\player\PlayerDeathEvent;
    use 
    pocketmine\event\entity\EntityDamageByEntityEvent;

    use 
    MassiveEconomy\MassiveEconomyAPI;
    use 
    onebone\economyapi\EconomyAPI;

    class 
    Main extends PluginBase implements Listener{

        public 
    $massive;
        public 
    $ecnomy;

    public function 
    onLoad() {
        
    $this->getLogger()->info(TextFormat::LIGHT_PURPLE "Loading KillCash v1.0.0");
        
    $this->getLogger()->info(TextFormat::LIGHT_PURPLE "Seeks Plugins To Load Plugins");
    }
        public function 
    onEnable(){
            @
    mkdir($this->getDataFolder());
            
    $this->saveDefaultConfig();
            
    $cfg $this->getConfig();
         
         
            if(!
    $cfg->exists("Give_Money")){
                
    $cfg->set("Give_Money""50");

            }
            if(!
    $cfg->exists("Message")){
                
    $cfg->set("Message""You have received [{Money} $]");
            }
            
    $cfg->save();
            
    $cfg->reload();

            
    $this->getServer()->getPluginManager()->registerEvents($this$this);
            
    $this->getLogger()->info(TextFormat::LIGHT_PURPLE "Enabled KillCash");
         
         
         
            if(!
    $this->getServer()->getPluginManager()->getPlugin("MassiveEconomy") == false) {
                
    $massive Server::getInstance()->getPluginManager()->getPlugin("MassiveEconomy");
                
    $this->log TextFormat::GREEN "- KillCash - Loaded With MassiveEconomy !" ); 
                
    $this->economy true;         
                }else{
                
    $this->getLogger()->info(TextFormat::YELLOW."MassiveEconomy not connect to KillCash");
                
    $this->massive false;
                } 
            if(!
    $this->getServer()->getPluginManager()->getPlugin("EconomyAPI") == false) {
                
    $ecnomy Server::getInstance()->getPluginManager()->getPlugin("EconomyAPI");
                
    $this->log TextFormat::GREEN "- KillCash - Loaded With EconomyAPI !" );
                
    $this->economy true;
                }else{
                
    $this->getLogger()->info(TextFormat::YELLOW."EconomyAPI not connect to KillCash");
                
    $this->economy false;
            }
        }

        public function 
    onPlayerDeath(PlayerDeathEvent $event){
            if(
    $this->economy) {
                   
    $entity $event->getEntity();
                
    $cause $entity->getLastDamageCause();
                if(
    $cause instanceof EntityDamageByEntityEvent) {
                    
    $killer $cause->getDamager()->getPlayer();
                                
    $message str_replace("{Money}"$this->cfg("Give_Money"), $this->cfg("Message"));
                                            
    EconomyAPI::getInstance()->addMoney($killer->getName(), $this->cfg->get("Give_Money"));
                        return 
    true;
                    }
                }
            if(
    $this->massive) {
                   
    $entity $event->getEntity();
                
    $cause $entity->getLastDamageCause();
                if(
    $cause instanceof EntityDamageByEntityEvent) {
                    
    $killer $cause->getDamager()->getPlayer();
                                
    $message str_replace("{Money}"$this->cfg("Give_Money"), $this->cfg("Message"));
                                            
    MassiveEconomyAPI::getInstance()->payPlayer($killer->getName(), $this->cfg("Give_Money"));
                        return 
    true;
                    }
                }else{
                    return 
    true;
                }
        }
        public function 
    onDisable(){
            
    $this->getLogger()->info(TextFormat::RED."KillCash Error!");
        }
    }
    Last edited: Feb 25, 2015
  2. Praxthisnovcht
    Offline

    Praxthisnovcht Notable Member Plugin Developer

    Joined:
    Mar 10, 2014
    Posts:
    702
    Plugins:
    4
    Minecraft User:
    PraxHellTag
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Your default config is corrupted.
  4. Praxthisnovcht
    Offline

    Praxthisnovcht Notable Member Plugin Developer

    Joined:
    Mar 10, 2014
    Posts:
    702
    Plugins:
    4
    Minecraft User:
    PraxHellTag
    Rewrite :p
  5. Joci2000
    Offline

    Joci2000 New Member

    Joined:
    Jul 6, 2014
    Posts:
    1
    Minecraft User:
    Joci2000
    How can i fix it? :

    WARNING RuntimeException: "yaml_parse(): reading error encountered during parsing: invalid leading UTF-8 octet (line 1, column 1)" (E_WARNING) in "/src/pocketmine/utils/Config" at line 138 pls help me :(

Share This Page

Advertisement