Removed pocketmine subdirectory, map PSR-4 style

This commit is contained in:
Dylan K. Taylor
2019-07-30 19:14:57 +01:00
parent 7a77d3dc30
commit 5499ac620c
1044 changed files with 3 additions and 3 deletions

View File

@ -0,0 +1,115 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\event\inventory;
use pocketmine\crafting\CraftingRecipe;
use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait;
use pocketmine\event\Event;
use pocketmine\inventory\transaction\CraftingTransaction;
use pocketmine\item\Item;
use pocketmine\player\Player;
class CraftItemEvent extends Event implements Cancellable{
use CancellableTrait;
/** @var CraftingTransaction */
private $transaction;
/** @var CraftingRecipe */
private $recipe;
/** @var int */
private $repetitions;
/** @var Item[] */
private $inputs;
/** @var Item[] */
private $outputs;
/**
* @param CraftingTransaction $transaction
* @param CraftingRecipe $recipe
* @param int $repetitions
* @param Item[] $inputs
* @param Item[] $outputs
*/
public function __construct(CraftingTransaction $transaction, CraftingRecipe $recipe, int $repetitions, array $inputs, array $outputs){
$this->transaction = $transaction;
$this->recipe = $recipe;
$this->repetitions = $repetitions;
$this->inputs = $inputs;
$this->outputs = $outputs;
}
/**
* Returns the inventory transaction involved in this crafting event.
*
* @return CraftingTransaction
*/
public function getTransaction() : CraftingTransaction{
return $this->transaction;
}
/**
* Returns the recipe crafted.
*
* @return CraftingRecipe
*/
public function getRecipe() : CraftingRecipe{
return $this->recipe;
}
/**
* Returns the number of times the recipe was crafted. This is usually 1, but might be more in the case of recipe
* book shift-clicks (which craft lots of items in a batch).
*
* @return int
*/
public function getRepetitions() : int{
return $this->repetitions;
}
/**
* Returns a list of items destroyed as ingredients of the recipe.
*
* @return Item[]
*/
public function getInputs() : array{
return $this->inputs;
}
/**
* Returns a list of items created by crafting the recipe.
*
* @return Item[]
*/
public function getOutputs() : array{
return $this->outputs;
}
/**
* @return Player
*/
public function getPlayer() : Player{
return $this->transaction->getSource();
}
}

View File

@ -0,0 +1,97 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\event\inventory;
use pocketmine\block\tile\Furnace;
use pocketmine\event\block\BlockEvent;
use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait;
use pocketmine\item\Item;
class FurnaceBurnEvent extends BlockEvent implements Cancellable{
use CancellableTrait;
/** @var Furnace */
private $furnace;
/** @var Item */
private $fuel;
/** @var int */
private $burnTime;
/** @var bool */
private $burning = true;
/**
* @param Furnace $furnace
* @param Item $fuel
* @param int $burnTime
*/
public function __construct(Furnace $furnace, Item $fuel, int $burnTime){
parent::__construct($furnace->getBlock());
$this->fuel = $fuel;
$this->burnTime = $burnTime;
$this->furnace = $furnace;
}
/**
* @return Furnace
*/
public function getFurnace() : Furnace{
return $this->furnace;
}
/**
* @return Item
*/
public function getFuel() : Item{
return $this->fuel;
}
/**
* @return int
*/
public function getBurnTime() : int{
return $this->burnTime;
}
/**
* @param int $burnTime
*/
public function setBurnTime(int $burnTime) : void{
$this->burnTime = $burnTime;
}
/**
* @return bool
*/
public function isBurning() : bool{
return $this->burning;
}
/**
* @param bool $burning
*/
public function setBurning(bool $burning) : void{
$this->burning = $burning;
}
}

View File

@ -0,0 +1,82 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\event\inventory;
use pocketmine\block\tile\Furnace;
use pocketmine\event\block\BlockEvent;
use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait;
use pocketmine\item\Item;
class FurnaceSmeltEvent extends BlockEvent implements Cancellable{
use CancellableTrait;
/** @var Furnace */
private $furnace;
/** @var Item */
private $source;
/** @var Item */
private $result;
/**
* @param Furnace $furnace
* @param Item $source
* @param Item $result
*/
public function __construct(Furnace $furnace, Item $source, Item $result){
parent::__construct($furnace->getBlock());
$this->source = clone $source;
$this->source->setCount(1);
$this->result = $result;
$this->furnace = $furnace;
}
/**
* @return Furnace
*/
public function getFurnace() : Furnace{
return $this->furnace;
}
/**
* @return Item
*/
public function getSource() : Item{
return $this->source;
}
/**
* @return Item
*/
public function getResult() : Item{
return $this->result;
}
/**
* @param Item $result
*/
public function setResult(Item $result) : void{
$this->result = $result;
}
}

View File

@ -0,0 +1,48 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\event\inventory;
use pocketmine\inventory\Inventory;
use pocketmine\player\Player;
class InventoryCloseEvent extends InventoryEvent{
/** @var Player */
private $who;
/**
* @param Inventory $inventory
* @param Player $who
*/
public function __construct(Inventory $inventory, Player $who){
$this->who = $who;
parent::__construct($inventory);
}
/**
* @return Player
*/
public function getPlayer() : Player{
return $this->who;
}
}

View File

@ -0,0 +1,54 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
/**
* Inventory related events
*/
namespace pocketmine\event\inventory;
use pocketmine\entity\Human;
use pocketmine\event\Event;
use pocketmine\inventory\Inventory;
abstract class InventoryEvent extends Event{
/** @var Inventory */
protected $inventory;
public function __construct(Inventory $inventory){
$this->inventory = $inventory;
}
/**
* @return Inventory
*/
public function getInventory() : Inventory{
return $this->inventory;
}
/**
* @return Human[]
*/
public function getViewers() : array{
return $this->inventory->getViewers();
}
}

View File

@ -0,0 +1,52 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\event\inventory;
use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait;
use pocketmine\inventory\Inventory;
use pocketmine\player\Player;
class InventoryOpenEvent extends InventoryEvent implements Cancellable{
use CancellableTrait;
/** @var Player */
private $who;
/**
* @param Inventory $inventory
* @param Player $who
*/
public function __construct(Inventory $inventory, Player $who){
$this->who = $who;
parent::__construct($inventory);
}
/**
* @return Player
*/
public function getPlayer() : Player{
return $this->who;
}
}

View File

@ -0,0 +1,52 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\event\inventory;
use pocketmine\entity\projectile\Arrow;
use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait;
use pocketmine\inventory\Inventory;
class InventoryPickupArrowEvent extends InventoryEvent implements Cancellable{
use CancellableTrait;
/** @var Arrow */
private $arrow;
/**
* @param Inventory $inventory
* @param Arrow $arrow
*/
public function __construct(Inventory $inventory, Arrow $arrow){
$this->arrow = $arrow;
parent::__construct($inventory);
}
/**
* @return Arrow
*/
public function getArrow() : Arrow{
return $this->arrow;
}
}

View File

@ -0,0 +1,52 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\event\inventory;
use pocketmine\entity\object\ItemEntity;
use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait;
use pocketmine\inventory\Inventory;
class InventoryPickupItemEvent extends InventoryEvent implements Cancellable{
use CancellableTrait;
/** @var ItemEntity */
private $item;
/**
* @param Inventory $inventory
* @param ItemEntity $item
*/
public function __construct(Inventory $inventory, ItemEntity $item){
$this->item = $item;
parent::__construct($inventory);
}
/**
* @return ItemEntity
*/
public function getItem() : ItemEntity{
return $this->item;
}
}

View File

@ -0,0 +1,54 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\event\inventory;
use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait;
use pocketmine\event\Event;
use pocketmine\inventory\transaction\InventoryTransaction;
/**
* Called when there is a transaction between two Inventory objects.
* The source of this can be a Player, entities, mobs, or even hoppers in the future!
*/
class InventoryTransactionEvent extends Event implements Cancellable{
use CancellableTrait;
/** @var InventoryTransaction */
private $transaction;
/**
* @param InventoryTransaction $transaction
*/
public function __construct(InventoryTransaction $transaction){
$this->transaction = $transaction;
}
/**
* @return InventoryTransaction
*/
public function getTransaction() : InventoryTransaction{
return $this->transaction;
}
}