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

Tell OP when player mines diamonds

Discussion in 'Requests' started by Cameron, Aug 5, 2017.

  1. Cameron

    Cameron Silverfish

    Messages:
    19
    Is there a chance if anyone can make/find me a plug in that tells ops when a player minds diamonds?
     
  2. Junkdude

    Junkdude Zombie

    Messages:
    346
    GitHub:
    JunkDaCoder
    This isnt tested
    EDIT: Didn't realize this was in request section
    PHP:
    public function onBreak(BlockBreakEvent $event) {
    $block $event->getBlock();
    $player $event->getPlayer();
    If(
    $block->getId() === 56) {
    foreach(
    $this->getServer()->getOnlinePlayers() as $p) {
    if(
    $p->IsOp) {
    $p->sendMessage($player->getName(). "broke a diamond ore");
    }
    }
    }
    }
     
    OnTheVerge likes this.
  3. Eduardo

    Eduardo Baby Zombie

    Messages:
    100
    GitHub:
    xBeastMode
    Just a correction: that's not a property. Should be `$player->isOp()`.
     
    OnTheVerge and Levi like this.
  4. Cameron

    Cameron Silverfish

    Messages:
    19
    How can I make this a .phar? Do I just make it a text file? Sorry I am a noob at coding.
     
  5. Cameron

    Cameron Silverfish

    Messages:
    19
    Would it be possible if you could do it for me?
     
    SOFe likes this.
  6. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    (sorry for intervening but this is REQUEST section not DEVELOPE section)
     
    OnTheVerge, jasonwynn10 and Muqsit like this.
  7. Junkdude

    Junkdude Zombie

    Messages:
    346
    GitHub:
    JunkDaCoder
    thats why i put the edit realizing it was a request.
     
  8. TheDiamondYT

    TheDiamondYT Zombie

    Messages:
    298
    GitHub:
    TheDiamondYT1
    Indent your code with 4 TABS so others learn to do it too
     
  9. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
  10. TheDiamondYT

    TheDiamondYT Zombie

    Messages:
    298
    GitHub:
    TheDiamondYT1
    jasonwynn10 likes this.
  11. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    PocketMine never required plugins to do that, much less forum threads.
     
  12. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    tabs and spaces are irrelevant and only matter of taste, and improve readability BUT only on certain cases, in this case it's clearly readable even without indents
     
  13. xXSirButterXx

    xXSirButterXx Witch

    Messages:
    52
    GitHub:
    xxsirbutterxx
    Plus, if they wrote it on the forums instead of writing the code on an IDE and copying it to a post the forums wont allow tabs. Which is probably the reason.
     
  14. WinterBuild7074

    WinterBuild7074 Zombie Pigman

    Messages:
    693
    GitHub:
    winterbuild7074
    I made a plugin for you:
     

    Attached Files:

  15. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    hoW aBoUt uSinG bOtH - tAbS anD sPacEs?
     
    OnTheVerge likes this.
  16. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Please stop doing that.
     
  17. Daniel23

    Daniel23 Witch

    Messages:
    65
    GitHub:
    daniel23
    Server thread/CRITICAL ParseError: "syntax error, unexpected ';'" (EXCEPTION) in "/BreakMessage/src/WinterBuild7074/BreakMessage/Main" at line 33
     
  18. WinterBuild7074

    WinterBuild7074 Zombie Pigman

    Messages:
    693
    GitHub:
    winterbuild7074
    Sorry, I forgot a closing bracket, please open the Main.php file and replace line 32 with this (copy and paste):
    PHP:
    if($player->hasPermission("breakmessage")) {
     
    Daniel23 likes this.
  19. Daniel23

    Daniel23 Witch

    Messages:
    65
    GitHub:
    daniel23
    thread/CRITICAL ReflectionException: "Class WinterBuild7074\BreakMessage\BlockBreakEvent does not exist" (EXCEPTION) in "/src/pocketmine/plugin/PluginManager" at line 766
     
  20. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    @WinterBuild7074 Please ship a full phar file instead of posting zip files and telling people to edit its contents.

    The request forum is for something that can actually be used. Random code snippets are not something that can be uesd.
     
    EdwardHamHam likes this.
  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.