This commit is contained in:
SOF3 2016-10-03 23:29:39 +08:00
commit 4b869c8615
77 changed files with 266 additions and 264 deletions

View File

@ -127,8 +127,8 @@ class MemoryManager{
} }
public function trigger($memory, $limit, $global = false, $triggerCount = 0){ 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){ if($this->cacheTrigger){
foreach($this->server->getLevels() as $level){ foreach($this->server->getLevels() as $level){
$level->clearCache(true); $level->clearCache(true);
@ -149,7 +149,7 @@ class MemoryManager{
$cycles = $this->triggerGarbageCollector(); $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(){ public function check(){
@ -323,7 +323,7 @@ class MemoryManager{
$this->continueDump($value, $data[$key], $objects, $refCounts, $recursion + 1, $maxNesting, $maxStringSize); $this->continueDump($value, $data[$key], $objects, $refCounts, $recursion + 1, $maxNesting, $maxStringSize);
} }
}elseif(is_string($from)){ }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)){ }elseif(is_resource($from)){
$data = "(resource) " . print_r($from, true); $data = "(resource) " . print_r($from, true);
}else{ }else{

View File

@ -2264,14 +2264,14 @@ class Server{
if($r > $this->baseTickRate){ if($r > $this->baseTickRate){
$level->tickRateCounter = $level->getTickRate(); $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){ }elseif($tickMs >= 50){
if($level->getTickRate() === $this->baseTickRate){ if($level->getTickRate() === $this->baseTickRate){
$level->setTickRate(max($this->baseTickRate + 1, min($this->autoTickRateLimit, floor($tickMs / 50)))); $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){ }elseif(($tickMs / $level->getTickRate()) >= 50 and $level->getTickRate() < $this->autoTickRateLimit){
$level->setTickRate($level->getTickRate() + 1); $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(); $level->tickRateCounter = $level->getTickRate();
} }
@ -2343,7 +2343,7 @@ class Server{
$d = Utils::getRealMemoryUsage(); $d = Utils::getRealMemoryUsage();
$u = Utils::getMemoryUsage(true); $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() . " " . echo "\x1b]0;" . $this->getName() . " " .
$this->getPocketMineVersion() . $this->getPocketMineVersion() .

View File

@ -27,9 +27,9 @@ interface BlockIds{
const STONE = 1; const STONE = 1;
const GRASS = 2; const GRASS = 2;
const DIRT = 3; const DIRT = 3;
const COBBLESTONE = 4; const COBBLE = 4; const COBBLESTONE = 4, COBBLE = 4;
const PLANK = 5; const PLANKS = 5; const WOODEN_PLANK = 5; const WOODEN_PLANKS = 5; const PLANK = 5, PLANKS = 5, WOODEN_PLANK = 5, WOODEN_PLANKS = 5;
const SAPLING = 6; const SAPLINGS = 6; const SAPLING = 6, SAPLINGS = 6;
const BEDROCK = 7; const BEDROCK = 7;
const WATER = 8; const WATER = 8;
const STILL_WATER = 9; const STILL_WATER = 9;
@ -40,7 +40,7 @@ interface BlockIds{
const GOLD_ORE = 14; const GOLD_ORE = 14;
const IRON_ORE = 15; const IRON_ORE = 15;
const COAL_ORE = 16; const COAL_ORE = 16;
const LOG = 17; const WOOD = 17; const TRUNK = 17; const LOG = 17, WOOD = 17, TRUNK = 17;
const LEAVES = 18; const LEAVES = 18;
const SPONGE = 19; const SPONGE = 19;
const GLASS = 20; const GLASS = 20;
@ -48,130 +48,130 @@ interface BlockIds{
const LAPIS_BLOCK = 22; const LAPIS_BLOCK = 22;
const DISPENSER = 23; const DISPENSER = 23;
const SANDSTONE = 24; const SANDSTONE = 24;
const NOTE_BLOCK = 25; const NOTEBLOCK = 25; const NOTE_BLOCK = 25, NOTEBLOCK = 25;
const BED_BLOCK = 26; const BED_BLOCK = 26;
const POWERED_RAIL = 27; const POWERED_RAIL = 27;
const DETECTOR_RAIL = 28; const DETECTOR_RAIL = 28;
const STICKY_PISTON = 29; const STICKY_PISTON = 29;
const COBWEB = 30; const COBWEB = 30;
const TALL_GRASS = 31; const TALL_GRASS = 31;
const BUSH = 32; const DEAD_BUSH = 32; const BUSH = 32, DEAD_BUSH = 32;
const PISTON = 33; const PISTON = 33;
const PISTON_HEAD = 34; const PISTON_HEAD = 34;
const WOOL = 35; const WOOL = 35;
const DANDELION = 37; 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 BROWN_MUSHROOM = 39;
const RED_MUSHROOM = 40; const RED_MUSHROOM = 40;
const GOLD_BLOCK = 41; const GOLD_BLOCK = 41;
const IRON_BLOCK = 42; const IRON_BLOCK = 42;
const DOUBLE_SLAB = 43; const DOUBLE_SLABS = 43; const DOUBLE_SLAB = 43, DOUBLE_SLABS = 43;
const SLAB = 44; const SLABS = 44; const STONE_SLAB = 44; const SLAB = 44, SLABS = 44, STONE_SLAB = 44;
const BRICKS = 45; const BRICKS_BLOCK = 45; const BRICKS = 45, BRICKS_BLOCK = 45;
const TNT = 46; const TNT = 46;
const BOOKSHELF = 47; const BOOKSHELF = 47;
const MOSS_STONE = 48; const MOSSY_STONE = 48; const MOSS_STONE = 48, MOSSY_STONE = 48;
const OBSIDIAN = 49; const OBSIDIAN = 49;
const TORCH = 50; const TORCH = 50;
const FIRE = 51; const FIRE = 51;
const MONSTER_SPAWNER = 52; 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 CHEST = 54;
const REDSTONE_WIRE = 55; const REDSTONE_WIRE = 55;
const DIAMOND_ORE = 56; const DIAMOND_ORE = 56;
const DIAMOND_BLOCK = 57; const DIAMOND_BLOCK = 57;
const CRAFTING_TABLE = 58; const WORKBENCH = 58; const CRAFTING_TABLE = 58, WORKBENCH = 58;
const WHEAT_BLOCK = 59; const WHEAT_BLOCK = 59;
const FARMLAND = 60; const FARMLAND = 60;
const FURNACE = 61; const FURNACE = 61;
const BURNING_FURNACE = 62; const LIT_FURNACE = 62; const BURNING_FURNACE = 62, LIT_FURNACE = 62;
const SIGN_POST = 63; 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 LADDER = 65;
const RAIL = 66; const RAIL = 66;
const COBBLESTONE_STAIRS = 67; const COBBLE_STAIRS = 67; const COBBLESTONE_STAIRS = 67, COBBLE_STAIRS = 67;
const WALL_SIGN = 68; const WALL_SIGN = 68;
const LEVER = 69; const LEVER = 69;
const STONE_PRESSURE_PLATE = 70; const STONE_PRESSURE_PLATE = 70;
const IRON_DOOR_BLOCK = 71; const IRON_DOOR_BLOCK = 71;
const WOODEN_PRESSURE_PLATE = 72; const WOODEN_PRESSURE_PLATE = 72;
const REDSTONE_ORE = 73; 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 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 STONE_BUTTON = 77;
const SNOW = 78; const SNOW_LAYER = 78; const SNOW = 78, SNOW_LAYER = 78;
const ICE = 79; const ICE = 79;
const SNOW_BLOCK = 80; const SNOW_BLOCK = 80;
const CACTUS = 81; const CACTUS = 81;
const CLAY_BLOCK = 82; const CLAY_BLOCK = 82;
const REEDS = 83; const SUGARCANE_BLOCK = 83; const REEDS = 83, SUGARCANE_BLOCK = 83;
const FENCE = 85; const FENCE = 85;
const PUMPKIN = 86; const PUMPKIN = 86;
const NETHERRACK = 87; const NETHERRACK = 87;
const SOUL_SAND = 88; const SOUL_SAND = 88;
const GLOWSTONE = 89; const GLOWSTONE_BLOCK = 89; const GLOWSTONE = 89, GLOWSTONE_BLOCK = 89;
const PORTAL_BLOCK = 90; const PORTAL = 90; const PORTAL_BLOCK = 90, PORTAL = 90;
const JACK_O_LANTERN = 91; const LIT_PUMPKIN = 91; const JACK_O_LANTERN = 91, LIT_PUMPKIN = 91;
const CAKE_BLOCK = 92; 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 POWERED_REPEATER_BLOCK = 94;
const INVISIBLE_BEDROCK = 95; const INVISIBLE_BEDROCK = 95;
const TRAPDOOR = 96; const WOODEN_TRAPDOOR = 96; const TRAPDOOR = 96, WOODEN_TRAPDOOR = 96;
const MONSTER_EGG_BLOCK = 97; 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 BROWN_MUSHROOM_BLOCK = 99;
const RED_MUSHROOM_BLOCK = 100; const RED_MUSHROOM_BLOCK = 100;
const IRON_BARS = 101; const IRON_BAR = 101; const IRON_BARS = 101, IRON_BAR = 101;
const GLASS_PANE = 102; const GLASS_PANEL = 102; const GLASS_PANE = 102, GLASS_PANEL = 102;
const MELON_BLOCK = 103; const MELON_BLOCK = 103;
const PUMPKIN_STEM = 104; const PUMPKIN_STEM = 104;
const MELON_STEM = 105; const MELON_STEM = 105;
const VINES = 106; const VINE = 106; const VINES = 106, VINE = 106;
const FENCE_GATE = 107; const OAK_FENCE_GATE = 107; const FENCE_GATE = 107, OAK_FENCE_GATE = 107;
const BRICK_STAIRS = 108; const BRICK_STAIRS = 108;
const STONE_BRICK_STAIRS = 109; const STONE_BRICK_STAIRS = 109;
const MYCELIUM = 110; const MYCELIUM = 110;
const LILY_PAD = 111; const WATER_LILY = 111; const LILY_PAD = 111, WATER_LILY = 111;
const NETHER_BRICKS = 112; const NETHER_BRICK_BLOCK = 112; const NETHER_BRICKS = 112, NETHER_BRICK_BLOCK = 112;
const NETHER_BRICK_FENCE = 113; 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 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 BREWING_STAND_BLOCK = 117;
const CAULDRON_BLOCK = 118; 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 END_STONE = 121;
const REDSTONE_LAMP = 123; const INACTIVE_REDSTONE_LAMP = 123; const REDSTONE_LAMP = 123, INACTIVE_REDSTONE_LAMP = 123;
const LIT_REDSTONE_LAMP = 124; const ACTIVE_REDSTONE_LAMP = 124; const LIT_REDSTONE_LAMP = 124, ACTIVE_REDSTONE_LAMP = 124;
const DROPPER = 125; const DROPPER = 125;
const ACTIVATOR_RAIL = 126; const ACTIVATOR_RAIL = 126;
const COCOA_BLOCK = 127; const COCOA_PODS = 127; const COCOA_BLOCK = 127, COCOA_PODS = 127;
const SANDSTONE_STAIRS = 128; const SANDSTONE_STAIRS = 128;
const EMERALD_ORE = 129; const EMERALD_ORE = 129;
const TRIPWIRE_HOOK = 131; const TRIPWIRE_HOOK = 131;
const TRIPWIRE = 132; const TRIPWIRE = 132;
const EMERALD_BLOCK = 133; const EMERALD_BLOCK = 133;
const SPRUCE_WOOD_STAIRS = 134; const SPRUCE_WOODEN_STAIRS = 134; const SPRUCE_WOOD_STAIRS = 134, SPRUCE_WOODEN_STAIRS = 134;
const BIRCH_WOOD_STAIRS = 135; const BIRCH_WOODEN_STAIRS = 135; const BIRCH_WOOD_STAIRS = 135, BIRCH_WOODEN_STAIRS = 135;
const JUNGLE_WOOD_STAIRS = 136; const JUNGLE_WOODEN_STAIRS = 136; 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 FLOWER_POT_BLOCK = 140;
const CARROT_BLOCK = 141; const CARROT_BLOCK = 141;
const POTATO_BLOCK = 142; const POTATO_BLOCK = 142;
const WOODEN_BUTTON = 143; 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 ANVIL = 145;
const TRAPPED_CHEST = 146; 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_LIGHT = 147, LIGHT_WEIGHTED_PRESSURE_PLATE = 147, GOLD_PRESSURE_PLATE = 147;
const WEIGHTED_PRESSURE_PLATE_HEAVY = 148; const HEAVY_WEIGHTED_PRESSURE_PLATE = 148; const IRON_PRESSURE_PLATE = 148; const WEIGHTED_PRESSURE_PLATE_HEAVY = 148, HEAVY_WEIGHTED_PRESSURE_PLATE = 148, IRON_PRESSURE_PLATE = 148;
const COMPARATOR_BLOCK = 149; const UNPOWERED_COMPARATOR_BLOCK = 149; const COMPARATOR_BLOCK = 149, UNPOWERED_COMPARATOR_BLOCK = 149;
const POWERED_COMPARATOR_BLOCK = 150; const POWERED_COMPARATOR_BLOCK = 150;
const DAYLIGHT_SENSOR = 151; const DAYLIGHT_SENSOR = 151;
const REDSTONE_BLOCK = 152; const REDSTONE_BLOCK = 152;
@ -179,14 +179,14 @@ interface BlockIds{
const HOPPER_BLOCK = 154; const HOPPER_BLOCK = 154;
const QUARTZ_BLOCK = 155; const QUARTZ_BLOCK = 155;
const QUARTZ_STAIRS = 156; 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 DOUBLE_WOOD_SLAB = 157, DOUBLE_WOODEN_SLAB = 157, DOUBLE_WOOD_SLABS = 157, DOUBLE_WOODEN_SLABS = 157;
const WOOD_SLAB = 158; const WOODEN_SLAB = 158; const WOOD_SLABS = 158; const WOODEN_SLABS = 158; const WOOD_SLAB = 158, WOODEN_SLAB = 158, WOOD_SLABS = 158, WOODEN_SLABS = 158;
const STAINED_CLAY = 159; const STAINED_HARDENED_CLAY = 159; const STAINED_CLAY = 159, STAINED_HARDENED_CLAY = 159;
const LEAVES2 = 161; const LEAVES2 = 161;
const WOOD2 = 162; const TRUNK2 = 162; const LOG2 = 162; const WOOD2 = 162, TRUNK2 = 162, LOG2 = 162;
const ACACIA_WOOD_STAIRS = 163; const ACACIA_WOODEN_STAIRS = 163; const ACACIA_WOOD_STAIRS = 163, ACACIA_WOODEN_STAIRS = 163;
const DARK_OAK_WOOD_STAIRS = 164; const DARK_OAK_WOODEN_STAIRS = 164; const DARK_OAK_WOOD_STAIRS = 164, DARK_OAK_WOODEN_STAIRS = 164;
const SLIME_BLOCK = 165; const SLIME_BLOCK = 165;
const IRON_TRAPDOOR = 167; const IRON_TRAPDOOR = 167;
@ -198,16 +198,16 @@ interface BlockIds{
const PACKED_ICE = 174; const PACKED_ICE = 174;
const DOUBLE_PLANT = 175; 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 = 179;
const RED_SANDSTONE_STAIRS = 180; const RED_SANDSTONE_STAIRS = 180;
const DOUBLE_RED_SANDSTONE_SLAB = 181; const DOUBLE_RED_SANDSTONE_SLAB = 181;
const RED_SANDSTONE_SLAB = 182; const RED_SANDSTONE_SLAB = 182;
const SPRUCE_FENCE_GATE = 183; const FENCE_GATE_SPRUCE = 183; const SPRUCE_FENCE_GATE = 183, FENCE_GATE_SPRUCE = 183;
const BIRCH_FENCE_GATE = 184; const FENCE_GATE_BIRCH = 184; const BIRCH_FENCE_GATE = 184, FENCE_GATE_BIRCH = 184;
const JUNGLE_FENCE_GATE = 185; const FENCE_GATE_JUNGLE = 185; const JUNGLE_FENCE_GATE = 185, FENCE_GATE_JUNGLE = 185;
const DARK_OAK_FENCE_GATE = 186; const FENCE_GATE_DARK_OAK = 186; const DARK_OAK_FENCE_GATE = 186, FENCE_GATE_DARK_OAK = 186;
const ACACIA_FENCE_GATE = 187; const FENCE_GATE_ACACIA = 187; const ACACIA_FENCE_GATE = 187, FENCE_GATE_ACACIA = 187;
const SPRUCE_DOOR_BLOCK = 193; const SPRUCE_DOOR_BLOCK = 193;
const BIRCH_DOOR_BLOCK = 194; const BIRCH_DOOR_BLOCK = 194;

View File

@ -35,8 +35,7 @@ class NetherBrickFence extends Transparent {
if($item instanceof Air){ if($item instanceof Air){
//Breaking by hand //Breaking by hand
return 10; return 10;
} }else{
else{
// Other breaktimes are equal to woodfences. // Other breaktimes are equal to woodfences.
return parent::getBreakTime($item); return parent::getBreakTime($item);
} }

View File

@ -143,7 +143,6 @@ class Slab extends Transparent{
} }
public function getToolType(){ public function getToolType(){
return Tool::TYPE_PICKAXE; return Tool::TYPE_PICKAXE;
} }

View File

@ -81,7 +81,7 @@ class StatusCommand extends VanillaCommand{
$tpsColor = TextFormat::RED; $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 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"); $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){ foreach($server->getLevels() as $level){
$sender->sendMessage(TextFormat::GOLD . "World \"".$level->getFolderName()."\"".($level->getFolderName() !== $level->getName() ? " (".$level->getName().")" : "").": " . $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->getChunks())) . TextFormat::GREEN . " chunks, " .
TextFormat::RED . number_format(count($level->getEntities())) . TextFormat::GREEN . " entities, " . TextFormat::RED . number_format(count($level->getEntities())) . TextFormat::GREEN . " entities, " .
TextFormat::RED . number_format(count($level->getTiles())) . TextFormat::GREEN . " tiles. " . 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() .")" : "") "Time $timeColor" . round($level->getTickRateTime(), 2) . "ms" . $tickRate
); );
} }

View File

@ -59,8 +59,9 @@ class TellCommand extends VanillaCommand{
} }
if($player instanceof Player){ if($player instanceof Player){
$sender->sendMessage("[".$sender->getName()." -> " . $player->getDisplayName() . "] " . implode(" ", $args)); $sender->sendMessage("[{$sender->getName()} -> {$player->getDisplayName()}] " . implode(" ", $args));
$player->sendMessage("[" . ($sender instanceof Player ? $sender->getDisplayName() : $sender->getName()) . " -> ".$player->getName()."] " . implode(" ", $args)); $name = $sender instanceof Player ? $sender->getDisplayName() : $sender->getName();
$player->sendMessage("[$name -> {$player->getName()}] " . implode(" ", $args));
}else{ }else{
$sender->sendMessage(new TranslationContainer("commands.generic.player.notFound")); $sender->sendMessage(new TranslationContainer("commands.generic.player.notFound"));
} }

View File

@ -61,12 +61,14 @@ class EntityDamageByEntityEvent extends EntityDamageEvent{
public function getDamager(){ public function getDamager(){
return $this->damager; return $this->damager;
} }
/** /**
* @return float * @return float
*/ */
public function getKnockBack(){ public function getKnockBack(){
return $this->knockBack; return $this->knockBack;
} }
/** /**
* @param float $knockBack * @param float $knockBack
*/ */

View File

@ -20,6 +20,7 @@
*/ */
namespace pocketmine\event\server; namespace pocketmine\event\server;
use pocketmine\utils\Utils; use pocketmine\utils\Utils;

View File

@ -29,7 +29,7 @@ interface ItemIds extends BlockIds{
const IRON_SHOVEL = 256; const IRON_SHOVEL = 256;
const IRON_PICKAXE = 257; const IRON_PICKAXE = 257;
const IRON_AXE = 258; 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 APPLE = 260;
const BOW = 261; const BOW = 261;
const ARROW = 262; const ARROW = 262;
@ -50,13 +50,13 @@ interface ItemIds extends BlockIds{
const DIAMOND_SHOVEL = 277; const DIAMOND_SHOVEL = 277;
const DIAMOND_PICKAXE = 278; const DIAMOND_PICKAXE = 278;
const DIAMOND_AXE = 279; const DIAMOND_AXE = 279;
const STICK = 280; const STICKS = 280; const STICK = 280, STICKS = 280;
const BOWL = 281; const BOWL = 281;
const MUSHROOM_STEW = 282; const MUSHROOM_STEW = 282;
const GOLD_SWORD = 283; const GOLDEN_SWORD = 283; const GOLD_SWORD = 283, GOLDEN_SWORD = 283;
const GOLD_SHOVEL = 284; const GOLDEN_SHOVEL = 284; const GOLD_SHOVEL = 284, GOLDEN_SHOVEL = 284;
const GOLD_PICKAXE = 285; const GOLDEN_PICKAXE = 285; const GOLD_PICKAXE = 285, GOLDEN_PICKAXE = 285;
const GOLD_AXE = 286; const GOLDEN_AXE = 286; const GOLD_AXE = 286, GOLDEN_AXE = 286;
const STRING = 287; const STRING = 287;
const FEATHER = 288; const FEATHER = 288;
const GUNPOWDER = 289; const GUNPOWDER = 289;
@ -64,8 +64,8 @@ interface ItemIds extends BlockIds{
const STONE_HOE = 291; const STONE_HOE = 291;
const IRON_HOE = 292; const IRON_HOE = 292;
const DIAMOND_HOE = 293; const DIAMOND_HOE = 293;
const GOLD_HOE = 294; const GOLDEN_HOE = 294; const GOLD_HOE = 294, GOLDEN_HOE = 294;
const SEEDS = 295; const WHEAT_SEEDS = 295; const SEEDS = 295, WHEAT_SEEDS = 295;
const WHEAT = 296; const WHEAT = 296;
const BREAD = 297; const BREAD = 297;
const LEATHER_CAP = 298; const LEATHER_CAP = 298;
@ -94,21 +94,20 @@ interface ItemIds extends BlockIds{
const PAINTING = 321; const PAINTING = 321;
const GOLDEN_APPLE = 322; const GOLDEN_APPLE = 322;
const SIGN = 323; const SIGN = 323;
const WOODEN_DOOR = 324; const OAK_DOOR = 324; const WOODEN_DOOR = 324, OAK_DOOR = 324;
const BUCKET = 325; const BUCKET = 325;
const MINECART = 328; const MINECART = 328;
const SADDLE = 329; const SADDLE = 329;
const IRON_DOOR = 330; const IRON_DOOR = 330;
const REDSTONE = 331; const REDSTONE = 331, REDSTONE_DUST = 331;
const REDSTONE_DUST = 331;
const SNOWBALL = 332; const SNOWBALL = 332;
const BOAT = 333; const BOAT = 333;
const LEATHER = 334; const LEATHER = 334;
const BRICK = 336; const BRICK = 336;
const CLAY = 337; 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 PAPER = 339;
const BOOK = 340; const BOOK = 340;
const SLIMEBALL = 341; const SLIMEBALL = 341;
@ -130,18 +129,18 @@ interface ItemIds extends BlockIds{
const COOKIE = 357; const COOKIE = 357;
const FILLED_MAP = 358; const FILLED_MAP = 358;
const SHEARS = 359; const SHEARS = 359;
const MELON = 360; const MELON_SLICE = 360; const MELON = 360, MELON_SLICE = 360;
const PUMPKIN_SEEDS = 361; const PUMPKIN_SEEDS = 361;
const MELON_SEEDS = 362; const MELON_SEEDS = 362;
const RAW_BEEF = 363; const RAW_BEEF = 363;
const STEAK = 364; const COOKED_BEEF = 364; const STEAK = 364, COOKED_BEEF = 364;
const RAW_CHICKEN = 365; const RAW_CHICKEN = 365;
const COOKED_CHICKEN = 366; const COOKED_CHICKEN = 366;
const ROTTEN_FLESH = 367; const ROTTEN_FLESH = 367;
const BLAZE_ROD = 369; const BLAZE_ROD = 369;
const GHAST_TEAR = 370; const GHAST_TEAR = 370;
const GOLD_NUGGET = 371; const GOLDEN_NUGGET = 371; const GOLD_NUGGET = 371, GOLDEN_NUGGET = 371;
const NETHER_WART = 372; const NETHER_WART = 372;
const POTION = 373; const POTION = 373;
const GLASS_BOTTLE = 374; const GLASS_BOTTLE = 374;
@ -154,19 +153,19 @@ interface ItemIds extends BlockIds{
const GLISTERING_MELON = 382; const GLISTERING_MELON = 382;
const SPAWN_EGG = 383; 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 FIRE_CHARGE = 385;
const EMERALD = 388; const EMERALD = 388;
const ITEM_FRAME = 389; const ITEM_FRAME = 389;
const FLOWER_POT = 390; const FLOWER_POT = 390;
const CARROT = 391; const CARROTS = 391; const CARROT = 391, CARROTS = 391;
const POTATO = 392; const POTATOES = 392; const POTATO = 392, POTATOES = 392;
const BAKED_POTATO = 393; const BAKED_POTATOES = 393; const BAKED_POTATO = 393, BAKED_POTATOES = 393;
const POISONOUS_POTATO = 394; const POISONOUS_POTATO = 394;
const MAP = 395; const EMPTY_MAP = 395; const MAP = 395, EMPTY_MAP = 395;
const GOLDEN_CARROT = 396; const GOLDEN_CARROT = 396;
const MOB_HEAD = 397; const SKULL = 397; const MOB_HEAD = 397, SKULL = 397;
const CARROT_ON_A_STICK = 398; const CARROT_ON_A_STICK = 398;
const PUMPKIN_PIE = 400; const PUMPKIN_PIE = 400;
@ -177,9 +176,7 @@ interface ItemIds extends BlockIds{
const QUARTZ = 406; const QUARTZ = 406;
const NETHER_QUARTZ = 406; const NETHER_QUARTZ = 406;
const MINECART_WITH_TNT = 407; const MINECART_WITH_TNT = 407;
const MINECART_WITH_HOPPER = 408; const MINECART_WITH_HOPPER = 408, HOPPER = 410;
const HOPPER = 410;
const RAW_RABBIT = 411; const RAW_RABBIT = 411;
const COOKED_RABBIT = 412; const COOKED_RABBIT = 412;
const RABBIT_STEW = 413; const RABBIT_STEW = 413;
@ -189,7 +186,7 @@ interface ItemIds extends BlockIds{
const IRON_HORSE_ARMOR = 417; const IRON_HORSE_ARMOR = 417;
const GOLD_HORSE_ARMOR = 418; const GOLD_HORSE_ARMOR = 418;
const DIAMOND_HORSE_ARMOR = 419; const DIAMOND_HORSE_ARMOR = 419;
const LEAD = 420; const LEASH = 420; const LEAD = 420, LEASH = 420;
const NAMETAG = 421; const NAMETAG = 421;
const RAW_MUTTON = 423; const RAW_MUTTON = 423;
@ -204,7 +201,7 @@ interface ItemIds extends BlockIds{
const SPLASH_POTION = 438; const SPLASH_POTION = 438;
const BEETROOT = 457; const BEETROOT = 457;
const BEETROOT_SEEDS = 458; const BEETROOT_SEED = 458; const BEETROOT_SEEDS = 458, BEETROOT_SEED = 458;
const BEETROOT_SOUP = 459; const BEETROOT_SOUP = 459;
const RAW_SALMON = 460; const RAW_SALMON = 460;
const CLOWN_FISH = 461; const CLOWN_FISH = 461;

View File

@ -901,7 +901,6 @@ class Level implements ChunkManager, Metadatable{
Level::getXZ($index, $chunkX, $chunkZ); Level::getXZ($index, $chunkX, $chunkZ);
if(!isset($this->chunks[$index]) or ($chunk = $this->getChunk($chunkX, $chunkZ, false)) === null){ if(!isset($this->chunks[$index]) or ($chunk = $this->getChunk($chunkX, $chunkZ, false)) === null){
unset($this->chunkTickList[$index]); unset($this->chunkTickList[$index]);
continue; continue;

View File

@ -22,7 +22,6 @@
namespace pocketmine\level\generator\normal\biome; namespace pocketmine\level\generator\normal\biome;
class DesertBiome extends SandyBiome{ class DesertBiome extends SandyBiome{
public function __construct(){ public function __construct(){

View File

@ -23,6 +23,7 @@
* Various Utilities used around the code * Various Utilities used around the code
*/ */
namespace pocketmine\utils; namespace pocketmine\utils;
use pocketmine\entity\Entity; use pocketmine\entity\Entity;
class Binary{ class Binary{

View File

@ -20,6 +20,7 @@
*/ */
namespace pocketmine\utils; namespace pocketmine\utils;
use pocketmine\scheduler\FileWriteTask; use pocketmine\scheduler\FileWriteTask;
use pocketmine\Server; use pocketmine\Server;