Compare commits

..

1119 Commits

Author SHA1 Message Date
05f71691fc Fixed AxisAlignedBB->setBB() 2014-10-17 09:57:42 +02:00
1c03c3afcf Decreased chunk ordering times 2014-10-17 09:57:18 +02:00
94e9485be9 Improved broadcast packet encoding 2014-10-17 09:36:47 +02:00
9cb27e26ef Fixed #2183 2014-10-16 22:01:32 +02:00
7760559be1 Improved chunk loading and order refresh times 2014-10-16 20:21:06 +02:00
163a37ee23 Optimized Player->orderChunks() and chunk sending ordering algorithm 2014-10-16 14:54:55 +02:00
c73a3e53be Added extra Entity metadata 2014-10-16 12:49:45 +02:00
8637b7f5a3 Fixed Tasks deleting their Timings reports 2014-10-16 12:49:26 +02:00
747fdab389 Fixed Inventory->removeItem() 2014-10-16 12:16:23 +02:00
204915450f Do not wrap text if unknown characters are found. 2014-10-15 18:38:14 +02:00
500a690cd0 Throw CRITICAL error message on unhandled Exception on commands instead of crashing 2014-10-15 18:35:42 +02:00
d473ce13ee Throw CRITICAL error message on unhandled Exception on plugin events instead of crashing 2014-10-15 18:35:30 +02:00
1adf53a81e Fixed error_handler trace generation on higher debug levels 2014-10-15 17:58:03 +02:00
ed942100ec Do not block when killing workers 2014-10-15 17:49:08 +02:00
8abe95309c Fixed RegionLoader not creating default index on first load 2014-10-15 16:59:31 +02:00
5dc5aba42c Match Player pickup area with Minecraft 2014-10-15 14:57:12 +02:00
bda6f03e15 Added BlockUpdateEvent 2014-10-15 13:07:10 +02:00
69d132401e Fixes entities not being saved and tile entities having an incorrect field, closes #1661 2014-10-15 12:15:17 +02:00
e3a9db5d8f Implemented saving modified chunks 2014-10-15 11:42:58 +02:00
b71a4701d9 Fixed player using an invalid spawn chunk 2014-10-15 11:40:41 +02:00
9b85abd75e Micro-optimizations 2014-10-15 10:44:01 +02:00
7b7b91ea0d Fixed Entity updates not firing 2014-10-15 10:13:49 +02:00
18f6bad48d Implemented scheduled and partial entity updates 2014-10-14 22:49:35 +02:00
fbe548c611 RakLib update, PING/PONG handling 2014-10-14 16:13:32 +02:00
4e793199fa Deprecated EntityMoveEvent 2014-10-14 16:11:10 +02:00
43a97c407d New PlayerMoveEvent, improved player movement event firing 2014-10-14 16:10:50 +02:00
07dcbdb9b0 Fixed Level->getNearbyEntities(), fixes item drops not being picked up 2014-10-14 16:03:14 +02:00
60ca24fe0e Updated PluginManager event deprecation message 2014-10-14 14:11:58 +02:00
6e8144d5d9 Improved player movement event firing & corrections 2014-10-14 00:11:17 +02:00
464afb949e Increased Player->forceMovement check radius 2014-10-13 23:44:28 +02:00
823dc933b8 Improved Entity extinguish operations and packet spam 2014-10-13 23:44:11 +02:00
883f93cc8c Improved item drop spawning 2014-10-13 22:45:04 +02:00
b26ee09f76 Removed a bunch of TODO and fixed item drops on block update 2014-10-13 18:54:34 +02:00
1eec333501 Save block bounding boxes, improves block cache 2014-10-13 18:38:00 +02:00
5448a48f67 Fixed Level->getCollidingEntities() 2014-10-13 18:36:13 +02:00
a10ad42a13 Removed Generic block class 2014-10-13 18:12:34 +02:00
da23cf685d Added PlayerBucketEvent and children, improved Bucket usage and Liquid placing 2014-10-13 18:04:40 +02:00
79e4b3e3a9 Removed old Player->timeout property 2014-10-12 17:12:59 +02:00
8472349caf Improved global block cache 2014-10-12 17:02:27 +02:00
96b61fbb92 Made Wheat crops extend Crop class 2014-10-12 16:20:30 +02:00
6246ad19c4 Added global block cache 2014-10-12 16:16:19 +02:00
9b69cc4288 Removed debug code 2014-10-12 15:40:14 +02:00
114153ae97 Added EntityBlockChangeEvent 2014-10-12 13:37:45 +02:00
ebb844fa52 Removed unused code, fixed undefined variables 2014-10-11 22:22:51 +02:00
bf89ea1cf6 Added BlockGrowEvent 2014-10-11 20:19:46 +02:00
4076fb4657 Added BlockSpreadEvent 2014-10-11 19:27:43 +02:00
312f377483 Added LeavesDecayEvent 2014-10-11 19:01:27 +02:00
0af3dfedd5 Improved Living entity ticking 2014-10-11 17:35:13 +02:00
6f1f201c41 Workaround for entities glitching through the floor on the client-side 2014-10-11 17:02:41 +02:00
48f591e5ce Removed workaround on flying check due to physics calculation fix, closes #2169 2014-10-11 16:43:14 +02:00
7f85e37540 Worked on scheduler 2014-10-11 16:36:38 +02:00
341717c89d Increased Player->stepHeight to 0.6, closes #2156 2014-10-11 16:36:17 +02:00
afdf7bc2b9 Added proper TextWrap width 2014-10-11 00:17:31 +02:00
24c76acf30 Submodule update 2014-10-11 00:04:17 +02:00
baf06dc363 Revert "Use Collectable class on AsyncTask, removed task collection workaround on ServerScheduler"
This reverts commit 0dba14074a.
2014-10-11 00:03:46 +02:00
645c00b2f7 Added TextWrapper 2014-10-11 00:01:53 +02:00
0dd46c835c Made ExplosionPrimeEvent accept setting block breaking settings 2014-10-10 22:39:06 +02:00
0dba14074a Use Collectable class on AsyncTask, removed task collection workaround on ServerScheduler 2014-10-10 20:53:28 +02:00
8b585fd9f7 Deprecated Level->getSpawn() in favor of Level->getSpawnLocation() 2014-10-10 11:43:54 +02:00
9ede8177df Fixed Entity->getLineOfSight() 2014-10-10 09:53:58 +02:00
13ec046f0d Removed old OS detection code 2014-10-09 19:37:23 +02:00
5c4e7b6ee0 Added Living->getTargetBlock(), Living->getLineOfSight(), Vector3 side constants, Vector3::getOppositeSide() 2014-10-09 17:57:25 +02:00
6424934df6 Fixed EntityCombustEvent children using a different handlerList 2014-10-09 14:40:52 +02:00
b2ac959083 Added FurnaceSmeltEvent 2014-10-09 12:47:42 +02:00
c67d4dae7b Added FurnaceBurnEvent 2014-10-09 12:36:57 +02:00
22ad75c5a0 Update fuel duration to ticks 2014-10-09 12:21:14 +02:00
b45ef8928c Added Tile->getBlock() method 2014-10-09 12:14:39 +02:00
eccf7b08d2 Added PlayerDeathEvent methods for inventory keeping 2014-10-09 11:06:05 +02:00
94eb9e35e2 Improved liquid performance, update RakLib 2014-10-08 23:24:39 +02:00
79bf1f12f2 API 1.6.0 2014-10-08 17:39:43 +02:00
10b33546ef Added PlayerBedEnterEvent and PlayerBedLeaveEvent 2014-10-08 17:37:11 +02:00
c52dc58d6f Added ProjectileHitEvent 2014-10-08 17:04:35 +02:00
62af784d37 Removed unused imports 2014-10-08 17:00:23 +02:00
aa010b7dea Added ProjectileLaunchEvent 2014-10-08 16:58:17 +02:00
4a3163b4c8 Added ItemSpawnEvent 2014-10-08 16:53:13 +02:00
c750a204e6 Added ItemDespawnEvent 2014-10-08 16:51:10 +02:00
3313981d54 Fixed issues with Entity::heal() method 2014-10-08 16:46:21 +02:00
57f7d57c76 Added ExplosionPrimeEvent 2014-10-08 16:45:55 +02:00
64bf293c69 Improved EntityShootBowEvent 2014-10-08 16:36:43 +02:00
7b09edf048 Improved EntityRegainHealthEvent 2014-10-08 16:28:40 +02:00
4346773e25 Added EntityDamageByBlockEvent (child of EntityDamageEvent) 2014-10-08 16:13:18 +02:00
b0c314526d Added EntityCombustEvent and childs 2014-10-08 15:51:27 +02:00
dd140ce018 Fixed arrow damage not getting overridden by the event result 2014-10-08 15:38:58 +02:00
08aa7808cf Updated RakLib, better player join 2014-10-08 10:45:37 +02:00
582c165479 Implemented Explosion and PrimedTNT, closes #2139 2014-10-07 17:46:01 +02:00
5fb205493a Spawnable->spawnToAll() now uses the actual chunk instead of the entire level to spawn 2014-10-07 12:50:53 +02:00
e346d245e2 Merge pull request #2166 from PocketMine/query-event-implementation
Query event implementation
2014-10-07 11:46:55 +02:00
4fece32ca8 API 1.5.0 2014-10-07 11:02:22 +02:00
0b79d74a2f Implemented QueryRegenerateEvent 2014-10-07 11:02:05 +02:00
b83c6fbfa3 Added Vine blocks, closes #2162 2014-10-07 10:18:02 +02:00
dda9c598f1 Added new Tool type selection constants 2014-10-07 10:16:05 +02:00
8769d2bcd1 Unload entities from chunks, possible fix for #2157, fixes #2165 2014-10-07 09:27:18 +02:00
3b7ece3363 Do not spawn dead entities to players, fixes #2157, possible fix for #2165 2014-10-07 09:24:19 +02:00
b6025e3f2b Removed selectors on Player->sendMessage() 2014-10-06 16:45:11 +02:00
35de331b74 Fixed Level->getCollidingEntities() when called with a null Entity 2014-10-06 13:18:05 +02:00
de11cce154 Improved entity ticking 2014-10-06 13:10:59 +02:00
d53ba52d32 Removed parse errors from AutoReporting 2014-10-06 12:12:54 +02:00
9db2fe40eb Fixed player datta not getting saved, use fall distance on fly calculation 2014-10-06 12:02:36 +02:00
57bb8f14fa Fixed Player movement collision checks 2014-10-06 11:47:28 +02:00
761cd59514 Implemented flying protection 2014-10-06 11:22:59 +02:00
4c2a1c8684 Implement crop growth levels properly, fixes #2002, closes #2160 2014-10-06 09:34:40 +02:00
31bb6d1a68 Changed base block classes to abstract, closes #2159 2014-10-06 09:27:44 +02:00
cd65179aef Fixes #2155 2014-10-06 12:07:48 +10:30
9abd2c63f4 Improved initial chunk loading, do not skip near chunks, fixes world loading getting stuck 2014-10-06 00:45:02 +02:00
376e359577 Moved connected flag up in the Player disconnect process 2014-10-05 22:51:20 +02:00
571e2f8895 Revert "Option to disable hitbox calculation"
This reverts commit fae330d499.
2014-10-05 16:32:49 +02:00
7106ea87e6 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-10-05 16:32:27 +02:00
6b65b68ebc Possible fix for #1661 2014-10-05 16:32:15 +02:00
d4c75ce68a Trim system timezone output 2014-10-05 17:40:17 +10:30
fae330d499 Option to disable hitbox calculation 2014-10-04 20:07:37 -05:00
5e03e157ad Fixed #2153 2014-10-04 23:16:35 +02:00
b0c40dc1ab Fixed Server->unloadLevel() not removing objects from memory 2014-10-04 20:56:27 +02:00
6840589f4e Fix trailing newline 2014-10-04 18:28:42 +02:00
19e4aaa16a Merge pull request #2151 from sekjun9878/master
Timezone for Windows and IP Geolocation TZdata
2014-10-05 01:51:44 +09:30
e0a7944faa Re-use timezone offset parsing 2014-10-05 01:43:33 +09:30
eeda22d0ba Add portable linux timezone detection for incompatible linux distributions. 2014-10-05 01:29:07 +09:30
769f1effb0 Cleaner timezone parsing for Linux and add support for Macs 2014-10-05 01:05:00 +09:30
42c7322273 Reliable timezone detection using systeminfo for Windows and additional IP Geolocation-based detection. Added a warning message for when auto-detection fails. Fixes #2015. 2014-10-05 00:32:01 +09:30
c8cf6b715e Merge pull request #2150 from PEMapModder/patch-2
Fixed PlayerChatEvent::setRecipients() being ignored
2014-10-04 14:49:14 +02:00
41f94f7385 Fixed PlayerChatEvent::setRecipients() being useless 2014-10-04 20:10:12 +08:00
602bdf27a5 Compatibility with pthreads > 2.0.8 2014-10-02 16:58:37 +02:00
539fa232f8 Added individual object timings to Entities / Tile Entities 2014-09-30 16:09:21 +02:00
f8378c09ba Fixed entities getting OnGround default to true 2014-09-30 13:13:31 +02:00
69fb7ae525 Update RakLib, fixes server locking when shutting down 2014-09-30 09:52:50 +02:00
ee8ad6f92a Implement Armor changes as Transactions 2014-09-30 09:37:58 +02:00
f888acbd7c Send PlayerArmorEquipmentPacket instead of ContainerSetContentPacket with id 0x78 2014-09-29 23:43:52 +02:00
215691f1c4 Update RakLib 2014-09-29 23:23:11 +02:00
1252dd65a9 Improved PlayerInventory->setItemInHand() $source call, fixed Tool durability 2014-09-29 17:53:53 +02:00
762c27affe Added armor change $source parameter 2014-09-29 17:50:48 +02:00
706e1099a1 Update raklib 2014-09-29 16:46:19 +02:00
9cd66dc969 Some changes 2014-09-29 16:37:56 +02:00
5b6b789ab3 Improved exponentiation 2014-09-29 13:24:25 +02:00
85ff696ae5 Improved Chunk entity loading 2014-09-29 13:14:14 +02:00
25f8e8318b Fixed Anvil levels duplicating saved entities 2014-09-29 13:09:13 +02:00
61d84c73d0 Implemented Arrow pick up 2014-09-29 13:05:18 +02:00
f5822c6de8 Improved entity movement updates 2014-09-29 12:59:01 +02:00
b0bd927545 Improved entity base ticks 2014-09-29 12:55:10 +02:00
fde61b7d21 Improved single-threaded chunk generation efficiency 2014-09-29 12:48:11 +02:00
886ad8442c Fixed #2055 Extra packet data sent on armor change 2014-09-28 17:31:44 +02:00
7b5869bea8 RakLib submodule update 2014-09-28 16:35:24 +02:00
3063863c65 RakLib update 2014-09-28 16:06:27 +02:00
0dfaa19380 Fixed invalid spawn position setting for plugins 2014-09-28 15:19:09 +02:00
7fea29e874 Updated pthreads version on Travis-CI 2014-09-28 12:50:03 +02:00
2ded2013bf Fixed auto-save configuration, made it global 2014-09-28 10:50:43 +02:00
aa27c28e65 Force new player position on spawn 2014-09-28 01:14:03 +02:00
05a81bebf4 Fixed server crash when Tile Entities / Entities were loaded and requested the same chunk 2014-09-28 00:39:49 +02:00
ce91f2943a Fixed Double Chests 2014-09-28 00:39:11 +02:00
1d8562fb8c Allow setting the player spawnpoint via events before PlayerJoinEvent 2014-09-28 00:14:08 +02:00
1dfb17b932 Fixed #2126 Items drop twice from tile entities 2014-09-27 14:31:41 +02:00
16384c2b20 Improved Player generation queue 2014-09-27 10:31:02 +02:00
48041b2f19 Basic entity motion on water 2014-09-27 00:09:38 +02:00
529bf743db Added torch drop 2014-09-26 23:07:43 +02:00
48bc919a33 Added Liquid flow 2014-09-26 16:56:10 +02:00
474091c013 Improved Level block update scheduling for repeated updates 2014-09-26 16:55:34 +02:00
666e5553c2 Fixed Level->scheduleUpdate() tick calculation 2014-09-26 16:04:51 +02:00
ae6f532b1d Partial Liquid flow 2014-09-26 13:25:52 +02:00
b231eba803 Fixed E_NOTICE error on player movement 2014-09-26 13:23:47 +02:00
82d903733d Fixed #2121 2014-09-26 11:34:06 +02:00
8e2903da86 API version 1.4.1 2014-09-26 11:19:30 +02:00
d720113ac9 Added non-threaded chunk generation, toggleable on pocketmine.yml 2014-09-26 11:18:46 +02:00
5db45222c6 Deprecated Level->getChunkAt() in favor of Level->getChunk() 2014-09-26 10:31:32 +02:00
2975509d0f Improved chunk unload queue, possible fix for #1661 2014-09-25 23:03:56 +02:00
7e49d073fa Improved player movement, check once per tick 2014-09-24 16:58:22 +02:00
ef3674a296 Possible fix for #1661 2014-09-24 16:47:53 +02:00
6cb7e36f8a Improved knockback motion 2014-09-24 16:17:04 +02:00
b88f19bb74 Improved Level::getSafeSpawn() 2014-09-23 20:16:16 +02:00
8c3fcf0798 Send player metadata on respawn 2014-09-23 20:14:01 +02:00
6b312a7826 Fixed players getting Suffocation damage inside transparent blocks 2014-09-23 19:50:44 +02:00
9907e84eee Torches can now be crafted using charcoal 2014-09-23 19:36:30 +02:00
01f299a7f1 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-09-23 15:54:59 +02:00
91f20f6789 Add valid position difference back to Player entities 2014-09-23 15:54:48 +02:00
4c1edc3f7e Re-order RFC section 2014-09-23 20:32:39 +09:30
5fd1e271c5 Merge pull request #2112 from PocketMine/rfc-rfc-and-voting
RFC and Voting
2014-09-22 15:46:03 +02:00
593b0497b0 Fixed #1750 cannot place slabs against blocks 2014-09-22 11:58:15 +02:00
0907aedcef Fixed Entity/Block issues on negative coordinates, closes #2100 2014-09-22 11:48:39 +02:00
0a29e66b62 Fixed #2114 Removed Player collisions with other entities 2014-09-22 11:26:12 +02:00
3cc4afbcd6 Possible fix for #1920 2014-09-22 11:21:54 +02:00
b3ae6eae04 Added RFC ready status, added new label to label list 2014-09-22 09:30:14 +02:00
3b56b536b6 Changed RFC label 2014-09-22 08:46:03 +02:00
9258281546 Fixed missing whitespace 2014-09-21 21:18:37 +02:00
e7897be7cd Merge pull request #2113 from tnpxxsheepdog/rfc-rfc-and-voting
Update CONTRIBUTING.md
2014-09-21 21:08:18 +02:00
5ff01de413 Update CONTRIBUTING.md
Smoothed out wording, fix grammar.
2014-09-21 15:05:08 -04:00
f191ada405 Fixed text typo 2014-09-21 18:33:34 +02:00
addd74d09e Fix typo, added PR: Request for Comments label 2014-09-21 17:51:35 +02:00
4e9d2d0a7f Added 'RFC and Voting' to CONTRIBUTING.md 2014-09-21 17:45:58 +02:00
d04e994d1b Added TPS load to /status 2014-09-21 12:18:51 +02:00
3d870629f2 Fixed ifconfig command typo 2014-09-21 12:18:26 +02:00
8dbe834dc3 Submodule update 2014-09-21 12:18:10 +02:00
36d8100e17 Protect against \0 attacks on name checking 2014-09-20 18:26:17 +02:00
b880bf13f8 Documented tool usage in Level::useBreakOn() 2014-09-20 18:25:53 +02:00
1ac08ce404 Fixed Utils::getUniqueID() on Linux due to /proc/cpuinfo 2014-09-20 12:39:57 +02:00
689b2ea877 Fixed #2104 Can't place blocks where non-solid entities exist 2014-09-20 11:10:46 +02:00
d1f22ee395 Block more player actions when dead, closes #2102 2014-09-19 20:19:27 +02:00
056ed4802f Send project name on usage 2014-09-19 15:08:40 +02:00
bcb65e9a48 Send build number on usage 2014-09-19 15:07:48 +02:00
5404ba77d0 Throw exception when Server::dispatchCommand() is called with an invalid CommandSender 2014-09-19 10:30:35 +02:00
ae54426836 Fixed date_default_timezone_set E_NOTICE 2014-09-19 10:26:44 +02:00
ee7d84dfbd Fixed T_DOUBLE_COLON 2014-09-19 09:48:02 +02:00
3e1ea23036 Fixed CallbackTask name 2014-09-19 09:46:38 +02:00
d312d2a143 Possible fix for #2046, removed embedded class names 2014-09-19 09:44:58 +02:00
8c627bd0af Remove level locks, possible fix for #2046 2014-09-18 11:44:16 +02:00
6fb7170556 Handle force parameter properly on Level::unload() 2014-09-18 11:38:03 +02:00
50f5c6d8ed RakLib patches 2014-09-18 09:22:52 +02:00
f9d5c5bd37 Improved event checking on PlayerInteractEvent 2014-09-16 17:49:44 +02:00
45dbb3f828 Improved block collision check 2014-09-16 12:02:33 +02:00
8a8a95480e Added Cactus damage 2014-09-16 12:02:18 +02:00
34139c7efe Added more death messages 2014-09-16 11:51:43 +02:00
f0e7713dce Added suffocation, drowning damage. Closes #1908 2014-09-16 11:51:31 +02:00
3ba099b309 Cobweb, Ladders and Water won't cause fall damage 2014-09-16 10:52:00 +02:00
c4a0c759dc Show fire to other clients 2014-09-16 10:48:56 +02:00
e9a2f88847 Added Fire, Lava damage 2014-09-16 10:42:29 +02:00
e608acbd1c Improved Player last damage check 2014-09-16 10:42:01 +02:00
42033da08b Fixed #2035 Invalid Fence Gate bounding box 2014-09-16 00:47:04 +02:00
69ab0d433b Removed old trigger_error() 2014-09-16 00:42:36 +02:00
44a30b7fac Added forced position strong check for Player 2014-09-16 00:32:03 +02:00
50b2f55583 Increased movement error range 2014-09-15 23:53:08 +02:00
da084d6908 Fixed door bounding boxes, closes#2075 2014-09-15 23:40:26 +02:00
7d51bc0004 Possible fix for #2077 2014-09-15 22:14:05 +02:00
87dbc18452 Removed position revert message on plugin event cancelled 2014-09-15 20:32:42 +02:00
5b8d4bba11 Fixed issues with placing doors 2014-09-15 20:32:27 +02:00
bb4c54106a Added temporal workaround for pthreads version check 2014-09-15 18:55:15 +02:00
1617b2509e Fixed plugin-related crash 2014-09-15 12:09:30 +02:00
ec293ebd9e Merge pull request #2071 from PocketMine/pthreads-fix
Removed pthreads workarounds, new pthreads version
2014-09-15 10:16:35 +02:00
9f9422f0ed Added Player->forceMovement check on teleport 2014-09-15 01:16:13 +02:00
da715e48e2 Bumped pthreads version 2014-09-13 12:07:04 +02:00
702b2e539c Update RakLib 2014-09-13 12:01:11 +02:00
63fc229c12 Enabled default PHP GC on generator thread 2014-09-12 15:57:02 +02:00
c71689a919 Optimized server sleep times 2014-09-12 15:56:21 +02:00
09428bc8c7 Merge branch 'master' into pthreads-fix 2014-09-12 13:32:53 +02:00
6c7e16d9d4 Added Permission/Permissible calculation timings 2014-09-12 13:08:59 +02:00
315ea2ea3c 64-bit Random optimizations 2014-09-12 12:58:21 +02:00
83eb9f778a Level generators can be set in server.properties 2014-09-12 01:05:32 +02:00
7923c40b33 Removed as Vector3 on Flat generator 2014-09-12 00:12:52 +02:00
d298adabad Merge branch 'master' into pthreads-fix 2014-09-11 22:06:10 +02:00
cfcf515f62 Added type hint to BlockEvent::getBlock() 2014-09-11 21:57:56 +02:00
b5deae7ba0 Added synchronization to GenerationThread::pushMainToThreadPacket() 2014-09-11 19:18:14 +02:00
d991c32435 Fixed Generator Thread as specified on krakjoe/pthreads#349 2014-09-11 19:10:25 +02:00
dbd1f3f96e Use pthreads interface on Chunk Generation THread, remove IPC sockets, improve performance 2014-09-11 18:05:14 +02:00
0bd7ab9def Added .mailmap file, fixes duplicated commiter names 2014-09-11 17:41:07 +02:00
665c275bb7 New improved RakLib version with pthreads changes 2014-09-11 17:18:54 +02:00
7ef2708fca Permission & interface optimization 2014-09-11 16:43:11 +02:00
78b4223795 Added PermissionAttachment::unsetPermissions(), PermissionAttachment::clearPermissions() 2014-09-11 12:43:53 +02:00
0328b4c5f5 Added PermissionAttachment::setPermissions()
This allows bulk permission without recalculating the new permissions until all everything is set. Permission plugins that set a big amount of nodes may want to use this method.
2014-09-11 12:39:01 +02:00
4624dfb472 Fixed Permissible::setPermission() not using the correct order on replacement 2014-09-11 12:17:03 +02:00
fba12c6ddf Fixed EntityMoveEvent not being cancelled correctly on players 2014-09-10 20:06:30 +02:00
60011a5ecf Fixed PermissionAttachment not recalculating its Permissible permissions 2014-09-10 20:05:41 +02:00
f4ae58dda2 Removed pthreads workarounds 2014-09-10 15:11:56 +02:00
8c939feed9 Added Pumpkin & Lit Pumpkin rotation, closes 2014-09-10 12:36:05 +02:00
02ca227085 Normalized Player pitch/yaw 2014-09-10 12:23:23 +02:00
1174b0c45c Added binary reading optimizations, faster 64-bit reading 2014-09-10 12:13:15 +02:00
8940360df4 Possible fix for #2061 2014-09-10 10:43:24 +02:00
bb34e06754 Fix division by zero when the server goes too fast 2014-09-09 19:13:35 +02:00
e06092cb99 Added Server::getTickUsage() 2014-09-09 18:46:20 +02:00
57373b8c5e TPS measurement improvement, moved interface handling to tick 2014-09-09 18:07:27 +02:00
317c6788a6 Updated RakLib path 2014-09-08 10:11:43 +02:00
0a4e0e3228 Fixed Item drop delay 2014-09-08 07:40:19 +02:00
d8c492de4a Merge pull request #2062 from Yosshi999/patch1
Fixed HeldItem were swapped in mining
2014-09-08 07:37:24 +02:00
05d59d587b Merge pull request #2063 from Yosshi999/patch2
Fixed Player's slot[0] disappears on loging in
2014-09-08 07:37:16 +02:00
7d387fe6aa Fixed TravisTest output 2014-09-07 19:54:13 +02:00
4f7a6a06be Fixed TravisTest pipes 2014-09-07 19:47:31 +02:00
344c84cfa6 Added --disable-readline CLI argument 2014-09-07 19:42:36 +02:00
bd721a13a3 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-09-07 19:33:01 +02:00
92b0b4d43c Implemented basic Travis-CI test 2014-09-07 19:32:21 +02:00
d0b0fbf992 Merge pull request #2064 from PEMapModder/patch-2
Fixed wrong cases
2014-09-07 09:02:54 +02:00
ab334e6962 Fixed wrong cases
I know this doesn't matter at all, but it is ugly in IDEs.
2014-09-07 13:21:05 +08:00
1ad6438e60 Fixed Player's slot[0] disappears on loging in 2014-09-07 11:37:54 +09:00
4ecec42c9d Fixed HeldItem were swapped in mining 2014-09-07 11:29:17 +09:00
84e62598ce Implemented attack cooldown 2014-09-06 16:52:52 +02:00
ad7acb93b6 Added cactus neighbour block check 2014-09-05 11:16:24 +02:00
ac4b4b08fd Fixed Level::setBlock() old calls 2014-09-05 11:00:13 +02:00
d3c308c5a8 Fixed possible Player crash on save 2014-09-05 10:50:19 +02:00
98e0583f34 Implemented Falling Sand 2014-09-05 10:50:06 +02:00
020351e20f Fixed #2052 2014-09-05 09:02:45 +02:00
f140fef52d Possible fix for level save issues, related to #1985 #1982 #1758 2014-09-04 12:37:27 +02:00
9980a0780a Fixed Server::getTicksPerSecond() 2014-09-04 12:22:16 +02:00
352497d88c Improves server ticking.
As I was lying in my bed, I came to a solution for the tick problem.
While remembering how most of the time the server is sleeping,
and how the TPS drops once costly operations are ticked,
I reviewed mentally that part of the code, Server::tick().

Then I saw it: I was setting the next execution time
using the time after it was executed as the base, but it should
have been done using the tick start time - that way if something takes
longer, the server will catch up and won't drop the TPS
until the CPU hits its limit.

I got up, got to my computer, and checked that function.
It was exactly as I saw in a near-dream state, so I fixed it
and tested things if they worked right.

Now I'm fully awake and I can't sleep anymore, so I wrote this.
2014-09-04 01:04:09 +02:00
ba08bfaa45 Do not report E_PARSE or E_COMPILE_ERROR crashes 2014-09-03 13:38:24 +02:00
dea4513c34 Possible fix for #2041 2014-09-03 11:55:49 +02:00
0eac084aa7 Added extra documentation to Level::setBlock() 2014-09-03 11:44:30 +02:00
e17ecf5795 Improved Arrow / Item movement 2014-09-03 10:55:14 +02:00
e94ddcabe0 Fixed dropped items going too fast 2014-09-01 23:37:31 +02:00
acf7eb1ce9 Remove scheduled updates from entities 2014-09-01 23:30:35 +02:00
dcfb7a7ac4 Fixed #2037 2014-09-01 17:47:28 +02:00
97c87aa8fa Added __debugInfo() to Server and Level 2014-09-01 17:37:28 +02:00
11f684d803 Improved CallbackTask timings data 2014-09-01 12:44:52 +02:00
ff48eb3d4d Added better Entity/Tile scheduled updates 2014-09-01 11:59:46 +02:00
e047b6a870 Fixed bows not getting damaged 2014-09-01 11:43:48 +02:00
c5626bae34 Do not set Level to null, closes #2032 2014-09-01 11:29:44 +02:00
3eac08f5ba Possible fix for #2027, properly check Player onGround flag 2014-09-01 02:32:16 +02:00
cc2555bb88 Fixed crash when chests are closed with viewers 2014-09-01 02:26:23 +02:00
705e4da789 Tick entities on Level, show correct timing reports 2014-09-01 01:56:13 +02:00
9b7a94b5ee Fixed timings ticks getting reset 2014-09-01 01:50:28 +02:00
bcdb6d8c2e Fixed timings name 2014-09-01 01:28:42 +02:00
eff63a661e Player creative check refactor 2014-08-31 10:49:20 +02:00
5a756d215d Fixed creative players dropping their inventory 2014-08-31 10:45:38 +02:00
422262d585 Fixed infinite Entity recursion on chunk load 2014-08-31 01:06:53 +02:00
b761a97660 Fixed crash due to class name conflict 2014-08-31 01:05:15 +02:00
7579cd763a Added Trapdoor bounding box 2014-08-30 23:57:57 +02:00
6bc5f60011 Added Cobble Wall bounding box 2014-08-30 23:52:06 +02:00
3eb8ca0d13 Added Soul Sand bounding box 2014-08-30 23:47:39 +02:00
a23352be88 Added Ladder bounding box 2014-08-30 23:45:08 +02:00
fa5f00a1ff Added Cake bounding boxe 2014-08-30 23:42:07 +02:00
d3a05adede Added Doors bounding boxes 2014-08-30 23:38:56 +02:00
f9182bd0f8 Added Iron bars bounding box 2014-08-30 23:30:10 +02:00
edad52c6ea Added Glass Pane bounding box 2014-08-30 23:30:01 +02:00
cd5e16f017 Added Fence Gate bounding box 2014-08-30 23:20:59 +02:00
310a7d6c04 Added Fence bounding box 2014-08-30 23:18:37 +02:00
ccea26c978 Added Farmland bounding box 2014-08-30 23:07:55 +02:00
cf542ac73a Added End Portal frame bounding box 2014-08-30 23:06:50 +02:00
3bf39df255 Added cactus bounding box 2014-08-30 23:06:27 +02:00
910e5e6181 Added stairs bounding box 2014-08-30 23:01:33 +02:00
a396b8c220 Fixed #2021 2014-08-30 21:45:32 +02:00
ec1fe6a083 Fixed EntityShootBowEventEvent crash 2014-08-30 19:07:17 +02:00
706c97b9b1 Made shooting bow use its durability 2014-08-30 18:46:09 +02:00
a04516a879 Added EntityShootBowEvent, made bow require an arrow 2014-08-30 18:43:32 +02:00
0f6dfd39b8 Made EntityDamageByEntityEvent call EntityDamageEvent handlers 2014-08-30 18:41:00 +02:00
36ee6d9966 Added arrow and suicide death messages 2014-08-30 18:30:39 +02:00
23793e0fc4 Added check for invalid entity attack 2014-08-30 18:24:24 +02:00
3409d332e7 Added survival check to movements 2014-08-30 17:57:30 +02:00
ca1b67a675 hmm 2014-08-30 17:07:50 +02:00
f5eed4f12b Disable RakLib port checking by default 2014-08-30 16:14:09 +02:00
7a10f91330 Fixed entity partial block moving 2014-08-30 15:31:22 +02:00
6477f4f077 Added Wooden Slab bounding box 2014-08-30 02:14:48 +02:00
3731e74696 Added Slab bounding box 2014-08-30 02:14:24 +02:00
c774e4c203 Added Carpet bounding box 2014-08-30 02:09:15 +02:00
d4907a2688 Added Chest bounding box 2014-08-30 02:07:50 +02:00
793520926b Added Bed bounding box 2014-08-30 02:06:46 +02:00
bf839e821c Added proper arrows and damage 2014-08-30 01:22:46 +02:00
7aeacf2705 Fixed armor crafting recipes 2014-08-29 14:49:41 +02:00
fc62c91c90 Fixed double physics calculation 2014-08-29 13:33:59 +02:00
98dd7f8c15 Use Entity::move() as player movement, protect against noclip cheat 2014-08-29 13:33:25 +02:00
7a1d25617f Fixed physics sneak flag 2014-08-29 13:02:08 +02:00
69b3ef326b Merge pull request #1994 from PocketMine/nbt-array
Added NBT <-> PHP array/type conversion methods
2014-08-29 12:17:10 +02:00
fadff2cc5b Removed debug code 2014-08-28 23:59:18 +02:00
43a0ef433e API version bump 2014-08-28 23:44:19 +02:00
9a1e7ca83c Implemented NBT::getArray() and NBT::setArray() 2014-08-28 23:43:04 +02:00
b9111b6f52 Fixed #1992 2014-08-28 23:19:44 +02:00
be70121f3a Renamed Item\Block to Item\ItemBlock 2014-08-28 22:28:32 +02:00
e2986992c7 Fixed AxisAlignedBB infinite expansion 2014-08-28 21:11:49 +02:00
9fb46d8fe8 Fixed entity physics 2014-08-28 18:26:37 +02:00
eab86f5f90 Replaced array() with [] 2014-08-28 17:04:22 +02:00
2f2afe2336 Fixed #1966 Face Lit Pumkins correctly 2014-08-28 11:00:41 +02:00
f7de1ede3f Made PocketMine loader backwards-compatible 2014-08-27 21:30:36 +02:00
812ae09a06 Merge branch 'php-5.6' 2014-08-27 21:24:52 +02:00
e473cd5e67 Improved unloaded tile entity handling 2014-08-27 18:18:33 +02:00
9e5e4fb362 Fixed possible Level::getBlock() crash 2014-08-27 18:11:23 +02:00
afa98866e0 Fixed Item after-clone behaviour 2014-08-27 18:11:02 +02:00
90fa40de34 Added entity id names 2014-08-27 17:42:38 +02:00
e6234c4c4d Removed cli_set_process_title() check 2014-08-27 12:45:14 +02:00
8f66d03d99 Improved Item::get() 2014-08-27 12:43:54 +02:00
8e9da9c84e Improved safe_var_dump(), Inventory::addItem() Inventory::removeItem() using argument unpacking 2014-08-27 12:29:04 +02:00
759d7e2545 Initial PHP 5.6 features support 2014-08-27 12:21:01 +02:00
f4b92bcdfc Fixed #1980 2014-08-27 11:41:00 +02:00
f7e2d31f0a Check player online status, closes #1983 2014-08-27 11:28:49 +02:00
e0fc3784ad Throw exception when saving an already-closed player, closes #1981 2014-08-26 22:02:43 +02:00
bf5630dc0d Fixed #1926 Teleport to non-generated chunks 2014-08-26 16:45:51 +02:00
472431752b Dropped items and arrows get deleted on Y < 0 2014-08-26 16:19:45 +02:00
c40f9f65a5 Optimize imports 2014-08-26 11:54:24 +02:00
f74af12914 Improved chunk ticking, enabled again. Disable it setting chunk-ticking.per-tick to 0 2014-08-26 11:52:45 +02:00
d169734781 Improved chunk sending 2014-08-26 11:50:51 +02:00
35b86af2af Fixed furnace achievement check 2014-08-26 10:56:33 +02:00
706bc8e8db Fixed undefined index on furnace recipes 2014-08-26 00:05:40 +02:00
b542c5b9bd Added Furnace progress fire 2014-08-26 00:05:18 +02:00
69800c6d79 Fixed #1911 Implemented FurnaceInventory callback 2014-08-26 00:03:16 +02:00
ea9fc3c72e Fixed #1879 Tile entities were not saved on chunk unload 2014-08-26 00:02:20 +02:00
8b90281355 Fixed #1953 Increased item PickupDelay to 2.5 seconds 2014-08-25 23:38:35 +02:00
92cabced97 Ctrl+C handling and kill signals are working again 2014-08-25 23:24:18 +02:00
cb645fa288 Moved spl to PocketMine-SPL 2014-08-25 21:02:33 +02:00
bda597a71e Moved spl to PocketMine-SPL 2014-08-25 20:54:53 +02:00
d6a0e284e3 Workaround BaseChunk::setBlock() recursion issues 2014-08-25 17:08:02 +02:00
1795c8c5e3 Fixed Chests/Furnaces not dropping contents when broken 2014-08-25 16:59:04 +02:00
c3b1b59118 Fixed #1970 Breaking blocks does not remove tile entities 2014-08-25 16:55:52 +02:00
a0df0a8fff Fixed player fall damage 2014-08-25 16:53:20 +02:00
049103ab7a Improved Block selection and construction performance 2014-08-25 16:39:47 +02:00
84c63c48ca Improved NBT IntArray read/write 2014-08-25 16:28:46 +02:00
20e11bd408 Improved player onGround collision check 2014-08-25 15:48:12 +02:00
456760b334 Removed unloaded chunk check 2014-08-25 15:43:48 +02:00
46e502430e Added teleport flag to MovePlayerPacket, improves player movement 2014-08-25 13:01:39 +02:00
87b800ebb9 Fixed #1967 Glowstone dust -> Glowstone recipe 2014-08-25 11:33:47 +02:00
9fdafb87b4 Fixed #1962 Fake client-side player entities 2014-08-24 23:12:12 +02:00
1fcfef20b0 Implemented beds 2014-08-24 20:34:24 +02:00
6109505786 Implemented correct time offsets and speed 2014-08-24 20:34:06 +02:00
764937dda4 Fixed #1961 2014-08-24 18:08:14 +02:00
8bf36315ae Updated RakLib 2014-08-24 17:21:05 +02:00
1ea0531ec7 Added RakLib port checking option 2014-08-24 17:16:37 +02:00
c47e359262 Updated blocks bounding boxes 2014-08-24 16:30:56 +02:00
f0f9bccb4b Fixed #1960 2014-08-24 15:57:13 +02:00
214dcef1ea Improved Air block collision check 2014-08-24 15:55:34 +02:00
4edadd764c Improved Level::getBlock() 2014-08-24 14:30:43 +02:00
01ebe74974 Performance improvements in blocks and Entities 2014-08-24 14:08:17 +02:00
84ce5f1c73 Performance improvements in NBT reading/writing 2014-08-24 13:59:37 +02:00
93a2bd36e0 Require PHP >= 5.5 2014-08-24 13:33:03 +02:00
fdd59e4506 Fixed default memory-limit values 2014-08-23 20:14:41 +02:00
9b86b1d45b Added --enable-profiler parameter to use with @krakjoe profiler 2014-08-23 20:14:04 +02:00
1a38003bc4 Fixed /version 2014-08-22 19:39:24 +02:00
60ea4d0e96 Removed hardcoded Server name from source 2014-08-22 18:31:17 +02:00
6077190a62 Deprecated Server::loadPlugin(Plugin) in favor of Server::enablePlugin(Plugin) 2014-08-22 17:43:29 +02:00
57299b9a29 Fixed #1948 /whitelist list is now working 2014-08-22 13:23:56 +02:00
bb08da701b Fixed header logo in PR #1944 2014-08-22 11:30:15 +02:00
ee593fe5e4 Merge pull request #1944 from PEMapModder/patch-2
Cleaned Mycelium.php and fixed its potential crash
2014-08-22 11:22:10 +02:00
e8b1b0fab6 Cleaned Mycelium.php and fixed its potential crash
Crash report: http://crash.pocketmine.net/view/27500
2014-08-22 11:05:47 +08:00
4858c7d82e Merge pull request #1912 from Intyre/feature/block
EndPortal, EndStone, MonsterSpawner, Mycelium and Podzol blocks added
2014-08-21 19:34:51 +02:00
ecc9e1d223 EndPortal meta and Endstone breaktime 2014-08-21 19:26:41 +02:00
a3cc676ac6 Improved player spawn, closes #1890 2014-08-21 19:18:06 +02:00
db7222976e Code cleanup 2014-08-21 17:26:41 +02:00
e1ef86074e Merge pull request #1937 from Yosshi999/patch
Fixed #1923 sending NULL to Level::getXZ()
2014-08-20 16:03:52 +02:00
9f4582349d Fixed #1923 sending NULL to Level::getXZ() 2014-08-20 22:32:19 +09:00
5dc3fe4fe9 Fix backwards-incompatible change 2014-08-19 16:26:37 +02:00
8446bd2ba5 Added thread stop message 2014-08-19 12:55:21 +02:00
9f34d22013 Detach invalid Workers on shutdown 2014-08-19 12:46:44 +02:00
973d6b5869 Removed 'unhandled data packet' debug message 2014-08-19 12:30:12 +02:00
40d2f8a373 Save level data automatically, closes #1927 2014-08-19 11:54:12 +02:00
b66f49dc5e Fixed infinite recursion when setting a block on an EmptyChunkSection 2014-08-19 11:37:02 +02:00
5c150f696c Fixed task not being freed from player on close 2014-08-19 11:31:23 +02:00
0246648a2c Possible solution for #1703 in-game action lag 2014-08-18 23:25:46 +02:00
532b12c6c0 Mycelium spreads like grass and MonsterSpawner breaktime added 2014-08-18 20:06:18 +02:00
34711dc346 Fixed #1889 Players drop their inventory when they die 2014-08-18 14:49:53 +02:00
3c231118a6 Fixed #1674 Wooden tools only craft with Oak wood 2014-08-18 14:43:08 +02:00
a816234ee8 Merge pull request #1917 from Yosshi999/patch2
creative & survival hotbar bugfix
2014-08-18 14:33:05 +02:00
baa34a7cca creative & survival hotbar bugfix
:P
2014-08-18 21:18:14 +09:00
daf1a8266d Merge pull request #1906 from PocketMine/MoreEvents
Added more events, API 1.3.0
2014-08-18 13:55:35 +02:00
4e6ff81674 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-08-18 13:51:21 +02:00
84a1b319c8 Modified chunk generation garbage collector 2014-08-18 13:49:43 +02:00
16774e66e6 Fixed crashes when default level is not loaded 2014-08-18 13:42:20 +02:00
67b97ade8b Workaround crash when placing paintings 2014-08-18 13:36:59 +02:00
0f04f4bc8a creative & survival hotbar bugfix 2014-08-17 21:55:31 +09:00
4c7b172cbe creative & survival hotbar bugfix
Supports Air
Bug fix
2014-08-17 21:51:32 +09:00
e91781cbf2 EndPortal, EndStone, MonsterSpawner, Mycelium and Podzol blocks added 2014-08-17 02:00:17 +02:00
cf0dc95a76 Merge pull request #1910 from Falkirks/master
Improve behaviour of showPlayer()
2014-08-16 20:26:56 +02:00
9fa7b9b5ea Fixed indent 2014-08-16 11:03:40 -07:00
badbe75d58 Check if player is online before showing 2014-08-16 11:00:57 -07:00
5eee4f9771 Fixed AddEntityPacket, added base Arrow 2014-08-16 16:37:57 +02:00
52d28795fa Added Villager spawn egg 2014-08-16 14:25:58 +02:00
c675605014 Added item activation, zombie spawn egg 2014-08-16 14:01:07 +02:00
758a6af678 Added Chiseled stone brick, red sand, end stone 2014-08-16 13:34:58 +02:00
6f30cd8a22 Removed PHP_VERSION constant on pocketmine namespace 2014-08-16 13:17:05 +02:00
8455e89784 Bump API version to 1.3.0 2014-08-16 13:08:46 +02:00
eee0eb5458 Added RemoteServerCommandEvent 2014-08-16 13:05:20 +02:00
7e4a191593 Added SignChangeEvent 2014-08-16 12:58:16 +02:00
8725ad522f Remove player unset limitations 2014-08-16 12:47:19 +02:00
a610a86579 Fixed #1901, EmptyChunkSection gets replaced by invalid Section 2014-08-16 11:54:08 +02:00
24134a06b8 Alternate chunk generation between multiple levels 2014-08-16 11:49:37 +02:00
de6f5309dc Fixed #1882 Race-condition on multiple world generation, causing lock of the geneartion thread 2014-08-16 11:18:26 +02:00
a2e231101e Added extra information to CONTRIBUTING.md about issue titles 2014-08-16 10:58:41 +02:00
918024e466 Load later plugins with custom loader, fixes API 2014-08-16 00:30:37 +02:00
9e74169d74 Better Anvil chunk loading 2014-08-15 17:04:16 +02:00
ec93ed3e3d Fixed crash on tile unloading 2014-08-15 16:37:39 +02:00
a7b44e3892 Stop submission of plugin syntax error crashes 2014-08-15 16:18:54 +02:00
31b92b392e Throw invalid event exception when a plugin tries to declare an abstract event 2014-08-15 16:15:12 +02:00
2f9494ed52 Fixed crash caused by a race condition on Query 2014-08-15 16:07:04 +02:00
7a5c583407 Throw exception when null chunk is passed to a Tile/Entity 2014-08-15 16:04:48 +02:00
f60e2860e8 Release strong weak references on close, closes #1883 2014-08-15 13:41:13 +02:00
9c95441402 Force despawn of players on quit 2014-08-13 20:43:46 +02:00
1f902d814e Move only own player from eye level 2014-08-13 20:25:43 +02:00
0ab3da88be Send player movements as direct packets 2014-08-13 19:32:25 +02:00
e6edace944 Move players from eye level, not top of head 2014-08-13 19:26:45 +02:00
3ee61d5ebb Improved chunk cache, clean invalid chunks 2014-08-13 19:21:42 +02:00
19d391b9b2 Added Exception handling on level loading 2014-08-13 10:48:53 +02:00
e462a89189 Order chunks to be generated 2014-08-13 09:51:43 +02:00
d616e73242 Fixed chunk sending 2014-08-13 09:41:13 +02:00
5ec6ccefda Merge pull request #1875 from KnownUnown/patch-1
Fixed AddMobPacket's Type - (is now int)
2014-08-12 19:34:42 +02:00
58d7599d6f Fixed AddMobPacket's Type - (is now int)
Thanks @Intyre!
2014-08-12 12:31:07 -05:00
0c5f920dfd Level formats can send chunks without creating an AsyncTask, API 1.2.1 (small fix, no changes) 2014-08-12 17:39:39 +02:00
67f6482c76 Implemented circular chunk sending 2014-08-12 17:30:01 +02:00
7b141b0b73 Remove head offset from client-side MovePlayerPacket 2014-08-12 17:16:31 +02:00
b17ce16262 Fixed RCON usage 2014-08-10 18:35:01 +02:00
fee7f5060b Made AsyncTask::onCompletion() implementation optional 2014-08-10 18:15:06 +02:00
76cd164aa4 Fixed source servers getting invalid AutoUpdater notifications 2014-08-10 13:25:15 +02:00
582f1540a7 Players are now moved using the head, closes #1842 2014-08-10 13:22:12 +02:00
4d7c953572 Possible fix for 'Invalid Chunk given' crash 2014-08-10 13:09:41 +02:00
06c01f14c6 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-08-10 12:28:03 +02:00
c43431c921 Fixed #1826 Block damage values were swapped in McRegion 2014-08-10 12:27:49 +02:00
4e1805ae02 Merge pull request #1859 from PEMapModder/patch-2
Update CONTRIBUTING.md
2014-08-10 12:09:32 +02:00
ac34b9eda0 Update CONTRIBUTING.md
PocketMine namespaces are all in lowercase letters.
2014-08-10 18:08:09 +08:00
3495c79c0c Fixed crashes related to ChunkEvent 2014-08-09 10:42:03 +02:00
77799d8f3d Fixed AsyncWorker includes 2014-08-08 18:06:07 +02:00
dfdf9ddb45 Merge pull request #1846 from milo1000/issue_1843
Issue 1843 - RCON worker threads synchronization corrected
2014-08-08 16:26:47 +02:00
86d423ae4d Hide timezone guess errors 2014-08-08 12:53:31 +02:00
eff454d103 Fixed AsyncWorker not getting the proper path and not using the correct class 2014-08-08 11:51:36 +02:00
51120fdd4f Added ThreadManager, removed PHP self-kill 2014-08-08 11:36:55 +02:00
5242e87026 Issue 1843 - RCON worker threads synchronization corrected 2014-08-07 10:19:23 +02:00
269a10fadd Modified Level and Chunk deprecated methods 2014-08-06 16:22:55 +02:00
232bf5ebe4 Modified Chunk provider saving 2014-08-06 16:22:49 +02:00
2904aa06ef Merge pull request #1838 from PEMapModder/patch-2
Fixes Position::fromObject() $strong parameter neglected
2014-08-06 11:12:53 +02:00
e10c70e776 A typo fix 2014-08-06 11:06:30 +08:00
2cead226db Fixes Position::fromObject() $strong parameter neglected 2014-08-05 23:45:09 +08:00
2784925a5e Merge pull request #1822 from LukeDarling/patch-1
fixed tell command so itdoesn'tlooklikethisanymore
2014-08-03 22:38:21 +02:00
d2a14e8303 fixed tell command so itdoesn'tlooklikethisanymore 2014-08-03 13:22:41 -04:00
071033ad5c Added new installer languages 2014-08-02 18:00:36 +02:00
1e3ed8640c Updated Installer wizard language 2014-08-02 17:54:48 +02:00
60a576e541 Added proper Entity->__toString() 2014-08-02 17:48:56 +02:00
eee7e659e9 Added ChunkLoadEvent, ChunkUnloadEvent, ChunkPopulateEvent 2014-08-02 17:19:33 +02:00
7ddfd4394d Merge pull request #1818 from 64FF00/master
Added getExecutor() and setExecutor() method to PluginCommand
2014-08-02 14:43:12 +02:00
f0f2eb9a01 ... 2014-08-02 10:17:27 +09:00
839f6621eb Added getExecutor() and setExecutor() method to PluginCommand
:D
2014-08-02 10:11:36 +09:00
7fcaa78de4 Catch uncatched thrown Exceptions to get useful backtraces 2014-08-01 17:04:16 +02:00
915443b508 Disabled chunk ticking until it is stable 2014-08-01 15:25:40 +02:00
e17a7005a1 Throw exception on invalid chunk 2014-08-01 14:33:50 +02:00
c1846e3bcf Improved chunk serialization 2014-08-01 13:22:48 +02:00
81feff6d0d Merge pull request #1813 from PocketMine/revert-1748-enabled-builtin-php
Revert "Enabled built-in PHP"
2014-08-01 12:50:05 +02:00
9b84d8c248 Revert "Enabled built-in PHP" 2014-08-01 12:49:53 +02:00
26ec562fbf Added worlds directive to pocketmine.yml to load extra worlds or use a plugin-provided generator 2014-08-01 12:24:08 +02:00
d10274ca7c Improved memory usage when chunks are saved/generated 2014-08-01 11:53:24 +02:00
7c68e42a86 Fixed chunk rotation on McRegion-based worlds 2014-08-01 11:52:13 +02:00
171de939cd Fixed crash on chunks that are used by an entity after generation 2014-07-31 20:05:07 +02:00
58bded4988 Merge pull request #1801 from PocketMine/McRegion
Added multiple level formats support, implemented McRegion
2014-07-31 19:28:39 +02:00
cb4a970631 Tuned generator to use a better way to process chunks, closes #1807 #1794 #1740 #1741 #1685 2014-07-31 19:27:01 +02:00
95b5979351 Removed SimpleChunk from generator, core, use binary representation of chunks 2014-07-31 14:28:17 +02:00
18d13fdc32 Added threaded chunk sending for all formats 2014-07-31 10:19:44 +02:00
1a442b793c Fixed Tiles/Entities not using the correct chunk type 2014-07-30 18:24:59 +02:00
765d4f30c7 Added caching to non-converted network chunks 2014-07-30 17:30:22 +02:00
2eced89e6f Do not send crash reports generated from a source PM installation 2014-07-30 17:05:46 +02:00
293102d8c4 Fixed typo, BLockLight -> BlockLight 2014-07-30 16:59:52 +02:00
25f5d409f1 Fixed loading invalid plugins crashing the server 2014-07-30 16:57:31 +02:00
4128b22e85 Reuse McRegion classes on Anvil 2014-07-30 16:38:56 +02:00
487ce00542 Correctly fixed #1659 PvP settings not working 2014-07-30 16:07:21 +02:00
a9cd03da2e Changed @williamtdr syntax 2014-07-30 16:05:36 +02:00
f5fee4c909 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-07-30 14:10:39 +02:00
016b08ecf2 Added block order detection, added support for non-sectioned level formats 2014-07-30 12:57:00 +02:00
3515a037c5 Merge pull request #1804 from PocketMine/revert-1760-patch-1
Revert API breaking changes "Remove similar player name check from the beginning limit"
2014-07-30 00:36:12 +02:00
d6e413e8ca Revert "Remove similar player name check from the beginning limit" 2014-07-30 00:34:54 +02:00
f991efd5bc Merge pull request #1803 from Falkirks/patch-1
Spelling on crashDump()
2014-07-30 00:12:08 +02:00
913c116e7b Spelling 2014-07-29 15:10:50 -07:00
8fafb85784 Added proper chunk saving in McRegion 2014-07-29 19:36:41 +02:00
b0aad89e7a Fixed a few typos in McRegion 2014-07-29 19:11:09 +02:00
ce018fd7c8 Bumped API version to 1.2.0 (backwards-compatible changes, related to level formats) 2014-07-29 18:55:27 +02:00
afe44e6c6f Added setting to select the default level format 2014-07-29 18:54:40 +02:00
e9311f5ceb Added base McRegion classes 2014-07-29 18:43:52 +02:00
b2978133f7 Added McRegion detection to Anvil 2014-07-29 17:21:07 +02:00
6b331535c6 Merge pull request #1748 from MinecrafterJPN/enabled-builtin-php
Enabled built-in PHP
2014-07-29 09:56:05 +02:00
3370052fac Do not send crash reports from non-phar plugins 2014-07-28 23:14:29 +02:00
7d8a961374 Throw exception when an invalid chunk is set as the parent of a Tile/Entity 2014-07-28 21:40:50 +02:00
e97139919a Added new exception when a plugin creates an orphaned PluginTask 2014-07-28 20:28:50 +02:00
81faddafb0 Fixed crash when using Level scheduled block update ReversePriorityQueue 2014-07-28 19:18:28 +02:00
d0936329aa Fixed crash reports using invalid lastError data 2014-07-28 15:41:13 +02:00
9124513584 Added RakLib version to crash information 2014-07-28 14:48:26 +02:00
e860c339e2 Fixed crash when cactus was updated 2014-07-28 14:46:52 +02:00
10c67a57a7 Added extra crash dump settings, added way to disable parts of it or change the host 2014-07-28 14:42:51 +02:00
b10e63b951 Removed debug values on Crash dump 2014-07-28 13:47:38 +02:00
409eeda6ee Added plugin crash detection 2014-07-28 13:20:13 +02:00
bf09c48d62 Fixed build number on crash dumps 2014-07-28 12:57:08 +02:00
aac646d343 Fixed full path phar on logs 2014-07-28 12:20:16 +02:00
ed90d58e32 Fixed crash when placing water or lava 2014-07-28 12:18:17 +02:00
e219f4784c Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-07-28 12:12:14 +02:00
b5a1c23c50 Moved rtfd documentation 2014-07-28 12:11:01 +02:00
14817df2c7 Merge pull request #1793 from Intyre/bug/inventory
player creative inventory bugfix
2014-07-28 11:36:32 +02:00
cc87064915 player creative inventory bugfix 2014-07-28 02:24:08 +02:00
aded24e6c6 Updated error path replace (again\!) 2014-07-27 23:05:49 +02:00
a95f8b45f1 Updated error path replace 2014-07-27 22:55:45 +02:00
7a3703d8b1 Fixed undefined $fullFile on CrashDump 2014-07-27 21:25:24 +02:00
ca59546ace Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-07-27 21:01:06 +02:00
2330f363bd Fix for thrown EmptyChunkSection modification exception 2014-07-27 20:54:28 +02:00
042861b51f Merge pull request #1790 from RobertClarke/patch-1
Small typo fix on main language file
2014-07-27 18:40:04 +02:00
98f42a936e Small typo fix 2014-07-27 17:36:40 +01:00
6d77b0883e Fixed getTrace() on crash with xdebug 2014-07-27 17:31:39 +02:00
f53d513894 Merge pull request #1789 from PocketMine/CrashDump
Added Crash Dumps and automatic reporting
2014-07-27 15:26:36 +02:00
e6e15ceffa Fixed typo in crash text 2014-07-27 14:09:34 +02:00
9d75baf212 Added automatic reporting 2014-07-27 14:00:00 +02:00
7b45df680e Added time and plugin cause 2014-07-27 12:39:38 +02:00
f93d5339bc Use correct syntax 2014-07-26 17:06:22 +02:00
677071e7cb Merge pull request #1782 from Yosshi999/master
Updated Stick crafting recipe to give x4
2014-07-26 16:22:12 +02:00
4fa6fb0546 Updated Stick crafting recipe to give x4 2014-07-26 22:48:41 +09:00
0ca614a2c3 Merge pull request #1781 from Intyre/versionbump
Support for MCPE v0.9.5
2014-07-26 15:47:59 +02:00
bdfa6c0bc5 link to docs added to README 2014-07-26 15:08:48 +02:00
ccb7e86cf1 changed version and protocol to support v0.9.5 2014-07-26 15:07:32 +02:00
03a970e91f Merge pull request #1777 from Striker209MPE/patch-5
Fixed an error related to AIR constant
2014-07-25 07:51:27 -05:00
b3e9bb8fec Fixed an error related to AIR constant
A E_NOTICE error happened: "Use of undefined constant AIR - assumed 'AIR'"

should be fixed
2014-07-25 11:44:08 +02:00
48b99486b0 Merge pull request #1775 from Intyre/docs
docs for pocketmine-mp.readthedocs.org
2014-07-25 07:03:06 +02:00
6921e6f2aa docs for pocketmine-mp.readthedocs.org 2014-07-25 06:58:57 +02:00
987f54ba08 Edit syntax to confirm with rest of document. 2014-07-24 15:13:12 -05:00
09ef1f1721 Merge pull request #1772 from Striker209MPE/patch-3
Fixed error with useBreakOn parameters
2014-07-24 15:11:59 -05:00
3eae7a1875 Fixed error with useBreakOn parameters
A E_RECOVERABLE_ERROR error happened: "Argument 1 passed to pocketmine\block\Block::getDrops() must be an instance of pocketmine\item\Item, null given

AND

A E_RECOVERABLE_ERROR error happened: "Argument 1 passed to pocketmine\block\Generic::onBreak() must be an instance of pocketmine\item\Item, null given

are fixed
2014-07-24 22:10:33 +02:00
21587ae3eb Merge pull request #1760 from PEMapModder/patch-1
Allow player names contained in existing online player list.
2014-07-23 09:48:11 -05:00
e5337d8949 Make Fire check more efficent - by @Tschrock 2014-07-23 09:46:30 -05:00
c92a1ba7fe Release similar player name check from the beginning
For example, some would like to write `map` for `pemapmodder`, and this is what existed in amai beetroot when we used `SQLite3::query("SELECT ... ALIKE")`.
2014-07-23 22:33:45 +08:00
2066e92f84 Revert "Proper Fire ID checking. Fix #1756."
This reverts commit cd943f52a1.
2014-07-23 09:08:18 -05:00
cd943f52a1 Proper Fire ID checking. Fix #1756. 2014-07-23 08:58:26 -05:00
c3424beda9 Revert "Update Level.php"
This reverts commit da9dfabae4.
2014-07-22 13:59:23 -05:00
b6506d1db8 Revert "Corrected parameters for setBlock()"
This reverts commit 2f3a011ed3.
2014-07-22 13:59:16 -05:00
4cec3e7e37 Merge pull request #1749 from Falkirks/patch-1
Fixed fire issue
2014-07-22 13:29:12 -05:00
2f3a011ed3 Corrected parameters for setBlock() 2014-07-22 07:05:13 -07:00
da9dfabae4 Update Level.php 2014-07-21 18:15:54 -07:00
4c83e9bb56 Update Level.php 2014-07-21 20:04:58 -05:00
090d159766 Enabled built-in PHP 2014-07-22 09:46:47 +09:00
14d86339fc Fixed previous error. 2014-07-21 18:27:50 -05:00
ccf34a9db8 #1745 part 2! 2014-07-21 15:29:40 -05:00
97af1b6008 Fix #1745 2014-07-21 13:02:24 -05:00
16d33b01f4 Fix #1663 2014-07-21 10:51:30 -05:00
fa318ce706 Merge pull request #1736 from swagking47/patch-5
Fix unintentional typo in InventoryTransactionEvent.php.
2014-07-21 10:15:19 -05:00
accea03d52 Merge pull request #1741 from PEMapModder/patch-6
Added count(Enum)
2014-07-21 10:10:40 -05:00
adcdf650a3 Added count(Enum) 2014-07-21 19:25:20 +08:00
e8e825322b Update InventoryTransactionEvent.php 2014-07-20 15:28:53 -04:00
1b36b10520 Merge pull request #1729 from PEMapModder/patch-5
Fixed wrong doccomment for Vector3::add()
2014-07-19 10:32:16 +02:00
0d37e96678 Fixed wrong doccomment for Vector3::add()
Yes I know it was me who wrote it wrong.
2014-07-19 11:59:31 +08:00
2448405e3a Fixed rcon password being shown 2014-07-18 11:58:39 +02:00
2e773a32ff Removed crash() 2014-07-18 11:55:24 +02:00
d8cba4f045 Implemented new crash dumps 2014-07-18 11:54:11 +02:00
07c1ed1c36 Moved pthreads check before its usage 2014-07-18 10:49:38 +02:00
d6711125a9 Bumped MCPE version to v0.9.4 2014-07-18 10:44:14 +02:00
b8802edd6d Only allow one thread per property, fixes #1668 2014-07-17 21:22:48 +02:00
71bf984e9e Better fix for shared STONE constant, closes #1711 2014-07-17 21:20:15 +02:00
9c9d786194 Fix #1659 2014-07-16 13:07:26 -05:00
bd2cb4b851 Fixed #1614, possible solution for #1678 2014-07-15 13:17:29 +02:00
6e77901453 Fixed inventory being sent before spawning 2014-07-14 16:54:29 +02:00
ebe8a902e5 Fixed being killed on teleport 2014-07-14 15:55:16 +02:00
304524f6d8 Fixed crash on /stop 2014-07-14 14:41:19 +02:00
cb879977d2 Use Player::getDisplayName() on more commands 2014-07-14 14:12:03 +02:00
096e238242 Fixed #1628 invalid sender x,y,z on /spawnpoint, closes #1671 2014-07-14 14:07:43 +02:00
f2d5daffc0 Whoops, Markdown spacing issue 2014-07-14 20:23:46 +09:30
12275125d2 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-07-14 12:48:09 +02:00
3d3b6826e4 Merge pull request #1669 from sekjun9878/master
Android issues to the correct repo @PEMapModder
2014-07-14 20:18:20 +09:30
3a8adfe2b8 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-07-14 12:47:34 +02:00
14116b6730 Android issues to the correct repo @PEMapModder 2014-07-14 20:17:30 +09:30
241d3d72af Merge pull request #1664 from sekjun9878/master
Issue Tracking Guidelines
2014-07-14 12:47:11 +02:00
79e864f4f1 Added far-generated loaded chunk to garbage collection 2014-07-14 12:46:03 +02:00
7812a3c4fc Added Won't Fix and Invalid as per @shoghicp's suggestion. Renamed PR: RFC to PR: Contribution 2014-07-14 20:15:26 +09:30
dbe5e9b4e9 Remove informal language from Contributing Guidelines 2014-07-14 17:25:28 +09:30
d743888b8d Issue Tracking Guidelines 2014-07-14 17:11:25 +09:30
0db009b08f Improved chunk generation queue 2014-07-14 03:10:25 +02:00
7cdf5a73eb Bumped MCPE version to 0.9.1 2014-07-14 02:21:04 +02:00
6c442551f7 Fixed client crashing (temp.), fixed clients not spawning. (Fixes #1640 #1636 #1590 #1573) 2014-07-14 02:19:14 +02:00
eccd82ca4b Moved player attack filter from Living to Player 2014-07-13 19:04:00 +02:00
6fbfa1836f Merge branch 'master' of https://github.com/PocketMine/PocketMine-MP 2014-07-13 22:04:41 +09:30
5dfb1fb9d5 Fix bug where a double quote would show when kick reason is not specified. 2014-07-13 22:03:54 +09:30
4a615f03b5 Merge pull request #1649 from PEMapModder/patch-2
Added doccomment for Vector3::add() and Vector3::subtract()
2014-07-13 12:26:46 +02:00
47503d84c2 Added doccomment for Vector3::add() and Vector3::subtract()
This is to avoid IDEs thinking that argument 1 for `Vector3::subtract()` must be an int. (But the fact is `Vector3` is OK too)
2014-07-13 13:43:09 +08:00
fdb7fa36b8 Fixed #1641 2014-07-13 01:10:16 +02:00
e29ddadd2f Fixed #1642 2014-07-13 01:04:10 +02:00
d2ed0aa9f0 Merge pull request #1634 from PocketMine/timings
Implemented Timings
2014-07-12 19:30:41 +02:00
a7944502cd Added small things 2014-07-12 19:27:51 +02:00
063d14ba63 Merge pull request #1638 from KnownUnown/master
Fix formality mistake
2014-07-12 18:42:11 +02:00
35ea9708a5 Fix formality mistake
Contractions such as "I've" should not be used in formal writing.
2014-07-12 11:36:03 -05:00
9a4ead54e3 Added more timings 2014-07-12 15:23:06 +02:00
0d55d5c653 Fixed typo 2014-07-12 14:36:22 +02:00
94bc817756 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-07-12 14:18:12 +02:00
52b0e8b1ee Updated RakLib, fixes random upload increase 2014-07-12 14:17:35 +02:00
9bdd294a66 Implemented global, tasks timings 2014-07-12 14:09:29 +02:00
0bfa9506d1 Updated API version to 1.1.0 (backwards-compatible) 2014-07-12 02:26:41 +02:00
67b0c4bc2e Added base timings 2014-07-12 02:26:06 +02:00
dd729ced68 Revert "Possible fix for #1628"
This reverts commit a6e22de6a3.
2014-07-11 10:21:58 -05:00
a6e22de6a3 Possible fix for #1628 2014-07-11 10:19:28 -05:00
7624eda7b1 Update damage sources for creative mode players 2014-07-11 16:24:04 +02:00
5e47dda0a8 Enable death through void, suicide 2014-07-11 09:18:15 -05:00
61043d2e0d Fix #1615
Players in creative cannot die from non-magic (plugin/console) causes.
2014-07-11 09:14:49 -05:00
3e882ef40d Revert "Fix #1615"
This reverts commit a8359f29a8.
2014-07-11 09:12:19 -05:00
a8359f29a8 Fix #1615
Players in creative cannot die from non-magic (plugin/console) causes.
2014-07-11 09:07:24 -05:00
167ee97569 Fix kick command broadcast message. 2014-07-11 22:14:57 +09:30
53214005cd Kick message reflects Vanila MCPC not Bukkit 2014-07-11 22:05:50 +09:30
6e74bb7faf Kick reason grammar 2014-07-11 21:52:57 +09:30
f60fdb5e61 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-07-11 12:47:19 +02:00
4bd2f3aea8 Use the world spawn by default for players, fixes #1616 2014-07-11 12:45:43 +02:00
dcba580115 Merge pull request #1626 from PEMapModder/patch-2
Fix #1622 /kick on unknown players crashes the server
2014-07-11 12:16:44 +02:00
63008c4ebb Fix #1622 2014-07-11 17:24:25 +08:00
c16f45ce39 Fixed unsigned fields being read as signed 2014-07-11 02:55:29 +02:00
f2fa13119a Added upload/download speed on title bar, referenced ChunkRequestTask 2014-07-11 02:23:40 +02:00
756a8fead6 Fixed #1604 2014-07-11 01:34:49 +02:00
7ed6ac2341 Fixed #1609 2014-07-11 01:18:37 +02:00
4a072b4163 Better chunk unload queues 2014-07-11 01:15:52 +02:00
91b2f81f3c Updated RakLib version 2014-07-11 00:53:48 +02:00
5c826cb9ab Fixed /list not showing the proper player count 2014-07-10 20:40:56 +02:00
20b0df4b57 Added deprecation warning on plugin events 2014-07-10 17:39:20 +02:00
1fab6bd589 Added settings.query-plugins setting 2014-07-10 17:24:12 +02:00
7dd4a843c6 Fixed #1598 spawning on a index-corrupted Anvil chunk 2014-07-10 16:52:59 +02:00
828f7f1590 Fall damage is now working 2014-07-10 16:16:11 +02:00
c9535162bd Added more damage sources 2014-07-10 14:02:56 +02:00
99c5ad789b Improved entity attack push 2014-07-10 13:29:29 +02:00
e6c510e7fd Fixed #1595 Undefined variable on QueryHandler 2014-07-10 13:15:24 +02:00
d3789d4fed Fixed /kick player name 2014-07-10 13:05:15 +02:00
8fbc63c14e Fixed /kill player name 2014-07-10 13:05:04 +02:00
4d0b184ca4 Fixed #1591, handle player disconnect and level change killing 2014-07-10 12:35:19 +02:00
589fde27c0 Reorder chunk unloading to leave chunks in memory for the GC time before removal 2014-07-10 01:32:18 +02:00
6cb55da9c7 Added correct save parameters to chunk unloading 2014-07-10 01:30:59 +02:00
0251ae93d8 Fixed #1578 Chunk garbage collection not marking chunks as unused 2014-07-10 01:17:51 +02:00
5b69f07a55 Tuned CPU usage on main lop and RakLib 2014-07-09 23:39:25 +02:00
9604907566 Fixed #1584 duplicated death messages 2014-07-09 20:25:40 +02:00
1f882f42d3 Save and restore entity health 2014-07-09 20:23:58 +02:00
981796fd4c Fixed #1583 not repeated Tasks getting repeated 2014-07-09 20:07:35 +02:00
3e53ecdfb3 Merge pull request #1585 from PEMapModder/master
Let plugin enable/disable events extend PluginEvent
2014-07-09 19:28:13 +02:00
cd324c3247 Let plugin enable/disable events extend PluginEvent 2014-07-10 00:40:16 +08:00
99d4ff5bdb Merge remote-tracking branch 'origin/master' 2014-07-09 18:43:33 +09:30
88bcaea292 Fixes #1570. Removed isValidPharFilename check as the function is very unreliable. 2014-07-09 18:42:57 +09:30
ff90b83a9f Merge pull request #1581 from PEMapModder/patch-1
Update cause of lava and fire damage
2014-07-09 16:38:12 +09:30
f3079f8444 Update cause of lava and fire damage 2014-07-09 14:40:50 +08:00
65523972c2 Implemented health, events, damage, motion push 2014-07-06 23:10:11 +02:00
25ecdcf6e2 Fixed physics BoundingBox 2014-07-06 12:59:41 +02:00
6b361389ad Fixed mirrored chunk sending 2014-07-06 12:36:23 +02:00
643a4c1ef5 Fixed motion, physics 2014-07-06 12:08:05 +02:00
0503adc08c Fixed PHP installation reading wrong php.ini 2014-07-06 02:40:13 +02:00
892119f791 Updated RakLib version, Query works again 2014-07-06 01:19:09 +02:00
1b6fcf7942 Added LevelLoadEvent 2014-07-06 00:07:42 +02:00
cbbdb42092 Added LevelUnloadEvent 2014-07-06 00:06:03 +02:00
81492acb0c Added LevelSaveEvent 2014-07-06 00:02:27 +02:00
6576c88a08 Added LevelInitEvent 2014-07-06 00:01:05 +02:00
637d9da5a6 Fixed worker pool AsyncTask storage 2014-07-05 22:02:14 +02:00
22552cdd72 Improved chunk sending, moved chunk encoding and compression to another thread 2014-07-05 20:41:44 +02:00
417cb94ea3 Use chunk unload queues in Level 2014-07-05 16:28:49 +02:00
4db97a007c Fixed typo on updater 2014-07-05 14:05:56 +02:00
519922b550 Improved chunk ticking 2014-07-05 14:05:39 +02:00
962847ffdf Merge pull request #1561 from PEMapModder/patch-1
Fix HandlerList.php wrong var name
2014-07-05 12:04:13 +02:00
b18783a0e7 Fix HandlerList.php wrong var name 2014-07-05 11:48:13 +08:00
5a8e6619e9 Fixed start.sh script 2014-07-04 01:07:40 +02:00
6b45c16a38 Added quotes to start.sh 2014-07-03 20:02:35 +02:00
8b2440ff96 Fixed ServerScheduler::addTask() period 2014-07-03 19:35:59 +02:00
32f67d7187 Updated build script 2014-07-03 13:52:48 +02:00
43635b501a Made logging better, plugin loggers can be attached by others 2014-07-02 23:33:29 +02:00
aa85993634 Made Server::getLogger() return a AttachableThreadedLogger 2014-07-02 23:23:33 +02:00
2f4fe4751c Merge pull request #1555 from PocketMine/LoggerAttachment
Implement LoggerAttachment (fixes #1547)
2014-07-02 23:13:22 +02:00
c8dd8f02eb Finished #1555 todo list 2014-07-02 23:11:39 +02:00
6c116678d7 Added autoloading of base namespace classes 2014-07-01 23:34:24 +02:00
75d2409a7c Added ThreadedLoggerAttachments 2014-07-01 20:50:51 +02:00
f7c23e89f0 Added move block while being teleported after spawning 2014-07-01 01:19:24 +02:00
f5a74a87e3 Updated composed packets 2014-07-01 01:11:09 +02:00
d4881260da Added check for registered alias command, useful when overriding 2014-06-30 21:14:00 +02:00
6d6059b61f Updated for new build 2014-06-30 21:07:27 +02:00
75bf3023a7 Swapped link order 2014-06-30 17:36:26 +02:00
f62cbcbcfa Removed -Wl,-Bstatic on Android 2014-06-30 17:32:27 +02:00
e5d8993d67 Changed library link order for Android 2014-06-30 17:29:19 +02:00
7bcc6d10b8 Enable assembly on cross-compile 2014-06-30 16:33:43 +02:00
308430c28d Disabled assembly on GMP 2014-06-30 16:03:40 +02:00
692a4fb57b Fixed reason on kick message 2014-06-30 01:17:55 +02:00
3fd18ca4af Updated installer PHP version 2014-06-30 00:53:48 +02:00
ca3fc33708 Added LDFLAGS to Android 2014-06-29 20:55:34 +02:00
e4bc9611f6 Compile GMP and mcrypt statically 2014-06-29 20:43:49 +02:00
3184a8e7d5 Added DNS lresolv MacOS 2014-06-29 18:24:09 +02:00
ff91113b81 Added flock_type patch for MacOS 2014-06-29 18:02:21 +02:00
f02fc664ba Removed ./buildconf for mcrypt (fails on MacOS) 2014-06-29 17:42:28 +02:00
e504421515 Added realloc env. variables for ARM to compile script 2014-06-29 17:33:31 +02:00
b80bae3352 Added realloc patch for ARM to compile script 2014-06-29 17:30:01 +02:00
311961f3aa Export compat. variables for malloc in compile script 2014-06-29 17:24:45 +02:00
1aa45500c0 Fixed mcrypt and malloc 2014-06-29 17:17:34 +02:00
58df00fa86 Fixed mcrypt having older config files 2014-06-29 17:10:20 +02:00
67baaf5308 Fixed GMP ABI 2014-06-29 17:04:22 +02:00
f20c862123 Fixed syntax error in compile script 2014-06-29 17:00:01 +02:00
a321aeca96 Compile fixes 2014-06-29 16:53:16 +02:00
487015d332 Updated to PHP 5.5.14, updated OpenSSL, updated cURL, added mcrypt and GMP to compile scripts 2014-06-29 16:28:18 +02:00
b064f1e71a Removed collision check crash on Slab 2014-06-28 02:38:04 +02:00
2ec0d86126 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-06-27 23:26:46 +02:00
cc36f8f997 Fixed kick messages 2014-06-27 23:26:35 +02:00
44f8541331 Merge pull request #1544 from Darunia18/patch-1
Update Explosion.php
2014-06-27 13:44:13 +02:00
87308d1c51 Update Explosion.php
Fixed bugs on lines 75 and 141.
2014-06-27 02:45:32 -04:00
84f9516f24 Merge pull request #1542 from MCMrARM/master
Fixed PlayerMetadataStore
2014-06-26 21:15:03 +02:00
fadf1a5d40 Fixed PlayerMetadataStore 2014-06-26 21:12:03 +02:00
401d7342dd Added nether reactor block to classes 2014-06-26 12:09:38 +02:00
7067c09228 Removed old code 2014-06-26 12:03:29 +02:00
3abec0a3c0 Modified Level::useBreakOn() to use events for creative block breaking 2014-06-26 12:03:02 +02:00
c2d760e6d9 Added RotateHeadPacket 2014-06-25 23:09:22 +02:00
de5e9df82b Fixes for chat formatting 2014-06-25 22:32:57 +02:00
b506ab349f Fixed TextFormat::toJSON() on nested formatting 2014-06-25 22:20:50 +02:00
e2f7cf61e3 Added TextFormat::toJSON() 2014-06-25 21:57:34 +02:00
03b1385f26 Fixed teleport command with a single target not teleporting correctly 2014-06-25 20:58:59 +02:00
2302a37311 Updated for build 9 2014-06-25 20:50:22 +02:00
9877271d70 Fixed kick messages 2014-06-25 20:50:16 +02:00
873e35f416 Fixed SendUsageTask 2014-06-25 13:06:44 +02:00
80aebf2932 Added AsyncTask::onCompletion() 2014-06-25 13:01:39 +02:00
f9d9d2b0e5 Updated for build 8 2014-06-25 02:21:25 +02:00
c8ee1da262 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-06-25 02:06:05 +02:00
79cc6ca559 Multiple fixes 2014-06-25 02:03:58 +02:00
a299b5f904 Update Furnace.php 2014-06-24 17:41:37 +02:00
fd9fdc30cb Allow changing gamemode without restarting the game (buggy) 2014-06-24 12:38:01 +02:00
ecbfff9b0f Added force-gamemode property 2014-06-24 12:18:51 +02:00
0e679139d2 Merge pull request #1532 from PEMapModder/patch-1
Fixed undefined variable $name notice for /pardon
2014-06-24 11:49:22 +02:00
f30922f439 Fixed undefined variable $name notice for /pardon 2014-06-24 17:48:32 +08:00
c775c3905d Added ServerCommandEvent::getSender() 2014-06-24 11:25:51 +02:00
a4593d4668 Fixed #1531 2014-06-23 23:24:27 +02:00
df68853c76 Fixed #1530 Container tiles not getting imported right when they are empty 2014-06-23 22:40:14 +02:00
88157d6e99 Added workaround for #1527 2014-06-23 22:35:02 +02:00
22533458ed Updated for MCPE 0.9.0 build 7 2014-06-23 21:50:07 +02:00
38a958ed08 Fixed #1526 $player->getPosition() returns a WeakRef error 2014-06-23 16:31:22 +02:00
396a3ff225 Limited block change packets to players using that chunk 2014-06-23 16:09:51 +02:00
bcb401c0c3 Added yaw/pitch on spawn 2014-06-23 16:07:59 +02:00
4b3addb8a0 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-06-23 15:26:51 +02:00
7cfeeae413 Send held item when changed 2014-06-23 15:26:20 +02:00
31a7410acd Fixed players and entities getting despawned 2014-06-23 15:25:44 +02:00
6c8f189499 Merge pull request #1525 from PEMapModder/patch-1
Fix /plugins crash
2014-06-23 14:00:26 +02:00
2e50fbbda4 Fix /plugins crash 2014-06-23 19:27:27 +08:00
fd4fc4ff94 Fixed Entity & Player loaded chunk indexes 2014-06-23 11:57:47 +02:00
496c004efc Changed default view-distance 2014-06-22 23:25:43 +02:00
6f9becdbb3 Added Empty chunk detection 2014-06-22 22:29:46 +02:00
36cdfd969d Fixed #799 Added Grass growth algorithm 2014-06-22 22:26:36 +02:00
0be2bd911f Fixed block updates not getting broadcasted 2014-06-22 21:56:58 +02:00
0e36107878 Fixed update ticks 2014-06-22 21:32:49 +02:00
279a438ae6 Fixed spawning of Tile entities via chunk packets 2014-06-22 18:05:42 +02:00
0d5eb149ab Fixed Level not saving chunks on auto save 2014-06-22 16:20:00 +02:00
557618c87d Fixed Level not saving chunks on unload 2014-06-22 16:15:37 +02:00
e0dda934ec Fixed Anvil region indexes in setChunk() 2014-06-22 16:15:23 +02:00
21f764590b Changed chunk-sending.per-second to chunk-sending.per-tick 2014-06-22 15:46:42 +02:00
bf49cafeae Added settings.async-workers to tune the amount of AsyncTask workers 2014-06-22 12:55:08 +02:00
7f795bc041 Fixed #1501 executing AsyncTasks blocks other threads 2014-06-22 12:50:24 +02:00
e381313747 New player chunk load queues with ACK notification 2014-06-21 19:41:06 +02:00
be0a31697a Fixed Double Chest inventory holder 2014-06-21 19:16:33 +02:00
14c558163e Updated languages 2014-06-21 18:21:16 +02:00
57437d3a06 Updated for MCPE 0.9.0 build 6 2014-06-19 17:26:03 +02:00
a0ce4b1d01 Updated Sign crafting recipe to give x3 2014-06-19 17:25:34 +02:00
a0ac660d57 Throw exception when a plugin tries to change the cancel event of a non-Cancellable event 2014-06-18 19:36:32 +02:00
825656feed Fixed installer language strings, bumped MCPE build to 5 (already compatible) 2014-06-18 19:23:14 +02:00
89a90c00fd Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-06-18 18:29:24 +02:00
83081456f2 Merge pull request #1508 from LegendOfMCPE/master
Fixed Explosion.php WeakRef issue
2014-06-18 18:28:32 +02:00
20e419a9c4 Fixed Explosion.php WeakRef issue 2014-06-18 11:42:41 +08:00
dda57f7b0f Signs can be placed again. TODO: spawn tile entities after chunk has been received and ACKed 2014-06-17 19:48:14 +02:00
85007a9dfe Fixed NBT compression, Anvil generated worlds are readable by Minecraft and other tools 2014-06-17 19:32:09 +02:00
f073a5b837 Fixed a few things 2014-06-17 18:46:16 +02:00
9e8f015dc0 Changed commands to use CommandSender::getServer() 2014-06-17 18:41:10 +02:00
f14fecbb5f Added /time command 2014-06-17 18:36:39 +02:00
b27637c926 Fixed default kick message 2014-06-17 17:27:17 +02:00
552c934486 Merge pull request #1506 from PEMapModder/master
Multiple permissions checked in Server::getInstance()
2014-06-17 16:15:39 +02:00
f202c9902a Multiple permissions checked in Server::getInstance()
This is done like the one in `Command::testPermissionSilent()`, where permissions are connected via semicolons (`;`) and they are checked with `OR`, where the player must have at least one permission to read.
2014-06-17 22:14:15 +08:00
3bd33a129f Added Player::getRemoveFormat() and Player::setRemoveFormat(bool) to choose showing colors in chat and nametags 2014-06-17 15:54:06 +02:00
79bc42c995 Added Player::getNameTag() and Player::setNameTag($name) 2014-06-17 15:28:57 +02:00
032710a2de Added integrated command aliases 2014-06-17 15:21:06 +02:00
e8cc52f99e Added chunk-sending.compression-level property 2014-06-17 14:34:14 +02:00
266b78aa31 Fixed warning on TickScheduler thread 2014-06-16 23:20:21 +02:00
8a89aee75d Added method to get info from the AutoUpdater 2014-06-16 23:20:07 +02:00
169c55443a Fixed #1213 2014-06-16 23:00:54 +02:00
77e914238c Fixed updater 2014-06-16 20:17:32 +02:00
73b9b2491f Added custom settings, update notification 2014-06-16 19:34:47 +02:00
89c61bb05e Fixed #1500 blocks cannot be placed in creative mode 2014-06-16 17:01:34 +02:00
6983ddf509 Added new implemented blocks to Creative menu 2014-06-16 16:41:49 +02:00
8bc3ff5726 Added Emerald ore, Emerald, Emerald block 2014-06-16 16:24:09 +02:00
b4e502be13 Added Diorite, Granite, Andesite, and polished versions 2014-06-16 16:16:21 +02:00
778ec96d72 Added Hardened Clay and Stained Clay 2014-06-16 16:02:01 +02:00
28926832df Added new Wood slabs, stairs, crafing recipes 2014-06-16 15:46:45 +02:00
b3820bedbc Added Acacia wood and Dark Oak wood 2014-06-16 15:30:43 +02:00
6722540bdc Added Red sand 2014-06-16 15:25:30 +02:00
2d5e98b6a3 Added new Saplings 2014-06-16 15:23:40 +02:00
bbb69429f3 Fixed setting biome color 2014-06-16 03:32:55 +02:00
e47198deaf Fixed Level methods 2014-06-16 03:14:18 +02:00
36ddbc6cb4 Fixed setBiomeColor() bug 2014-06-16 01:20:53 +02:00
a371890962 Fixed Chest and Furnace placing, Furnace open 2014-06-16 00:30:51 +02:00
e1c0976927 Fixed block placing in creative mode 2014-06-16 00:19:46 +02:00
40bf7fd22a Fixed player being kicked on death 2014-06-16 00:01:09 +02:00
214de28808 Player join message will be only shown if not empty (modified by plugins) 2014-06-15 23:53:31 +02:00
530b81674b Updated RakLib, improved network stream 2014-06-15 23:39:05 +02:00
e6224be46f Faster generation, ticks catch up when slower 2014-06-15 16:54:28 +02:00
ed5325c069 Fixed setting chunks on non-loaded regions 2014-06-15 14:50:49 +02:00
a5e78d775b Temp. fixed /status 2014-06-15 00:23:17 +02:00
c4673addf7 Added server-side join message (removed from client-side MCPE) 2014-06-15 00:14:28 +02:00
cb1c4da4ea Fixed chunk unload on level change 2014-06-15 00:07:21 +02:00
6f36e9af24 Fixed chunk unloading on same level 2014-06-15 00:03:35 +02:00
6977833b1a Fixed thread generator crashing, added thread generator garbage collector, fixed generation queues 2014-06-14 23:59:31 +02:00
30318569e1 Fixed player spawnpoint not being restored 2014-06-14 22:15:07 +02:00
429f7ffe8d Fixed SimpleChunk metadata 2014-06-14 22:11:19 +02:00
4354d76cae Fully fixed metadata sending 2014-06-14 21:44:02 +02:00
f3e6c726b0 Added BlockMetadataStore to Level and Block 2014-06-14 20:06:42 +02:00
694ccf2bc5 Fixed /reload 2014-06-14 18:46:40 +02:00
392f0110bb Updated build number 2014-06-13 23:26:52 +02:00
b0775e3e0c Fixed EntityMoveEvent cancellation for Player 2014-06-13 21:59:10 +02:00
ab2fb24fe5 Fixed PluginEvent 2014-06-13 20:15:53 +02:00
cbaeec54ff Added biomeIds and biomeColors to Anvil format 2014-06-13 20:04:07 +02:00
20759dcf07 Fixed block data network sending (Anvil::getBlockDataColumn() 2014-06-13 19:10:12 +02:00
189accc0d6 Fixed furnace processing bug 2014-06-13 18:45:53 +02:00
4e075987ab Merge pull request #1487 from PocketMine/master
Fixed FurnaceInventory crash
2014-06-12 17:53:55 +02:00
303c947d2a Fixed FurnaceInventory crash 2014-06-12 17:43:46 +02:00
b6ef52e89c Updated Normal generator 2014-06-11 00:29:01 +02:00
109b6dbf44 Updated to v0.9.0 build 2, now using Anvil worlds 2014-06-11 00:06:46 +02:00
fa50cbf4b3 Working Threaded Generation 2014-06-10 20:45:09 +02:00
392eb74901 Merge branch 'Level-Rewrite' into 0.9.0 2014-06-10 16:08:34 +02:00
5f163133ee Added grass color test 2014-06-10 15:24:33 +02:00
9be231fbca Made levels infinite 2014-06-10 15:05:59 +02:00
b6caad289d Faster chunk loading 2014-06-10 11:27:30 +02:00
3fbc411e17 0.9.0 clients can join 2014-06-09 23:47:09 +02:00
fb46faa320 Updated protocol changes from MCPE-6865 2014-06-09 15:19:24 +02:00
c180534f21 Bump protocol version 2014-06-09 11:52:12 +02:00
926e7ac0b1 Disabled Travis CI 2014-06-09 11:49:52 +02:00
409efcbb03 Updated raklib 2014-06-09 11:43:20 +02:00
115b4cf4ac Updated Levels :D 2014-06-09 11:35:52 +02:00
920e2a7c7e Merge branch 'Level-Rewrite' 2014-06-07 23:33:49 +02:00
2566f2c4cb Worked on chunk loading 2014-06-07 22:29:45 +02:00
d8f9f9231f Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-06-07 04:22:07 +02:00
93b236811a Updated RakLib 2014-06-07 04:22:00 +02:00
e4c7564e3e Delete mainLogger.php 2014-06-07 04:20:03 +02:00
41fe4a527a Update MainLogger.php 2014-06-07 04:19:19 +02:00
1c20fcc8c7 Fix for log file 2014-06-06 02:23:14 +02:00
5355a95d1d Fix for player->CID 2014-06-06 02:22:53 +02:00
e37b731e88 Fixed player block breaking 2014-06-05 18:27:50 +02:00
370a1a0041 Fixed seed generation 2014-06-05 18:13:33 +02:00
310ebb9817 Fixed timeout 2014-06-05 18:04:00 +02:00
fdc2edc421 Updated to new RakLib 2014-06-05 17:52:42 +02:00
c434961dfc Some fixes 2014-06-05 01:44:16 +02:00
ddf3e149c9 Merge branch 'Core-Rewrite'
Conflicts:
	src/API/PlayerAPI.php
	src/build/compile.sh
	src/build/jenkins.sh
2014-06-05 01:39:43 +02:00
3c4e35ff8d Updated default PHP version 2014-06-05 01:23:24 +02:00
2674902eaa Preparing to merge 2014-06-05 01:22:04 +02:00
596f4ddb0e Added lots of new events, enabled old features 2014-06-05 01:05:52 +02:00
2b73da5412 Added Animation 2014-06-05 00:41:24 +02:00
9884fe6473 Updated RakLib 2014-06-05 00:31:36 +02:00
2877f026ec Added item drop 2014-06-05 00:31:16 +02:00
99a0117a33 Implemented RakLib 2014-06-04 20:29:25 +02:00
cce9499a61 Merge branch 'Core-Rewrite' of github.com:PocketMine/PocketMine-MP into Core-Rewrite 2014-06-04 17:09:53 +02:00
905d572d42 Added RakLib library 2014-06-04 17:08:09 +02:00
e4cdfdf6e9 Update Logger 2014-06-04 02:15:29 +02:00
ea9e0b917b Moved $EXTRA_FLAGS 2014-06-04 02:07:38 +02:00
a76f56d0a9 Update compile.sh 2014-06-04 02:04:18 +02:00
ee0ab63202 Updated PHP version 2014-06-04 02:02:15 +02:00
2f6f851715 Updated PHP version 2014-06-04 02:00:48 +02:00
97f3959e83 Check for class loaded on SplClassLoader 2014-06-03 19:24:34 +02:00
ff48b0be53 Fixed Loggers 2014-06-02 22:59:56 +02:00
24d95fb7fd Added \ThreadedLogger abstract class 2014-06-02 14:47:38 +02:00
a17d847a82 Moved Logger interface to root 2014-06-02 14:41:43 +02:00
857c79cc05 Update pointer to track master 2014-06-01 02:24:26 +02:00
35551246d2 Linked PocketMine-MP GUI submodule 2014-06-01 02:18:15 +02:00
5117bbf7f4 Fixed ContainerSetContentPacket being spammed before join 2014-05-30 01:26:57 +02:00
0925898d8d Temporal fix for extra commit spam due to bug 2014-05-30 00:31:35 +02:00
325bcc367d Fixed motion update spam 2014-05-29 23:07:48 +02:00
97a687c03a Replaced PHPDoc on Config 2014-05-29 20:19:15 +02:00
c6632da159 Removed debug code from player data saving 2014-05-29 18:48:38 +02:00
96445c4613 Fixed item in hand in creative mode, player files are now readable by Minecraft PC 2014-05-29 18:45:49 +02:00
a45f8782b1 Fixed collision against other entities 2014-05-29 18:03:17 +02:00
61ce7f11d6 Implemented bounding box limits for item placing 2014-05-29 17:04:37 +02:00
49370c21d1 Removed locks from MainLogger 2014-05-29 04:11:20 +02:00
441b47e744 Fixed Logger getting paths relative to soruce code 2014-05-29 04:04:00 +02:00
8d40f843cf MainLogger can now have debug level disabled 2014-05-29 00:08:02 +02:00
7bd6f2ed91 Added Logger interface, threaded MainLogger and updated PluginLogger 2014-05-28 23:46:56 +02:00
9df56295f6 Removed debug message for Transactions 2014-05-28 19:44:50 +02:00
dafa4f1b1c Fixed null Items with id < 256 not working correctly 2014-05-28 17:58:09 +02:00
f66560ccd4 Update ContainerInventory on Transaction refused 2014-05-28 17:11:06 +02:00
f795a3f565 Fixed DroppedItems not being restored after save 2014-05-28 16:09:57 +02:00
130b2c4910 Fixed Chests and Furnaces not droping their contents when broken 2014-05-28 15:34:34 +02:00
c778e0467e Fixed touching items with an empty hand 2014-05-28 15:22:25 +02:00
70e340086d Fixed Inventory::addItem() not adding items properly 2014-05-28 15:08:07 +02:00
b9ec63f016 Fixed getting Entities by area 2014-05-28 14:41:09 +02:00
9aed430fda Added Furnace recipes 2014-05-28 00:29:36 +02:00
d5f160ea3d Added Stonecutter recipes 2014-05-27 23:59:59 +02:00
3ac60f9860 Added Normal and Big crafting recipes, fixed CraftingTransactionGroup count 2014-05-27 23:26:07 +02:00
6746987ce5 Added CraftItemEvent, Crafting system now uses Transactions 2014-05-27 17:49:22 +02:00
3fc1be1262 Fixed crash when removing Tiles 2014-05-27 16:15:23 +02:00
96b1831229 Fixed Tile entities not being read correctly 2014-05-27 16:02:03 +02:00
a669797ccb Fixed breaking Spawnable tiles and cancelling it 2014-05-27 12:12:45 +02:00
5e97da2e11 Added InventoryTransactionEvent 2014-05-27 01:56:25 +02:00
d92c5332da Added InventoryOpenEvent and InventoryPickupItemEvent 2014-05-27 01:44:56 +02:00
e1ccd7f9ea Added InventoryCloseEvent 2014-05-27 01:30:24 +02:00
6fcd5322d0 Implemented Transactions 2014-05-27 01:20:18 +02:00
160c633c08 Updated trigger_error to Exceptions, fixed bug in Plugin task deletion 2014-05-26 12:22:28 +02:00
ffa3e8a0aa Fixes for Chest & Furnace 2014-05-26 10:46:30 +02:00
274f972b58 Items can be picked up 2014-05-25 21:57:58 +02:00
03d7127e33 Finally, physics 2014-05-25 18:14:01 +02:00
933a28537b Fixed giving large amount of items, updated player inventory to correct size 2014-05-25 16:26:46 +02:00
4f2856dc09 Added base physics 2014-05-25 12:31:00 +02:00
ec055fd8d1 Items spawn, Tiles spawn, both are saved, blocks drop 2014-05-24 17:25:37 +02:00
f2dc9cdff7 Removed _ split from SplClassLoader 2014-05-24 17:25:02 +02:00
d8ea2e744f Added methods to add/remove Entities/Tiles from Levels 2014-05-24 13:49:58 +02:00
f9353a0ecd Fixed Events being called with reversed priority 2014-05-24 13:40:05 +02:00
abff932d8f Moved Entity::get() to Level::getEntity() and removed Entity::getAll() 2014-05-24 13:30:37 +02:00
ef6ca9d2cd Added Tile::saveNBT(), moved Player::broadcastPacket() to Server 2014-05-24 13:21:55 +02:00
1fd7e0431b Added CustomInventory, StoneCutter inventory type, network IDs, fixed viewer list bugs 2014-05-24 01:30:58 +02:00
f9103772c3 It works. (Inventory, windows, block placement) 2014-05-24 00:32:29 +02:00
5460ccf41c Server can be joined, again! (fixed weak references and blocks) 2014-05-23 23:12:15 +02:00
a2b3a4bb90 Removed not valid TimeCommand 2014-05-23 22:46:08 +02:00
683ab8d2cd Fixed invalid metadata and updated weak references on PluginManager 2014-05-23 22:30:37 +02:00
53749483c3 Implemented new Inventory windows on Player, Chest and Furnace 2014-05-23 20:53:06 +02:00
27e82ea60a Updated Inventory classes 2014-05-22 23:13:46 +02:00
48af130269 Fixed things 2014-05-22 20:48:17 +02:00
98e9b5594c Fixed slots overfilling (like on Armor slots) 2014-05-22 20:32:56 +02:00
9b950a98c7 Added BaseInventory 2014-05-22 20:25:58 +02:00
34c2510f0f Allow setting null damage on items 2014-05-22 19:33:10 +02:00
6cbd39de9b Added Inventory interfaces and types, updated long array() to [] 2014-05-22 18:59:16 +02:00
0be679c9d5 Updated method names: getMetadata() & setMetadata() to getDamage() & setDamage() on Block and Item classes 2014-05-22 18:37:28 +02:00
387677e957 Level rewrite middle step 2014-05-22 17:53:56 +02:00
c1546aac9c Updated Position to use Weak / strong references for Level objects 2014-05-22 04:14:06 +02:00
6328834681 Make PluginBase::getResource() return a file pointer instead of the file contents 2014-05-19 20:14:31 +02:00
99818a26f5 Added object metadata for Plugins, use WeakMap on perms 2014-05-19 20:07:27 +02:00
88f9347093 Updated PHP to 5.5.12 (added to jenkins.sh) 2014-05-19 18:11:38 +02:00
1fc475860d Updated PHP to 5.5.12, uopz to 2.0.4 2014-05-19 18:10:33 +02:00
e45bcf06fe Updated pthreads to 2.0.7, fixed WeakRef 2014-05-19 18:04:42 +02:00
29caf1363f Merge branch 'Core-Rewrite' of github.com:PocketMine/PocketMine-MP into Core-Rewrite 2014-05-19 17:34:30 +02:00
c15f05622e Added WeakRef as default extension 2014-05-19 17:33:04 +02:00
b9502b9c2c Merge pull request #1453 from onebone/Core-Rewrite
Added time command
2014-05-18 15:59:17 +02:00
3e575ad505 Added time command 2014-05-18 22:56:01 +09:00
f668a41f57 Merge pull request #1440 from PEMapModder/cr-br-6
Fixed a typo at PermissibleBase
2014-05-17 21:38:36 +02:00
dcd4af9dd0 Merge pull request #1451 from wiezz/patch-1
Little fix for generateLevel()
2014-05-17 21:38:23 +02:00
d01a82cf9f Little fix for generateLevel()
Check if $generator is the default value NULL instead of false
2014-05-17 21:34:27 +02:00
92169f4288 Fixed a typo
(Is this really a typo? But it seems so...)
2014-05-12 19:23:37 +08:00
c455c84d15 Update installer.sh 2014-05-04 17:59:30 +02:00
15c5dacab3 Removed old PluginManager::getInstance() 2014-04-28 01:42:20 +02:00
1001a47cd6 Typo fix to crash dump 2014-04-27 15:17:52 +09:30
46464eb504 Update installer.sh 2014-04-20 19:16:51 +02:00
1fd773486e Reverted to 03d46020ec 2014-04-20 18:11:13 +02:00
50c0bf424a Revert 25b98a5480 2014-04-21 00:50:20 +09:30
9644088b5d Added username sharding for player yaml saves. 2014-04-21 00:43:39 +09:30
25b98a5480 Merge branch 'master' of https://github.com/PocketMine/PocketMine-MP 2014-04-21 00:13:43 +09:30
3729c5b603 Faster aligned read/write 2014-04-14 12:34:57 +02:00
59392ac4e9 Fix small spelling typo. 2014-04-12 19:06:55 +09:30
346d267e4e Merge pull request #1387 from PEMapModder/patch-1
pocketmine\command\Command implements the __toString() magic method
2014-04-12 18:59:18 +09:30
e9aba34e6b Added /setworldspawn 2014-04-10 18:50:41 +02:00
1dc3d42b78 Working Anvil region format parsing 2014-04-10 16:52:53 +02:00
f23a05d42e Anvil garbage collector won't run if not needed 2014-04-10 06:02:33 +02:00
a1a1f1b8e4 Added Anvil in-place garbage cleaner 2014-04-10 05:58:31 +02:00
aa1de79337 New Chunk objects / structure, Anvil region loader [WiP] 2014-04-10 05:05:36 +02:00
abccfeac37 Updated Vector-related classes 2014-04-10 05:04:58 +02:00
9859333aae Edited tests since now everything goes faster 2014-04-09 04:16:17 +02:00
5ca4f50703 removed C extension by default 2014-04-09 04:10:12 +02:00
96e36dbcb3 better Binary 2014-04-09 04:09:39 +02:00
8da3aced07 Lowered microtime() 2014-04-09 03:17:47 +02:00
ab84be7f6a Added microtime() operation to benchmark 2014-04-09 03:16:48 +02:00
88fb84edc5 Lowered file operations 2014-04-09 03:05:25 +02:00
5e8ea04e52 Fixed tests and one-byte packet reading 2014-04-09 03:00:33 +02:00
3136c23795 Added small benchmark 2014-04-09 02:37:37 +02:00
366fa0e05d fixed version 2014-04-09 01:48:35 +02:00
42b34d55e0 fixed... 2014-04-09 01:41:30 +02:00
5070866fe0 Updated extension to 0.0.3 2014-04-09 01:12:56 +02:00
db15ae49a1 Updated to extension 0.0.2 2014-04-09 00:56:36 +02:00
71737c3e53 Added PocketMine native extension version 0.0.1 2014-04-08 22:08:35 +02:00
9fcbe2698a Modified compile flags 2014-04-08 17:42:54 +02:00
da5853083c crc fake random generator 2014-04-08 16:35:45 +02:00
1d40399b9c hacky things D: 2014-04-08 16:22:52 +02:00
d6f4e77b6c Another patch, added INT32_MASK 2014-04-08 16:05:27 +02:00
cb32a95e60 Why, PHP? 2014-04-08 15:52:34 +02:00
731fbbc8d1 Another 64-bit patch 2014-04-08 15:50:13 +02:00
29ab53a46f Patched... again 2014-04-08 15:46:32 +02:00
4c973ce625 Patched random generator on 64-bit 2014-04-08 15:43:13 +02:00
9d8e6d5f8c New Random generator 2014-04-08 15:41:32 +02:00
5abe5bd43d replaced binary with hexadecimal 2014-04-08 13:02:13 +02:00
89138ae4ce Added a few things 2014-04-08 13:00:52 +02:00
8d14c98da9 Fixed binary reading/writing of longs 2014-04-08 13:00:50 +02:00
669401afd4 Updated PHP extension version 2014-04-08 11:55:36 +02:00
8dbdffa517 Update compile.sh 2014-04-08 02:28:12 +02:00
efeaadf0ba Added PHP C extension version 2014-04-08 02:23:43 +02:00
999990756c Fixed invalid string type in writeMetadata() 2014-04-07 16:24:58 +02:00
c0de004472 Moved binary methods from Utils to Binary 2014-04-07 13:52:01 +02:00
62313d4a84 Update Command.php 2014-04-07 16:38:37 +08:00
ac02185ad0 Fixed start.sh on linux :P 2014-04-07 04:10:26 +02:00
d83b5c3a60 Oops 2014-04-07 03:25:31 +02:00
e405c2bf1c Merge branch 'Core-Rewrite' of github.com:PocketMine/PocketMine-MP into Core-Rewrite 2014-04-07 03:22:07 +02:00
039151c136 Fixed compile.sh :P 2014-04-07 03:21:58 +02:00
40b290739e Fixed compile.sh perms 2014-04-06 21:18:39 -04:00
93c82d5267 Added PocketMine C PHP extension 2014-04-07 03:14:55 +02:00
0000000bab Testing things ;) 2014-04-06 20:07:11 +02:00
4098252ec7 Use CommandExecutor by default on plugins :P 2014-04-05 21:44:29 +02:00
711519d4ff Fixed uopz on installer 2014-04-05 18:50:31 +02:00
0b9896ff5e Updated to PHP 5.5.11 on the installer 2014-04-05 18:43:42 +02:00
41c4c15549 Updated compiler to PHP 5.5.11 2014-04-05 16:33:41 +02:00
1a8cbdd6c7 Fixed players being able to add color codes in names and be shown on console (on kick) 2014-04-05 14:02:35 +02:00
7be9ea68c7 Added Config::getPath() and Config::setPath() 2014-04-05 10:36:18 +02:00
e390374c74 Updated README.md 2014-04-05 00:58:20 +02:00
6d58f32c91 Added PluginLogger 2014-04-05 00:20:09 +02:00
0d91be62cf Improved plugin loading 2014-04-04 22:11:31 +02:00
adcbc67a71 Updated installer to use new Raspberry Pi PHP builds 2014-04-04 15:59:18 +02:00
ddf59b8bee Fixed MySQLnd cross-compilation 2014-04-04 15:50:13 +02:00
5c8747cb87 Set -j on Linux builds to 2 2014-04-04 15:41:46 +02:00
5065fce415 Moved -ftree-parallelize-loops to x86 and x86_64 optimizations 2014-04-04 15:06:09 +02:00
e63f8b93a7 Updated cURL 2014-04-04 03:56:02 +02:00
848b4bc113 Disabled temporaly uopz on compile script 2014-04-04 03:09:24 +02:00
648b23d08f Get correct Phar path if not specified 2014-04-04 02:53:41 +02:00
0f0b866788 Hmm, typo 2014-04-04 02:01:42 +02:00
c6f189f93f Added ability to disallow auto-kick of logged in players without using external properties, and using the event system 2014-04-04 01:59:58 +02:00
076bf2f2fe Added /spawnpoint message 2014-04-04 01:54:38 +02:00
fb6cd22c83 Fixed /tp 2014-04-04 01:52:56 +02:00
327d183bed Disallow duplicate usernames and block new player 2014-04-03 18:14:36 -05:00
7a163f9ea5 Added option to not kick players on duplicate names 2014-04-03 18:06:10 -05:00
0a7d9f1c87 Enabled use of /tp <source> <target> 2014-04-03 18:04:26 -05:00
08c9321a55 Fix error on tapping block with air in hand 2014-04-03 16:40:16 -05:00
cbf1f7a2e8 Fix /spawnpoint from console with no coordinate crash 2014-04-03 16:37:00 -05:00
85f7cdb123 Temporarily fix placing blocks near water crash 2014-04-03 16:34:02 -05:00
d3a912b2ef Added jenkins branch 2014-04-03 22:28:28 +02:00
5173781725 Modified jenkins script 2014-04-03 20:36:15 +02:00
ab1fbae2f2 Added dependency search on loaded plugins 2014-04-03 20:06:18 +02:00
febc6af323 Added uopz doc stub 2014-04-03 17:23:49 +02:00
d972d38b41 Added uopz extension (for monkey patching) 2014-04-03 16:25:42 +02:00
80f9093875 Added /reload command (does not reload source code) 2014-04-03 15:49:00 +02:00
ee6dc989ce Added class not found exception to SplClassLoader 2014-04-03 14:01:44 +02:00
5da68059ee Added file_exists check to SplClassLoader 2014-04-03 13:59:26 +02:00
5052e58bd0 Added /status memory 2014-04-03 13:22:04 +02:00
2ad9e1fe29 Added /status title 2014-04-03 13:19:34 +02:00
908210969e Added permissions for /status 2014-04-03 13:17:10 +02:00
0865381881 Moved /status into debug.commands 2014-04-03 13:16:15 +02:00
b50d58e46f Merge branch 'Core-Rewrite' of github.com:PocketMine/PocketMine-MP into Core-Rewrite 2014-04-03 13:12:30 +02:00
4841e105d3 Added debug.level 2014-04-03 13:12:15 +02:00
6c938944e6 Merge pull request #1376 from williamtdr/Core-Rewrite
Re-enable support for debug information with /status
2014-04-03 13:11:13 +02:00
04917ecd5a Added correct PluginIdentifiableCommand 2014-04-03 13:08:11 +02:00
3d80362560 Re-enable support for SIGTERM for clean exit 2014-04-02 21:24:49 -05:00
48f2927e08 Re-enable support for debug information with /status 2014-04-02 21:14:22 -05:00
27fcf0286e Fixed terminal colors 2014-04-03 04:10:20 +02:00
2ab1997f21 v1.5.0 added /extractplugin 2014-04-03 03:38:16 +02:00
61192b172b Removed FolderPluginLoader, allow loading of plugins by other loaders 2014-04-03 02:34:57 +02:00
f71f10da0b Added entry on .gitignore for Netbeans 2014-04-03 01:14:59 +02:00
a2536ed308 Fixed Server::isLevelgenerated() 2014-04-03 00:35:38 +02:00
83eb032393 Fixed plugin resources 2014-04-02 23:48:00 +02:00
36027f1073 Removed TimeAPI 2014-04-02 20:29:38 +02:00
95628227b0 Removed ServerOld, ServerAPI 2014-04-02 20:27:34 +02:00
0f42cd9243 Added Asynchronous tasks, usage sending 2014-04-02 20:20:14 +02:00
11356b68ba Added RCON 2014-04-02 19:33:49 +02:00
379b70eca7 Removed PlayerAPI 2014-04-02 19:07:29 +02:00
c81266d1da Added /tp 2014-04-02 19:04:07 +02:00
8c4afcd21a Added /spawnpoint 2014-04-02 18:40:24 +02:00
5cadc665d1 Added /kill, base entity health methods 2014-04-02 18:27:49 +02:00
bec642310a Removed BlockAPI 2014-04-02 06:07:21 +02:00
df3e456162 Added /give, /gamemode 2014-04-02 05:59:26 +02:00
7cd29f0fcf Added block updates, correct block placing 2014-04-02 05:36:45 +02:00
a4630372fa Added /save-on, /save-off, /save-all 2014-04-02 04:37:58 +02:00
9a5ffbe56c Added Tool for Items, new items 2014-04-02 04:26:53 +02:00
ee23b42e23 Added Spawn protection, including item usage, added /whitelist 2014-04-02 03:37:51 +02:00
502c27273d Moved Level methods to Server 2014-04-02 02:58:20 +02:00
5865f17c75 Faster plugin filter loading 2014-04-01 21:57:32 +02:00
7e9304a0c9 Formatting 2014-04-01 19:48:28 +02:00
b4cc3bbd43 Added /op, /deop, /kick, OfflinePlayer, moved player list to Server instead of static Player 2014-04-01 19:46:48 +02:00
e60ea2eb15 Fixed event names 2014-04-01 13:13:43 +02:00
a38d300616 Updated PluginBase::getResources() for Phar plugins 2014-04-01 12:18:27 +02:00
e3ee317924 Fixed detection 2014-04-01 12:09:18 +02:00
=
c688039047 Removed ghost dirs 2014-04-01 05:13:36 +02:00
dd17652aca Fixed wrong paths 2014-04-01 05:06:12 +02:00
03d46020ec Update compile.sh 2014-03-29 06:11:24 +01:00
19efa5e8d9 I need a Mac 2014-03-29 05:16:17 +01:00
08c6265762 Added libcurl MacOS install_name_tool dynamic path patch 2014-03-29 05:08:14 +01:00
4098e5e3b8 Fixed invalid MacOS arch for 64-bit 2014-03-29 05:03:20 +01:00
829069b0c8 Removed WeakRef 2014-03-29 04:40:10 +01:00
66cea2f8ea Update compile.sh 2014-03-29 04:14:29 +01:00
9cab86540b Update compile.sh 2014-03-29 04:10:52 +01:00
d9ce4f119f Update compile.sh 2014-03-29 04:05:10 +01:00
35511aa30e Update compile.sh 2014-03-29 04:01:50 +01:00
5ce7b57cac Update compile.sh 2014-03-29 03:54:28 +01:00
fc053d9d75 Update jenkins.sh 2014-03-29 03:30:16 +01:00
cb1b8c6c68 Update compile.sh 2014-03-29 03:30:02 +01:00
86f9d3e233 Merge branch 'master' of https://github.com/PocketMine/PocketMine-MP 2014-03-23 10:37:44 +10:30
c266cb991c Fix /list adding a trailing comma. 2014-03-14 16:45:54 -05:00
b28bc3ae9b Merge branch 'master' of https://github.com/PocketMine/PocketMine-MP 2014-03-09 20:01:02 +10:30
e0705c80e2 Fixed getopts on compile.sh 2014-03-08 18:14:43 +01:00
5d2884716d Update jenkins.sh 2014-03-08 13:53:27 +01:00
45ee209c58 Update jenkins.sh 2014-03-08 06:21:22 +01:00
564a504ef7 Update compile.sh 2014-03-08 05:49:27 +01:00
ba21d7f661 Update compile.sh 2014-03-08 05:35:31 +01:00
d5ff5d0066 Merge branches 'Faster-Network' and 'master' of https://github.com/PocketMine/PocketMine-MP 2014-02-10 19:20:37 +10:30
718 changed files with 35223 additions and 20618 deletions

11
.gitignore vendored
View File

@ -2,11 +2,15 @@ players/*
worlds/*
plugins/*
bin/*
.idea/*
*.log
*.txt
*.phar
server.properties
pocketmine.yml
# Common IDEs
.idea/*
nbproject/*
# Windows image file caches
Thumbs.db
@ -16,3 +20,8 @@ Desktop.ini
# Mac crap
.DS_Store
/nbproject/private/
# Sphinx-doc
/docs/build/
!/docs/requirements.txt

11
.gitmodules vendored Normal file
View File

@ -0,0 +1,11 @@
[submodule "src/pocketmine/gui"]
path = src/pocketmine/gui
url = https://github.com/PocketMine/PocketMine-MP-GUI.git
branch = master
[submodule "src/raklib"]
path = src/raklib
url = https://github.com/PocketMine/RakLib.git
branch = master
[submodule "src/spl"]
path = src/spl
url = https://github.com/PocketMine/PocketMine-SPL.git

5
.mailmap Normal file
View File

@ -0,0 +1,5 @@
Shoghi Cervantes <shoghicp@gmail.com>
Shoghi Cervantes <shoghicp@gmail.com> Shoghi Cervantes <shoghicp@pocketmine.net>
Brandon V <brandon15811@gmail.com>
Michael Yoo <sekjun9878@gmail.com> Michael Yoo <michael@yoo.id.au>
Michael Yoo <sekjun9878@gmail.com> Michael Yoo <sekjun9878@sekjun9878.info>

View File

@ -1,21 +1,21 @@
language: php
php:
- 5.4
- 5.5
- 5.6
branches:
except:
- Core-Rewrite
- master
before_script:
- pecl install channel://pecl.php.net/pthreads-2.0.4
- mkdir plugins
- wget -O plugins/DevTools.phar https://github.com/PocketMine/DevTools/releases/download/v1.9.0/DevTools_v1.9.0.phar
- pecl install channel://pecl.php.net/pthreads-2.0.10
- pecl install channel://pecl.php.net/weakref-0.2.4
- echo | pecl install channel://pecl.php.net/yaml-1.1.1
script:
- php src/tests/ServerSuiteTest.php --no-wizard
- php tests/TravisTest.php
notifications:
email: false
webhooks: http://n.tkte.ch/h/214/wsNvmG43-ncxUVRrFPwSM-r0
#webhooks: http://n.tkte.ch/h/214/wsNvmG43-ncxUVRrFPwSM-r0

View File

@ -2,36 +2,37 @@
# PocketMine-MP Contribution Guidelines
Before contributing to PocketMine-MP, please read this. Also, take a look if your contribution fits the PocketMine-MP goals below.
You must follow these guidelines if you wish to contribute to the PocketMine-MP code base, or participate in issue tracking.
## I've a question
## I have a question
* For questions, please refer to the _#pocketmine_ or _#mcpedevs_ IRC channel on Freenode. There is a [WebIRC](http://webchat.freenode.net?channels=pocketmine,mcpedevs&uio=d4) if you want.
* You can ask directly to _[@PocketMine](https://twitter.com/PocketMine)_ in Twitter, but don't expect an inmediate reply.
* You can ask directly to _[@PocketMine](https://twitter.com/PocketMine)_ in Twitter, but don't expect an immediate reply.
* You may use our [Forum](http://forums.pocketmine.net) to ask questions.
* We do not accept questions or support requests in our issue tracker.
## I want to create an issue
* First, use the [Issue Search](https://github.com/PocketMine/PocketMine-MP/search?ref=cmdform&type=Issues) to check if anyone has reported it.
* Is your issue related to a Plugin? If so, please contact their original author instead of reporting it here.
* And no, we won't update a Plugin because you need it.
* When reporting, give as much info as you can, and if the Issue is a crash, give the Crash Dump.
* Issues should be written in English.
## Creating an Issue
- First, use the [Issue Search](https://github.com/PocketMine/PocketMine-MP/search?ref=cmdform&type=Issues) to check if anyone has reported it.
- If your issue is related to a plugin, you must contact their original author instead of reporting it here.
- If your issue is related to a PocketMine official plugin, or our Android application, you must create an issue on that specific repository.
- **Support requests are not bugs.** Issues such as "How do I do this" are not bugs and are closed as soon as a collaborator spots it. They are referred to our Forum to seek assistance.
- **No generic titles** such as "Question", "Help", "Crash Report" etc. If an issue has a generic title they will either be closed on the spot, or a collaborator will edit it to describe the actual symptom.
- Information must be provided in the issue body, not in the title. No tags are allowed in the title, and do not change the title if the issue has been solved.
- Similarly, no generic issue reports. It is the issue submitter's responsibility to provide us an issue that is **trackable, debuggable, reproducible, reported professionally and is an actual bug**. If you do not provide us with a summary or instructions on how to reproduce the issue, it is a support request until the actual bug has been found and therefore the issue is closed.
## I want to contribute code
## Contributing Code
* 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. See below for an example.
* The code must be clear and written in English, comments included.
* Use descriptive commit titles
* __No merge commits are allowed, or multiple features per pull request__
**Thanks for contributing to PocketMine-MP!**
__Thanks for contributing to PocketMine-MP!__
### Code syntax
### 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.
* Opening braces MUST go on the same line, and MUST NOT have spaces before.
* `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.
@ -40,13 +41,12 @@ It is mainly [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accept
* Files MUST NOT have an ending `?>` tag.
* Code MUST use namespaces.
* 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
namespace pocketmine\Example;
namespace pocketmine\example;
class ExampleClass{
const EXAMPLE_CLASS_CONSTANT = 1;
@ -58,17 +58,83 @@ class ExampleClass{
//do things
}elseif($firstArgument === "otherValue"){
$secondArgument = function(){
return array(
return [
0 => "value1",
1 => "value2",
2 => "value3",
3 => "value4",
4 => "value5",
5 => "value6",
);
];
}
}
}
}
```
### RFC and Voting
* These are big Pull Requests or contributions that change important behavior.
* RFCs will be tagged with the *PR: RFC* label
* A vote will be held once the RFC is ready. All users can vote commenting on the Pull Request
* Comments MUST use "Yes" or "No" on the FIRST sentence to signify the vote, except when they don't want it to be counted.
* If your comment is a voting comment, specify the reason of your vote or it won't be counted.
* After voting has been closed, no further votes will be counted.
* An RFC will be rejected if less than 50% + 1 (simple majority) has voted Yes.
* If the RFC is approved, Team Members have the final word on its implementation or rejection.
* RFCs with complex voting options will specify the vote percentage or other details.
## Bug Tracking for Collaborators
### Labels
To provide a concise bug tracking environment, prevent the issue tracker from over flowing and to keep support requests out of the bug tracker, PocketMine-MP uses a label scheme a bit different from the default GitHub Issues labels.
PocketMine-MP uses GitHub Issues Labels. There are a total of 12 labels.
Note: For future reference, labels must not be longer than 15 letters.
#### Categories
Category labels are prefixed by `C:`. Multiple category labels may be applied to a single issue(but try to keep this to a minimum and do not overuse category labels).
- C: Core - This label is applied when the bug results in a fatal crash, or is related to neither Gameplay nor Plugin API.
- C: Gameplay - This label is applied when the bug effects the gameplay.
- C: API - This label is applied when the bug effects the Plugin API.
#### Pull Requests
Pull Requests are prefixed by `PR:`. Only one label may be applied for a Pull Request.
- PR: Bug Fix - This label is applied when the Pull Request fixes a bug.
- PR: Contribution - This label is applied when the Pull Request contributes code to PocketMine-MP such as a new feature or an improvement.
- PR: RFC - Request for Comments
#### Status
Status labels show the status of the issue. Multiple status labels may be applied.
- Reproduced - This label is applied when the bug has been reproduced, or multiple people are reporting the same issue and symptoms in which case it is automatically assumed that the bug has been reproduced in different environments.
- Debugged - This label is applied when the cause of the bug has been found.
- Priority - This label is applied when the bug is easy to fix, or if the scale of the bug is global.
- Won't Fix - This label is applied if the bug has been decided not be fixed for some reason. e.g. when the bug benefits gameplay. *This label may only be applied to a closed issue.*
#### Miscellaneous
Miscellaneous labels are labels that show status not related to debugging that bug. The To-Do label and the Mojang label may not be applied to a single issue at the same time.
- To-Do - This label is applied when the issue is not a bug, but a feature request or a list of features to be implemented that count towards a milestone.
- Mojang - This label is applied when the issue is suspected of being caused by the Minecraft: Pocket Edition client, but has not been confirmed.
- Invalid - This label is applied when the issue is reporting a false bug that works as intended, a support request, etc. *This label may only be applied to a closed issue.*
### Closing Issues
To keep the bug tracker clear of non-related issues and to prevent it from overflowing, **issues must be closed as soon as possible** (This may sound unethical, but it is MUCH better than having the BUG TRACKER filled with SUPPORT REQUESTS and "I NEED HELP").
If an issue does not conform to the "Creating an Issue" guidelines above, the issue should be closed.
### Milestones
PocketMine-MP uses GitHub Milestones to set a goal for a new release. A milestone is set on the following occasions.
- A new Beta release
- A new Stable release
A milestone must use the following format:
```
Alpha_<version_number> [release_title][release_version]
```
For example:
```
Alpha_1.4 beta2
```

View File

@ -15,27 +15,32 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
__PocketMine-MP is a Minecraft: PE server software.__
The entire server is written in PHP, and has been tested, profiled and optimized to run smoothly.
__PocketMine-MP is a free, open-source software that creates Minecraft: Pocket Edition servers and allows extending its functionalities__
### [Homepage](http://www.pocketmine.net/)
### [Forums](http://forums.pocketmine.net/)
### [Wiki](https://github.com/PocketMine/PocketMine-MP/wiki/)
### [Documentation](http://pocketmine-mp.readthedocs.org/)
### [FAQ: Frequently Asked Questions](https://github.com/PocketMine/PocketMine-MP/wiki/Frequently-Asked-Questions)
### [Plugin Repository](http://plugins.pocketmine.net/)
<!--## [FAQ: Frequently Asked Questions](https://github.com/PocketMine/PocketMine-MP/wiki/Frequently-Asked-Questions)-->
### [Official Jenkins server](http://jenkins.pocketmine.net/)
### API Documentation
* [Doxygen generated](http://docs.pocketmine.net/)
* [PHPDoc generated](http://docs.pocketmine.net/phpdoc/)
* [Official Doxygen-generated documentation](http://docs.pocketmine.net/)
* [Latest Doxygen generated from development](http://jenkins.pocketmine.net/job/PocketMine-MP-doc/doxygen/)
### [Twitter @PocketMine](https://twitter.com/PocketMine)
## IRC Chat #pocketmine (or #mcpedevs) @ irc.freenode.net
### IRC Chat #pocketmine (or #mcpedevs) @ irc.freenode.net
[#pocketmine + #mcpedevs channel WebIRC](http://webchat.freenode.net/?channels=pocketmine,mcpedevs)
### Want to contribute?
* Check the [Contributing Guidelines](CONTRIBUTING.md)
## Third-party Libraries/Protocols Used
* __[PHP Sockets](http://php.net/manual/en/book.sockets.php)__
@ -44,7 +49,6 @@ The entire server is written in PHP, and has been tested, profiled and optimized
* __[PHP pthreads](http://pthreads.org/)__ by _[krakjoe](https://github.com/krakjoe)_: Threading for PHP - Share Nothing, Do Everything.
* __[PHP YAML](https://code.google.com/p/php-yaml/)__ by _Bryan Davis_: The Yaml PHP Extension provides a wrapper to the LibYAML library.
* __[LibYAML](http://pyyaml.org/wiki/LibYAML)__ by _Kirill Simonov_: A YAML 1.1 parser and emitter written in C.
* __[mintty](https://code.google.com/p/mintty/)__ : xterm Terminal Emulator
* __[cURL](http://curl.haxx.se/)__: cURL is a command line tool for transferring data with URL syntax
* __[Zlib](http://www.zlib.net/)__: A Massively Spiffy Yet Delicately Unobtrusive Compression Library
* __[Source RCON Protocol](https://developer.valvesoftware.com/wiki/Source_RCON_Protocol)__

File diff suppressed because it is too large Load Diff

View File

@ -1,411 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine;
use pocketmine\level\Level;
use pocketmine\math\Vector2;
use pocketmine\utils\Config;
class BanAPI{
private $server;
/*
* I would use PHPDoc Template here but PHPStorm does not recognise it. - @sekjun9878
*/
/** @var Config */
private $whitelist;
/** @var Config */
private $banned;
/** @var Config */
private $ops;
/** @var Config */
private $bannedIPs;
private $cmdWhitelist = array(); //Command WhiteList
function __construct(){
$this->server = Server::getInstance();
}
public function init(){
$this->whitelist = new Config(\pocketmine\DATA . "white-list.txt", Config::ENUM); //Open whitelist list file
$this->bannedIPs = new Config(\pocketmine\DATA . "banned-ips.txt", Config::ENUM); //Open Banned IPs list file
$this->banned = new Config(\pocketmine\DATA . "banned.txt", Config::ENUM); //Open Banned Usernames list file
$this->ops = new Config(\pocketmine\DATA . "ops.txt", Config::ENUM); //Open list of OPs
$this->server->api->console->register("banip", "<add|remove|list|reload> [IP|player]", array($this, "commandHandler"));
$this->server->api->console->register("ban", "<add|remove|list|reload> [username]", array($this, "commandHandler"));
$this->server->api->console->register("kick", "<player> [reason ...]", array($this, "commandHandler"));
$this->server->api->console->register("whitelist", "<on|off|list|add|remove|reload> [username]", array($this, "commandHandler"));
$this->server->api->console->register("op", "<player>", array($this, "commandHandler"));
$this->server->api->console->register("deop", "<player>", array($this, "commandHandler"));
$this->server->api->console->register("sudo", "<player> <command>", array($this, "commandHandler"));
$this->server->api->console->alias("ban-ip", "banip add");
$this->server->api->console->alias("banlist", "ban list");
$this->server->api->console->alias("pardon", "ban remove");
$this->server->api->console->alias("pardon-ip", "banip remove");
$this->server->addHandler("console.command", array($this, "permissionsCheck"), 1); //Event handler when commands are issued. Used to check permissions of commands that go through the server.
$this->server->addHandler("player.block.break", array($this, "permissionsCheck"), 1); //Event handler for blocks
$this->server->addHandler("player.block.place", array($this, "permissionsCheck"), 1); //Event handler for blocks
$this->server->addHandler("player.flying", array($this, "permissionsCheck"), 1); //Flying Event
}
/**
* @param string $cmd Command to Whitelist
*/
public function cmdWhitelist($cmd){ //Whitelists a CMD so everyone can issue it - Even non OPs.
$this->cmdWhitelist[strtolower(trim($cmd))] = true;
}
/**
* @param string $username
*
* @return boolean
*/
public function isOp($username){ //Is a player op?
$username = strtolower($username);
if($this->server->api->dhandle("op.check", $username) === true){
return true;
}elseif($this->ops->exists($username)){
return true;
}
return false;
}
/**
* @param mixed $data
* @param string $event
*
* @return boolean
*/
public function permissionsCheck($data, $event){
switch($event){
case "player.flying": //OPs can fly around the server.
if($this->isOp($data->getName())){
return true;
}
break;
case "player.block.break":
case "player.block.place": //Spawn protection detection. Allows OPs to place/break blocks in the spawn area.
if(!$this->isOp($data["player"]->getName())){
$t = new Vector2($data["target"]->x, $data["target"]->z);
$s = new Vector2(Level::getDefault()->getSpawn()->x, Level::getDefault()->getSpawn()->z);
if($t->distance($s) <= $this->server->api->getProperty("spawn-protection") and $this->server->api->dhandle($event . ".spawn", $data) !== true){
return false;
}
}
return;
case "console.command": //Checks if a command is allowed with the current user permissions.
if(isset($this->cmdWhitelist[$data["cmd"]])){
return;
}
if($data["issuer"] instanceof Player){
if($this->server->api->handle("console.check", $data) === true or $this->isOp($data["issuer"]->getName())){
return;
}
}elseif($data["issuer"] === "console" or $data["issuer"] === "rcon"){
return;
}
return false;
}
}
/**
* @param string $cmd
* @param array $params
* @param string $issuer
* @param string $alias
*
* @return string
*/
public function commandHandler($cmd, $params, $issuer, $alias){
$output = "";
switch($cmd){
case "sudo":
$target = strtolower(array_shift($params));
$player = Player::get($target);
if(!($player instanceof Player)){
$output .= "Player not connected.\n";
break;
}
$this->server->api->console->run(implode(" ", $params), $player);
$output .= "Command ran as " . $player->getName() . ".\n";
break;
case "op":
$user = strtolower($params[0]);
if($user == null){
$output .= "Usage: /op <player>\n";
break;
}
$player = Player::get($user);
if(!($player instanceof Player)){
$this->ops->set($user);
$this->ops->save();
$output .= $user . " is now op\n";
break;
}
$this->ops->set(strtolower($player->getName()));
$this->ops->save();
$output .= $player->getName() . " is now op\n";
$player->sendMessage("You are now op.");
break;
case "deop":
$user = strtolower($params[0]);
$player = Player::get($user);
if(!($player instanceof Player)){
$this->ops->remove($user);
$this->ops->save();
$output .= $user . " is no longer op\n";
break;
}
$this->ops->remove(strtolower($player->getName()));
$this->ops->save();
$output .= $player->getName() . " is no longer op\n";
$player->sendMessage("You are no longer op.");
break;
case "kick":
if(!isset($params[0])){
$output .= "Usage: /kick <player> [reason ...]\n";
}else{
$name = strtolower(array_shift($params));
$player = Player::get($name);
if($player === false){
$output .= "Player \"" . $name . "\" does not exist\n";
}else{
$reason = implode(" ", $params);
$reason = $reason == "" ? "No reason" : $reason;
$this->server->schedule(60, array($player, "close"), "You have been kicked: " . $reason); //Forces a kick
$player->blocked = true;
if($issuer instanceof Player){
Player::broadcastMessage($player->getName() . " has been kicked by " . $issuer->getName() . ": $reason\n");
}else{
Player::broadcastMessage($player->getName() . " has been kicked: $reason\n");
}
}
}
break;
case "whitelist":
$p = strtolower(array_shift($params));
switch($p){
case "remove":
$user = strtolower($params[0]);
$this->whitelist->remove($user);
$this->whitelist->save();
$output .= "Player \"$user\" removed from white-list\n";
break;
case "add":
$user = strtolower($params[0]);
$this->whitelist->set($user);
$this->whitelist->save();
$output .= "Player \"$user\" added to white-list\n";
break;
case "reload":
$this->whitelist = new Config(\pocketmine\DATA . "white-list.txt", Config::ENUM);
break;
case "list":
$output .= "White-list: " . implode(", ", $this->whitelist->getAll(true)) . "\n";
break;
case "on":
case "true":
case "1":
$output .= "White-list turned on\n";
$this->server->api->setProperty("white-list", true);
break;
case "off":
case "false":
case "0":
$output .= "White-list turned off\n";
$this->server->api->setProperty("white-list", false);
break;
default:
$output .= "Usage: /whitelist <on|off|list|add|remove|reload> [username]\n";
break;
}
break;
case "banip":
$p = strtolower(array_shift($params));
switch($p){
case "pardon":
case "remove":
$ip = strtolower($params[0]);
$this->bannedIPs->remove($ip);
$this->bannedIPs->save();
$output .= "IP \"$ip\" removed from ban list\n";
break;
case "add":
case "ban":
$ip = strtolower($params[0]);
$player = Player::get($ip);
if($player instanceof Player){
$ip = $player->getIP();
$player->kick("You are banned");
}
$this->bannedIPs->set($ip);
$this->bannedIPs->save();
$output .= "IP \"$ip\" added to ban list\n";
break;
case "reload":
$this->bannedIPs = new Config(\pocketmine\DATA . "banned-ips.txt", Config::ENUM);
break;
case "list":
$output .= "IP ban list: " . implode(", ", $this->bannedIPs->getAll(true)) . "\n";
break;
default:
$output .= "Usage: /banip <add|remove|list|reload> [IP|player]\n";
break;
}
break;
case "ban":
$p = strtolower(array_shift($params));
switch($p){
case "pardon":
case "remove":
$user = strtolower($params[0]);
$this->banned->remove($user);
$this->banned->save();
$output .= "Player \"$user\" removed from ban list\n";
break;
case "add":
case "ban":
$user = strtolower($params[0]);
$this->banned->set($user);
$this->banned->save();
$player = Player::get($user);
if($player !== false){
$player->kick("You are banned");
}
if($issuer instanceof Player){
Player::broadcastMessage($user . " has been banned by " . $issuer->getName() . "\n");
}else{
Player::broadcastMessage($user . " has been banned\n");
}
$this->kick($user, "Banned");
$output .= "Player \"$user\" added to ban list\n";
break;
case "reload":
$this->banned = new Config(\pocketmine\DATA . "banned.txt", Config::ENUM);
break;
case "list":
$output .= "Ban list: " . implode(", ", $this->banned->getAll(true)) . "\n";
break;
default:
$output .= "Usage: /ban <add|remove|list|reload> [username]\n";
break;
}
break;
}
return $output;
}
/**
* @param string $username
*/
public function ban($username){
$this->commandHandler("ban", array("add", $username), "console", "");
}
/**
* @param string $username
*/
public function pardon($username){
$this->commandHandler("ban", array("pardon", $username), "console", "");
}
/**
* @param string $ip
*/
public function banIP($ip){
$this->commandHandler("banip", array("add", $ip), "console", "");
}
/**
* @param string $ip
*/
public function pardonIP($ip){
$this->commandHandler("banip", array("pardon", $ip), "console", "");
}
/**
* @param string $username
* @param string $reason
*/
public function kick($username, $reason = "No Reason"){
$this->commandHandler("kick", array($username, $reason), "console", "");
}
public function reload(){
$this->commandHandler("ban", array("reload"), "console", "");
$this->commandHandler("banip", array("reload"), "console", "");
$this->commandHandler("whitelist", array("reload"), "console", "");
}
/**
* @param string $ip
*
* @return boolean
*/
public function isIPBanned($ip){
if($this->server->api->dhandle("api.ban.ip.check", $ip) === false){
return true;
}elseif($this->bannedIPs->exists($ip, true)){
return true;
}else{
return false;
}
}
/**
* @param string $username
*
* @return boolean
*/
public function isBanned($username){
$username = strtolower($username);
if($this->server->api->dhandle("api.ban.check", $username) === false){
return true;
}elseif($this->banned->exists($username, true)){
return true;
}else{
return false;
}
}
/**
* @param string $username
*
* @return boolean
*/
public function inWhitelist($username){
$username = strtolower($username);
if($this->isOp($username)){
return true;
}elseif($this->server->api->dhandle("api.ban.whitelist.check", $username) === false){
return true;
}elseif($this->whitelist->exists($username, true)){
return true;
}
return false;
}
}

View File

@ -1,352 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine;
use pocketmine\Block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\level\Position;
class BlockAPI{
private $server;
private $scheduledUpdates = array();
public static $creative = array(
//Building
[Item::STONE, 0],
[Item::COBBLESTONE, 0],
[Item::STONE_BRICKS, 0],
[Item::STONE_BRICKS, 1],
[Item::STONE_BRICKS, 2],
[Item::MOSS_STONE, 0],
[Item::WOODEN_PLANKS, 0],
[Item::WOODEN_PLANKS, 1],
[Item::WOODEN_PLANKS, 2],
[Item::WOODEN_PLANKS, 3],
[Item::BRICKS, 0],
[Item::DIRT, 0],
[Item::GRASS, 0],
[Item::CLAY_BLOCK, 0],
[Item::SANDSTONE, 0],
[Item::SANDSTONE, 1],
[Item::SANDSTONE, 2],
[Item::SAND, 0],
[Item::GRAVEL, 0],
[Item::TRUNK, 0],
[Item::TRUNK, 1],
[Item::TRUNK, 2],
[Item::TRUNK, 3],
[Item::NETHER_BRICKS, 0],
[Item::NETHERRACK, 0],
[Item::BEDROCK, 0],
[Item::COBBLESTONE_STAIRS, 0],
[Item::OAK_WOODEN_STAIRS, 0],
[Item::SPRUCE_WOODEN_STAIRS, 0],
[Item::BIRCH_WOODEN_STAIRS, 0],
[Item::JUNGLE_WOODEN_STAIRS, 0],
[Item::BRICK_STAIRS, 0],
[Item::SANDSTONE_STAIRS, 0],
[Item::STONE_BRICK_STAIRS, 0],
[Item::NETHER_BRICKS_STAIRS, 0],
[Item::QUARTZ_STAIRS, 0],
[Item::SLAB, 0],
[Item::SLAB, 1],
[Item::WOODEN_SLAB, 0],
[Item::WOODEN_SLAB, 1],
[Item::WOODEN_SLAB, 2],
[Item::WOODEN_SLAB, 3],
[Item::SLAB, 3],
[Item::SLAB, 4],
[Item::SLAB, 5],
[Item::SLAB, 6],
[Item::QUARTZ_BLOCK, 0],
[Item::QUARTZ_BLOCK, 1],
[Item::QUARTZ_BLOCK, 2],
[Item::COAL_ORE, 0],
[Item::IRON_ORE, 0],
[Item::GOLD_ORE, 0],
[Item::DIAMOND_ORE, 0],
[Item::LAPIS_ORE, 0],
[Item::REDSTONE_ORE, 0],
[Item::OBSIDIAN, 0],
[Item::ICE, 0],
[Item::SNOW_BLOCK, 0],
//Decoration
[Item::COBBLESTONE_WALL, 0],
[Item::COBBLESTONE_WALL, 1],
[Item::GOLD_BLOCK, 0],
[Item::IRON_BLOCK, 0],
[Item::DIAMOND_BLOCK, 0],
[Item::LAPIS_BLOCK, 0],
[Item::COAL_BLOCK, 0],
[Item::SNOW_LAYER, 0],
[Item::GLASS, 0],
[Item::GLOWSTONE_BLOCK, 0],
[Item::NETHER_REACTOR, 0],
[Item::WOOL, 0],
[Item::WOOL, 7],
[Item::WOOL, 6],
[Item::WOOL, 5],
[Item::WOOL, 4],
[Item::WOOL, 3],
[Item::WOOL, 2],
[Item::WOOL, 1],
[Item::WOOL, 15],
[Item::WOOL, 14],
[Item::WOOL, 13],
[Item::WOOL, 12],
[Item::WOOL, 11],
[Item::WOOL, 10],
[Item::WOOL, 9],
[Item::WOOL, 8],
[Item::LADDER, 0],
[Item::SPONGE, 0],
[Item::GLASS_PANE, 0],
[Item::WOODEN_DOOR, 0],
[Item::TRAPDOOR, 0],
[Item::FENCE, 0],
[Item::FENCE_GATE, 0],
[Item::IRON_BARS, 0],
[Item::BED, 0],
[Item::BOOKSHELF, 0],
[Item::PAINTING, 0],
[Item::WORKBENCH, 0],
[Item::STONECUTTER, 0],
[Item::CHEST, 0],
[Item::FURNACE, 0],
[Item::DANDELION, 0],
[Item::CYAN_FLOWER, 0],
[Item::BROWN_MUSHROOM, 0],
[Item::RED_MUSHROOM, 0],
[Item::CACTUS, 0],
[Item::MELON_BLOCK, 0],
[Item::PUMPKIN, 0],
[Item::LIT_PUMPKIN, 0],
[Item::COBWEB, 0],
[Item::HAY_BALE, 0],
[Item::TALL_GRASS, 1],
[Item::TALL_GRASS, 2],
[Item::DEAD_BUSH, 0],
[Item::SAPLING, 0],
[Item::SAPLING, 1],
[Item::SAPLING, 2],
[Item::SAPLING, 3],
[Item::LEAVES, 0],
[Item::LEAVES, 1],
[Item::LEAVES, 2],
[Item::LEAVES, 3],
[Item::CAKE, 0],
[Item::SIGN, 0],
[Item::CARPET, 0],
[Item::CARPET, 7],
[Item::CARPET, 6],
[Item::CARPET, 5],
[Item::CARPET, 4],
[Item::CARPET, 3],
[Item::CARPET, 2],
[Item::CARPET, 1],
[Item::CARPET, 15],
[Item::CARPET, 14],
[Item::CARPET, 13],
[Item::CARPET, 12],
[Item::CARPET, 11],
[Item::CARPET, 10],
[Item::CARPET, 9],
[Item::CARPET, 8],
//Tools
//[Item::RAILS, 0],
//[Item::POWERED_RAILS, 0],
[Item::TORCH, 0],
[Item::BUCKET, 0],
[Item::BUCKET, 8],
[Item::BUCKET, 10],
[Item::TNT, 0],
[Item::IRON_HOE, 0],
[Item::IRON_SWORD, 0],
[Item::BOW, 0],
[Item::SHEARS, 0],
[Item::FLINT_AND_STEEL, 0],
[Item::CLOCK, 0],
[Item::COMPASS, 0],
[Item::MINECART, 0],
[Item::SPAWN_EGG, 10], //Chicken
[Item::SPAWN_EGG, 11], //Cow
[Item::SPAWN_EGG, 12], //Pig
[Item::SPAWN_EGG, 13], //Sheep
//TODO: Replace with Entity constants
//Seeds
[Item::SUGARCANE, 0],
[Item::WHEAT, 0],
[Item::SEEDS, 0],
[Item::MELON_SEEDS, 0],
[Item::PUMPKIN_SEEDS, 0],
[Item::CARROT, 0],
[Item::POTATO, 0],
[Item::BEETROOT_SEEDS, 0],
[Item::EGG, 0],
[Item::DYE, 0],
[Item::DYE, 7],
[Item::DYE, 6],
[Item::DYE, 5],
[Item::DYE, 4],
[Item::DYE, 3],
[Item::DYE, 2],
[Item::DYE, 1],
[Item::DYE, 15],
[Item::DYE, 14],
[Item::DYE, 13],
[Item::DYE, 12],
[Item::DYE, 11],
[Item::DYE, 10],
[Item::DYE, 9],
[Item::DYE, 8],
);
function __construct(){
$this->server = Server::getInstance();
}
public function init(){
$this->server->schedule(1, array($this, "blockUpdateTick"), array(), true);
$this->server->api->console->register("give", "<player> <item[:damage]> [amount]", array($this, "commandHandler"));
}
public function commandHandler($cmd, $params, $issuer, $alias){
$output = "";
switch($cmd){
case "give":
if(!isset($params[0]) or !isset($params[1])){
$output .= "Usage: /give <player> <item[:damage]> [amount]\n";
break;
}
$player = Player::get($params[0]);
$item = Item::fromString($params[1]);
if(!isset($params[2])){
$item->setCount($item->getMaxStackSize());
}else{
$item->setCount((int) $params[2]);
}
if($player instanceof Player){
if(($player->gamemode & 0x01) === 0x01){
$output .= "Player is in creative mode.\n";
break;
}
if($item->getID() == 0){
$output .= "You cannot give an air block to a player.\n";
break;
}
$player->addItem(clone $item);
$output .= "Giving " . $item->getCount() . " of " . $item->getName() . " (" . $item->getID() . ":" . $item->getMetadata() . ") to " . $player->getName() . "\n";
}else{
$output .= "Unknown player.\n";
}
break;
}
return $output;
}
public function blockUpdateAround(Position $pos, $type = Level::BLOCK_UPDATE_NORMAL, $delay = false){
if($delay !== false){
$this->scheduleBlockUpdate($pos->getSide(0), $delay, $type);
$this->scheduleBlockUpdate($pos->getSide(1), $delay, $type);
$this->scheduleBlockUpdate($pos->getSide(2), $delay, $type);
$this->scheduleBlockUpdate($pos->getSide(3), $delay, $type);
$this->scheduleBlockUpdate($pos->getSide(4), $delay, $type);
$this->scheduleBlockUpdate($pos->getSide(5), $delay, $type);
}else{
$this->blockUpdate($pos->getSide(0), $type);
$this->blockUpdate($pos->getSide(1), $type);
$this->blockUpdate($pos->getSide(2), $type);
$this->blockUpdate($pos->getSide(3), $type);
$this->blockUpdate($pos->getSide(4), $type);
$this->blockUpdate($pos->getSide(5), $type);
}
}
public function blockUpdate(Position $pos, $type = Level::BLOCK_UPDATE_NORMAL){
if(!($pos instanceof block\Block)){
$block = $pos->level->getBlock($pos);
}else{
$pos = new Position($pos->x, $pos->y, $pos->z, $pos->level);
$block = $pos->level->getBlock($pos);
}
if($block === false){
return false;
}
$level = $block->onUpdate($type);
if($level === Level::BLOCK_UPDATE_NORMAL){
$this->blockUpdateAround($block, $level);
}
return $level;
}
public function scheduleBlockUpdate(Position $pos, $delay, $type = Level::BLOCK_UPDATE_SCHEDULED){
$type = (int) $type;
if($delay < 0){
return false;
}
$index = $pos->x . "." . $pos->y . "." . $pos->z . "." . $pos->level->getName() . "." . $type;
$delay = microtime(true) + $delay * 0.05;
if(!isset($this->scheduledUpdates[$index])){
$this->scheduledUpdates[$index] = $pos;
$this->server->query("INSERT INTO blockUpdates (x, y, z, level, type, delay) VALUES (" . $pos->x . ", " . $pos->y . ", " . $pos->z . ", '" . $pos->level->getName() . "', " . $type . ", " . $delay . ");");
return true;
}
return false;
}
public function blockUpdateTick(){
$time = microtime(true);
if(count($this->scheduledUpdates) > 0){
$update = $this->server->query("SELECT x,y,z,level,type FROM blockUpdates WHERE delay <= " . $time . ";");
if($update instanceof \SQLite3Result){
$upp = array();
while(($up = $update->fetchArray(SQLITE3_ASSOC)) !== false){
$index = $up["x"] . "." . $up["y"] . "." . $up["z"] . "." . $up["level"] . "." . $up["type"];
if(isset($this->scheduledUpdates[$index])){
$upp[] = array((int) $up["type"], $this->scheduledUpdates[$index]);
unset($this->scheduledUpdates[$index]);
}
}
$this->server->query("DELETE FROM blockUpdates WHERE delay <= " . $time . ";");
foreach($upp as $b){
$this->blockUpdate($b[1], $b[0]);
}
}
}
}
}

View File

@ -1,66 +0,0 @@
<?php
/**
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine;
use pocketmine\level\Level;
class LevelAPI{
private $server;
public function __construct(){
$this->server = Server::getInstance();
}
public function init(){
$this->server->api->console->register("save-all", "", array($this, "commandHandler"));
$this->server->api->console->register("save-on", "", array($this, "commandHandler"));
$this->server->api->console->register("save-off", "", array($this, "commandHandler"));
}
public function commandHandler($cmd, $params, $issuer, $alias){
$output = "";
switch($cmd){
case "save-all":
$save = $this->server->saveEnabled;
$this->server->saveEnabled = true;
Level::saveAll();
$this->server->saveEnabled = $save;
break;
case "save-on":
$this->server->saveEnabled = true;
break;
case "save-off":
$this->server->saveEnabled = false;
break;
}
return $output;
}
public function __destruct(){
Level::saveAll();
foreach(Level::getAll() as $level){
$level->unload(true);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,345 +0,0 @@
<?php
/**
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine;
use pocketmine\entity\Entity;
use pocketmine\level\Level;
use pocketmine\level\Position;
use pocketmine\math\Vector3 as Vector3;
class PlayerAPI{
private $server;
function __construct(){
$this->server = Server::getInstance();
}
public function init(){
$this->server->schedule(20 * 15, array($this, "handle"), 1, true, "server.regeneration");
$this->server->addHandler("player.death", array($this, "handle"), 1);
$this->server->api->console->register("list", "", array($this, "commandHandler"));
$this->server->api->console->register("kill", "<player>", array($this, "commandHandler"));
$this->server->api->console->register("gamemode", "<mode> [player]", array($this, "commandHandler"));
$this->server->api->console->register("tp", "[target player] <destination player | w:world> OR /tp [target player] <x> <y> <z>", array($this, "commandHandler"));
$this->server->api->console->register("spawnpoint", "[player | w:world] [x] [y] [z]", array($this, "commandHandler"));
$this->server->api->console->register("spawn", "", array($this, "commandHandler"));
$this->server->api->console->register("ping", "", array($this, "commandHandler"));
$this->server->api->console->alias("lag", "ping");
$this->server->api->console->alias("suicide", "kill");
$this->server->api->console->alias("tppos", "tp");
$this->server->api->ban->cmdWhitelist("list");
$this->server->api->ban->cmdWhitelist("ping");
$this->server->api->ban->cmdWhitelist("spawn");
}
public function handle($data, $event){
switch($event){
case "server.regeneration":
/*if($this->server->difficulty === 0){
$result = $this->server->preparedSQL->selectPlayersToHeal->execute();
if($result !== false){
while(($player = $result->fetchArray()) !== false){
if(($player = Entity::get($player["EID"])) !== false){
if($player->getHealth() <= 0){
continue;
}
$player->setHealth(min(20, $player->getHealth() + $data), "regeneration");
}
}
return true;
}
}*/
break;
case "player.death":
if(is_numeric($data["cause"])){
$e = Entity::get($data["cause"]);
if($e instanceof Entity){
switch($e->class){
case ENTITY_PLAYER:
$message = " was killed by " . $e->name;
break;
default:
$message = " was killed";
break;
}
}
}else{
switch($data["cause"]){
case "cactus":
$message = " was pricked to death";
break;
case "lava":
$message = " tried to swim in lava";
break;
case "fire":
$message = " went up in flames";
break;
case "burning":
$message = " burned to death";
break;
case "suffocation":
$message = " suffocated in a wall";
break;
case "water":
$message = " drowned";
break;
case "void":
$message = " fell out of the world";
break;
case "fall":
$message = " hit the ground too hard";
break;
case "explosion":
$message = " blew up";
break;
default:
$message = " died";
break;
}
}
Player::broadcastMessage($data["player"]->getName() . $message);
return true;
}
return;
}
public function commandHandler($cmd, $params, $issuer, $alias){
$output = "";
switch($cmd){
case "spawnpoint":
if(count($params) === 0){
$output .= "Usage: /$cmd [player | w:world] [x] [y] [z]\n";
break;
}
if(!($issuer instanceof Player) and count($params) < 4){
$output .= "Please run this command in-game.\n";
break;
}
if(count($params) === 1 or count($params) === 4){
$tg = array_shift($params);
if(count($params) === 3 and substr($tg, 0, 2) === "w:"){
$target = Level::get(substr($tg, 2));
}else{
$target = Player::get($tg);
}
}else{
$target = $issuer;
}
if(!($target instanceof Player) and !($target instanceof Level)){
$output .= "That player cannot be found.\n";
break;
}
if(count($params) === 3){
if($target instanceof Level){
$spawn = new Vector3(floatval(array_shift($params)), floatval(array_shift($params)), floatval(array_shift($params)));
}else{
$spawn = new Position(floatval(array_shift($params)), floatval(array_shift($params)), floatval(array_shift($params)), $issuer->level);
}
}else{
$spawn = new Position($issuer->entity->x, $issuer->entity->y, $issuer->entity->z, $issuer->entity->level);
}
$target->setSpawn($spawn);
if($target instanceof Level){
$output .= "Spawnpoint of world " . $target->getName() . " set correctly!\n";
}elseif($target !== $issuer){
$output .= "Spawnpoint of " . $target->getName() . " set correctly!\n";
}else{
$output .= "Spawnpoint set correctly!\n";
}
break;
case "spawn":
if(!($issuer instanceof Player)){
$output .= "Please run this command in-game.\n";
break;
}
$issuer->teleport(Level::getDefault()->getSafeSpawn());
break;
case "ping":
if(!($issuer instanceof Player)){
$output .= "Please run this command in-game.\n";
break;
}
$output .= "ping " . round($issuer->getLag(), 2) . "ms, packet loss " . round($issuer->getPacketLoss() * 100, 2) . "%, " . round($issuer->getBandwidth() / 1024, 2) . " KB/s\n";
break;
case "gamemode":
$player = false;
$setgm = false;
$gms = array(
"0" => 0,
"survival" => 0,
"s" => 0,
"1" => 1,
"creative" => 1,
"c" => 1,
"2" => 2,
"adventure" => 2,
"a" => 2,
"3" => 3,
"view" => 3,
"viewer" => 3,
"spectator" => 3,
"v" => 3,
);
if(isset($params[1])){
if(Player::get($params[1]) instanceof Player){
$player = Player::get($params[1]);
$setgm = $params[0];
}elseif(Player::get($params[0]) instanceof Player){
$player = Player::get($params[0]);
$setgm = $params[1];
}else{
$output .= "Usage: /$cmd <mode> [player] or /$cmd [player] <mode>\n";
break;
}
}elseif(isset($params[0])){
if(!(Player::get($params[0]) instanceof Player)){
if($issuer instanceof Player){
$setgm = $params[0];
$player = $issuer;
}
}
}
if(!($player instanceof Player) or !isset($gms[strtolower($setgm)])){
$output .= "Usage: /$cmd <mode> [player] or /$cmd [player] <mode>\n";
break;
}
if($player->setGamemode($gms[strtolower($setgm)])){
$output .= "Gamemode of " . $player->getName() . " changed to " . $player->getGamemode() . "\n";
}
break;
case "tp":
if(count($params) <= 2 or substr($params[0], 0, 2) === "w:" or substr($params[1], 0, 2) === "w:"){
if((!isset($params[1]) or substr($params[0], 0, 2) === "w:") and isset($params[0]) and ($issuer instanceof Player)){
$name = $issuer->getName();
$target = implode(" ", $params);
}elseif(isset($params[1]) and isset($params[0])){
$name = array_shift($params);
$target = implode(" ", $params);
}else{
$output .= "Usage: /$cmd [target player] <destination player | w:world>\n";
break;
}
if($this->teleport($name, $target) !== false){
$output .= "\"$name\" teleported to \"$target\"\n";
}else{
$output .= "Couldn't teleport.\n";
}
}else{
if(!isset($params[3]) and isset($params[2]) and isset($params[1]) and isset($params[0]) and ($issuer instanceof Player)){
$name = $issuer->getName();
$x = $params[0];
$y = $params[1];
$z = $params[2];
}elseif(isset($params[3]) and isset($params[2]) and isset($params[1]) and isset($params[0])){
$name = $params[0];
$x = $params[1];
$y = $params[2];
$z = $params[3];
}else{
$output .= "Usage: /$cmd [player] <x> <y> <z>\n";
break;
}
if($this->tppos($name, $x, $y, $z)){
$output .= "\"$name\" teleported to ($x, $y, $z)\n";
}else{
$output .= "Couldn't teleport.\n";
}
}
break;
case "kill":
case "suicide":
if(!isset($params[0]) and ($issuer instanceof Player)){
$player = $issuer;
}else{
$player = Player::get($params[0]);
}
if($player instanceof Player){
$player->harm(1000, "console", true);
$player->sendMessage("Ouch. That looks like it hurt.\n");
}else{
$output .= "Usage: /$cmd [player]\n";
}
break;
case "list":
$output .= "There are " . count(Player::$list) . "/" . $this->server->maxClients . " players online:\n";
if(count(Player::$list) == 0){
break;
}
foreach(Player::$list as $c){
$output .= $c->getName() . ", ";
}
$output = substr($output, 0, -2) . "\n";
break;
}
return $output;
}
public function teleport(&$name, &$target){
if(substr($target, 0, 2) === "w:"){
$lv = Level::get(substr($target, 2));
if($lv instanceof Level){
$origin = Player::get($name);
if($origin instanceof Player){
$name = $origin->getName();
return $origin->teleport($lv->getSafeSpawn());
}
}else{
return false;
}
}
$player = Player::get($target);
if($player instanceof Player and $player->spawned === true){
$target = $player->getName();
$origin = Player::get($name);
if($origin instanceof Player){
$name = $origin->getName();
return $origin->teleport($player->entity);
}
}
return false;
}
public function tppos(&$name, &$x, &$y, &$z){
$player = Player::get($name);
if($player instanceof Player and $player->spawned === true){
$name = $player->getName();
$x = $x{0} === "~" ? $player->x + floatval(substr($x, 1)) : floatval($x);
$y = $y{0} === "~" ? $player->y + floatval(substr($y, 1)) : floatval($y);
$z = $z{0} === "~" ? $player->z + floatval(substr($z, 1)) : floatval($z);
$player->teleport(new Vector3($x, $y, $z));
return true;
}
return false;
}
}

View File

@ -1,369 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
*
*
*/
namespace {
/**
* Output text to the console, can contain Minecraft-formatted text.
*
* @param string $message
* @param bool $EOL
* @param bool $log
* @param int $level
*/
function console($message, $EOL = true, $log = true, $level = 1){
pocketmine\console($message, $EOL, $log, $level);
}
function safe_var_dump(){
static $cnt = 0;
foreach(func_get_args() as $var){
switch(true){
case is_array($var):
echo str_repeat(" ", $cnt) . "array(" . count($var) . ") {" . PHP_EOL;
foreach($var as $key => $value){
echo str_repeat(" ", $cnt + 1) . "[" . (is_integer($key) ? $key : '"' . $key . '"') . "]=>" . PHP_EOL;
++$cnt;
safe_var_dump($value);
--$cnt;
}
echo str_repeat(" ", $cnt) . "}" . PHP_EOL;
break;
case is_integer($var):
echo str_repeat(" ", $cnt) . "int(" . $var . ")" . PHP_EOL;
break;
case is_float($var):
echo str_repeat(" ", $cnt) . "float(" . $var . ")" . PHP_EOL;
break;
case is_bool($var):
echo str_repeat(" ", $cnt) . "bool(" . ($var === true ? "true" : "false") . ")" . PHP_EOL;
break;
case is_string($var):
echo str_repeat(" ", $cnt) . "string(" . strlen($var) . ") \"$var\"" . PHP_EOL;
break;
case is_resource($var):
echo str_repeat(" ", $cnt) . "resource() of type (" . get_resource_type($var) . ")" . PHP_EOL;
break;
case is_object($var):
echo str_repeat(" ", $cnt) . "object(" . get_class($var) . ")" . PHP_EOL;
break;
case is_null($var):
echo str_repeat(" ", $cnt) . "NULL" . PHP_EOL;
break;
}
}
}
function dummy(){
}
}
namespace pocketmine {
use pocketmine\utils\TextFormat;
use pocketmine\utils\Utils;
use pocketmine\wizard\Installer;
const VERSION = "Alpha_1.4dev";
const API_VERSION = "1.0.0";
const CODENAME = "絶好(Zekkou)ケーキ(Cake)";
const MINECRAFT_VERSION = "v0.8.1 alpha";
const PHP_VERSION = "5.5";
@define("pocketmine\\PATH", \getcwd() . DIRECTORY_SEPARATOR);
if(!class_exists("SplClassLoader", false)){
require_once(\pocketmine\PATH . "src/spl/SplClassLoader.php");
}
$autoloader = new \SplClassLoader();
$autoloader->add("pocketmine", array(
\pocketmine\PATH . "src"
));
$autoloader->register(true);
//Startup code. Do not look at it, it can harm you. Most of them are hacks to fix date-related bugs, or basic functions used after this
set_time_limit(0); //Who set it to 30 seconds?!?!
if(ini_get("date.timezone") == ""){ //No Timezone set
date_default_timezone_set("GMT");
if(strpos(" " . strtoupper(php_uname("s")), " WIN") !== false){
$time = time();
$time -= $time % 60;
//TODO: Parse different time & date formats by region. ¬¬ world
//Example: USA
exec("time.exe /T", $hour);
$i = array_map("intval", explode(":", trim($hour[0])));
exec("date.exe /T", $date);
$j = array_map("intval", explode(substr($date[0], 2, 1), trim($date[0])));
$offset = round((mktime($i[0], $i[1], 0, $j[1], $j[0], $j[2]) - $time) / 60) * 60;
}else{
exec("date +%s", $t);
$offset = round((intval(trim($t[0])) - time()) / 60) * 60;
}
$daylight = (int) date("I");
$d = timezone_name_from_abbr("", $offset, $daylight);
@ini_set("date.timezone", $d);
date_default_timezone_set($d);
}else{
$d = @date_default_timezone_get();
if(strpos($d, "/") === false){
$d = timezone_name_from_abbr($d);
@ini_set("date.timezone", $d);
date_default_timezone_set($d);
}
}
gc_enable();
error_reporting(E_ALL | E_STRICT);
ini_set("allow_url_fopen", 1);
ini_set("display_errors", 1);
ini_set("display_startup_errors", 1);
ini_set("default_charset", "utf-8");
ini_set("memory_limit", "128M"); //Default
define("pocketmine\\START_TIME", microtime(true));
$opts = getopt("", array("enable-ansi", "disable-ansi", "data:", "plugins:", "no-wizard"));
define("pocketmine\\DATA", isset($opts["data"]) ? realpath($opts["data"]) . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR);
define("pocketmine\\PLUGIN_PATH", isset($opts["plugins"]) ? realpath($opts["plugins"]) . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR);
if((strpos(strtoupper(php_uname("s")), "WIN") === false or isset($opts["enable-ansi"])) and !isset($opts["disable-ansi"])){
define("pocketmine\\ANSI", true);
}else{
define("pocketmine\\ANSI", false);
}
function kill($pid){
switch(Utils::getOS()){
case "win":
exec("taskkill.exe /F /PID " . ((int) $pid) . " > NUL");
break;
case "mac":
case "linux":
default:
exec("kill -9 " . ((int) $pid) . " > /dev/null 2>&1");
}
}
/**
* Output text to the console, can contain Minecraft-formatted text.
*
* @param $message
* @param bool $EOL
* @param bool $log
* @param int $level
*/
function console($message, $EOL = true, $log = true, $level = 1){
if(!defined("pocketmine\\DEBUG") or \pocketmine\DEBUG >= $level){
$message .= $EOL === true ? PHP_EOL : "";
if($message{0} !== "["){
$message = "[INFO] $message";
}
$time = (\pocketmine\ANSI === true ? TextFormat::AQUA . date("H:i:s") . TextFormat::RESET : date("H:i:s")) . " ";
$replaced = TextFormat::clean(preg_replace('/\x1b\[[0-9;]*m/', "", $time . $message));
if($log === true and (!defined("LOG") or LOG === true)){
log(date("Y-m-d") . " " . $replaced, "server", false, $level);
}
if(\pocketmine\ANSI === true){
$add = "";
if(preg_match("/^\\[([a-zA-Z0-9]*)\\]/", $message, $matches) > 0){
switch($matches[1]){
case "ERROR":
case "SEVERE":
$add .= TextFormat::RED;
break;
case "TRACE":
case "INTERNAL":
case "DEBUG":
$add .= TextFormat::GRAY;
break;
case "WARNING":
$add .= TextFormat::YELLOW;
break;
case "NOTICE":
$add .= TextFormat::AQUA;
break;
default:
$add = "";
break;
}
}
$message = TextFormat::toANSI($time . $add . $message . TextFormat::RESET);
}else{
$message = $replaced;
}
echo $message;
}
}
function getTrace($start = 1){
$e = new \Exception();
$trace = $e->getTrace();
$messages = array();
$j = 0;
for($i = (int) $start; isset($trace[$i]); ++$i, ++$j){
$params = "";
if(isset($trace[$i]["args"])){
foreach($trace[$i]["args"] as $name => $value){
$params .= (is_object($value) ? get_class($value) . " " . (method_exists($value, "__toString") ? $value->__toString() : "object") : gettype($value) . " " . @strval($value)) . ", ";
}
}
$messages[] = "#$j " . (isset($trace[$i]["file"]) ? $trace[$i]["file"] : "") . "(" . (isset($trace[$i]["line"]) ? $trace[$i]["line"] : "") . "): " . (isset($trace[$i]["class"]) ? $trace[$i]["class"] . $trace[$i]["type"] : "") . $trace[$i]["function"] . "(" . substr($params, 0, -2) . ")";
}
return $messages;
}
function error_handler($errno, $errstr, $errfile, $errline){
if(error_reporting() === 0){ //@ error-control
return false;
}
$errorConversion = array(
E_ERROR => "E_ERROR",
E_WARNING => "E_WARNING",
E_PARSE => "E_PARSE",
E_NOTICE => "E_NOTICE",
E_CORE_ERROR => "E_CORE_ERROR",
E_CORE_WARNING => "E_CORE_WARNING",
E_COMPILE_ERROR => "E_COMPILE_ERROR",
E_COMPILE_WARNING => "E_COMPILE_WARNING",
E_USER_ERROR => "E_USER_ERROR",
E_USER_WARNING => "E_USER_WARNING",
E_USER_NOTICE => "E_USER_NOTICE",
E_STRICT => "E_STRICT",
E_RECOVERABLE_ERROR => "E_RECOVERABLE_ERROR",
E_DEPRECATED => "E_DEPRECATED",
E_USER_DEPRECATED => "E_USER_DEPRECATED",
);
$type = ($errno === E_ERROR or $errno === E_WARNING or $errno === E_USER_ERROR or $errno === E_USER_WARNING) ? "ERROR" : "NOTICE";
$errno = isset($errorConversion[$errno]) ? $errorConversion[$errno] : $errno;
console("[$type] A $errno error happened: \"$errstr\" in \"$errfile\" at line $errline", true, true, 0);
foreach(getTrace() as $i => $line){
console("[TRACE] $line");
}
return true;
}
function log($message, $name, $EOL = true, $level = 2, $close = false){
global $fpointers;
if((!defined("pocketmine\\DEBUG") or \pocketmine\DEBUG >= $level) and (!defined("pocketmine\\LOG") or \pocketmine\LOG === true)){
$message .= $EOL === true ? PHP_EOL : "";
if(!isset($fpointers)){
$fpointers = array();
}
if(!isset($fpointers[$name]) or $fpointers[$name] === false){
$fpointers[$name] = @fopen(\pocketmine\DATA . "/" . $name . ".log", "ab");
}
@fwrite($fpointers[$name], $message);
if($close === true){
fclose($fpointers[$name]);
unset($fpointers[$name]);
}
}
}
set_error_handler("\\pocketmine\\error_handler", E_ALL);
$errors = 0;
if(version_compare("5.4.0", PHP_VERSION) > 0){
console("[ERROR] Use PHP >= 5.4.0", true, true, 0);
++$errors;
}
if(php_sapi_name() !== "cli"){
console("[ERROR] You must run PocketMine-MP using the CLI.", true, true, 0);
++$errors;
}
if(!extension_loaded("sockets")){
console("[ERROR] Unable to find the Socket extension.", true, true, 0);
++$errors;
}
if(!extension_loaded("pthreads")){
console("[ERROR] Unable to find the pthreads extension.", true, true, 0);
++$errors;
}else{
$pthreads_version = phpversion("pthreads");
if(substr_count($pthreads_version, ".") < 2){
$pthreads_version = "0.$pthreads_version";
}
if(version_compare($pthreads_version, "2.0.4") < 0){
console("[ERROR] pthreads >= 2.0.4 is required, while you have $pthreads_version.", true, true, 0);
++$errors;
}
}
if(!extension_loaded("curl")){
console("[ERROR] Unable to find the cURL extension.", true, true, 0);
++$errors;
}
if(!extension_loaded("sqlite3")){
console("[ERROR] Unable to find the SQLite3 extension.", true, true, 0);
++$errors;
}
if(!extension_loaded("yaml")){
console("[ERROR] Unable to find the YAML extension.", true, true, 0);
++$errors;
}
if(!extension_loaded("zlib")){
console("[ERROR] Unable to find the Zlib extension.", true, true, 0);
++$errors;
}
if($errors > 0){
console("[ERROR] Please use the installer provided on the homepage, or recompile PHP again.", true, true, 0);
exit(1); //Exit with error
}
if(file_exists(\pocketmine\PATH . ".git/refs/heads/master")){ //Found Git information!
define("pocketmine\\GIT_COMMIT", strtolower(trim(file_get_contents(\pocketmine\PATH . ".git/refs/heads/master"))));
}else{ //Unknown :(
define("pocketmine\\GIT_COMMIT", str_repeat("00", 20));
}
@ini_set("opcache.mmap_base", bin2hex(Utils::getRandomBytes(8, false))); //Fix OPCache address errors
if(!file_exists(\pocketmine\DATA . "server.properties") and !isset($opts["no-wizard"])){
new Installer();
}
if(substr(__FILE__, 0, 7) !== "phar"){
console("[WARNING] Non-packaged PocketMine-MP installation detected, do not use on production.");
}
$server = new Server($autoloader, \pocketmine\PATH, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);
$server->start();
kill(getmypid());
exit(0);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,363 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine;
use pocketmine\network\query\QueryHandler;
use pocketmine\network\rcon\RCON;
use pocketmine\network\upnp\UPnP;
use pocketmine\plugin\PluginManager;
use pocketmine\utils\Config;
use pocketmine\utils\TextFormat;
use pocketmine\utils\Utils;
use pocketmine\utils\VersionString;
class ServerAPI{
public $restart = false;
private static $serverRequest = false;
private $asyncCalls = array();
private $server;
private $config;
private $apiList = array();
private $asyncCnt = 0;
private $rcon;
public $query;
//TODO: Instead of hard-coding functions, use PHPDoc-compatible methods to load APIs.
/** @var ConsoleAPI */
public $console;
/** @var LevelAPI */
public $level;
/** @var BlockAPI */
public $block;
/** @var ChatAPI */
public $chat;
/** @var BanAPI */
public $ban;
/** @var TimeAPI */
public $time;
/** @var PlayerAPI */
public $player;
/**
* @return Server
*/
public static function request(){
return self::$serverRequest;
}
public function start(){
return $this->run();
}
public function run(){
$this->load();
return $this->init();
}
public function load(){
@mkdir(\pocketmine\DATA . "players/", 0755);
@mkdir(\pocketmine\DATA . "worlds/", 0755);
@mkdir(\pocketmine\DATA . "plugins/", 0755);
$version = new VersionString();
console("[INFO] Starting Minecraft: PE server version " . TextFormat::AQUA . MINECRAFT_VERSION);
console("[INFO] Loading properties...");
$this->config = new Config(\pocketmine\DATA . "server.properties", Config::PROPERTIES, array(
"server-name" => "Minecraft: PE Server",
"description" => "Server made using PocketMine-MP",
"motd" => "Welcome @player to this server!",
"server-port" => 19132,
"server-type" => "normal",
"memory-limit" => "128M",
"last-update" => false,
"white-list" => false,
"announce-player-achievements" => true,
"spawn-protection" => 16,
"view-distance" => 8,
"max-players" => 20,
"allow-flight" => false,
"spawn-animals" => true,
"spawn-mobs" => true,
"gamemode" => 0,
"hardcore" => false,
"pvp" => true,
"difficulty" => 1,
"generator-settings" => "",
"level-name" => "world",
"level-seed" => "",
"level-type" => "DEFAULT",
"enable-query" => true,
"enable-rcon" => false,
"rcon.password" => substr(base64_encode(Utils::getRandomBytes(20, false)), 3, 10),
"auto-save" => true,
));
$this->parseProperties();
//Load advanced properties
define("pocketmine\\DEBUG", $this->getProperty("debug", 1));
define("ADVANCED_CACHE", $this->getProperty("enable-advanced-cache", false));
define("MAX_CHUNK_RATE", 20 / $this->getProperty("max-chunks-per-second", 7)); //Default rate ~448 kB/s
if(ADVANCED_CACHE == true){
console("[INFO] Advanced cache enabled");
}
if($this->getProperty("upnp-forwarding") == true){
console("[INFO] [UPnP] Trying to port forward...");
UPnP::PortForward($this->getProperty("server-port"));
}
$this->server = new Server($this->getProperty("server-name"), $this->getProperty("gamemode"), ($seed = $this->getProperty("level-seed")) != "" ? (int) $seed : false, $this->getProperty("server-port"), ($ip = $this->getProperty("server-ip")) != "" ? $ip : "0.0.0.0");
$this->server->api = $this;
self::$serverRequest = $this->server;
console("[INFO] This server is running PocketMine-MP version " . ($version->isDev() ? TextFormat::YELLOW : "") . VERSION . TextFormat::RESET . " \"" . CODENAME . "\" (API " . API_VERSION . ")", true, true, 0);
console("[INFO] PocketMine-MP is distributed under the LGPL License", true, true, 0);
if($this->getProperty("last-update") === false or ($this->getProperty("last-update") + 3600) < time()){
console("[INFO] Checking for new server version");
console("[INFO] Last check: " . TextFormat::AQUA . date("Y-m-d H:i:s", $this->getProperty("last-update")) . "\x1b[0m");
if($this->server->version->isDev()){
$info = json_decode(Utils::getURL("https://api.github.com/repos/PocketMine/PocketMine-MP/commits"), true);
if($info === false or !isset($info[0])){
console("[ERROR] Github API error");
}else{
$last = new \DateTime($info[0]["commit"]["committer"]["date"]);
$last = $last->getTimestamp();
if($last >= $this->getProperty("last-update") and $this->getProperty("last-update") !== false and \pocketmine\GIT_COMMIT != $info[0]["sha"]){
console("[NOTICE] " . TextFormat::YELLOW . "A new DEVELOPMENT version of PocketMine-MP has been released!");
console("[NOTICE] " . TextFormat::YELLOW . "Commit \"" . $info[0]["commit"]["message"] . "\" [" . substr($info[0]["sha"], 0, 10) . "] by " . $info[0]["commit"]["committer"]["name"]);
console("[NOTICE] " . TextFormat::YELLOW . "Get it at PocketMine.net or at https://github.com/PocketMine/PocketMine-MP/archive/" . $info[0]["sha"] . ".zip");
console("[NOTICE] This message will disappear after issuing the command \"/update-done\"");
}else{
$this->setProperty("last-update", time());
console("[INFO] " . TextFormat::AQUA . "This is the latest DEVELOPMENT version");
}
}
}else{
$info = json_decode(Utils::getURL("https://api.github.com/repos/PocketMine/PocketMine-MP/tags"), true);
if($info === false or !isset($info[0])){
console("[ERROR] Github API error");
}else{
$newest = new VersionString(VERSION);
$newestN = $newest->getNumber();
$update = new VersionString($info[0]["name"]);
$updateN = $update->getNumber();
if($updateN > $newestN){
console("[NOTICE] " . TextFormat::GREEN . "A new STABLE version of PocketMine-MP has been released!");
console("[NOTICE] " . TextFormat::GREEN . "Version \"" . $info[0]["name"] . "\" #" . $updateN);
console("[NOTICE] Get it at PocketMine.net or at " . $info[0]["zipball_url"]);
console("[NOTICE] This message will disappear as soon as you update");
}else{
$this->setProperty("last-update", time());
console("[INFO] " . TextFormat::AQUA . "This is the latest STABLE version");
}
}
}
}
$this->loadProperties();
$this->apiList[] = $this->console = new ConsoleAPI();
$this->apiList[] = $this->level = new LevelAPI();
$this->apiList[] = $this->block = new BlockAPI();
$this->apiList[] = $this->chat = new ChatAPI();
$this->apiList[] = $this->ban = new BanAPI();
$this->apiList[] = $this->player = new PlayerAPI();
$this->apiList[] = $this->time = new TimeAPI();
foreach($this->apiList as $ob){
if(is_callable(array($ob, "init"))){
$ob->init(); //Fails sometimes!!!
}
}
console("[INFO] Loaded " . count(PluginManager::loadPlugins(\pocketmine\DATA . "plugins/")) . " plugin(s).");
}
public function async(callable $callable, $params = array(), $remove = false){
$cnt = $this->asyncCnt++;
$this->asyncCalls[$cnt] = new \Async($callable, $params);
return $remove === true ? $this->getAsync($cnt) : $cnt;
}
public function getAsync($id){
if(!isset($this->asyncCalls[$id])){
return false;
}
$ob = $this->asyncCalls[$id];
unset($this->asyncCalls[$id]);
return $ob;
}
public function __destruct(){
foreach($this->apiList as $i => $ob){
if(method_exists($ob, "__destruct")){
$ob->__destruct();
unset($this->apiList[$i]);
}
}
}
private function writeProperties(){
$this->config->save();
}
public function init(){
if(!(self::$serverRequest instanceof Server)){
self::$serverRequest = $this->server;
}
if($this->getProperty("send-usage", true) !== false){
$this->server->schedule(6000, array($this, "sendUsage"), array(), true); //Send the info after 5 minutes have passed
$this->sendUsage();
}
if($this->getProperty("auto-save") === true){
$this->server->schedule(18000, array($this, "autoSave"), array(), true);
}
if(!defined("NO_THREADS") and $this->getProperty("enable-rcon") === true){
$this->rcon = new RCON($this->getProperty("rcon.password", ""), $this->getProperty("rcon.port", $this->getProperty("server-port")), ($ip = $this->getProperty("server-ip")) != "" ? $ip : "0.0.0.0", $this->getProperty("rcon.threads", 1), $this->getProperty("rcon.clients-per-thread", 50));
}
if($this->getProperty("enable-query") === true){
$this->query = new QueryHandler();
}
$this->schedule(2, array($this, "checkTickUpdates"), array(), true);
$this->server->init();
unregister_tick_function(array($this->server, "tick"));
$this->console->__destruct();
if($this->rcon instanceof RCON){
$this->rcon->stop();
}
$this->__destruct();
if($this->getProperty("upnp-forwarding") === true){
console("[INFO] [UPnP] Removing port forward...");
UPnP::RemovePortForward($this->getProperty("server-port"));
}
return $this->restart;
}
/*-------------------------------------------------------------*/
public function asyncOperation($t, $d, $c = null){
return $this->server->asyncOperation($t, $d, $c);
}
public function addHandler($e, $c, $p = 5){
return $this->server->addHandler($e, $c, $p);
}
public function dhandle($e, $d){
return $this->server->handle($e, $d);
}
public function handle($e, &$d){
return $this->server->handle($e, $d);
}
public function schedule($t, $c, $d, $r = false, $e = "server.schedule"){
return $this->server->schedule($t, $c, $d, $r, $e);
}
public function event($e, $d){
return $this->server->event($e, $d);
}
public function trigger($e, $d){
return $this->server->trigger($e, $d);
}
public function deleteEvent($id){
return $this->server->deleteEvent($id);
}
public function getProperties(){
return $this->config->getAll();
}
public function getProperty($name, $default = false){
$v = getopt("", array("$name::"));
if(isset($v[$name]) !== false){ //Allow for command-line arguments
$v = $v[$name];
switch(strtolower(trim($v))){
case "":
case "on":
case "true":
case "yes":
$v = true;
break;
case "off":
case "false":
case "no":
$v = false;
break;
}
switch($name){
case "last-update":
if($v === false){
$v = time();
}else{
$v = (int) $v;
}
break;
case "gamemode":
case "max-players":
case "server-port":
case "debug":
case "difficulty":
$v = (int) $v;
break;
}
return $v;
}
return ($this->config->exists($name) ? $this->config->get($name) : $default);
}
public function setProperty($name, $value, $save = true){
$this->config->set($name, $value);
if($save == true){
$this->writeProperties();
}
$this->loadProperties();
}
public function getList(){
return $this->apiList;
}
}

View File

@ -1,735 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
/**
* PocketMine-MP is the Minecraft: PE multiplayer server software
* Homepage: http://www.pocketmine.net/
*/
namespace pocketmine;
use pocketmine\entity\Entity;
use pocketmine\network\Packet;
use pocketmine\network\protocol\Info;
use pocketmine\network\raknet\Info as RakNetInfo;
use pocketmine\network\raknet\Packet as RakNetPacket;
use pocketmine\plugin\PluginManager;
use pocketmine\utils\Utils;
use pocketmine\utils\VersionString;
class ServerOld{
/** @var Server */
private static $instance;
public $tCnt;
public $serverID;
public $interface;
public $database;
public $version;
public $invisible;
public $tickMeasure;
public $preparedSQL;
public $spawn;
public $whitelist;
public $seed;
public $stop;
public $gamemode;
public $difficulty;
public $name;
public $maxClients;
public $eidCnt;
public $custom;
public $description;
public $motd;
public $port;
public $saveEnabled;
private $rcon;
private $query;
private $serverip;
private $evCnt;
private $handCnt;
private $events;
private $eventsID;
private $handlers;
private $serverType;
private $lastTick;
private $doTick;
private $ticks;
private $memoryStats;
private $schedule;
private $asyncThread;
private $async = array();
private $asyncID = 0;
/**
* @return Server
*/
public static function getInstance(){
if(isset(self::$instance)){
return self::$instance;
}
return null;
}
private function load(){
$this->version = new VersionString();
if(defined("pocketmine\\DEBUG") and \pocketmine\DEBUG >= 0 and function_exists("cli_set_process_title")){
@cli_set_process_title("PocketMine-MP " . \pocketmine\VERSION);
}
console("[INFO] Starting Minecraft PE server on " . ($this->serverip === "0.0.0.0" ? "*" : $this->serverip) . ":" . $this->port);
define("BOOTUP_RANDOM", Utils::getRandomBytes(16));
$this->serverID = $this->serverID === false ? Utils::readLong(substr(Utils::getUniqueID(true, $this->serverip . $this->port), 8)) : $this->serverID;
$this->seed = $this->seed === false ? Utils::readInt(Utils::getRandomBytes(4, false)) : $this->seed;
$this->startDatabase();
$this->api = false;
$this->tCnt = 1;
$this->events = array();
$this->eventsID = array();
$this->handlers = array();
$this->invisible = false;
$this->difficulty = 1;
$this->custom = array();
$this->evCnt = 1;
$this->handCnt = 1;
$this->eidCnt = 1;
$this->maxClients = 20;
$this->schedule = array();
$this->scheduleCnt = 1;
$this->description = "";
$this->memoryStats = array();
$this->spawn = false;
$this->saveEnabled = true;
$this->whitelist = false;
$this->tickMeasure = array_fill(0, 40, 0);
$this->setType("normal");
$this->interface = new Handler("255.255.255.255", $this->port, $this->serverip);
$this->stop = false;
$this->ticks = 0;
if(!defined("NO_THREADS")){
$this->asyncThread = new \AsyncMultipleQueue();
}
}
function __construct($name, $gamemode = 0, $seed = false, $port = 19132, $serverip = "0.0.0.0"){
$this->port = (int) $port;
$this->doTick = true;
$this->gamemode = (int) $gamemode;
$this->name = $name;
$this->motd = "Welcome to " . $name;
$this->serverID = false;
$this->seed = $seed;
$this->serverip = $serverip;
self::$instance = $this;
$this->load();
}
/**
* @return float
*/
public function getTPS(){
$v = array_values($this->tickMeasure);
$tps = 40 / ($v[39] - $v[0]);
return round($tps, 4);
}
public function titleTick(){
$time = microtime(true);
if(defined("pocketmine\\DEBUG") and \pocketmine\DEBUG >= 0 and \pocketmine\ANSI === true){
echo "\x1b]0;PocketMine-MP " . VERSION . " | Online " . count(Player::$list) . "/" . $this->maxClients . " | RAM " . round((memory_get_usage() / 1024) / 1024, 2) . "MB | U " . round(($this->interface->bandwidth[1] / max(1, $time - $this->interface->bandwidth[2])) / 1024, 2) . " D " . round(($this->interface->bandwidth[0] / max(1, $time - $this->interface->bandwidth[2])) / 1024, 2) . " kB/s | TPS " . $this->getTPS() . "\x07";
}
$this->interface->bandwidth = array(0, 0, $time);
}
public function loadEvents(){
if(\pocketmine\ANSI === true){
$this->schedule(30, array($this, "titleTick"), array(), true);
}
$this->schedule(20 * 15, array($this, "checkTicks"), array(), true);
$this->schedule(20 * 60, array($this, "checkMemory"), array(), true);
$this->schedule(20 * 45, "pocketmine\\utils\\Cache::cleanup", array(), true);
$this->schedule(20, array($this, "asyncOperationChecker"), array(), true);
}
public function checkTicks(){
if($this->getTPS() < 12){
console("[WARNING] Can't keep up! Is the server overloaded?");
}
}
public function checkMemory(){
$info = $this->debugInfo();
$data = $info["memory_usage"] . "," . $info["players"] . "," . $info["entities"];
$i = count($this->memoryStats) - 1;
if($i < 0 or $this->memoryStats[$i] !== $data){
$this->memoryStats[] = $data;
}
}
public function startDatabase(){
$this->preparedSQL = new \stdClass();
$this->preparedSQL->entity = new \stdClass();
$this->database = new \SQLite3(":memory:", SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE);
$this->query("PRAGMA journal_mode = OFF;");
$this->query("PRAGMA encoding = \"UTF-8\";");
$this->query("PRAGMA secure_delete = OFF;");
$this->query("CREATE TABLE actions (ID INTEGER PRIMARY KEY, interval NUMERIC, last NUMERIC, code TEXT, repeat NUMERIC);");
$this->query("CREATE TABLE handlers (ID INTEGER PRIMARY KEY, name TEXT, priority NUMERIC);");
$this->query("CREATE TABLE blockUpdates (level TEXT, x INTEGER, y INTEGER, z INTEGER, type INTEGER, delay NUMERIC);");
$this->query("CREATE TABLE recipes (id INTEGER PRIMARY KEY, type NUMERIC, recipe TEXT);");
$this->query("PRAGMA synchronous = OFF;");
$this->preparedSQL->selectHandlers = $this->database->prepare("SELECT DISTINCT ID FROM handlers WHERE name = :name ORDER BY priority DESC;");
$this->preparedSQL->selectActions = $this->database->prepare("SELECT ID,code,repeat FROM actions WHERE last <= (:time - interval);");
$this->preparedSQL->updateAction = $this->database->prepare("UPDATE actions SET last = :time WHERE ID = :id;");
}
public function query($sql, $fetch = false){
$result = $this->database->query($sql) or console("[ERROR] [SQL Error] " . $this->database->lastErrorMsg() . ". Query: " . $sql, true, true, 0);
if($fetch === true and ($result instanceof \SQLite3Result)){
$result = $result->fetchArray(SQLITE3_ASSOC);
}
return $result;
}
public function debugInfo($console = false){
$info = array();
$info["tps"] = $this->getTPS();
$info["memory_usage"] = round((memory_get_usage() / 1024) / 1024, 2) . "MB";
$info["memory_peak_usage"] = round((memory_get_peak_usage() / 1024) / 1024, 2) . "MB";
$info["entities"] = count(Entity::$list);
$info["players"] = count(Player::$list);
$info["events"] = count($this->eventsID);
$info["handlers"] = $this->query("SELECT count(ID) as count FROM handlers;", true);
$info["handlers"] = $info["handlers"]["count"];
$info["actions"] = $this->query("SELECT count(ID) as count FROM actions;", true);
$info["actions"] = $info["actions"]["count"];
$info["garbage"] = gc_collect_cycles();
$this->handle("server.debug", $info);
if($console === true){
console("[DEBUG] TPS: " . $info["tps"] . ", Memory usage: " . $info["memory_usage"] . " (Peak " . $info["memory_peak_usage"] . "), Entities: " . $info["entities"] . ", Events: " . $info["events"] . ", Handlers: " . $info["handlers"] . ", Actions: " . $info["actions"] . ", Garbage: " . $info["garbage"], true, true, 2);
}
return $info;
}
/**
* @param string $reason
*/
public function close($reason = "server stop"){
if($this->stop !== true){
if(is_int($reason)){
$reason = "signal stop";
}
if(($this->api instanceof ServerAPI) === true){
if(($this->api->chat instanceof ChatAPI) === true){
Player::broadcastMessage("Stopping server...");
}
}
$this->stop = true;
$this->trigger("server.close", $reason);
$this->interface->close();
if(!defined("NO_THREADS")){
@$this->asyncThread->stop = true;
}
}
}
public function setType($type = "normal"){
switch(trim(strtolower($type))){
case "normal":
case "demo":
$this->serverType = "MCCPP;Demo;";
break;
case "minecon":
$this->serverType = "MCCPP;MINECON;";
break;
}
}
public function asyncOperation($type, array $data, callable $callable = null){
if(defined("NO_THREADS")){
return false;
}
$d = "";
$type = (int) $type;
switch($type){
case ASYNC_CURL_GET:
$d .= Utils::writeShort(strlen($data["url"])) . $data["url"] . (isset($data["timeout"]) ? Utils::writeShort($data["timeout"]) : Utils::writeShort(10));
break;
case ASYNC_CURL_POST:
$d .= Utils::writeShort(strlen($data["url"])) . $data["url"] . (isset($data["timeout"]) ? Utils::writeShort($data["timeout"]) : Utils::writeShort(10));
$d .= Utils::writeShort(count($data["data"]));
foreach($data["data"] as $key => $value){
$d .= Utils::writeShort(strlen($key)) . $key . Utils::writeInt(strlen($value)) . $value;
}
break;
case ASYNC_FUNCTION:
$params = serialize($data["arguments"]);
$d .= Utils::writeShort(strlen($data["function"])) . $data["function"] . Utils::writeInt(strlen($params)) . $params;
break;
default:
return false;
}
$ID = $this->asyncID++;
$this->async[$ID] = $callable;
$this->asyncThread->input .= Utils::writeInt($ID) . Utils::writeShort($type) . $d;
return $ID;
}
public function asyncOperationChecker(){
if(defined("NO_THREADS")){
return false;
}
if(isset($this->asyncThread->output{5})){
$offset = 0;
$ID = Utils::readInt(substr($this->asyncThread->output, $offset, 4));
$offset += 4;
$type = Utils::readShort(substr($this->asyncThread->output, $offset, 2));
$offset += 2;
$data = array();
switch($type){
case ASYNC_CURL_GET:
case ASYNC_CURL_POST:
$len = Utils::readInt(substr($this->asyncThread->output, $offset, 4));
$offset += 4;
$data["result"] = substr($this->asyncThread->output, $offset, $len);
$offset += $len;
break;
case ASYNC_FUNCTION:
$len = Utils::readInt(substr($this->asyncThread->output, $offset, 4));
$offset += 4;
$data["result"] = unserialize(substr($this->asyncThread->output, $offset, $len));
$offset += $len;
break;
}
$this->asyncThread->output = substr($this->asyncThread->output, $offset);
if(isset($this->async[$ID]) and $this->async[$ID] !== null and is_callable($this->async[$ID])){
if(is_array($this->async[$ID])){
$method = $this->async[$ID][1];
$result = $this->async[$ID][0]->$method($data, $type, $ID);
}else{
$result = $this->async[$ID]($data, $type, $ID);
}
}
unset($this->async[$ID]);
}
}
/**
* @param string $event
* @param callable $callable
* @param integer $priority
*
* @return boolean
*/
public function addHandler($event, callable $callable, $priority = 5){
if(!is_callable($callable)){
return false;
}
$priority = (int) $priority;
$hnid = $this->handCnt++;
$this->handlers[$hnid] = $callable;
$this->query("INSERT INTO handlers (ID, name, priority) VALUES (" . $hnid . ", '" . str_replace("'", "\\'", $event) . "', " . $priority . ");");
console("[INTERNAL] New handler " . (is_array($callable) ? get_class($callable[0]) . "::" . $callable[1] : $callable) . " to special event " . $event . " (ID " . $hnid . ")", true, true, 3);
return $hnid;
}
public function dhandle($e, $d){
return $this->handle($e, $d);
}
public function handle($event, &$data){
$this->preparedSQL->selectHandlers->reset();
$this->preparedSQL->selectHandlers->clear();
$this->preparedSQL->selectHandlers->bindValue(":name", $event, SQLITE3_TEXT);
$handlers = $this->preparedSQL->selectHandlers->execute();
$result = null;
if($handlers instanceof \SQLite3Result){
$call = array();
while(($hn = $handlers->fetchArray(SQLITE3_ASSOC)) !== false){
$call[(int) $hn["ID"]] = true;
}
$handlers->finalize();
foreach($call as $hnid => $boolean){
if($result !== false and $result !== true){
$handler = $this->handlers[$hnid];
if(is_array($handler)){
$method = $handler[1];
$result = $handler[0]->$method($data, $event);
}else{
$result = $handler($data, $event);
}
}else{
break;
}
}
}
if($result !== false){
$this->trigger($event, $data);
}
return $result;
}
public function eventHandler($data, $event){
switch($event){
}
}
/**
* TODO
* @return string
*/
public function getGamemode(){
switch($this->gamemode){
case 0:
return "survival";
case 1:
return "creative";
case 2:
return "adventure";
case 3:
return "view";
}
}
public function init(){
register_tick_function(array($this, "tick"));
declare(ticks = 5000); //Minimum TPS for main thread locks
$this->loadEvents();
register_shutdown_function(array($this, "dumpError"));
register_shutdown_function(array($this, "close"));
if(function_exists("pcntl_signal")){
pcntl_signal(SIGTERM, array($this, "close"));
pcntl_signal(SIGINT, array($this, "close"));
pcntl_signal(SIGHUP, array($this, "close"));
}
console("[INFO] Default game type: " . strtoupper($this->getGamemode()));
$this->trigger("server.start", microtime(true));
console('[INFO] Done (' . round(microtime(true) - \pocketmine\START_TIME, 3) . 's)! For help, type "help" or "?"');
$this->process();
}
public function dumpError(){
if($this->stop === true){
return;
}
ini_set("memory_limit", "-1"); //Fix error dump not dumped on memory problems
console("[SEVERE] An unrecovereable has ocurred and the server has crashed. Creating an error dump");
$dump = "```\r\n# PocketMine-MP Error Dump " . date("D M j H:i:s T Y") . "\r\n";
$er = error_get_last();
$errorConversion = array(
E_ERROR => "E_ERROR",
E_WARNING => "E_WARNING",
E_PARSE => "E_PARSE",
E_NOTICE => "E_NOTICE",
E_CORE_ERROR => "E_CORE_ERROR",
E_CORE_WARNING => "E_CORE_WARNING",
E_COMPILE_ERROR => "E_COMPILE_ERROR",
E_COMPILE_WARNING => "E_COMPILE_WARNING",
E_USER_ERROR => "E_USER_ERROR",
E_USER_WARNING => "E_USER_WARNING",
E_USER_NOTICE => "E_USER_NOTICE",
E_STRICT => "E_STRICT",
E_RECOVERABLE_ERROR => "E_RECOVERABLE_ERROR",
E_DEPRECATED => "E_DEPRECATED",
E_USER_DEPRECATED => "E_USER_DEPRECATED",
);
$er["type"] = isset($errorConversion[$er["type"]]) ? $errorConversion[$er["type"]] : $er["type"];
$dump .= "Error: " . var_export($er, true) . "\r\n\r\n";
if(stripos($er["file"], "plugin") !== false){
$dump .= "THIS ERROR WAS CAUSED BY A PLUGIN. REPORT IT TO THE PLUGIN DEVELOPER.\r\n";
}
$dump .= "Code: \r\n";
$file = @file($er["file"], FILE_IGNORE_NEW_LINES);
for($l = max(0, $er["line"] - 10); $l < $er["line"] + 10; ++$l){
$dump .= "[" . ($l + 1) . "] " . @$file[$l] . "\r\n";
}
$dump .= "\r\n\r\n";
$dump .= "Backtrace: \r\n";
foreach(getTrace() as $line){
$dump .= "$line\r\n";
}
$dump .= "\r\n\r\n";
$version = new VersionString();
$dump .= "PocketMine-MP version: " . $version . " #" . $version->getNumber() . " [Protocol " . Info::CURRENT_PROTOCOL . "; API " . API_VERSION . "]\r\n";
$dump .= "Git commit: " . GIT_COMMIT . "\r\n";
$dump .= "uname -a: " . php_uname("a") . "\r\n";
$dump .= "PHP Version: " . phpversion() . "\r\n";
$dump .= "Zend version: " . zend_version() . "\r\n";
$dump .= "OS : " . PHP_OS . ", " . Utils::getOS() . "\r\n";
$dump .= "Debug Info: " . var_export($this->debugInfo(false), true) . "\r\n\r\n\r\n";
global $arguments;
$dump .= "Parameters: " . var_export($arguments, true) . "\r\n\r\n\r\n";
$p = $this->api->getProperties();
if($p["rcon.password"] != ""){
$p["rcon.password"] = "******";
}
$dump .= "server.properties: " . var_export($p, true) . "\r\n\r\n\r\n";
if(class_exists("pocketmine\\plugin\\PluginManager", false)){
$dump .= "Loaded plugins:\r\n";
foreach(PluginManager::getPlugins() as $p){
$d = $p->getDescription();
$dump .= $d->getName() . " " . $d->getVersion() . " by " . implode(", ", $d->getAuthors()) . "\r\n";
}
$dump .= "\r\n\r\n";
}
$extensions = array();
foreach(get_loaded_extensions() as $ext){
$extensions[$ext] = phpversion($ext);
}
$dump .= "Loaded Modules: " . var_export($extensions, true) . "\r\n";
$this->checkMemory();
$dump .= "Memory Usage Tracking: \r\n" . chunk_split(base64_encode(gzdeflate(implode(";", $this->memoryStats), 9))) . "\r\n";
ob_start();
phpinfo();
$dump .= "\r\nphpinfo(): \r\n" . chunk_split(base64_encode(gzdeflate(ob_get_contents(), 9))) . "\r\n";
ob_end_clean();
$dump .= "\r\n```";
$name = "Error_Dump_" . date("D_M_j-H.i.s-T_Y");
log($dump, $name, true, 0, true);
console("[SEVERE] Please submit the \"{$name}.log\" file to the Bug Reporting page. Give as much info as you can.", true, true, 0);
}
public function tick(){
$time = microtime(true);
if($this->lastTick <= ($time - 0.05)){
$this->tickMeasure[] = $this->lastTick = $time;
unset($this->tickMeasure[key($this->tickMeasure)]);
++$this->ticks;
return $this->tickerFunction($time);
}
return 0;
}
public static function clientID($ip, $port){
return crc32($ip . $port) ^ crc32($port . $ip . BOOTUP_RANDOM);
//return $ip . ":" . $port;
}
public function packetHandler(Packet $packet){
$data =& $packet;
$CID = Server::clientID($packet->ip, $packet->port);
if(isset(Player::$list[$CID])){
if($packet instanceof RakNetPacket){
Player::$list[$CID]->handlePacket($packet);
}
}else{
switch($packet->pid()){
case RakNetInfo::UNCONNECTED_PING:
case RakNetInfo::UNCONNECTED_PING_OPEN_CONNECTIONS:
if($this->invisible === true){
$pk = new RakNetPacket(RakNetInfo::UNCONNECTED_PONG);
$pk->pingID = $packet->pingID;
$pk->serverID = $this->serverID;
$pk->serverType = $this->serverType;
$pk->ip = $packet->ip;
$pk->port = $packet->port;
$this->send($pk);
break;
}
if(!isset($this->custom["times_" . $CID])){
$this->custom["times_" . $CID] = 0;
}
$ln = 15;
if($this->description == "" or substr($this->description, -1) != " "){
$this->description .= " ";
}
$txt = substr($this->description, $this->custom["times_" . $CID], $ln);
$txt .= substr($this->description, 0, $ln - strlen($txt));
$pk = new RakNetPacket(RakNetInfo::UNCONNECTED_PONG);
$pk->pingID = $packet->pingID;
$pk->serverID = $this->serverID;
$pk->serverType = $this->serverType . $this->name . " [" . count(Player::$list) . "/" . $this->maxClients . "] " . $txt;
$pk->ip = $packet->ip;
$pk->port = $packet->port;
$this->send($pk);
$this->custom["times_" . $CID] = ($this->custom["times_" . $CID] + 1) % strlen($this->description);
break;
case RakNetInfo::OPEN_CONNECTION_REQUEST_1:
if($packet->structure !== RakNetInfo::STRUCTURE){
console("[DEBUG] Incorrect structure #" . $packet->structure . " from " . $packet->ip . ":" . $packet->port, true, true, 2);
$pk = new RakNetPacket(RakNetInfo::INCOMPATIBLE_PROTOCOL_VERSION);
$pk->serverID = $this->serverID;
$pk->ip = $packet->ip;
$pk->port = $packet->port;
$this->send($pk);
}else{
$pk = new RakNetPacket(RakNetInfo::OPEN_CONNECTION_REPLY_1);
$pk->serverID = $this->serverID;
$pk->mtuSize = strlen($packet->buffer);
$pk->ip = $packet->ip;
$pk->port = $packet->port;
$this->send($pk);
}
break;
case RakNetInfo::OPEN_CONNECTION_REQUEST_2:
if($this->invisible === true){
break;
}
new Player($packet->clientID, $packet->ip, $packet->port, $packet->mtuSize); //New Session!
$pk = new RakNetPacket(RakNetInfo::OPEN_CONNECTION_REPLY_2);
$pk->serverID = $this->serverID;
$pk->serverPort = $this->port;
$pk->mtuSize = $packet->mtuSize;
$pk->ip = $packet->ip;
$pk->port = $packet->port;
$this->send($pk);
break;
}
}
}
public function send(Packet $packet){
return $this->interface->writePacket($packet);
}
public function process(){
$lastLoop = 0;
while($this->stop === false){
$packet = $this->interface->readPacket();
if($packet instanceof Packet){
$this->packetHandler($packet);
$lastLoop = 0;
}
if(($ticks = $this->tick()) === 0){
++$lastLoop;
if($lastLoop < 16){
usleep(1);
}elseif($lastLoop < 128){
usleep(1000);
}elseif($lastLoop < 256){
usleep(2000);
}else{
usleep(4000);
}
}
}
}
public function trigger($event, $data = ""){
if(isset($this->events[$event])){
foreach($this->events[$event] as $evid => $ev){
if(!is_callable($ev)){
$this->deleteEvent($evid);
continue;
}
if(is_array($ev)){
$method = $ev[1];
$ev[0]->$method($data, $event);
}else{
$ev($data, $event);
}
}
}
}
public function schedule($ticks, callable $callback, $data = array(), $repeat = false, $eventName = "server.schedule"){
if(!is_callable($callback)){
return false;
}
$chcnt = $this->scheduleCnt++;
$this->schedule[$chcnt] = array($callback, $data, $eventName);
$this->query("INSERT INTO actions (ID, interval, last, repeat) VALUES(" . $chcnt . ", " . ($ticks / 20) . ", " . microtime(true) . ", " . (((bool) $repeat) === true ? 1 : 0) . ");");
return $chcnt;
}
public function tickerFunction($time){
//actions that repeat every x time will go here
$this->preparedSQL->selectActions->reset();
$this->preparedSQL->selectActions->bindValue(":time", $time, SQLITE3_FLOAT);
$actions = $this->preparedSQL->selectActions->execute();
$actionCount = 0;
if($actions instanceof \SQLite3Result){
while(($action = $actions->fetchArray(SQLITE3_ASSOC)) !== false){
$cid = $action["ID"];
$this->preparedSQL->updateAction->reset();
$this->preparedSQL->updateAction->bindValue(":time", $time, SQLITE3_FLOAT);
$this->preparedSQL->updateAction->bindValue(":id", $cid, SQLITE3_INTEGER);
$this->preparedSQL->updateAction->execute();
if(!@is_callable($this->schedule[$cid][0])){
$return = false;
}else{
++$actionCount;
$return = call_user_func($this->schedule[$cid][0], $this->schedule[$cid][1], $this->schedule[$cid][2]);
}
if($action["repeat"] == 0 or $return === false){
$this->query("DELETE FROM actions WHERE ID = " . $action["ID"] . ";");
$this->schedule[$cid] = null;
unset($this->schedule[$cid]);
}
}
$actions->finalize();
}
return $actionCount;
}
public function event($event, callable $func){
if(!is_callable($func)){
return false;
}
$evid = $this->evCnt++;
if(!isset($this->events[$event])){
$this->events[$event] = array();
}
$this->events[$event][$evid] = $func;
$this->eventsID[$evid] = $event;
console("[INTERNAL] Attached " . (is_array($func) ? get_class($func[0]) . "::" . $func[1] : $func) . " to event " . $event . " (ID " . $evid . ")", true, true, 3);
return $evid;
}
public function deleteEvent($id){
$id = (int) $id;
if(isset($this->eventsID[$id])){
$ev = $this->eventsID[$id];
$this->eventsID[$id] = null;
unset($this->eventsID[$id]);
$this->events[$ev][$id] = null;
unset($this->events[$ev][$id]);
if(count($this->events[$ev]) === 0){
unset($this->events[$ev]);
}
}
}
}

View File

@ -1,144 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine;
use pocketmine\level\Level;
class TimeAPI{
public static $phases = array(
"day" => 0,
"sunset" => 9500,
"night" => 10900,
"sunrise" => 17800,
);
private $server;
function __construct(){
$this->server = Server::getInstance();
}
public function init(){
$this->server->api->console->register("time", "<check|set|add> [time]", array($this, "commandHandler"));
}
public function commandHandler($cmd, $params, $issuer, $alias){
$output = "";
switch($cmd){
case "time":
$level = false;
if($issuer instanceof Player){
$level = $issuer->level;
}
$p = strtolower(array_shift($params));
switch($p){
case "check":
$output .= "Time: " . $this->getDate($level) . ", " . $this->getPhase($level) . " (" . $this->get(true, $level) . ")\n";
break;
case "add":
$output .= "Set the time to " . $this->add(array_shift($params), $level) . "\n";
break;
case "set":
$output .= "Set the time to " . $this->set(array_shift($params), $level) . "\n";
break;
case "sunrise":
case "day":
case "sunset":
case "night":
$output .= "Set the time to " . $this->set($p, $level) . "\n";
break;
default:
$output .= "Usage: /time <check|set|add> [time]\n";
break;
}
break;
}
return $output;
}
public function night(){
return $this->set("night");
}
public function day(){
return $this->set("day");
}
public function sunrise(){
return $this->set("sunrise");
}
public function sunset(){
return $this->set("sunset");
}
public function get($raw = false, $level = false){
if(!($level instanceof Level)){
$level = Level::getDefault();
}
return $raw === true ? $level->getTime() : abs($level->getTime()) % 19200;
}
public function add($time, $level = false){
if(!($level instanceof Level)){
$level = Level::getDefault();
}
$level->setTime($level->getTime() + (int) $time);
}
public function getDate($time = false){
$time = !is_integer($time) ? $this->get(false, $time) : $time;
return str_pad(strval((floor($time / 800) + 6) % 24), 2, "0", STR_PAD_LEFT) . ":" . str_pad(strval(floor(($time % 800) / 13.33)), 2, "0", STR_PAD_LEFT);
}
public function getPhase($time = false){
$time = !is_integer($time) ? $this->get(false, $time) : $time;
if($time < TimeAPI::$phases["sunset"]){
$time = "day";
}elseif($time < TimeAPI::$phases["night"]){
$time = "sunset";
}elseif($time < TimeAPI::$phases["sunrise"]){
$time = "night";
}else{
$time = "sunrise";
}
return $time;
}
public function set($time, $level = false){
if(!($level instanceof Level)){
$level = Level::getDefault();
}
if(is_string($time) and isset(TimeAPI::$phases[$time])){
$level->setTime(TimeAPI::$phases[$time]);
}else{
$level->setTime((int) $time);
}
return $level->getTime();
}
}

View File

@ -1,94 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\Player;
class Beetroot extends Flowable{
public function __construct($meta = 0){
parent::__construct(self::BEETROOT_BLOCK, $meta, "Beetroot Block");
$this->isActivable = true;
$this->hardness = 0;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() === self::FARMLAND){
$this->level->setBlock($block, $this, true, false, true);
return true;
}
return false;
}
public function onActivate(Item $item, Player $player = null){
if($item->getID() === Item::DYE and $item->getMetadata() === 0x0F){ //Bonemeal
$this->meta = 0x07;
$this->level->setBlock($this, $this, true, false, true);
$item->count--;
return true;
}
return false;
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
//TODO
//Server::getInstance()->api->entity->drop($this, Item::get(BEETROOT_SEEDS, 0, 1));
$this->level->setBlock($this, new Air(), false, false, true);
return Level::BLOCK_UPDATE_NORMAL;
}
}elseif($type === Level::BLOCK_UPDATE_RANDOM){
if(mt_rand(0, 2) == 1){
if($this->meta < 0x07){
++$this->meta;
$this->level->setBlock($this, $this, true, false, true);
return Level::BLOCK_UPDATE_RANDOM;
}
}else{
return Level::BLOCK_UPDATE_RANDOM;
}
}
return false;
}
public function getDrops(Item $item){
$drops = array();
if($this->meta >= 0x07){
$drops[] = array(Item::BEETROOT, 0, 1);
$drops[] = array(Item::BEETROOT_SEEDS, 0, mt_rand(0, 3));
}else{
$drops[] = array(Item::BEETROOT_SEEDS, 0, 1);
}
return $drops;
}
}

View File

@ -1,543 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
/**
* All Block classes are in here
*/
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\level\Position;
use pocketmine\Player;
abstract class Block extends Position{
const AIR = 0;
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 BEDROCK = 7;
const WATER = 8;
const STILL_WATER = 9;
const LAVA = 10;
const STILL_LAVA = 11;
const SAND = 12;
const GRAVEL = 13;
const GOLD_ORE = 14;
const IRON_ORE = 15;
const COAL_ORE = 16;
const WOOD = 17;
const TRUNK = 17;
const LOG = 17;
const LEAVES = 18;
const LEAVE = 18;
const SPONGE = 19;
const GLASS = 20;
const LAPIS_ORE = 21;
const LAPIS_BLOCK = 22;
const SANDSTONE = 24;
const BED_BLOCK = 26;
const COBWEB = 30;
const TALL_GRASS = 31;
const BUSH = 32;
const DEAD_BUSH = 32;
const WOOL = 35;
const DANDELION = 37;
const ROSE = 38;
const CYAN_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 BRICKS = 45;
const BRICKS_BLOCK = 45;
const TNT = 46;
const BOOKSHELF = 47;
const MOSS_STONE = 48;
const MOSSY_STONE = 48;
const OBSIDIAN = 49;
const TORCH = 50;
const FIRE = 51;
const WOOD_STAIRS = 53;
const WOODEN_STAIRS = 53;
const OAK_WOOD_STAIRS = 53;
const OAK_WOODEN_STAIRS = 53;
const CHEST = 54;
const DIAMOND_ORE = 56;
const DIAMOND_BLOCK = 57;
const CRAFTING_TABLE = 58;
const WORKBENCH = 58;
const WHEAT_BLOCK = 59;
const FARMLAND = 60;
const FURNACE = 61;
const BURNING_FURNACE = 62;
const LIT_FURNACE = 62;
const SIGN_POST = 63;
const DOOR_BLOCK = 64;
const WOODEN_DOOR_BLOCK = 64;
const WOOD_DOOR_BLOCK = 64;
const LADDER = 65;
const COBBLE_STAIRS = 67;
const COBBLESTONE_STAIRS = 67;
const WALL_SIGN = 68;
const IRON_DOOR_BLOCK = 71;
const REDSTONE_ORE = 73;
const GLOWING_REDSTONE_ORE = 74;
const LIT_REDSTONE_ORE = 74;
const SNOW = 78;
const 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 FENCE = 85;
const PUMPKIN = 86;
const NETHERRACK = 87;
const SOUL_SAND = 88;
const GLOWSTONE = 89;
const GLOWSTONE_BLOCK = 89;
const LIT_PUMPKIN = 91;
const JACK_O_LANTERN = 91;
const CAKE_BLOCK = 92;
const TRAPDOOR = 96;
const STONE_BRICKS = 98;
const STONE_BRICK = 98;
const IRON_BAR = 101;
const IRON_BARS = 101;
const GLASS_PANE = 102;
const GLASS_PANEL = 102;
const MELON_BLOCK = 103;
const PUMPKIN_STEM = 104;
const MELON_STEM = 105;
const FENCE_GATE = 107;
const BRICK_STAIRS = 108;
const STONE_BRICK_STAIRS = 109;
const NETHER_BRICKS = 112;
const NETHER_BRICK_BLOCK = 112;
const NETHER_BRICKS_STAIRS = 114;
const SANDSTONE_STAIRS = 128;
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 COBBLE_WALL = 139;
const STONE_WALL = 139;
const COBBLESTONE_WALL = 139;
const CARROT_BLOCK = 141;
const POTATO_BLOCK = 142;
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 HAY_BALE = 170;
const CARPET = 171;
const COAL_BLOCK = 173;
const BEETROOT_BLOCK = 244;
const STONECUTTER = 245;
const GLOWING_OBSIDIAN = 246;
const NETHER_REACTOR = 247;
public static $list = array();
protected $id;
protected $meta;
protected $name;
protected $breakTime;
protected $hardness;
public $isActivable = false;
public $breakable = true;
public $isFlowable = false;
public $isSolid = true;
public $isTransparent = false;
public $isReplaceable = false;
public $isPlaceable = true;
public $level = false;
public $hasPhysics = false;
public $isLiquid = false;
public $isFullBlock = true;
public $x = 0;
public $y = 0;
public $z = 0;
public static function init(){
if(count(self::$list) === 0){
self::$list = array(
self::AIR => new Air(),
self::STONE => new Stone(),
self::GRASS => new Grass(),
self::DIRT => new Dirt(),
self::COBBLESTONE => new Cobblestone(),
self::PLANKS => new Planks(),
self::SAPLING => new Sapling(),
self::BEDROCK => new Bedrock(),
self::WATER => new Water(),
self::STILL_WATER => new StillWater(),
self::LAVA => new Lava(),
self::STILL_LAVA => new StillLava(),
self::SAND => new Sand(),
self::GRAVEL => new Gravel(),
self::GOLD_ORE => new GoldOre(),
self::IRON_ORE => new IronOre(),
self::COAL_ORE => new CoalOre(),
self::WOOD => new Wood(),
self::LEAVES => new Leaves(),
self::SPONGE => new Sponge(),
self::GLASS => new Glass(),
self::LAPIS_ORE => new LapisOre(),
self::LAPIS_BLOCK => new Lapis(),
self::SANDSTONE => new Sandstone(),
self::BED_BLOCK => new Bed(),
self::COBWEB => new Cobweb(),
self::TALL_GRASS => new TallGrass(),
self::DEAD_BUSH => new DeadBush(),
self::WOOL => new Wool(),
self::DANDELION => new Dandelion(),
self::CYAN_FLOWER => new CyanFlower(),
self::BROWN_MUSHROOM => new BrownMushroom(),
self::RED_MUSHROOM => new RedMushroom(),
self::GOLD_BLOCK => new Gold(),
self::IRON_BLOCK => new Iron(),
self::DOUBLE_SLAB => new DoubleSlab(),
self::SLAB => new Slab(),
self::BRICKS_BLOCK => new Bricks(),
self::TNT => new TNT(),
self::BOOKSHELF => new Bookshelf(),
self::MOSS_STONE => new MossStone(),
self::OBSIDIAN => new Obsidian(),
self::TORCH => new Torch(),
self::FIRE => new Fire(),
self::WOOD_STAIRS => new WoodStairs(),
self::CHEST => new Chest(),
self::DIAMOND_ORE => new DiamondOre(),
self::DIAMOND_BLOCK => new Diamond(),
self::WORKBENCH => new Workbench(),
self::WHEAT_BLOCK => new Wheat(),
self::FARMLAND => new Farmland(),
self::FURNACE => new Furnace(),
self::BURNING_FURNACE => new BurningFurnace(),
self::SIGN_POST => new SignPost(),
self::WOOD_DOOR_BLOCK => new WoodDoor(),
self::LADDER => new Ladder(),
self::COBBLESTONE_STAIRS => new CobblestoneStairs(),
self::WALL_SIGN => new WallSign(),
self::IRON_DOOR_BLOCK => new IronDoor(),
self::REDSTONE_ORE => new RedstoneOre(),
self::GLOWING_REDSTONE_ORE => new GlowingRedstoneOre(),
self::SNOW_LAYER => new SnowLayer(),
self::ICE => new Ice(),
self::SNOW_BLOCK => new Snow(),
self::CACTUS => new Cactus(),
self::CLAY_BLOCK => new Clay(),
self::SUGARCANE_BLOCK => new Sugarcane(),
self::FENCE => new Fence(),
self::PUMPKIN => new Pumpkin(),
self::NETHERRACK => new Netherrack(),
self::SOUL_SAND => new SoulSand(),
self::GLOWSTONE_BLOCK => new Glowstone(),
self::LIT_PUMPKIN => new LitPumpkin(),
self::CAKE_BLOCK => new Cake(),
self::TRAPDOOR => new Trapdoor(),
self::STONE_BRICKS => new StoneBricks(),
self::IRON_BARS => new IronBars(),
self::GLASS_PANE => new GlassPane(),
self::MELON_BLOCK => new Melon(),
self::PUMPKIN_STEM => new PumpkinStem(),
self::MELON_STEM => new MelonStem(),
self::FENCE_GATE => new FenceGate(),
self::BRICK_STAIRS => new BrickStairs(),
self::STONE_BRICK_STAIRS => new StoneBrickStairs(),
self::NETHER_BRICKS => new NetherBrick(),
self::NETHER_BRICKS_STAIRS => new NetherBrickStairs(),
self::SANDSTONE_STAIRS => new SandstoneStairs(),
self::SPRUCE_WOOD_STAIRS => new SpruceWoodStairs(),
self::BIRCH_WOOD_STAIRS => new BirchWoodStairs(),
self::JUNGLE_WOOD_STAIRS => new JungleWoodStairs(),
self::STONE_WALL => new StoneWall(),
self::CARROT_BLOCK => new Carrot(),
self::POTATO_BLOCK => new Potato(),
self::QUARTZ_BLOCK => new Quartz(),
self::QUARTZ_STAIRS => new QuartzStairs(),
self::DOUBLE_WOOD_SLAB => new DoubleWoodSlab(),
self::WOOD_SLAB => new WoodSlab(),
self::HAY_BALE => new HayBale(),
self::CARPET => new Carpet(),
self::COAL_BLOCK => new Coal(),
self::BEETROOT_BLOCK => new Beetroot(),
self::STONECUTTER => new Stonecutter(),
self::GLOWING_OBSIDIAN => new GlowingObsidian(),
);
}
}
/**
* @param int $id
* @param int $meta
* @param Position $pos
*
* @return Block
*/
public static function get($id, $meta = 0, Position $pos = null){
if(isset(self::$list[$id])){
$block = clone self::$list[$id];
$block->setMetadata($meta);
}else{
$block = new Generic($id, $meta);
}
if($pos instanceof Position){
$block->position($pos);
}
return $block;
}
/**
* @param int $id
* @param int $meta
* @param string $name
*/
public function __construct($id, $meta = 0, $name = "Unknown"){
$this->id = (int) $id;
$this->meta = (int) $meta;
$this->name = $name;
$this->breakTime = 0.20;
$this->hardness = 10;
}
/**
* @return int
*/
final public function getHardness(){
return $this->hardness;
}
/**
* @return string
*/
final public function getName(){
return $this->name;
}
/**
* @return int
*/
final public function getID(){
return $this->id;
}
/**
* @return int
*/
final public function getMetadata(){
return $this->meta;
}
/**
* @param int $meta
*/
final public function setMetadata($meta){
$this->meta = $meta & 0x0F;
}
/**
* Sets the block position to a new Position object
*
* @param Position $v
*/
final public function position(Position $v){
$this->level = $v->level;
$this->x = (int) $v->x;
$this->y = (int) $v->y;
$this->z = (int) $v->z;
}
/**
* Returns an array of Item objects to be dropped
*
* @param Item $item
*
* @return array
*/
public function getDrops(Item $item){
if(!isset(self::$list[$this->id])){ //Unknown blocks
return array();
}else{
return array(
array($this->id, $this->meta, 1),
);
}
}
/**
* Returns the seconds that this block takes to be broken using an specific Item
*
* @param Item $item
*
* @return float
*/
public function getBreakTime(Item $item){
return $this->breakTime;
}
/**
* Returns the Block on the side $side, works like Vector3::side()
*
* @param int $side
*
* @return Block
*/
public function getSide($side){
$v = parent::getSide($side);
if($this->level instanceof Level){
return $this->level->getBlock($v);
}
return $v;
}
/**
* @return string
*/
final public function __toString(){
return "Block " . $this->name . " (" . $this->id . ":" . $this->meta . ")";
}
/**
* Returns if the item can be broken with an specific Item
*
* @param Item $item
*
* @return bool
*/
abstract function isBreakable(Item $item);
/**
* Do the actions needed so the block is broken with the Item
*
* @param Item $item
*
* @return mixed
*/
abstract function onBreak(Item $item);
/**
* Places the Block, using block space and block target, and side. Returns if the block has been placed.
*
* @param Item $item
* @param Block $block
* @param Block $target
* @param int $face
* @param float $fx
* @param float $fy
* @param float $fz
* @param Player $player = null
*
* @return bool
*/
abstract function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null);
/**
* Do actions when activated by Item. Returns if it has done anything
*
* @param Item $item
* @param Player $player
*
* @return bool
*/
abstract function onActivate(Item $item, Player $player = null);
/**
* Fires a block update on the Block
*
* @param int $type
*
* @return void
*/
abstract function onUpdate($type);
}

View File

@ -1,138 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\network\protocol\LevelEventPacket;
use pocketmine\Player;
abstract class Door extends Transparent{
public function __construct($id, $meta = 0, $name = "Unknown"){
parent::__construct($id, $meta, $name);
$this->isSolid = false;
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->getID() === self::AIR){ //Replace with common break method
$this->level->setBlock($this, new Air(), false);
if($this->getSide(1) instanceof Door){
$this->level->setBlock($this->getSide(1), new Air(), false);
}
return Level::BLOCK_UPDATE_NORMAL;
}
}
return false;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
if($face === 1){
$blockUp = $this->getSide(1);
$blockDown = $this->getSide(0);
if($blockUp->isReplaceable === false or $blockDown->isTransparent === true){
return false;
}
$direction = $player instanceof Player ? $player->getDirection() : 0;
$face = array(
0 => 3,
1 => 4,
2 => 2,
3 => 5,
);
$next = $this->getSide($face[(($direction + 2) % 4)]);
$next2 = $this->getSide($face[$direction]);
$metaUp = 0x08;
if($next->getID() === $this->id or ($next2->isTransparent === false and $next->isTransparent === true)){ //Door hinge
$metaUp |= 0x01;
}
$this->level->setBlock($blockUp, Block::get($this->id, $metaUp), true, false, true); //Top
$this->meta = $player->getDirection() & 0x03;
$this->level->setBlock($block, $this, true, false, true); //Bottom
return true;
}
return false;
}
public function onBreak(Item $item){
if(($this->meta & 0x08) === 0x08){
$down = $this->getSide(0);
if($down->getID() === $this->id){
$this->level->setBlock($down, new Air(), true, false, true);
}
}else{
$up = $this->getSide(1);
if($up->getID() === $this->id){
$this->level->setBlock($up, new Air(), true, false, true);
}
}
$this->level->setBlock($this, new Air(), true, false, true);
return true;
}
public function onActivate(Item $item, Player $player = null){
if(($this->meta & 0x08) === 0x08){ //Top
$down = $this->getSide(0);
if($down->getID() === $this->id){
$meta = $down->getMetadata() ^ 0x04;
$this->level->setBlock($down, Block::get($this->id, $meta), true, false, true);
$players = $this->level->getUsingChunk($this->x >> 4, $this->z >> 4);
if($player instanceof Player){
unset($players[$player->CID]);
}
$pk = new LevelEventPacket;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->evid = 1003;
$pk->data = 0;
Player::broadcastPacket($players, $pk);
return true;
}
return false;
}else{
$this->meta ^= 0x04;
$this->level->setBlock($this, $this, true, false, true);
$players = $this->level->getUsingChunk($this->x >> 4, $this->z >> 4);
if($player instanceof Player){
unset($players[$player->CID]);
}
$pk = new LevelEventPacket;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->evid = 1003;
$pk->data = 0;
Player::broadcastPacket($players, $pk);
}
return true;
}
}

View File

@ -1,57 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\generator\object\TallGrass;
use pocketmine\Player;
use pocketmine\utils\Random;
class Grass extends Solid{
public function __construct(){
parent::__construct(self::GRASS, 0, "Grass");
$this->isActivable = true;
$this->hardness = 3;
}
public function getDrops(Item $item){
return array(
array(Item::DIRT, 0, 1),
);
}
public function onActivate(Item $item, Player $player = null){
if($item->getID() === Item::DYE and $item->getMetadata() === 0x0F){
$item->count--;
TallGrass::growGrass($this->level, $this, new Random(), 8, 2);
return true;
}elseif($item->isHoe()){
$item->useOn($this);
$this->level->setBlock($this, new Farmland());
return true;
}
return false;
}
}

View File

@ -1,154 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\level\Position;
use pocketmine\Player;
use pocketmine\Server;
class Lava extends Liquid{
public function __construct($meta = 0){
parent::__construct(self::LAVA, $meta, "Lava");
$this->hardness = 0;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$ret = $this->level->setBlock($this, $this, true, false, true);
Server::getInstance()->api->block->scheduleBlockUpdate(clone $this, 40, Level::BLOCK_UPDATE_NORMAL);
return $ret;
}
public function getSourceCount(){
$count = 0;
for($side = 2; $side <= 5; ++$side){
if($this->getSide($side) instanceof Lava){
$b = $this->getSide($side);
$level = $b->meta & 0x07;
if($level == 0x00){
$count++;
}
}
}
return $count;
}
public function checkWater(){
for($side = 1; $side <= 5; ++$side){
$b = $this->getSide($side);
if($b instanceof Water){
$level = $this->meta & 0x07;
if($level == 0x00){
$this->level->setBlock($this, new Obsidian(), false, false, true);
}else{
$this->level->setBlock($this, new Cobblestone(), false, false, true);
}
}
}
}
public function getFrom(){
for($side = 0; $side <= 5; ++$side){
$b = $this->getSide($side);
if($b instanceof Lava){
$tlevel = $b->meta & 0x07;
$level = $this->meta & 0x07;
if(($tlevel + 2) == $level || ($side == 0x01 && $level == 0x01) || ($tlevel == 6 && $level == 7)){
return $b;
}
}
}
return null;
}
public function onUpdate($type){
//return false;
$newId = $this->id;
$level = $this->meta & 0x07;
if($type !== Level::BLOCK_UPDATE_NORMAL){
return false;
}
if($this->checkWater()){
return;
}
$falling = $this->meta >> 3;
$down = $this->getSide(0);
$from = $this->getFrom();
if($from !== null || $level == 0x00){
if($level !== 0x07){
if($down instanceof Air || $down instanceof Lava){
$this->level->setBlock($down, new Lava(0x01), false, false, true);
Server::getInstance()->api->block->scheduleBlockUpdate(new Position($down, 0, 0, $this->level), 40, Level::BLOCK_UPDATE_NORMAL);
}else{
for($side = 2; $side <= 5; ++$side){
$b = $this->getSide($side);
if($b instanceof Lava){
}elseif($b->isFlowable === true){
$this->level->setBlock($b, new Lava(min($level + 2, 7)), false, false, true);
Server::getInstance()->api->block->scheduleBlockUpdate(Position::fromObject($b, $this->level), 40, Level::BLOCK_UPDATE_NORMAL);
}
}
}
}
}else{
//Extend Remove for Left Lavas
for($side = 2; $side <= 5; ++$side){
$sb = $this->getSide($side);
if($sb instanceof Lava){
$tlevel = $sb->meta & 0x07;
if($tlevel != 0x00){
for($s = 0; $s <= 5; $s++){
$ssb = $sb->getSide($s);
Server::getInstance()->api->block->scheduleBlockUpdate(Position::fromObject($ssb, $this->level), 40, Level::BLOCK_UPDATE_NORMAL);
}
$this->level->setBlock($sb, new Air(), false, false, true);
}
}
$b = $this->getSide(0)->getSide($side);
if($b instanceof Lava){
$tlevel = $b->meta & 0x07;
if($tlevel != 0x00){
for($s = 0; $s <= 5; $s++){
$ssb = $sb->getSide($s);
Server::getInstance()->api->block->scheduleBlockUpdate(Position::fromObject($ssb, $this->level), 40, Level::BLOCK_UPDATE_NORMAL);
}
$this->level->setBlock($b, new Air(), false, false, true);
}
}
//Server::getInstance()->api->block->scheduleBlockUpdate(Position::fromObject($b, $this->level), 10, Level::BLOCK_UPDATE_NORMAL);
}
$this->level->setBlock($this, new Air(), false, false, true);
}
return false;
}
}

View File

@ -1,95 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\Player;
class Potato extends Flowable{
public function __construct($meta = 0){
parent::__construct(self::POTATO_BLOCK, $meta, "Potato Block");
$this->isActivable = true;
$this->hardness = 0;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() === self::FARMLAND){
$this->level->setBlock($block, $this, true, false, true);
return true;
}
return false;
}
public function onActivate(Item $item, Player $player = null){
if($item->getID() === Item::DYE and $item->getMetadata() === 0x0F){ //Bonemeal
$this->meta = 0x07;
$this->level->setBlock($this, $this, true, false, true);
if(($player->gamemode & 0x01) === 0){
$item->count--;
}
return true;
}
return false;
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
//TODO
//Server::getInstance()->api->entity->drop($this, Item::get(POTATO, 0, 1));
$this->level->setBlock($this, new Air(), false, false, true);
return Level::BLOCK_UPDATE_NORMAL;
}
}elseif($type === Level::BLOCK_UPDATE_RANDOM){
if(mt_rand(0, 2) == 1){
if($this->meta < 0x07){
++$this->meta;
$this->level->setBlock($this, $this, true, false, true);
return Level::BLOCK_UPDATE_RANDOM;
}
}else{
return Level::BLOCK_UPDATE_RANDOM;
}
}
return false;
}
public function getDrops(Item $item){
$drops = array();
if($this->meta >= 0x07){
$drops[] = array(Item::POTATO, 0, mt_rand(1, 4));
}else{
$drops[] = array(Item::POTATO, 0, 1);
}
return $drops;
}
}

View File

@ -1,160 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\level\Position;
use pocketmine\Player;
use pocketmine\Server;
class Water extends Liquid{
public function __construct($meta = 0){
parent::__construct(self::WATER, $meta, "Water");
$this->hardness = 500;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$ret = $this->level->setBlock($this, $this, true, false, true);
Server::getInstance()->api->block->scheduleBlockUpdate(clone $this, 10, Level::BLOCK_UPDATE_NORMAL);
return $ret;
}
public function getSourceCount(){
$count = 0;
for($side = 2; $side <= 5; ++$side){
if($this->getSide($side) instanceof Water){
$b = $this->getSide($side);
$level = $b->meta & 0x07;
if($level == 0x00){
$count++;
}
}
}
return $count;
}
public function checkLava(){
for($side = 0; $side <= 5; ++$side){
if($side == 1){
continue;
}
$b = $this->getSide($side);
if($b instanceof Lava){
$level = $b->meta & 0x07;
if($level == 0x00){
$this->level->setBlock($b, new Obsidian(), false, false, true);
}else{
$this->level->setBlock($b, new Cobblestone(), false, false, true);
}
return true;
}
}
return false;
}
public function getFrom(){
for($side = 0; $side <= 5; ++$side){
$b = $this->getSide($side);
if($b instanceof Water){
$tlevel = $b->meta & 0x07;
$level = $this->meta & 0x07;
if(($tlevel + 1) == $level || ($side == 0x01 && $level == 0x01)){
return $b;
}
}
}
return null;
}
public function onUpdate($type){
//return false;
$newId = $this->id;
$level = $this->meta & 0x07;
if($type !== Level::BLOCK_UPDATE_NORMAL){
return false;
}
$this->checkLava();
$falling = $this->meta >> 3;
$down = $this->getSide(0);
$from = $this->getFrom();
//Has Source or Its Source
if($from !== null || $level == 0x00){
if($level !== 0x07){
if($down instanceof Air || $down instanceof Water){
$this->level->setBlock($down, new Water(0x01), false, false, true);
Server::getInstance()->api->block->scheduleBlockUpdate(Position::fromObject($down, $this->level), 10, Level::BLOCK_UPDATE_NORMAL);
}else{
for($side = 2; $side <= 5; ++$side){
$b = $this->getSide($side);
if($b instanceof Water){
if($this->getSourceCount() >= 2 && $level != 0x00){
$this->level->setBlock($this, new Water(0), false, false, true);
}
}elseif($b->isFlowable === true){
$this->level->setBlock($b, new Water($level + 1), false, false, true);
Server::getInstance()->api->block->scheduleBlockUpdate(Position::fromObject($b, $this->level), 10, Level::BLOCK_UPDATE_NORMAL);
}
}
}
}
}else{
//Extend Remove for Left Waters
for($side = 2; $side <= 5; ++$side){
$sb = $this->getSide($side);
if($sb instanceof Water){
$tlevel = $sb->meta & 0x07;
if($tlevel != 0x00){
for($s = 0; $s <= 5; $s++){
$ssb = $sb->getSide($s);
Server::getInstance()->api->block->scheduleBlockUpdate(Position::fromObject($ssb, $this->level), 10, Level::BLOCK_UPDATE_NORMAL);
}
$this->level->setBlock($sb, new Air(), false, false, true);
}
}
$b = $this->getSide(0)->getSide($side);
if($b instanceof Water){
$tlevel = $b->meta & 0x07;
if($tlevel != 0x00){
for($s = 0; $s <= 5; $s++){
$ssb = $sb->getSide($s);
Server::getInstance()->api->block->scheduleBlockUpdate(Position::fromObject($ssb, $this->level), 10, Level::BLOCK_UPDATE_NORMAL);
}
$this->level->setBlock($b, new Air(), false, false, true);
}
}
//Server::getInstance()->api->block->scheduleBlockUpdate(Position::fromObject($b, $this->level), 10, Level::BLOCK_UPDATE_NORMAL);
}
$this->level->setBlock($this, new Air(), false, false, true);
}
return false;
}
}

View File

@ -1,92 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\Player;
class Wheat extends Flowable{
public function __construct($meta = 0){
parent::__construct(self::WHEAT_BLOCK, $meta, "Wheat Block");
$this->isActivable = true;
$this->hardness = 0;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() === self::FARMLAND){
$this->level->setBlock($block, $this, true, false, true);
return true;
}
return false;
}
public function onActivate(Item $item, Player $player = null){
if($item->getID() === Item::DYE and $item->getMetadata() === 0x0F){ //Bonemeal
$this->meta = 0x07;
$this->level->setBlock($this, $this, true, false, true);
if(($player->gamemode & 0x01) === 0){
$item->count--;
}
return true;
}
return false;
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
//TODO
//Server::getInstance()->api->entity->drop($this, Item::get(WHEAT_SEEDS, 0, 1));
$this->level->setBlock($this, new Air(), false, false, true);
return Level::BLOCK_UPDATE_NORMAL;
}
}elseif($type === Level::BLOCK_UPDATE_RANDOM){
if(mt_rand(0, 2) == 1){
if($this->meta < 0x07){
++$this->meta;
$this->level->setBlock($this, $this, true, false, true);
}
}
}
return false;
}
public function getDrops(Item $item){
$drops = array();
if($this->meta >= 0x07){
$drops[] = array(Item::WHEAT, 0, 1);
$drops[] = array(Item::WHEAT_SEEDS, 0, mt_rand(0, 3));
}else{
$drops[] = array(Item::WHEAT_SEEDS, 0, 1);
}
return $drops;
}
}

View File

@ -1,47 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine;
//Entities
const ENTITY_PLAYER = 1;
const ENTITY_MOB = 2;
const MOB_CHICKEN = 10;
const MOB_COW = 11;
const MOB_PIG = 12;
const MOB_SHEEP = 13;
const MOB_ZOMBIE = 32;
const MOB_CREEPER = 33;
const MOB_SKELETON = 34;
const MOB_SPIDER = 35;
const MOB_PIGMAN = 36;
const ENTITY_OBJECT = 3;
const OBJECT_PRIMEDTNT = 65;
const OBJECT_ARROW = 80;
const OBJECT_PAINTING = 83;
const ENTITY_ITEM = 4;
const ENTITY_FALLING = 5;
const FALLING_SAND = 66;

View File

@ -1,552 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
/**
* All the entity classes
*/
namespace pocketmine\entity;
use pocketmine\event\entity\EntityDespawnEvent;
use pocketmine\event\entity\EntityLevelChangeEvent;
use pocketmine\event\entity\EntityMotionEvent;
use pocketmine\event\entity\EntityMoveEvent;
use pocketmine\event\entity\EntitySpawnEvent;
use pocketmine\level\Level;
use pocketmine\level\Position;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3 as Vector3;
use pocketmine\nbt\tag\Compound;
use pocketmine\network\protocol\MoveEntityPacket_PosRot;
use pocketmine\network\protocol\MovePlayerPacket;
use pocketmine\network\protocol\RemoveEntityPacket;
use pocketmine\network\protocol\SetEntityMotionPacket;
use pocketmine\Network;
use pocketmine\network\protocol\SetTimePacket;
use pocketmine\Player;
use pocketmine\pmf\LevelFormat;
use pocketmine\Server;
abstract class Entity extends Position{
public static $entityCount = 1;
/**
* @var Entity[]
*/
public static $list = array();
/**
* @var Entity[]
*/
public static $needUpdate = array();
/**
* @var Player[]
*/
protected $hasSpawned = array();
protected $id;
public $passenger = null;
public $vehicle = null;
public $chunkIndex;
public $lastX;
public $lastY;
public $lastZ;
public $motionX;
public $motionY;
public $motionZ;
public $yaw;
public $pitch;
public $lastYaw;
public $lastPitch;
public $boundingBox;
public $onGround;
public $positionChanged;
public $motionChanged;
public $dead;
public $height;
public $width;
public $length;
public $fallDistance;
public $ticksLived;
public $lastUpdate;
public $maxFireTicks;
public $fireTicks;
public $airTicks;
public $namedtag;
protected $inWater;
public $noDamageTicks;
private $justCreated;
protected $fireProof;
private $invulnerable;
public $closed;
public static function get($entityID){
return isset(Entity::$list[$entityID]) ? Entity::$list[$entityID] : false;
}
public static function getAll(){
return Entity::$list;
}
public function __construct(Level $level, Compound $nbt){
$this->id = Entity::$entityCount++;
$this->justCreated = true;
$this->closed = false;
$this->namedtag = $nbt;
$this->level = $level;
$this->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
$this->setPositionAndRotation(new Vector3($this->namedtag["Pos"][0], $this->namedtag["Pos"][1], $this->namedtag["Pos"][2]), $this->namedtag->Rotation[0], $this->namedtag->Rotation[1]);
$this->setMotion(new Vector3($this->namedtag["Motion"][0], $this->namedtag["Motion"][1], $this->namedtag["Motion"][2]));
$this->fallDistance = $this->namedtag["FallDistance"];
$this->fireTicks = $this->namedtag["Fire"];
$this->airTicks = $this->namedtag["Air"];
$this->onGround = $this->namedtag["OnGround"] > 0 ? true : false;
$this->invulnerable = $this->namedtag["Invulnerable"] > 0 ? true : false;
$index = LevelFormat::getIndex($this->x >> 4, $this->z >> 4);
$this->chunkIndex = $index;
Entity::$list[$this->id] = $this;
$this->level->entities[$this->id] = $this;
$this->level->chunkEntities[$this->chunkIndex][$this->id] = $this;
$this->lastUpdate = microtime(true);
$this->initEntity();
Server::getInstance()->getPluginManager()->callEvent(new EntitySpawnEvent($this));
}
public function saveNBT(){
$this->namedtag["Pos"][0] = $this->x;
$this->namedtag["Pos"][1] = $this->y;
$this->namedtag["Pos"][2] = $this->z;
$this->namedtag["Motion"][0] = $this->motionX;
$this->namedtag["Motion"][1] = $this->motionY;
$this->namedtag["Motion"][2] = $this->motionZ;
$this->namedtag["Rotation"][0] = $this->yaw;
$this->namedtag["Rotation"][1] = $this->pitch;
$this->namedtag["FallDistance"] = $this->fallDistance;
$this->namedtag["Fire"] = $this->fireTicks;
$this->namedtag["Air"] = $this->airTicks;
$this->namedtag["OnGround"] = $this->onGround == true ? 1 : 0;
$this->namedtag["Invulnerable"] = $this->invulnerable == true ? 1 : 0;
}
protected abstract function initEntity();
public function spawnTo(Player $player){
if(!isset($this->hasSpawned[$player->getID()]) and $player->chunksLoaded[$this->chunkIndex] !== 0xff){
$this->hasSpawned[$player->getID()] = $player;
}
}
public function despawnFrom(Player $player){
if(isset($this->hasSpawned[$player->getID()])){
$pk = new RemoveEntityPacket;
$pk->eid = $this->id;
$player->dataPacket($pk);
unset($this->hasSpawned[$player->getID()]);
}
}
abstract function attack($damage, $source = "generic");
abstract function heal($amount, $source = "generic");
public function onUpdate(){
if($this->closed !== false){
return false;
}
$timeNow = microtime(true);
$this->ticksLived += ($timeNow - $this->lastUpdate) * 20;
if($this->handleWaterMovement()){
$this->fallDistance = 0;
$this->inWater = true;
$this->extinguish();
}else{
$this->inWater = false;
}
if($this->fireTicks > 0){
if($this->fireProof === true){
$this->fireTicks -= 4;
if($this->fireTicks < 0){
$this->fireTicks = 0;
}
}else{
if(($this->fireTicks % 20) === 0){
$this->attackEntity(1, "onFire");
}
--$this->fireTicks;
}
}
if($this->handleLavaMovement()){
$this->attackEntity(4, "lava");
$this->setOnFire(15);
$this->fallDistance *= 0.5;
}
if($this->y < -64){
$this->kill();
}
if($this->x !== $this->lastX or $this->y !== $this->lastY or $this->z !== $this->lastZ or $this->yaw !== $this->lastYaw or $this->pitch !== $this->lastPitch){
$this->lastX = $this->x;
$this->lastY = $this->y;
$this->lastZ = $this->z;
$this->lastYaw = $this->yaw;
$this->lastPitch = $this->pitch;
if($this instanceof Human){
$pk = new MovePlayerPacket;
$pk->eid = $this->id;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->yaw = $this->yaw;
$pk->pitch = $this->pitch;
$pk->bodyYaw = $this->yaw;
}else{
$pk = new MoveEntityPacket_PosRot;
$pk->eid = $this->id;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->yaw = $this->yaw;
$pk->pitch = $this->pitch;
}
Player::broadcastPacket($this->hasSpawned, $pk);
}
if($this->motionChanged === true){
$this->motionChanged = false;
$pk = new SetEntityMotionPacket;
$pk->eid = $this->id;
$pk->speedX = $this->motionX;
$pk->speedY = $this->motionY;
$pk->speedZ = $this->motionZ;
Player::broadcastPacket($this->hasSpawned, $pk);
}
$this->lastUpdate = $timeNow;
return false;
}
public final function scheduleUpdate(){
Entity::$needUpdate[$this->id] = $this;
}
public abstract function getMetadata();
public function setOnFire($seconds){
$ticks = $seconds * 20;
if($ticks > $this->fireTicks){
$this->fireTicks = $ticks;
}
}
public function getDirection(){
$rotation = ($this->yaw - 90) % 360;
if($rotation < 0){
$rotation += 360.0;
}
if((0 <= $rotation and $rotation < 45) or (315 <= $rotation and $rotation < 360)){
return 2; //North
}elseif(45 <= $rotation and $rotation < 135){
return 3; //East
}elseif(135 <= $rotation and $rotation < 225){
return 0; //South
}elseif(225 <= $rotation and $rotation < 315){
return 1; //West
}else{
return null;
}
}
public function extinguish(){
$this->fireTicks = 0;
}
public function canTriggerWalking(){
return true;
}
protected function updateFallState($distanceThisTick, $onGround){
if($onGround === true){
if($this->fallDistance > 0){
if($this instanceof Living){
//TODO
}
$this->fall($this->fallDistance);
$this->fallDistance = 0;
}
}elseif($distanceThisTick < 0){
$this->fallDistance -= $distanceThisTick;
}
}
public function getBoundingBox(){
return $this->boundingBox;
}
public function fall($fallDistance){ //TODO
}
public function handleWaterMovement(){ //TODO
}
public function handleLavaMovement(){ //TODO
}
public function getEyeHeight(){
return 0;
}
public function moveFlying(){ //TODO
}
public function onCollideWithPlayer(Human $entityPlayer){
}
protected function switchLevel(Level $targetLevel){
if($this->level instanceof Level){
Server::getInstance()->getPluginManager()->callEvent($ev = new EntityLevelChangeEvent($this, $this->level, $targetLevel));
if($ev->isCancelled()){
return false;
}
unset($this->level->entities[$this->id]);
unset($this->level->chunkEntities[$this->chunkIndex][$this->id]);
$this->despawnFromAll();
if($this instanceof Player){
foreach($this->chunksLoaded as $index => $Yndex){
if($Yndex !== 0xff){
$X = null;
$Z = null;
LevelFormat::getXZ($index, $X, $Z);
foreach($this->level->getChunkEntities($X, $Z) as $entity){
$entity->despawnFrom($this);
}
}
}
$this->level->freeAllChunks($this);
}
}
$this->level = $targetLevel;
$this->level->entities[$this->id] = $this;
if($this instanceof Player){
$this->chunksLoaded = array();
$pk = new SetTimePacket();
$pk->time = $this->level->getTime();
$pk->started = $this->level->stopTime == false;
$this->dataPacket($pk);
}
$this->spawnToAll();
$this->chunkIndex = false;
}
public function getPosition(){
return new Position($this->x, $this->y, $this->z, $this->level);
}
public function move(Vector3 $displacement){
if($displacement->x == 0 and $displacement->y == 0 and $displacement->z == 0){
return;
}
$x = $this->x;
$y = $this->y;
$z = $this->z;
$this->scheduleUpdate();
}
public function setPositionAndRotation(Vector3 $pos, $yaw, $pitch){
if($this->setPosition($pos) === true){
$this->setRotation($yaw, $pitch);
return true;
}
return false;
}
public function setRotation($yaw, $pitch){
$this->yaw = $yaw;
$this->pitch = $pitch;
$this->scheduleUpdate();
}
public function setPosition(Vector3 $pos){
if($pos instanceof Position and $pos->level instanceof Level and $pos->level !== $this->level){
if($this->switchLevel($pos->level) === false){
return false;
}
}
Server::getInstance()->getPluginManager()->callEvent($ev = new EntityMoveEvent($this, $pos));
if($ev->isCancelled()){
return false;
}
$this->x = $pos->x;
$this->y = $pos->y;
$this->z = $pos->z;
$radius = $this->width / 2;
if(($index = LevelFormat::getIndex($this->x >> 4, $this->z >> 4)) !== $this->chunkIndex){
if($this->chunkIndex !== false){
unset($this->level->chunkEntities[$this->chunkIndex][$this->id]);
}
$this->chunkIndex = $index;
$this->level->loadChunk($this->x >> 4, $this->z >> 4);
$newChunk = $this->level->getUsingChunk($this->x >> 4, $this->z >> 4);
foreach($this->hasSpawned as $player){
if(!isset($newChunk[$player->CID])){
$this->despawnFrom($player);
}else{
unset($newChunk[$player->CID]);
}
}
foreach($newChunk as $player){
$this->spawnTo($player);
}
$this->level->chunkEntities[$this->chunkIndex][$this->id] = $this;
}
$this->boundingBox->setBounds($pos->x - $radius, $pos->y, $pos->z - $radius, $pos->x + $radius, $pos->y + $this->height, $pos->z + $radius);
$this->scheduleUpdate();
return true;
}
public function getMotion(){
return new Vector3($this->motionX, $this->motionY, $this->motionZ);
}
public function setMotion(Vector3 $motion){
Server::getInstance()->getPluginManager()->callEvent($ev = new EntityMotionEvent($this, $motion));
if($ev->isCancelled()){
return false;
}
$this->motionX = $motion->x;
$this->motionY = $motion->y;
$this->motionZ = $motion->z;
$this->scheduleUpdate();
}
public function isOnGround(){
return $this->onGround === true;
}
public function kill(){
$this->dead = true;
}
public function getLevel(){
return $this->level;
}
public function teleport(Vector3 $pos, $yaw = false, $pitch = false){
$this->setMotion(new Vector3(0, 0, 0));
if($this->setPositionAndRotation($pos, $yaw === false ? $this->yaw : $yaw, $pitch === false ? $this->pitch : $pitch) !== false){
if($this instanceof Player){
$this->airTicks = 300;
$this->fallDistance = 0;
$this->orderChunks();
$this->getNextChunk(true);
$this->forceMovement = $pos;
$pk = new MovePlayerPacket;
$pk->eid = 0;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->bodyYaw = $this->yaw;
$pk->pitch = $this->pitch;
$pk->yaw = $this->yaw;
$this->dataPacket($pk);
}
return true;
}
return false;
}
public function getID(){
return $this->id;
}
public function spawnToAll(){
foreach($this->level->getPlayers() as $player){
if(isset($player->id) and $player->spawned === true){
$this->spawnTo($player);
}
}
}
public function despawnFromAll(){
foreach($this->hasSpawned as $player){
$this->despawnFrom($player);
}
}
public function close(){
if($this->closed === false){
$this->closed = true;
unset(Entity::$needUpdate[$this->id]);
unset($this->level->entities[$this->id]);
unset($this->level->chunkEntities[$this->chunkIndex][$this->id]);
unset(Entity::$list[$this->id]);
$this->despawnFromAll();
Server::getInstance()->getPluginManager()->callEvent(new EntityDespawnEvent($this));
}
}
public function __destruct(){
$this->close();
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\entity;
class FallingBlock extends Entity{
}

View File

@ -1,413 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\entity;
use pocketmine\event\entity\EntityArmorChangeEvent;
use pocketmine\event\entity\EntityInventoryChangeEvent;
use pocketmine\item\Item;
use pocketmine\nbt\NBT;
use pocketmine\nbt\tag\Byte;
use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Enum;
use pocketmine\nbt\tag\Short;
use pocketmine\network\protocol\AddPlayerPacket;
use pocketmine\network\protocol\ContainerSetContentPacket;
use pocketmine\network\protocol\PlayerArmorEquipmentPacket;
use pocketmine\network\protocol\PlayerEquipmentPacket;
use pocketmine\network\protocol\RemovePlayerPacket;
use pocketmine\network\protocol\SetEntityMotionPacket;
use pocketmine\Network;
use pocketmine\Player;
use pocketmine\Server;
class Human extends Creature implements ProjectileSource, InventorySource{
protected $nameTag = "TESTIFICATE";
protected $inventory = array();
public $slot;
protected $hotbar = array();
protected $armor = array();
protected function initEntity(){
if(isset($this->namedtag->NameTag)){
$this->nameTag = $this->namedtag["NameTag"];
}
$this->hotbar = array(-1, -1, -1, -1, -1, -1, -1, -1, -1);
$this->armor = array(
0 => Item::get(Item::AIR, 0, 0),
1 => Item::get(Item::AIR, 0, 0),
2 => Item::get(Item::AIR, 0, 0),
3 => Item::get(Item::AIR, 0, 0)
);
foreach($this->namedtag->Inventory as $item){
if($item["Slot"] >= 0 and $item["Slot"] < 9){ //Hotbar
$this->hotbar[$item["Slot"]] = isset($item["TrueSlot"]) ? $item["TrueSlot"] : -1;
}elseif($item["Slot"] >= 100 and $item["Slot"] < 104){ //Armor
$this->armor[$item["Slot"] - 100] = Item::get($item["id"], $item["Damage"], $item["Count"]);
}else{
$this->inventory[$item["Slot"] - 9] = Item::get($item["id"], $item["Damage"], $item["Count"]);
}
}
$this->slot = $this->hotbar[0];
$this->height = 1.8; //Or 1.62?
$this->width = 0.6;
}
public function saveNBT(){
parent::saveNBT();
$this->namedtag->Inventory = new Enum("Inventory", array());
$this->namedtag->Inventory->setTagType(NBT::TAG_Compound);
for($slot = 0; $slot < 9; ++$slot){
if(isset($this->hotbar[$slot]) and $this->hotbar[$slot] !== -1){
$item = $this->getSlot($this->hotbar[$slot]);
if($item->getID() !== 0 and $item->getCount() > 0){
$this->namedtag->Inventory[$slot] = new Compound(false, array(
new Byte("Count", $item->getCount()),
new Short("Damage", $item->getMetadata()),
new Byte("Slot", $slot),
new Byte("TrueSlot", $this->hotbar[$slot]),
new Short("id", $item->getID()),
));
continue;
}
}
$this->namedtag->Inventory[$slot] = new Compound(false, array(
new Byte("Count", 0),
new Short("Damage", 0),
new Byte("Slot", $slot),
new Byte("TrueSlot", -1),
new Short("id", 0),
));
}
//Normal inventory
$slotCount = Player::SURVIVAL_SLOTS + 9;
//$slotCount = (($this instanceof Player and ($this->gamemode & 0x01) === 1) ? Player::CREATIVE_SLOTS : Player::SURVIVAL_SLOTS) + 9;
for($slot = 9; $slot < $slotCount; ++$slot){
$item = $this->getSlot($slot - 9);
$this->namedtag->Inventory[$slot] = new Compound(false, array(
new Byte("Count", $item->getCount()),
new Short("Damage", $item->getMetadata()),
new Byte("Slot", $slot),
new Short("id", $item->getID()),
));
}
//Armor
for($slot = 100; $slot < 104; ++$slot){
$item = $this->armor[$slot - 100];
if($item instanceof Item){
$this->namedtag->Inventory[$slot] = new Compound(false, array(
new Byte("Count", $item->getCount()),
new Short("Damage", $item->getMetadata()),
new Byte("Slot", $slot),
new Short("id", $item->getID()),
));
}
}
}
public function spawnTo(Player $player){
if($player !== $this and !isset($this->hasSpawned[$player->getID()])){
$this->hasSpawned[$player->getID()] = $player;
$pk = new AddPlayerPacket;
$pk->clientID = 0;
$pk->username = $this->nameTag;
$pk->eid = $this->id;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->yaw = 0;
$pk->pitch = 0;
$pk->unknown1 = 0;
$pk->unknown2 = 0;
$pk->metadata = $this->getMetadata();
$player->dataPacket($pk);
$pk = new SetEntityMotionPacket;
$pk->eid = $this->id;
$pk->speedX = $this->motionX;
$pk->speedY = $this->motionY;
$pk->speedZ = $this->motionZ;
$player->dataPacket($pk);
$this->sendCurrentEquipmentSlot($player);
$this->sendArmor($player);
}
}
public function despawnFrom(Player $player){
if(isset($this->hasSpawned[$player->getID()])){
$pk = new RemovePlayerPacket;
$pk->eid = $this->id;
$pk->clientID = 0;
$player->dataPacket($pk);
unset($this->hasSpawned[$player->getID()]);
}
}
public function setEquipmentSlot($equipmentSlot, $inventorySlot){
$this->hotbar[$equipmentSlot] = $inventorySlot;
if($equipmentSlot === $this->slot){
foreach($this->hasSpawned as $p){
$this->sendEquipmentSlot($p);
}
}
}
public function setCurrentEquipmentSlot($slot){
if(isset($this->hotbar[$slot])){
$this->slot = (int) $slot;
foreach($this->hasSpawned as $p){
$this->sendEquipmentSlot($p);
}
}
}
public function sendCurrentEquipmentSlot(Player $player){
$pk = new PlayerEquipmentPacket;
$pk->eid = $this->id;
$pk->item = $this->getSlot($this->slot)->getID();
$pk->meta = $this->getSlot($this->slot)->getMetadata();
$pk->slot = 0;
$player->dataPacket($pk);
}
public function setArmorSlot($slot, Item $item){
Server::getInstance()->getPluginManager()->callEvent($ev = new EntityArmorChangeEvent($this, $this->getArmorSlot($slot), $item, $slot));
if($ev->isCancelled()){
return false;
}
$this->armor[(int) $slot] = $ev->getNewItem();
foreach($this->hasSpawned as $p){
$this->sendArmor($p);
}
if($this instanceof Player){
$this->sendArmor();
}
return true;
}
public function getArmorSlot($slot){
$slot = (int) $slot;
if(!isset($this->armor[$slot])){
$this->armor[$slot] = Item::get(Item::AIR, 0, 0);
}
return $this->armor[$slot];
}
public function sendArmor($player = null){
$slots = array();
for($i = 0; $i < 4; ++$i){
if(isset($this->armor[$i]) and ($this->armor[$i] instanceof Item) and $this->armor[$i]->getID() > Item::AIR){
$slots[$i] = $this->armor[$i]->getID() !== Item::AIR ? $this->armor[$i]->getID() - 256 : 0;
}else{
$this->armor[$i] = Item::get(Item::AIR, 0, 0);
$slots[$i] = 255;
}
}
if($player instanceof Player){
$pk = new PlayerArmorEquipmentPacket();
$pk->eid = $this->id;
$pk->slots = $slots;
$player->dataPacket($pk);
}elseif($this instanceof Player){
$pk = new ContainerSetContentPacket;
$pk->windowid = 0x78; //Armor window id
$pk->slots = $this->armor;
$this->dataPacket($pk);
}
}
public function getMetadata(){ //TODO
$flags = 0;
$flags |= $this->fireTicks > 0 ? 1 : 0;
//$flags |= ($this->crouched === true ? 0b10:0) << 1;
//$flags |= ($this->inAction === true ? 0b10000:0);
$d = array(
0 => array("type" => 0, "value" => $flags),
1 => array("type" => 1, "value" => $this->airTicks),
16 => array("type" => 0, "value" => 0),
17 => array("type" => 6, "value" => array(0, 0, 0)),
);
/*if($this->class === ENTITY_MOB and $this->type === MOB_SHEEP){
if(!isset($this->data["Sheared"])){
$this->data["Sheared"] = 0;
$this->data["Color"] = mt_rand(0,15);
}
$d[16]["value"] = (($this->data["Sheared"] == 1 ? 1:0) << 4) | ($this->data["Color"] & 0x0F);
}elseif($this->type === OBJECT_PRIMEDTNT){
$d[16]["value"] = (int) max(0, $this->data["fuse"] - (microtime(true) - $this->spawntime) * 20);
}elseif($this->class === ENTITY_PLAYER){
if($this->player->sleeping !== false){
$d[16]["value"] = 2;
$d[17]["value"] = array($this->player->sleeping->x, $this->player->sleeping->y, $this->player->sleeping->z);
}
}*/
return $d;
}
public function attack($damage, $source = "generic"){
}
public function heal($amount, $source = "generic"){
}
public function hasItem(Item $item, $checkDamage = true){
foreach($this->inventory as $s => $i){
if($i->equals($item, $checkDamage)){
return $i;
}
}
return false;
}
public function canAddItem(Item $item){
$inv = $this->inventory;
while($item->getCount() > 0){
$add = 0;
foreach($inv as $s => $i){
if($i->getID() === Item::AIR){
$add = min($i->getMaxStackSize(), $item->getCount());
$inv[$s] = clone $item;
$inv[$s]->setCount($add);
break;
}elseif($i->equals($item)){
$add = min($i->getMaxStackSize() - $i->getCount(), $item->getCount());
if($add <= 0){
continue;
}
$inv[$s] = clone $item;
$inv[$s]->setCount($i->getCount() + $add);
break;
}
}
if($add <= 0){
return false;
}
$item->setCount($item->getCount() - $add);
}
return true;
}
public function addItem(Item $item){
while($item->getCount() > 0){
$add = 0;
foreach($this->inventory as $s => $i){
if($i->getID() === Item::AIR){
$add = min($i->getMaxStackSize(), $item->getCount());
$i2 = clone $item;
$i2->setCount($add);
$this->setSlot($s, $i2);
break;
}elseif($i->equals($item)){
$add = min($i->getMaxStackSize() - $i->getCount(), $item->getCount());
if($add <= 0){
continue;
}
$i2 = clone $item;
$i2->setCount($i->getCount() + $add);
$this->setSlot($s, $i2);
break;
}
}
if($add <= 0){
return false;
}
$item->setCount($item->getCount() - $add);
}
return true;
}
public function canRemoveItem(Item $item, $checkDamage = true){
return $this->hasItem($item, $checkDamage);
}
public function removeItem(Item $item, $checkDamage = true){
while($item->getCount() > 0){
$remove = 0;
foreach($this->inventory as $s => $i){
if($i->equals($item, $checkDamage)){
$remove = min($item->getCount(), $i->getCount());
if($item->getCount() < $i->getCount()){
$i->setCount($i->getCount() - $item->getCount());
$this->setSlot($s, $i);
}else{
$this->setSlot($s, Item::get(Item::AIR, 0, 0));
}
break;
}
}
if($remove <= 0){
return false;
}
$item->setCount($item->getCount() - $remove);
}
return true;
}
public function setSlot($slot, Item $item){
Server::getInstance()->getPluginManager()->callEvent($ev = new EntityInventoryChangeEvent($this, $this->getSlot($slot), $item, $slot));
if($ev->isCancelled()){
return false;
}
$this->inventory[(int) $slot] = $ev->getNewItem();
return true;
}
/**
* @param int $slot
*
* @return Item
*/
public function getSlot($slot){
$slot = (int) $slot;
if(!isset($this->inventory[$slot])){
$this->inventory[$slot] = Item::get(Item::AIR, 0, 0);
}
return $this->inventory[$slot];
}
public function getAllSlots(){
return $this->inventory;
}
public function getSlotCount(){
return count($this->inventory);
}
}

View File

@ -1,58 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\entity;
use pocketmine\item\Item;
interface InventorySource{
public function hasItem(Item $item, $checkDamage = true);
public function canAddItem(Item $item);
/**
* @param Item $item
*
* @return boolean hasBeenAdded
*/
public function addItem(Item $item);
public function canRemoveItem(Item $item, $checkDamage = true);
/**
* @param Item $item
* @param boolean $checkDamage
*
* @return boolean hasBeenRemoved
*/
public function removeItem(Item $item, $checkDamage = true);
public function getSlotCount();
public function getAllSlots();
public function getSlot($slot);
public function setSlot($slot, Item $item);
}

View File

@ -1,27 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\entity;
abstract class Living extends Entity implements Damageable{
}

View File

@ -1,27 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\entity;
class TNTPrimed extends Entity implements Explosive{
}

View File

@ -1,27 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\entity;
class Zombie extends Monster{
}

View File

@ -1,154 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\level;
use pocketmine\block\Block;
use pocketmine\block\TNT;
use pocketmine\entity\Entity;
use pocketmine\event\entity\EntityExplodeEvent;
use pocketmine\item\Item;
use pocketmine\math\Vector3 as Vector3;
use pocketmine\network\protocol\ExplodePacket;
use pocketmine\Player;
use pocketmine\Server;
class Explosion{
public static $specialDrops = array(
Item::GRASS => Item::DIRT,
Item::STONE => Item::COBBLESTONE,
Item::COAL_ORE => Item::COAL,
Item::DIAMOND_ORE => Item::DIAMOND,
Item::REDSTONE_ORE => Item::REDSTONE,
);
private $rays = 16; //Rays
public $level;
public $source;
public $size;
/**
* @var Block[]
*/
public $affectedBlocks = array();
public $stepLen = 0.3;
private $what;
public function __construct(Position $center, $size, $what = null){
$this->level = $center->level;
$this->source = $center;
$this->size = max($size, 0);
$this->what = $what;
}
public function explode(){
if($this->size < 0.1){
return false;
}
$mRays = $this->rays - 1;
for($i = 0; $i < $this->rays; ++$i){
for($j = 0; $j < $this->rays; ++$j){
for($k = 0; $k < $this->rays; ++$k){
if($i == 0 or $i == $mRays or $j == 0 or $j == $mRays or $k == 0 or $k == $mRays){
$vector = new Vector3($i / $mRays * 2 - 1, $j / $mRays * 2 - 1, $k / $mRays * 2 - 1); //($i / $mRays) * 2 - 1
$vector = $vector->normalize()->multiply($this->stepLen);
$pointer = clone $this->source;
for($blastForce = $this->size * (mt_rand(700, 1300) / 1000); $blastForce > 0; $blastForce -= $this->stepLen * 0.75){
$vBlock = $pointer->floor();
$blockID = $this->level->level->getBlockID($vBlock->x, $vBlock->y, $vBlock->z);
if($blockID > 0){
$block = Block::get($blockID, 0);
$block->x = $vBlock->x;
$block->y = $vBlock->y;
$block->z = $vBlock->z;
$blastForce -= ($block->getHardness() / 5 + 0.3) * $this->stepLen;
if($blastForce > 0){
$index = ($block->x << 15) + ($block->z << 7) + $block->y;
if(!isset($this->affectedBlocks[$index])){
$this->affectedBlocks[$index] = $block;
}
}
}
$pointer = $pointer->add($vector);
}
}
}
}
}
$send = array();
$source = $this->source->floor();
$radius = 2 * $this->size;
$yield = (1 / $this->size) * 100;
if($this->what instanceof Entity){
Server::getInstance()->getPluginManager()->callEvent($ev = new EntityExplodeEvent($this->what, $this->source, $this->affectedBlocks, $yield));
if($ev->isCancelled()){
return false;
}else{
$yield = $ev->getYield();
$this->affectedBlocks = $ev->getBlockList();
}
}
//TODO
/*foreach($server->api->entity->getRadius($this->source, $radius) as $entity){
$impact = (1 - $this->source->distance($entity) / $radius) * 0.5; //placeholder, 0.7 should be exposure
$damage = (int) (($impact * $impact + $impact) * 8 * $this->size + 1);
$entity->harm($damage, "explosion");
}*/
foreach($this->affectedBlocks as $block){
if($block instanceof TNT){
$data = array(
"x" => $block->x + 0.5,
"y" => $block->y + 0.5,
"z" => $block->z + 0.5,
"power" => 4,
"fuse" => mt_rand(10, 30), //0.5 to 1.5 seconds
);
//TODO
//$e = $server->api->entity->add($this->level, ENTITY_OBJECT, OBJECT_PRIMEDTNT, $data);
//$e->spawnToAll();
}elseif(mt_rand(0, 100) < $yield){
if(isset(self::$specialDrops[$block->getID()])){
//TODO
//$server->api->entity->drop(new Position($block->x + 0.5, $block->y, $block->z + 0.5, $this->level), Item::get(self::$specialDrops[$block->getID()], 0));
}else{
//TODO
//$server->api->entity->drop(new Position($block->x + 0.5, $block->y, $block->z + 0.5, $this->level), Item::get($block->getID(), $this->level->level->getBlockDamage($block->x, $block->y, $block->z)));
}
}
$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);
}
$pk = new ExplodePacket;
$pk->x = $this->source->x;
$pk->y = $this->source->y;
$pk->z = $this->source->z;
$pk->radius = $this->size;
$pk->records = $send;
Player::broadcastPacket($this->level->getPlayers(), $pk);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,71 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\level;
use pocketmine\level\generator\Generator;
use pocketmine\pmf\LevelFormat;
use pocketmine\utils\Config;
use pocketmine\utils\Random;
use pocketmine\utils\Utils;
class WorldGenerator{
private $seed, $level, $path, $random, $generator, $height;
public function __construct(Generator $generator, $name, $seed = false, $height = 8){
$this->seed = $seed !== false ? (int) $seed : Utils::readInt(Utils::getRandomBytes(4, false));
$this->random = new Random($this->seed);
$this->height = (int) $height;
$this->path = \pocketmine\DATA . "worlds/" . $name . "/";
$this->generator = $generator;
$level = new LevelFormat($this->path . "level.pmf", array(
"name" => $name,
"seed" => $this->seed,
"time" => 0,
"spawnX" => 128,
"spawnY" => 128,
"spawnZ" => 128,
"height" => $this->height,
"generator" => $this->generator->getName(),
"generatorSettings" => $this->generator->getSettings(),
"extra" => ""
));
$blockUpdates = new Config($this->path . "bupdates.yml", Config::YAML);
$this->level = new Level($level, $name);
}
public function generate(){
$this->generator->init($this->level, $this->random);
for($Z = 7; $Z <= 9; ++$Z){
for($X = 7; $X <= 9; ++$X){
$this->level->level->loadChunk($X, $Z);
}
}
$this->level->setSpawn($this->generator->getSpawn());
}
public function close(){
$this->level->close();
}
}

View File

@ -1,188 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\math;
class Vector3{
public $x;
public $y;
public $z;
public function __construct($x = 0, $y = 0, $z = 0){
$this->x = $x;
$this->y = $y;
$this->z = $z;
}
public function getX(){
return $this->x;
}
public function getY(){
return $this->y;
}
public function getZ(){
return $this->z;
}
public function getFloorX(){
return (int) $this->x;
}
public function getFloorY(){
return (int) $this->y;
}
public function getFloorZ(){
return (int) $this->z;
}
public function getRight(){
return $this->getX();
}
public function getUp(){
return $this->getY();
}
public function getForward(){
return $this->getZ();
}
public function getSouth(){
return $this->getX();
}
public function getWest(){
return $this->getZ();
}
public function add($x = 0, $y = 0, $z = 0){
if(($x instanceof Vector3) === true){
return $this->add($x->x, $x->y, $x->z);
}else{
return new Vector3($this->x + $x, $this->y + $y, $this->z + $z);
}
}
public function subtract($x = 0, $y = 0, $z = 0){
if(($x instanceof Vector3) === true){
return $this->add(-$x->x, -$x->y, -$x->z);
}else{
return $this->add(-$x, -$y, -$z);
}
}
public function multiply($number){
return new Vector3($this->x * $number, $this->y * $number, $this->z * $number);
}
public function divide($number){
return new Vector3($this->x / $number, $this->y / $number, $this->z / $number);
}
public function ceil(){
return new Vector3((int) ($this->x + 1), (int) ($this->y + 1), (int) ($this->z + 1));
}
public function floor(){
return new Vector3((int) $this->x, (int) $this->y, (int) $this->z);
}
public function round(){
return new Vector3(round($this->x), round($this->y), round($this->z));
}
public function abs(){
return new Vector3(abs($this->x), abs($this->y), abs($this->z));
}
public function getSide($side){
switch((int) $side){
case 0:
return new Vector3($this->x, $this->y - 1, $this->z);
case 1:
return new Vector3($this->x, $this->y + 1, $this->z);
case 2:
return new Vector3($this->x, $this->y, $this->z - 1);
case 3:
return new Vector3($this->x, $this->y, $this->z + 1);
case 4:
return new Vector3($this->x - 1, $this->y, $this->z);
case 5:
return new Vector3($this->x + 1, $this->y, $this->z);
default:
return $this;
}
}
public function distance(Vector3 $pos){
return sqrt($this->distanceSquared($pos));
}
public function distanceSquared(Vector3 $pos){
return pow($this->x - $pos->x, 2) + pow($this->y - $pos->y, 2) + pow($this->z - $pos->z, 2);
}
public function maxPlainDistance($x = 0, $z = 0){
if(($x instanceof Vector3) === true){
return $this->maxPlainDistance($x->x, $x->z);
}else{
return max(abs($this->x - $x), abs($this->z - $z));
}
}
public function length(){
return sqrt($this->lengthSquared());
}
public function lengthSquared(){
return $this->x * $this->x + $this->y * $this->y + $this->z * $this->z;
}
public function normalize(){
$len = $this->length();
if($len != 0){
return $this->divide($len);
}
return new Vector3(0, 0, 0);
}
public function dot(Vector3 $v){
return $this->x * $v->x + $this->y * $v->y + $this->z * $v->z;
}
public function cross(Vector3 $v){
return new Vector3(
$this->y * $v->z - $this->z * $v->y,
$this->z * $v->x - $this->x * $v->z,
$this->x * $v->y - $this->y * $v->x
);
}
public function __toString(){
return "Vector3(x=" . $this->x . ",y=" . $this->y . ",z=" . $this->z . ")";
}
}

View File

@ -1,30 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\network;
class Packet extends \stdClass{
public $ip;
public $port;
public $buffer;
}

View File

@ -1,187 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
/**
* Network-related classes
*/
namespace pocketmine\network;
use pocketmine\network\query\QueryPacket;
use pocketmine\network\raknet\Info;
use pocketmine\network\raknet\Packet as RakNetPacket;
class ThreadedHandler extends \Thread{
protected $bandwidthUp;
protected $bandwidthDown;
protected $bandwidthTime;
private $socket;
protected $packets;
protected $queue;
protected $stop;
protected $server;
protected $port;
protected $serverip;
function __construct($server, $port = 19132, $serverip = "0.0.0.0"){
$this->server = $server;
$this->port = $port;
$this->serverip = $serverip;
$this->bandwidthUp = 0;
$this->bandwidthDown = 0;
$this->bandwidthTime = microtime(true);
$this->packets = new \Threaded();
$this->queue = new \Threaded();
$this->stop = false;
//Load the classes so the Thread gets them
Info::isValid(0);
new Packet(0);
new QueryPacket();
new RakNetPacket(0);
$this->start(PTHREADS_INHERIT_ALL);
}
public function close(){
$this->synchronized(function (){
$this->stop = true;
socket_close($this->socket);
});
}
/**
* Upload speed in bytes/s
*
* @return float
*/
public function getUploadSpeed(){
return $this->bandwidthUp / max(1, microtime(true) - $this->bandwidthTime);
}
/**
* Download speed in bytes/s
*
* @return float
*/
public function getDownloadSpeed(){
return $this->bandwidthDown / max(1, microtime(true) - $this->bandwidthTime);
}
/**
* @return Packet
*/
public function readPacket(){
return $this->packets->shift();
}
/**
* @param Packet $packet
*
* @return int
*/
public function writePacket(Packet $packet){
$this->queue[] = $packet;
return strlen($packet->buffer);
}
public function run(){
$autoloader = new \SplClassLoader();
$autoloader->add("pocketmine", array(
\pocketmine\PATH . "src"
));
$autoloader->register(true);
$this->socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_set_option($this->socket, SOL_SOCKET, SO_BROADCAST, 1); //Allow sending broadcast messages
if(@socket_bind($this->socket, $this->serverip, $this->port) === true){
socket_set_option($this->socket, SOL_SOCKET, SO_REUSEADDR, 0);
@socket_set_option($this->socket, SOL_SOCKET, SO_SNDBUF, 1024 * 1024 * 2); //2MB
@socket_set_option($this->socket, SOL_SOCKET, SO_RCVBUF, 1024 * 1024); //1MB
}else{
console("[SEVERE] **** FAILED TO BIND TO " . $this->serverip . ":" . $this->port . "!", true, true, 0);
console("[SEVERE] Perhaps a server is already running on that port?", true, true, 0);
exit(1);
}
socket_set_nonblock($this->socket);
$count = 0;
while($this->stop === false){
if($this->getPacket() === false and $this->putPacket() === false){
++$count;
}else{
$count = 0;
}
if($count > 128){
$this->wait(100000);
}
}
}
private function putPacket(){
if(($packet = $this->queue->shift()) instanceof Packet){
if($packet instanceof RakNetPacket){
$packet->encode();
}
$this->bandwidthUp += @socket_sendto($this->socket, $packet->buffer, strlen($packet->buffer), 0, $packet->ip, $packet->port);
return true;
}
return false;
}
private function getPacket(){
$buffer = null;
$source = null;
$port = null;
$len = @socket_recvfrom($this->socket, $buffer, 65535, 0, $source, $port);
if($len === false or $len == 0){
return false;
}
$this->bandwidthDown += $len;
$pid = ord($buffer{0});
if(Info::isValid($pid)){
$packet = new RakNetPacket($pid);
$packet->buffer =& $buffer;
$packet->ip = $source;
$packet->port = $port;
$packet->decode();
}elseif($pid === 0xfe and $buffer{1} === "\xfd"){
$packet = new QueryPacket;
$packet->ip = $source;
$packet->port = $port;
$packet->buffer =& $buffer;
}else{
$packet = new Packet($pid);
$packet->ip = $source;
$packet->port = $port;
$packet->buffer =& $buffer;
}
$this->packets[] = $packet;
return true;
}
}
?>

View File

@ -1,54 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\network\protocol;
class ClientHandshakePacket extends DataPacket{
public $cookie;
public $security;
public $port;
public $dataArray0;
public $dataArray;
public $timestamp;
public $session2;
public $session;
public function pid(){
return Info::CLIENT_HANDSHAKE_PACKET;
}
public function decode(){
$this->cookie = $this->get(4);
$this->security = $this->get(1);
$this->port = $this->getShort(true);
$this->dataArray0 = $this->get($this->getByte());
$this->dataArray = $this->getDataArray(9);
$this->timestamp = $this->get(2);
$this->session2 = $this->getLong();
$this->session = $this->getLong();
}
public function encode(){
}
}

View File

@ -1,41 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\network\protocol;
class PingPacket extends DataPacket{
public $time = 0;
public function pid(){
return Info::PING_PACKET;
}
public function decode(){
$this->time = $this->getLong();
}
public function encode(){
$this->reset();
$this->putLong($this->time);
}
}

View File

@ -1,44 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\network\protocol;
class PongPacket extends DataPacket{
public $time = 0;
public $ptime = 0;
public function pid(){
return Info::PONG_PACKET;
}
public function decode(){
$this->ptime = $this->getLong();
$this->time = $this->getLong();
}
public function encode(){
$this->reset();
$this->putLong($this->ptime);
$this->putLong($this->time);
}
}

View File

@ -1,60 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\network\protocol;
class ServerHandshakePacket extends DataPacket{
public $port;
public $session;
public $session2;
public function pid(){
return Info::SERVER_HANDSHAKE_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->put("\x04\x3f\x57\xfe"); //cookie
$this->put("\xcd"); //Security flags
$this->putShort($this->port);
$this->putDataArray(array(
"\xf5\xff\xff\xf5",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
));
$this->put("\x00\x00");
$this->putLong($this->session);
$this->putLong($this->session2);
}
}

View File

@ -1,143 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
/**
* Implementation of the UT3 Query Protocol (GameSpot)
* Source: http://wiki.unrealadmin.org/UT3_query_protocol
*/
namespace pocketmine\network\query;
use pocketmine\level\Level;
use pocketmine\Player;
use pocketmine\Server;
use pocketmine\utils\Utils;
class QueryHandler{
private $socket, $server, $lastToken, $token, $longData, $timeout;
public function __construct(){
console("[INFO] Starting GS4 status listener");
$this->server = Server::getInstance();
$addr = ($ip = $this->server->getIp()) != "" ? $ip : "0.0.0.0";
$port = $this->server->getPort();
console("[INFO] Setting query port to $port");
/*
The Query protocol is built on top of the existing Minecraft PE UDP network stack.
Because the 0xFE packet does not exist in the MCPE protocol,
we can identify Query packets and remove them from the packet queue.
Then, the Query class handles itself sending the packets in raw form, because
packets can conflict with the MCPE ones.
*/
$this->regenerateToken();
$this->lastToken = $this->token;
$this->regenerateInfo();
console("[INFO] Query running on $addr:$port");
}
public function regenerateInfo(){
$str = "";
$plist = "PocketMine-MP " . $this->server->getPocketMineVersion();
$pl = $this->server->getPluginManager()->getPlugins();
if(count($pl) > 0){
$plist .= ":";
foreach($pl as $p){
$d = $p->getDescription();
$plist .= " " . str_replace(array(";", ":", " "), array("", "", "_"), $d->getName()) . " " . str_replace(array(";", ":", " "), array("", "", "_"), $d->getVersion()) . ";";
}
$plist = substr($plist, 0, -1);
}
$KVdata = array(
"splitnum" => chr(128),
"hostname" => $this->server->getServerName(),
"gametype" => ($this->server->getGamemode() & 0x01) === 0 ? "SMP" : "CMP",
"game_id" => "MINECRAFTPE",
"version" => $this->server->getVersion(),
"server_engine" => $this->server->getName() . " " . $this->server->getPocketMineVersion(),
"plugins" => $plist,
"map" => Level::getDefault()->getName(),
"numplayers" => count(Player::$list),
"maxplayers" => $this->server->getMaxPlayers(),
"whitelist" => $this->server->hasWhitelist() === true ? "on" : "off",
"hostport" => $this->server->getPort()
);
foreach($KVdata as $key => $value){
$str .= $key . "\x00" . $value . "\x00";
}
$str .= "\x00\x01player_\x00\x00";
foreach(Player::$list as $player){
if($player->getName() != ""){
$str .= $player->getName() . "\x00";
}
}
$str .= "\x00";
$this->longData = $str;
$this->timeout = microtime(true) + 5;
}
public function regenerateToken(){
$this->lastToken = $this->token;
$this->token = Utils::getRandomBytes(16, false);
}
public static function getTokenString($token, $salt){
return Utils::readInt(substr(hash("sha512", $salt . ":" . $token, true), 7, 4));
}
public function handle(QueryPacket $packet){
$packet->decode();
switch($packet->packetType){
case QueryPacket::HANDSHAKE: //Handshake
$pk = new QueryPacket;
$pk->ip = $packet->ip;
$pk->port = $packet->port;
$pk->packetType = QueryPacket::HANDSHAKE;
$pk->sessionID = $packet->sessionID;
$pk->payload = self::getTokenString($this->token, $packet->ip) . "\x00";
$pk->encode();
$this->server->sendPacket($pk);
break;
case QueryPacket::STATISTICS: //Stat
$token = Utils::readInt(substr($packet->payload, 0, 4));
if($token !== self::getTokenString($this->token, $packet->ip) and $token !== self::getTokenString($this->lastToken, $packet->ip)){
break;
}
$pk = new QueryPacket;
$pk->ip = $packet->ip;
$pk->port = $packet->port;
$pk->packetType = QueryPacket::STATISTICS;
$pk->sessionID = $packet->sessionID;
if(strlen($packet->payload) === 8){
if($this->timeout < microtime(true)){
$this->regenerateInfo();
}
$pk->payload = $this->longData;
}else{
$pk->payload = $this->server->getServerName() . "\x00" . (($this->server->getGamemode() & 0x01) === 0 ? "SMP" : "CMP") . "\x00" . Level::getDefault()->getName() . "\x00" . count(Player::$list) . "\x00" . $this->server->getMaxPlayers() . "\x00" . Utils::writeLShort($this->server->getPort()) . $this->server->getIp() . "\x00";
}
$pk->encode();
$this->server->sendPacket($pk);
break;
}
}
}

View File

@ -1,46 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\network\query;
use pocketmine\network\Packet;
use pocketmine\utils\Utils;
class QueryPacket extends Packet{
const HANDSHAKE = 9;
const STATISTICS = 0;
public $packetType;
public $sessionID;
public $payload;
public function decode(){
$this->packetType = ord($this->buffer{2});
$this->sessionID = Utils::readInt(substr($this->buffer, 3, 4));
$this->payload = substr($this->buffer, 7);
}
public function encode(){
$this->buffer .= chr($this->packetType);
$this->buffer .= Utils::writeInt($this->sessionID);
$this->buffer .= $this->payload;
}
}

View File

@ -1,99 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
/**
* RakNet UDP library implementation
*/
namespace pocketmine\network\raknet;
abstract class Info{
const STRUCTURE = 5;
const MAGIC = "\x00\xff\xff\x00\xfe\xfe\xfe\xfe\xfd\xfd\xfd\xfd\x12\x34\x56\x78";
const UNCONNECTED_PING = 0x01;
const UNCONNECTED_PING_OPEN_CONNECTIONS = 0x02;
const OPEN_CONNECTION_REQUEST_1 = 0x05;
const OPEN_CONNECTION_REPLY_1 = 0x06;
const OPEN_CONNECTION_REQUEST_2 = 0x07;
const OPEN_CONNECTION_REPLY_2 = 0x08;
const INCOMPATIBLE_PROTOCOL_VERSION = 0x1a; //CHECK THIS
const UNCONNECTED_PONG = 0x1c;
const ADVERTISE_SYSTEM = 0x1d;
const DATA_PACKET_0 = 0x80;
const DATA_PACKET_1 = 0x81;
const DATA_PACKET_2 = 0x82;
const DATA_PACKET_3 = 0x83;
const DATA_PACKET_4 = 0x84;
const DATA_PACKET_5 = 0x85;
const DATA_PACKET_6 = 0x86;
const DATA_PACKET_7 = 0x87;
const DATA_PACKET_8 = 0x88;
const DATA_PACKET_9 = 0x89;
const DATA_PACKET_A = 0x8a;
const DATA_PACKET_B = 0x8b;
const DATA_PACKET_C = 0x8c;
const DATA_PACKET_D = 0x8d;
const DATA_PACKET_E = 0x8e;
const DATA_PACKET_F = 0x8f;
const NACK = 0xa0;
const ACK = 0xc0;
public static function isValid($pid){
switch((int) $pid){
case self::UNCONNECTED_PING:
case self::UNCONNECTED_PING_OPEN_CONNECTIONS:
case self::OPEN_CONNECTION_REQUEST_1:
case self::OPEN_CONNECTION_REPLY_1:
case self::OPEN_CONNECTION_REQUEST_2:
case self::OPEN_CONNECTION_REPLY_2:
case self::INCOMPATIBLE_PROTOCOL_VERSION:
case self::UNCONNECTED_PONG:
case self::ADVERTISE_SYSTEM:
case self::DATA_PACKET_0:
case self::DATA_PACKET_1:
case self::DATA_PACKET_2:
case self::DATA_PACKET_3:
case self::DATA_PACKET_4:
case self::DATA_PACKET_5:
case self::DATA_PACKET_6:
case self::DATA_PACKET_7:
case self::DATA_PACKET_8:
case self::DATA_PACKET_9:
case self::DATA_PACKET_A:
case self::DATA_PACKET_B:
case self::DATA_PACKET_C:
case self::DATA_PACKET_D:
case self::DATA_PACKET_E:
case self::DATA_PACKET_F:
case self::NACK:
case self::ACK:
return true;
default:
return false;
}
}
}

View File

@ -1,591 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\network\raknet;
use pocketmine\network\Packet as NetworkPacket;
use pocketmine\network\protocol\AddEntityPacket;
use pocketmine\network\protocol\AddItemEntityPacket;
use pocketmine\network\protocol\AddMobPacket;
use pocketmine\network\protocol\AddPaintingPacket;
use pocketmine\network\protocol\AddPlayerPacket;
use pocketmine\network\protocol\AdventureSettingsPacket;
use pocketmine\network\protocol\AnimatePacket;
use pocketmine\network\protocol\ChatPacket;
use pocketmine\network\protocol\ChunkDataPacket;
use pocketmine\network\protocol\ClientConnectPacket;
use pocketmine\network\protocol\ContainerClosePacket;
use pocketmine\network\protocol\ContainerOpenPacket;
use pocketmine\network\protocol\ContainerSetContentPacket;
use pocketmine\network\protocol\ContainerSetDataPacket;
use pocketmine\network\protocol\ContainerSetSlotPacket;
use pocketmine\network\protocol\DataPacket;
use pocketmine\network\protocol\DisconnectPacket;
use pocketmine\network\protocol\DropItemPacket;
use pocketmine\network\protocol\EntityDataPacket;
use pocketmine\network\protocol\EntityEventPacket;
use pocketmine\network\protocol\ExplodePacket;
use pocketmine\network\protocol\HurtArmorPacket;
use pocketmine\network\protocol\Info as ProtocolInfo;
use pocketmine\network\protocol\InteractPacket;
use pocketmine\network\protocol\LevelEventPacket;
use pocketmine\network\protocol\LoginPacket;
use pocketmine\network\protocol\LoginStatusPacket;
use pocketmine\network\protocol\MessagePacket;
use pocketmine\network\protocol\MoveEntityPacket;
use pocketmine\network\protocol\MoveEntityPacket_PosRot;
use pocketmine\network\protocol\MovePlayerPacket;
use pocketmine\network\protocol\PingPacket;
use pocketmine\network\protocol\PlayerActionPacket;
use pocketmine\network\protocol\PlayerArmorEquipmentPacket;
use pocketmine\network\protocol\PlayerEquipmentPacket;
use pocketmine\network\protocol\PongPacket;
use pocketmine\network\protocol\ReadyPacket;
use pocketmine\network\protocol\RemoveBlockPacket;
use pocketmine\network\protocol\RemoveEntityPacket;
use pocketmine\network\protocol\RemovePlayerPacket;
use pocketmine\network\protocol\RequestChunkPacket;
use pocketmine\network\protocol\RespawnPacket;
use pocketmine\network\protocol\RotateHeadPacket;
use pocketmine\network\protocol\SendInventoryPacket;
use pocketmine\network\protocol\ServerHandshakePacket;
use pocketmine\network\protocol\SetEntityDataPacket;
use pocketmine\network\protocol\SetEntityMotionPacket;
use pocketmine\network\protocol\SetHealthPacket;
use pocketmine\network\protocol\SetSpawnPositionPacket;
use pocketmine\network\protocol\SetTimePacket;
use pocketmine\network\protocol\StartGamePacket;
use pocketmine\network\protocol\TakeItemEntityPacket;
use pocketmine\network\protocol\TileEventPacket;
use pocketmine\network\protocol\UnknownPacket;
use pocketmine\network\protocol\UpdateBlockPacket;
use pocketmine\network\protocol\UseItemPacket;
use pocketmine\utils\Utils;
class Packet extends NetworkPacket{
private $packetID;
private $offset = 1;
public $data = array();
public function __construct($packetID){
$this->packetID = (int) $packetID;
}
public function pid(){
return $this->packetID;
}
protected function get($len){
if($len <= 0){
$this->offset = strlen($this->buffer) - 1;
return "";
}elseif($len === true){
return substr($this->buffer, $this->offset);
}
$buffer = "";
for(; $len > 0; --$len, ++$this->offset){
$buffer .= @$this->buffer{$this->offset};
}
return $buffer;
}
private function getLong($unsigned = false){
return Utils::readLong($this->get(8), $unsigned);
}
private function getInt(){
return Utils::readInt($this->get(4));
}
private function getShort($unsigned = false){
return Utils::readShort($this->get(2), $unsigned);
}
private function getLTriad(){
return Utils::readTriad(strrev($this->get(3)));
}
private function getByte(){
return ord($this->buffer{$this->offset++});
}
private function feof(){
return !isset($this->buffer{$this->offset});
}
public function decode(){
$this->offset = 1;
switch($this->packetID){
case Info::UNCONNECTED_PING:
case Info::UNCONNECTED_PING_OPEN_CONNECTIONS:
$this->pingID = $this->getLong();
$this->offset += 16; //Magic
break;
case Info::OPEN_CONNECTION_REQUEST_1:
$this->offset += 16; //Magic
$this->structure = $this->getByte();
$this->mtuSize = strlen($this->get(true));
break;
case Info::OPEN_CONNECTION_REQUEST_2:
$this->offset += 16; //Magic
$this->security = $this->get(5);
$this->clientPort = $this->getShort(false);
$this->mtuSize = $this->getShort(false);
$this->clientID = $this->getLong();
break;
case Info::DATA_PACKET_0:
case Info::DATA_PACKET_1:
case Info::DATA_PACKET_2:
case Info::DATA_PACKET_3:
case Info::DATA_PACKET_4:
case Info::DATA_PACKET_5:
case Info::DATA_PACKET_6:
case Info::DATA_PACKET_7:
case Info::DATA_PACKET_8:
case Info::DATA_PACKET_9:
case Info::DATA_PACKET_A:
case Info::DATA_PACKET_B:
case Info::DATA_PACKET_C:
case Info::DATA_PACKET_D:
case Info::DATA_PACKET_E:
case Info::DATA_PACKET_F:
$this->seqNumber = $this->getLTriad();
$this->data = array();
while(!$this->feof() and $this->parseDataPacket() !== false){
}
break;
case Info::NACK:
case Info::ACK:
$count = $this->getShort();
$this->packets = array();
for($i = 0; $i < $count and !$this->feof(); ++$i){
if($this->getByte() === 0){
$start = $this->getLTriad();
$end = $this->getLTriad();
if(($end - $start) > 4096){
$end = $start + 4096;
}
for($c = $start; $c <= $end; ++$c){
$this->packets[] = $c;
}
}else{
$this->packets[] = $this->getLTriad();
}
}
break;
default:
break;
}
}
private function parseDataPacket(){
$packetFlags = $this->getByte();
$reliability = ($packetFlags & 0b11100000) >> 5;
$hasSplit = ($packetFlags & 0b00010000) > 0;
$length = (int) ceil($this->getShort() / 8);
if($reliability === 2
or $reliability === 3
or $reliability === 4
or $reliability === 6
or $reliability === 7
){
$messageIndex = $this->getLTriad();
}else{
$messageIndex = false;
}
if($reliability === 1
or $reliability === 3
or $reliability === 4
or $reliability === 7
){
$orderIndex = $this->getLTriad();
$orderChannel = $this->getByte();
}else{
$orderIndex = false;
$orderChannel = false;
}
if($hasSplit == true){
$splitCount = $this->getInt();
$splitID = $this->getShort();
$splitIndex = $this->getInt();
}else{
$splitCount = false;
$splitID = false;
$splitIndex = false;
}
if($length <= 0
or $orderChannel >= 32
or ($hasSplit === true and $splitIndex >= $splitCount)
){
return false;
}else{
$pid = $this->getByte();
$buffer = $this->get($length - 1);
if(strlen($buffer) < ($length - 1)){
return false;
}
switch($pid){
case ProtocolInfo::PING_PACKET:
$data = new PingPacket();
break;
case ProtocolInfo::PONG_PACKET:
$data = new PongPacket();
break;
case ProtocolInfo::CLIENT_CONNECT_PACKET:
$data = new ClientConnectPacket();
break;
case ProtocolInfo::SERVER_HANDSHAKE_PACKET:
$data = new ServerHandshakePacket();
break;
case ProtocolInfo::DISCONNECT_PACKET:
$data = new DisconnectPacket();
break;
case ProtocolInfo::LOGIN_PACKET:
$data = new LoginPacket();
break;
case ProtocolInfo::LOGIN_STATUS_PACKET:
$data = new LoginStatusPacket();
break;
case ProtocolInfo::READY_PACKET:
$data = new ReadyPacket();
break;
case ProtocolInfo::MESSAGE_PACKET:
$data = new MessagePacket();
break;
case ProtocolInfo::SET_TIME_PACKET:
$data = new SetTimePacket();
break;
case ProtocolInfo::START_GAME_PACKET:
$data = new StartGamePacket();
break;
case ProtocolInfo::ADD_MOB_PACKET:
$data = new AddMobPacket();
break;
case ProtocolInfo::ADD_PLAYER_PACKET:
$data = new AddPlayerPacket();
break;
case ProtocolInfo::REMOVE_PLAYER_PACKET:
$data = new RemovePlayerPacket();
break;
case ProtocolInfo::ADD_ENTITY_PACKET:
$data = new AddEntityPacket();
break;
case ProtocolInfo::REMOVE_ENTITY_PACKET:
$data = new RemoveEntityPacket();
break;
case ProtocolInfo::ADD_ITEM_ENTITY_PACKET:
$data = new AddItemEntityPacket();
break;
case ProtocolInfo::TAKE_ITEM_ENTITY_PACKET:
$data = new TakeItemEntityPacket();
break;
case ProtocolInfo::MOVE_ENTITY_PACKET:
$data = new MoveEntityPacket();
break;
case ProtocolInfo::MOVE_ENTITY_PACKET_POSROT:
$data = new MoveEntityPacket_PosRot();
break;
case ProtocolInfo::ROTATE_HEAD_PACKET:
$data = new RotateHeadPacket();
break;
case ProtocolInfo::MOVE_PLAYER_PACKET:
$data = new MovePlayerPacket();
break;
case ProtocolInfo::REMOVE_BLOCK_PACKET:
$data = new RemoveBlockPacket();
break;
case ProtocolInfo::UPDATE_BLOCK_PACKET:
$data = new UpdateBlockPacket();
break;
case ProtocolInfo::ADD_PAINTING_PACKET:
$data = new AddPaintingPacket();
break;
case ProtocolInfo::EXPLODE_PACKET:
$data = new ExplodePacket();
break;
case ProtocolInfo::LEVEL_EVENT_PACKET:
$data = new LevelEventPacket();
break;
case ProtocolInfo::TILE_EVENT_PACKET:
$data = new TileEventPacket();
break;
case ProtocolInfo::ENTITY_EVENT_PACKET:
$data = new EntityEventPacket();
break;
case ProtocolInfo::REQUEST_CHUNK_PACKET:
$data = new RequestChunkPacket();
break;
case ProtocolInfo::CHUNK_DATA_PACKET:
$data = new ChunkDataPacket();
break;
case ProtocolInfo::PLAYER_EQUIPMENT_PACKET:
$data = new PlayerEquipmentPacket();
break;
case ProtocolInfo::PLAYER_ARMOR_EQUIPMENT_PACKET:
$data = new PlayerArmorEquipmentPacket();
break;
case ProtocolInfo::INTERACT_PACKET:
$data = new InteractPacket();
break;
case ProtocolInfo::USE_ITEM_PACKET:
$data = new UseItemPacket();
break;
case ProtocolInfo::PLAYER_ACTION_PACKET:
$data = new PlayerActionPacket();
break;
case ProtocolInfo::HURT_ARMOR_PACKET:
$data = new HurtArmorPacket();
break;
case ProtocolInfo::SET_ENTITY_DATA_PACKET:
$data = new SetEntityDataPacket();
break;
case ProtocolInfo::SET_ENTITY_MOTION_PACKET:
$data = new SetEntityMotionPacket();
break;
case ProtocolInfo::SET_HEALTH_PACKET:
$data = new SetHealthPacket();
break;
case ProtocolInfo::SET_SPAWN_POSITION_PACKET:
$data = new SetSpawnPositionPacket();
break;
case ProtocolInfo::ANIMATE_PACKET:
$data = new AnimatePacket();
break;
case ProtocolInfo::RESPAWN_PACKET:
$data = new RespawnPacket();
break;
case ProtocolInfo::SEND_INVENTORY_PACKET:
$data = new SendInventoryPacket();
break;
case ProtocolInfo::DROP_ITEM_PACKET:
$data = new DropItemPacket();
break;
case ProtocolInfo::CONTAINER_OPEN_PACKET:
$data = new ContainerOpenPacket();
break;
case ProtocolInfo::CONTAINER_CLOSE_PACKET:
$data = new ContainerClosePacket();
break;
case ProtocolInfo::CONTAINER_SET_SLOT_PACKET:
$data = new ContainerSetSlotPacket();
break;
case ProtocolInfo::CONTAINER_SET_DATA_PACKET:
$data = new ContainerSetDataPacket();
break;
case ProtocolInfo::CONTAINER_SET_CONTENT_PACKET:
$data = new ContainerSetContentPacket();
break;
case ProtocolInfo::CHAT_PACKET:
$data = new ChatPacket();
break;
case ProtocolInfo::ADVENTURE_SETTINGS_PACKET:
$data = new AdventureSettingsPacket();
break;
case ProtocolInfo::ENTITY_DATA_PACKET:
$data = new EntityDataPacket();
break;
default:
$data = new UnknownPacket();
$data->packetID = $pid;
break;
}
$data->reliability = $reliability;
$data->hasSplit = $hasSplit;
$data->messageIndex = $messageIndex;
$data->orderIndex = $orderIndex;
$data->orderChannel = $orderChannel;
$data->splitCount = $splitCount;
$data->splitID = $splitID;
$data->splitIndex = $splitIndex;
$data->setBuffer($buffer);
$this->data[] = $data;
}
return true;
}
public function encode(){
if(strlen($this->buffer) > 0){
return;
}
$this->buffer = chr($this->packetID);
switch($this->packetID){
case Info::OPEN_CONNECTION_REPLY_1:
$this->buffer .= Info::MAGIC;
$this->putLong($this->serverID);
$this->putByte(0); //server security
$this->putShort($this->mtuSize);
break;
case Info::OPEN_CONNECTION_REPLY_2:
$this->buffer .= Info::MAGIC;
$this->putLong($this->serverID);
$this->putShort($this->serverPort);
$this->putShort($this->mtuSize);
$this->putByte(0); //Server security
break;
case Info::INCOMPATIBLE_PROTOCOL_VERSION:
$this->putByte(Info::STRUCTURE);
$this->buffer .= Info::MAGIC;
$this->putLong($this->serverID);
break;
case Info::UNCONNECTED_PONG:
case Info::ADVERTISE_SYSTEM:
$this->putLong($this->pingID);
$this->putLong($this->serverID);
$this->buffer .= Info::MAGIC;
$this->putString($this->serverType);
break;
case Info::DATA_PACKET_0:
case Info::DATA_PACKET_1:
case Info::DATA_PACKET_2:
case Info::DATA_PACKET_3:
case Info::DATA_PACKET_4:
case Info::DATA_PACKET_5:
case Info::DATA_PACKET_6:
case Info::DATA_PACKET_7:
case Info::DATA_PACKET_8:
case Info::DATA_PACKET_9:
case Info::DATA_PACKET_A:
case Info::DATA_PACKET_B:
case Info::DATA_PACKET_C:
case Info::DATA_PACKET_D:
case Info::DATA_PACKET_E:
case Info::DATA_PACKET_F:
$this->putLTriad($this->seqNumber);
foreach($this->data as $pk){
$this->encodeDataPacket($pk);
}
break;
case Info::NACK:
case Info::ACK:
$payload = "";
$records = 0;
$pointer = 0;
sort($this->packets, SORT_NUMERIC);
$max = count($this->packets);
while($pointer < $max){
$type = true;
$curr = $start = $this->packets[$pointer];
for($i = $start + 1; $i < $max; ++$i){
$n = $this->packets[$i];
if(($n - $curr) === 1){
$curr = $end = $n;
$type = false;
$pointer = $i + 1;
}else{
break;
}
}
++$pointer;
if($type === false){
$payload .= "\x00";
$payload .= strrev(Utils::writeTriad($start));
$payload .= strrev(Utils::writeTriad($end));
}else{
$payload .= Utils::writeBool(true);
$payload .= strrev(Utils::writeTriad($start));
}
++$records;
}
$this->putShort($records);
$this->buffer .= $payload;
break;
default:
}
}
private function encodeDataPacket(DataPacket $pk){
$this->putByte(($pk->reliability << 5) | ($pk->hasSplit > 0 ? 0b00010000 : 0));
$this->putShort(strlen($pk->buffer) << 3);
if($pk->reliability === 2
or $pk->reliability === 3
or $pk->reliability === 4
or $pk->reliability === 6
or $pk->reliability === 7
){
$this->putLTriad($pk->messageIndex);
}
if($pk->reliability === 1
or $pk->reliability === 3
or $pk->reliability === 4
or $pk->reliability === 7
){
$this->putLTriad($pk->orderIndex);
$this->putByte($pk->orderChannel);
}
if($pk->hasSplit === true){
$this->putInt($pk->splitCount);
$this->putShort($pk->splitID);
$this->putInt($pk->splitIndex);
}
$this->buffer .= $pk->buffer;
}
protected function put($str){
$this->buffer .= $str;
}
protected function putLong($v){
$this->buffer .= Utils::writeLong($v);
}
protected function putInt($v){
$this->buffer .= Utils::writeInt($v);
}
protected function putShort($v){
$this->buffer .= Utils::writeShort($v);
}
protected function putTriad($v){
$this->buffer .= Utils::writeTriad($v);
}
protected function putLTriad($v){
$this->buffer .= strrev(Utils::writeTriad($v));
}
protected function putByte($v){
$this->buffer .= chr($v);
}
protected function putString($v){
$this->putShort(strlen($v));
$this->put($v);
}
public function __destruct(){
}
}

View File

@ -1,147 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\plugin;
use pocketmine\event\plugin\PluginDisableEvent;
use pocketmine\event\plugin\PluginEnableEvent;
use pocketmine\Server;
/**
* Handles different types of plugins
*/
class FolderPluginLoader implements PluginLoader{
/** @var Server */
private $server;
/**
* @param Server $server
*/
public function __construct(Server $server){
$this->server = $server;
}
/**
* Loads the plugin contained in $file
*
* @param string $file
*
* @return Plugin
*/
public function loadPlugin($file){
if(is_dir($file) and file_exists($file . "/plugin.yml") and file_exists($file . "/src/")){
if(($description = $this->getPluginDescription($file)) instanceof PluginDescription){
console("[INFO] Loading " . $description->getFullName());
console("[WARNING] Non-packaged plugin ".$description->getName() ." detected, do not use on production.");
$dataFolder = dirname($file) . DIRECTORY_SEPARATOR . $description->getName();
if(file_exists($dataFolder) and !is_dir($dataFolder)){
trigger_error("Projected dataFolder '" . $dataFolder . "' for " . $description->getName() . " exists and is not a directory", E_USER_WARNING);
return null;
}
$className = $description->getMain();
$this->server->getLoader()->add(substr($className, 0, strpos($className, "\\")), array(
$file . "/src"
));
if(class_exists($className, true)){
$plugin = new $className();
$this->initPlugin($plugin, $description, $dataFolder, $file);
return $plugin;
}else{
trigger_error("Couldn't load plugin " . $description->getName() . ": main class not found", E_USER_WARNING);
return null;
}
}
}
return null;
}
/**
* Gets the PluginDescription from the file
*
* @param string $file
*
* @return PluginDescription
*/
public function getPluginDescription($file){
if(is_dir($file) and file_exists($file . "/plugin.yml")){
$yaml = @file_get_contents($file . "/plugin.yml");
if($yaml != ""){
return new PluginDescription($yaml);
}
}
return null;
}
/**
* Returns the filename patterns that this loader accepts
*
* @return array
*/
public function getPluginFilters(){
return "/[^\\.]/";
}
/**
* @param PluginBase $plugin
* @param PluginDescription $description
* @param string $dataFolder
* @param string $file
*/
private function initPlugin(PluginBase $plugin, PluginDescription $description, $dataFolder, $file){
$plugin->init($this, $this->server, $description, $dataFolder, $file);
$plugin->onLoad();
}
/**
* @param Plugin $plugin
*/
public function enablePlugin(Plugin $plugin){
if($plugin instanceof PluginBase and !$plugin->isEnabled()){
console("[INFO] Enabling " . $plugin->getDescription()->getFullName());
$plugin->setEnabled(true);
Server::getInstance()->getPluginManager()->callEvent(new PluginEnableEvent($plugin));
}
}
/**
* @param Plugin $plugin
*/
public function disablePlugin(Plugin $plugin){
if($plugin instanceof PluginBase and $plugin->isEnabled()){
console("[INFO] Disabling " . $plugin->getDescription()->getFullName());
Server::getInstance()->getPluginManager()->callEvent(new PluginDisableEvent($plugin));
$plugin->setEnabled(false);
}
}
}

View File

@ -1,334 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
/**
* Crafting / Smelting / Fuel data and fast search databases
*/
namespace pocketmine\recipes;
use pocketmine\item\Item;
abstract class Crafting{
private static $lookupTable = array();
private static $small = array( //Probably means craftable on crafting bench and in inventory. Name it better!
//Building
"CLAY:?x4=>CLAY_BLOCK:0x1",
"WOODEN_PLANKS:?x4=>WORKBENCH:0x1",
"GLOWSTONE_DUST:?x4=>GLOWSTONE_BLOCK:0x1",
"PUMPKIN:?x1,TORCH:?x1=>LIT_PUMPKIN:0x1",
"SNOWBALL:?x4=>SNOW_BLOCK:0x1",
"WOODEN_PLANKS:?x2=>STICK:0x4",
"COBBLESTONE:?x4=>STONECUTTER:0x1",
"WOOD:0x1=>WOODEN_PLANKS:0x4",
"WOOD:1x1=>WOODEN_PLANKS:1x4",
"WOOD:2x1=>WOODEN_PLANKS:2x4",
"WOOD:3x1=>WOODEN_PLANKS:3x4",
"WOOL:0x1,DYE:0x1=>WOOL:15x1",
"WOOL:0x1,DYE:1x1=>WOOL:14x1",
"WOOL:0x1,DYE:2x1=>WOOL:13x1",
"WOOL:0x1,DYE:3x1=>WOOL:12x1",
"WOOL:0x1,DYE:4x1=>WOOL:11x1",
"WOOL:0x1,DYE:5x1=>WOOL:10x1",
"WOOL:0x1,DYE:6x1=>WOOL:9x1",
"WOOL:0x1,DYE:7x1=>WOOL:8x1",
"WOOL:0x1,DYE:8x1=>WOOL:7x1",
"WOOL:0x1,DYE:9x1=>WOOL:6x1",
"WOOL:0x1,DYE:10x1=>WOOL:5x1",
"WOOL:0x1,DYE:11x1=>WOOL:4x1",
"WOOL:0x1,DYE:12x1=>WOOL:3x1",
"WOOL:0x1,DYE:13x1=>WOOL:2x1",
"WOOL:0x1,DYE:14x1=>WOOL:1x1",
"STRING:?x4=>WOOL:0x1",
//Tools
"IRON_INGOT:?x1,FLINT:?x1=>FLINT_STEEL:0x1",
"IRON_INGOT:?x2=>SHEARS:0x1",
"COAL:0x1,STICK:?x1=>TORCH:0x4",
"COAL:1x1,STICK:?x1=>TORCH:0x4",
//Food & protection
"MELON_SLICE:?x1=>MELON_SEEDS:0x1",
"PUMPKIN:?x1=>PUMPKIN_SEEDS:0x4",
"PUMPKIN:?x1,EGG:?x1,SUGAR:?x1=>PUMPKIN_PIE:0x1",
"BROWN_MUSHROOM:?x1,RED_MUSHROOM:?x1,BOWL:?x1=>MUSHROOM_STEW:0x1",
"SUGARCANE:?x1=>SUGAR:0x1",
"MELON_SLICE:?x1=>MELON_SEEDS:0x1",
"HAY_BALE:?x1=>WHEAT:0x9",
//Items
"DIAMOND_BLOCK:?x1=>DIAMOND:0x9",
"GOLD_BLOCK:?x1=>GOLD_INGOT:0x9",
"IRON_BLOCK:?x1=>IRON_INGOT:0x9",
"LAPIS_BLOCK:?x1=>DYE:4x9",
"DANDELION:?x1=>DYE:11x2",
"BONE:?x1=>DYE:15x3",
"DYE:0x1,DYE:14x1=>DYE:3x2",
"DYE:0x1,DYE:1x1,DYE:11x1=>DYE:3x3",
"DYE:1x1,DYE:15x1=>DYE:9x2",
"DYE:1x1,DYE:11x1=>DYE:14x2",
"DYE:2x1,DYE:15x1=>DYE:10x2",
"DYE:4x1,DYE:15x1=>DYE:12x2",
"DYE:2x1,DYE:4x1=>DYE:6x2",
"DYE:1x1,DYE:4x1=>DYE:5x2",
"DYE:1x1,DYE:4x1,DYE:15x1=>DYE:13x3",
"BEETROOT:?x1=>DYE:1x1",
"DYE:15x1,DYE:1x2,DYE:4x1=>DYE:13x4", //
"DYE:5x1,DYE:9x1=>DYE:13x2", //
"DYE:0x1,DYE:15x1=>DYE:8x2", //
"DYE:0x1,DYE:15x2=>DYE:7x3", //
"DYE:0x1,DYE:8x1=>DYE:7x2", //
);
private static $big = array( //Probably means only craftable on crafting bench. Name it better!
//Building
"WOOL:?x3,WOODEN_PLANKS:?x3=>BED:0x1",
"WOODEN_PLANKS:?x8=>CHEST:0x1",
"STICK:?x6=>FENCE:0x2",
"STICK:?x4,WOODEN_PLANKS:?x2=>FENCE_GATE:0x1",
"COBBLESTONE:?x8=>FURNACE:0x1",
"GLASS:?x6=>GLASS_PANE:0x16",
"STICK:?x7=>LADDER:0x2",
"DIAMOND:?x3,IRON_INGOT:?x6=>NETHER_REACTOR:0x1",
"WOODEN_PLANKS:?x6=>TRAPDOOR:0x2",
"WOODEN_PLANKS:?x6=>WOODEN_DOOR:0x1",
"WOODEN_PLANKS:0x6=>WOODEN_STAIRS:0x4",
"WOODEN_PLANKS:0x3=>WOOD_SLAB:0x6",
"WOODEN_PLANKS:1x6=>SPRUCE_WOOD_STAIRS:0x4",
"WOODEN_PLANKS:1x3=>WOOD_SLAB:1x6",
"WOODEN_PLANKS:2x6=>BIRCH_WOOD_STAIRS:0x4",
"WOODEN_PLANKS:2x3=>BIRCH_WOOD_SLAB:2x6",
"WOODEN_PLANKS:3x6=>JUNGLE_WOOD_STAIRS:0x4",
"WOODEN_PLANKS:3x3=>JUNGLE_WOOD_SLAB:3x6",
//Tools
"STICK:?x1,FEATHER:?x1,FLINT:?x1=>ARROW:0x4",
"STICK:?x3,STRING:?x3=>BOW:0x1",
"IRON_INGOT:?x3=>BUCKET:0x1",
"GOLD_INGOT:?x4,REDSTONE_DUST:?x1=>CLOCK:0x1",
"IRON_INGOT:?x4,REDSTONE_DUST:?x1=>COMPASS:0x1",
"DIAMOND:?x3,STICK:?x2=>DIAMOND_AXE:0x1",
"DIAMOND:?x2,STICK:?x2=>DIAMOND_HOE:0x1",
"DIAMOND:?x3,STICK:?x2=>DIAMOND_PICKAXE:0x1",
"DIAMOND:?x1,STICK:?x2=>DIAMOND_SHOVEL:0x1",
"DIAMOND:?x2,STICK:?x1=>DIAMOND_SWORD:0x1",
"GOLD_INGOT:?x3,STICK:?x2=>GOLD_AXE:0x1",
"GOLD_INGOT:?x2,STICK:?x2=>GOLD_HOE:0x1",
"GOLD_INGOT:?x3,STICK:?x2=>GOLD_PICKAXE:0x1",
"GOLD_INGOT:?x1,STICK:?x2=>GOLD_SHOVEL:0x1",
"GOLD_INGOT:?x2,STICK:?x1=>GOLD_SWORD:0x1",
"IRON_INGOT:?x3,STICK:?x2=>IRON_AXE:0x1",
"IRON_INGOT:?x2,STICK:?x2=>IRON_HOE:0x1",
"IRON_INGOT:?x3,STICK:?x2=>IRON_PICKAXE:0x1",
"IRON_INGOT:?x1,STICK:?x2=>IRON_SHOVEL:0x1",
"IRON_INGOT:?x2,STICK:?x1=>IRON_SWORD:0x1",
"COBBLESTONE:?x3,STICK:?x2=>STONE_AXE:0x1",
"COBBLESTONE:?x2,STICK:?x2=>STONE_HOE:0x1",
"COBBLESTONE:?x3,STICK:?x2=>STONE_PICKAXE:0x1",
"COBBLESTONE:?x1,STICK:?x2=>STONE_SHOVEL:0x1",
"COBBLESTONE:?x2,STICK:?x1=>STONE_SWORD:0x1",
"SAND:?x4,GUNPOWDER:?x5=>TNT:0x1",
"WOODEN_PLANKS:?x3,STICK:?x2=>WOODEN_AXE:0x1",
"WOODEN_PLANKS:?x2,STICK:?x2=>WOODEN_HOE:0x1",
"WOODEN_PLANKS:?x3,STICK:?x2=>WOODEN_PICKAXE:0x1",
"WOODEN_PLANKS:?x1,STICK:?x2=>WOODEN_SHOVEL:0x1",
"WOODEN_PLANKS:?x2,STICK:?x1=>WOODEN_SWORD:0x1",
//Food & protection
"BEETROOT:?x4,BOWL:?x1=>BEETROOT_SOUP:0x1",
"WOODEN_PLANKS:?x3=>BOWL:0x1",
"WHEAT:?x3=>BREAD:0x1",
"WHEAT:?x3,BUCKET:1x3,EGG:?x1,SUGAR:?x2=>CAKE:0x1",
"DIAMOND:?x4=>DIAMOND_BOOTS:0x1",
"DIAMOND:?x8=>DIAMOND_CHESTPLATE:0x1",
"DIAMOND:?x5=>DIAMOND_HELMET:0x1",
"DIAMOND:?x7=>DIAMOND_LEGGINGS:0x1",
"GOLD_INGOT:?x4=>GOLD_BOOTS:0x1",
"GOLD_INGOT:?x8=>GOLD_CHESTPLATE:0x1",
"GOLD_INGOT:?x5=>GOLD_HELMET:0x1",
"GOLD_INGOT:?x7=>GOLD_LEGGINGS:0x1",
"IRON_INGOT:?x4=>IRON_BOOTS:0x1",
"IRON_INGOT:?x8=>IRON_CHESTPLATE:0x1",
"IRON_INGOT:?x5=>IRON_HELMET:0x1",
"IRON_INGOT:?x7=>IRON_LEGGINGS:0x1",
"LEATHER:?x4=>LEATHER_BOOTS:0x1",
"LEATHER:?x8=>LEATHER_TUNIC:0x1",
"LEATHER:?x5=>LEATHER_CAP:0x1",
"LEATHER:?x7=>LEATHER_PANTS:0x1",
"FIRE:?x4=>CHAIN_BOOTS:0x1",
"FIRE:?x8=>CHAIN_CHESTPLATE:0x1",
"FIRE:?x5=>CHAIN_HELMET:0x1",
"FIRE:?x7=>CHAIN_LEGGINGS:0x1",
//Items
"DIAMOND:?x9=>DIAMOND_BLOCK:0x1",
"GOLD_INGOT:?x9=>GOLD_BLOCK:0x1",
"IRON_INGOT:?x9=>IRON_BLOCK:0x1",
"IRON_INGOT:?x5=>MINECART:0x1",
"WHEAT:?x9=>HAY_BALE:0x1",
"PAPER:?x3=>BOOK:0x1",
"WOODEN_PLANKS:?x6,BOOK:?x3=>BOOKSHELF:0x1",
"DYE:4x9=>LAPIS_BLOCK:0x1",
"WOOL:?x1,STICK:?x8=>PAINTING:0x1",
"SUGARCANE:?x3=>PAPER:0x1",
"WOODEN_PLANKS:?x6,STICK:?x1=>SIGN:0x1",
"IRON_INGOT:?x6=>IRON_BARS:0x16",
"COAL:0x9=>COAL_BLOCK:0x1",
"COAL_BLOCK:?x1=>COAL:0x9",
);
private static $stone = array(
"QUARTZ:?x4=>QUARTZ_BLOCK:0x1",
"BRICKS_BLOCK:?x6=>BRICK_STAIRS:0x4",
"BRICK:?x4=>BRICKS_BLOCK:0x1",
"BRICKS_BLOCK:?x3=>SLAB:4x6",
"SLAB:6x2=>QUARTZ_BLOCK:1x1",
"COBBLESTONE:?x3=>SLAB:3x6",
"COBBLESTONE:0x6=>STONE_WALL:0x6",
"MOSSY_STONE:0x6=>STONE_WALL:1x6",
"NETHER_BRICK:?x4=>NETHER_BRICKS:0x1",
"NETHER_BRICKS:?x6=>NETHER_BRICKS_STAIRS:0x4",
"QUARTZ_BLOCK:0x2=>QUARTZ_BLOCK:2x2",
"QUARTZ_BLOCK:?x3=>SLAB:6x6",
"SANDSTONE:0x6=>SANDSTONE_STAIRS:0x4",
"SAND:?x4=>SANDSTONE:0x1",
"SANDSTONE:0x4=>SANDSTONE:2x4",
"SLAB:1x2=>SANDSTONE:1x1",
"SANDSTONE:0x3=>SLAB:1x6",
"STONE_BRICK:?x6=>STONE_BRICK_STAIRS:0x4",
"STONE:?x4=>STONE_BRICK:0x4",
"STONE_BRICKS:?x3=>SLAB:5x6",
"STONE:?x3=>SLAB:0x6",
"COBBLESTONE:?x6=>COBBLESTONE_STAIRS:0x4",
);
private static $recipes = array();
private static function parseRecipe($recipe){
$recipe = explode("=>", $recipe);
$recipeItems = array();
foreach(explode(",", $recipe[0]) as $item){
$item = explode("x", $item);
$id = explode(":", $item[0]);
$meta = array_pop($id);
$id = $id[0];
$it = Item::fromString($id);
$recipeItems[$it->getID()] = array($it->getID(), $meta === "?" ? false : intval($meta) & 0xFFFF, intval($item[1]));
}
ksort($recipeItems);
$item = explode("x", $recipe[1]);
$id = explode(":", $item[0]);
$meta = array_pop($id);
$id = $id[0];
$it = Item::fromString($id);
$craftItem = array($it->getID(), intval($meta) & 0xFFFF, intval($item[1]));
$recipeString = "";
foreach($recipeItems as $item){
$recipeString .= $item[0] . "x" . $item[2] . ",";
}
$recipeString = substr($recipeString, 0, -1) . "=>" . $craftItem[0] . "x" . $craftItem[2];
return array($recipeItems, $craftItem, $recipeString);
}
public static function init(){
$id = 1;
self::$lookupTable[0] = array();
foreach(self::$small as $recipe){
$recipe = self::parseRecipe($recipe);
self::$recipes[$id] = $recipe;
if(!isset(self::$lookupTable[0][$recipe[2]])){
self::$lookupTable[0][$recipe[2]] = array();
}
self::$lookupTable[0][$recipe[2]][] = $id;
++$id;
}
self::$lookupTable[1] = array();
foreach(self::$big as $recipe){
$recipe = self::parseRecipe($recipe);
self::$recipes[$id] = $recipe;
if(!isset(self::$lookupTable[1][$recipe[2]])){
self::$lookupTable[1][$recipe[2]] = array();
}
self::$lookupTable[1][$recipe[2]][] = $id;
++$id;
}
self::$lookupTable[2] = array();
foreach(self::$stone as $recipe){
$recipe = self::parseRecipe($recipe);
self::$recipes[$id] = $recipe;
if(!isset(self::$lookupTable[2][$recipe[2]])){
self::$lookupTable[2][$recipe[2]] = array();
}
self::$lookupTable[2][$recipe[2]][] = $id;
++$id;
}
}
public static function canCraft(array $craftItem, array $recipeItems, $type){
ksort($recipeItems);
$recipeString = "";
foreach($recipeItems as $item){
$recipeString .= $item[0] . "x" . $item[2] . ",";
}
$recipeString = substr($recipeString, 0, -1) . "=>" . $craftItem[0] . "x" . $craftItem[2];
$continue = true;
if(isset(self::$lookupTable[$type][$recipeString])){
foreach(self::$lookupTable[$type][$recipeString] as $id){
$continue = true;
$recipe = self::$recipes[$id];
foreach($recipe[0] as $item){
if(!isset($recipeItems[$item[0]])){
$continue = false;
break;
}
$oitem = $recipeItems[$item[0]];
if(($oitem[1] !== $item[1] and $item[1] !== false) or $oitem[2] !== $item[2]){
$continue = false;
break;
}
}
if($continue === false or $craftItem[0] !== $recipe[1][0] or $recipe[1][1] !== $recipe[1][1] or $recipe[1][2] !== $recipe[1][2]){
$continue = false;
continue;
}
$continue = $recipe;
break;
}
}else{
return true;
}
return $continue;
}
}

View File

@ -1,44 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\recipes;
use pocketmine\item\Item;
class Smelt{
public static $product = array(
Item::COBBLESTONE => array(Item::STONE, 0),
Item::SAND => array(Item::GLASS, 0),
Item::TRUNK => array(Item::COAL, 1), //Charcoal
Item::GOLD_ORE => array(Item::GOLD_INGOT, 0),
Item::IRON_ORE => array(Item::IRON_INGOT, 0),
Item::NETHERRACK => array(Item::NETHER_BRICK, 0),
Item::RAW_PORKCHOP => array(Item::COOKED_PORKCHOP, 0),
Item::CLAY => array(Item::BRICK, 0),
//Item::RAW_FISH => array(Item::COOKED_FISH, 0),
Item::CACTUS => array(Item::DYE, 2),
Item::RED_MUSHROOM => array(Item::DYE, 1),
Item::RAW_BEEF => array(Item::STEAK, 0),
Item::RAW_CHICKEN => array(Item::COOKED_CHICKEN, 0),
Item::RED_MUSHROOM => array(Item::DYE, 1),
Item::POTATO => array(Item::BAKED_POTATO, 0),
);
}

View File

@ -1,79 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\scheduler;
class TickScheduler extends \Thread{
protected $sleepTime;
protected $ticksPerSecond;
protected $tickMeasure;
public $hasTick;
public function __construct($ticksPerSecond = 20){
$this->ticksPerSecond = (int) $ticksPerSecond;
$this->sleepTime = (int) (1000000 / $this->ticksPerSecond);
$this->tickMeasure = $this->sleepTime;
$this->start(PTHREADS_INHERIT_ALL & ~PTHREADS_INHERIT_CLASSES);
}
/**
* Returns true if clear to run tick
*
* @return bool
*/
public function hasTick(){
return $this->synchronized(function (){
$hasTick = $this->hasTick;
$this->hasTick = false;
return $hasTick === true;
});
}
public function doTick(){
$this->notify();
}
/**
* @return float
*/
public function getTPS(){
return $this->synchronized(function (){
return round(($this->sleepTime / $this->tickMeasure) * $this->ticksPerSecond, 2);
});
}
public function run(){
$tickTime = microtime(true);
$this->hasTick = true;
while(true){
$this->synchronized(function (){
$this->hasTick = true;
$this->wait();
$this->hasTick = false;
});
$this->tickMeasure = (int) ((($time = microtime(true)) - $tickTime) * 1000000);
$tickTime = $time;
usleep($this->sleepTime - 100); //Remove a few ms for processing
}
}
}

View File

@ -1,129 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\tile;
use pocketmine\level\Level;
use pocketmine\math\Vector3 as Vector3;
use pocketmine\nbt\NBT;
use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Int;
use pocketmine\nbt\tag\String;
use pocketmine\network\protocol\EntityDataPacket;
use pocketmine\Player;
class Chest extends Spawnable{
use Container;
const SLOTS = 27;
public function __construct(Level $level, Compound $nbt){
$nbt["id"] = Tile::CHEST;
parent::__construct($level, $nbt);
}
public function isPaired(){
if(!isset($this->namedtag->pairx) or !isset($this->namedtag->pairz)){
return false;
}
return true;
}
public function getPair(){
if($this->isPaired()){
return $this->level->getTile(new Vector3((int) $this->namedtag->pairx, $this->y, (int) $this->namedtag->pairz));
}
return false;
}
public function pairWith(Tile $tile){
if($this->isPaired() or $tile->isPaired()){
return false;
}
$this->namedtag->pairx = $tile->x;
$this->namedtag->pairz = $tile->z;
$tile->namedtag->pairx = $this->x;
$tile->namedtag->pairz = $this->z;
$this->spawnToAll();
$tile->spawnToAll();
$this->server->handle("tile.update", $this);
$this->server->handle("tile.update", $tile);
return true;
}
public function unpair(){
if(!$this->isPaired()){
return false;
}
$tile = $this->getPair();
unset($this->namedtag->pairx, $this->namedtag->pairz, $tile->namedtag->pairx, $tile->namedtag->pairz);
$this->spawnToAll();
$this->server->handle("tile.update", $this);
if($tile instanceof Chest){
$tile->spawnToAll();
$this->server->handle("tile.update", $tile);
}
return true;
}
public function spawnTo(Player $player){
if($this->closed){
return false;
}
$nbt = new NBT(NBT::LITTLE_ENDIAN);
if($this->isPaired()){
$nbt->setData(new Compound("", array(
new String("id", Tile::CHEST),
new Int("x", (int) $this->x),
new Int("y", (int) $this->y),
new Int("z", (int) $this->z),
new Int("pairx", (int) $this->namedtag->pairx),
new Int("pairz", (int) $this->namedtag->pairz)
)));
}else{
$nbt->setData(new Compound("", array(
new String("id", Tile::CHEST),
new Int("x", (int) $this->x),
new Int("y", (int) $this->y),
new Int("z", (int) $this->z)
)));
}
$pk = new EntityDataPacket;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->namedtag = $nbt->write();
$player->dataPacket($pk);
return true;
}
}

View File

@ -1,195 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\tile;
use pocketmine\event\tile\TileInventoryChangeEvent;
use pocketmine\item\Item;
use pocketmine\nbt\tag\Byte;
use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Short;
use pocketmine\Network;
use pocketmine\network\protocol\ContainerOpenPacket;
use pocketmine\network\protocol\ContainerSetContentPacket;
use pocketmine\network\protocol\TileEventPacket;
use pocketmine\Player;
use pocketmine\Server;
trait Container{
public function openInventory(Player $player){
if($this instanceof Chest){
$player->windowCnt++;
$player->windowCnt = $id = max(2, $player->windowCnt % 99);
if(($pair = $this->getPair()) !== false){
if(($pair->x + ($pair->z << 13)) > ($this->x + ($this->z << 13))){ //Order them correctly
$player->windows[$id] = array(
$pair,
$this
);
}else{
$player->windows[$id] = array(
$this,
$pair
);
}
}else{
$player->windows[$id] = $this;
}
$pk = new ContainerOpenPacket();
$pk->windowid = $id;
$pk->type = 0;
$pk->slots = is_array($player->windows[$id]) ? Chest::SLOTS << 1 : Chest::SLOTS;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$player->dataPacket($pk);
$slots = array();
if(is_array($player->windows[$id])){
$all = $this->level->getPlayers();
foreach($player->windows[$id] as $ob){
$pk = new TileEventPacket();
$pk->x = $ob->x;
$pk->y = $ob->y;
$pk->z = $ob->z;
$pk->case1 = 1;
$pk->case2 = 2;
Player::broadcastPacket($all, $pk);
for($s = 0; $s < Chest::SLOTS; ++$s){
$slot = $ob->getSlot($s);
if($slot->getID() > Item::AIR and $slot->getCount() > 0){
$slots[] = $slot;
}else{
$slots[] = Item::get(Item::AIR, 0, 0);
}
}
}
}else{
$pk = new TileEventPacket();
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->case1 = 1;
$pk->case2 = 2;
Player::broadcastPacket($this->level->getPlayers(), $pk);
for($s = 0; $s < Chest::SLOTS; ++$s){
$slot = $this->getSlot($s);
if($slot->getID() > Item::AIR and $slot->getCount() > 0){
$slots[] = $slot;
}else{
$slots[] = Item::get(Item::AIR, 0, 0);
}
}
}
$pk = new ContainerSetContentPacket();
$pk->windowid = $id;
$pk->slots = $slots;
$player->dataPacket($pk);
return true;
}elseif($this instanceof Furnace){
$player->windowCnt++;
$player->windowCnt = $id = max(2, $player->windowCnt % 99);
$player->windows[$id] = $this;
$pk = new ContainerOpenPacket();
$pk->windowid = $id;
$pk->type = 2;
$pk->slots = Furnace::SLOTS;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$player->dataPacket($pk);
$slots = array();
for($s = 0; $s < Furnace::SLOTS; ++$s){
$slot = $this->getSlot($s);
if($slot->getID() > Item::AIR and $slot->getCount() > 0){
$slots[] = $slot;
}else{
$slots[] = Item::get(Item::AIR, 0, 0);
}
}
$pk = new ContainerSetContentPacket();
$pk->windowid = $id;
$pk->slots = $slots;
$player->dataPacket($pk);
return true;
}
}
public function getSlotIndex($s){
foreach($this->namedtag->Items as $i => $slot){
if($slot["Slot"] === $s){
return $i;
}
}
return -1;
}
public function getSlot($s){
$i = $this->getSlotIndex($s);
if($i === false or $i < 0){
return Item::get(Item::AIR, 0, 0);
}else{
return Item::get($this->namedtag->Items[$i]["id"], $this->namedtag->Items[$i]["Damage"], $this->namedtag->Items[$i]["Count"]);
}
}
public function setSlot($s, Item $item, $update = true, $offset = 0){
$i = $this->getSlotIndex($s);
if($i === false){
return false;
}
Server::getInstance()->getPluginManager()->callEvent($ev = new TileInventoryChangeEvent($this, $this->getSlot($s), $item, $s, $offset));
if($ev->isCancelled()){
return false;
}
$item = $ev->getNewItem();
$d = new Compound(false, array(
new Byte("Count", $item->getCount()),
new Byte("Slot", $s),
new Short("id", $item->getID()),
new Short("Damage", $item->getMetadata()),
));
if($item->getID() === Item::AIR or $item->getCount() <= 0){
if($i >= 0){
unset($this->namedtag->Items[$i]);
}
}elseif($i < 0){
$this->namedtag->Items[] = $d;
}else{
$this->namedtag->Items[$i] = $d;
}
if($update === true){
$this->scheduleUpdate();
}
return true;
}
}

View File

@ -1,118 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\tile;
use pocketmine\block\Block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\nbt\tag\Compound;
class Furnace extends Tile{
use Container;
const SLOTS = 3;
public function __construct(Level $level, Compound $nbt){
$nbt["id"] = Tile::FURNACE;
parent::__construct($level, $nbt);
if(!isset($this->namedtag->BurnTime) or $this->namedtag->BurnTime < 0){
$this->namedtag->BurnTime = 0;
}
if(!isset($this->namedtag->CookTime) or $this->namedtag->CookTime < 0 or ($this->namedtag->BurnTime === 0 and $this->namedtag->CookTime > 0)){
$this->namedtag->CookTime = 0;
}
if(!isset($this->namedtag->MaxTime)){
$this->namedtag->MaxTime = $this->namedtag->BurnTime;
$this->namedtag->BurnTicks = 0;
}
if($this->namedtag->BurnTime > 0){
$this->scheduleUpdate();
}
}
public function onUpdate(){
if($this->closed === true){
return false;
}
$ret = false;
$fuel = $this->getSlot(1);
$raw = $this->getSlot(0);
$product = $this->getSlot(2);
$smelt = $raw->getSmeltItem();
$canSmelt = ($smelt !== false and $raw->getCount() > 0 and (($product->getID() === $smelt->getID() and $product->getMetadata() === $smelt->getMetadata() and $product->getCount() < $product->getMaxStackSize()) or $product->getID() === Item::AIR));
if($this->namedtag->BurnTime <= 0 and $canSmelt and $fuel->getFuelTime() !== false and $fuel->getCount() > 0){
$this->lastUpdate = microtime(true);
$this->namedtag->MaxTime = $this->namedtag->BurnTime = floor($fuel->getFuelTime() * 20);
$this->namedtag->BurnTicks = 0;
$fuel->setCount($fuel->getCount() - 1);
if($fuel->getCount() === 0){
$fuel = Item::get(Item::AIR, 0, 0);
}
$this->setSlot(1, $fuel, false);
$current = $this->level->getBlock($this);
if($current->getID() === Item::FURNACE){
$this->level->setBlock($this, Block::get(Item::BURNING_FURNACE, $current->getMetadata()), true, false, true);
}
}
if($this->namedtag->BurnTime > 0){
$ticks = (microtime(true) - $this->lastUpdate) * 20;
$this->namedtag->BurnTime -= $ticks;
$this->namedtag->BurnTicks = ceil(($this->namedtag->BurnTime / $this->namedtag->MaxTime) * 200);
if($smelt !== false and $canSmelt){
$this->namedtag->CookTime += $ticks;
if($this->namedtag->CookTime >= 200){ //10 seconds
$product = Item::get($smelt->getID(), $smelt->getMetadata(), $product->getCount() + 1);
$this->setSlot(2, $product, false);
$raw->setCount($raw->getCount() - 1);
if($raw->getCount() === 0){
$raw = Item::get(Item::AIR, 0, 0);
}
$this->setSlot(0, $raw, false);
$this->namedtag->CookTime -= 200;
}
}elseif($this->namedtag->BurnTime <= 0){
$this->namedtag->BurnTime = 0;
$this->namedtag->CookTime = 0;
$this->namedtag->BurnTicks = 0;
}else{
$this->namedtag->CookTime = 0;
}
$ret = true;
}else{
$current = $this->level->getBlock($this);
if($current->getID() === Item::BURNING_FURNACE){
$this->level->setBlock($this, Block::get(Item::FURNACE, $current->getMetadata()), true, false, true);
}
$this->namedtag->CookTime = 0;
$this->namedtag->BurnTime = 0;
$this->namedtag->BurnTicks = 0;
}
$this->server->handle("tile.update", $this);
$this->lastUpdate = microtime(true);
return $ret;
}
}

View File

@ -1,64 +0,0 @@
<?php
/**
* SplAutoloader defines the contract that any OO based autoloader must follow.
*
* @author Guilherme Blanco <guilhermeblanco@php.net>
*/
interface SplAutoloader{
/**
* Defines autoloader to work silently if resource is not found.
*
* @const
*/
const MODE_SILENT = 0;
/**
* Defines autoloader to work normally (requiring an un-existent resource).
*
* @const
*/
const MODE_NORMAL = 1;
/**
* Defines autoloader to work in debug mode, loading file and validating requested resource.
*
* @const
*/
const MODE_DEBUG = 2;
/**
* Define the autoloader work mode.
*
* @param integer $mode Autoloader work mode.
*/
public function setMode($mode);
/**
* Add a new resource lookup path.
*
* @param string $resourceName Resource name, namespace or prefix.
* @param mixed $resourcePath Resource single path or multiple paths (array).
*/
public function add($resourceName, $resourcePath = null);
/**
* Load a resource through provided resource name.
*
* @param string $resourceName Resource name.
*/
public function load($resourceName);
/**
* Register this as an autoloader instance.
*
* @param boolean $prepend Whether to prepend the autoloader or not in autoloader's list.
*/
public function register($prepend = false);
/**
* Unregister this autoloader instance.
*
*/
public function unregister();
}

View File

@ -1,218 +0,0 @@
<?php
require_once("SplAutoloader.php");
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
*
* Example usage:
*
* $classLoader = new \SplClassLoader();
*
* // Configure the SplClassLoader to act normally or silently
* $classLoader->setMode(\SplClassLoader::MODE_NORMAL);
*
* // Add a namespace of classes
* $classLoader->add('Doctrine', array(
* '/path/to/doctrine-common', '/path/to/doctrine-dbal', '/path/to/doctrine-orm'
* ));
*
* // Add a prefix
* $classLoader->add('Swift', '/path/to/swift');
*
* // Add a prefix through PEAR1 convention, requiring include_path lookup
* $classLoader->add('PEAR');
*
* // Allow to PHP use the include_path for file path lookup
* $classLoader->setIncludePathLookup(true);
*
* // Possibility to change the default php file extension
* $classLoader->setFileExtension('.php');
*
* // Register the autoloader, prepending it in the stack
* $classLoader->register(true);
*
* @author Guilherme Blanco <guilhermeblanco@php.net>
* @author Jonathan H. Wage <jonwage@gmail.com>
* @author Roman S. Borschel <roman@code-factory.org>
* @author Matthew Weier O'Phinney <matthew@zend.com>
* @author Kris Wallsmith <kris.wallsmith@gmail.com>
* @author Fabien Potencier <fabien.potencier@symfony-project.org>
*/
class SplClassLoader implements SplAutoloader{
/** @var string */
private $fileExtension = '.php';
/** @var boolean */
private $includePathLookup = false;
/** @var array */
private $resources = array();
/** @var integer */
private $mode = self::MODE_NORMAL;
/**
* {@inheritdoc}
*/
public function setMode($mode){
if($mode & self::MODE_SILENT && $mode & self::MODE_NORMAL){
throw new \InvalidArgumentException(
sprintf('Cannot have %s working normally and silently at the same time!', __CLASS__)
);
}
$this->mode = $mode;
}
/**
* Define the file extension of resource files in the path of this class loader.
*
* @param string $fileExtension
*/
public function setFileExtension($fileExtension){
$this->fileExtension = $fileExtension;
}
/**
* Retrieve the file extension of resource files in the path of this class loader.
*
* @return string
*/
public function getFileExtension(){
return $this->fileExtension;
}
/**
* Turns on searching the include for class files. Allows easy loading installed PEAR packages.
*
* @param boolean $includePathLookup
*/
public function setIncludePathLookup($includePathLookup){
$this->includePathLookup = $includePathLookup;
}
/**
* Gets the base include path for all class files in the namespace of this class loader.
*
* @return boolean
*/
public function getIncludePathLookup(){
return $this->includePathLookup;
}
/**
* {@inheritdoc}
*/
public function register($prepend = false){
spl_autoload_register(array($this, 'load'), true, $prepend);
}
/**
* {@inheritdoc}
*/
public function unregister(){
spl_autoload_unregister(array($this, 'load'));
}
/**
* {@inheritdoc}
*/
public function add($resource, $resourcePath = null){
$this->resources[$resource] = (array) $resourcePath;
}
/**
* {@inheritdoc}
*/
public function load($resourceName){
$resourceAbsolutePath = $this->getResourceAbsolutePath($resourceName);
switch(true){
case ($this->mode & self::MODE_SILENT):
if($resourceAbsolutePath !== false){
require $resourceAbsolutePath;
}
break;
case ($this->mode & self::MODE_NORMAL):
default:
require $resourceAbsolutePath;
break;
}
if($this->mode & self::MODE_DEBUG && !$this->isResourceDeclared($resourceName)){
throw new \RuntimeException(
sprintf('Autoloader expected resource "%s" to be declared in file "%s".', $resourceName, $resourceAbsolutePath)
);
}
}
/**
* Transform resource name into its absolute resource path representation.
*
* @param string $resourceName
*
* @return string Resource absolute path.
*/
private function getResourceAbsolutePath($resourceName){
$resourceRelativePath = $this->getResourceRelativePath($resourceName);
foreach($this->resources as $resource => $resourcesPath){
if(strpos($resourceName, $resource) !== 0){
continue;
}
foreach($resourcesPath as $resourcePath){
$resourceAbsolutePath = $resourcePath . DIRECTORY_SEPARATOR . $resourceRelativePath;
if(is_file($resourceAbsolutePath)){
return $resourceAbsolutePath;
}
}
}
if($this->includePathLookup && ($resourceAbsolutePath = stream_resolve_include_path($resourceRelativePath)) !== false){
return $resourceAbsolutePath;
}
return false;
}
/**
* Transform resource name into its relative resource path representation.
*
* @param string $resourceName
*
* @return string Resource relative path.
*/
private function getResourceRelativePath($resourceName){
// We always work with FQCN in this context
$resourceName = ltrim($resourceName, '\\');
$resourcePath = '';
if(($lastNamespacePosition = strrpos($resourceName, '\\')) !== false){
// Namespaced resource name
$resourceNamespace = substr($resourceName, 0, $lastNamespacePosition);
$resourceName = substr($resourceName, $lastNamespacePosition + 1);
$resourcePath = str_replace('\\', DIRECTORY_SEPARATOR, $resourceNamespace) . DIRECTORY_SEPARATOR;
}
return $resourcePath . str_replace('_', DIRECTORY_SEPARATOR, $resourceName) . $this->fileExtension;
}
/**
* Check if resource is declared in user space.
*
* @param string $resourceName
*
* @return boolean
*/
private function isResourceDeclared($resourceName){
return class_exists($resourceName, false)
|| interface_exists($resourceName, false)
|| (function_exists('trait_exists') && trait_exists($resourceName, false));
}
}

View File

@ -1,732 +0,0 @@
#!/bin/bash
PHP_VERSION="5.5.10"
ZEND_VM="GOTO"
ZLIB_VERSION="1.2.8"
OPENSSL_VERSION="1.0.0l"
CURL_VERSION="curl-7_35_0"
READLINE_VERSION="6.3"
NCURSES_VERSION="5.9"
PHPNCURSES_VERSION="1.0.2"
PTHREADS_VERSION="2.0.4"
WEAKREF_VERSION="0.2.2"
PHPYAML_VERSION="1.1.1"
YAML_VERSION="0.1.4"
LIBXML_VERSION="2.9.1"
BCOMPILER_VERSION="1.0.2"
echo "[PocketMine] PHP compiler for Linux, MacOS and Android"
DIR="$(pwd)"
date > "$DIR/install.log" 2>&1
trap "echo \"# \$(eval echo \$BASH_COMMAND)\" >> \"$DIR/install.log\" 2>&1" DEBUG
uname -a >> "$DIR/install.log" 2>&1
echo "[INFO] Checking dependecies"
type make >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"make\""; read -p "Press [Enter] to continue..."; exit 1; }
type autoconf >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"autoconf\""; read -p "Press [Enter] to continue..."; exit 1; }
type automake >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"automake\""; read -p "Press [Enter] to continue..."; exit 1; }
type libtool >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"libtool\""; read -p "Press [Enter] to continue..."; exit 1; }
type m4 >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"m4\""; read -p "Press [Enter] to continue..."; exit 1; }
type wget >> "$DIR/install.log" 2>&1 || type curl >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"wget\" or \"curl\""; read -p "Press [Enter] to continue..."; exit 1; }
type getconf >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"getconf\""; read -p "Press [Enter] to continue..."; exit 1; }
#Needed to use aliases
shopt -s expand_aliases
type wget >> "$DIR/install.log" 2>&1
if [ $? -eq 0 ]; then
alias download_file="wget --no-check-certificate -q -O -"
else
type curl >> "$DIR/install.log" 2>&1
if [ $? -eq 0 ]; then
alias download_file="curl --insecure --silent --location"
else
echo "error, curl or wget not found"
fi
fi
export CC="gcc"
COMPILE_FOR_ANDROID=no
RANLIB=ranlib
HAVE_MYSQLI="--enable-embedded-mysqli --enable-mysqlnd --with-mysqli=mysqlnd"
COMPILE_TARGET=""
COMPILE_OPENSSL="no"
COMPILE_CURL="default"
COMPILE_FANCY="no"
IS_CROSSCOMPILE="no"
IS_WINDOWS="no"
DO_OPTIMIZE="no"
DO_STATIC="no"
while getopts "::t:oj:srcxff:" OPTION; do
case $OPTION in
t)
echo "[opt] Set target to $OPTARG"
COMPILE_TARGET="$OPTARG"
;;
j)
echo "[opt] Set make threads to $OPTARG"
THREADS="$OPTARG"
;;
o)
echo "[opt] Will compile OpenSSL"
COMPILE_OPENSSL="yes"
;;
r)
echo "[opt] Will compile readline and ncurses"
COMPILE_FANCY="yes"
;;
c)
echo "[opt] Will force compile cURL"
COMPILE_CURL="yes"
;;
x)
echo "[opt] Doing cross-compile"
IS_CROSSCOMPILE="yes"
;;
s)
echo "[opt] Will compile everything statically"
DO_STATIC="yes"
;;
f)
echo "[opt] Enabling abusive optimizations..."
DO_OPTIMIZE="yes"
ffast_math="-fno-math-errno -funsafe-math-optimizations -fno-trapping-math -ffinite-math-only -fno-rounding-math -fno-signaling-nans -fcx-limited-range" #workaround SQLite3 fail
CFLAGS="$CFLAGS -O2 -DSQLITE_HAVE_ISNAN $ffast_math -fno-signed-zeros -funsafe-loop-optimizations -fomit-frame-pointer -frename-registers -funroll-loops -funswitch-loops -fpredictive-commoning -fgcse-after-reload -ftree-vectorize -ftracer -ftree-loop-im -fivopts -ftree-parallelize-loops=4"
if [ "$OPTARG" == "arm" ]; then
CFLAGS="$CFLAGS -mfloat-abi=softfp -mfpu=vfp"
elif [ "$OPTARG" == "x86_64" ]; then
CFLAGS="$CFLAGS -mmx -msse -msse2 -msse3 -mfpmath=sse -free -msahf"
elif [ "$OPTARG" == "x86" ]; then
CFLAGS="$CFLAGS -mmx -msse -msse2 -mfpmath=sse -m128bit-long-double -malign-double"
fi
;;
\?)
echo "Invalid option: -$OPTION$OPTARG" >&2
exit 1
;;
esac
done
if [ "$IS_CROSSCOMPILE" == "yes" ]; then
if [ "$COMPILE_TARGET" == "win" ] || [ "$COMPILE_TARGET" == "win32" ]; then
TOOLCHAIN_PREFIX="i686-w64-mingw32"
[ -z "$march" ] && march=i686;
[ -z "$mtune" ] && mtune=pentium4;
CFLAGS="$CFLAGS -mconsole"
export CC="$TOOLCHAIN_PREFIX-gcc"
CONFIGURE_FLAGS="--host=$TOOLCHAIN_PREFIX --target=$TOOLCHAIN_PREFIX --build=$TOOLCHAIN_PREFIX"
OPENSSL_TARGET="mingw"
IS_WINDOWS="yes"
echo "[INFO] Cross-compiling for Windows 32-bit"
elif [ "$COMPILE_TARGET" == "win64" ]; then
TOOLCHAIN_PREFIX="x86_64-w64-mingw32"
[ -z "$march" ] && march=x86_64;
[ -z "$mtune" ] && mtune=nocona;
CFLAGS="$CFLAGS -mconsole"
export CC="$TOOLCHAIN_PREFIX-gcc"
CONFIGURE_FLAGS="--host=$TOOLCHAIN_PREFIX --target=$TOOLCHAIN_PREFIX --build=$TOOLCHAIN_PREFIX"
OPENSSL_TARGET="mingw"
IS_WINDOWS="yes"
echo "[INFO] Cross-compiling for Windows 64-bit"
elif [ "$COMPILE_TARGET" == "android" ] || [ "$COMPILE_TARGET" == "android-armv6" ]; then
COMPILE_FOR_ANDROID=yes
[ -z "$march" ] && march=armv6;
[ -z "$mtune" ] && mtune=arm1136jf-s;
TOOLCHAIN_PREFIX="arm-unknown-linux-uclibcgnueabi"
export CC="$TOOLCHAIN_PREFIX-gcc"
CONFIGURE_FLAGS="--host=$TOOLCHAIN_PREFIX --enable-static-link --disable-ipv6"
CFLAGS="-static -uclibc -Wl,-Bdynamic $CFLAGS"
echo "[INFO] Cross-compiling for Android ARMv6"
OPENSSL_TARGET="android"
HAVE_MYSQLI="--without-mysqli"
elif [ "$COMPILE_TARGET" == "android-armv7" ]; then
COMPILE_FOR_ANDROID=yes
[ -z "$march" ] && march=armv7-a;
[ -z "$mtune" ] && mtune=cortex-a8;
TOOLCHAIN_PREFIX="arm-unknown-linux-uclibcgnueabi"
export CC="$TOOLCHAIN_PREFIX-gcc"
CONFIGURE_FLAGS="--host=$TOOLCHAIN_PREFIX --enable-static-link --disable-ipv6"
CFLAGS="-static -uclibc -Wl,-Bdynamic $CFLAGS"
echo "[INFO] Cross-compiling for Android ARMv7"
OPENSSL_TARGET="android-armv7"
HAVE_MYSQLI="--without-mysqli"
elif [ "$COMPILE_TARGET" == "rpi" ]; then
TOOLCHAIN_PREFIX="arm-linux-gnueabihf"
[ -z "$march" ] && march=armv6zk;
[ -z "$mtune" ] && mtune=arm1176jzf-s;
CFLAGS="$CFLAGS -mfloat-abi=hard -mfpu=vfp";
if [ "$DO_OPTIMIZE" == "yes" ]; then
CFLAGS="$CFLAGS -mfloat-abi=hard -mfpu=vfp"
fi
export CC="$TOOLCHAIN_PREFIX-gcc"
CONFIGURE_FLAGS="--host=$TOOLCHAIN_PREFIX"
[ -z "$CFLAGS" ] && CFLAGS="-uclibc";
OPENSSL_TARGET="linux-armv4"
echo "[INFO] Cross-compiling for Raspberry Pi ARMv6zk hard float"
elif [ "$COMPILE_TARGET" == "mac" ]; then
[ -z "$march" ] && march=prescott;
[ -z "$mtune" ] && mtune=generic;
CFLAGS="$CFLAGS -fomit-frame-pointer";
TOOLCHAIN_PREFIX="i686-apple-darwin10"
export CC="$TOOLCHAIN_PREFIX-gcc"
CONFIGURE_FLAGS="--host=$TOOLCHAIN_PREFIX"
#zlib doesn't use the correct ranlib
RANLIB=$TOOLCHAIN_PREFIX-ranlib
OPENSSL_TARGET="darwin64-x86_64-cc"
CFLAGS="$CFLAGS -Qunused-arguments -Wno-error=unused-command-line-argument-hard-error-in-future"
ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"
echo "[INFO] Cross-compiling for Intel MacOS"
elif [ "$COMPILE_TARGET" == "ios" ] || [ "$COMPILE_TARGET" == "ios-armv6" ]; then
[ -z "$march" ] && march=armv6;
[ -z "$mtune" ] && mtune=arm1176jzf-s;
TOOLCHAIN_PREFIX="arm-apple-darwin10"
export CC="$TOOLCHAIN_PREFIX-gcc"
CONFIGURE_FLAGS="--host=$TOOLCHAIN_PREFIX --target=$TOOLCHAIN_PREFIX -miphoneos-version-min=4.2"
OPENSSL_TARGET="BSD-generic32"
HAVE_MYSQLI="--without-mysqli"
elif [ "$COMPILE_TARGET" == "ios-armv7" ]; then
[ -z "$march" ] && march=armv7-a;
[ -z "$mtune" ] && mtune=cortex-a8;
TOOLCHAIN_PREFIX="arm-apple-darwin10"
export CC="$TOOLCHAIN_PREFIX-gcc"
CONFIGURE_FLAGS="--host=$TOOLCHAIN_PREFIX --target=$TOOLCHAIN_PREFIX -miphoneos-version-min=4.2"
OPENSSL_TARGET="BSD-generic32"
HAVE_MYSQLI="--without-mysqli"
if [ "$DO_OPTIMIZE" == "yes" ]; then
CFLAGS="$CFLAGS -mfpu=neon"
fi
else
echo "Please supply a proper platform [android android-armv6 android-armv7 rpi mac ios ios-armv6 ios-armv7 win win32 win64] to cross-compile"
exit 1
fi
elif [ "$COMPILE_TARGET" == "linux" ] || [ "$COMPILE_TARGET" == "linux32" ]; then
[ -z "$march" ] && march=i686;
[ -z "$mtune" ] && mtune=pentium4;
CFLAGS="$CFLAGS -m32";
OPENSSL_TARGET="linux-generic32"
echo "[INFO] Compiling for Linux x86"
elif [ "$COMPILE_TARGET" == "linux64" ]; then
[ -z "$march" ] && march=x86-64;
[ -z "$mtune" ] && mtune=nocona;
CFLAGS="$CFLAGS -m64"
OPENSSL_TARGET="linux-x86_64"
echo "[INFO] Compiling for Linux x86_64"
elif [ "$COMPILE_TARGET" == "rpi" ]; then
[ -z "$march" ] && march=armv6zk;
[ -z "$mtune" ] && mtune=arm1176jzf-s;
CFLAGS="$CFLAGS -mfloat-abi=hard -mfpu=vfp";
OPENSSL_TARGET="linux-armv4"
echo "[INFO] Compiling for Raspberry Pi ARMv6zk hard float"
elif [ "$COMPILE_TARGET" == "mac" ] || [ "$COMPILE_TARGET" == "mac32" ]; then
[ -z "$march" ] && march=prescott;
[ -z "$mtune" ] && mtune=generic;
CFLAGS="$CFLAGS -m32 -arch i386 -fomit-frame-pointer -mmacosx-version-min=10.5";
LDFLAGS="$LDFLAGS -Wl,-rpath,@loader_path/../lib";
export DYLD_LIBRARY_PATH="@loader_path/../lib"
OPENSSL_TARGET="darwin-i386-cc"
CFLAGS="$CFLAGS -Qunused-arguments -Wno-error=unused-command-line-argument-hard-error-in-future"
ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"
echo "[INFO] Compiling for Intel MacOS x86"
elif [ "$COMPILE_TARGET" == "mac64" ]; then
[ -z "$march" ] && march=core2;
[ -z "$mtune" ] && mtune=generic;
CFLAGS="$CFLAGS -m64 -arch x86_64 -fomit-frame-pointer -mmacosx-version-min=10.5";
LDFLAGS="$LDFLAGS -Wl,-rpath,@loader_path/../lib";
export DYLD_LIBRARY_PATH="@loader_path/../lib"
OPENSSL_TARGET="darwin64-x86_64-cc"
CFLAGS="$CFLAGS -Qunused-arguments -Wno-error=unused-command-line-argument-hard-error-in-future"
ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"
echo "[INFO] Compiling for Intel MacOS x86_64"
elif [ "$COMPILE_TARGET" == "ios" ]; then
[ -z "$march" ] && march=armv7-a;
[ -z "$mtune" ] && mtune=cortex-a8;
echo "[INFO] Compiling for iOS ARMv7"
OPENSSL_TARGET="linux-armv4"
elif [ -z "$CFLAGS" ]; then
if [ `getconf LONG_BIT` == "64" ]; then
echo "[INFO] Compiling for current machine using 64-bit"
CFLAGS="-m64 $CFLAGS"
OPENSSL_TARGET="linux-x86_64"
else
echo "[INFO] Compiling for current machine using 32-bit"
CFLAGS="-m32 $CFLAGS"
OPENSSL_TARGET="linux-generic32"
fi
fi
echo "#include <stdio.h> \
int main(void){ \
printf("Hello world\n"); \
return 0; \
}" > test.c
type $CC >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"$CC\""; read -p "Press [Enter] to continue..."; exit 1; }
[ -z "$THREADS" ] && THREADS=1;
[ -z "$march" ] && march=native;
[ -z "$mtune" ] && mtune=native;
[ -z "$CFLAGS" ] && CFLAGS="";
[ -z "$LDFLAGS" ] && LDFLAGS="-Wl,-rpath='\$\$ORIGIN/../lib'";
[ -z "$CONFIGURE_FLAGS" ] && CONFIGURE_FLAGS="";
if [ "$mtune" != "none" ]; then
$CC -march=$march -mtune=$mtune $CFLAGS -o test test.c >> "$DIR/install.log" 2>&1
if [ $? -eq 0 ]; then
CFLAGS="-march=$march -mtune=$mtune -fno-gcse $CFLAGS"
fi
else
$CC -march=$march $CFLAGS -o test test.c >> "$DIR/install.log" 2>&1
if [ $? -eq 0 ]; then
CFLAGS="-march=$march -fno-gcse $CFLAGS"
fi
fi
rm test.* >> "$DIR/install.log" 2>&1
rm test >> "$DIR/install.log" 2>&1
export CFLAGS="-O2 -fPIC $CFLAGS"
export LDFLAGS="$LDFLAGS"
rm -r -f install_data/ >> "$DIR/install.log" 2>&1
rm -r -f bin/ >> "$DIR/install.log" 2>&1
mkdir -m 0755 install_data >> "$DIR/install.log" 2>&1
mkdir -m 0755 bin >> "$DIR/install.log" 2>&1
mkdir -m 0755 bin/php5 >> "$DIR/install.log" 2>&1
cd install_data
set -e
#PHP 5
echo -n "[PHP] downloading $PHP_VERSION..."
download_file "http://php.net/get/php-$PHP_VERSION.tar.gz/from/this/mirror" | tar -zx >> "$DIR/install.log" 2>&1
mv php-$PHP_VERSION php
echo " done!"
if [ "$COMPILE_FANCY" == "yes" ]; then
if [ "$DO_STATIC" == "yes" ]; then
EXTRA_FLAGS="--without-shared --with-static"
else
EXTRA_FLAGS="--with-shared --without-static"
fi
#ncurses
echo -n "[ncurses] downloading $NCURSES_VERSION..."
download_file "http://ftp.gnu.org/gnu/ncurses/ncurses-$NCURSES_VERSION.tar.gz" | tar -zx >> "$DIR/install.log" 2>&1
mv ncurses-$NCURSES_VERSION ncurses
echo -n " checking..."
cd ncurses
./configure --prefix="$DIR/bin/php5" \
--without-ada \
--without-manpages \
--without-progs \
--without-tests \
--with-normal \
--with-pthread \
--without-debug \
$EXTRA_FLAGS \
$CONFIGURE_FLAGS >> "$DIR/install.log" 2>&1
echo -n " compiling..."
make -j $THREADS >> "$DIR/install.log" 2>&1
echo -n " installing..."
make install >> "$DIR/install.log" 2>&1
echo -n " cleaning..."
cd ..
rm -r -f ./ncurses
echo " done!"
HAVE_NCURSES="--with-ncurses=$DIR/bin/php5"
if [ "$DO_STATIC" == "yes" ]; then
EXTRA_FLAGS="--enable-shared=no --enable-static=yes"
else
EXTRA_FLAGS="--enable-shared=yes --enable-static=no"
fi
#readline
set +e
echo -n "[readline] downloading $READLINE_VERSION..."
download_file "http://ftp.gnu.org/gnu/readline/readline-$READLINE_VERSION.tar.gz" | tar -zx >> "$DIR/install.log" 2>&1
mv readline-$READLINE_VERSION readline
echo -n " checking..."
cd readline
./configure --prefix="$DIR/bin/php5" \
--with-curses="$DIR/bin/php5" \
--enable-multibyte \
$EXTRA_FLAGS \
$CONFIGURE_FLAGS >> "$DIR/install.log" 2>&1
echo -n " compiling..."
if make -j $THREADS >> "$DIR/install.log" 2>&1; then
echo -n " installing..."
make install >> "$DIR/install.log" 2>&1
HAVE_READLINE="--with-readline=$DIR/bin/php5"
else
echo -n " disabling..."
HAVE_READLINE="--without-readline"
fi
echo -n " cleaning..."
cd ..
rm -r -f ./readline
echo " done!"
set -e
else
HAVE_NCURSES="--without-ncurses"
HAVE_READLINE="--without-readline"
fi
if [ "$DO_STATIC" == "yes" ]; then
EXTRA_FLAGS="--static"
else
EXTRA_FLAGS="--shared"
fi
#zlib
download_file "https://github.com/madler/zlib/archive/v$ZLIB_VERSION.tar.gz" | tar -zx >> "$DIR/install.log" 2>&1
echo -n "[zlib] downloading $ZLIB_VERSION..."
mv zlib-$ZLIB_VERSION zlib
echo -n " checking..."
cd zlib
RANLIB=$RANLIB ./configure --prefix="$DIR/bin/php5" \
$EXTRA_FLAGS >> "$DIR/install.log" 2>&1
echo -n " compiling..."
make -j $THREADS >> "$DIR/install.log" 2>&1
echo -n " installing..."
make install >> "$DIR/install.log" 2>&1
echo -n " cleaning..."
cd ..
rm -r -f ./zlib
if [ "$DO_STATIC" != "yes" ]; then
rm -f "$DIR/bin/php5/lib/libz.a"
fi
echo " done!"
if [ "$COMPILE_OPENSSL" == "yes" ] || [ "$COMPILE_CURL" != "no" ] && [ "$IS_CROSSCOMPILE" != "yes" ]; then
#if [ "$DO_STATIC" == "yes" ]; then
# EXTRA_FLAGS=""
#else
# EXTRA_FLAGS="shared no-static"
#fi
EXTRA_FLAGS="shared no-static"
#OpenSSL
WITH_SSL="--with-ssl=$DIR/bin/php5"
WITH_OPENSSL="--with-openssl=$DIR/bin/php5"
echo -n "[OpenSSL] downloading $OPENSSL_VERSION..."
download_file "http://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz" | tar -zx >> "$DIR/install.log" 2>&1
mv openssl-$OPENSSL_VERSION openssl
echo -n " checking..."
cd openssl
RANLIB=$RANLIB ./Configure \
$OPENSSL_TARGET \
--prefix="$DIR/bin/php5" \
--openssldir="$DIR/bin/php5" \
zlib \
zlib-dynamic \
--with-zlib-lib="$DIR/bin/php5/lib" \
--with-zlib-include="$DIR/bin/php5/include" \
$EXTRA_FLAGS \
no-ssl2 \
no-asm \
no-hw \
no-engines \
$CONFIGURE_FLAGS >> "$DIR/install.log" 2>&1
echo -n " compiling..."
make depend >> "$DIR/install.log" 2>&1
make >> "$DIR/install.log" 2>&1
echo -n " installing..."
make install >> "$DIR/install.log" 2>&1
echo -n " cleaning..."
cd ..
rm -r -f ./openssh
if [ "$DO_STATIC" != "yes" ]; then
rm -f "$DIR/bin/php5/lib/libcrypto.a" "$DIR/bin/php5/lib/libssl.a"
fi
echo " done!"
else
WITH_SSL="--with-ssl"
WITH_OPENSSL="--without-ssl"
if [ "$(uname -s)" == "Darwin" ] && [ "$COMPILE_TARGET" != "crosscompile" ]; then
WITH_SSL="--with-darwinssl"
fi
fi
if [ "$(uname -s)" == "Darwin" ] && [ "$IS_CROSSCOMPILE" != "yes" ] && [ "$COMPILE_CURL" != "yes" ]; then
HAVE_CURL="shared,/usr"
else
if [ "$DO_STATIC" == "yes" ]; then
EXTRA_FLAGS="--enable-static --disable-shared"
else
EXTRA_FLAGS="--disable-static --enable-shared"
fi
#curl
echo -n "[cURL] downloading $CURL_VERSION..."
download_file "https://github.com/bagder/curl/archive/$CURL_VERSION.tar.gz" | tar -zx >> "$DIR/install.log" 2>&1
mv curl-$CURL_VERSION curl
echo -n " checking..."
cd curl
if [ ! -f ./configure ]; then
./buildconf --force >> "$DIR/install.log" 2>&1
fi
RANLIB=$RANLIB ./configure --disable-dependency-tracking \
--enable-ipv6 \
--enable-optimize \
--enable-http \
--enable-ftp \
--disable-dict \
--enable-file \
--without-librtmp \
--disable-gopher \
--disable-imap \
--disable-pop3 \
--disable-rtsp \
--disable-smtp \
--disable-telnet \
--disable-tftp \
--disable-ldap \
--disable-ldaps \
--without-libidn \
--with-zlib="$DIR/bin/php5" \
$WITH_SSL \
--enable-threaded-resolver \
--prefix="$DIR/bin/php5" \
$EXTRA_FLAGS \
$CONFIGURE_FLAGS >> "$DIR/install.log" 2>&1
echo -n " compiling..."
make -j $THREADS >> "$DIR/install.log" 2>&1
echo -n " installing..."
make install >> "$DIR/install.log" 2>&1
echo -n " cleaning..."
cd ..
rm -r -f ./curl
echo " done!"
HAVE_CURL="$DIR/bin/php5"
fi
# PECL libraries
#pthreads
echo -n "[PHP pthreads] downloading $PTHREADS_VERSION..."
download_file "http://pecl.php.net/get/pthreads-$PTHREADS_VERSION.tgz" | tar -zx >> "$DIR/install.log" 2>&1
mv pthreads-$PTHREADS_VERSION "$DIR/install_data/php/ext/pthreads"
echo " done!"
#WeakRef
#echo -n "[PHP WeakRef] downloading $WEAKREF_VERSION..."
#download_file "http://pecl.php.net/get/Weakref-$WEAKREF_VERSION.tgz" | tar -zx >> "$DIR/install.log" 2>&1
#mv Weakref-$WEAKREF_VERSION "$DIR/install_data/php/ext/weakref"
#echo " done!"
#PHP YAML
echo -n "[PHP YAML] downloading $PHPYAML_VERSION..."
download_file "http://pecl.php.net/get/yaml-$PHPYAML_VERSION.tgz" | tar -zx >> "$DIR/install.log" 2>&1
mv yaml-$PHPYAML_VERSION "$DIR/install_data/php/ext/yaml"
echo " done!"
#bcompiler
#echo -n "[bcompiler] downloading $BCOMPILER_VERSION..."
#download_file "http://pecl.php.net/get/bcompiler-$BCOMPILER_VERSION.tgz" | tar -zx >> "$DIR/install.log" 2>&1
#mv bcompiler-$BCOMPILER_VERSION "$DIR/install_data/php/ext/bcompiler"
#echo " done!"
#PHP ncurses
#echo -n "[PHP ncurses] downloading $PHPNCURSES_VERSION..."
#download_file "http://pecl.php.net/get/ncurses-$PHPNCURSES_VERSION.tgz" | tar -zx >> "$DIR/install.log" 2>&1
#mv ncurses-$PHPNCURSES_VERSION "$DIR/install_data/php/ext/ncurses"
#echo " done!"
if [ "$DO_STATIC" == "yes" ]; then
EXTRA_FLAGS="--disable-shared --enable-static"
else
EXTRA_FLAGS="--enable-shared --disable-static"
fi
#YAML
echo -n "[YAML] downloading $YAML_VERSION..."
download_file "http://pyyaml.org/download/libyaml/yaml-$YAML_VERSION.tar.gz" | tar -zx >> "$DIR/install.log" 2>&1
mv yaml-$YAML_VERSION yaml
echo -n " checking..."
cd yaml
RANLIB=$RANLIB ./configure \
--prefix="$DIR/bin/php5" \
$EXTRA_FLAGS \
$CONFIGURE_FLAGS >> "$DIR/install.log" 2>&1
sed -i=".backup" 's/ tests win32/ win32/g' Makefile
echo -n " compiling..."
make -j $THREADS >> "$DIR/install.log" 2>&1
echo -n " installing..."
make install >> "$DIR/install.log" 2>&1
echo -n " cleaning..."
cd ..
rm -r -f ./yaml
echo " done!"
if [ "$DO_STATIC" == "yes" ]; then
EXTRA_FLAGS="--enable-shared=no --enable-static=yes"
else
EXTRA_FLAGS="--enable-shared=yes --enable-static=no"
fi
#libxml2
#echo -n "[libxml2] downloading $LIBXML_VERSION..."
#download_file "ftp://xmlsoft.org/libxml2/libxml2-$LIBXML_VERSION.tar.gz" | tar -zx >> "$DIR/install.log" 2>&1
#mv libxml2-$LIBXML_VERSION yaml
#echo -n " checking..."
#cd libxml2
#RANLIB=$RANLIB ./configure \
#--disable-ipv6 \
#--with-libz="$DIR/bin/php5" \
#--prefix="$DIR/bin/php5" \
#$EXTRA_FLAGS \
#$CONFIGURE_FLAGS >> "$DIR/install.log" 2>&1
#echo -n " compiling..."
#make -j $THREADS >> "$DIR/install.log" 2>&1
#echo -n " installing..."
#make install >> "$DIR/install.log" 2>&1
#echo -n " cleaning..."
#cd ..
#rm -r -f ./libxml2
#echo " done!"
echo -n "[PHP]"
if [ "$DO_OPTIMIZE" != "no" ]; then
echo -n " enabling optimizations..."
PHP_OPTIMIZATION="--enable-inline-optimization "
else
PHP_OPTIMIZATION="--disable-inline-optimization "
fi
echo -n " checking..."
cd php
rm -f ./aclocal.m4 >> "$DIR/install.log" 2>&1
rm -rf ./autom4te.cache/ >> "$DIR/install.log" 2>&1
rm -f ./configure >> "$DIR/install.log" 2>&1
./buildconf --force >> "$DIR/install.log" 2>&1
if [ "$IS_CROSSCOMPILE" == "yes" ]; then
sed -i=".backup" 's/pthreads_working=no/pthreads_working=yes/' ./configure
if [ "$IS_WINDOWS" != "yes" ]; then
export LIBS="$LIBS -lpthread -ldl -lresolv"
else
export LIBS="$LIBS -lpthread"
fi
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-opcache=no"
fi
if [ "$IS_WINDOWS" != "yes" ]; then
HAVE_PCNTL="--enable-pcntl"
else
HAVE_PCNTL="--disable-pcntl"
cp -f ./win32/build/config.* ./main >> "$DIR/install.log" 2>&1
sed 's:@PREFIX@:$DIR/bin/php5:' ./main/config.w32.h.in > ./wmain/config.w32.h 2>> "$DIR/install.log"
fi
RANLIB=$RANLIB ./configure $PHP_OPTIMIZATION --prefix="$DIR/bin/php5" \
--exec-prefix="$DIR/bin/php5" \
--with-curl="$HAVE_CURL" \
--with-zlib="$DIR/bin/php5" \
--with-zlib-dir="$DIR/bin/php5" \
--with-yaml="$DIR/bin/php5" \
$HAVE_NCURSES \
$HAVE_READLINE \
--enable-mbstring \
--enable-calendar \
--enable-pthreads \
--enable-pthreads-pedantic \
--disable-libxml \
--disable-xml \
--disable-dom \
--disable-simplexml \
--disable-xmlreader \
--disable-xmlwriter \
--disable-cgi \
--disable-session \
--disable-debug \
--disable-pdo \
--without-pear \
--without-iconv \
--without-pdo-sqlite \
--with-pic \
--enable-phar \
--enable-ctype \
--enable-sockets \
--enable-shared=no \
--enable-static=yes \
--enable-shmop \
--enable-maintainer-zts \
--disable-short-tags \
--enable-zend-signals \
$HAVE_PCNTL \
$HAVE_MYSQLI \
--enable-bcmath \
--enable-cli \
--enable-zip \
--enable-ftp \
--with-zend-vm=$ZEND_VM \
$CONFIGURE_FLAGS >> "$DIR/install.log" 2>&1
echo -n " compiling..."
if [ "$COMPILE_FOR_ANDROID" == "yes" ]; then
sed -i=".backup" 's/-export-dynamic/-all-static/g' Makefile
fi
sed -i=".backup" 's/PHP_BINARIES. pharcmd$/PHP_BINARIES)/g' Makefile
sed -i=".backup" 's/install-programs install-pharcmd$/install-programs/g' Makefile
make -j $THREADS >> "$DIR/install.log" 2>&1
echo -n " installing..."
make install >> "$DIR/install.log" 2>&1
if [ "$(uname -s)" == "Darwin" ] && [ "$IS_CROSSCOMPILE" != "yes" ]; then
set +e
install_name_tool -delete_rpath "$DIR/bin/php5/lib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libz.1.dylib" "@loader_path/../lib/libz.1.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libcurl.4.dylib" "@loader_path/../lib/libcurl.4.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libyaml-0.2.dylib" "@loader_path/../lib/libyaml-0.2.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libreadline.$READLINE_VERSION.dylib" "@loader_path/../lib/libreadline.$READLINE_VERSION.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libhistory.$READLINE_VERSION.dylib" "@loader_path/../lib/libhistory.$READLINE_VERSION.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libform.6.0.dylib" "@loader_path/../lib/libform.6.0.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libmenu.6.0.dylib" "@loader_path/../lib/libmenu.6.0.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libncurses.6.0.dylib" "@loader_path/../lib/libncurses.6.0.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libpanel.6.0.dylib" "@loader_path/../lib/libpanel.6.0.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libssl.1.0.0.dylib" "@loader_path/../lib/libssl.1.0.0.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libssl.1.0.0.dylib" "@loader_path/../lib/libssl.1.0.0.dylib" "$DIR/bin/php5/lib/libcurl.4.dylib" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libcrypto.1.0.0.dylib" "@loader_path/../lib/libcrypto.1.0.0.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libcrypto.1.0.0.dylib" "@loader_path/../lib/libcrypto.1.0.0.dylib" "$DIR/bin/php5/lib/libcurl.4.dylib" >> "$DIR/install.log" 2>&1
chmod 0777 "$DIR/bin/php5/lib/libssl.1.0.0.dylib" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libcrypto.1.0.0.dylib" "@loader_path/libcrypto.1.0.0.dylib" "$DIR/bin/php5/lib/libssl.1.0.0.dylib" >> "$DIR/install.log" 2>&1
chmod 0755 "$DIR/bin/php5/lib/libssl.1.0.0.dylib" >> "$DIR/install.log" 2>&1
set -e
fi
echo -n " generating php.ini..."
trap - DEBUG
TIMEZONE=$(date +%Z)
echo "date.timezone=$TIMEZONE" > "$DIR/bin/php5/bin/php.ini"
echo "short_open_tag=0" >> "$DIR/bin/php5/bin/php.ini"
echo "asp_tags=0" >> "$DIR/bin/php5/bin/php.ini"
echo "phar.readonly=0" >> "$DIR/bin/php5/bin/php.ini"
echo "phar.require_hash=1" >> "$DIR/bin/php5/bin/php.ini"
if [ "$IS_CROSSCOMPILE" != "crosscompile" ]; then
echo "zend_extension=opcache.so" >> "$DIR/bin/php5/bin/php.ini"
echo "opcache.enable=1" >> "$DIR/bin/php5/bin/php.ini"
echo "opcache.enable_cli=1" >> "$DIR/bin/php5/bin/php.ini"
echo "opcache.save_comments=0" >> "$DIR/bin/php5/bin/php.ini"
echo "opcache.fast_shutdown=1" >> "$DIR/bin/php5/bin/php.ini"
echo "opcache.max_accelerated_files=4096" >> "$DIR/bin/php5/bin/php.ini"
echo "opcache.interned_strings_buffer=8" >> "$DIR/bin/php5/bin/php.ini"
echo "opcache.memory_consumption=128" >> "$DIR/bin/php5/bin/php.ini"
echo "opcache.optimization_level=0xffffffff" >> "$DIR/bin/php5/bin/php.ini"
fi
if [ "$HAVE_CURL" == "shared,/usr" ]; then
echo "extension=curl.so" >> "$DIR/bin/php5/bin/php.ini"
fi
echo " done!"
cd "$DIR"
echo -n "[INFO] Cleaning up..."
rm -r -f install_data/ >> "$DIR/install.log" 2>&1
rm -f bin/php5/bin/curl* >> "$DIR/install.log" 2>&1
rm -f bin/php5/bin/curl-config* >> "$DIR/install.log" 2>&1
rm -f bin/php5/bin/c_rehash* >> "$DIR/install.log" 2>&1
rm -f bin/php5/bin/openssl* >> "$DIR/install.log" 2>&1
rm -r -f bin/php5/man >> "$DIR/install.log" 2>&1
rm -r -f bin/php5/php >> "$DIR/install.log" 2>&1
rm -r -f bin/php5/misc >> "$DIR/install.log" 2>&1
date >> "$DIR/install.log" 2>&1
echo " done!"
echo "[PocketMine] You should start the server now using \"./start.sh.\""
echo "[PocketMine] If it doesn't work, please send the \"install.log\" file to the Bug Tracker."

View File

@ -1,247 +0,0 @@
#!/bin/bash
PMMP_VERSION=""
LINUX_32_BUILD="PHP_5.5.10_x86_Linux"
LINUX_64_BUILD="PHP_5.5.10_x86-64_Linux"
MAC_32_BUILD="PHP_5.5.10_x86_MacOS"
MAC_64_BUILD="PHP_5.5.10_x86-64_MacOS"
RPI_BUILD="PHP_5.5.9_ARM_Raspbian_hard"
# Temporal build
ODROID_BUILD="PHP_5.5.9_ARM_Raspbian_hard"
AND_BUILD="PHP_5.5.9_ARMv7_Android"
IOS_BUILD="PHP_5.5.9_ARMv6_iOS"
update=off
forcecompile=off
alldone=no
#Needed to use aliases
shopt -s expand_aliases
type wget > /dev/null 2>&1
if [ $? -eq 0 ]; then
alias download_file="wget --no-check-certificate -q -O -"
else
type curl >> /dev/null 2>&1
if [ $? -eq 0 ]; then
alias download_file="curl --insecure --silent --location"
else
echo "error, curl or wget not found"
fi
fi
while getopts "ucdv:" opt; do
case $opt in
u)
update=on
;;
c)
forcecompile=on
;;
d)
PMMP_VERSION="master"
;;
v)
PMMP_VERSION="$OPTARG"
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
esac
done
if [ "$PMMP_VERSION" == "" ]; then
PMMP_VERSION=$(download_file "https://api.github.com/repos/PocketMine/PocketMine-MP/tags" | grep '"name": "[A-Za-z0-9_\.]*",' | head -1 | sed -r 's/[ ]*"name": "([A-Za-z0-9_\.]*)",[ ]*/\1/')
if [ "$PMMP_VERSION" == "" ]; then
echo "[ERROR] Couldn't get the latest PocketMine-MP version"
exit 1
fi
fi
echo "[INFO] PocketMine-MP $PMMP_VERSION downloader & installer for Linux & Mac"
echo "[0/3] Cleaning..."
rm -r -f src/
rm -f PocketMine-MP.php
rm -f README.md
rm -f CONTRIBUTING.md
rm -f LICENSE
rm -f start.sh
rm -f start.bat
echo "[1/3] Downloading PocketMine-MP $PMMP_VERSION..."
download_file "https://github.com/PocketMine/PocketMine-MP/archive/$PMMP_VERSION.tar.gz" | tar -zx > /dev/null
mv -f PocketMine-MP-$PMMP_VERSION/* ./
rm -f -r PocketMine-MP-$PMMP_VERSION/
rm -f ./start.cmd
chmod +x ./start.sh
chmod +x ./src/build/compile.sh
if [ "$update" == "on" ]; then
echo "[3/3] Skipping PHP recompilation due to user request"
else
echo -n "[3/3] Obtaining PHP:"
echo " detecting if build is available..."
if [ "$forcecompile" == "off" ] && [ "$(uname -s)" == "Darwin" ]; then
set +e
UNAME_M=$(uname -m)
IS_IOS=$(expr match $UNAME_M 'iP[a-zA-Z0-9,]*' 2> /dev/null)
set -e
if [[ "$IS_IOS" -gt 0 ]]; then
rm -r -f bin/ >> /dev/null 2>&1
echo -n "[3/3] iOS PHP build available, downloading $IOS_BUILD.tar.gz..."
download_file "http://sourceforge.net/projects/pocketmine/files/builds/$IOS_BUILD.tar.gz" | tar -zx > /dev/null 2>&1
chmod +x ./bin/php5/bin/*
echo -n " checking..."
if [ $(./bin/php5/bin/php -r 'echo "yes";' 2>/dev/null) == "yes" ]; then
echo -n " regenerating php.ini..."
TIMEZONE=$(date +%Z)
echo "date.timezone=$TIMEZONE" >> "./bin/php5/bin/php.ini"
echo "short_open_tag=0" >> "./bin/php5/bin/php.ini"
echo "asp_tags=0" >> "./bin/php5/bin/php.ini"
echo "phar.readonly=0" >> "./bin/php5/bin/php.ini"
echo "phar.require_hash=1" >> "./bin/php5/bin/php.ini"
echo " done"
alldone=yes
else
echo " invalid build detected"
fi
else
rm -r -f bin/ >> /dev/null 2>&1
if [ `getconf LONG_BIT` == "64" ]; then
echo -n "[3/3] MacOS 64-bit PHP build available, downloading $MAC_64_BUILD.tar.gz..."
MAC_BUILD="$MAC_64_BUILD"
else
echo -n "[3/3] MacOS 32-bit PHP build available, downloading $MAC_32_BUILD.tar.gz..."
MAC_BUILD="$MAC_32_BUILD"
fi
download_file "http://sourceforge.net/projects/pocketmine/files/builds/$MAC_BUILD.tar.gz" | tar -zx > /dev/null 2>&1
chmod +x ./bin/php5/bin/*
echo -n " checking..."
if [ $(./bin/php5/bin/php -r 'echo "yes";' 2>/dev/null) == "yes" ]; then
echo -n " regenerating php.ini..."
TIMEZONE=$(date +%Z)
OPCACHE_PATH="$(find $(pwd) -name opcache.so)"
echo "zend_extension=\"$OPCACHE_PATH\"" > "./bin/php5/bin/php.ini"
echo "opcache.enable=1" >> "./bin/php5/bin/php.ini"
echo "opcache.enable_cli=1" >> "./bin/php5/bin/php.ini"
echo "opcache.save_comments=0" >> "./bin/php5/bin/php.ini"
echo "opcache.fast_shutdown=1" >> "./bin/php5/bin/php.ini"
echo "opcache.max_accelerated_files=4096" >> "./bin/php5/bin/php.ini"
echo "opcache.interned_strings_buffer=8" >> "./bin/php5/bin/php.ini"
echo "opcache.memory_consumption=128" >> "./bin/php5/bin/php.ini"
echo "opcache.optimization_level=0xffffffff" >> "./bin/php5/bin/php.ini"
echo "date.timezone=$TIMEZONE" >> "./bin/php5/bin/php.ini"
echo "short_open_tag=0" >> "./bin/php5/bin/php.ini"
echo "asp_tags=0" >> "./bin/php5/bin/php.ini"
echo "phar.readonly=0" >> "./bin/php5/bin/php.ini"
echo "phar.require_hash=1" >> "./bin/php5/bin/php.ini"
echo " done"
alldone=yes
else
echo " invalid build detected"
fi
fi
else
grep -q BCM2708 /proc/cpuinfo > /dev/null 2>&1
IS_RPI=$?
grep -q ODROID /proc/cpuinfo > /dev/null 2>&1
IS_ODROID=$?
if [ "$IS_RPI" -eq 0 ] && [ "$forcecompile" == "off" ]; then
rm -r -f bin/ >> /dev/null 2>&1
echo -n "[3/3] Raspberry Pi PHP build available, downloading $RPI_BUILD.tar.gz..."
download_file "http://sourceforge.net/projects/pocketmine/files/builds/$RPI_BUILD.tar.gz" | tar -zx > /dev/null 2>&1
chmod +x ./bin/php5/bin/*
echo -n " checking..."
if [ $(./bin/php5/bin/php -r 'echo "yes";' 2>/dev/null) == "yes" ]; then
echo -n " regenerating php.ini..."
TIMEZONE=$(date +%Z)
OPCACHE_PATH="$(find $(pwd) -name opcache.so)"
echo "zend_extension=\"$OPCACHE_PATH\"" > "./bin/php5/bin/php.ini"
echo "opcache.enable=1" >> "./bin/php5/bin/php.ini"
echo "opcache.enable_cli=1" >> "./bin/php5/bin/php.ini"
echo "opcache.save_comments=0" >> "./bin/php5/bin/php.ini"
echo "opcache.fast_shutdown=1" >> "./bin/php5/bin/php.ini"
echo "opcache.max_accelerated_files=4096" >> "./bin/php5/bin/php.ini"
echo "opcache.interned_strings_buffer=8" >> "./bin/php5/bin/php.ini"
echo "opcache.memory_consumption=128" >> "./bin/php5/bin/php.ini"
echo "opcache.optimization_level=0xffffffff" >> "./bin/php5/bin/php.ini"
echo "date.timezone=$TIMEZONE" >> "./bin/php5/bin/php.ini"
echo "short_open_tag=0" >> "./bin/php5/bin/php.ini"
echo "asp_tags=0" >> "./bin/php5/bin/php.ini"
echo "phar.readonly=0" >> "./bin/php5/bin/php.ini"
echo "phar.require_hash=1" >> "./bin/php5/bin/php.ini"
echo " done"
alldone=yes
else
echo " invalid build detected"
fi
elif [ "$IS_ODROID" -eq 0 ] && [ "$forcecompile" == "off" ]; then
rm -r -f bin/ >> /dev/null 2>&1
echo -n "[3/3] ODROID PHP build available, downloading $ODROID_BUILD.tar.gz..."
download_file "http://sourceforge.net/projects/pocketmine/files/builds/$ODROID_BUILD.tar.gz" | tar -zx > /dev/null 2>&1
chmod +x ./bin/php5/bin/*
echo -n " checking..."
if [ $(./bin/php5/bin/php -r 'echo "yes";' 2>/dev/null) == "yes" ]; then
echo -n " regenerating php.ini..."
OPCACHE_PATH="$(find $(pwd) -name opcache.so)"
echo "zend_extension=\"$OPCACHE_PATH\"" > "./bin/php5/bin/php.ini"
echo "opcache.enable=1" >> "./bin/php5/bin/php.ini"
echo "opcache.enable_cli=1" >> "./bin/php5/bin/php.ini"
echo "opcache.save_comments=0" >> "./bin/php5/bin/php.ini"
echo "opcache.fast_shutdown=1" >> "./bin/php5/bin/php.ini"
echo "opcache.max_accelerated_files=4096" >> "./bin/php5/bin/php.ini"
echo "opcache.interned_strings_buffer=8" >> "./bin/php5/bin/php.ini"
echo "opcache.memory_consumption=128" >> "./bin/php5/bin/php.ini"
echo "opcache.optimization_level=0xffffffff" >> "./bin/php5/bin/php.ini"
echo "date.timezone=$TIMEZONE" >> "./bin/php5/bin/php.ini"
echo "short_open_tag=0" >> "./bin/php5/bin/php.ini"
echo "asp_tags=0" >> "./bin/php5/bin/php.ini"
echo "phar.readonly=0" >> "./bin/php5/bin/php.ini"
echo "phar.require_hash=1" >> "./bin/php5/bin/php.ini"
echo " done"
alldone=yes
else
echo " invalid build detected"
fi
elif [ "$forcecompile" == "off" ] && [ "$(uname -s)" == "Linux" ]; then
rm -r -f bin/ >> /dev/null 2>&1
if [ `getconf LONG_BIT` = "64" ]; then
echo -n "[3/3] Linux 64-bit PHP build available, downloading $LINUX_64_BUILD.tar.gz..."
LINUX_BUILD="$LINUX_64_BUILD"
else
echo -n "[3/3] Linux 32-bit PHP build available, downloading $LINUX_32_BUILD.tar.gz..."
LINUX_BUILD="$LINUX_32_BUILD"
fi
download_file "http://sourceforge.net/projects/pocketmine/files/builds/$LINUX_BUILD.tar.gz" | tar -zx > /dev/null 2>&1
chmod +x ./bin/php5/bin/*
echo -n " checking..."
if [ $(./bin/php5/bin/php -r 'echo "yes";' 2>/dev/null) == "yes" ]; then
echo -n " regenerating php.ini..."
OPCACHE_PATH="$(find $(pwd) -name opcache.so)"
echo "zend_extension=\"$OPCACHE_PATH\"" > "./bin/php5/bin/php.ini"
echo "opcache.enable=1" >> "./bin/php5/bin/php.ini"
echo "opcache.enable_cli=1" >> "./bin/php5/bin/php.ini"
echo "opcache.save_comments=0" >> "./bin/php5/bin/php.ini"
echo "opcache.fast_shutdown=1" >> "./bin/php5/bin/php.ini"
echo "opcache.max_accelerated_files=4096" >> "./bin/php5/bin/php.ini"
echo "opcache.interned_strings_buffer=8" >> "./bin/php5/bin/php.ini"
echo "opcache.memory_consumption=128" >> "./bin/php5/bin/php.ini"
echo "opcache.optimization_level=0xffffffff" >> "./bin/php5/bin/php.ini"
echo "date.timezone=$TIMEZONE" >> "./bin/php5/bin/php.ini"
echo "short_open_tag=0" >> "./bin/php5/bin/php.ini"
echo "asp_tags=0" >> "./bin/php5/bin/php.ini"
echo "phar.readonly=0" >> "./bin/php5/bin/php.ini"
echo "phar.require_hash=1" >> "./bin/php5/bin/php.ini"
echo " done"
alldone=yes
else
echo " invalid build detected"
fi
fi
if [ "$alldone" == "no" ]; then
set -e
echo "[3/3] no build found, compiling PHP"
exec ./src/build/compile.sh
fi
fi
fi
echo "[INFO] Everything done! Run ./start.sh to start PocketMine-MP"
exit 0

View File

@ -1,213 +0,0 @@
#!/bin/bash -x
export PATH="/opt/arm-2013.05/bin:/opt/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin:/opt/arm-unknown-linux-uclibcgnueabi/bin:$PATH"
export THREADS=2
PHP_VERSION="5.5.10"
#Needed to use aliases
shopt -s expand_aliases
type wget > /dev/null 2>&1
if [ $? -eq 0 ]; then
alias download_file="wget --no-check-certificate -q -O -"
else
type curl >> /dev/null 2>&1
if [ $? -eq 0 ]; then
alias download_file="curl --insecure --silent --location"
else
echo "error, curl or wget not found"
fi
fi
rm -rf $WORKSPACE/compile.sh
download_file "https://github.com/PocketMine/PocketMine-MP/raw/master/src/build/compile.sh" > $WORKSPACE/compile.sh
chmod +x $WORKSPACE/compile.sh
SCRIPT="$WORKSPACE/compile.sh"
ARCHIVE="$WORKSPACE/archive"
COMPILEDIR="$WORKSPACE/compile"
rm -rf "$ARCHIVE" "$COMPILEDIR"
mkdir -p "$ARCHIVE"
mkdir -p "$COMPILEDIR"
if [ "$COMPILE_LINUX_32BIT" = "true" ];
then
mkdir -p {$COMPILEDIR,$ARCHIVE}/linux/32bit
cd $COMPILEDIR/linux/32bit
$SCRIPT -t linux32 -o -j 1 -c -f x86
tar -czf PHP_${PHP_VERSION}_x86_Linux.tar.gz bin/
cp -r $COMPILEDIR/linux/32bit/{install.log,PHP_${PHP_VERSION}_x86_Linux.tar.gz,install_data/*} $ARCHIVE/linux/32bit/
if [ ! -f $COMPILEDIR/linux/32bit/bin/php5/bin/php ]; then
exit 1
fi
fi
if [ "$COMPILE_LINUX_64BIT" = "true" ];
then
mkdir -p {$COMPILEDIR,$ARCHIVE}/linux/64bit
cd $COMPILEDIR/linux/64bit
$SCRIPT -t linux64 -o -j 1 -c -f x86_64
tar -czf PHP_${PHP_VERSION}_x86-64_Linux.tar.gz bin/
cp -r $COMPILEDIR/linux/64bit/{install.log,PHP_${PHP_VERSION}_x86-64_Linux.tar.gz,install_data/*} $ARCHIVE/linux/64bit/
if [ ! -f $COMPILEDIR/linux/64bit/bin/php5/bin/php ]; then
exit 1
fi
fi
if [ "$COMPILE_MAC_32" = "true" ];
then
mkdir -p {$COMPILEDIR,$ARCHIVE}/mac32
cd $COMPILEDIR/mac32
curl -L http://ftpmirror.gnu.org/libtool/libtool-2.4.2.tar.gz | tar -xz > /dev/null
cd libtool-2.4.2
./configure --prefix="$COMPILEDIR/mac/libtool" > /dev/null
make > /dev/null
make install
cd ../
rm -rf libtool-2.4.2
export LIBTOOL="$COMPILEDIR/mac/libtool/bin/libtool"
export LIBTOOLIZE="$COMPILEDIR/mac/libtool/bin/libtoolize"
$SCRIPT -t mac32 -o -j 1 -c -f
tar -czf PHP_${PHP_VERSION}_x86_MacOS.tar.gz bin/
cp -r $COMPILEDIR/mac32/{install.log,PHP_${PHP_VERSION}_x86_MacOS.tar.gz,install_data/*} $ARCHIVE/mac32/
if [ ! -f $COMPILEDIR/mac32/bin/php5/bin/php ]; then
exit 1
fi
fi
if [ "$COMPILE_MAC_64" = "true" ];
then
mkdir -p {$COMPILEDIR,$ARCHIVE}/mac64
cd $COMPILEDIR/mac64
curl -L http://ftpmirror.gnu.org/libtool/libtool-2.4.2.tar.gz | tar -xz > /dev/null
cd libtool-2.4.2
./configure --prefix="$COMPILEDIR/mac/libtool" > /dev/null
make > /dev/null
make install
cd ../
rm -rf libtool-2.4.2
export LIBTOOL="$COMPILEDIR/mac/libtool/bin/libtool"
export LIBTOOLIZE="$COMPILEDIR/mac/libtool/bin/libtoolize"
$SCRIPT -t mac64 -o -j 1 -c -f
tar -czf PHP_${PHP_VERSION}_x86-64_MacOS.tar.gz bin/
cp -r $COMPILEDIR/mac64/{install.log,PHP_${PHP_VERSION}_x86-64_MacOS.tar.gz,install_data/*} $ARCHIVE/mac64
if [ ! -f $COMPILEDIR/mac64/bin/php5/bin/php ]; then
exit 1
fi
fi
if [ "$COMPILE_RPI" = "true" ];
then
mkdir -p {$COMPILEDIR,$ARCHIVE}/rpi
cd $COMPILEDIR/rpi
$SCRIPT -t rpi -o -j 1 -c -f arm
tar -czf PHP_${PHP_VERSION}_ARM_Raspbian_hard.tar.gz bin/
cp -r $COMPILEDIR/rpi/{install.log,PHP_${PHP_VERSION}_ARM_Raspbian_hard.tar.gz,install_data/*} $ARCHIVE/rpi/
if [ ! -f $COMPILEDIR/rpi/bin/php5/bin/php ]; then
exit 1
fi
fi
if [ "$CROSSCOMPILE_ANDROID_ARMV6" = "true" ];
then
mkdir -p {$COMPILEDIR,$ARCHIVE}/crosscompile/android-armv6
cd $COMPILEDIR/crosscompile/android-armv6
$SCRIPT -t android-armv6 -o -j 1 -c -x -s -f arm
tar -czf PHP_${PHP_VERSION}_ARMv6_Android.tar.gz bin/
cp -r $COMPILEDIR/crosscompile/android-armv6/{install.log,PHP_${PHP_VERSION}_ARMv6_Android.tar.gz,install_data/*} $ARCHIVE/crosscompile/android-armv6/
if [ ! -f $COMPILEDIR/crosscompile/android-armv6/bin/php5/bin/php ]; then
exit 1
fi
fi
if [ "$CROSSCOMPILE_ANDROID_ARMV7" = "true" ];
then
mkdir -p {$COMPILEDIR,$ARCHIVE}/crosscompile/android-armv7
cd $COMPILEDIR/crosscompile/android-armv7
$SCRIPT -t android-armv7 -o -j 1 -c -x -s -f arm
tar -czf PHP_${PHP_VERSION}_ARMv7_Android.tar.gz bin/
cp -r $COMPILEDIR/crosscompile/android-armv7/{install.log,PHP_${PHP_VERSION}_ARMv7_Android.tar.gz,install_data/*} $ARCHIVE/crosscompile/android-armv7/
if [ ! -f $COMPILEDIR/crosscompile/android-armv7/bin/php5/bin/php ]; then
exit 1
fi
fi
if [ "$CROSSCOMPILE_IOS_ARMV6" = "true" ];
then
mkdir -p {$COMPILEDIR,$ARCHIVE}/crosscompile/ios-armv6
cd $COMPILEDIR/crosscompile/ios-armv6
curl -L http://ftpmirror.gnu.org/libtool/libtool-2.4.2.tar.gz | tar -xz > /dev/null
cd libtool-2.4.2
./configure --prefix="$COMPILEDIR/crosscompile/ios-armv6/libtool" > /dev/null
make > /dev/null
make install
cd ../
rm -rf libtool-2.4.2
export LIBTOOL="$COMPILEDIR/crosscompile/ios-armv6/libtool/bin/libtool"
export LIBTOOLIZE="$COMPILEDIR/crosscompile/ios-armv6/libtool/bin/libtoolize"
PATH="/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:$PATH" $SCRIPT -t ios-armv6 -o -j 1 -c -x
cp -r $COMPILEDIR/crosscompile/ios-armv6/{install.log,bin/*,install_data/*} $ARCHIVE/crosscompile/ios-armv6/
if [ ! -f $COMPILEDIR/crosscompile/ios-armv6/bin/php5/bin/php ]; then
exit 1
fi
fi
if [ "$CROSSCOMPILE_IOS_ARMV7" = "true" ];
then
mkdir -p {$COMPILEDIR,$ARCHIVE}/crosscompile/ios-armv7
cd $COMPILEDIR/crosscompile/ios-armv7
curl -L http://ftpmirror.gnu.org/libtool/libtool-2.4.2.tar.gz | tar -xz > /dev/null
cd libtool-2.4.2
./configure --prefix="$COMPILEDIR/crosscompile/ios-armv7/libtool" > /dev/null
make > /dev/null
make install
cd ../
rm -rf libtool-2.4.2
export LIBTOOL="$COMPILEDIR/crosscompile/ios-armv7/libtool/bin/libtool"
export LIBTOOLIZE="$COMPILEDIR/crosscompile/ios-armv7/libtool/bin/libtoolize"
PATH="/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:$PATH" $SCRIPT -t ios-armv6 -o -j 1 -c -x
cp -r $COMPILEDIR/crosscompile/ios-armv7/{install.log,bin/*,install_data/*} $ARCHIVE/crosscompile/ios-armv7/
if [ ! -f $COMPILEDIR/crosscompile/ios-armv7/bin/php5/bin/php ]; then
exit 1
fi
fi
if [ "$CROSSCOMPILE_RPI" = "true" ];
then
mkdir -p {$COMPILEDIR,$ARCHIVE}/crosscompile/rpi
cd $COMPILEDIR/crosscompile/rpi
$SCRIPT -t rpi -o -j 1 -c -x -f arm
tar -czf PHP_${PHP_VERSION}_ARM_Raspbian_hard.tar.gz bin/
cp -r $COMPILEDIR/crosscompile/rpi/{install.log,PHP_${PHP_VERSION}_ARM_Raspbian_hard.tar.gz,install_data/*} $ARCHIVE/crosscompile/rpi/
if [ ! -f $COMPILEDIR/crosscompile/rpi/bin/php5/bin/php ]; then
exit 1
fi
fi
if [ "$CROSSCOMPILE_MAC" = "true" ];
then
mkdir -p {$COMPILEDIR,$ARCHIVE}/crosscompile/mac
cd $COMPILEDIR/crosscompile/mac
$SCRIPT -t mac -o -j 1 -c -f -x
cp -r $COMPILEDIR/crosscompile/mac/{install.log,bin/*,install_data/*} $ARCHIVE/crosscompile/mac/
if [ ! -f $COMPILEDIR/crosscompile/mac/bin/php5/bin/php ]; then
exit 1
fi
fi

View File

@ -1,21 +0,0 @@
language_has_been_selected=وقد تم اختيار اللغة الإنجليزية بشكل صحيح.
skip_installer=هل تريد تخطي معالج الإعداد؟
welcome_to_pocketmine=مرحبا بكم في PocketMine-MP! \ nBefore بدء إعداد ملقم جديد لديك لقبول الترخيص. \ مرخص nPocketMine-MP تحت رخصة LGPL، \ n التي يمكنك أن تقرأ فتح ملف الترخيص على هذا folder.Do كنت ترغب في تخطي المعالج انشاء؟
accept_license=هل تقبل رخصة؟
you_have_to_accept_the_license=عليك أن تقبل رخصة LGPL إلى الاستمرار في استخدام PocketMine-MP
setting_up_server_now=أنت ذاهب لإعداد الخادم الخاص بك الآن.
default_values_info=إذا كنت لا تريد تغيير القيمة الافتراضية، فقط اضغط على Enter.
server_properties=يمكنك تحريرها في وقت لاحق على الملف server.properties.
name_your_server=إعطاء اسم على الخادم الخاص بك
port_warning=لا تقم بتغيير قيمة المنفذ الافتراضي إذا كان هذا هو الخادم الخاص بك أولا.
server_port=منفذ خادم
invalid_port=منفذ خادم غير صالحة
ram_warning=ذاكرة الوصول العشوائي هو الحد الأقصى لمقدار الذاكرة سوف تستخدم PocketMine-MP. ينصح قيمة 128-256 ميغا بايت
server_ram=RAM الخادم في ميغا بايت
gamemode_info=الاختيار بين العمل الإبداعي (1) أو البقاء على قيد الحياة (0)

View File

@ -1,6 +0,0 @@

View File

@ -1,45 +0,0 @@
language_has_been_selected=Englisch haben Sie richtig ausgewählt.
skip_installer=Möchten Sie den Setup-Assistenten überspringen?
welcome_to_pocketmine=Willkommen auf PocketMine-MP!\nBevor Sie die Einrichtung Ihres neuen Server starten, müssen Sie die Lizenz akzeptieren. \nPocketMine-MP ist unter der LGPL-Lizenz, \ndamit Sie die LIZENZ in diesem Ordner lesen oder öffnen können.
accept_license=Akzeptieren Sie die Lizenz?
you_have_to_accept_the_license=Sie müssen die LGPL Lizenz akzeptieren, um weiterhin PocketMine-MP zu nutzen
setting_up_server_now=Sie werden jetzt Ihren Server einrichten.
default_values_info=Wenn Sie nicht den Standardwert ändern möchten, drücken Sie einfach Enter.
server_properties=Sie können sie später in der server.properties Datei bearbeiten.
name_your_server=Geben Sie einen Namen für Ihren Server ein
port_warning=Ändern Sie den Standard-Port-Wert nicht, wenn dies Ihr erster Server ist.
server_port=Server-Port
invalid_port=Ungültiger Server-Port
ram_warning=Der RAM ist die maximale Speichermenge die PocketMine-MP verwenden kann. Ein Wert zwischen 128 bis 256 MB wird empfohlen
server_ram=Server RAM in MB
gamemode_info=Wählen Sie zwischen Kreativ (1) oder Überleben (0)
default_gamemode=Standard Spielmodus
max_players=Max. Online-Spieler
spawn_protection_info=Der Spawn-Schutz verbietet Platzierung/Zerstörung der Blöcke in der Einstiegszone, was aber nicht für OPs gilt
spawn_protection=Aktiviere Spawn-Schutz?
op_info=Ein OP ist der Admin Spieler des Servers. OPs können mehr Befehle ausführen als normale Spieler
op_who=OP Spieler Name (z.B. dein Spiel-Name)
op_warning=Sie werden in der Lage sein einen OP Benutzer später mit /op <player> hinzuzufügen
whitelist_info=Nur die Spieler auf der white-list können zu ihrem Spiel verbinden.
whitelist_enable=Möchten Sie die white-list aktivieren?
whitelist_warning=Sie müssen die Spieler zur white-list hinzufügen
query_warning1=Query ist ein Protokoll das von verschiedenen Tools verwendet wird, um Informationen von Ihrem Server und eingeloggten Spieler zu nehmen.
query_warning2=Wenn Sie es deaktivieren, werden Sie nicht in der Lage sein, Server-Listen zu verwenden.
query_disable=Wollen Sie Query deaktivieren?
rcon_info=RCON ist ein Protokoll für eine Remote-Verbindung mit der Server-Konsole, mit der Benutzung eines Passworts.
rcon_enable=Wollen Sie RCON aktivieren?
rcon_password=RCON Passwort (Sie können es später ändern)
usage_info=Die anonymen Nutzungsdaten ermöglichen es uns, globale Statistiken für PocketMine-MP und seine Plugins zu berechnen. Sie können sie auf stats.pocketmine.net ansehen
usage_disable=Wollen Sie die anonyme Nutzung deaktivieren?
ip_get=Bekomme deine externe IP und interne IP
ip_warning=Ihre externe IP ist {{EXTERNAL_IP}}. Evtl. musst Du einen port-forward auf deine interne IP {{INTERNAL_IP}} machen
ip_confirm=Achten Sie darauf, wenn Sie den Port forwarden müssen und Sie es überspringen, dass keine externen Spieler beitreten können. [Drücke Enter]
you_have_finished=Sie haben den Setup-Assistenten korrekt beendet
pocketmine_will_start=PocketMine-MP wird nun gestartet. Tippe /help um die Liste der verfügbaren Befehle anzuzeigen.
pocketmine_plugins=Überprüfen Sie das Plugin Repository um neue Features, Minispiele, oder einen erweiterten Schutz für Ihren Server hinzuzufügen

View File

@ -1,6 +0,0 @@

View File

@ -1,45 +0,0 @@
language_has_been_selected=English has been correctly selected.
skip_installer=Do you want to skip the set-up wizard?
welcome_to_pocketmine=Welcome to PocketMine-MP!\nBefore starting setting up your new server you have to accept the license.\nPocketMine-MP is licensed under the LGPL License,\nthat you can read opening the LICENSE file on this folder.
accept_license=Do you accept the License?
you_have_to_accept_the_license=You have to accept the LGPL license to continue using PocketMine-MP
setting_up_server_now=You are going to set up your server now.
default_values_info=If you don't want to change the default value, just press Enter.
server_properties=You can edit them later on the server.properties file.
name_your_server=Give a name to your server
port_warning=Do not change the default port value if this is your first server.
server_port=Server port
invalid_port=Invalid server port
ram_warning=The RAM is the maximum amount of memory PocketMine-MP will use. A value of 128-256 MB is recommended
server_ram=Server RAM in MB
gamemode_info=Choose between Creative (1) or Survival (0)
default_gamemode=Default Game mode
max_players=Max. online players
spawn_protection_info=The spawn protection disallows placing/breaking blocks in the spawn zone except for OPs
spawn_protection=Enable spawn protection?
op_info=An OP is the player admin of the server. OPs can run more commands than normal players
op_who=OP player name (example, your game name)
op_warning=You will be able to add an OP user later using /op <player>
whitelist_info=The white-list only allows players in it to join.
whitelist_enable=Do you want to enable the white-list?
whitelist_warning=You will have to add the players to the white-list
query_warning1=Query is a protocol used by diferent tools to get information of your server and players logged in.
query_warning2=If you disable it, you won't be able to use server lists.
query_disable=Do you want to disable Query?
rcon_info=RCON is a protocol to remote connect with the server console using a password.
rcon_enable=Do you want to enable RCON?
rcon_password=RCON password (you can change it later)
usage_info=The anonymous usage data allows us to calculate global statistics for PocketMine-MP and its plugins. You can view them on stats.pocketmine.net
usage_disable=Do you want to disable the anonymous usage?
ip_get=Getting your external IP and internal IP
ip_warning=Your external IP is {{EXTERNAL_IP}}. You may have to port-forward to your internal IP {{INTERNAL_IP}}
ip_confirm=Be sure to check it, if you have to forward and you skip that, no external players will be able to join. [Press Enter]
you_have_finished=You have finished the set-up wizard correctly
pocketmine_will_start=PocketMine-MP will now start. Type /help to view the list of available commands.
pocketmine_plugins=Check the Plugin Repository to add new features, minigames, or advanced protection to your server

View File

@ -1,45 +0,0 @@
language_has_been_selected=English has been correctly selected.
skip_installer=Do you want to skip the set-up wizard?
welcome_to_pocketmine=Welcome to PocketMine-MP!\nBefore starting setting up your new server you have to accept the license.\nPocketMine-MP is licensed under the LGPL License,\nthat you can read opening the LICENSE file on this folder.
accept_license=Do you accept the License?
you_have_to_accept_the_license=You have to accept the LGPL license to continue using PocketMine-MP
setting_up_server_now=You are going to set up your server now.
default_values_info=If you don't want to change the default value, just press Enter.
server_properties=You can edit them later on the server.properties file.
name_your_server=Give a name to your server
port_warning=Do not change the default port value if this is your first server.
server_port=Server port
invalid_port=Invalid server port
ram_warning=The RAM is the maximum amount of memory PocketMine-MP will use. A value of 128-256 MB is recommended
server_ram=Server RAM in MB
gamemode_info=Choose between Creative (1) or Survival (0)
default_gamemode=Default Game mode
max_players=Max. online players
spawn_protection_info=The spawn protection disallows placing/breaking blocks in the spawn zone except for OPs
spawn_protection=Enable spawn protection?
op_info=An OP is the player admin of the server. OPs can run more commands than normal players
op_who=OP player name (example, your game name)
op_warning=You will be able to add an OP user later using /op <player>
whitelist_info=The white-list only allows players in it to join.
whitelist_enable=Do you want to enable the white-list?
whitelist_warning=You will have to add the players to the white-list
query_warning1=Query is a protocol used by diferent tools to get information of your server and players logged in.
query_warning2=If you disable it, you won't be able to use server lists.
query_disable=Do you want to disable Query?
rcon_info=RCON is a protocol to remote connect with the server console using a password.
rcon_enable=Do you want to enable RCON?
rcon_password=RCON password (you can change it later)
usage_info=The anonymous usage data allows us to calculate global statistics for PocketMine-MP and its plugins. You can view them on stats.pocketmine.net
usage_disable=Do you want to disable the anonymous usage?
ip_get=Getting your external IP and internal IP
ip_warning=Your external IP is {{EXTERNAL_IP}}. You may have to port-forward to your internal IP {{INTERNAL_IP}}
ip_confirm=Be sure to check it, if you have to forward and you skip that, no external players will be able to join. [Press Enter]
you_have_finished=You have finished the set-up wizard correctly
pocketmine_will_start=PocketMine-MP will now start. Type /help to view the list of available commands.
pocketmine_plugins=Check the Plugin Repository to add new features, minigames, or advanced protection to your server

View File

@ -1,47 +0,0 @@
language_has_been_selected=English has been correctly selected.
skip_installer=Do you want to skip the set-up wizard?
welcome_to_pocketmine=Welcome to PocketMine-MP!\nBefore starting setting up your new server you have to accept the license.\nPocketMine-MP is licensed under the LGPL License,\nthat you can read opening the LICENSE file on this folder.
accept_license=Do you accept the License?
you_have_to_accept_the_license=You have to accept the LGPL license to continue using PocketMine-MP
setting_up_server_now=You are going to set up your server now.
default_values_info=If you don't want to change the default value, just press Enter.
server_properties=You can edit them later on the server.properties file.
name_your_server=Give your server a name
port_warning=Do not change the default port value if this is your first server.
server_port=Server port
invalid_port=Invalid server port
ram_warning=The RAM is the maximum amount of memory PocketMine-MP can use. A value of 128-256 MB is recommended
server_ram=Server RAM in MB
gamemode_info=Choose between Survival Mode (0), Creative Mode (1), or Adventure Mode (2)
default_gamemode=Default gamemode
max_players=Maximum online players at one time
spawn_protection_info=The spawn protection prevents the placing/breaking of blocks in the spawn area for all players with the exception of operators
spawn_protection=Enable spawn protection?
op_info=An 'op' is the admin of the server. Ops can run more commands than normal players (like /ban, etc.)
op_who=Operator player name (e.g. Steve)
op_warning=
You will be able to add an operators later using /op <player>
whitelist_info=When enabled, only players in the whitelist will have access to the server.
whitelist_enable=Do you want to enable the whitelist?
whitelist_warning=You will have to add the players to the whitelist
query_warning1=Query is a protocol used by different tools to obtain information about the server and the players logged in.
query_warning2=If you disable it, you won't be able to use server lists.
query_disable=Do you want to disable Query?
rcon_info=RCON is a protocol that allows remote connections with the server console using a password.
rcon_enable=Do you want to enable RCON?
rcon_password=RCON password (can be changed later)
usage_info=The anonymous usage data allows us to calculate global statistics for PocketMine-MP and its plugins. You can view them on stats.pocketmine.net
usage_disable=Do you want to disable the anonymous usage?
ip_get=Finding your external and internal IP adresses
ip_warning=Your current external IP is {{EXTERNAL_IP}}. In some cases, you may have to port-forward to your internal IP ({{INTERNAL_IP}})
ip_confirm=Be sure to check it, if you have to forward and you skip that, no external players will be able to join. [Press Enter]
you_have_finished=You have finished the set-up wizard correctly
pocketmine_will_start=PocketMine-MP will now start. Type /help to view the list of available commands.
pocketmine_plugins=Check the Plugin Repository to add new features, minigames, or advanced protection to your server

View File

@ -1,45 +0,0 @@
language_has_been_selected=English has been correctly selected.
skip_installer=Do you want to skip the set-up wizard?
welcome_to_pocketmine=Welcome to PocketMine-MP!\nBefore starting setting up your new server you have to accept the license.\nPocketMine-MP is licensed under the LGPL License,\nthat you can read opening the LICENSE file on this folder.
accept_license=Do you accept the License?
you_have_to_accept_the_license=You have to accept the LGPL license to continue using PocketMine-MP
setting_up_server_now=You are going to set up your server now.
default_values_info=If you don't want to change the default value, just press Enter.
server_properties=You can edit them later on the server.properties file.
name_your_server=Give a name to your server
port_warning=Do not change the default port value if this is your first server.
server_port=Server port
invalid_port=Invalid server port
ram_warning=The RAM is the maximum amount of memory PocketMine-MP will use. A value of 128-256 MB is recommended
server_ram=Server RAM in MB
gamemode_info=Choose between Creative (1) or Survival (0)
default_gamemode=Default Game mode
max_players=Max. online players
spawn_protection_info=The spawn protection disallows placing/breaking blocks in the spawn zone except for OPs
spawn_protection=Enable spawn protection?
op_info=An OP is the player admin of the server. OPs can run more commands than normal players
op_who=OP player name (example, your game name)
op_warning=You will be able to add an OP user later using /op <player>
whitelist_info=The white-list only allows players in it to join.
whitelist_enable=Do you want to enable the white-list?
whitelist_warning=You will have to add the players to the white-list
query_warning1=Query is a protocol used by diferent tools to get information of your server and players logged in.
query_warning2=If you disable it, you won't be able to use server lists.
query_disable=Do you want to disable Query?
rcon_info=RCON is a protocol to remote connect with the server console using a password.
rcon_enable=Do you want to enable RCON?
rcon_password=RCON password (you can change it later)
usage_info=The anonymous usage data allows us to calculate global statistics for PocketMine-MP and its plugins. You can view them on stats.pocketmine.net
usage_disable=Do you want to disable the anonymous usage?
ip_get=Getting your external IP and internal IP
ip_warning=Your external IP is {{EXTERNAL_IP}}. You may have to port-forward to your internal IP {{INTERNAL_IP}}
ip_confirm=Be sure to check it, if you have to forward and you skip that, no external players will be able to join. [Press Enter]
you_have_finished=You have finished the set-up wizard correctly
pocketmine_will_start=PocketMine-MP will now start. Type /help to view the list of available commands.
pocketmine_plugins=Check the Plugin Repository to add new features, minigames, or advanced protection to your server

View File

@ -1,45 +0,0 @@
language_has_been_selected=Español sido seleccionado correctamente.
skip_installer=¿Quieres saltarte el asistente de configuración?
welcome_to_pocketmine=Bienvenido a PocketMine-MP!\nAntes de comenzar a configurar tu nuevo servidor, tienes que aceptar la licencia.\nPocketMine-MP está licenciado con la licencia LGPL,\nque puedes leer abriendo el archivo LICENSE en esta carpeta.
accept_license=¿Aceptas la Licencia?
you_have_to_accept_the_license=Tienes que aceptar la licencia LGPL antes de continuar usando PocketMine-MP
setting_up_server_now=La configuración del servidor va a comenzar.
default_values_info=Si no quieres cambiar el valor por defecto, pulsa Enter.
server_properties=Puedes editar todo despues en el fichero server.properties.
name_your_server=Nombre del servidor
port_warning=No cambies el puerto por defecto si este es tu primer servidor.
server_port=Puerto del servidor
invalid_port=Puerto inválido
ram_warning=La RAM es la máxima memoria que PocketMine-MP usará. Es recomendado usar un valor de 128-256 MB
server_ram=RAM del servidor en MB
gamemode_info=Elige entre Creativo (1) o Supervivencia (0)
default_gamemode=Modo de juego por defecto
max_players=Límite de jugadores
spawn_protection_info=La protección del inicio bloquea poner/romper bloques en la zona de inicio, excepto los OPs
spawn_protection=¿Activar protección de inicio?
op_info=Un OP es el jugador administrador del servidor. Los OPs pueden usar más comandos que los jugadores normales
op_who=Jugador OP (por ejemplo, tu nombre de jugador)
op_warning=Podrás añadir mas OPs después usando /op <jugador>
whitelist_info=La lista blanca permite entrar únicamente a los jugadores en ella.
whitelist_enable=¿Quieres activar la lista blanca?
whitelist_warning=Tendrás que añadir los jugadores a la lista blanca
query_warning1=Query es un protocolo usado por diferentes herramientas para conseguir informacion de tu servidor y los jugadores conectados.
query_warning2=Si lo desactivas, no podrás usar listas de servidores.
query_disable=¿Quieres desactivar Query?
rcon_info=RCON es un protocolo que permite conectarte a la consola del servidor usando una contraseña.
rcon_enable=¿Queres activar RCON?
rcon_password=Contraseña RCON (puedes cambiarla después)
usage_info=Los datos de uso anónimos nos permiten calcular estadísticas globales para PocketMine-MP y sus plugins. Puedes verlas en stats.pocketmine.net
usage_disable=¿Quieres desactivar las datos de uso anónimos?
ip_get=Obteniendo tu IP externa e IP interna
ip_warning=Tu IP externa es {{EXTERNAL_IP}}. Quizás debas redireccionar el puerto a tu IP interna {{INTERNAL_IP}}
ip_confirm=Asegúrate de comprobarlo, ya que si debes hacerlo y lo saltas, ningún jugador externo podra entrar. [Pulsa Enter]
you_have_finished=Has completado el asistente de configuración correctamente
pocketmine_will_start=PocketMine-MP se iniciará ahora. Escribe /help para ver la lista de los comandos disponibles.
pocketmine_plugins=Ves al Repositorio de Plugins para añadir nuevas funcionalidades, minijuegos o protección avanzada a tu servidor

View File

@ -1,45 +0,0 @@
language_has_been_selected=Español sido seleccionado correctamente.
skip_installer=¿Quieres saltarte el asistente de configuración?
welcome_to_pocketmine=Bienvenido a PocketMine-MP!\nAntes de comenzar a configurar tu nuevo servidor, tienes que aceptar la licencia.\nPocketMine-MP está licenciado con la licencia LGPL,\nque puedes leer abriendo el archivo LICENSE en esta carpeta.
accept_license=¿Aceptas la Licencia?
you_have_to_accept_the_license=Tienes que aceptar la licencia LGPL antes de continuar usando PocketMine-MP
setting_up_server_now=La configuración del servidor va a comenzar.
default_values_info=Si no quieres cambiar el valor por defecto, pulsa Enter.
server_properties=Puedes editar todo despues en el fichero server.properties.
name_your_server=Nombre del servidor
port_warning=No cambies el puerto por defecto si este es tu primer servidor.
server_port=Puerto del servidor
invalid_port=Puerto inválido
ram_warning=La RAM es la máxima memoria que PocketMine-MP usará. Es recomendado usar un valor de 128-256 MB
server_ram=RAM del servidor en MB
gamemode_info=Elige entre Creativo (1) o Supervivencia (0)
default_gamemode=Modo de juego por defecto
max_players=Límite de jugadores
spawn_protection_info=La protección del inicio bloquea poner/romper bloques en la zona de inicio, excepto los OPs
spawn_protection=¿Activar protección de inicio?
op_info=Un OP es el jugador administrador del servidor. Los OPs pueden usar más comandos que los jugadores normales
op_who=Jugador OP (por ejemplo, tu nombre de jugador)
op_warning=Podrás añadir mas OPs después usando /op <jugador>
whitelist_info=La lista blanca permite entrar únicamente a los jugadores en ella.
whitelist_enable=¿Quieres activar la lista blanca?
whitelist_warning=Tendrás que añadir los jugadores a la lista blanca
query_warning1=Query es un protocolo usado por diferentes herramientas para conseguir informacion de tu servidor y los jugadores conectados.
query_warning2=Si lo desactivas, no podrás usar listas de servidores.
query_disable=¿Quieres desactivar Query?
rcon_info=RCON es un protocolo que permite conectarte a la consola del servidor usando una contraseña.
rcon_enable=¿Queres activar RCON?
rcon_password=Contraseña RCON (puedes cambiarla después)
usage_info=Los datos de uso anónimos nos permiten calcular estadísticas globales para PocketMine-MP y sus plugins. Puedes verlas en stats.pocketmine.net
usage_disable=¿Quieres desactivar las datos de uso anónimos?
ip_get=Obteniendo tu IP externa e IP interna
ip_warning=Tu IP externa es {{EXTERNAL_IP}}. Quizás debas redireccionar el puerto a tu IP interna {{INTERNAL_IP}}
ip_confirm=Asegúrate de comprobarlo, ya que si debes hacerlo y lo saltas, ningún jugador externo podra entrar. [Pulsa Enter]
you_have_finished=Has completado el asistente de configuración correctamente
pocketmine_will_start=PocketMine-MP se iniciará ahora. Escribe /help para ver la lista de los comandos disponibles.
pocketmine_plugins=Ves al Repositorio de Plugins para añadir nuevas funcionalidades, minijuegos o protección avanzada a tu servidor

View File

@ -1,45 +0,0 @@
language_has_been_selected=Español seleccionado.
skip_installer=Deseas omitir el asistente de configuración?
welcome_to_pocketmine=¡Bienvenido a PocketMine-MP!\nAntes de empezar a configurar tu nuevo servidor necesitas aceptar la licensia.\nLa licensia de PocketMine-MP esta bajo la licensia LGPL,\n que puedes leer abriendo el archivo "License" en esta carpeta.
accept_license=Aceptas la licensia?
you_have_to_accept_the_license=Debes aceptar la licensia de LPGL para continuar utilizando PocketMine-MP
setting_up_server_now=Empezemos con la configuración.
default_values_info=Si no quieres cambiar los valores predeterminados pulsa Enter.
server_properties=Puedes editarlos despues editando el archivo "server.properties".
name_your_server=Escribe el nombre de tu servidor
port_warning=No cambies el puerto predeterminado si este es tu primer servidor.
server_port=Puerto del servidor
invalid_port=Puerto invalido
ram_warning=La RAM es la máxima memoria que PocketMine-MP usará. Se recomienda utilizar un mínimo de 128 MB
server_ram=RAM del servidor en MB
gamemode_info=Escoge entre Creativo (1) o Survival (0)
default_gamemode=Modo de juego predeterminado
max_players=Límite de jugadores
spawn_protection_info=La protección del inicio impide poner/romper bloques en la zona de aparición, a excepción de los OPs
spawn_protection=Activar la protección del spawn?
op_info=Un OP es el administrador del servidor. Los OPs pueden ejecutar más comandos que los usuarios normales
op_who=OP nombre del jugador (Por ejemplo: Tu nombre de Minecraft)
op_warning=Podrás añadir más usuarios a la lista de OPs después, utilizando el comando /op <player>
whitelist_info=La lista blanca (white-list) permite hacer una lista de invitados, solo los usuarios en la lista podrán entrar a tu servidor.
whitelist_enable=¿Deseas activar la lista blanca?
whitelist_warning=Tendrás que añadir usuarios a la lista blanca
query_warning1=Query es un protocolo usado por diferentes herramientas para conseguir informacion de tu servidor y los jugadores conectados.
query_warning2=Si lo desactivas, no podrás registrar tu servidor en una lista de servidores.
query_disable=¿Quieres desactivar Query?
rcon_info=RCON es un protocolo que te permite conectarte a la consola de tu servidor usando una contraseña.
rcon_enable=¿Queres activar RCON?
rcon_password=Contraseña para RCON (puedes cambiarla después)
usage_info=Los datos de uso anónimos nos permiten calcular estadísticas globales para PocketMine-MP y sus plugins. Puedes verlas en stats.pocketmine.net
usage_disable=¿Quieres desactivar las datos de uso anónimos?
ip_get=Obteniendo tu IP externa e IP interna
ip_warning=Tu IP externa es {{EXTERNAL_IP}}. Quizás debas redireccionar el puerto a tu IP interna: {{INTERNAL_IP}}
ip_confirm=Asegúrate de que este bien, ya que si debes hacerlo y lo saltas, ningún jugador podrá entrar si esta fuera de tu red WIFI. [Pulsa Enter]
you_have_finished=Has completado el asistente de configuración correctamente
pocketmine_will_start=PocketMine-MP se iniciará ahora. Escribe /help para ver la lista de los comandos disponibles.
pocketmine_plugins=Ve al Repositorio de Plugins para añadir nuevas funciones, minijuegos o protección avanzada a tu servidor

View File

@ -1,7 +0,0 @@
default_gamemode=Normaali Peli Tila

View File

@ -1,45 +0,0 @@
language_has_been_selected=Français a été correctement sélectionné.
skip_installer=Voulez-vous passer l'assistant d'installation?
welcome_to_pocketmine=Bienvenue sur PocketMine-MP!\nAvant de commencer à paramétrer votre nouveau serveur, vous devez accepter la license d'utilisation.\nPocketMine-MP est sous licence LGPL,\nvous pouvez la lire en ouvrant le fichier LICENSE dans ce dossier.
accept_license=Acceptez-vous la Licence?
you_have_to_accept_the_license=Vous devez accepter la licence LGPL pour continuer à utiliser PocketMine-MP
setting_up_server_now=Vous êtes maintenant prêt à paramétrer votre serveur.
default_values_info=Si vous ne voulez pas changer la valeur par défaut, pressez juste Enter.
server_properties=Vous pouvez éditer cela plus tard dans le fichier server.properties.
name_your_server=Donnez un nom à votre serveur
port_warning=Ne changez pas la valeur par défaut du port si c'est votre premier serveur.
server_port=Port du serveur
invalid_port=Port du serveur invalide
ram_warning=La RAM est au maximum de sa capacité par rapport à la mémoire utilisée par PocketMine-MP. Une valeur de 128-256 MB est recommandée
server_ram=RAM du serveur en MB
gamemode_info=Choisir entre Créatif (1) ou Survie (1)
default_gamemode=Mode de jeu par défaut
max_players=Joueurs max. en ligne
spawn_protection_info=La protection de spawn désactive le placement/cassement de blocs dans la zone de spawn excepté pour les OPs
spawn_protection=Activer la protection de spawn?
op_info=Un OP est un administrateur du serveur. Les OPs peuvent exécuter plus de commandes que les joueurs normaux
op_who=Nom de joueur OP (exemple, votre nom de jeu)
op_warning=Vous serez en mesure d'ajouter un OP plus tard en utilisant /op <player>
whitelist_info=La white-list autorise seulement les joueurs présents sur celle-ci.
whitelist_enable=Voulez-vous activer la white-list?
whitelist_warning=Vous devrez ajouter les joueurs à la white-list
query_warning1=Query est un protocole utilisé par différents outils pour avoir des informations sur votre serveur et les joueurs connectés.
query_warning2=Si vous le désactivez, vous ne pourrez pas utiliser les listes du serveur.
query_disable=Voulez-vous désactiver Query?
rcon_info=RCON est un protocole pour se connecter à distance à la console du serveur par un mot de passe.
rcon_enable=Voulez-vous activer RCON?
rcon_password=Mot de passe RCON (vous pouvez le changer plus tard)
usage_info=Les données d'utilisation anonyme vous permettent de calculer les statistiques globales de PocketMine-MP et ses plugins. Vous pouvez les voir sur stats.pocketmine.net
usage_disable=Voulez-vous désactiver l'utilisation anonyme?
ip_get=Obtention de votre IP externe et IP interne
ip_warning=Votre IP externe est {{EXTERNAL_IP}}. Vous pourriez avoir à transmettre au port votre IP interne {{INTERNAL_IP}}
ip_confirm=Vérifiez-le bien, si vous avancez et sautez cette étape, les joueurs extérieurs ne pourront pas rejoindre votre serveur. [Tapez Enter]
you_have_finished=Vous avez correctement terminé l'assistant d'installation
pocketmine_will_start=PocketMine-MP démarre. Tapez /help pour voir la liste des commandes disponibles.
pocketmine_plugins=Vérification du répertoire de plugin pour ajouter des nouvelles caractéristiques, mini-jeux, ou une protection avancée de votre serveur

View File

@ -1,45 +0,0 @@
language_has_been_selected=Italiano selezionato correttamente.
skip_installer=Vuoi evitare il programma di installazione?
welcome_to_pocketmine=Benvenuto in PocketMine-MP!\nPrima di iniziare a impostare il tuo nuovo server devi accettare la licenza.\nPocketMine-MP è distribuito sotto licenza LGPL,\nche potrai leggere aprendo il file LICNESE in questa cartella.
accept_license=Accetti i termini della licenza?
you_have_to_accept_the_license=Devi accettare i termini della licenza LGPL per continuare ad usare PocketMine-MP
setting_up_server_now=Stai per iniziare ad impostare il tuo server.
default_values_info=Se non vuoi cambiare i valori proposti, premi Invio.
server_properties=Potrai modificarli in seguito nel file server.properties.
name_your_server=Dai un nome al tuo server
port_warning=Non cambiare la porta predefinita se questo è il tuo primo server.
server_port=Porta del server
invalid_port=Porta del server non valida
ram_warning=La RAM è la massima quantità di memoria che PocketMine-MP potrà usare. Un valore di 128-256 MB è raccomandata
server_ram=RAM del server in MB
gamemode_info=Scegli tra Creative (1) o Survival (0)
default_gamemode=Modalità di gioco predefinita
max_players=Players massimi
spawn_protection_info=La protezione dello spawn non permette di piazzare/rompere blocchi nella zona di spawn, ad eccezione degli Operatori
spawn_protection=Abilitare la protezione dello spawn?
op_info=Un Operatore (OP) è un player amministratore del server. Gli operatori possono usare più comandi dei players normali
op_who=Nome del player OP (ad esempio, il tuo nome in gioco)
op_warning=Sarà possibile aggiungere un player OP più tardi con /op <player>
whitelist_info=La white-list permette solo ad i players in lista di entrare.
whitelist_enable=Vuoi abilitare la white-list?
whitelist_warning=Dovrai aggiungere i players in white-list
query_warning1=Query è un protocollo usato da differenti programmi per ottenere informazioni dal tuo server e dai player che ci entrano.
query_warning2=Se lo disabiliti, non sarai in grado di usare le liste server.
query_disable=Vuoi disabilitare Query?
rcon_info=RCON è un protocollo per connessioni remote con la console del server grazie all'utilizzo di una password.
rcon_enable=Vuoi abilitare RCON?
rcon_password=Password RCON (potrai cambiarla più tardi)
usage_info=L'invio anonimo dei dati di utilizzo ci aiuta a calcolare statistiche generali per PocketMine-MP ed i suoi plugins. Puoi vederle su stats.pocketmine.net
usage_disable=Vuoi disabilitare l'invio anonimo dei dati di utilizzo?
ip_get=Ottengo il tuo indirizzo IP interno ed esterno
ip_warning=Il tuo indirizzo IP è {{EXTERNAL_IP}}. Potresti dover redirigere le porte al tuo IP interno: {{INTERNAL_IP}}
ip_confirm=Sii sicuro di farlo, se devi redirigere le porte e non lo fai, nessun player esterno sarà in grado di entrare. [Premi Invio]
you_have_finished=Hai completato l'installazione con successo
pocketmine_will_start=Ora PocketMine-MP si avvierà. Digita /help per visualizzare la lista dei comandi disponibili.
pocketmine_plugins=Controlla il Repository dei Plugins per aggiungere nuove funzionalità, minigiochi, o protezioni avanzate al tuo server

View File

@ -1,45 +0,0 @@
language_has_been_selected=日本語に設定されました
skip_installer=セットアップウィザードをスキップしますか?
welcome_to_pocketmine=PocketMine-MPをインストールして頂きありがとうございますサーバのセットアップを開始するにはライセンスに同意する必要があります。PocketMine-MPはLGPLライセンスに基づいて認可されており、これについてはこのフォルダ内のLICENSEファイルから確認することができます。
accept_license=ライセンスに同意しますか?
you_have_to_accept_the_license=PocketMine-MPを使用するにはLGPLライセンスに同意する必要があります
setting_up_server_now=サーバのセットアップを開始します
default_values_info=設定を変更しない場合は、Enterキーを押してください。
server_properties=それらの設定は後からでもserver.propertiesファイルから変更できます
name_your_server=あなたのサーバに名前を付けてください
port_warning=これが初めてのサーバの場合は、ポート番号をデフォルトから変更しないでください
server_port=サーバポート
invalid_port=不適切なサーバポートです
ram_warning=RAMはPocketMine-MPが使用し得るメモリの最大値を示しています。128-256MBの範囲内で指定することを推奨します。
server_ram=RAMの単位はMBです
gamemode_info=クリエイティブモード(1)、またはサバイバルモード(0)を選択してください
default_gamemode=デフォルトのゲームモード
max_players=最大プレイヤー数
spawn_protection_info=スポーンプロテクションは、OPでないプレイヤーによるスポーン地点付近でのブロックの設置/破壊を制限します
spawn_protection=スポーンプロテクションを有効にしますか?
op_info=OPとはそのサーバの管理権限を指します。OPを持ったプレイヤーは他のプレイヤーよりも多くのコマンドを使用できます。
op_who=OPプレイヤー名(例: あなたのゲーム内での名前)
op_warning=後から/op <プレイヤー名>コマンドを実行してOPプレイヤーを追加することもできます
whitelist_info=ホワイトリストはこのサーバに入ることのできるプレイヤーを制限します。
whitelist_enable=ホワイトリストを有効にしますか?
whitelist_warning=プレイヤーをホワイトリストに追加してください
query_warning1=クエリは他のツールによりあなたのサーバやプレイヤーの情報を取得するためのプロトコルです。
query_warning2=それを無効にした場合、サーバリストを使用できなくなる可能性があります。
query_disable=クエリを無効にしますか?
rcon_info=RCONはパスワードを用いてサーバコンソールからリモート接続するためのプロトコルです。
rcon_enable=RCONを有効にしますか
rcon_password=RCONパスワード(後から変更できます)
usage_info=世界中で使われているPocketMine-MPやそのプラグインの統計を算出するために匿名の使用データが送信されます。統計はこちらから確認できます。stats.pocketmine.net
usage_disable=匿名の使用データの送信を拒否しますか?
ip_get=グローバルIPとプライベートIPの取得
ip_warning=あなたのグローバルIPは{{EXTERNAL_IP}}です。プライベートIP{{INTERNAL_IP}}をポート解放してください。
ip_confirm=必ずポート解放ができているか確認してください。ポートが解放できていなかった場合、他のプレイヤーがサーバに入れなくなる恐れがあります。[Enterキーを押してください]
you_have_finished=セットアップは正しく終了しました
pocketmine_will_start=PocketMine_MPを起動します。/helpと入力すれば使用可能なコマンド一覧を表示できます。
pocketmine_plugins=拡張機能や管理システム、ミニゲームなどを追加できるプラグインリポジトリも確認してみてください

View File

@ -1,45 +0,0 @@
language_has_been_selected=한국어가 언어로 선택되었습니다.
skip_installer=설치 마법사를 건너뛰겠습니까?
welcome_to_pocketmine=PocketMine-MP에 오신 것을 환영합니다!\n서버 설치를 시작하기 전, 약관에 동의해야 합니다. \nPocketMine-MP는 GNU 약소 일반 공중 사용 허가서(LGPL) 하에 배포되고 있습니다. \n이 폴더에서 약관을 읽을 수 있습니다.
accept_license=약관에 동의하십니까?
you_have_to_accept_the_license=GNU 약소 일반 공중 사용 허가서(LGPL)에 동의하셔야 PocketMine-MP를 사용할 수 있습니다.
setting_up_server_now=서버 설정을 시작합니다.
default_values_info=기본값을 수정하고 싶지 않으면, 엔터를 누르십시기 바랍니다.
server_properties=이 설정들은 server.properties 파일에서 세부적으로 변경이 가능합니다.
name_your_server=당신의 서버 이름을 입력하시기 바랍니다.
port_warning=만약 당신이 서버를 처음 설정한다면 포트 값을 변경하지 마세요.
server_port=서버 포트
invalid_port=서버 포트가 잘못 입력되었습니다.
ram_warning=RAM 값은 PocketMine-MP에 할당할 메모리의 크기입니다. 128~256MB를 권장합니다.
server_ram=서버의 램(RAM) (MB)
gamemode_info=크리에이티브 (1) 또는 서바이벌 (0) 게임모드 중 하나를 고르세요.
default_gamemode=기본 게임 모드
max_players=최대 동시접속 인원 수
spawn_protection_info=스폰 보호는 OP를 제외한 유저들이 스폰 지역 근처에서 블럭을 놓거나 부수는것을 방지합니다.
spawn_protection=스폰 지역 보호를 사용하겠습니까?
op_info=OP는 서버 관리자를 뜻합니다. OP는 일반 플레이어보다 훨씬 많은 명령어들을 사용할 수 있습니다
op_who=OP 권한을 줄 플레이어 이름(예: 당신의 닉네임)
op_warning=또는 이후에 /op <플레이어 이름> 을 입력해 그 유저에게 OP 권한을 줄 수도 있습니다
whitelist_info=화이트리스트를 사용하면 허용된 플레이어들만 서버에 접속할 수 있습니다.
whitelist_enable=화이트리스트를 사용하겠습니까?
whitelist_warning=당신은 접속을 허용할 플레이어들의 이름을 적어야 합니다
query_warning1=쿼리 (Query)는 당신의 서버와 현재 접속한 플레이어들의 정보를 알 수 있게 해주는 여러가지 기능이 담긴 프로토콜입니다.
query_warning2=쿼리를 사용하지 않으면, 당신은 서버 리스트를 사용할 수 없게 됩니다.
query_disable=쿼리를 사용하지 않겠습니까?
rcon_info=RCON은 비밀 번호를 사용하여 서버 명령창에 원격으로 접소갈 수 있는 프로토콜입니다.
rcon_enable=RCON 을 사용하시겠습니까?
rcon_password=RCON 비밀번호 설정 (나중에 server.properties 에서 변경이 가능합니다.)
usage_info=익명 사용 통계 전송을 허용하면 PocketMine-MP가 세계의 서버 상황과 플러그인들을 통계화하는 데 사용할 수 있습니다. 당신은 stats.pocketmine.net에서 이를 확인할 수 있습니다
usage_disable=익명 사용 통계 전송을 사용하지 않으시겠습니까?
ip_get=내/외부 IP 주소 얻기
ip_warning=당신의 외부 IP는 {{EXTERNAL_IP}}입니다. 당신의 내부 IP {{INTERNAL_IP}}로 포트포워딩이 필요할 수 있습니다
ip_confirm=신중하게 확인하세요. 만약 포트 포워딩이 필요하지만 하지 않을 경우 외부에서 플레이어들이 접속할 수 없게 됩니다. [계속 하시려면 엔터를 누르세요]
you_have_finished=PocketMine-MP의 설치가 모두 완료되었습니다.
pocketmine_will_start=PocketMine-MP 서버를 구동합니다. /help로 사용 가능한 모든 명령어의 목록을 보시기 바랍니다.
pocketmine_plugins=플러그인 저장소에서 새로운 기능을 추가하세요. 새로운 기능, 미니게임을 추가하거나 고급 기능으로 당신의 서버를 보호할 수 있습니다

View File

@ -1,6 +0,0 @@

View File

@ -1,45 +0,0 @@
language_has_been_selected=Nederlands is nu geselecteerd.
skip_installer=Wil je de set-up help overslaan?
welcome_to_pocketmine=Welkom op de PocketMine-MP!\nVoordat je je nieuwe server klaarmaakt, moet je onze gebruikersovereenkomst accepteren.\nPocketMine-MP is gelicenseerd onder LGPL License,\nwat je kunt lezen door de LICENSE file in deze map te openen.
accept_license=Accepteer je de gebruikersvoorwaarden?
you_have_to_accept_the_license=Je moet de LGPL gebruikersvoorwaarden accepteren voordat je verder gaat met het gebruiken van de services van PocketMine-MP
setting_up_server_now=Je gaat nu een server klaarmaken voor gebruik.
default_values_info=Druk op Enter als je de gebruikelijke waarde niet wilt veranderen.
server_properties=Je kunt ze later veranderen in het server.properties bestand.
name_your_server=Geef een naam aan je server
port_warning=Verander de gebruikelijke poort niet als dit je eerste server is.
server_port=Server poort
invalid_port=Ongeldige server poort
ram_warning=De RAM is het maximale aantal memory wat PocketMine-MP zal gebruiken. Een aantal tussen de 128 en de 256 MB is aanbevolen
server_ram=Server RAM in MB
gamemode_info=Kies tussen Creative (1) of Survival (0)
default_gamemode=Gebruikelijke spelmodus
max_players=Maximale online spelers
spawn_protection_info=De spawnbeveiliging verbiedt het plaatsen/slopen van blokken in het spawn gebied behalve voor OP's
spawn_protection=Wil je spawnbeveiliging aanzetten?
op_info=Een OP is de beheerder van de server. OP's kunnen meer commando's gebruiken dan normale spelers
op_who=OP speler naam (voorbeeld: je username)
op_warning=Je kunt later meerdere OP's toevoegen met het commando /op <player>
whitelist_info=De whitelist laat alleen de spelers die in de lijst staan op de server.
whitelist_enable=Wil je de whitelist aanzetten?
whitelist_warning=Je moet wel spelers aan de whitelist toevoegen.
query_warning1=Query is een protocol dat gebruikt wordt door verschillende programma's om informatie te verkrijgen van je server en welke spelers ingelogd zijn.
query_warning2=Als je het uitzet, zul je geen mogelijkheid hebben om server lijsten te gebruiken.
query_disable=Wil je Query uitschakelen?
rcon_info=RCON is een protocol om je server op afstand te beheren via de server console door middel van een wachtwoord.
rcon_enable=Wil je RCON aanzetten?
rcon_password=RCON wachtwoord (deze kun je later veranderen)
usage_info=De anonieme gebruikersdata laat ons toe om de globale statistieken voor PocketMine-ML te zien en zijn plugins. Je kunt de statistieken zien op stats.pocketmine.net
usage_disable=Wil je anonieme data uitschakelen?
ip_get=Je externe IP en interne IP verkrijgen
ip_warning=Je externe IP is {{EXTERNAL_IP}}. Het is mogelijk dat je moet port-forwarden naar je interne IP:{{INTERNAL_IP}}
ip_confirm=Wees niet bang om het te controleren, als je moet port-forwarden en je slaat dit over, kunnen externe spelers niet op de server.
you_have_finished=Je hebt de set-up help volledig beëindigd.
pocketmine_will_start=PocketMine-MP zal nu opstarten. Type /help om de lijst van beschikbare commando's te weergeven.
pocketmine_plugins=Check de Plugin Opslag om nieuwe features, minigames of geavanceerde spawnbeveiliging toe te voegen aan je server

View File

@ -1,45 +0,0 @@
language_has_been_selected=Norsk har blitt valgt.
skip_installer=Vil du hoppe over installasjons veiviseren?
welcome_to_pocketmine=Velkommen til PocketMine-MP!\nFør vi starter med å sette opp din nye server må du akseptere vår lisens.\nPocketMine-MP er lisensiert under LGPL lisensen,\nat du kan lese LISENS filen i denne mappen.
accept_license=Aksepterer du lisensen?
you_have_to_accept_the_license=Du må akseptere LGPL lisensen for å fortsette med å bruke PocketMine-MP
setting_up_server_now=Nå skal du sette opp din server.
default_values_info=Hvis du ikke vil gjøre forskjell med den ordinære verdien, så trenger du bare å trykke Enter.
server_properties=Du kan redigere dem senere i server.properties filen.
name_your_server=Gi et navn til din server
port_warning=Ikke bytt på den vanlige port verdien vis dette er din første server.
server_port=Server port
invalid_port=Ugyldig server port
ram_warning=RAMMEN er den maksimale beløpet PocketMine-MP vil bruke. A verdien av 128-256 MB er anbefalt
server_ram=Server RAMMEN i MB
gamemode_info=Velg mellom Kreativ (1) eller Overlevelse (0)
default_gamemode=Standard spill modus
max_players=Maks online spillere
spawn_protection_info=Spawn-beskyttelsen deaktiverer plassering/ødeleggelse av blokker i spawn sonen bortsett fra for Operatører
spawn_protection=Aktiver spawn-beskyttelse?
op_info=En Operatør er en administrator spiller av serveren. Operatører kan bruke mer kommandoer enn vanlige spillere
op_who=Operatør spiller navn (eksempel, ditt spill-navn)
op_warning=Du vil ha muligheten til å legge til en Operatør bruker senere med /op <spiller>
whitelist_info=Hvitelisten tillater bare brukere som er i den å bli med.
whitelist_enable=Vil du aktivere hvitelisten?
whitelist_warning=Du må legge til spillere til hvitelisten
query_warning1=Query er en protokoll brukt av forskjellige verktøy for å få informasjon fra din server og spillere som er logget inn.
query_warning2=Hvis du deaktiverer det, kan du ikke bruke server lister.
query_disable=Vil du deaktivere Query?
rcon_info=RCON er en protokoll for ekstern kobling til server konsollen med et passord.
rcon_enable=Vil du aktivere RCON?
rcon_password=RCON passord (du kan endre det senere)
usage_info=Den anonyme bruksdata gir oss mulighet til å kalkulere global statistikk for PocketMine-MP og dens utvidelser. Du kan se dette på stats.pocketmine.net
usage_disable=Vil du deaktivere den anonyme bruksdata?
ip_get=Henter din eksterne IP og interne IP
ip_warning=Din eksterne IP er {{EXTERNAL_IP}}. Du må kanskje port forwarde til din interne IP {{INTERNAL_IP}}
ip_confirm=Pass på å sjekke det, hvis du må port forwarde og du skipper det, kan ingen eksterne spillere koble til serveren. [Trykk på Enter]
you_have_finished=Du er nå klar. Alt har blitt gjort korrekt
pocketmine_will_start=PocketMine-MP vil nå starte. Skriv /help for å se en liste av alle tilgjengelige kommandoer.
pocketmine_plugins=Sjekk utvidelse depotet for å legge til nye funksjoner, minispill, eller avansert beskyttelse for din server

View File

@ -1,6 +0,0 @@

View File

@ -1,45 +0,0 @@
language_has_been_selected=Был выбран русский язык.
skip_installer=Вы хотите пропустить мастер настройки?
welcome_to_pocketmine=Добро пожаловать в PocketMine-MP!\nПеред началом установки нового сервера, вы должны согласиться с лицензией. \nPocketMine-MP лицензировано на условиях LGPL лицензии, \nс которой вы можете ознакомиться, открыв файл LICENSE в этой папке.
accept_license=Принимаете ли вы лицензию?
you_have_to_accept_the_license=Вы должны принять LGPL лицензию, чтобы продолжить использование PocketMine-MP
setting_up_server_now=Теперь вы можете настроить сервер.
default_values_info=Если вы не хотите изменять стандартное значение, просто нажмите Enter.
server_properties=Вы можете редактировать их позже в файле server.properties.
name_your_server=Дайте имя вашему серверу
port_warning=Не изменяйте значение порта по умолчанию, если это ваш первый сервер.
server_port=Порт сервера
invalid_port=Неверный порт сервера
ram_warning=RAM - максимальный объем памяти, котооый будет использовать PocketMine-MP, рекомендуемое значение 128-256 МБ
server_ram=Оперативная память сервера в МБ
gamemode_info=Выберите между Креативом-(1), или Выживанием (0)
default_gamemode=Режим игры по умолчанию
max_players=Максимум онлайн игроков
spawn_protection_info=Защита спавна запрещает размещение/разрушение блоков на спавне, за исключением операторов
spawn_protection=Включить защиту спавна?
op_info=Оператор - Администратор сервера, который может использовать больше команд, чем обычный игрок
op_who=Имя оператора (К примеру ваш ник в игре)
op_warning=Вы можете добавить оператора позже используя команду /op <player>
whitelist_info=White-list позволяет присоединиться только игрокам в этом списке.
whitelist_enable=Вы хотите включить white-list?
whitelist_warning=Вам придётся добавить игроков в white-list
query_warning1=Query это протокол, используемый разными инструментами, чтобы получить информацию о вашем сервере и о зашедших игроках.
query_warning2=Если вы отключите его, вы не сможете использовать списки серверов.
query_disable=Вы хотите отключить Query?
rcon_info=RCON - это протокол для удаленного управления сервером через консоль, с использованием пароля.
rcon_enable=Вы хотите включить RCON?
rcon_password=RCON пароль (вы сможете изменить его позже)
usage_info=Сбор анонимных данных о использовании поможет нам проанализировать глобальную статистику для PocketMine-MP и плагинов. Статистика доступна по адресу stats.pocketmine.net
usage_disable=Вы хотите отключить сбор анонимных данных о использовании?
ip_get=Получение вашего внешнего и внутреннего IP адреса
ip_warning=Ваш внешний IP адрес: {{EXTERNAL_IP}}. Возможно вам необходимо открыть порты к вашему внутреннему IP адресу: {{INTERNAL_IP}}
ip_confirm=Убедитесь в том, что вы открыли порты, в противном случае игроки вне вашей локальной сети не смогут подключится. [Нажмите Enter]
you_have_finished=Вы закончили работу с мастером установки
pocketmine_will_start=PocketMine-MP сейчас запустится. Введите /help для просмотра доступных вам команд.
pocketmine_plugins=Посетите репозиторий плагинов для получения новых функций, мини-игр, или повышения защиты вашего сервера

View File

@ -1,45 +0,0 @@
language_has_been_selected=Svenska har bilvit valt.
skip_installer=Vill du hoppa över Installations programmet?
welcome_to_pocketmine=Välkommen till PocketMine-MP! Före du börja ställa in din server måste du godkänna licensen. PocketMIne-MP är licenserat under LGPL Licensen som du kan läsa genom att öppna LICENSE filen i den här mappen.
accept_license=Accepterar du Licensen?
you_have_to_accept_the_license=Du måste godkänna LGPL licensen för att fortsätta använda PocketMine-MP
setting_up_server_now=Du håller på att börja ställa in din server nu.
default_values_info=Om du inte vill ändra standard värdet, tryck bara ENTER.
server_properties=Du kan redigera dem senare i server.properies filen.
name_your_server=Ge ett namn till din server
port_warning=ändra INTE standard porten om detta är din första server.
server_port=Server port
invalid_port=Ogiltig Server port
ram_warning=RAM är max mängden minne PocketMine-MP kommer använda. Ett väre av 128-256 MB är rekommenderat
server_ram=Server RAM i MB
gamemode_info=Välj mellan Kreativt läge (1) eller Överlevnad (0)
default_gamemode=Standard spelläge
max_players=Max spelare online
spawn_protection_info=Spawn skydd stoppar spelare från att bygga / krossa block i Spawn-zonen förutom för OPs
spawn_protection=Aktivera Spawn-skydd?
op_info=En OP är en spelar Administratör på servern. OPs kan köra fler kommandon än vanliga spelare
op_who=OP spelar namn (Ditt IGN här)
op_warning=Du kommer kunna lägga till fler OPs senare me /op <spelare>
whitelist_info=whitelisten är en lista på spelare som får komma in på servern.
whitelist_enable=Vill du aktivera whitelisten?
whitelist_warning=Du måste i så fall lägga till spelare på whitelisten
query_warning1=Query är ett protokoll som används av olika verktyg för att samla in information om din server och spelare loggade in.
query_warning2=Om du stänger av den så kommer du inte kunna använda serverlistor.
query_disable=Vill du stänga av Query?
rcon_info=RCON är ett protocol för att trådlöst ansluta till server konsolen med ett lösenord.
rcon_enable=Vill du aktivera RCON?
rcon_password=RCON lösenord (kan bytas senare)
usage_info=Anonym data användning tillåter oss att räkna ut global statistik för PocketMine-MP och dess plugin. Du kan se dessa på stats.pocketmine.net
usage_disable=Vill du stänga av anonym data använding?
ip_get=Hämtar din externa IP och interna IP
ip_warning=Din externa Ip är {{EXTERNAL_IP}}} Du kan behöva göra en "port-foward" till din Interna IP {{INTERNAL_IP}}
ip_confirm=Var säker på att du kollar den. Om du måste göra en "port-foward" men skippar det så kommer inga externa spelare att kunna logga in på din server. [Tryck på ENTER]
you_have_finished=Du är nu klar. Allt har genomförts korrekt
pocketmine_will_start=Din Server kommer nu att starta. skriv /help eller /? för en list på tillgängliga kommandon.
pocketmine_plugins=Kolla in Plugin Hemsidan för att lägga till nya saker till din server, minispel, eller avancerat skydd

View File

@ -1,45 +0,0 @@
language_has_been_selected=İngilizce başarıyla seçildi.
skip_installer=Kurulum yazılımını atlamak istiyormusunuz?
welcome_to_pocketmine=PocketMine-MP dünyasına hoşgeldin.\nYeni sunucunu ayarlamaya başlamadan önce lisans sözleşmesini kabul etmelisin.\nPocketMine-MP LGPL Linsansı altında lisanslıdır,\nBu klasörden LİSANS dosyasınııp okuyabilirsin.
accept_license=Lisans sözleşmesini kabul ediyor musunuz?
you_have_to_accept_the_license=PocketMine-MP'yi kullanabilmeniz için LGPL lisansını kabul etmeniz gereklidir
setting_up_server_now=Sunucunuz şimdi kurulacak, Devam edilsin mi?
default_values_info=Varsayılan değeri değiştirmek istemiyorsan Enter'a bas.
server_properties=Bunları daha sonra server.properties dosyasından düzenleyebilirsin.
name_your_server=Sunucuna bir isim ver
port_warning=Eğer bu senin ilk sunucun ise varsayılan port değerini değiştirme.
server_port=Sunucu portu
invalid_port=Hatalı sunucu portu
ram_warning=PocketMine-MP için ayrılan maksimum RAM değeri. 128-256 MB yapman önerilir
server_ram=Kullanılan RAM (MB)
gamemode_info=Yaratıcılık (1) ve Hayatta Kalma (0) arasından seçim yap
default_gamemode=Varsayılan oyun modu
max_players=Max. online oyuncu
spawn_protection_info=Spawn koruması, OP olmayan oyuncuların spawn bölgesinde blok kırmasını/koymasını engeller
spawn_protection=Spawn korumasını aktif et?
op_info=Bir OP sunucunun admin oyuncusudur. OPlar normal oyunculardan daha fazla komut kullanabilir
op_who=OP oyuncu adı (örnek, senin oyun adın)
op_warning=Daha sonra /op <player> yazarak oyuncuları OP yapabilirsin
whitelist_info=White-list yalnızca izin verilen oyuncuların giriş yapmasını sağlar.
whitelist_enable=White-list özelliğini aktif etmek ister misin?
whitelist_warning=White-list'e oyuncu eklemelisin
query_warning1=Query, farklı araçların sunucu ve bağlı oyuncu bilgilerini çekebilmesi için var olan bir protokoldür.
query_warning2=Eğer devre dışı bırakırsan, sunucu listelerini kullanamayacaksın.
query_disable=Query'i devre dışı bırakmak ister misin?
rcon_info=RCON, sunucu konsoluna şifre ile bağlanmak için kullanılan bir protokoldür.
rcon_enable=RCON'u aktif etmek ister misin?
rcon_password=RCON şifresi (daha sonra değiştirebilirsin)
usage_info=Anonim kullanım, PocketMine-MP ve eklentileri için global istatistikleri hesaplar. Bu istatistiklere stats.pocketmine.net adresinden bakabilirsin
usage_disable=Anonim kullanımı kapatmak ister misin?
ip_get=Dış IP adresi ve iç IP adresi tespit ediliyor
ip_warning=Dış IP adresin {{EXTERNAL_IP}}. İç IP adresin olan {{INTERNAL_IP}} adresine port yönlendirme yapmalısın
ip_confirm=Lütfen bu adımı gözden geçirin. Bu adımı atlarsanız, Lokal olmayan oyuncular sunucuya bağlanamayacak. [Enter'a Bas]
you_have_finished=Kurulum başarıyla tamamlandı.
pocketmine_will_start=PocketMine-MP şimdi başlayacak. /help yazarak kullanılbilir komutların listesini görebilirsin.
pocketmine_plugins=Sunucuna minigames veya gelişmiş korumalar eklemek için eklenti kütüphanesine bak

View File

@ -1,9 +0,0 @@
language_has_been_selected=Английский был правильно выбран.
skip_installer=Вы хотите пропустить мастер настройки?
welcome_to_pocketmine=Добро пожаловать в PocketMine-MP!\nПеред началом установки нового сервера, вы должны согласиться с лицензией.\nPocketMine-MP лицензирована под LGPL лицензии, \nчто вы можете прочитать, открыв файл лицензии на эту папку.

View File

@ -1,31 +0,0 @@
language_has_been_selected=Tiếng Anh đã được chọn.
skip_installer=Bạn có muốn bỏ qua hướng dẫn set-up?
welcome_to_pocketmine=Chào mừng tới PocketMine-MP!\nTrước khi bắt đầu, bạn phải chấp nhận hợp đồng. \nPocketMine-MP được hợp đồng bởi LGPL License,\nbạn có thể đọc file LICENSE trong thư mục này.
accept_license=Bạn có chấp nhận hợp đồng ?
you_have_to_accept_the_license=Bạn phải chấp nhận LGPL license để sử dụng PocketMine-MP
setting_up_server_now=Bạn sẽ bắt đầu set up server của bạn ngay.
default_values_info=Nếu bạn không muốn đổi giá trị mặc định, nhấn Enter.
server_properties=Bạn có thể chỉnh sửa lại vào file server.properties .
name_your_server=Đặt tên server
port_warning=Không được đổi giá trị port mặc định nếu đây là server đầu tiên của bạn.
server_port=Server port
invalid_port=Server port không đúng
ram_warning=RAM là tất cả bộ nhớ mà PocketMine-MP sẽ sử dụng. 128/256 MB là cần thiết
server_ram=Server RAM theo MB
gamemode_info=Chọn Creative (1) hoặc Survival (0)
default_gamemode=Chế độ mặc định
max_players=Giới hạn lượng người chơi
spawn_protection_info=Spawn protection không cho phép đặt/đập trong khu vực hồi sinh trừ OPs
spawn_protection=Mở Spawn protection?
op_info=OP là chủ/quản lí server. OPs có nhiều quyền hạn hơn người thường
op_who=Tên OP (ví dụ, tên bạn)
op_warning=Bạn có thể thêm OP bằng lệnh /op <player>
whitelist_info=White-list chỉ cho người có phép của quản lí tham gia.
whitelist_enable=Bạn có muốn bật white-list?
whitelist_warning=Bạn sẽ phải thêm người chơi vào white-list

View File

@ -1,46 +0,0 @@
language_has_been_selected=您现在选择了简体中文.
skip_installer=您想跳过安装向导吗?
welcome_to_pocketmine=欢迎来到PocketMine-MP!\n在开始使用您的新服务器之前您需要接受以下协议\nPocketMine-MP使用了LGPL协议\n你可以在这个文件夹中找到LICENCE文件。
accept_license=您接受协议内容吗?
you_have_to_accept_the_license=您要接受LGPL协议才可继续使用PocketMine-MP
setting_up_server_now=你现在要开始设置您的服务器了。
default_values_info=如果您希望留住默认设置,请直接按下回车键。
server_properties=您以后可以在server.properties中修改设置.
name_your_server=命名您的服务器:
port_warning=如果这是您第一次设置服务器,尽量不要改变端口。
server_port=服务器端口:
invalid_port=服务器端口不正确。
ram_warning=RAM是PocketMine-MP可用的最大内存. 推荐范围: 128-256 MB
server_ram=分配给服务器的内存(RAM)(MB):
gamemode_info=选择模式: (1)生存模式 或 (2)创造模式
default_gamemode=默认游戏模式
max_players=最多在线人数
spawn_protection_info=出生点保护可以在出生点范围内保护所有方块不被改變。
spawn_protection=启用出生点保护?
op_info=OP是一个服务器的管理员, 可以执行比普通玩家更多的命令.
op_who=OP的用户名是什么?
op_warning=你可以执行\"/op <用户名>\"来添加OP.
whitelist_info=白名单可以只允许在其列表内的玩家加入.
whitelist_enable=您想启用白名单吗?
whitelist_warning=你可以用"/whitelist add <用户名>"把别人加入白名单.
query_warning1=请求是一个用于不同的程序的协议用来获取您服务器数据和登录的玩家.
query_warning2=如果您禁止了它, 您将不能使用服务器列表.
query_disable=您希望禁用Query请求吗?
rcon_info=RCON是一个用来远程连接到服务器控制台的协议(需要密码).
rcon_enable=您希望启用RCON吗?
rcon_password=RCON密码 (您也以后更改它) :
usage_info=匿名数据让我们可以获得全球的PocketMine-MP和它的插件的统计信息. 您可以在 stats.pocketmine.net 查看统计信息.
usage_disable=您希望禁用匿名数据吗?
ip_get=获得你的外部IP和内部IP
ip_warning=您的外部IP是 {{EXTERNAL_IP}} . 您可能需要端口转发到您的内网IP {{INTERNAL_IP}} .
ip_confirm=请确认您检查了它, 如果您直接进入下一步并跳过这一步, 没有外部的玩家可以加入. [按\"回车\"键]
you_have_finished=您已经成功完成了服务器设置向导.
pocketmine_will_start=PocketMine-MP现在开始运行. 输入 \"/help\" 来看所有可用的命令.
pocketmine_plugins=请查看插件源来添加新的功能, 迷你游戏或者对服务器的高级保护.

View File

@ -1,45 +0,0 @@
language_has_been_selected={crwdns106:0}{crwdne106:0}
skip_installer={crwdns107:0}{crwdne107:0}
welcome_to_pocketmine={crwdns108:0}{crwdne108:0}
accept_license={crwdns109:0}{crwdne109:0}
you_have_to_accept_the_license={crwdns110:0}{crwdne110:0}
setting_up_server_now={crwdns111:0}{crwdne111:0}
default_values_info={crwdns112:0}{crwdne112:0}
server_properties={crwdns113:0}{crwdne113:0}
name_your_server={crwdns114:0}{crwdne114:0}
port_warning={crwdns115:0}{crwdne115:0}
server_port={crwdns116:0}{crwdne116:0}
invalid_port={crwdns117:0}{crwdne117:0}
ram_warning={crwdns118:0}{crwdne118:0}
server_ram={crwdns119:0}{crwdne119:0}
gamemode_info={crwdns120:0}{crwdne120:0}
default_gamemode={crwdns121:0}{crwdne121:0}
max_players={crwdns122:0}{crwdne122:0}
spawn_protection_info={crwdns123:0}{crwdne123:0}
spawn_protection={crwdns124:0}{crwdne124:0}
op_info={crwdns125:0}{crwdne125:0}
op_who={crwdns126:0}{crwdne126:0}
op_warning={crwdns127:0}{crwdne127:0}
whitelist_info={crwdns128:0}{crwdne128:0}
whitelist_enable={crwdns129:0}{crwdne129:0}
whitelist_warning={crwdns130:0}{crwdne130:0}
query_warning1={crwdns131:0}{crwdne131:0}
query_warning2={crwdns132:0}{crwdne132:0}
query_disable={crwdns133:0}{crwdne133:0}
rcon_info={crwdns134:0}{crwdne134:0}
rcon_enable={crwdns135:0}{crwdne135:0}
rcon_password={crwdns136:0}{crwdne136:0}
usage_info={crwdns137:0}{crwdne137:0}
usage_disable={crwdns138:0}{crwdne138:0}
ip_get={crwdns139:0}{crwdne139:0}
ip_warning={crwdns140:0}{{EXTERNAL_IP}}{crwdnd140:0}{{INTERNAL_IP}}{crwdne140:0}
ip_confirm={crwdns141:0}{crwdne141:0}
you_have_finished={crwdns142:0}{crwdne142:0}
pocketmine_will_start={crwdns143:0}{crwdne143:0}
pocketmine_plugins={crwdns144:0}{crwdne144:0}

View File

@ -20,6 +20,7 @@
*/
namespace pocketmine;
use pocketmine\utils\TextFormat;
/**
@ -29,78 +30,78 @@ abstract class Achievement{
/**
* @var array[]
*/
public static $list = array(
public static $list = [
/*"openInventory" => array(
"name" => "Taking Inventory",
"requires" => array(),
"requires" => [],
),*/
"mineWood" => array(
"mineWood" => [
"name" => "Getting Wood",
"requires" => array( //"openInventory",
),
),
"buildWorkBench" => array(
"requires" => [ //"openInventory",
],
],
"buildWorkBench" => [
"name" => "Benchmarking",
"requires" => array(
"requires" => [
"mineWood",
),
),
"buildPickaxe" => array(
],
],
"buildPickaxe" => [
"name" => "Time to Mine!",
"requires" => array(
"requires" => [
"buildWorkBench",
),
),
"buildFurnace" => array(
],
],
"buildFurnace" => [
"name" => "Hot Topic",
"requires" => array(
"requires" => [
"buildPickaxe",
),
),
"acquireIron" => array(
],
],
"acquireIron" => [
"name" => "Acquire hardware",
"requires" => array(
"requires" => [
"buildFurnace",
),
),
"buildHoe" => array(
],
],
"buildHoe" => [
"name" => "Time to Farm!",
"requires" => array(
"requires" => [
"buildWorkBench",
),
),
"makeBread" => array(
],
],
"makeBread" => [
"name" => "Bake Bread",
"requires" => array(
"requires" => [
"buildHoe",
),
),
"bakeCake" => array(
],
],
"bakeCake" => [
"name" => "The Lie",
"requires" => array(
"requires" => [
"buildHoe",
),
),
"buildBetterPickaxe" => array(
],
],
"buildBetterPickaxe" => [
"name" => "Getting an Upgrade",
"requires" => array(
"requires" => [
"buildPickaxe",
),
),
"buildSword" => array(
],
],
"buildSword" => [
"name" => "Time to Strike!",
"requires" => array(
"requires" => [
"buildWorkBench",
),
),
"diamonds" => array(
],
],
"diamonds" => [
"name" => "DIAMONDS!",
"requires" => array(
"requires" => [
"acquireIron",
),
),
],
],
);
];
public static function broadcast(Player $player, $achievementId){
@ -117,12 +118,12 @@ abstract class Achievement{
return false;
}
public static function add($achievementId, $achievementName, array $requires = array()){
public static function add($achievementId, $achievementName, array $requires = []){
if(!isset(Achievement::$list[$achievementId])){
Achievement::$list[$achievementId] = array(
Achievement::$list[$achievementId] = [
"name" => $achievementName,
"requires" => $requires,
);
];
return true;
}

View File

@ -0,0 +1,32 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine;
class CompatibleClassLoader extends \BaseClassLoader{
/**
* @deprecated
*/
public function add($namespace, $paths){
$this->addPath(array_shift($paths));
}
}

View File

@ -0,0 +1,248 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
*
*
*/
namespace pocketmine;
use pocketmine\network\protocol\Info;
use pocketmine\plugin\PluginBase;
use pocketmine\plugin\PluginLoadOrder;
use pocketmine\utils\Utils;
use pocketmine\utils\VersionString;
use raklib\RakLib;
class CrashDump{
/** @var Server */
private $server;
private $fp;
private $time;
private $data = [];
private $encodedData = null;
private $path;
public function __construct(Server $server){
$this->time = time();
$this->server = $server;
$this->path = $this->server->getDataPath() . "CrashDump_" . date("D_M_j-H.i.s-T_Y", $this->time) . ".log";
$this->fp = fopen($this->path, "wb");
$this->data["time"] = $this->time;
$this->addLine($this->server->getName() . " Crash Dump " . date("D M j H:i:s T Y", $this->time));
$this->addLine();
$this->baseCrash();
$this->generalData();
$this->pluginsData();
$this->extraData();
$this->encodeData();
}
public function getPath(){
return $this->path;
}
public function getEncodedData(){
return $this->encodedData;
}
public function getData(){
return $this->data;
}
private function encodeData(){
$this->addLine();
$this->addLine("----------------------REPORT THE DATA BELOW THIS LINE-----------------------");
$this->addLine();
$this->addLine("===BEGIN CRASH DUMP===");
$this->encodedData = zlib_encode(json_encode($this->data, JSON_UNESCAPED_SLASHES), ZLIB_ENCODING_DEFLATE, 9);
foreach(str_split(base64_encode($this->encodedData), 76) as $line){
$this->addLine($line);
}
$this->addLine("===END CRASH DUMP===");
}
private function pluginsData(){
if(class_exists("pocketmine\\plugin\\PluginManager", false)){
$this->addLine();
$this->addLine("Loaded plugins:");
$this->data["plugins"] = [];
foreach($this->server->getPluginManager()->getPlugins() as $p){
$d = $p->getDescription();
$this->data["plugins"][$d->getName()] = [
"name" => $d->getName(),
"version" => $d->getVersion(),
"authors" => $d->getAuthors(),
"api" => $d->getCompatibleApis(),
"enabled" => $p->isEnabled(),
"depends" => $d->getDepend(),
"softDepends" => $d->getSoftDepend(),
"main" => $d->getMain(),
"load" => $d->getOrder() === PluginLoadOrder::POSTWORLD ? "POSTWORLD" : "STARTUP",
"website" => $d->getWebsite()
];
$this->addLine($d->getName() . " " . $d->getVersion() . " by " . implode(", ", $d->getAuthors()) . " for API(s) " . implode(", ", $d->getCompatibleApis()));
}
}
}
private function extraData(){
global $arguments;
if($this->server->getProperty("auto-report.send-settings", true) !== false){
$this->data["parameters"] = (array) $arguments;
$this->data["server.properties"] = @file_get_contents($this->server->getDataPath() . "server.properties");
$this->data["server.properties"] = preg_replace("#^rcon\\.password=(.*)$#m", "rcon.password=******", $this->data["server.properties"]);
$this->data["pocketmine.yml"] = @file_get_contents($this->server->getDataPath() . "pocketmine.yml");
}else{
$this->data["pocketmine.yml"] = "";
$this->data["server.properties"] = "";
$this->data["parameters"] = [];
}
$extensions = [];
foreach(get_loaded_extensions() as $ext){
$extensions[$ext] = phpversion($ext);
}
$this->data["extensions"] = $extensions;
if($this->server->getProperty("auto-report.send-phpinfo", true) !== false){
ob_start();
phpinfo();
$this->data["phpinfo"] = ob_get_contents();
ob_end_clean();
}
}
private function baseCrash(){
global $lastExceptionError, $lastError;
if(isset($lastExceptionError)){
$error = $lastExceptionError;
}else{
$error = (array) error_get_last();
$error["trace"] = getTrace(4);
$errorConversion = [
E_ERROR => "E_ERROR",
E_WARNING => "E_WARNING",
E_PARSE => "E_PARSE",
E_NOTICE => "E_NOTICE",
E_CORE_ERROR => "E_CORE_ERROR",
E_CORE_WARNING => "E_CORE_WARNING",
E_COMPILE_ERROR => "E_COMPILE_ERROR",
E_COMPILE_WARNING => "E_COMPILE_WARNING",
E_USER_ERROR => "E_USER_ERROR",
E_USER_WARNING => "E_USER_WARNING",
E_USER_NOTICE => "E_USER_NOTICE",
E_STRICT => "E_STRICT",
E_RECOVERABLE_ERROR => "E_RECOVERABLE_ERROR",
E_DEPRECATED => "E_DEPRECATED",
E_USER_DEPRECATED => "E_USER_DEPRECATED",
];
$error["fullFile"] = $error["file"];
$error["file"] = cleanPath($error["file"]);
$error["type"] = isset($errorConversion[$error["type"]]) ? $errorConversion[$error["type"]] : $error["type"];
if(($pos = strpos($error["message"], "\n")) !== false){
$error["message"] = substr($error["message"], 0, $pos);
}
}
if(isset($lastError)){
$this->data["lastError"] = $lastError;
}
$this->data["error"] = $error;
unset($this->data["error"]["fullFile"]);
unset($this->data["error"]["trace"]);
$this->addLine("Error: " . $error["message"]);
$this->addLine("File: " . $error["file"]);
$this->addLine("Line: " . $error["line"]);
$this->addLine("Type: " . $error["type"]);
if(strpos($error["file"], "src/pocketmine/") === false and strpos($error["file"], "src/raklib/") === false and file_exists($error["fullFile"])){
$this->addLine();
$this->addLine("THIS CRASH WAS CAUSED BY A PLUGIN");
$this->data["plugin"] = true;
$reflection = new \ReflectionClass(PluginBase::class);
$file = $reflection->getProperty("file");
$file->setAccessible(true);
foreach($this->server->getPluginManager()->getPlugins() as $plugin){
$filePath = \pocketmine\cleanPath($file->getValue($plugin));
if(strpos($error["file"], $filePath) === 0){
$this->data["plugin"] = $plugin->getName();
$this->addLine("BAD PLUGIN: " . $plugin->getDescription()->getFullName());
break;
}
}
}else{
$this->data["plugin"] = false;
}
$this->addLine();
$this->addLine("Code:");
$this->data["code"] = [];
if($this->server->getProperty("auto-report.send-code", true) !== false){
$file = @file($error["fullFile"], FILE_IGNORE_NEW_LINES);
for($l = max(0, $error["line"] - 10); $l < $error["line"] + 10; ++$l){
$this->addLine("[" . ($l + 1) . "] " . @$file[$l]);
$this->data["code"][$l + 1] = @$file[$l];
}
}
$this->addLine();
$this->addLine("Backtrace:");
foreach(($this->data["trace"] = $error["trace"]) as $line){
$this->addLine($line);
}
$this->addLine();
}
private function generalData(){
$version = new VersionString();
$this->data["general"] = [];
$this->data["general"]["version"] = $version->get(false);
$this->data["general"]["build"] = $version->getBuild();
$this->data["general"]["protocol"] = Info::CURRENT_PROTOCOL;
$this->data["general"]["api"] = \pocketmine\API_VERSION;
$this->data["general"]["git"] = \pocketmine\GIT_COMMIT;
$this->data["general"]["raklib"] = RakLib::VERSION;
$this->data["general"]["uname"] = php_uname("a");
$this->data["general"]["php"] = phpversion();
$this->data["general"]["zend"] = zend_version();
$this->data["general"]["php_os"] = PHP_OS;
$this->data["general"]["os"] = Utils::getOS();
$this->addLine("PocketMine-MP version: " . $version->get(false) . " #" . $version->getBuild() . " [Protocol " . Info::CURRENT_PROTOCOL . "; API " . API_VERSION . "]");
$this->addLine("Git commit: " . GIT_COMMIT);
$this->addLine("uname -a: " . php_uname("a"));
$this->addLine("PHP Version: " . phpversion());
$this->addLine("Zend version: " . zend_version());
$this->addLine("OS : " . PHP_OS . ", " . Utils::getOS());
}
public function addLine($line = ""){
fwrite($this->fp, $line . PHP_EOL);
}
public function add($str){
fwrite($this->fp, $str);
}
}

View File

@ -0,0 +1,78 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine;
use pocketmine\permission\ServerOperator;
interface IPlayer extends ServerOperator{
/**
* @return bool
*/
public function isOnline();
/**
* @return string
*/
public function getName();
/**
* @return bool
*/
public function isBanned();
/**
* @param bool $banned
*/
public function setBanned($banned);
/**
* @return bool
*/
public function isWhitelisted();
/**
* @param bool $value
*/
public function setWhitelisted($value);
/**
* @return Player|null
*/
public function getPlayer();
/**
* @return int|double
*/
public function getFirstPlayed();
/**
* @return int|double
*/
public function getLastPlayed();
/**
* @return mixed
*/
public function hasPlayedBefore();
}

View File

@ -0,0 +1,134 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine;
use pocketmine\metadata\MetadataValue;
use pocketmine\nbt\tag\Compound;
use pocketmine\plugin\Plugin;
class OfflinePlayer implements IPlayer{
private $name;
private $server;
private $namedtag;
/**
* @param Server $server
* @param string $name
*/
public function __construct(Server $server, $name){
$this->server = $server;
$this->name = $name;
if(file_exists($this->server->getDataPath() . "players/" . strtolower($this->getName()) . ".dat")){
$this->namedtag = $this->server->getOfflinePlayerData($this->name);
}else{
$this->namedtag = null;
}
}
public function isOnline(){
return $this->getPlayer() !== null;
}
public function getName(){
return $this->name;
}
public function getServer(){
return $this->server;
}
public function isOp(){
return $this->server->isOp(strtolower($this->getName()));
}
public function setOp($value){
if($value === $this->isOp()){
return;
}
if($value === true){
$this->server->addOp(strtolower($this->getName()));
}else{
$this->server->removeOp(strtolower($this->getName()));
}
}
public function isBanned(){
return $this->server->getNameBans()->isBanned(strtolower($this->getName()));
}
public function setBanned($value){
if($value === true){
$this->server->getNameBans()->addBan($this->getName(), null, null, null);
}else{
$this->server->getNameBans()->remove($this->getName());
}
}
public function isWhitelisted(){
return $this->server->isWhitelisted(strtolower($this->getName()));
}
public function setWhitelisted($value){
if($value === true){
$this->server->addWhitelist(strtolower($this->getName()));
}else{
$this->server->removeWhitelist(strtolower($this->getName()));
}
}
public function getPlayer(){
return $this->server->getPlayerExact($this->getName());
}
public function getFirstPlayed(){
return $this->namedtag instanceof Compound ? $this->namedtag["firstPlayed"] : null;
}
public function getLastPlayed(){
return $this->namedtag instanceof Compound ? $this->namedtag["lastPlayed"] : null;
}
public function hasPlayedBefore(){
return $this->namedtag instanceof Compound;
}
public function setMetadata($metadataKey, MetadataValue $metadataValue){
$this->server->getPlayerMetadata()->setMetadata($this, $metadataKey, $metadataValue);
}
public function getMetadata($metadataKey){
return $this->server->getPlayerMetadata()->getMetadata($this, $metadataKey);
}
public function hasMetadata($metadataKey){
return $this->server->getPlayerMetadata()->hasMetadata($this, $metadataKey);
}
public function removeMetadata($metadataKey, Plugin $plugin){
$this->server->getPlayerMetadata()->removeMetadata($this, $metadataKey, $plugin);
}
}

2604
src/pocketmine/Player.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,502 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace {
function safe_var_dump(){
static $cnt = 0;
foreach(func_get_args() as $var){
switch(true){
case is_array($var):
echo str_repeat(" ", $cnt) . "array(" . count($var) . ") {" . PHP_EOL;
foreach($var as $key => $value){
echo str_repeat(" ", $cnt + 1) . "[" . (is_integer($key) ? $key : '"' . $key . '"') . "]=>" . PHP_EOL;
++$cnt;
safe_var_dump($value);
--$cnt;
}
echo str_repeat(" ", $cnt) . "}" . PHP_EOL;
break;
case is_integer($var):
echo str_repeat(" ", $cnt) . "int(" . $var . ")" . PHP_EOL;
break;
case is_float($var):
echo str_repeat(" ", $cnt) . "float(" . $var . ")" . PHP_EOL;
break;
case is_bool($var):
echo str_repeat(" ", $cnt) . "bool(" . ($var === true ? "true" : "false") . ")" . PHP_EOL;
break;
case is_string($var):
echo str_repeat(" ", $cnt) . "string(" . strlen($var) . ") \"$var\"" . PHP_EOL;
break;
case is_resource($var):
echo str_repeat(" ", $cnt) . "resource() of type (" . get_resource_type($var) . ")" . PHP_EOL;
break;
case is_object($var):
echo str_repeat(" ", $cnt) . "object(" . get_class($var) . ")" . PHP_EOL;
break;
case is_null($var):
echo str_repeat(" ", $cnt) . "NULL" . PHP_EOL;
break;
}
}
}
function dummy(){
}
}
namespace pocketmine {
use LogLevel;
use pocketmine\utils\Binary;
use pocketmine\utils\MainLogger;
use pocketmine\utils\Utils;
use pocketmine\wizard\Installer;
const VERSION = "Alpha_1.4dev";
const API_VERSION = "1.6.0";
const CODENAME = "絶好(Zekkou)ケーキ(Cake)";
const MINECRAFT_VERSION = "v0.9.5 alpha";
/*
* Startup code. Do not look at it, it may harm you.
* Most of them are hacks to fix date-related bugs, or basic functions used after this
* This is the only non-class based file on this project.
* Enjoy it as much as I did writing it. I don't want to do it again.
*/
if(\Phar::running(true) !== ""){
@define("pocketmine\\PATH", \Phar::running(true) . "/");
}else{
@define("pocketmine\\PATH", \getcwd() . DIRECTORY_SEPARATOR);
}
if(!extension_loaded("pthreads")){
echo "[CRITICAL] Unable to find the pthreads extension." . PHP_EOL;
echo "[CRITICAL] Please use the installer provided on the homepage." . PHP_EOL;
exit(1);
}
if(!class_exists("ClassLoader", false)){
require_once(\pocketmine\PATH . "src/spl/ClassLoader.php");
require_once(\pocketmine\PATH . "src/spl/BaseClassLoader.php");
require_once(\pocketmine\PATH . "src/pocketmine/CompatibleClassLoader.php");
}
$autoloader = new CompatibleClassLoader();
$autoloader->addPath(\pocketmine\PATH . "src");
$autoloader->addPath(\pocketmine\PATH . "src" . DIRECTORY_SEPARATOR . "spl");
$autoloader->addPath(\pocketmine\PATH . "src" . DIRECTORY_SEPARATOR . "raklib");
$autoloader->register(true);
set_time_limit(0); //Who set it to 30 seconds?!?!
gc_enable();
error_reporting(-1);
ini_set("allow_url_fopen", 1);
ini_set("display_errors", 1);
ini_set("display_startup_errors", 1);
ini_set("default_charset", "utf-8");
ini_set("memory_limit", "256M"); //Default
define("pocketmine\\START_TIME", microtime(true));
$opts = getopt("", ["enable-ansi", "disable-ansi", "data:", "plugins:", "no-wizard", "enable-profiler"]);
define("pocketmine\\DATA", isset($opts["data"]) ? realpath($opts["data"]) . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR);
define("pocketmine\\PLUGIN_PATH", isset($opts["plugins"]) ? realpath($opts["plugins"]) . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR);
define("pocketmine\\ANSI", (Utils::getOS() !== "win" or isset($opts["enable-ansi"])) and !isset($opts["disable-ansi"]));
//Logger has a dependency on timezone, so we'll set it to UTC until we can get the actual timezone.
date_default_timezone_set("UTC");
$logger = new MainLogger(\pocketmine\DATA . "server.log", \pocketmine\ANSI);
if(!ini_get("date.timezone")){
if(($timezone = detect_system_timezone()) and date_default_timezone_set($timezone)){
//Success! Timezone has already been set and validated in the if statement.
//This here is just for redundancy just in case some stupid program wants to read timezone data from the ini.
ini_set("date.timezone", $timezone);
}else{
//If system timezone detection fails or timezone is an invalid value.
if($response = Utils::getURL("http://ip-api.com/json")
and $ip_geolocation_data = json_decode($response, true)
and $ip_geolocation_data['status'] != 'fail'
and date_default_timezone_set($ip_geolocation_data['timezone']))
{
//Again, for redundancy.
ini_set("date.timezone", $ip_geolocation_data['timezone']);
}else{
ini_set("date.timezone", "UTC");
date_default_timezone_set("UTC");
$logger->warning("Timezone could not be automatically determined. An incorrect timezone will result in incorrect timestamps on console logs. It has been set to \"UTC\" by default. You can change it on the php.ini file.");
}
}
}else{
/*
* This is here so that stupid idiots don't come to us complaining and fill up the issue tracker when they put an incorrect timezone abbreviation in php.ini apparently.
*/
$default_timezone = date_default_timezone_get();
if(strpos($default_timezone, "/") === false){
$default_timezone = timezone_name_from_abbr($default_timezone);
ini_set("date.timezone", $default_timezone);
date_default_timezone_set($default_timezone);
}
}
function detect_system_timezone(){
switch(Utils::getOS()){
case 'win':
$regex = '/(?:Time Zone:\s*\()(UTC)(\+*\-*\d*\d*\:*\d*\d*)(?:\))/';
exec("systeminfo", $output);
$string = trim(implode("\n", $output));
//Detect the Time Zone string in systeminfo
preg_match($regex, $string, $matches);
if(!isset($matches[2]))
{
return false;
}
$offset = $matches[2];
if($offset == ""){
return "UTC";
}
return parse_offset($offset);
break;
case 'linux':
// Ubuntu / Debian.
if(file_exists('/etc/timezone')){
$data = file_get_contents('/etc/timezone');
if($data){
return trim($data);
}
}
// RHEL / CentOS
if(file_exists('/etc/sysconfig/clock')){
$data = parse_ini_file('/etc/sysconfig/clock');
if(!empty($data['ZONE'])){
return trim($data['ZONE']);
}
}
//Portable method for incompatible linux distributions.
$offset = trim(exec('date +%:z'));
if($offset == "+00:00"){
return "UTC";
}
return parse_offset($offset);
break;
case 'mac':
if(is_link('/etc/localtime')){
$filename = readlink('/etc/localtime');
if(strpos($filename, '/usr/share/zoneinfo/') === 0){
$timezone = substr($filename, 20);
return trim($timezone);
}
}
return false;
break;
default:
return false;
break;
}
}
/**
* @param string $offset In the format of +09:00, +02:00, -04:00 etc.
* @return string
*/
function parse_offset($offset){
//Make signed offsets unsigned for date_parse
if(strpos($offset, '-') !== false){
$negative_offset = true;
$offset = str_replace('-', '', $offset);
}else{
if(strpos($offset, '+') !== false){
$negative_offset = false;
$offset = str_replace('+', '', $offset);
}else{
return false;
}
}
$parsed = date_parse($offset);
$offset = $parsed['hour'] * 3600 + $parsed['minute'] * 60 + $parsed['second'];
//After date_parse is done, put the sign back
if($negative_offset == true){
$offset = -abs($offset);
}
//And then, look the offset up.
//timezone_name_from_abbr is not used because it returns false on some(most) offsets because it's mapping function is weird.
//That's been a bug in PHP since 2008!
foreach(timezone_abbreviations_list() as $zones){
foreach($zones as $timezone){
if($timezone['offset'] == $offset){
return $timezone['timezone_id'];
}
}
}
return false;
}
if(isset($opts["enable-profiler"])){
if(function_exists("profiler_enable")){
\profiler_enable();
$logger->notice("Execution is being profiled");
}else{
$logger->notice("No profiler found. Please install https://github.com/krakjoe/profiler");
}
}
function kill($pid){
switch(Utils::getOS()){
case "win":
exec("taskkill.exe /F /PID " . ((int) $pid) . " > NUL");
break;
case "mac":
case "linux":
default:
exec("kill -9 " . ((int) $pid) . " > /dev/null 2>&1");
}
}
function getTrace($start = 1, $trace = null){
if($trace === null){
if(function_exists("xdebug_get_function_stack")){
$trace = array_reverse(xdebug_get_function_stack());
}else{
$e = new \Exception();
$trace = $e->getTrace();
}
}
$messages = [];
$j = 0;
for($i = (int) $start; isset($trace[$i]); ++$i, ++$j){
$params = "";
if(isset($trace[$i]["args"]) or isset($trace[$i]["params"])){
if(isset($trace[$i]["args"])){
$args = $trace[$i]["args"];
}else{
$args = $trace[$i]["params"];
}
foreach($args as $name => $value){
$params .= (is_object($value) ? get_class($value) . " " . (method_exists($value, "__toString") ? $value->__toString() : "object") : gettype($value) . " " . @strval($value)) . ", ";
}
}
$messages[] = "#$j " . (isset($trace[$i]["file"]) ? cleanPath($trace[$i]["file"]) : "") . "(" . (isset($trace[$i]["line"]) ? $trace[$i]["line"] : "") . "): " . (isset($trace[$i]["class"]) ? $trace[$i]["class"] . (($trace[$i]["type"] === "dynamic" or $trace[$i]["type"] === "->") ? "->" : "::") : "") . $trace[$i]["function"] . "(" . substr($params, 0, -2) . ")";
}
return $messages;
}
function cleanPath($path){
return rtrim(str_replace(["\\", ".php", "phar://", rtrim(str_replace(["\\", "phar://"], ["/", ""], \pocketmine\PATH), "/"), rtrim(str_replace(["\\", "phar://"], ["/", ""], \pocketmine\PLUGIN_PATH), "/")], ["/", "", "", "", ""], $path), "/");
}
function error_handler($errno, $errstr, $errfile, $errline, $context, $trace = null){
global $lastError;
if(error_reporting() === 0){ //@ error-con..trol
return false;
}
$errorConversion = [
E_ERROR => "E_ERROR",
E_WARNING => "E_WARNING",
E_PARSE => "E_PARSE",
E_NOTICE => "E_NOTICE",
E_CORE_ERROR => "E_CORE_ERROR",
E_CORE_WARNING => "E_CORE_WARNING",
E_COMPILE_ERROR => "E_COMPILE_ERROR",
E_COMPILE_WARNING => "E_COMPILE_WARNING",
E_USER_ERROR => "E_USER_ERROR",
E_USER_WARNING => "E_USER_WARNING",
E_USER_NOTICE => "E_USER_NOTICE",
E_STRICT => "E_STRICT",
E_RECOVERABLE_ERROR => "E_RECOVERABLE_ERROR",
E_DEPRECATED => "E_DEPRECATED",
E_USER_DEPRECATED => "E_USER_DEPRECATED",
];
$type = ($errno === E_ERROR or $errno === E_USER_ERROR) ? LogLevel::ERROR : (($errno === E_USER_WARNING or $errno === E_WARNING) ? LogLevel::WARNING : LogLevel::NOTICE);
$errno = isset($errorConversion[$errno]) ? $errorConversion[$errno] : $errno;
if(($pos = strpos($errstr, "\n")) !== false){
$errstr = substr($errstr, 0, $pos);
}
$logger = MainLogger::getLogger();
$oldFile = $errfile;
$errfile = cleanPath($errfile);
$logger->log($type, "An $errno error happened: \"$errstr\" in \"$errfile\" at line $errline");
foreach(($trace = getTrace($trace === null ? 3 : 0, $trace)) as $i => $line){
$logger->debug($line);
}
$lastError = [
"type" => $type,
"message" => $errstr,
"fullFile" => $oldFile,
"file" => $errfile,
"line" => $errline,
"trace" => $trace
];
return true;
}
set_error_handler("\\pocketmine\\error_handler", E_ALL);
$errors = 0;
if(version_compare("5.6.0", PHP_VERSION) > 0){
$logger->critical("You must use PHP >= 5.6");
++$errors;
}
if(php_sapi_name() !== "cli"){
$logger->critical("You must run PocketMine-MP using the CLI.");
++$errors;
}
if(!extension_loaded("sockets")){
$logger->critical("Unable to find the Socket extension.");
++$errors;
}
$pthreads_version = phpversion("pthreads");
if(substr_count($pthreads_version, ".") < 2){
$pthreads_version = "0.$pthreads_version";
}
if(version_compare($pthreads_version, "2.0.8") < 0){
$logger->critical("pthreads >= 2.0.8 is required, while you have $pthreads_version.");
++$errors;
}
if(!extension_loaded("uopz")){
//$logger->notice("Couldn't find the uopz extension. Some functions may be limited");
}
if(extension_loaded("pocketmine")){
if(version_compare(phpversion("pocketmine"), "0.0.1") < 0){
$logger->critical("You have the native PocketMine extension, but your version is lower than 0.0.1.");
++$errors;
}elseif(version_compare(phpversion("pocketmine"), "0.0.4") > 0){
$logger->critical("You have the native PocketMine extension, but your version is higher than 0.0.4.");
++$errors;
}
}
if(!extension_loaded("Weakref") and !extension_loaded("weakref")){
$logger->critical("Unable to find the Weakref extension.");
++$errors;
}
if(!extension_loaded("curl")){
$logger->critical("Unable to find the cURL extension.");
++$errors;
}
if(!extension_loaded("sqlite3")){
$logger->critical("Unable to find the SQLite3 extension.");
++$errors;
}
if(!extension_loaded("yaml")){
$logger->critical("Unable to find the YAML extension.");
++$errors;
}
if(!extension_loaded("zlib")){
$logger->critical("Unable to find the Zlib extension.");
++$errors;
}
if($errors > 0){
$logger->critical("Please use the installer provided on the homepage, or recompile PHP again.");
$logger->shutdown();
$logger->join();
exit(1); //Exit with error
}
if(file_exists(\pocketmine\PATH . ".git/refs/heads/master")){ //Found Git information!
define("pocketmine\\GIT_COMMIT", strtolower(trim(file_get_contents(\pocketmine\PATH . ".git/refs/heads/master"))));
}else{ //Unknown :(
define("pocketmine\\GIT_COMMIT", str_repeat("00", 20));
}
@define("ENDIANNESS", (pack("d", 1) === "\77\360\0\0\0\0\0\0" ? Binary::BIG_ENDIAN : Binary::LITTLE_ENDIAN));
@define("INT32_MASK", is_int(0xffffffff) ? 0xffffffff : -1);
@ini_set("opcache.mmap_base", bin2hex(Utils::getRandomBytes(8, false))); //Fix OPCache address errors
if(!file_exists(\pocketmine\DATA . "server.properties") and !isset($opts["no-wizard"])){
new Installer();
}
if(substr(__FILE__, 0, 7) !== "phar://"){
$logger->warning("Non-packaged PocketMine-MP installation detected, do not use on production.");
}
ThreadManager::init();
$server = new Server($autoloader, $logger, \pocketmine\PATH, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);
$logger->info("Stopping other threads");
foreach(ThreadManager::getInstance()->getAll() as $id => $thread){
if($thread->isRunning()){
$logger->debug("Stopping " . (new \ReflectionClass($thread))->getShortName() . " thread");
if($thread instanceof Thread){
$thread->kill();
sleep(1);
if($thread->isRunning()){
$thread->detach();
}
}elseif($thread instanceof Worker){
$thread->kill();
sleep(1);
if($thread->isRunning()){
$thread->detach();
}
}
}elseif(!$thread->isJoined()){
$logger->debug("Joining " . (new \ReflectionClass($thread))->getShortName() . " thread");
$thread->join();
}
}
$logger->shutdown();
$logger->join();
exit(0);
}

2132
src/pocketmine/Server.php Normal file

File diff suppressed because it is too large Load Diff

34
src/pocketmine/Thread.php Normal file
View File

@ -0,0 +1,34 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine;
/**
* This class must be extended by all custom threading classes
*/
abstract class Thread extends \Thread{
public final function start($options = PTHREADS_INHERIT_ALL){
ThreadManager::getInstance()->add($this);
return parent::start($options);
}
}

View File

@ -0,0 +1,69 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine;
class ThreadManager extends \Threaded{
/** @var ThreadManager */
private static $instance = null;
public static function init(){
self::$instance = new ThreadManager();
}
/**
* @return ThreadManager
*/
public static function getInstance(){
return self::$instance;
}
/**
* @param Worker|Thread $thread
*/
public function add($thread){
if($thread instanceof Thread or $thread instanceof Worker){
$this->{spl_object_hash($thread)} = $thread;
}
}
/**
* @param Worker|Thread $thread
*/
public function remove($thread){
if($thread instanceof Thread or $thread instanceof Worker){
unset($this->{spl_object_hash($thread)});
}
}
/**
* @return Worker[]|Thread[]
*/
public function getAll(){
$array = [];
foreach($this as $key => $thread){
$array[$key] = $thread;
}
return $array;
}
}

34
src/pocketmine/Worker.php Normal file
View File

@ -0,0 +1,34 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine;
/**
* This class must be extended by all custom threading classes
*/
abstract class Worker extends \Worker{
public final function start($options = PTHREADS_INHERIT_ALL){
ThreadManager::getInstance()->add($this);
return parent::start($options);
}
}

View File

@ -23,15 +23,14 @@ namespace pocketmine\block;
use pocketmine\item\Item;
class Farmland extends Solid{
class AcaciaWoodStairs extends Stair{
public function __construct($meta = 0){
parent::__construct(self::FARMLAND, $meta, "Farmland");
$this->hardness = 3;
parent::__construct(self::ACACIA_WOOD_STAIRS, $meta, "Acacia Wood Stairs");
}
public function getDrops(Item $item){
return array(
array(Item::DIRT, 0, 1),
);
return [
[$this->id, 0, 1],
];
}
}

View File

@ -0,0 +1,51 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
/**
* Air block
*/
class Air extends Transparent{
public $isActivable = false;
public $breakable = false;
public $isFlowable = true;
public $isTransparent = true;
public $isReplaceable = true;
public $isPlaceable = false;
public $hasPhysics = false;
public $isSolid = false;
public $isFullBlock = true;
protected $id = self::AIR;
protected $meta = 0;
protected $name = "Air";
protected $hardness = 0;
public function __construct(){
}
public function getBoundingBox(){
return null;
}
}

View File

@ -22,9 +22,10 @@
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\math\AxisAlignedBB;
use pocketmine\network\protocol\ChatPacket;
use pocketmine\Player;
use pocketmine\Server;
class Bed extends Transparent{
public function __construct($type = 0){
@ -34,8 +35,28 @@ class Bed extends Transparent{
$this->hardness = 1;
}
public function getBoundingBox(){
if($this->boundingBox !== null){
return $this->boundingBox;
}
return $this->boundingBox = new AxisAlignedBB(
$this->x,
$this->y,
$this->z,
$this->x + 1,
$this->y + 0.5625,
$this->z + 1
);
}
public function onActivate(Item $item, Player $player = null){
if($player instanceof Player and Server::getInstance()->api->time->getPhase($this->level) !== "night"){
$time = $this->getLevel()->getTime() % Level::TIME_FULL;
$isNight = ($time >= Level::TIME_NIGHT and $time < Level::TIME_SUNRISE);
if($player instanceof Player and !$isNight){
$pk = new ChatPacket;
$pk->message = "You can only sleep at night";
$player->dataPacket($pk);
@ -58,10 +79,12 @@ class Bed extends Transparent{
$b = $blockEast;
}elseif($blockWest->getID() === $this->id and ($blockWest->meta & 0x08) === 0x08){
$b = $blockWest;
}elseif($player instanceof Player){
$pk = new ChatPacket;
$pk->message = "This bed is incomplete";
$player->dataPacket($pk);
}else{
if($player instanceof Player){
$pk = new ChatPacket;
$pk->message = "This bed is incomplete";
$player->dataPacket($pk);
}
return true;
}
@ -79,19 +102,19 @@ class Bed extends Transparent{
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->isTransparent === false){
$faces = array(
$faces = [
0 => 3,
1 => 4,
2 => 2,
3 => 5,
);
];
$d = $player instanceof Player ? $player->getDirection() : 0;
$next = $this->getSide($faces[(($d + 3) % 4)]);
$downNext = $this->getSide(0);
if($next->isReplaceable === true and $downNext->isTransparent === false){
$meta = (($d + 3) % 4) & 0x03;
$this->level->setBlock($block, Block::get($this->id, $meta), true, false, true);
$this->level->setBlock($next, Block::get($this->id, $meta | 0x08), true, false, true);
$this->getLevel()->setBlock($block, Block::get($this->id, $meta), true, true);
$this->getLevel()->setBlock($next, Block::get($this->id, $meta | 0x08), true, true);
return true;
}
@ -108,34 +131,34 @@ class Bed extends Transparent{
if(($this->meta & 0x08) === 0x08){ //This is the Top part of bed
if($blockNorth->getID() === $this->id and $blockNorth->meta !== 0x08){ //Checks if the block ID and meta are right
$this->level->setBlock($blockNorth, new Air(), true, false, true);
$this->getLevel()->setBlock($blockNorth, new Air(), true, true);
}elseif($blockSouth->getID() === $this->id and $blockSouth->meta !== 0x08){
$this->level->setBlock($blockSouth, new Air(), true, false, true);
$this->getLevel()->setBlock($blockSouth, new Air(), true, true);
}elseif($blockEast->getID() === $this->id and $blockEast->meta !== 0x08){
$this->level->setBlock($blockEast, new Air(), true, false, true);
$this->getLevel()->setBlock($blockEast, new Air(), true, true);
}elseif($blockWest->getID() === $this->id and $blockWest->meta !== 0x08){
$this->level->setBlock($blockWest, new Air(), true, false, true);
$this->getLevel()->setBlock($blockWest, new Air(), true, true);
}
}else{ //Bottom Part of Bed
if($blockNorth->getID() === $this->id and ($blockNorth->meta & 0x08) === 0x08){
$this->level->setBlock($blockNorth, new Air(), true, false, true);
$this->getLevel()->setBlock($blockNorth, new Air(), true, true);
}elseif($blockSouth->getID() === $this->id and ($blockSouth->meta & 0x08) === 0x08){
$this->level->setBlock($blockSouth, new Air(), true, false, true);
$this->getLevel()->setBlock($blockSouth, new Air(), true, true);
}elseif($blockEast->getID() === $this->id and ($blockEast->meta & 0x08) === 0x08){
$this->level->setBlock($blockEast, new Air(), true, false, true);
$this->getLevel()->setBlock($blockEast, new Air(), true, true);
}elseif($blockWest->getID() === $this->id and ($blockWest->meta & 0x08) === 0x08){
$this->level->setBlock($blockWest, new Air(), true, false, true);
$this->getLevel()->setBlock($blockWest, new Air(), true, true);
}
}
$this->level->setBlock($this, new Air(), true, false, true);
$this->getLevel()->setBlock($this, new Air(), true, true);
return true;
}
public function getDrops(Item $item){
return array(
array(Item::BED, 0, 1),
);
return [
[Item::BED, 0, 1],
];
}
}

Some files were not shown because too many files have changed in this diff Show More