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

Help plz...

Comments in 'Plugin Development' started by VoBIs, Apr 16, 2016.

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

    VoBIs New Member

    Joined:
    Jun 20, 2015
    Posts:
    18
    Minecraft User:
    VoBIs
    Why?....

    2016-04-16 [12:33:03] [Server thread/CRITICAL]: "Невозможно обработать событие 'pocketmine\event\player\PlayerInteractEvent' в 'MoneyFromFlower v1': Argument 2 passed to _64FF00\PurePerms\data\UserDataManager::setGroup() must be an instance of _64FF00\PurePerms\PPGroup, string given, called in /home/servs/srv3211/plugins/MoneyFromFlower/src/FIRERO/MoneyFromFlower.php on line 40 в FIRERO\MoneyFromFlower"
    2016-04-16 [12:33:03] [Server thread/CRITICAL]: TypeError: "Argument 2 passed to _64FF00\PurePerms\data\UserDataManager::setGroup() must be an instance of _64FF00\PurePerms\PPGroup, string given, called in /home/servs/srv3211/plugins/MoneyFromFlower/src/FIRERO/MoneyFromFlower.php on line 40" (EXCEPTION) in "/PurePerms_v1.3.7.phar/src/_64FF00/PurePerms/data/UserDataManager" at line 149


    <?php

    namespace FIRERO;

    use _64FF00\PurePerms\PurePerms;
    use onebone\economyapi\EconomyAPI;
    use pocketmine\plugin\PluginBase;
    use pocketmine\event\Listener;
    use pocketmine\Player;
    use pocketmine\item\Item;
    use pocketmine\event\inventory\Inventory;
    use pocketmine\event\inventory\BaseInventory;
    use pocketmine\event\inventory\InventoryOpenEvent;
    use pocketmine\event\player\PlayerInteractEvent;
    use pocketmine\command\Command;
    use pocketmine\command\CommandSender;

    class MoneyFromFlower extends PluginBase implements Listener{

    public function onEnable(){
    $this->getLogger()->info("Плагин От FIRERO Загружен!");
    $this->getServer()->getPluginManager()->registerEvents($this, $this);
    $this->plugin = $this->getServer()->getPluginManager()->getPlugin("PurePerms");
    $this->Economy = $this->getServer()->getPluginManager()->getPlugin("EconomyAPI");
    }

    public function onDisable(){
    $this->getLogger()->info("Плагин От FIRERO Выгружен!");
    }

    public function onPlayerInteractEvent(PlayerInteractEvent $event){
    $player = $event->getPlayer();
    $group = "Admin";
    $levelName = "world";
    $name = $player->getName();
    $money = $this->Economy->mymoney($name);
    if($event->getItem()->getID() == 175){
    if($event->getItem()->getDamage() == 0){
    if($money = 15500){
    $this->plugin->getUserDataMgr()->setGroup($player, $group, $levelName);
    $player->sendMessage("Ты теперь Админ.");
    }
    }
    }
    }
    }
  2. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Can you read the error? It wants a PPGroup instance, you gave it a string.
    applqpak likes this.
  3. VoBIs
    Offline

    VoBIs New Member

    Joined:
    Jun 20, 2015
    Posts:
    18
    Minecraft User:
    VoBIs
    What string? And I don't know...
  4. Vaivez66
    Offline

    Vaivez66 Notable Member Plugin Developer

    Joined:
    Jun 10, 2015
    Posts:
    402
    Plugins:
    2
    How did you make that plugin, if you don't even know what string is?
    ImagicalGamer and applqpak like this.
  5. VoBIs
    Offline

    VoBIs New Member

    Joined:
    Jun 20, 2015
    Posts:
    18
    Minecraft User:
    VoBIs
    and what do you may say about my problem? nothing!? You suggested it would be better, instead of asking questions.
  6. Vaivez66
    Offline

    Vaivez66 Notable Member Plugin Developer

    Joined:
    Jun 10, 2015
    Posts:
    402
    Plugins:
    2
    If you're asking here, we assume that you have enough knowledge in PHP, because this is PocketMine forums, not PHP forums. If you don't know what string is, then you have to learn PHP again, if so, you should understand what CraftYourBukkit meant...
    Primus, applqpak and minebuilder0110 like this.
  7. Vaivez66
    Offline

    Vaivez66 Notable Member Plugin Developer

    Joined:
    Jun 10, 2015
    Posts:
    402
    Plugins:
    2
    applqpak likes this.
  8. _Neisufek_
    Offline

    _Neisufek_ New Member

    Joined:
    Apr 17, 2016
    Posts:
    16
    Minecraft User:
    xNaisu
    If you lack the knowledge of a string you need to go back onto learning PHP or start learning it.

    Where to learn PHP? There are loads of websites:
    1. http://www.w3schools.com/php/
    2. http://PHP.net
    3. https://www.codecademy.com/learn/php
    ---------
    Look up more sites and turorials on: http://Google.Com
    ---------

    What is a string ? Read:
    A string is a set of characters in quotes.

    What is an instance?
    An instance is a class/object with pair of functions, arrays, etc. For example, when you get a player from an even it returns a player object.

    With that being said, you can't compare a string byte with an object. I assume there is a PP sided function to get a group instance by string.
    Primus, Vaivez66 and applqpak like this.
  9. applqpak
    Offline

    applqpak Active Member Plugin Developer

    Joined:
    Dec 16, 2015
    Posts:
    284
    Plugins:
    1
    Minecraft User:
    applqpak
    I suggest not to use W3Schools. It is in no way correct.
    ImagicalGamer and Vaivez66 like this.
  10. _Neisufek_
    Offline

    _Neisufek_ New Member

    Joined:
    Apr 17, 2016
    Posts:
    16
    Minecraft User:
    xNaisu
    Hmm... I don't know why, I've used it before and I find it good. What's the reason you find it incorrect?
  11. applqpak
    Offline

    applqpak Active Member Plugin Developer

    Joined:
    Dec 16, 2015
    Posts:
    284
    Plugins:
    1
    Minecraft User:
    applqpak
    Half of the stuff on there is either incorrect, or bad practice.
    ImagicalGamer likes this.
  12. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    You know, no one has to help you, so I suggest you stop being rude and be glad people are trying to help you.
  13. applqpak
    Offline

    applqpak Active Member Plugin Developer

    Joined:
    Dec 16, 2015
    Posts:
    284
    Plugins:
    1
    Minecraft User:
    applqpak
    To be honest, I am getting REALLY tired of people attempting plugins, not even knowing the half of PHP, then come nagging for help, and being rude to everyone.
  14. TheDeibo
    Offline

    TheDeibo Notable Member

    Joined:
    Sep 8, 2014
    Posts:
    693
    Minecraft User:
    TheDeibo
    I have to be honest, at least half of the plugin developers that PocketMine has ever had, has started of Nooby. and at least a quarter the Plugin Devs ( including me )actually learnt it though trial and error. :3
  15. applqpak
    Offline

    applqpak Active Member Plugin Developer

    Joined:
    Dec 16, 2015
    Posts:
    284
    Plugins:
    1
    Minecraft User:
    applqpak
    Yep.

    But we didn't go nagging people for days and then being the rudest person ever to them.
  16. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    PHP:
    $Strings "This is string";
  17. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    That doesn't explain anything.. Also, variables should start with a lowercase letter, you only use uppercase at more than one word. (e.g. $helloWorld). Why even use $strings? It's one string, so you should rather use $string, just for a better understanding later.
    http://lmgtfy.com/?q=What is a string?
    applqpak likes this.
  18. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    i know strings
    , am i wrong in what I said ,
    because I am not good at EN, and i did not understand what you are say
  19. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    To be honest, I was one of them but I didn't ask this dumb questions having this kind of attitude
    ImagicalGamer and applqpak like this.
  20. Hittmana
    Offline

    Hittmana Active Member

    Joined:
    Jul 26, 2015
    Posts:
    224
    Minecraft User:
    move_it
    W3schools is where I learned all my php and I never have a single php error, I only get errors from incorrect PocketMine stuff.
    ImagicalGamer likes this.
Thread Status:
Not open for further replies.

Share This Page

Advertisement