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

Help to update code

Discussion in 'Development' started by georgianYT, Oct 13, 2018.

  1. georgianYT

    georgianYT Spider

    Messages:
    9
    GitHub:
    georgianYT
    PHP:
    <?php

    namespace georgianYT;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\scheduler\PluginTask;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\entity\Effect;
    use 
    pocketmine\event\entity\EntityTeleportEvent;
    use 
    pocketmine\event\player\PlayerInteractEvent;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\event\entity\EntityDamageEvent;
    use 
    pocketmine\event\entity\EntityDamageByEntityEvent;
    use 
    pocketmine\event\inventory\InventoryTransactionEvent;
    use 
    pocketmine\event\inventory\InventoryPickupArrowEvent;
    use 
    pocketmine\event\player\PlayerItemHeldEvent;
    use 
    pocketmine\Player;
    use 
    pocketmine\Server;
    use 
    pocketmine\utils\TextFormat as TF;
    use 
    pocketmine\item\Item;
    use 
    pocketmine\network\protocol\AddPlayerPacket;
    use 
    pocketmine\network\protocol\AddEntityPacket;
    use 
    pocketmine\network\protocol\RemovePlayerPacket;
    use 
    pocketmine\network\protocol\RemoveEntityPacket;
    use 
    pocketmine\utils\UUID;
    use 
    pocketmine\entity\Entity;
    use 
    pocketmine\event\player\PlayerCommandPreprocessEvent;
    use 
    pocketmine\inventory\PlayerInventory;

    class 
    Main extends PluginBase implements Listener{

        public function 
    onEnable(){
            
    $this->getServer()->getPluginManager()->registerEvents($this$this);
        }
     
        public function 
    onItemHeld(PlayerItemHeldEvent $event){
            if(
    $event->getItem()->getId() == 352){
                
    $event->getPlayer()->sendPopup("§cRedSword");
            }
        }

        public function 
    onEntityDamageByEntity(EntityDamageEvent $event){
        if (
    $event instanceof EntityDamageByEntityEvent) {
            
    $entity $event->getEntity();
            
    $player $event->getDamager();
            if (
    $entity instanceof Player and $player instanceof Player) {
                
    $item $player->getInventory()->getItemInHand()->getID();
                
    $randrand(110);
                if (
    $item == 352) {
                    
    $event->setDamage(16.0);
                    }
                }
            }
        }
    }
     
    Last edited: Oct 14, 2018
  2. xjohannaxx

    xjohannaxx Silverfish

    Messages:
    16
    may i ask what plugin this is?
     
  3. Derpific

    Derpific Spider Jockey

    Messages:
    44
    GitHub:
    Derpific
    Errors? I only see some outdated imports
     
  4. Awzaw

    Awzaw Zombie Pigman Poggit Admin

    Messages:
    726
    GitHub:
    awzaw
    You should use code blocks (in the little plus icon on the formatting bar) for PHP, or people won't bother to read it.
     
  5. georgianYT

    georgianYT Spider

    Messages:
    9
    GitHub:
    georgianYT
    Oh yes but can you help me to pdate this plugin
     
  6. georgianYT

    georgianYT Spider

    Messages:
    9
    GitHub:
    georgianYT
    Is a plugin to add damage
     
  7. georgianYT

    georgianYT Spider

    Messages:
    9
    GitHub:
    georgianYT
    Like some body can right it correctly pleaseeeeeee....
     
  8. georgianYT

    georgianYT Spider

    Messages:
    9
    GitHub:
    georgianYT
  9. Aericio

    Aericio Slime

    Messages:
    99
    GitHub:
    aericio
    If you are not patient enough to wait for another person's help, feel free to look at the helpful changelog that dktapps spent his time on writing: https://github.com/pmmp/PocketMine-MP/releases and correct it yourself.

    If you are not capable of doing that, then be patient and wait for someone to help you.
     
    Awzaw and EdwardHamHam like this.
  10. Awzaw

    Awzaw Zombie Pigman Poggit Admin

    Messages:
    726
    GitHub:
    awzaw
    To get a quick reply it's always best to post as much information as possible ... What errors do you see? Which version of PMMP Pocketmine are you using?
     
    EdwardHamHam likes this.
  11. georgianYT

    georgianYT Spider

    Messages:
    9
    GitHub:
    georgianYT
    The last one .
    And I got errors
    It is written that the functions are obsolete
     
  12. Aericio

    Aericio Slime

    Messages:
    99
    GitHub:
    aericio
    It would be helpful if we knew the version of PocketMine-MP you are running on.

    You might have missed it in @Awzaw 's post. Hopefully, this will catch your eye.

    Code:
    ~~ MANDATORY ~~
    > PLEASE SUPPLY YOUR POCKETMINE-MP VERSION.
    > SIMPLY RUN `/VERSION` IN CONSOLE AND PROVIDE THE OUTPUT.
    > IF NOT PROVIDED, WE CANNOT MAKE THE APPROPRIATE CHANGES
    > FOR THE VERSION YOU ARE ON.
    ~~ MANDATORY ~~
    If you require this in another language, simply head over to https://translate.google.com/ and select your desired language of translation.

    - Aericio, Founder of PleaseRead Inc.

    PleaseRead Inc. is a non-profit corporation that specializes in providing courtesy services, free of charge, in order to help people, like you, read. It is our mission to educate as many people as possible to efficiently read text and stop wasting people's times by providing the necessary information required.

    While PleaseRead Inc. is a free-of-charge service, courtesy of Aericio, we welcome donations to our company via our Patreon Link. We are also looking for extra volunteer staff for our company. If you are interested, please email me at aericio@***.com and we will send you an application form.
    (psst, this is a joke. patreon goes to pmmp.)
     
    Last edited: Oct 17, 2018
    InspectorGadget likes this.
  13. Awzaw

    Awzaw Zombie Pigman Poggit Admin

    Messages:
    726
    GitHub:
    awzaw
    To quota a wise person, "last" is not a version... and I didn't ask for a description of the errors, I asked to see the actual errors; to get help you'll need to put in a little effort yourself too: copy/paste the PocketMine-MP version you get when starting the server, and the errors from console - into nice spoliers/code blocks.
     
  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.