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

Config file help

Discussion in 'Development' started by Matrox, Jan 8, 2019.

  1. Matrox

    Matrox Slime

    Messages:
    92
    GitHub:
    MatroxMC
    Hello I would like to know how I can make a text that is curtomisable thanks to a config file how I can implement this (I show what I want to customizable)
    Thanks.


    PHP:
    foreach($this->ores as $ore){                                                                                
    if(
    $block->getId() === $ore && !$ev->isCancelled()){                               here                                   
    $ev
    ->setDrops(array());                                                      v v v v v v v
    $this
    ->getServer()->broadcastMessage("§9[§eBlutoInfo§9] §6$name §9a trouver des diamants !!");
    $p->getInventory()->addItem(Item::get($this->ingot[$ore]));
    [
    PHP]
    My full code
    PHP:
    <?php

    namespace DiamondWarner;

    use 
    pocketmine\event\block\BlockBreakEvent;
    use 
    pocketmine\Player;
    use 
    pocketmine\Server;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\level\sound\BatSound;
    use 
    pocketmine\level\sound\ClickSound;
    use 
    pocketmine\level\sound\DoorSound;
    use 
    pocketmine\level\sound\FizzSound;
    use 
    pocketmine\level\Position;
    use 
    pocketmine\math\Vector3;
    use 
    pocketmine\item\Item;
    use 
    pocketmine\block\Block;
    use 
    pocketmine\plugin\PluginManager;
    use 
    pocketmine\Plugin;
    use 
    pocketmine\Level;
    class 
    Main extends PluginBase implements Listener{

    public function 
    onEnable(){
    $this->getServer()->getLogger()->info("DiamondWarner Loading...");
    $this->getServer()->getPluginManager()->registerEvents($this,$this);
          
    $this->ores=array(56);
     
    $this->ingot=array(

        
    56 => 264,);
    }

    public function 
    onBreak(BlockBreakEvent $ev){

        
    //variable
    $player $ev->getPlayer();

    $name $player->getName();

    //Merci au forum pmmp :)
    $p $ev->getPlayer();


    $block $ev->getBlock();

    $item $ev->getItem()->getId();

    $ev->setInstaBreak(true);

    foreach(
    $this->ores as $ore){
    if(
    $block->getId() === $ore && !$ev->isCancelled()){
    $ev->setDrops(array());
    $this->getServer()->broadcastMessage("§9[§eBlutoInfo§9] §6$name §9a trouver des diamants !!");
    $p->getInventory()->addItem(Item::get($this->ingot[$ore]));
    }
    }
    }
    }
    [
    PHP]
     
  2. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    corytortoise likes this.
  3. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    I'd like to add, that instead of posting a thread asking how to do every single thing in your plugin, that you spend time learning the PMMP API first. It would save you and every one else some time. The PMMP Docs are pretty helpful.
     
  4. Matrox

    Matrox Slime

    Messages:
    92
    GitHub:
    MatroxMC
    Ok... Sorry. Give me a links please
     
  5. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    The link above is very useful for references and understanding what a particular function or class does, but this thread by Intyre is useful, as well as many of the other threads in the Plugin > Resources section.
     
    HimbeersaftLP 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.