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

Editing Plugins

Discussion in 'Plugin Help' started by Leo, Mar 14, 2017.

  1. Leo

    Leo Silverfish

    Messages:
    23
    Hello, I recently created a thread called "Plugin Help" where I asked how to use zips and .phars, I ended up learning how to do it but I ran into another problem... I am editing a plugin called 1vs1 and I want to make it so that instead of players spawning from a 5 block distance of /refarena, I want to make that 15 blocks! I also wanted to extend the time from 3minutes to 10minutes and I wanted to make it so it didn't give the items (chainmail iron sword food) I wanted to use another plugin on that so I could make multiple kits. I found where those features where in the code and how to edit them but that's where I'm lost right now. I use droidedit and es file manager. Droidedit so I can edit the code, es file manager so I can get to where I edit the code. I learned that you have to edit the file ur turning into a .phar before you turn it into one and not after, so I tried that and I edited the ZIP file and the zip file will not save! It shows that I save it but when I return it is not saved. So I at first wasn't noticing this, so I went to the pocketmine .phar making website and turned the zip into a .phar, then I went to my server client and went to ftp. I went to the plugins folder and uploaded the edited 1vs1 .phar! I went back and restarted my server, looked at the console, did /plugins and 1vs1 didn't show up. I looked back at ftp and the file was still there, but it wasn't showing the plugin! (Before it shows the zips and .phars it shows all of the installed plugins) So then I look at my other installed plugins and found that they all had zips installed as well, so I uploaded the zip and restarted the server, this is when it would have showed up if I didn't edit it because I've tried it like this before. So what happened was, after I restart the server it will delete the .phar and remove the plugin from /plugins. I'd appreciate some help on this, I'm kind of a noob at plugins so far. Also with the actual plugin download, on github i think its a broken version (its not 0.0.5 its 0.0.4 and that version is when it shows up red on /plugins, I looked at the issue using /pluginmgr enable 1vs1 and there was broken code on arena manager line 68. I found where that was and removed the entire folder (I didn't really need it because it was just for the signs) I don't think its on poggit and on old pocketmine forums it has 0.0.5 but it gives you the .phar so that you can just place it in the ftp folder... But that means I can't edit it. Any other links to another 1vs1 download? I honestly have no idea.
     
  2. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    woah.
    1) You shouldn't do such things on an android phone. That'll get really messy. Do you have some sort of computer?
    2) I guess you either didn't "compile" the phar correctly, or introduced a syntax error.
     
  3. dktapps

    dktapps Administrator Staff Member PMMP Team

    Messages:
    774
    GitHub:
    dktapps
    tl;dr
     
    Cr1m, MK500 and HimbeersaftLP like this.
  4. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    so much information :D
    >The abbreviation is based on the principle that, if the writer does not invest the time to convey their message concisely, the reader is justified not investing the time to read it. Alternatively, it might mean that there is insufficient material of value or interest to justify the time required to read it.
     
    HimbeersaftLP likes this.
  5. Leo

    Leo Silverfish

    Messages:
    23
    I do have a computer to do this on but I feel like it would be easier for me to do it mobile because I already have some tools installed. For the kit part of the code that I edited it had
    $player->getInventory()->addItem(Item::get(ITEM::IRON_SWORD));
    $player->getInventory()->addItem(Item::get(ITEM::BREAD));
    $player->getInventory()->setItemInHand(Item::get(ITEM::IRON_SWORD), $player);
    $player->getInventory()->setHelmet(Item::get(302, 0, 1));
    $player->getInventory()->setChestplate(Item::get(303, 0, 1));
    $player->getInventory()->setLeggings(Item::get(304, 0, 1));
    $player->getInventory()->setBoots(Item::get(305, 0, 1));
    $player->getInventory()->sendArmorContents($player);
    And I simply just deleted that. and for the game mode I put
    $player1->setGamemode(0);
    $player2->setGamemode(0); but I changed the number to 2 so it could change the game mode to adventure
    For the spawn distance and for the time I edited this part:
    const ROUND_DURATION = 180;
    const PLAYER_1_OFFSET_X = 5;
    const PLAYER_2_OFFSET_X = -5; I changed the time to 600 and the spawn spots to 15 blocks instead of 5!
    That's all I edit from the code
     
  6. TheDiamondYT

    TheDiamondYT Zombie

    Messages:
    298
    GitHub:
    TheDiamondYT1
    I code everything on a Kindle Fire HD 8 32gb.
     
  7. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    So you deleted ArenaManager.php? That's the problem. I can't begin to explain why. I assume you are using Minifixio's 1vs1 plugin?
     
  8. Leo

    Leo Silverfish

    Messages:
    23
    I deleted the file after trying other things many times. before I had deleted the code error and that didn't work either.
    Yes I'm using Minifixios 1vs1 plugin, I'm pretty sure that's the only 1v1 plugin out there for pe. I'll try to edit the file without doing anything to arenamanager.php but it will shut off the plugin when I add it to ftp like it did before :/.
     
  9. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Deleting a file that the plugin depends on will cause far more issues than it resolves. Especially since the majority of the plugin's functionality is kept in the ArenaManager. Can you share the error you get?
     
    EdwardHamHam likes this.
  10. Leo

    Leo Silverfish

    Messages:
    23
    This is the error I get just by installing the plugin from github, turning it into a .phar, putting it into ftp, and reloading the server "Call to undefined method Minifixio\onevsone\ArenaManager::getServer()" (EXCEPTION) in "/phar_pocketmine-1vs1-plugin-master_Csr2mlNavi56d8D.phar/src/Minifixio/onevsone/ArenaManager" at line 68 . I copyied that from the console
     
  11. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    That's a common issue. I'll be fixing it in this repository.
     
  12. Leo

    Leo Silverfish

    Messages:
    23
    Yes that worked, I can't edit the zip because it doesn't save. And I tryed editing the phar from ftp by editing it and that makes the server shut it off completely. I don't know what to do with that to make the edited code work.
     
  13. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    You can try unzipping it, editing it, then re compressing the folder into a zip, and then into a phar again. I don't suggest editing the plugin while it is on your server. Also, you can use DevTools to load the plugin from the source files(Unzipped). That is useful for editing and testing the plugin before pharing it. If you get any errors or messages when trying to load the plugin, please share them.
     
  14. Leo

    Leo Silverfish

    Messages:
    23
    This is what the console tells me when I edit the code after I put it in ftp:
    14.03 16:56:27 [Server] Server thread/CRITICAL UnexpectedValueException: "manifest cannot be larger than 100 MB in phar "/plugins/phar_pocketmine-1vs1-plugin-master (1)_RYEp8AOam88EdTO.phar"" (EXCEPTION) in "/src/pocketmine/plugin/PharPluginLoader" at line 84
    14.03 16:56:27 [Server] Server thread/ERROR Could not load '/plugins/phar_pocketmine-1vs1-plugin-master (1)_RYEp8AOam88EdTO.phar' in folder '/plugins/': manifest cannot be larger than 100 MB in phar "/plugins/phar_pocketmine-1vs1-plugin-master (1)_RYEp8AOam88EdTO.phar"
     
  15. Leo

    Leo Silverfish

    Messages:
    23
    And what should I use to unzip and recompress ?
     
  16. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    You can extract and compress with ES File Explorer.

    Did you edit the phar directly? This is an error I have never seen before. There is no reason why it should be more than 100 MB...
     
  17. Leo

    Leo Silverfish

    Messages:
    23
    That is a error that popped up when I edited the phar after I put it into ftp. I'll try to compress and extract the phar/zip so hopefully I can get it to save...
     
  18. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Never edit the .phar file directly, because it will not work. You might as well start fresh from the source and phar it after you are done.
     
  19. Leo

    Leo Silverfish

    Messages:
    23
    Yeah I'm lost now. I was looking at ES file manager and it really doesn't explain anything. I got all the steps kind of out of order.
     
  20. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Okay, let's go to a private conversation so as not to spam this thread any more.
     
  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.