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

Error with plugin

Discussion in 'Development' started by DanielYTK, Mar 16, 2017.

  1. DanielYTK

    DanielYTK Zombie

    Messages:
    227
    So I put the plugin in the plugin folder, then when I turn on my server, the plugin gets enabled but nothing appears, nothing like:
    - Commands do not work
    - getLogger () also does not work
    - Main is totally right
    - plugin.yml all right

    So I can not tell what's going on
     
  2. LilCrispy2o9

    LilCrispy2o9 Spider Jockey

    Messages:
    43
    GitHub:
    lilcrispy2o9
    Can you show us what you have?
     
  3. McpeBooster

    McpeBooster Baby Zombie

    Messages:
    190
    GitHub:
    mcpebooster
    If it is a folder Plugin you must have DevTools to run it :D
     
  4. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Make sure your Main class extends pocketmine\plugin\PluginBase.
     
  5. DanielYTK

    DanielYTK Zombie

    Messages:
    227
    PHP:
    <?php

    namespace da;

    use 
    pocketmine\event\Listener;
    use 
    pocketmine\plugin\PluginBase;

    use 
    pocketmine\Server;
    use 
    pocketmine\Player;
    use 
    pocketmine\entity\Entity;
    use 
    pocketmine\item\Item;
    use 
    pocketmine\utils\Config;
    use 
    pocketmine\block\Block;

    use 
    pocketmine\inventory;
    use 
    pocketmine\inventory\PlayerInventory;
    use 
    pocketmine\inventory\BaseInventory;

    use 
    pocketmine\item\enchantment\Enchantment;
    use 
    pocketmine\item\enchantment\EnchantmentList;
    use 
    pocketmine\item\enchantment\EnchantmentEntry;

    use 
    pocketmine\command\Command;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\command\ConsoleCommandSender;

    use 
    pocketmine\event\entity\EntityDamageEvent;
    use 
    pocketmine\event\player\PlayerCommandPreprocessEvent;
    use 
    pocketmine\event\player\PlayerJoinEvent;
    use 
    pocketmine\event\block\BlockPlaceEvent;
    use 
    pocketmine\event\player\PlayerInteractEvent;

    use 
    pocketmine\plugin\PluginDescription;

    use 
    onebone\economyapi\EconomyAPI;

    class 
    main extends PluginBase implements Listener{
        public 
    $player;
        public function 
    onEnable(){
            
    $this->getServer()->getPluginManager()->registerEvents($this$this);
            
    $this->getServer()->getLogger()->info("§aHydraCore foi ligada!");
            @
    mkdir($this->getDataFolder());
            
    $as = new Config($this->getDataFolder()."antispam.yml",Config::YAML,[
            
    "time"=> 0
            
    ]);
            
    $as->save();
            
    $cm = new Config($this->getDataFolder(). "caixa.yml",Config::YAML, [
            
    "basica" => 200000,
            
    "avancada" => 600000,
            
    "spawner" => 800000
            
    ]);
            
    $cm->save();
            
    $this->money Server::getInstance()->getPluginManager()->getPlugin("EconomyAPI");
            
    $this->getServer()->getCommandMap()->register("caixa", new caixa($this));
            
    $this->getServer()->getCommandMap()->register("coords", new coords($this));
            
    $this->getServer()->getCommandMap()->register("reportar", new reportar($this));
            
    $this->getServer()->getCommandMap()->register("addcash", new addcash($this));
            
    $this->getServer()->getCommandMap()->register("enviar", new enviar($this));
            
    $this->getServer()->getCommandMap()->register("cash", new cash($this));
            
    $this->getServer()->getCommandMap()->register("setcash", new setcash($this));
            
    $this->getServer()->getCommandMap()->register("retirar", new retirar($this));
            
    $this->getServer()->getCommandMap()->register("vida", new vida($this));
            
    $this->getServer()->getCommandMap()->register("takecash", new takecash($this));
            
    $this->getServer()->getCommandMap()->register("vserver", new vserver($this));
        }
       
        public function 
    onDisable(){}
       
        public function 
    onInteract(PlayerInteractEvent $ev){
            
    $p $ev->getPlayer();
            
    $item $ev->getItem();
            if(
    $ev->getItem() == 339){
                
    $i $ev->getDamage();
                if(
    $item->getDamage() >= 0){
                    
    $sender->sendMessage("§l§5Banco§r§7 Foi depositado $$i em sua conta");
                    
    $sender->getInventory()->remove($ev->getItem());
                    
    $sender->getInventory()->addItem(Item::get($item->getId(), $item->getDamage(), $item->getCount() -1));
                }
                }
            }
    getLogger() and the events and commands, don't work.
    Plugin.yml:
    Code:
    name: Plugin
    main: da\main
    api: 2.0.0
    version: 1.0
    authors: DanielYTK
    commands:
        reportar:
            description: Reportar um jogador
            permission: reportar.usar
        enviar:
            description: Enviar um item para outro jogador
            permission: enviar.usar
        vida:
            description: Regenerar sua vida
            permission: vida.usar
        caixa:
            description: Comprar uma caixa mágica
            permission: caixa.comprar
        cash:
            description: Ver o seu cash
            permission: cash.ver
        setcash:
            description: Setar o cash de um jogador
            permission: cash.setar
        addcash:
            description: Adicionar cash a um jogador
            permission: cash.add
        takecash:
            description: Remover o cash de um jogador
            permission: cash.remover
        vserver:
            description: Ver informações importantes do Servidor
            permission: vserver.ver
        coords:
            description: Ver suas coordenadas
            permission: coords.usar
        tpaon:
            description: Ativar suas solicitações de tpa
            permission: tpa.on
        tpaoff:
            description: Desativar suas solicitações de tpa
            permission: tpa.off
        tellon:
            description: Ativar as mensagens privadas
            permission: tpa.on
        telloff:
            description: Desativar as mensagens privadas
            permission: tpa.off
    
    
     
  6. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    When you do /plugins, does it show up at all? Does it show up in red? If it's red, it may be an incompatible API issue.
     
  7. DanielYTK

    DanielYTK Zombie

    Messages:
    227
    no. no, its is green(actived)
     
  8. dktapps

    dktapps Administrator Staff Member PMMP Team

    Messages:
    774
    GitHub:
    dktapps
    `api: 2.0.0` doesn't look correct... PocketMine-MP will not load plugins with wrong API versions. Unless you're using a spoon, which always seem to think it's a good idea to just remove compatibility checks...
     
    jasonwynn10 and HimbeersaftLP like this.
  9. DanielYTK

    DanielYTK Zombie

    Messages:
    227
    So, what should I do, young man?
     
  10. Jack Noordhuis

    Jack Noordhuis Zombie Pigman Poggit Reviewer

    Messages:
    618
    GitHub:
    JackNoordhuis
    Use your head and update the plugin, child.
     
  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.