mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-18 11:45:30 +00:00
Merge branch 'master' of https://github.com/PocketMine/PocketMine-MP
This commit is contained in:
commit
3352c36ba4
@ -1,6 +1,6 @@
|
||||

|
||||
|
||||
# PocketMine-MP Contribution Gidelines
|
||||
# PocketMine-MP Contribution Guidelines
|
||||
|
||||
Before contributing to PocketMine-MP, please read this.
|
||||
|
||||
@ -20,8 +20,54 @@ Before contributing to PocketMine-MP, please read this.
|
||||
* Use the [Pull Request](https://github.com/PocketMine/PocketMine-MP/pull/new) system, your request will be checked and discussed.
|
||||
* __Create a single branch for that pull request__
|
||||
* If you want to be part of PocketMine-MP, we will ask you to.
|
||||
* Code using the syntax as in PocketMine-MP.
|
||||
* Code using the syntax as in PocketMine-MP. See below for an example.
|
||||
* The code must be clear and written in English, comments included.
|
||||
|
||||
|
||||
__Thanks for contributing to PocketMine-MP!__
|
||||
|
||||
|
||||
|
||||
|
||||
#### Code syntax
|
||||
|
||||
It is mainly [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md) with a few exceptions.
|
||||
* Opening braces MUST go on the same line.
|
||||
* `else if` MUST be written as `elseif`. _(It is in PSR-2, but using a SHOULD)_
|
||||
* Control structure keywords or opening braces MUST NOT have one space after them.
|
||||
* Code MUST use tabs for indenting.
|
||||
* Long arrays MAY be split across multiple lines, where each subsequent line is indented once.
|
||||
* Files MUST use only the `<?php` tag.
|
||||
* Files MUST NOT have an ending `?>` tag.
|
||||
* Code MUST NOT use namespaces. _(This restriction will be lifted on the Alpha_1.4 code)_
|
||||
* Strings SHOULD use the double quote `"` except when the single quote is required.
|
||||
* Arrays SHOULD be declared using `array()`, not the `[]` shortcut.
|
||||
* Argument lists MAY NOT be split across multiple lines, except long arrays.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
class ExampleClass{
|
||||
const EXAMPLE_CLASS_CONSTANT = 1;
|
||||
public $examplePublicVariable = "defaultValue";
|
||||
private $examplePrivateVariable;
|
||||
|
||||
public function __construct($firstArgument, &$secondArgument = null){
|
||||
if($firstArgument === "exampleValue"){ //Remember to use === instead == when possible
|
||||
//do things
|
||||
}elseif($firstArgument === "otherValue"){
|
||||
$secondArgument = function(){
|
||||
return array(
|
||||
0 => "value1",
|
||||
1 => "value2",
|
||||
2 => "value3",
|
||||
3 => "value4",
|
||||
4 => "value5",
|
||||
5 => "value6",
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
```
|
@ -802,6 +802,7 @@ class Player{
|
||||
}
|
||||
|
||||
if(is_array($res)){
|
||||
|
||||
if($this->server->api->dhandle("player.craft", array("player" => $this, "recipe" => $recipe, "craft" => $craft, "type" => $type)) === false){
|
||||
return false;
|
||||
}
|
||||
@ -851,6 +852,9 @@ class Player{
|
||||
case DIAMOND:
|
||||
AchievementAPI::grantAchievement($this, "diamond");
|
||||
break;
|
||||
case CAKE:
|
||||
$this->addItem(BUCKET, 0, 3, false);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
@ -1852,7 +1856,7 @@ class Player{
|
||||
$items = array(
|
||||
APPLE => 2,
|
||||
MUSHROOM_STEW => 10,
|
||||
//BEETROOT_SOUP => ??,
|
||||
BEETROOT_SOUP => 10,
|
||||
BREAD => 5,
|
||||
RAW_PORKCHOP => 3,
|
||||
COOKED_PORKCHOP => 8,
|
||||
|
@ -98,7 +98,28 @@ class Explosion{
|
||||
$e = $server->api->entity->add($this->level, ENTITY_OBJECT, OBJECT_PRIMEDTNT, $data);
|
||||
$server->api->entity->spawnToAll($e);
|
||||
}elseif(mt_rand(0, 10000) < ((1/$this->size) * 10000)){
|
||||
$server->api->entity->drop(new Position($block->x + 0.5, $block->y, $block->z + 0.5, $this->level), BlockAPI::getItem($block->getID(), $this->level->level->getBlockDamage($block->x, $block->y, $block->z)));
|
||||
switch ($block->getID()) {
|
||||
|
||||
case GRASS:
|
||||
$server->api->entity->drop(new Position($block->x + 0.5, $block->y, $block->z + 0.5, $this->level), BlockAPI::getItem(DIRT, $this->level->level->getBlockDamage($block->x, $block->y, $block->z)));
|
||||
break;
|
||||
|
||||
case STONE:
|
||||
$server->api->entity->drop(new Position($block->x + 0.5, $block->y, $block->z + 0.5, $this->level), BlockAPI::getItem(COBBLESTONE, $this->level->level->getBlockDamage($block->x, $block->y, $block->z)));
|
||||
break;
|
||||
|
||||
case COAL_ORE:
|
||||
$server->api->entity->drop(new Position($block->x + 0.5, $block->y, $block->z + 0.5, $this->level), new CoalItem());
|
||||
break;
|
||||
|
||||
case DIAMOND_ORE:
|
||||
$server->api->entity->drop(new Position($block->x + 0.5, $block->y, $block->z + 0.5, $this->level), new DiamondItem());
|
||||
break;
|
||||
|
||||
default:
|
||||
$server->api->entity->drop(new Position($block->x + 0.5, $block->y, $block->z + 0.5, $this->level), BlockAPI::getItem($block->getID(), $this->level->level->getBlockDamage($block->x, $block->y, $block->z)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->level->level->setBlockID($block->x, $block->y, $block->z, 0);
|
||||
$send[] = new Vector3($block->x - $source->x, $block->y - $source->y, $block->z - $source->z);
|
||||
|
Loading…
x
Reference in New Issue
Block a user