mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 16:51:42 +00:00
PhpStorm automated formatting (#11)
* PhpStorm reformatting * Tuned PhpStorm reformatting * Improved ItemIds and BlockIds formatting * Tuned more PhpStorm reformatting * Improved string concatenation
This commit is contained in:
parent
2b6d058760
commit
58ff381557
@ -127,8 +127,8 @@ class MemoryManager{
|
||||
}
|
||||
|
||||
public function trigger($memory, $limit, $global = false, $triggerCount = 0){
|
||||
$this->server->getLogger()->debug("[Memory Manager] ".($global ? "Global " : "") ."Low memory triggered, limit ". round(($limit / 1024) / 1024, 2)."MB, using ". round(($memory / 1024) / 1024, 2)."MB");
|
||||
|
||||
$this->server->getLogger()->debug(sprintf("[Memory Manager] %sLow memory triggered, limit %gMB, using %gMB",
|
||||
$global ? "Global " : "", round(($limit / 1024) / 1024, 2), round(($memory / 1024) / 1024, 2)));
|
||||
if($this->cacheTrigger){
|
||||
foreach($this->server->getLevels() as $level){
|
||||
$level->clearCache(true);
|
||||
@ -149,7 +149,7 @@ class MemoryManager{
|
||||
$cycles = $this->triggerGarbageCollector();
|
||||
}
|
||||
|
||||
$this->server->getLogger()->debug("[Memory Manager] Freed " . round(($ev->getMemoryFreed() / 1024) / 1024, 2)."MB, $cycles cycles");
|
||||
$this->server->getLogger()->debug(sprintf("[Memory Manager] Freed %gMB, $cycles cycles", round(($ev->getMemoryFreed() / 1024) / 1024, 2)));
|
||||
}
|
||||
|
||||
public function check(){
|
||||
@ -265,7 +265,7 @@ class MemoryManager{
|
||||
$this->continueDump($property->getValue($object), $info["properties"][$property->getName()], $objects, $refCounts, 0, $maxNesting, $maxStringSize);
|
||||
}
|
||||
|
||||
fwrite($obData, "$hash@$className: ". json_encode($info, JSON_UNESCAPED_SLASHES) . "\n");
|
||||
fwrite($obData, "$hash@$className: " . json_encode($info, JSON_UNESCAPED_SLASHES) . "\n");
|
||||
|
||||
if(!isset($objects["staticProperties"][$className])){
|
||||
$staticProperties[$className] = [];
|
||||
@ -323,7 +323,7 @@ class MemoryManager{
|
||||
$this->continueDump($value, $data[$key], $objects, $refCounts, $recursion + 1, $maxNesting, $maxStringSize);
|
||||
}
|
||||
}elseif(is_string($from)){
|
||||
$data = "(string) len(".strlen($from).") " . substr(Utils::printable($from), 0, $maxStringSize);
|
||||
$data = sprintf("(string) len(%d) " . substr(Utils::printable($from), 0, $maxStringSize), strlen($from));
|
||||
}elseif(is_resource($from)){
|
||||
$data = "(resource) " . print_r($from, true);
|
||||
}else{
|
||||
|
@ -175,7 +175,7 @@ namespace pocketmine {
|
||||
$default_timezone = timezone_name_from_abbr($timezone);
|
||||
ini_set("date.timezone", $default_timezone);
|
||||
date_default_timezone_set($default_timezone);
|
||||
} else {
|
||||
}else{
|
||||
date_default_timezone_set($timezone);
|
||||
}
|
||||
}
|
||||
@ -323,7 +323,7 @@ namespace pocketmine {
|
||||
if(function_exists("posix_kill")){
|
||||
posix_kill($pid, SIGKILL);
|
||||
}else{
|
||||
exec("kill -9 " . ((int)$pid) . " > /dev/null 2>&1");
|
||||
exec("kill -9 " . ((int) $pid) . " > /dev/null 2>&1");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -801,9 +801,9 @@ class Server{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $name
|
||||
* @param CompoundTag $nbtTag
|
||||
* @param bool $async
|
||||
* @param bool $async
|
||||
*/
|
||||
public function saveOfflinePlayerData($name, CompoundTag $nbtTag, $async = false){
|
||||
$nbt = new NBT(NBT::BIG_ENDIAN);
|
||||
@ -1779,7 +1779,7 @@ class Server{
|
||||
*
|
||||
* @param Player[] $players
|
||||
* @param DataPacket[]|string $packets
|
||||
* @param bool $forceSync
|
||||
* @param bool $forceSync
|
||||
*/
|
||||
public function batchPackets(array $players, array $packets, $forceSync = false){
|
||||
Timings::$playerNetworkTimer->startTiming();
|
||||
@ -1986,7 +1986,7 @@ class Server{
|
||||
gc_collect_cycles();
|
||||
}catch(\Throwable $e){
|
||||
$this->logger->emergency("Crashed while crashing, killing process");
|
||||
$this->logger->emergency(get_class($e) . ": ". $e->getMessage());
|
||||
$this->logger->emergency(get_class($e) . ": " . $e->getMessage());
|
||||
@kill(getmypid());
|
||||
}
|
||||
|
||||
@ -2264,14 +2264,14 @@ class Server{
|
||||
if($r > $this->baseTickRate){
|
||||
$level->tickRateCounter = $level->getTickRate();
|
||||
}
|
||||
$this->getLogger()->debug("Raising level \"".$level->getName()."\" tick rate to ".$level->getTickRate()." ticks");
|
||||
$this->getLogger()->debug("Raising level \"{$level->getName()}\" tick rate to {$level->getTickRate()} ticks");
|
||||
}elseif($tickMs >= 50){
|
||||
if($level->getTickRate() === $this->baseTickRate){
|
||||
$level->setTickRate(max($this->baseTickRate + 1, min($this->autoTickRateLimit, floor($tickMs / 50))));
|
||||
$this->getLogger()->debug("Level \"".$level->getName()."\" took ".round($tickMs, 2)."ms, setting tick rate to ".$level->getTickRate()." ticks");
|
||||
$this->getLogger()->debug(sprintf("Level \"%s\" took %gms, setting tick rate to %d ticks", $level->getName(), round($tickMs, 2), $level->getTickRate()));
|
||||
}elseif(($tickMs / $level->getTickRate()) >= 50 and $level->getTickRate() < $this->autoTickRateLimit){
|
||||
$level->setTickRate($level->getTickRate() + 1);
|
||||
$this->getLogger()->debug("Level \"".$level->getName()."\" took ".round($tickMs, 2)."ms, setting tick rate to ".$level->getTickRate()." ticks");
|
||||
$this->getLogger()->debug(sprintf("Level \"%s\" took %gms, setting tick rate to %d ticks", $level->getName(), round($tickMs, 2), $level->getTickRate()));
|
||||
}
|
||||
$level->tickRateCounter = $level->getTickRate();
|
||||
}
|
||||
@ -2343,7 +2343,7 @@ class Server{
|
||||
$d = Utils::getRealMemoryUsage();
|
||||
|
||||
$u = Utils::getMemoryUsage(true);
|
||||
$usage = round(($u[0] / 1024) / 1024, 2) . "/" . round(($d[0] / 1024) / 1024, 2) . "/" . round(($u[1] / 1024) / 1024, 2) . "/".round(($u[2] / 1024) / 1024, 2)." MB @ " . Utils::getThreadCount() . " threads";
|
||||
$usage = sprintf("%g/%g/%g/%g MB @ %d threads", round(($u[0] / 1024) / 1024, 2), round(($d[0] / 1024) / 1024, 2), round(($u[1] / 1024) / 1024, 2), round(($u[2] / 1024) / 1024, 2), Utils::getThreadCount());
|
||||
|
||||
echo "\x1b]0;" . $this->getName() . " " .
|
||||
$this->getPocketMineVersion() .
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
class ActivatorRail extends Solid {
|
||||
class ActivatorRail extends Solid{
|
||||
|
||||
protected $id = self::ACTIVATOR_RAIL;
|
||||
|
||||
|
@ -27,9 +27,9 @@ interface BlockIds{
|
||||
const STONE = 1;
|
||||
const GRASS = 2;
|
||||
const DIRT = 3;
|
||||
const COBBLESTONE = 4; const COBBLE = 4;
|
||||
const PLANK = 5; const PLANKS = 5; const WOODEN_PLANK = 5; const WOODEN_PLANKS = 5;
|
||||
const SAPLING = 6; const SAPLINGS = 6;
|
||||
const COBBLESTONE = 4, COBBLE = 4;
|
||||
const PLANK = 5, PLANKS = 5, WOODEN_PLANK = 5, WOODEN_PLANKS = 5;
|
||||
const SAPLING = 6, SAPLINGS = 6;
|
||||
const BEDROCK = 7;
|
||||
const WATER = 8;
|
||||
const STILL_WATER = 9;
|
||||
@ -40,7 +40,7 @@ interface BlockIds{
|
||||
const GOLD_ORE = 14;
|
||||
const IRON_ORE = 15;
|
||||
const COAL_ORE = 16;
|
||||
const LOG = 17; const WOOD = 17; const TRUNK = 17;
|
||||
const LOG = 17, WOOD = 17, TRUNK = 17;
|
||||
const LEAVES = 18;
|
||||
const SPONGE = 19;
|
||||
const GLASS = 20;
|
||||
@ -48,130 +48,130 @@ interface BlockIds{
|
||||
const LAPIS_BLOCK = 22;
|
||||
const DISPENSER = 23;
|
||||
const SANDSTONE = 24;
|
||||
const NOTE_BLOCK = 25; const NOTEBLOCK = 25;
|
||||
const NOTE_BLOCK = 25, NOTEBLOCK = 25;
|
||||
const BED_BLOCK = 26;
|
||||
const POWERED_RAIL = 27;
|
||||
const DETECTOR_RAIL = 28;
|
||||
const STICKY_PISTON = 29;
|
||||
const COBWEB = 30;
|
||||
const TALL_GRASS = 31;
|
||||
const BUSH = 32; const DEAD_BUSH = 32;
|
||||
const BUSH = 32, DEAD_BUSH = 32;
|
||||
const PISTON = 33;
|
||||
const PISTON_HEAD = 34;
|
||||
const WOOL = 35;
|
||||
|
||||
const DANDELION = 37;
|
||||
const POPPY = 38; const ROSE = 38; const RED_FLOWER = 38;
|
||||
const POPPY = 38, ROSE = 38, RED_FLOWER = 38;
|
||||
const BROWN_MUSHROOM = 39;
|
||||
const RED_MUSHROOM = 40;
|
||||
const GOLD_BLOCK = 41;
|
||||
const IRON_BLOCK = 42;
|
||||
const DOUBLE_SLAB = 43; const DOUBLE_SLABS = 43;
|
||||
const SLAB = 44; const SLABS = 44; const STONE_SLAB = 44;
|
||||
const BRICKS = 45; const BRICKS_BLOCK = 45;
|
||||
const DOUBLE_SLAB = 43, DOUBLE_SLABS = 43;
|
||||
const SLAB = 44, SLABS = 44, STONE_SLAB = 44;
|
||||
const BRICKS = 45, BRICKS_BLOCK = 45;
|
||||
const TNT = 46;
|
||||
const BOOKSHELF = 47;
|
||||
const MOSS_STONE = 48; const MOSSY_STONE = 48;
|
||||
const MOSS_STONE = 48, MOSSY_STONE = 48;
|
||||
const OBSIDIAN = 49;
|
||||
const TORCH = 50;
|
||||
const FIRE = 51;
|
||||
const MONSTER_SPAWNER = 52;
|
||||
const WOOD_STAIRS = 53; const WOODEN_STAIRS = 53; const OAK_WOOD_STAIRS = 53; const OAK_WOODEN_STAIRS = 53;
|
||||
const WOOD_STAIRS = 53, WOODEN_STAIRS = 53, OAK_WOOD_STAIRS = 53, OAK_WOODEN_STAIRS = 53;
|
||||
const CHEST = 54;
|
||||
const REDSTONE_WIRE = 55;
|
||||
const DIAMOND_ORE = 56;
|
||||
const DIAMOND_BLOCK = 57;
|
||||
const CRAFTING_TABLE = 58; const WORKBENCH = 58;
|
||||
const CRAFTING_TABLE = 58, WORKBENCH = 58;
|
||||
const WHEAT_BLOCK = 59;
|
||||
const FARMLAND = 60;
|
||||
const FURNACE = 61;
|
||||
const BURNING_FURNACE = 62; const LIT_FURNACE = 62;
|
||||
const BURNING_FURNACE = 62, LIT_FURNACE = 62;
|
||||
const SIGN_POST = 63;
|
||||
const DOOR_BLOCK = 64; const WOODEN_DOOR_BLOCK = 64; const WOOD_DOOR_BLOCK = 64;
|
||||
const DOOR_BLOCK = 64, WOODEN_DOOR_BLOCK = 64, WOOD_DOOR_BLOCK = 64;
|
||||
const LADDER = 65;
|
||||
const RAIL = 66;
|
||||
const COBBLESTONE_STAIRS = 67; const COBBLE_STAIRS = 67;
|
||||
const COBBLESTONE_STAIRS = 67, COBBLE_STAIRS = 67;
|
||||
const WALL_SIGN = 68;
|
||||
const LEVER = 69;
|
||||
const STONE_PRESSURE_PLATE = 70;
|
||||
const IRON_DOOR_BLOCK = 71;
|
||||
const WOODEN_PRESSURE_PLATE = 72;
|
||||
const REDSTONE_ORE = 73;
|
||||
const GLOWING_REDSTONE_ORE = 74; const LIT_REDSTONE_ORE = 74;
|
||||
const GLOWING_REDSTONE_ORE = 74, LIT_REDSTONE_ORE = 74;
|
||||
const UNLIT_REDSTONE_TORCH = 75;
|
||||
const REDSTONE_TORCH = 76; const LIT_REDSTONE_TORCH = 76;
|
||||
const REDSTONE_TORCH = 76, LIT_REDSTONE_TORCH = 76;
|
||||
const STONE_BUTTON = 77;
|
||||
const SNOW = 78; const SNOW_LAYER = 78;
|
||||
const SNOW = 78, SNOW_LAYER = 78;
|
||||
const ICE = 79;
|
||||
const SNOW_BLOCK = 80;
|
||||
const CACTUS = 81;
|
||||
const CLAY_BLOCK = 82;
|
||||
const REEDS = 83; const SUGARCANE_BLOCK = 83;
|
||||
const REEDS = 83, SUGARCANE_BLOCK = 83;
|
||||
|
||||
const FENCE = 85;
|
||||
const PUMPKIN = 86;
|
||||
const NETHERRACK = 87;
|
||||
const SOUL_SAND = 88;
|
||||
const GLOWSTONE = 89; const GLOWSTONE_BLOCK = 89;
|
||||
const PORTAL_BLOCK = 90; const PORTAL = 90;
|
||||
const JACK_O_LANTERN = 91; const LIT_PUMPKIN = 91;
|
||||
const GLOWSTONE = 89, GLOWSTONE_BLOCK = 89;
|
||||
const PORTAL_BLOCK = 90, PORTAL = 90;
|
||||
const JACK_O_LANTERN = 91, LIT_PUMPKIN = 91;
|
||||
const CAKE_BLOCK = 92;
|
||||
const REPEATER_BLOCK = 93; const UNPOWERED_REPEATER_BLOCK = 93;
|
||||
const REPEATER_BLOCK = 93, UNPOWERED_REPEATER_BLOCK = 93;
|
||||
const POWERED_REPEATER_BLOCK = 94;
|
||||
const INVISIBLE_BEDROCK = 95;
|
||||
const TRAPDOOR = 96; const WOODEN_TRAPDOOR = 96;
|
||||
const TRAPDOOR = 96, WOODEN_TRAPDOOR = 96;
|
||||
const MONSTER_EGG_BLOCK = 97;
|
||||
const STONE_BRICKS = 98; const STONE_BRICK = 98;
|
||||
const STONE_BRICKS = 98, STONE_BRICK = 98;
|
||||
const BROWN_MUSHROOM_BLOCK = 99;
|
||||
const RED_MUSHROOM_BLOCK = 100;
|
||||
const IRON_BARS = 101; const IRON_BAR = 101;
|
||||
const GLASS_PANE = 102; const GLASS_PANEL = 102;
|
||||
const IRON_BARS = 101, IRON_BAR = 101;
|
||||
const GLASS_PANE = 102, GLASS_PANEL = 102;
|
||||
const MELON_BLOCK = 103;
|
||||
const PUMPKIN_STEM = 104;
|
||||
const MELON_STEM = 105;
|
||||
const VINES = 106; const VINE = 106;
|
||||
const FENCE_GATE = 107; const OAK_FENCE_GATE = 107;
|
||||
const VINES = 106, VINE = 106;
|
||||
const FENCE_GATE = 107, OAK_FENCE_GATE = 107;
|
||||
const BRICK_STAIRS = 108;
|
||||
const STONE_BRICK_STAIRS = 109;
|
||||
const MYCELIUM = 110;
|
||||
const LILY_PAD = 111; const WATER_LILY = 111;
|
||||
const NETHER_BRICKS = 112; const NETHER_BRICK_BLOCK = 112;
|
||||
const LILY_PAD = 111, WATER_LILY = 111;
|
||||
const NETHER_BRICKS = 112, NETHER_BRICK_BLOCK = 112;
|
||||
const NETHER_BRICK_FENCE = 113;
|
||||
const NETHER_BRICK_STAIRS = 114; const NETHER_BRICKS_STAIRS = 114;
|
||||
const NETHER_BRICK_STAIRS = 114, NETHER_BRICKS_STAIRS = 114;
|
||||
const NETHER_WART_BLOCK = 115;
|
||||
const ENCHANTING_TABLE = 116; const ENCHANT_TABLE = 116; const ENCHANTMENT_TABLE = 116;
|
||||
const ENCHANTING_TABLE = 116, ENCHANT_TABLE = 116, ENCHANTMENT_TABLE = 116;
|
||||
const BREWING_STAND_BLOCK = 117;
|
||||
const CAULDRON_BLOCK = 118;
|
||||
|
||||
const END_PORTAL_FRAME = 120; const END_PORTAL = 120;
|
||||
const END_PORTAL_FRAME = 120, END_PORTAL = 120;
|
||||
const END_STONE = 121;
|
||||
|
||||
const REDSTONE_LAMP = 123; const INACTIVE_REDSTONE_LAMP = 123;
|
||||
const LIT_REDSTONE_LAMP = 124; const ACTIVE_REDSTONE_LAMP = 124;
|
||||
const REDSTONE_LAMP = 123, INACTIVE_REDSTONE_LAMP = 123;
|
||||
const LIT_REDSTONE_LAMP = 124, ACTIVE_REDSTONE_LAMP = 124;
|
||||
const DROPPER = 125;
|
||||
const ACTIVATOR_RAIL = 126;
|
||||
const COCOA_BLOCK = 127; const COCOA_PODS = 127;
|
||||
const COCOA_BLOCK = 127, COCOA_PODS = 127;
|
||||
const SANDSTONE_STAIRS = 128;
|
||||
const EMERALD_ORE = 129;
|
||||
|
||||
const TRIPWIRE_HOOK = 131;
|
||||
const TRIPWIRE = 132;
|
||||
const EMERALD_BLOCK = 133;
|
||||
const SPRUCE_WOOD_STAIRS = 134; const SPRUCE_WOODEN_STAIRS = 134;
|
||||
const BIRCH_WOOD_STAIRS = 135; const BIRCH_WOODEN_STAIRS = 135;
|
||||
const JUNGLE_WOOD_STAIRS = 136; const JUNGLE_WOODEN_STAIRS = 136;
|
||||
const SPRUCE_WOOD_STAIRS = 134, SPRUCE_WOODEN_STAIRS = 134;
|
||||
const BIRCH_WOOD_STAIRS = 135, BIRCH_WOODEN_STAIRS = 135;
|
||||
const JUNGLE_WOOD_STAIRS = 136, JUNGLE_WOODEN_STAIRS = 136;
|
||||
|
||||
const COBBLESTONE_WALL = 139; const COBBLE_WALL = 139; const STONE_WALL = 139;
|
||||
const COBBLESTONE_WALL = 139, COBBLE_WALL = 139, STONE_WALL = 139;
|
||||
const FLOWER_POT_BLOCK = 140;
|
||||
const CARROT_BLOCK = 141;
|
||||
const POTATO_BLOCK = 142;
|
||||
const WOODEN_BUTTON = 143;
|
||||
const MOB_HEAD_BLOCK = 144; const SKULL_BLOCK = 144;
|
||||
const MOB_HEAD_BLOCK = 144, SKULL_BLOCK = 144;
|
||||
const ANVIL = 145;
|
||||
const TRAPPED_CHEST = 146;
|
||||
const WEIGHTED_PRESSURE_PLATE_LIGHT = 147; const LIGHT_WEIGHTED_PRESSURE_PLATE = 147; const GOLD_PRESSURE_PLATE = 147;
|
||||
const WEIGHTED_PRESSURE_PLATE_HEAVY = 148; const HEAVY_WEIGHTED_PRESSURE_PLATE = 148; const IRON_PRESSURE_PLATE = 148;
|
||||
const COMPARATOR_BLOCK = 149; const UNPOWERED_COMPARATOR_BLOCK = 149;
|
||||
const WEIGHTED_PRESSURE_PLATE_LIGHT = 147, LIGHT_WEIGHTED_PRESSURE_PLATE = 147, GOLD_PRESSURE_PLATE = 147;
|
||||
const WEIGHTED_PRESSURE_PLATE_HEAVY = 148, HEAVY_WEIGHTED_PRESSURE_PLATE = 148, IRON_PRESSURE_PLATE = 148;
|
||||
const COMPARATOR_BLOCK = 149, UNPOWERED_COMPARATOR_BLOCK = 149;
|
||||
const POWERED_COMPARATOR_BLOCK = 150;
|
||||
const DAYLIGHT_SENSOR = 151;
|
||||
const REDSTONE_BLOCK = 152;
|
||||
@ -179,14 +179,14 @@ interface BlockIds{
|
||||
const HOPPER_BLOCK = 154;
|
||||
const QUARTZ_BLOCK = 155;
|
||||
const QUARTZ_STAIRS = 156;
|
||||
const DOUBLE_WOOD_SLAB = 157; const DOUBLE_WOODEN_SLAB = 157; const DOUBLE_WOOD_SLABS = 157; const DOUBLE_WOODEN_SLABS = 157;
|
||||
const WOOD_SLAB = 158; const WOODEN_SLAB = 158; const WOOD_SLABS = 158; const WOODEN_SLABS = 158;
|
||||
const STAINED_CLAY = 159; const STAINED_HARDENED_CLAY = 159;
|
||||
const DOUBLE_WOOD_SLAB = 157, DOUBLE_WOODEN_SLAB = 157, DOUBLE_WOOD_SLABS = 157, DOUBLE_WOODEN_SLABS = 157;
|
||||
const WOOD_SLAB = 158, WOODEN_SLAB = 158, WOOD_SLABS = 158, WOODEN_SLABS = 158;
|
||||
const STAINED_CLAY = 159, STAINED_HARDENED_CLAY = 159;
|
||||
|
||||
const LEAVES2 = 161;
|
||||
const WOOD2 = 162; const TRUNK2 = 162; const LOG2 = 162;
|
||||
const ACACIA_WOOD_STAIRS = 163; const ACACIA_WOODEN_STAIRS = 163;
|
||||
const DARK_OAK_WOOD_STAIRS = 164; const DARK_OAK_WOODEN_STAIRS = 164;
|
||||
const WOOD2 = 162, TRUNK2 = 162, LOG2 = 162;
|
||||
const ACACIA_WOOD_STAIRS = 163, ACACIA_WOODEN_STAIRS = 163;
|
||||
const DARK_OAK_WOOD_STAIRS = 164, DARK_OAK_WOODEN_STAIRS = 164;
|
||||
const SLIME_BLOCK = 165;
|
||||
|
||||
const IRON_TRAPDOOR = 167;
|
||||
@ -198,16 +198,16 @@ interface BlockIds{
|
||||
const PACKED_ICE = 174;
|
||||
const DOUBLE_PLANT = 175;
|
||||
|
||||
const INVERTED_DAYLIGHT_SENSOR = 178; const DAYLIGHT_SENSOR_INVERTED = 178;
|
||||
const INVERTED_DAYLIGHT_SENSOR = 178, DAYLIGHT_SENSOR_INVERTED = 178;
|
||||
const RED_SANDSTONE = 179;
|
||||
const RED_SANDSTONE_STAIRS = 180;
|
||||
const DOUBLE_RED_SANDSTONE_SLAB = 181;
|
||||
const RED_SANDSTONE_SLAB = 182;
|
||||
const SPRUCE_FENCE_GATE = 183; const FENCE_GATE_SPRUCE = 183;
|
||||
const BIRCH_FENCE_GATE = 184; const FENCE_GATE_BIRCH = 184;
|
||||
const JUNGLE_FENCE_GATE = 185; const FENCE_GATE_JUNGLE = 185;
|
||||
const DARK_OAK_FENCE_GATE = 186; const FENCE_GATE_DARK_OAK = 186;
|
||||
const ACACIA_FENCE_GATE = 187; const FENCE_GATE_ACACIA = 187;
|
||||
const SPRUCE_FENCE_GATE = 183, FENCE_GATE_SPRUCE = 183;
|
||||
const BIRCH_FENCE_GATE = 184, FENCE_GATE_BIRCH = 184;
|
||||
const JUNGLE_FENCE_GATE = 185, FENCE_GATE_JUNGLE = 185;
|
||||
const DARK_OAK_FENCE_GATE = 186, FENCE_GATE_DARK_OAK = 186;
|
||||
const ACACIA_FENCE_GATE = 187, FENCE_GATE_ACACIA = 187;
|
||||
|
||||
const SPRUCE_DOOR_BLOCK = 193;
|
||||
const BIRCH_DOOR_BLOCK = 194;
|
||||
@ -227,4 +227,4 @@ interface BlockIds{
|
||||
const BLOCK_MOVED_BY_PISTON = 250;
|
||||
const OBSERVER = 251;
|
||||
const INFO_RESERVED6 = 255;
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
class CocoaBlock extends Solid {
|
||||
class CocoaBlock extends Solid{
|
||||
|
||||
protected $id = self::COCOA_BLOCK;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
class DaylightSensor extends Solid {
|
||||
class DaylightSensor extends Solid{
|
||||
|
||||
protected $id = self::DAYLIGHT_SENSOR;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
class DetectorRail extends Solid {
|
||||
class DetectorRail extends Solid{
|
||||
|
||||
protected $id = self::DETECTOR_RAIL;
|
||||
|
||||
|
@ -26,7 +26,7 @@ use pocketmine\math\AxisAlignedBB;
|
||||
use pocketmine\math\Vector3;
|
||||
|
||||
class Fence extends Transparent{
|
||||
const FENCE_OAK = 0;
|
||||
const FENCE_OAK = 0;
|
||||
const FENCE_SPRUCE = 1;
|
||||
const FENCE_BIRCH = 2;
|
||||
const FENCE_JUNGLE = 3;
|
||||
|
@ -54,12 +54,12 @@ class FlowerPot extends Flowable{
|
||||
|
||||
public function getBoundingBox(){
|
||||
return new AxisAlignedBB(
|
||||
$this->x + (5/16),
|
||||
$this->x + (5 / 16),
|
||||
$this->y,
|
||||
$this->z + (5/16),
|
||||
$this->x + (11/16),
|
||||
$this->y + (6/16),
|
||||
$this->z + (11/16)
|
||||
$this->z + (5 / 16),
|
||||
$this->x + (11 / 16),
|
||||
$this->y + (6 / 16),
|
||||
$this->z + (11 / 16)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
class Lever extends Solid {
|
||||
class Lever extends Solid{
|
||||
|
||||
protected $id = self::LEVER;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
class LitRedstoneLamp extends Solid {
|
||||
class LitRedstoneLamp extends Solid{
|
||||
|
||||
protected $id = self::LIT_REDSTONE_LAMP;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
class LitRedstoneTorch extends Solid {
|
||||
class LitRedstoneTorch extends Solid{
|
||||
|
||||
protected $id = self::REDSTONE_TORCH;
|
||||
|
||||
|
@ -61,7 +61,7 @@ class MobHead extends Solid{
|
||||
$nbt = new CompoundTag("", [
|
||||
new StringTag("id", Tile::SKULL),
|
||||
new ByteTag("SkullType", $item->getDamage()),
|
||||
new ByteTag("Rot", $rot),
|
||||
new ByteTag("Rot", $rot),
|
||||
new IntTag("x", (int) $this->x),
|
||||
new IntTag("y", (int) $this->y),
|
||||
new IntTag("z", (int) $this->z)
|
||||
|
@ -23,7 +23,7 @@ namespace pocketmine\block;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\item\Tool;
|
||||
|
||||
class NetherBrickFence extends Transparent {
|
||||
class NetherBrickFence extends Transparent{
|
||||
|
||||
protected $id = self::NETHER_BRICK_FENCE;
|
||||
|
||||
@ -32,11 +32,10 @@ class NetherBrickFence extends Transparent {
|
||||
}
|
||||
|
||||
public function getBreakTime(Item $item){
|
||||
if ($item instanceof Air){
|
||||
if($item instanceof Air){
|
||||
//Breaking by hand
|
||||
return 10;
|
||||
}
|
||||
else{
|
||||
}else{
|
||||
// Other breaktimes are equal to woodfences.
|
||||
return parent::getBreakTime($item);
|
||||
}
|
||||
@ -67,5 +66,5 @@ class NetherBrickFence extends Transparent {
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
class NoteBlock extends Solid {
|
||||
class NoteBlock extends Solid{
|
||||
|
||||
protected $id = self::NOTE_BLOCK;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
class PoweredRail extends Solid {
|
||||
class PoweredRail extends Solid{
|
||||
protected $id = self::POWERED_RAIL;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
class Rail extends Solid {
|
||||
class Rail extends Solid{
|
||||
|
||||
protected $id = self::RAIL;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
class RedstoneLamp extends Solid {
|
||||
class RedstoneLamp extends Solid{
|
||||
|
||||
protected $id = self::REDSTONE_LAMP;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
class RedstoneTorch extends Solid {
|
||||
class RedstoneTorch extends Solid{
|
||||
|
||||
protected $id = self::REDSTONE_TORCH;
|
||||
|
||||
|
@ -143,7 +143,6 @@ class Slab extends Transparent{
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getToolType(){
|
||||
return Tool::TYPE_PICKAXE;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
class StoneButton extends Solid {
|
||||
class StoneButton extends Solid{
|
||||
|
||||
protected $id = self::STONE_BUTTON;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
class StonePressurePlate extends Solid {
|
||||
class StonePressurePlate extends Solid{
|
||||
|
||||
protected $id = self::STONE_PRESSURE_PLATE;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
class Tripwire extends Solid {
|
||||
class Tripwire extends Solid{
|
||||
|
||||
protected $id = self::TRIPWIRE;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
class TripwireHook extends Solid {
|
||||
class TripwireHook extends Solid{
|
||||
|
||||
protected $id = self::TRIPWIRE_HOOK;
|
||||
|
||||
|
@ -39,8 +39,8 @@ class WallSign extends SignPost{
|
||||
5 => 4,
|
||||
];
|
||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||
if(isset($faces[$this->meta])) {
|
||||
if ($this->getSide($faces[$this->meta])->getId() === self::AIR) {
|
||||
if(isset($faces[$this->meta])){
|
||||
if($this->getSide($faces[$this->meta])->getId() === self::AIR){
|
||||
$this->getLevel()->useBreakOn($this);
|
||||
}
|
||||
return Level::BLOCK_UPDATE_NORMAL;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
class WeightedPressurePlateHeavy extends Solid {
|
||||
class WeightedPressurePlateHeavy extends Solid{
|
||||
|
||||
protected $id = self::WEIGHTED_PRESSURE_PLATE_HEAVY;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
class WeightedPressurePlateLight extends Solid {
|
||||
class WeightedPressurePlateLight extends Solid{
|
||||
|
||||
protected $id = self::WEIGHTED_PRESSURE_PLATE_LIGHT;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
class WoodenButton extends Solid {
|
||||
class WoodenButton extends Solid{
|
||||
|
||||
protected $id = self::WOODEN_BUTTON;
|
||||
|
||||
|
@ -25,7 +25,7 @@ class WoodenPressurePlate extends Solid{
|
||||
|
||||
protected $id = self::WOODEN_PRESSURE_PLATE;
|
||||
|
||||
public function __construct($meta = 0) {
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
|
||||
|
@ -289,7 +289,7 @@ abstract class Command{
|
||||
public static function broadcastCommandMessage(CommandSender $source, $message, $sendToSource = true){
|
||||
if($message instanceof TextContainer){
|
||||
$m = clone $message;
|
||||
$result = "[".$source->getName().": ".($source->getServer()->getLanguage()->get($m->getText()) !== $m->getText() ? "%" : "") . $m->getText() ."]";
|
||||
$result = "[" . $source->getName() . ": " . ($source->getServer()->getLanguage()->get($m->getText()) !== $m->getText() ? "%" : "") . $m->getText() . "]";
|
||||
|
||||
$users = $source->getServer()->getPluginManager()->getPermissionSubscriptions(Server::BROADCAST_CHANNEL_ADMINISTRATIVE);
|
||||
$colored = TextFormat::GRAY . TextFormat::ITALIC . $result;
|
||||
|
@ -64,7 +64,7 @@ class GarbageCollectorCommand extends VanillaCommand{
|
||||
$sender->sendMessage(TextFormat::GOLD . "Tiles: " . TextFormat::RED . number_format($tilesCollected));
|
||||
|
||||
$sender->sendMessage(TextFormat::GOLD . "Cycles: " . TextFormat::RED . number_format($cyclesCollected));
|
||||
$sender->sendMessage(TextFormat::GOLD . "Memory freed: " . TextFormat::RED . number_format(round((($memory - memory_get_usage()) / 1024) / 1024, 2))." MB");
|
||||
$sender->sendMessage(TextFormat::GOLD . "Memory freed: " . TextFormat::RED . number_format(round((($memory - memory_get_usage()) / 1024) / 1024, 2)) . " MB");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ class GiveCommand extends VanillaCommand{
|
||||
$data = implode(" ", array_slice($args, 3));
|
||||
try{
|
||||
$tags = NBT::parseJSON($data);
|
||||
}catch (\Throwable $ex){
|
||||
}catch(\Throwable $ex){
|
||||
$exception = $ex;
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ class StatusCommand extends VanillaCommand{
|
||||
$tpsColor = TextFormat::RED;
|
||||
}
|
||||
|
||||
$sender->sendMessage(TextFormat::GOLD . "Current TPS: " . $tpsColor . $server->getTicksPerSecond() . " (".$server->getTickUsage()."%)");
|
||||
$sender->sendMessage(TextFormat::GOLD . "Current TPS: {$tpsColor}{$server->getTicksPerSecond()} ({$server->getTickUsage()}%)");
|
||||
|
||||
$sender->sendMessage(TextFormat::GOLD . "Network upload: " . TextFormat::RED . round($server->getNetwork()->getUpload() / 1024, 2) . " kB/s");
|
||||
$sender->sendMessage(TextFormat::GOLD . "Network download: " . TextFormat::RED . round($server->getNetwork()->getDownload() / 1024, 2) . " kB/s");
|
||||
@ -99,11 +99,14 @@ class StatusCommand extends VanillaCommand{
|
||||
}
|
||||
|
||||
foreach($server->getLevels() as $level){
|
||||
$sender->sendMessage(TextFormat::GOLD . "World \"".$level->getFolderName()."\"".($level->getFolderName() !== $level->getName() ? " (".$level->getName().")" : "").": " .
|
||||
TextFormat::RED . number_format(count($level->getChunks())) . TextFormat::GREEN . " chunks, " .
|
||||
TextFormat::RED . number_format(count($level->getEntities())) . TextFormat::GREEN . " entities, " .
|
||||
TextFormat::RED . number_format(count($level->getTiles())) . TextFormat::GREEN . " tiles. ".
|
||||
"Time " . (($level->getTickRate() > 1 or $level->getTickRateTime() > 40) ? TextFormat::RED : TextFormat::YELLOW) . round($level->getTickRateTime(), 2)."ms" . ($level->getTickRate() > 1 ? " (tick rate ". $level->getTickRate() .")" : "")
|
||||
$levelName = $level->getFolderName() !== $level->getName() ? " (" . $level->getName() . ")" : "";
|
||||
$timeColor = ($level->getTickRate() > 1 or $level->getTickRateTime() > 40) ? TextFormat::RED : TextFormat::YELLOW;
|
||||
$tickRate = $level->getTickRate() > 1 ? " (tick rate " . $level->getTickRate() . ")" : "";
|
||||
$sender->sendMessage(TextFormat::GOLD . "World \"{$level->getFolderName()}\"$levelName: " .
|
||||
TextFormat::RED . number_format(count($level->getChunks())) . TextFormat::GREEN . " chunks, " .
|
||||
TextFormat::RED . number_format(count($level->getEntities())) . TextFormat::GREEN . " entities, " .
|
||||
TextFormat::RED . number_format(count($level->getTiles())) . TextFormat::GREEN . " tiles. " .
|
||||
"Time $timeColor" . round($level->getTickRateTime(), 2) . "ms" . $tickRate
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -59,8 +59,9 @@ class TellCommand extends VanillaCommand{
|
||||
}
|
||||
|
||||
if($player instanceof Player){
|
||||
$sender->sendMessage("[".$sender->getName()." -> " . $player->getDisplayName() . "] " . implode(" ", $args));
|
||||
$player->sendMessage("[" . ($sender instanceof Player ? $sender->getDisplayName() : $sender->getName()) . " -> ".$player->getName()."] " . implode(" ", $args));
|
||||
$sender->sendMessage("[{$sender->getName()} -> {$player->getDisplayName()}] " . implode(" ", $args));
|
||||
$name = $sender instanceof Player ? $sender->getDisplayName() : $sender->getName();
|
||||
$player->sendMessage("[$name -> {$player->getName()}] " . implode(" ", $args));
|
||||
}else{
|
||||
$sender->sendMessage(new TranslationContainer("commands.generic.player.notFound"));
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class AttributeMap implements \ArrayAccess{
|
||||
* @return Attribute[]
|
||||
*/
|
||||
public function needSend() : array{
|
||||
return array_filter($this->attributes, function (Attribute $attribute){
|
||||
return array_filter($this->attributes, function(Attribute $attribute){
|
||||
return $attribute->isSyncable() and $attribute->isDesynchronized();
|
||||
});
|
||||
}
|
||||
|
@ -1533,7 +1533,7 @@ abstract class Entity extends Location implements Metadatable{
|
||||
public function setDataProperty($id, $type, $value, $send = true){
|
||||
if($this->getDataProperty($id) !== $value){
|
||||
$this->dataProperties[$id] = [$type, $value];
|
||||
if($send === true) {
|
||||
if($send === true){
|
||||
$this->sendData($this->hasSpawned, [$id => $this->dataProperties[$id]]);
|
||||
}
|
||||
|
||||
|
@ -61,12 +61,14 @@ class EntityDamageByEntityEvent extends EntityDamageEvent{
|
||||
public function getDamager(){
|
||||
return $this->damager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getKnockBack(){
|
||||
return $this->knockBack;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $knockBack
|
||||
*/
|
||||
|
@ -40,8 +40,8 @@ class CraftItemEvent extends Event implements Cancellable{
|
||||
|
||||
/**
|
||||
* @param \pocketmine\Player $player
|
||||
* @param Item[] $input
|
||||
* @param Recipe $recipe
|
||||
* @param Item[] $input
|
||||
* @param Recipe $recipe
|
||||
*/
|
||||
public function __construct(Player $player, array $input, Recipe $recipe){
|
||||
$this->player = $player;
|
||||
|
@ -47,8 +47,8 @@ class PlayerCreationEvent extends Event{
|
||||
|
||||
/**
|
||||
* @param SourceInterface $interface
|
||||
* @param Player::class $baseClass
|
||||
* @param Player::class $playerClass
|
||||
* @param Player::class $baseClass
|
||||
* @param Player::class $playerClass
|
||||
* @param mixed $clientId
|
||||
* @param string $address
|
||||
* @param int $port
|
||||
|
@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
namespace pocketmine\event\server;
|
||||
|
||||
use pocketmine\utils\Utils;
|
||||
|
||||
|
||||
|
@ -124,7 +124,7 @@ abstract class BaseInventory implements Inventory{
|
||||
$this->clear($i);
|
||||
}
|
||||
}else{
|
||||
if (!$this->setItem($i, $items[$i])){
|
||||
if(!$this->setItem($i, $items[$i])){
|
||||
$this->clear($i);
|
||||
}
|
||||
}
|
||||
@ -248,7 +248,7 @@ abstract class BaseInventory implements Inventory{
|
||||
$itemSlots = [];
|
||||
foreach($slots as $slot){
|
||||
if(!($slot instanceof Item)){
|
||||
throw new \InvalidArgumentException("Expected Item[], got ".gettype($slot));
|
||||
throw new \InvalidArgumentException("Expected Item[], got " . gettype($slot));
|
||||
}
|
||||
if($slot->getId() !== 0 and $slot->getCount() > 0){
|
||||
$itemSlots[] = clone $slot;
|
||||
@ -308,7 +308,7 @@ abstract class BaseInventory implements Inventory{
|
||||
$itemSlots = [];
|
||||
foreach($slots as $slot){
|
||||
if(!($slot instanceof Item)){
|
||||
throw new \InvalidArgumentException("Expected Item[], got ".gettype($slot));
|
||||
throw new \InvalidArgumentException("Expected Item[], got " . gettype($slot));
|
||||
}
|
||||
if($slot->getId() !== 0 and $slot->getCount() > 0){
|
||||
$itemSlots[] = clone $slot;
|
||||
|
@ -47,45 +47,45 @@ class CraftingManager{
|
||||
MainLogger::getLogger()->info("Loading recipes...");
|
||||
foreach($recipes->getAll() as $recipe){
|
||||
switch($recipe["Type"]){
|
||||
case 0:
|
||||
// TODO: handle multiple result items
|
||||
if(count($recipe["Result"]) == 1){
|
||||
$first = $recipe["Result"][0];
|
||||
$result = new ShapelessRecipe(Item::get($first["ID"], $first["Damage"], $first["Count"]));
|
||||
case 0:
|
||||
// TODO: handle multiple result items
|
||||
if(count($recipe["Result"]) == 1){
|
||||
$first = $recipe["Result"][0];
|
||||
$result = new ShapelessRecipe(Item::get($first["ID"], $first["Damage"], $first["Count"]));
|
||||
|
||||
foreach($recipe["Ingredients"] as $ingredient){
|
||||
$result->addIngredient(Item::get($ingredient["ID"], $ingredient["Damage"], $ingredient["Count"]));
|
||||
}
|
||||
$this->registerRecipe($result);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
// TODO: handle multiple result items
|
||||
if(count($recipe["Result"]) == 1){
|
||||
$first = $recipe["Result"][0];
|
||||
$result = new ShapedRecipe(Item::get($first["ID"], $first["Damage"], $first["Count"]), $recipe["Height"], $recipe["Width"]);
|
||||
|
||||
$shape = array_chunk($recipe["Ingredients"], $recipe["Width"]);
|
||||
foreach($shape as $y => $row){
|
||||
foreach($row as $x => $ingredient){
|
||||
$result->addIngredient($x, $y, Item::get($ingredient["ID"], ($ingredient["Damage"] < 0 ? null : $ingredient["Damage"]), $ingredient["Count"]));
|
||||
foreach($recipe["Ingredients"] as $ingredient){
|
||||
$result->addIngredient(Item::get($ingredient["ID"], $ingredient["Damage"], $ingredient["Count"]));
|
||||
}
|
||||
$this->registerRecipe($result);
|
||||
}
|
||||
$this->registerRecipe($result);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
$result = $recipe["Result"];
|
||||
$resultItem = Item::get($result["ID"], $result["Damage"], $result["Count"]);
|
||||
$this->registerRecipe(new FurnaceRecipe($resultItem, Item::get($recipe["Ingredients"], 0, 1)));
|
||||
break;
|
||||
case 3:
|
||||
$result = $recipe["Result"];
|
||||
$resultItem = Item::get($result["ID"], $result["Damage"], $result["Count"]);
|
||||
$this->registerRecipe(new FurnaceRecipe($resultItem, Item::get($recipe["Ingredients"]["ID"], $recipe["Ingredients"]["Damage"], 1)));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
case 1:
|
||||
// TODO: handle multiple result items
|
||||
if(count($recipe["Result"]) == 1){
|
||||
$first = $recipe["Result"][0];
|
||||
$result = new ShapedRecipe(Item::get($first["ID"], $first["Damage"], $first["Count"]), $recipe["Height"], $recipe["Width"]);
|
||||
|
||||
$shape = array_chunk($recipe["Ingredients"], $recipe["Width"]);
|
||||
foreach($shape as $y => $row){
|
||||
foreach($row as $x => $ingredient){
|
||||
$result->addIngredient($x, $y, Item::get($ingredient["ID"], ($ingredient["Damage"] < 0 ? null : $ingredient["Damage"]), $ingredient["Count"]));
|
||||
}
|
||||
}
|
||||
$this->registerRecipe($result);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
$result = $recipe["Result"];
|
||||
$resultItem = Item::get($result["ID"], $result["Damage"], $result["Count"]);
|
||||
$this->registerRecipe(new FurnaceRecipe($resultItem, Item::get($recipe["Ingredients"], 0, 1)));
|
||||
break;
|
||||
case 3:
|
||||
$result = $recipe["Result"];
|
||||
$resultItem = Item::get($result["ID"], $result["Damage"], $result["Count"]);
|
||||
$this->registerRecipe(new FurnaceRecipe($resultItem, Item::get($recipe["Ingredients"]["ID"], $recipe["Ingredients"]["Damage"], 1)));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ class DoubleChestInventory extends ChestInventory implements InventoryHolder{
|
||||
|
||||
for($i = 0; $i < $this->size; ++$i){
|
||||
if(!isset($items[$i])){
|
||||
if ($i < $this->left->size){
|
||||
if($i < $this->left->size){
|
||||
if(isset($this->left->slots[$i])){
|
||||
$this->clear($i);
|
||||
}
|
||||
|
@ -55,8 +55,8 @@ interface Inventory{
|
||||
* If a plugin refuses the update or $index is invalid, it'll return false
|
||||
* If a source Player is specified, it won't send a Inventory update to it
|
||||
*
|
||||
* @param int $index
|
||||
* @param Item $item
|
||||
* @param int $index
|
||||
* @param Item $item
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
@ -161,7 +161,7 @@ interface Inventory{
|
||||
/**
|
||||
* Will clear a specific slot
|
||||
*
|
||||
* @param int $index
|
||||
* @param int $index
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
@ -212,8 +212,8 @@ interface Inventory{
|
||||
public function onClose(Player $who);
|
||||
|
||||
/**
|
||||
* @param int $index
|
||||
* @param Item $before
|
||||
* @param int $index
|
||||
* @param Item $before
|
||||
*/
|
||||
public function onSlotChange($index, $before);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ interface ItemIds extends BlockIds{
|
||||
const IRON_SHOVEL = 256;
|
||||
const IRON_PICKAXE = 257;
|
||||
const IRON_AXE = 258;
|
||||
const FLINT_AND_STEEL = 259; const FLINT_STEEL = 259;
|
||||
const FLINT_AND_STEEL = 259, FLINT_STEEL = 259;
|
||||
const APPLE = 260;
|
||||
const BOW = 261;
|
||||
const ARROW = 262;
|
||||
@ -50,13 +50,13 @@ interface ItemIds extends BlockIds{
|
||||
const DIAMOND_SHOVEL = 277;
|
||||
const DIAMOND_PICKAXE = 278;
|
||||
const DIAMOND_AXE = 279;
|
||||
const STICK = 280; const STICKS = 280;
|
||||
const STICK = 280, STICKS = 280;
|
||||
const BOWL = 281;
|
||||
const MUSHROOM_STEW = 282;
|
||||
const GOLD_SWORD = 283; const GOLDEN_SWORD = 283;
|
||||
const GOLD_SHOVEL = 284; const GOLDEN_SHOVEL = 284;
|
||||
const GOLD_PICKAXE = 285; const GOLDEN_PICKAXE = 285;
|
||||
const GOLD_AXE = 286; const GOLDEN_AXE = 286;
|
||||
const GOLD_SWORD = 283, GOLDEN_SWORD = 283;
|
||||
const GOLD_SHOVEL = 284, GOLDEN_SHOVEL = 284;
|
||||
const GOLD_PICKAXE = 285, GOLDEN_PICKAXE = 285;
|
||||
const GOLD_AXE = 286, GOLDEN_AXE = 286;
|
||||
const STRING = 287;
|
||||
const FEATHER = 288;
|
||||
const GUNPOWDER = 289;
|
||||
@ -64,8 +64,8 @@ interface ItemIds extends BlockIds{
|
||||
const STONE_HOE = 291;
|
||||
const IRON_HOE = 292;
|
||||
const DIAMOND_HOE = 293;
|
||||
const GOLD_HOE = 294; const GOLDEN_HOE = 294;
|
||||
const SEEDS = 295; const WHEAT_SEEDS = 295;
|
||||
const GOLD_HOE = 294, GOLDEN_HOE = 294;
|
||||
const SEEDS = 295, WHEAT_SEEDS = 295;
|
||||
const WHEAT = 296;
|
||||
const BREAD = 297;
|
||||
const LEATHER_CAP = 298;
|
||||
@ -94,21 +94,20 @@ interface ItemIds extends BlockIds{
|
||||
const PAINTING = 321;
|
||||
const GOLDEN_APPLE = 322;
|
||||
const SIGN = 323;
|
||||
const WOODEN_DOOR = 324; const OAK_DOOR = 324;
|
||||
const WOODEN_DOOR = 324, OAK_DOOR = 324;
|
||||
const BUCKET = 325;
|
||||
|
||||
const MINECART = 328;
|
||||
const SADDLE = 329;
|
||||
const IRON_DOOR = 330;
|
||||
const REDSTONE = 331;
|
||||
const REDSTONE_DUST = 331;
|
||||
const REDSTONE = 331, REDSTONE_DUST = 331;
|
||||
const SNOWBALL = 332;
|
||||
const BOAT = 333;
|
||||
const LEATHER = 334;
|
||||
|
||||
const BRICK = 336;
|
||||
const CLAY = 337;
|
||||
const SUGARCANE = 338; const SUGAR_CANE = 338; const SUGAR_CANES = 338;
|
||||
const SUGARCANE = 338, SUGAR_CANE = 338, SUGAR_CANES = 338;
|
||||
const PAPER = 339;
|
||||
const BOOK = 340;
|
||||
const SLIMEBALL = 341;
|
||||
@ -130,18 +129,18 @@ interface ItemIds extends BlockIds{
|
||||
const COOKIE = 357;
|
||||
const FILLED_MAP = 358;
|
||||
const SHEARS = 359;
|
||||
const MELON = 360; const MELON_SLICE = 360;
|
||||
const MELON = 360, MELON_SLICE = 360;
|
||||
const PUMPKIN_SEEDS = 361;
|
||||
const MELON_SEEDS = 362;
|
||||
const RAW_BEEF = 363;
|
||||
const STEAK = 364; const COOKED_BEEF = 364;
|
||||
const STEAK = 364, COOKED_BEEF = 364;
|
||||
const RAW_CHICKEN = 365;
|
||||
const COOKED_CHICKEN = 366;
|
||||
const ROTTEN_FLESH = 367;
|
||||
|
||||
const BLAZE_ROD = 369;
|
||||
const GHAST_TEAR = 370;
|
||||
const GOLD_NUGGET = 371; const GOLDEN_NUGGET = 371;
|
||||
const GOLD_NUGGET = 371, GOLDEN_NUGGET = 371;
|
||||
const NETHER_WART = 372;
|
||||
const POTION = 373;
|
||||
const GLASS_BOTTLE = 374;
|
||||
@ -154,19 +153,19 @@ interface ItemIds extends BlockIds{
|
||||
|
||||
const GLISTERING_MELON = 382;
|
||||
const SPAWN_EGG = 383;
|
||||
const BOTTLE_O_ENCHANTING = 384; const ENCHANTING_BOTTLE = 384;
|
||||
const BOTTLE_O_ENCHANTING = 384, ENCHANTING_BOTTLE = 384;
|
||||
const FIRE_CHARGE = 385;
|
||||
|
||||
const EMERALD = 388;
|
||||
const ITEM_FRAME = 389;
|
||||
const FLOWER_POT = 390;
|
||||
const CARROT = 391; const CARROTS = 391;
|
||||
const POTATO = 392; const POTATOES = 392;
|
||||
const BAKED_POTATO = 393; const BAKED_POTATOES = 393;
|
||||
const CARROT = 391, CARROTS = 391;
|
||||
const POTATO = 392, POTATOES = 392;
|
||||
const BAKED_POTATO = 393, BAKED_POTATOES = 393;
|
||||
const POISONOUS_POTATO = 394;
|
||||
const MAP = 395; const EMPTY_MAP = 395;
|
||||
const MAP = 395, EMPTY_MAP = 395;
|
||||
const GOLDEN_CARROT = 396;
|
||||
const MOB_HEAD = 397; const SKULL = 397;
|
||||
const MOB_HEAD = 397, SKULL = 397;
|
||||
const CARROT_ON_A_STICK = 398;
|
||||
|
||||
const PUMPKIN_PIE = 400;
|
||||
@ -177,9 +176,7 @@ interface ItemIds extends BlockIds{
|
||||
const QUARTZ = 406;
|
||||
const NETHER_QUARTZ = 406;
|
||||
const MINECART_WITH_TNT = 407;
|
||||
const MINECART_WITH_HOPPER = 408;
|
||||
|
||||
const HOPPER = 410;
|
||||
const MINECART_WITH_HOPPER = 408, HOPPER = 410;
|
||||
const RAW_RABBIT = 411;
|
||||
const COOKED_RABBIT = 412;
|
||||
const RABBIT_STEW = 413;
|
||||
@ -189,7 +186,7 @@ interface ItemIds extends BlockIds{
|
||||
const IRON_HORSE_ARMOR = 417;
|
||||
const GOLD_HORSE_ARMOR = 418;
|
||||
const DIAMOND_HORSE_ARMOR = 419;
|
||||
const LEAD = 420; const LEASH = 420;
|
||||
const LEAD = 420, LEASH = 420;
|
||||
const NAMETAG = 421;
|
||||
|
||||
const RAW_MUTTON = 423;
|
||||
@ -204,7 +201,7 @@ interface ItemIds extends BlockIds{
|
||||
const SPLASH_POTION = 438;
|
||||
|
||||
const BEETROOT = 457;
|
||||
const BEETROOT_SEEDS = 458; const BEETROOT_SEED = 458;
|
||||
const BEETROOT_SEEDS = 458, BEETROOT_SEED = 458;
|
||||
const BEETROOT_SOUP = 459;
|
||||
const RAW_SALMON = 460;
|
||||
const CLOWN_FISH = 461;
|
||||
@ -214,4 +211,4 @@ interface ItemIds extends BlockIds{
|
||||
const ENCHANTED_GOLDEN_APPLE = 466;
|
||||
|
||||
const CAMERA = 498; #blamemojang
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ class BaseLang{
|
||||
*/
|
||||
public function translateString($str, array $params = [], $onlyPrefix = null){
|
||||
$baseText = $this->get($str);
|
||||
$baseText = $this->parseTranslation( ($baseText !== null and ($onlyPrefix === null or strpos($str, $onlyPrefix) === 0)) ? $baseText : $str, $onlyPrefix);
|
||||
$baseText = $this->parseTranslation(($baseText !== null and ($onlyPrefix === null or strpos($str, $onlyPrefix) === 0)) ? $baseText : $str, $onlyPrefix);
|
||||
|
||||
foreach($params as $i => $p){
|
||||
$baseText = str_replace("{%$i}", $this->parseTranslation((string) $p), $baseText, $onlyPrefix);
|
||||
@ -98,7 +98,7 @@ class BaseLang{
|
||||
public function translate(TextContainer $c){
|
||||
if($c instanceof TranslationContainer){
|
||||
$baseText = $this->internalGet($c->getText());
|
||||
$baseText = $this->parseTranslation( $baseText !== null ? $baseText : $c->getText());
|
||||
$baseText = $this->parseTranslation($baseText !== null ? $baseText : $c->getText());
|
||||
|
||||
foreach($c->getParameters() as $i => $p){
|
||||
$baseText = str_replace("{%$i}", $this->parseTranslation($p), $baseText);
|
||||
|
@ -19,7 +19,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace pocketmine\level;
|
||||
|
||||
@ -77,8 +77,8 @@ interface ChunkManager{
|
||||
public function getChunk(int $chunkX, int $chunkZ);
|
||||
|
||||
/**
|
||||
* @param int $chunkX
|
||||
* @param int $chunkZ
|
||||
* @param int $chunkX
|
||||
* @param int $chunkZ
|
||||
* @param FullChunk $chunk
|
||||
*/
|
||||
public function setChunk(int $chunkX, int $chunkZ, FullChunk $chunk = null);
|
||||
|
@ -19,7 +19,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
declare(strict_types = 1);
|
||||
|
||||
/**
|
||||
* All Level related classes are here, like Generators, Populators, Noise, ...
|
||||
@ -267,7 +267,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
|
||||
public static function blockHash(int $x, int $y, int $z){
|
||||
return PHP_INT_SIZE === 8 ? (($x & 0xFFFFFFF) << 35) | (($y & 0x7f) << 28) | ($z & 0xFFFFFFF) : $x . ":" . $y .":". $z;
|
||||
return PHP_INT_SIZE === 8 ? (($x & 0xFFFFFFF) << 35) | (($y & 0x7f) << 28) | ($z & 0xFFFFFFF) : $x . ":" . $y . ":" . $z;
|
||||
}
|
||||
|
||||
public static function chunkBlockHash(int $x, int $y, int $z) : int{
|
||||
@ -378,14 +378,14 @@ class Level implements ChunkManager, Metadatable{
|
||||
public function registerGenerator(){
|
||||
$size = $this->server->getScheduler()->getAsyncTaskPoolSize();
|
||||
for($i = 0; $i < $size; ++$i){
|
||||
$this->server->getScheduler()->scheduleAsyncTaskToWorker(new GeneratorRegisterTask($this, $this->generatorInstance), $i);
|
||||
$this->server->getScheduler()->scheduleAsyncTaskToWorker(new GeneratorRegisterTask($this, $this->generatorInstance), $i);
|
||||
}
|
||||
}
|
||||
|
||||
public function unregisterGenerator(){
|
||||
$size = $this->server->getScheduler()->getAsyncTaskPoolSize();
|
||||
for($i = 0; $i < $size; ++$i){
|
||||
$this->server->getScheduler()->scheduleAsyncTaskToWorker(new GeneratorUnregisterTask($this, $this->generatorInstance), $i);
|
||||
$this->server->getScheduler()->scheduleAsyncTaskToWorker(new GeneratorUnregisterTask($this, $this->generatorInstance), $i);
|
||||
}
|
||||
}
|
||||
|
||||
@ -447,7 +447,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
}else{
|
||||
$this->server->batchPackets($players, $pk, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -707,7 +707,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
|
||||
foreach($this->moveToSend as $index => $entry){
|
||||
Level::getXZ($index, $chunkX, $chunkZ);
|
||||
foreach($entry as $e) {
|
||||
foreach($entry as $e){
|
||||
$pk = new MoveEntityPacket();
|
||||
$pk->eid = $e[0];
|
||||
$pk->x = $e[1];
|
||||
@ -901,7 +901,6 @@ class Level implements ChunkManager, Metadatable{
|
||||
Level::getXZ($index, $chunkX, $chunkZ);
|
||||
|
||||
|
||||
|
||||
if(!isset($this->chunks[$index]) or ($chunk = $this->getChunk($chunkX, $chunkZ, false)) === null){
|
||||
unset($this->chunkTickList[$index]);
|
||||
continue;
|
||||
|
@ -19,7 +19,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace pocketmine\level;
|
||||
|
||||
@ -107,8 +107,8 @@ class SimpleChunkManager implements ChunkManager{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $chunkX
|
||||
* @param int $chunkZ
|
||||
* @param int $chunkX
|
||||
* @param int $chunkZ
|
||||
* @param FullChunk $chunk
|
||||
*/
|
||||
public function setChunk(int $chunkX, int $chunkZ, FullChunk $chunk = null){
|
||||
@ -128,7 +128,7 @@ class SimpleChunkManager implements ChunkManager{
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getSeed() {
|
||||
public function getSeed(){
|
||||
return $this->seed;
|
||||
}
|
||||
}
|
@ -173,9 +173,9 @@ interface FullChunk{
|
||||
public function getHeightMap($x, $z);
|
||||
|
||||
/**
|
||||
* @param int $x 0-15
|
||||
* @param int $z 0-15
|
||||
* @param $value 0-255
|
||||
* @param int $x 0-15
|
||||
* @param int $z 0-15
|
||||
* @param $value 0-255
|
||||
*/
|
||||
public function setHeightMap($x, $z, $value);
|
||||
|
||||
|
@ -40,8 +40,8 @@ abstract class BaseChunk extends BaseFullChunk implements Chunk{
|
||||
* @param ChunkSection[] $sections
|
||||
* @param int[] $biomeColors
|
||||
* @param int[] $heightMap
|
||||
* @param CompoundTag[] $entities
|
||||
* @param CompoundTag[] $tiles
|
||||
* @param CompoundTag[] $entities
|
||||
* @param CompoundTag[] $tiles
|
||||
*
|
||||
* @throws ChunkException
|
||||
*/
|
||||
|
@ -82,8 +82,8 @@ abstract class BaseFullChunk implements FullChunk{
|
||||
* @param string $blockLight
|
||||
* @param int[] $biomeColors
|
||||
* @param int[] $heightMap
|
||||
* @param CompoundTag[] $entities
|
||||
* @param CompoundTag[] $tiles
|
||||
* @param CompoundTag[] $entities
|
||||
* @param CompoundTag[] $tiles
|
||||
*/
|
||||
protected function __construct($provider, $x, $z, $blocks, $data, $skyLight, $blockLight, array $biomeColors = [], array $heightMap = [], array $entities = [], array $tiles = [], array $extraData = []){
|
||||
$this->provider = $provider;
|
||||
|
@ -131,7 +131,7 @@ class RegionLoader{
|
||||
protected function saveChunk($x, $z, $chunkData){
|
||||
$length = strlen($chunkData) + 1;
|
||||
if($length + 4 > self::MAX_SECTOR_LENGTH){
|
||||
throw new ChunkException("Chunk is too big! ".($length + 4)." > ".self::MAX_SECTOR_LENGTH);
|
||||
throw new ChunkException("Chunk is too big! " . ($length + 4) . " > " . self::MAX_SECTOR_LENGTH);
|
||||
}
|
||||
$sectors = (int) ceil(($length + 4) / 4096);
|
||||
$index = self::getChunkOffset($x, $z);
|
||||
|
@ -159,7 +159,7 @@ class Flat extends Generator{
|
||||
}
|
||||
|
||||
public function generateChunk($chunkX, $chunkZ){
|
||||
if($this->chunk === null) {
|
||||
if($this->chunk === null){
|
||||
if(isset($this->options["preset"]) and $this->options["preset"] != ""){
|
||||
$this->parsePreset($this->options["preset"], $chunkX, $chunkZ);
|
||||
}else{
|
||||
|
@ -88,7 +88,7 @@ abstract class Generator{
|
||||
if($samplingRate === 0){
|
||||
throw new \InvalidArgumentException("samplingRate cannot be 0");
|
||||
}
|
||||
if ($xSize % $samplingRate !== 0) {
|
||||
if($xSize % $samplingRate !== 0){
|
||||
throw new \InvalidArgumentCountException("xSize % samplingRate must return 0");
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ abstract class Noise{
|
||||
);
|
||||
}
|
||||
|
||||
public static function trilinearLerp($x, $y, $z, $q000, $q001, $q010, $q011, $q100, $q101, $q110, $q111, $x1, $x2, $y1, $y2, $z1, $z2) {
|
||||
public static function trilinearLerp($x, $y, $z, $q000, $q001, $q010, $q011, $q100, $q101, $q110, $q111, $x1, $x2, $y1, $y2, $z1, $z2){
|
||||
$dx1 = (($x2 - $x) / ($x2 - $x1));
|
||||
$dx2 = (($x - $x1) / ($x2 - $x1));
|
||||
$dy1 = (($y2 - $y) / ($y2 - $y1));
|
||||
|
@ -101,10 +101,10 @@ class Normal extends Generator{
|
||||
$hash *= $hash + 223;
|
||||
$xNoise = $hash >> 20 & 3;
|
||||
$zNoise = $hash >> 22 & 3;
|
||||
if ($xNoise == 3) {
|
||||
if($xNoise == 3){
|
||||
$xNoise = 1;
|
||||
}
|
||||
if($zNoise == 3) {
|
||||
if($zNoise == 3){
|
||||
$zNoise = 1;
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
namespace pocketmine\level\generator\normal\biome;
|
||||
|
||||
|
||||
|
||||
class DesertBiome extends SandyBiome{
|
||||
|
||||
public function __construct(){
|
||||
|
@ -37,8 +37,8 @@ class FloatingTextParticle extends Particle{
|
||||
|
||||
/**
|
||||
* @param Vector3 $pos
|
||||
* @param int $text
|
||||
* @param string $title
|
||||
* @param int $text
|
||||
* @param string $title
|
||||
*/
|
||||
public function __construct(Vector3 $pos, $text, $title = ""){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z);
|
||||
|
@ -27,7 +27,7 @@ abstract class NamedTag extends Tag{
|
||||
protected $__name;
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $name
|
||||
* @param bool|float|double|int|ByteTag|ShortTag|array|CompoundTag|ListTag|string $value
|
||||
*/
|
||||
public function __construct($name = "", $value = null){
|
||||
|
@ -138,7 +138,7 @@ class Network{
|
||||
|
||||
public function processInterfaces(){
|
||||
foreach($this->interfaces as $interface){
|
||||
try {
|
||||
try{
|
||||
$interface->process();
|
||||
}catch(\Throwable $e){
|
||||
$logger = $this->server->getLogger();
|
||||
|
@ -169,10 +169,10 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
|
||||
$info = $this->server->getQueryInformation();
|
||||
|
||||
$this->interface->sendOption("name",
|
||||
"MCPE;".addcslashes($name, ";") .";".
|
||||
Info::CURRENT_PROTOCOL.";".
|
||||
\pocketmine\MINECRAFT_VERSION_NETWORK.";".
|
||||
$info->getPlayerCount().";".
|
||||
"MCPE;" . addcslashes($name, ";") . ";" .
|
||||
Info::CURRENT_PROTOCOL . ";" .
|
||||
\pocketmine\MINECRAFT_VERSION_NETWORK . ";" .
|
||||
$info->getPlayerCount() . ";" .
|
||||
$info->getMaxPlayerCount()
|
||||
);
|
||||
}
|
||||
|
@ -59,8 +59,8 @@ class AddEntityPacket extends DataPacket{
|
||||
$this->putFloat($this->speedX);
|
||||
$this->putFloat($this->speedY);
|
||||
$this->putFloat($this->speedZ);
|
||||
$this->putFloat($this->yaw * (256/360));
|
||||
$this->putFloat($this->pitch * (256/360));
|
||||
$this->putFloat($this->yaw * (256 / 360));
|
||||
$this->putFloat($this->pitch * (256 / 360));
|
||||
$this->putInt($this->modifiers);
|
||||
$meta = Binary::writeMetadata($this->metadata);
|
||||
$this->put($meta);
|
||||
|
@ -49,7 +49,7 @@ class LoginPacket extends DataPacket{
|
||||
$this->setBuffer($str, 0);
|
||||
|
||||
$chainData = json_decode($this->get($this->getLInt()));
|
||||
foreach ($chainData->{"chain"} as $chain){
|
||||
foreach($chainData->{"chain"} as $chain){
|
||||
$webtoken = $this->decodeToken($chain);
|
||||
if(isset($webtoken["extraData"])){
|
||||
if(isset($webtoken["extraData"]["displayName"])){
|
||||
|
@ -40,9 +40,9 @@ class MoveEntityPacket extends DataPacket{
|
||||
$this->x = $this->getFloat();
|
||||
$this->y = $this->getFloat();
|
||||
$this->z = $this->getFloat();
|
||||
$this->pitch = $this->getByte()*(360.0/256);
|
||||
$this->yaw = $this->getByte()*(360.0/256);
|
||||
$this->headYaw = $this->getByte()*(360.0/256);
|
||||
$this->pitch = $this->getByte() * (360.0 / 256);
|
||||
$this->yaw = $this->getByte() * (360.0 / 256);
|
||||
$this->headYaw = $this->getByte() * (360.0 / 256);
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
@ -51,9 +51,9 @@ class MoveEntityPacket extends DataPacket{
|
||||
$this->putFloat($this->x);
|
||||
$this->putFloat($this->y);
|
||||
$this->putFloat($this->z);
|
||||
$this->putByte($this->pitch/(360.0/256));
|
||||
$this->putByte($this->yaw/(360.0/256));
|
||||
$this->putByte($this->headYaw/(360.0/256));
|
||||
$this->putByte($this->pitch / (360.0 / 256));
|
||||
$this->putByte($this->yaw / (360.0 / 256));
|
||||
$this->putByte($this->headYaw / (360.0 / 256));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ class RCON{
|
||||
}elseif($this->workers[$n]->isWaiting()){
|
||||
if($this->workers[$n]->response !== ""){
|
||||
$this->server->getLogger()->info($this->workers[$n]->response);
|
||||
$this->workers[$n]->synchronized(function (RCONInstance $thread){
|
||||
$this->workers[$n]->synchronized(function(RCONInstance $thread){
|
||||
$thread->notify();
|
||||
}, $this->workers[$n]);
|
||||
}else{
|
||||
@ -98,7 +98,7 @@ class RCON{
|
||||
}
|
||||
|
||||
$this->workers[$n]->response = TextFormat::clean($response->getMessage());
|
||||
$this->workers[$n]->synchronized(function (RCONInstance $thread){
|
||||
$this->workers[$n]->synchronized(function(RCONInstance $thread){
|
||||
$thread->notify();
|
||||
}, $this->workers[$n]);
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ class RCONInstance extends Thread{
|
||||
if($payload === $this->password){
|
||||
socket_getpeername($client, $addr, $port);
|
||||
$this->response = "[INFO] Successful Rcon connection from: /$addr:$port";
|
||||
$this->synchronized(function (){
|
||||
$this->synchronized(function(){
|
||||
$this->waiting = true;
|
||||
$this->wait();
|
||||
});
|
||||
@ -162,7 +162,7 @@ class RCONInstance extends Thread{
|
||||
}
|
||||
if(strlen($payload) > 0){
|
||||
$this->cmd = ltrim($payload);
|
||||
$this->synchronized(function (){
|
||||
$this->synchronized(function(){
|
||||
$this->waiting = true;
|
||||
$this->wait();
|
||||
});
|
||||
|
@ -36,7 +36,7 @@ class FileWriteTask extends AsyncTask{
|
||||
public function onRun(){
|
||||
try{
|
||||
file_put_contents($this->path, $this->contents, (int) $this->flags);
|
||||
}catch (\Throwable $e){
|
||||
}catch(\Throwable $e){
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ class SendUsageTask extends AsyncTask{
|
||||
try{
|
||||
Utils::postURL($this->endpoint, $this->data, 5, [
|
||||
"Content-Type: application/json",
|
||||
"Content-Length: ". strlen($this->data)
|
||||
"Content-Length: " . strlen($this->data)
|
||||
]);
|
||||
}catch(\Throwable $e){
|
||||
|
||||
|
@ -47,10 +47,10 @@ class EnchantTable extends Spawnable implements Nameable{
|
||||
|
||||
public function getSpawnCompound(){
|
||||
$c = new CompoundTag("", [
|
||||
new StringTag("id", Tile::ENCHANT_TABLE),
|
||||
new IntTag("x", (int) $this->x),
|
||||
new IntTag("y", (int) $this->y),
|
||||
new IntTag("z", (int) $this->z)
|
||||
new StringTag("id", Tile::ENCHANT_TABLE),
|
||||
new IntTag("x", (int) $this->x),
|
||||
new IntTag("y", (int) $this->y),
|
||||
new IntTag("z", (int) $this->z)
|
||||
]);
|
||||
|
||||
if($this->hasName()){
|
||||
|
@ -67,10 +67,10 @@ abstract class Tile extends Position{
|
||||
public $tickTimer;
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
* @param FullChunk $chunk
|
||||
* @param CompoundTag $nbt
|
||||
* @param $args
|
||||
* @param string $type
|
||||
* @param FullChunk $chunk
|
||||
* @param CompoundTag $nbt
|
||||
* @param $args
|
||||
*
|
||||
* @return Tile
|
||||
*/
|
||||
|
@ -23,6 +23,7 @@
|
||||
* Various Utilities used around the code
|
||||
*/
|
||||
namespace pocketmine\utils;
|
||||
|
||||
use pocketmine\entity\Entity;
|
||||
|
||||
class Binary{
|
||||
|
@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
namespace pocketmine\utils;
|
||||
|
||||
use pocketmine\scheduler\FileWriteTask;
|
||||
use pocketmine\Server;
|
||||
|
||||
|
@ -189,7 +189,7 @@ class MainLogger extends \AttachableThreadedLogger{
|
||||
$threadName = (new \ReflectionClass($thread))->getShortName() . " thread";
|
||||
}
|
||||
|
||||
$message = TextFormat::toANSI(TextFormat::AQUA . "[" . date("H:i:s", $now) . "] ". TextFormat::RESET . $color ."[" . $threadName . "/" . $prefix . "]:" . " " . $message . TextFormat::RESET);
|
||||
$message = TextFormat::toANSI(TextFormat::AQUA . "[" . date("H:i:s", $now) . "] " . TextFormat::RESET . $color . "[" . $threadName . "/" . $prefix . "]:" . " " . $message . TextFormat::RESET);
|
||||
$cleanMessage = TextFormat::clean($message);
|
||||
|
||||
if(!Terminal::hasFormattingCodes()){
|
||||
|
@ -71,7 +71,7 @@ class Random{
|
||||
$this->seed = $seed;
|
||||
$this->x = self::X ^ $seed;
|
||||
$this->y = self::Y ^ ($seed << 17) | (($seed >> 15) & 0x7fffffff) & 0xffffffff;
|
||||
$this->z = self::Z ^ ($seed << 31) | (($seed >> 1) & 0x7fffffff) & 0xffffffff;
|
||||
$this->z = self::Z ^ ($seed << 31) | (($seed >> 1) & 0x7fffffff) & 0xffffffff;
|
||||
$this->w = self::W ^ ($seed << 18) | (($seed >> 14) & 0x7fffffff) & 0xffffffff;
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ class Random{
|
||||
$this->y = $this->z;
|
||||
$this->z = $this->w;
|
||||
$this->w = ($this->w ^ (($this->w >> 19) & 0x7fffffff)
|
||||
^ ($t ^ (($t >> 8) & 0x7fffffff))) & 0xffffffff;
|
||||
^ ($t ^ (($t >> 8) & 0x7fffffff))) & 0xffffffff;
|
||||
|
||||
return $this->w;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ abstract class TextFormat{
|
||||
* @return array
|
||||
*/
|
||||
public static function tokenize($string){
|
||||
return preg_split("/(". TextFormat::ESCAPE ."[0123456789abcdefklmnor])/", $string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
|
||||
return preg_split("/(" . TextFormat::ESCAPE . "[0123456789abcdefklmnor])/", $string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -72,7 +72,7 @@ abstract class TextFormat{
|
||||
*/
|
||||
public static function clean($string, $removeFormat = true){
|
||||
if($removeFormat){
|
||||
return str_replace(TextFormat::ESCAPE, "", preg_replace(["/". TextFormat::ESCAPE ."[0123456789abcdefklmnor]/", "/\x1b[\\(\\][[0-9;\\[\\(]+[Bm]/"], "", $string));
|
||||
return str_replace(TextFormat::ESCAPE, "", preg_replace(["/" . TextFormat::ESCAPE . "[0123456789abcdefklmnor]/", "/\x1b[\\(\\][[0-9;\\[\\(]+[Bm]/"], "", $string));
|
||||
}
|
||||
return str_replace("\x1b", "", preg_replace("/\x1b[\\(\\][[0-9;\\[\\(]+[Bm]/", "", $string));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user