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

Some bug in plugin

Comments in 'Plugin Development' started by Jelly9912, Sep 20, 2015.

Thread Status:
Not open for further replies.
  1. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    When i edit plugin on my server and i make phar file, then i shared this to other players and on other servers this plugin doesn't work. But on my server this works perfectly :/
    Any suggestions?
  2. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Please provide more information on the plugin and the server versions.
  3. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    Console says this when i started server with .phar file

    Attached Files:

  4. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    And Crash Dump when i started server with source of plugin

    Attached Files:

  5. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Did you edit the plugin phar directly? If so, you broke the signature.
  6. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    No, i edits source code and i make phar file with /makeplugin and then i downloaded this from server and i pasted this on PocketMine server and this just doesn't works
  7. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    Try compiling it again
    PEMapModder likes this.
  8. FuryTacticz
    Offline

    FuryTacticz New Member

    Joined:
    Aug 31, 2015
    Posts:
    23
    Minecraft User:
    FuryTacticz
    whats line 85 on main.php
  9. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    Main.php have 65 lines but in phar file this is
    Code:
    $this->plugin->giveAll();
  10. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    Can u show the full code?
  11. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    Main.php or phar ?
  12. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Main.php obviously...
    Taha_The_Hacker likes this.
  13. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    Yea, sure, cauze this is RandomItem but polish version :p
    Code:
    <?php
    namespace LosowyItem;
    use pocketmine\command\Command;
    use pocketmine\command\CommandSender;
    use pocketmine\Player;
    use pocketmine\inventory\PlayerInventory;
    use pocketmine\plugin\PluginBase;
    use pocketmine\Server;
    use pocketmine\utils\TextFormat;
    use pocketmine\item\Item;
    class Main extends PluginBase {
      public function onEnable() {
        if(!file_exists($this->getDataFolder() . "config.yml")) {
          @mkdir($this->getDataFolder());
          file_put_contents($this->getDataFolder() . "config.yml",$this->getResource("config.yml"));
        }
        $c = yaml_parse(file_get_contents($this->getDataFolder() . "config.yml"));
        $t = $c["interval"] * 1200;
        $num = 0;
        foreach ($c["items"] as $i) {
          $r = explode(":",$i);
          $this->itemdata[$num] = array("id" => $r[0],"meta" => $r[1],"amount" => $r[2]);
          $num++;
        }
        $this->getServer()->getScheduler()->scheduleRepeatingTask(new Gift($this),$t);
      }
      public function onCommand(CommandSender $issuer,Command $cmd,$label,array $args) {
        if((strtolower($cmd->getName()) == "losowyitem") && isset($args[0])) {
          if($this->getServer()->getPlayer($args[0]) instanceof Player) {
            $d = $this->generateData();
            $p = $this->getServer()->getPlayer($args[0]);
            $this->give($p,$d);
            $p->sendMessage("§d[§aLosowy§6Item§d] §eDostałeś/aś losowy item! (" . $data["id"] . ":" . $data["meta"] . ")");
          } else {
            $issuer->sendMessage("§cGracz jest offline !");
          }
          return true;
        } else if((strtolower($cmd->getName()) == "losowyitem") && !(isset($args[0]))) {
          $this->giveAll();
          return true;
        } else {
          return false;
        }
      }
      public function give($p,$data) {
        if(($p instanceof Player) && ($p->getInventory() instanceof PlayerInventory)) {
          $item = new Item($data["id"],$data["meta"],$data["amount"]);
          $p->getInventory()->addItem($item);
        }
      }
      public function giveAll() {
        $data = $this->generateData();
        $this->broadcast("§eLosowy item rozdany!§b (" . $data["id"] . ":" . $data["meta"] . ")");
        foreach($this->getServer()->getOnlinePlayers() as $p) {
          $this->give($p,$data);
        }
      }
      public function broadcast($m) {
        foreach($this->getServer()->getOnlinePlayers() as $p) {
          $p->sendMessage("§d[§aLosowy§6Item§d]§e " . $m);
        }
        $this->getLogger()->info(TextFormat::YELLOW . $m);
      }
      public function generateData() {
        return $this->itemdata[rand(0,(count($this->itemdata) - 1))];
      }
    }
    
  14. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Based on the code and the crash dump, I can assume that the problem is a broken signature(most likely because you modified the phar itself), so re-complile it and tell me what happens.
  15. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    I downloaded source code from github and console says:
    Code:
    [Server] [19:05:32] [Server thread/INFO]: Loading source plugin RandomItem v4.2
    [Server] [19:05:32] [Server thread/INFO]: Enabling RandomItem v4.2
    [Server] [19:05:32] [Server thread/NOTICE]: ArrayOutOfBoundsException: "Undefined index: interval" (E_NOTICE) in "/RandomItem/src/LDX/RandomItem/Main" at line 14
    [Server] [19:05:32] [Server thread/INFO]: Disabling RandomItem v4.2 
    Line 14:
    Code:
    $t = $c["interval"] * 1200; 

    EDIT: Nvm it's just old api :/
  16. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Read carefully, it is FolderPluginLoader line 85 not main.php line 85...
  17. FuryTacticz
    Offline

    FuryTacticz New Member

    Joined:
    Aug 31, 2015
    Posts:
    23
    Minecraft User:
    FuryTacticz
    I best get my eye sight checked e.e
  18. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    Ok thx guys, i fixed this
  19. andre_the_gamer
    Offline

    andre_the_gamer Active Member

    Joined:
    Feb 5, 2015
    Posts:
    112
    Minecraft User:
    Andre_The_Gamer
    Try the randomitem version from pocketmine not github cause sometimes the github version can be outdated so just download the .PHAR from pocketmine plugin section then use dev tools to do /extractplugin RandomItem and i think you can now edit the source and it should work :). Hope i helped. :D
    Jelly9912 likes this.
  20. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    Since we're here, i have a second bug, but with skyblock plugin.
    I changed this
    Code:
        public function makeIsland($name){
            $player = $this->getServer()->getPlayer($name);
            if(!($player instanceof Player)){
                return "Error: Player not found";
            }else{
              
                $randX = rand(1, 500);
                $randZ = rand(1, 500);
                $Y = 100;
    
    On this
    Code:
        public function makeIsland($name){
            $player = $this->getServer()->getPlayer($name);
            if(!($player instanceof Player)){
                return "Error: Player not found";
            }else{
              
                $randX = rand(1, 5000);
                $randZ = rand(1, 5000);
                $randY = rand(15, 120);
    And now islands doesn't creating :c
    how i can fix this ?
Thread Status:
Not open for further replies.

Share This Page

Advertisement