Compare commits

...

3288 Commits

Author SHA1 Message Date
763ef7f937 Removed outdated GUI submodule (#125) 2016-11-25 13:46:41 +00:00
e51a2725de Remove circular dependency between Item and NBT modules (#121) 2016-11-25 10:17:50 +00:00
a0111d04ee Log exception with backtrace 2016-11-24 21:20:10 +00:00
958473b333 update PHP-YAML to 2.0.0 for Travis 2016-11-24 12:04:52 +00:00
744f5a8384 Fix ServerKiller and make it less useless (#122) 2016-11-24 08:47:28 +00:00
fe348b0a9d Speed up region file creation by only using ftruncate(). (#116)
* Speed up region file creation by only using ftruncate().

The old method was extremely slow (~200ms to create a single region file), but the new one is much faster (in the order of ~15ms). (Numbers were measured on a Linode 2048)

* Replace manual array fill with array_fill().

* Spaces -> tabs.

* Update RegionLoader.php
2016-11-23 21:23:38 +00:00
8d842732e0 Ignore MovePlayerPacket if position is the same 2016-11-22 16:55:40 +00:00
bee342691d Remove NetherBrickFenceGate derp 2016-11-22 15:47:20 +00:00
36623d8a5b Update links to .io 2016-11-21 17:55:14 +00:00
7eb9530346 Fix CraftItemEvent not return inputs 2016-11-21 17:43:04 +00:00
bd85d53a0b Removed unsafe use of potential non-Player-object parameter 2016-11-20 20:03:56 +08:00
ac37af3a46 Added types and changed to sendWhisper 2016-11-20 20:03:56 +08:00
208884422d Added whisper 2016-11-20 20:03:56 +08:00
da23568546 Disallow scheduling the same AsyncTask instance more than once 2016-11-20 01:12:38 +08:00
f0f6d85809 Merge branch 'asynctask-progress' 2016-11-19 23:17:26 +08:00
92bd1a755d Fix Installer server name bug (server name uses MOTD now 2016-11-18 11:41:25 +00:00
3ee43c5a17 Fix some varints 2016-11-17 18:28:39 +00:00
8ced6547f2 Fixed #109 2016-11-17 01:25:01 +08:00
d29e96407e Update another link
[ci skip]
2016-11-15 13:31:14 +00:00
8214e50bcc HTTPS [ci skip] 2016-11-14 14:25:17 +00:00
802bc21c53 Change forums link
[ci skip]
2016-11-14 10:04:04 +00:00
25b51b4dfd Update ISSUE_TEMPLATE.md 2016-11-14 09:32:29 +00:00
794ff643a7 Add new forum link (#102) 2016-11-13 16:33:52 +00:00
37ae760417 Fixed crashes after scheduleAsyncTaskToWorker() calls 2016-11-13 18:32:11 +08:00
ab4d6b1e36 Clarified that AsyncTask should not run for a long time 2016-11-13 18:14:41 +08:00
383df298a6 fix crash at server stop when RCON is enable (#101) 2016-11-13 10:11:15 +00:00
7314aaf7f7 Particles for 0.16
Added BlockForceFieldParticle, removed LargeExplodeParticle and added HugeExplodeSeedParticle
2016-11-12 21:05:01 +00:00
75fa2f1132 Fixed array progress crashing
Forgot to serialize them. They would be converted to Volatile, which is Threaded. Threaded objects still crash with progressUpdates.
2016-11-12 18:57:52 +08:00
d5881dbe83 Disallow Threaded objects to be passed as progress parameter 2016-11-12 18:33:25 +08:00
8404ce88bd Fixed pthreads crashes with progressUpdates 2016-11-12 18:30:55 +08:00
7861822a0f Fixed garbage AsyncTasks cannot be accessed 2016-11-12 17:47:07 +08:00
e6485c4734 Added AsyncTask progress update API 2016-11-12 17:31:59 +08:00
bd5bbbea10 Missed one
TODO: fix this properly
2016-11-10 13:28:27 +00:00
0ac04b52ff Merge pull request #95 from pmmp/timings-verbose
Make /timings command more verbose about errors
2016-11-10 08:48:09 +00:00
2d37d361a7 Make /timings command more verbose about errors 2016-11-09 22:09:16 +00:00
d696049a0a Fix anvil rotation and variant drops 2016-11-09 20:28:59 +00:00
1d876e30c8 Clean up some EnchantmentList mess 2016-11-09 14:20:25 +00:00
ea7313779e Update crafting recipes 2016-11-09 14:20:24 +00:00
5a8008367f Updated creative inventory json with better NBT encode/decode, fixes enchanted books issues 2016-11-09 14:20:24 +00:00
911529a6cc Added jsonSerialize() to Item and fixed some crafting data decode issues 2016-11-09 14:20:24 +00:00
bee6c546dc Added decode for CraftingDataPacket and shell for MultiRecipe 2016-11-09 14:20:23 +00:00
e3c900e071 Merge pull request #70 from pmmp/24-level-leak
Fixed bugs related to #24 such as getName() on null. Close #24
2016-11-09 10:51:15 +00:00
e50311f1ea Fix wrong SPL submodule branch 2016-11-07 16:52:29 +00:00
0bdb8a46f7 Update submodules 2016-11-07 16:49:01 +00:00
074583d104 Builtin thread-local object storage for AsyncTask (#1)
* Added AsyncTask::fetchLocal()
2016-11-06 22:02:53 +08:00
3b7377370c Critical error upon missing submodules (#77)
* Critical error upon missing SPL

* Added checks for RakLib and PocketMine-Language

* It actually throws ClassNotFoundException, not simply returns false :(

Should I blame :shoghi:?
2016-11-06 11:46:39 +08:00
1ac74fe5bc Temporary fix for commands, remove permission filter 2016-11-05 19:02:08 +00:00
c494af618c Clean up some old code 2016-11-04 21:46:14 +00:00
557257baed Fix wrong SetHealthPacket decode 2016-11-04 16:29:51 +00:00
75cc99a003 Fix client crash on join. TODO: new recipe type 4 (no longer enchantment entry) 2016-11-04 12:57:11 +00:00
7dc839fbe8 Merge pull request #75 from pmmp/fix-op-perm-calc
Fix double permission recalculation on op status change, fixes double…
2016-11-04 10:13:52 +00:00
d3fb8c46f5 Fix double permission recalculation on op status change, fixes double sending of AvailableCommandsPacket 2016-11-03 18:05:12 +00:00
fffa5488fd Fix command resending when permissibles are recalculated 2016-11-03 17:35:20 +00:00
e60364d7c9 Corrected encode/decode of TextPacket parameters 2016-11-03 15:55:08 +00:00
cf222324d6 Fix high load when teleporting and some teleportation weirdness 2016-11-02 14:18:47 +00:00
d3c62988b0 Add unknown field to ResourcePackInfoEntry 2016-11-02 13:41:59 +00:00
b34d438ed9 Fix AddPlayerPacket field ordering 2016-11-02 09:38:31 +00:00
f50c63a0c2 update docs link 2016-10-31 18:07:30 +00:00
d1f59632c2 Merge pull request #67 from KnownUnown/system_php
Fixed detection of system PHP binaries
2016-10-31 17:45:49 +00:00
03003ffa50 Improved invalid spawnpoint checking 2016-10-31 14:05:50 +00:00
7a1cdf88e8 Fixed bugs related to #24 such as getName() on null 2016-10-31 13:50:18 +00:00
4856dbd1c6 Add PreProcessor as submodule, and fixed for 0.16. Close #69 2016-10-31 13:24:57 +00:00
16d07e1f3d Remove redundant return value for setImmobile() 2016-10-30 17:07:06 +00:00
daed82612c fixed system PHP detection 2016-10-30 12:07:01 -05:00
16d72c7f86 Remove redundant type-hint causing crashes 2016-10-30 17:03:29 +00:00
ce5fa0e836 Fix FallingSand metadata 2016-10-30 15:54:02 +00:00
dc07fc42b4 Merge pull request #42 from pmmp/0.16
Update to 0.16 (1.6.1dev, API 2.1.0)
2016-10-30 11:27:10 +00:00
fdf3c0c1c7 Change Unknown Command message colour to Gold to highlight client command issues 2016-10-30 10:20:17 +00:00
656ec60805 Fix plugin metadata crashes 2016-10-29 17:56:34 +01:00
293af3d55d Add levelId to StartGamePacket (previously unknown) 2016-10-29 14:46:51 +01:00
0ce25f8b29 Fix #59 (FloatingTextParticle undefined ) 2016-10-29 09:59:34 +01:00
06f8390b30 Fix furnaces and wrong smelting data recipe encoding 2016-10-28 21:46:20 +01:00
55ad6c6b95 Fix wrong comment 2016-10-28 13:31:47 +01:00
46af92f781 Fix dataless crafting and furnace recipes 2016-10-28 12:17:11 +01:00
2765e87677 Add slashes (my bad -_-) 2016-10-28 10:01:57 +01:00
5df916099d Fire PlayerCommandPreProcessEvent for CommandStepPacket 2016-10-27 22:08:27 +01:00
137972098f Fixes for AnimatePacket and added TextPacket::TYPE_WHISPER constant 2016-10-27 14:05:49 +01:00
3d2f9f0e74 Better InteractPacket handling and added ACTION_MOUSEOVER constant 2016-10-27 13:15:53 +01:00
9d16f145dd Creative inventory update with unknown item filter 2016-10-27 12:13:27 +01:00
ae1501884b More metadata and some cleanup 2016-10-27 10:55:06 +01:00
5234327b3f Improved action check for InteractPacket (#55)
Fixes issues with 0.16 combat, where the server thinks the player is attacking an entity they're looking at
2016-10-27 10:55:05 +01:00
689a052bda Update game permissions when op status changes 2016-10-27 10:55:05 +01:00
813bb98850 Add some permission constants to AdventureSettings 2016-10-27 10:55:05 +01:00
d9e6676176 Fix wrong flag names 2016-10-27 10:55:05 +01:00
bfc77a772a New entity data flags
@Intyre, you are beyond awesome
2016-10-27 10:55:05 +01:00
6bcb3aeb26 Add new values for potion colour and ambient. TODO: bubble transparency. 2016-10-27 10:55:05 +01:00
0f8a6481c6 Fix snowball throw direction
Blame Mojang, TODO: Revert this once the bug is fixed
2016-10-27 10:55:05 +01:00
db3e801478 Fixed snowballs 2016-10-27 10:55:05 +01:00
0f261b7baa Fixed player flags (now can sleep!) 2016-10-27 10:55:05 +01:00
6c1dd81130 Remove type-hints, fix some crashes 2016-10-27 10:55:05 +01:00
eed8c37eab Addresses issues noted by @SOF3 2016-10-27 10:55:05 +01:00
6e0cebbe38 Add missing import 2016-10-27 10:55:04 +01:00
902dd4258b Bump version to 0.16.0.5 and protocol to 91 2016-10-27 10:55:04 +01:00
ce72f634b0 Update some old code 2016-10-27 10:55:04 +01:00
2dfca14714 Add varint length checks (10 bytes, currently no proper varlong support) 2016-10-27 10:55:04 +01:00
2ffbb452bb Fix a bunch of metadata bugs, fixed air ticking and added some new API methods 2016-10-27 10:55:04 +01:00
468b3e8d44 Flags now work on mobs, but not on players
This commit no doubt breaks something, somewhere
2016-10-27 10:55:04 +01:00
035084a5ac Remove useless override 2016-10-27 10:55:04 +01:00
869721a8ee Add more unknowns 2016-10-27 10:55:04 +01:00
787f6594b2 More new data properties 2016-10-27 10:55:04 +01:00
867ec6b509 Fix leads, crashes 2016-10-27 10:55:03 +01:00
b6e1a21566 Add new metadata type vector3f and correct metadata encoding. Result = client crash. TODO: new data values and flags. 2016-10-27 10:55:03 +01:00
694c9b151f Move default data to json 2016-10-27 10:55:03 +01:00
ed69303b4a Add permission checks back in 2016-10-27 10:55:03 +01:00
192fba9c88 Resend command data when op status changes 2016-10-27 10:55:03 +01:00
018897062c Initial working slash commands on 0.16. TODO: new API 2016-10-27 10:55:03 +01:00
b198f287db Add AvailableCommands and CommandStep packet shells 2016-10-27 10:55:03 +01:00
750462aa75 Fix large signed varint/negative number CPU leak 2016-10-27 10:55:03 +01:00
b1df4728d3 BatchPacket payload checks, fix crashes when older versions try to join 2016-10-27 10:55:03 +01:00
5eb2459355 Fix player list duplicates 2016-10-27 10:55:02 +01:00
1120dff492 Fix player lists and skins 2016-10-27 10:55:02 +01:00
bd1b18d9af Fix issues on 64-bit systems -_- (hate php) 2016-10-27 10:55:02 +01:00
01d465b038 Add decode for LevelSoundEventPacket
TODO: find new fields, find out when client sends this
2016-10-27 10:55:02 +01:00
d6fcc59a49 Support changing gamemode in GUI and fixed spectator flight controls 2016-10-27 10:55:02 +01:00
a45e232829 Fix wrong SetDifficultyPacket decode 2016-10-27 10:55:02 +01:00
9497dff3ee Add decode for ResourcePackClientResponse (fields unknown) 2016-10-27 10:55:02 +01:00
df88e9272e Fix DisconnectionScreen, add getBool() and putBool() methods, update some packets 2016-10-27 10:55:02 +01:00
ec328a8160 >_> 2016-10-27 10:55:02 +01:00
7cd7a7fbf6 Spawn working on new build. TODO: Resource packs. 2016-10-27 10:55:02 +01:00
9a12aa689e New StartGamePacket fields for 0.15.90.8 2016-10-27 10:55:02 +01:00
39ffc28f2a Auto-generated data for 0.15.90.8 (not functionalyet) 2016-10-27 10:55:01 +01:00
9242f89221 Add PlayerToggleFlightEvent 2016-10-27 10:55:01 +01:00
e35ed7f04a New fields for LevelSoundEventPacket (previously unknown) 2016-10-27 10:55:01 +01:00
08f11412a4 AdventureSettings fixes and added isFlying properties and methods 2016-10-27 10:55:01 +01:00
2bb50792c3 Fast commands hack for old plugins. 2016-10-27 10:55:01 +01:00
85c50731f8 Fixed crafting (cannot test enchanting) 2016-10-27 10:55:01 +01:00
ff40c0a070 NBT updates and tile spawns fixed 2016-10-27 10:55:01 +01:00
8f9574dec5 Fixed FOV and attributes 2016-10-27 10:55:01 +01:00
86ed0f1397 Updated existing packets and added new ones 2016-10-27 10:55:01 +01:00
affed33066 Add length check assertions 2016-10-27 10:55:00 +01:00
9cde63a327 Base inventory fixes 2016-10-27 10:55:00 +01:00
401de97719 Fixed chunk loading and movement 2016-10-27 10:55:00 +01:00
dd0c5efb56 Initial spawn on 0.16 2016-10-27 10:55:00 +01:00
bb9ab525b6 Fix quadruple-quote key parser bug 2016-10-26 22:18:06 +01:00
8053066ac0 Remove useless statement (#50)
* Remove useless statement

* Delete instead of commenting.
2016-10-23 17:03:51 +01:00
88d14e9923 Remove redundant ifndefs 2016-10-23 15:14:59 +01:00
702ab53e69 Moved the default mcr/mca worlds' spawn in the center of the r.0.0.mc* region file (#28)
The default mcr/mca spawn was not centered in the 0,0 region causing the generation of not needed regions walking just a bit
2016-10-21 13:50:30 +01:00
0163555d3e Add warning for xdebug on server startup 2016-10-21 13:44:38 +01:00
1c41667b9b Remove useless submodule (unused) (#39) 2016-10-20 20:22:44 +01:00
c2299b521f change homepage link 2016-10-20 11:43:32 +01:00
3692ddab1d Remove duplicate call to gc_collect_cycles
This is already done in forceShutdown(), and if it is not then the
process will have committed suicide and this will never be called
anyway. Either way, it's useless.
2016-10-19 22:08:44 +01:00
3ddfb97921 Support PC item save format with string ID, close #32 (#33)
* Fixed #32

* StringTag check, throw exception for other types

* Short, not int

* Fix misleading exception message
2016-10-19 09:41:59 +01:00
e7e476b65e Wooden and Stone slabs both placable 2016-10-18 18:19:58 +02:00
f3f853056a This messed up movement
Revert "Removed unneeded vars - fixed logical condition (#29)"

This reverts commit ef7a843fa3.
2016-10-18 17:10:06 +01:00
bcc641a25a Fix for slab placing, close #31 2016-10-18 17:37:40 +02:00
ebcc16d283 Fix --disable-readline command-line option does not work, close #34 (#35)
* Fix --disable-readline command-line option does not work, close #34

* add parentheses
2016-10-18 14:33:38 +01:00
4bc2275fc3 Merge branch 'ci' 2016-10-18 13:57:13 +01:00
ef7a843fa3 Removed unneeded vars - fixed logical condition (#29) 2016-10-18 12:52:18 +01:00
10698c892e Remove old script, add disable-readline option 2016-10-18 12:45:56 +01:00
43842691fe Merge branch 'new-labels' 2016-10-18 12:03:27 +01:00
8637a04e2b New label scheme 2016-10-18 12:03:11 +01:00
d53810c6bc Fix banlist crash when | is entered in any /ban arguments 2016-10-17 18:29:33 +01:00
f3e35bb94a Update some links 2016-10-17 14:41:59 +01:00
707847b46e Shell-based CI with lint scans 2016-10-17 12:59:20 +01:00
e81c738010 Update ISSUE_TEMPLATE.md 2016-10-17 12:14:16 +01:00
8f3b95164a Fix preprocessor issues
Blame @SOF3
2016-10-16 19:47:32 +01:00
19601f998a New Jenkins server 2016-10-16 19:04:18 +01:00
2fba1073dd Fix wrong comment 2016-10-12 13:24:00 +01:00
6b06e407c6 Delete .mailmap 2016-10-10 14:38:17 +01:00
0b270342b1 Update .mailmap 2016-10-10 14:33:30 +01:00
23e4ca64e4 Remove dupe load() causing reload debug spam
This call is completely redundant.
2016-10-10 14:10:37 +01:00
36207debe0 Update RakLib submodule
Fix DoS with empty packets does not trigger blocking
2016-10-08 13:41:50 +01:00
de28ddabdb Update RakLib submodule 2016-10-08 11:25:53 +01:00
c328d7359c Labels do not have restricted length
WhataTerribleFailure
@sekjun9878 why did you add that?
2016-10-08 18:11:09 +08:00
5e72850a62 Merge branch 'pmmp-cntrb' of https://github.com/pmmp/PocketMine-MP 2016-10-08 18:05:58 +08:00
a9cbe4f63e Updated CONTRIBUTING.md to adapt into pmmp org
Updated CONTRIBUTING.md to adapt into pmmp org
2016-10-07 18:52:53 +08:00
beabc5a85c Merge pull request #14 from pmmp/disable-player-dat
Added options to disable saving <player>.dat
2016-10-07 18:47:01 +08:00
2a07638af3 Do not show playerNotFound notice if player data should not be saved 2016-10-07 17:52:25 +08:00
d6fd9259cf Added options to disable saving player.dat 2016-10-07 10:25:26 +01:00
16c09e3610 Merge branch '0.15.10'
Skin models again
2016-10-06 09:46:59 +01:00
b78dd70f72 Bump version to 0.15.10.0 and protocol version to 84
Changes unknown
2016-10-05 15:29:27 +01:00
92784054cd Creative inventory fixes 2016-10-05 10:07:00 +01:00
98ea674d20 Ouch 2016-10-04 18:48:07 +01:00
4b869c8615 Merge branch 'master' of https://github.com/pmmp/PocketMine-MP 2016-10-03 23:29:39 +08:00
ec79477b3e gitignore memory dumps 2016-10-03 23:24:34 +08:00
58ff381557 PhpStorm automated formatting (#11)
* PhpStorm reformatting

* Tuned PhpStorm reformatting

* Improved ItemIds and BlockIds formatting

* Tuned more PhpStorm reformatting

* Improved string concatenation
2016-10-03 19:05:48 +08:00
2b6d058760 Fixed kicked for flying when walking on lily pads (#7)
Add an optional extended description…
2016-10-03 09:17:50 +01:00
535e1a0eb4 Merge branch 'master' of https://github.com/pmmp/PocketMine-MP 2016-10-03 01:59:22 +08:00
4133f98b23 Updated a few tabs, updated SPL submodule 2016-10-03 01:59:06 +08:00
d7a78ee00f Merge pull request #10 from SOF3/master
Fixed some lines indented with 4 spaces rather than tabs
2016-10-03 01:05:23 +08:00
e913b16804 Fixed some lines indented with 4 spaces rather than tabs 2016-10-03 00:58:34 +08:00
6fc435da0e Imports rearrangement 2016-10-03 00:43:46 +08:00
84e15b6b1a Remove derp brackets (#8) 2016-10-02 17:22:19 +01:00
e9f2bf0085 Better time ticking and sync (#2)
* Remove unnecessary SetTimePacket spam

This is handled automatically client-side, as long as it is calculated correctly server side there is no issue (unless the server hits a spot of bad lag)

* Better client/server time sync when lagging
2016-10-02 12:54:27 +01:00
5f26c21b9f Remove unused RemovePlayerPacket 2016-10-01 21:39:05 +01:00
ee4854d07c Typo fix (#5) 2016-10-01 17:07:00 +01:00
9a379734ba Use \pocketmine\Thread::getThreadName() instead (#6) 2016-10-01 17:03:24 +01:00
a7366324e5 Fixed RawChicken::getAdditionalEffects return values (#4)
* Fixed RawChicken::getAdditionalEffects returns void

* Update RawChicken.php
2016-10-01 16:35:20 +01:00
39f731aa06 Remove use of deprecated Utils::getRandomBytes(16) (#3)
Whichever guy did that, somehow this one just got missed out?
2016-10-01 16:08:59 +01:00
7c41aa66f1 Update submodules 2016-10-01 15:49:25 +01:00
98d129f1f4 Fix bad copy-paste job, blame @shoghicp 2016-10-01 14:54:50 +01:00
99622c5ce7 Fix wrong network IDs for inventories, fix anvil/enchanting table windows 2016-10-01 14:48:42 +01:00
ad64a074cb Fix furnace NBT assertion errors and inventory not working 2016-10-01 14:14:55 +01:00
23f3097390 Travis: Build all branches 2016-10-01 13:44:31 +01:00
abf004de7d Change Travis links 2016-10-01 11:37:52 +01:00
ff4b7612a6 Update submodules 2016-09-30 20:25:17 +01:00
2d95bdc10f Remove derp semicolon (#11)
* Update Furnace.php

* fix formatting
2016-09-30 19:20:03 +01:00
50c5c1de92 Bump version to 0.15.9 and protocol to 83
Seems the only thing that changed was the cape skin models, which would not be rendered correctly by older clients.
2016-09-30 19:20:01 +01:00
e2e31d345d Allow vanilla trapdoor placement 2016-09-30 19:20:00 +01:00
7145e16bce Fix getHandler() returns null on tasks (#3) 2016-09-30 19:19:59 +01:00
5485b63e6e Added ChangeDimensionPacket 2016-09-30 19:19:58 +01:00
f2f70480ee Fixed precedence problem (#1)
as mentioned in 4cb76f369a (commitcomment-19068812)
2016-09-30 19:19:57 +01:00
900c4adb66 Create sign tile like it should be. 2016-09-30 19:19:56 +01:00
5f8dc5829c Better inheritance for wooden stairs 2016-09-30 19:19:55 +01:00
e962f7fb0a Fixed bug in updateAround where only one block is updated 2016-09-30 19:19:54 +01:00
a3e3a5f631 RNG: XorShift128 adapted from php-random library
Fixes world generation problems on 32-bit systems
2016-09-30 19:19:53 +01:00
b156480550 Fix redstone ore glowing immediately when placed
Do not update the block when placed
2016-09-30 19:19:52 +01:00
7b8548b2b1 Added Flower Pots 2016-09-30 19:19:51 +01:00
fbe17344fb Fix plugin crashes when attempting to get metadata of offline players 2016-09-30 19:19:50 +01:00
e143fb80da create .editorconfig to improve code displaying on github 2016-09-30 19:19:49 +01:00
795d6c8ddf Fix entity-related memory leak on chunk unload 2016-09-30 19:19:48 +01:00
6bd028f8b3 Fix Wood2 crashes 2016-09-30 19:19:47 +01:00
35c33ba980 Fix Glowing Obsidian lighting 2016-09-30 19:19:46 +01:00
895790f46c Fix signs going blank
Sign text is not limited to 16 characters anymore, but to the width of
the sign. Server: Stop being such a control freak
2016-09-30 19:19:45 +01:00
378c3d7994 Patch %0 client translation exploit 2016-09-30 19:19:44 +01:00
9808f874c8 Remove Stonecutter remnants 2016-09-30 19:19:43 +01:00
4198c445b0 Fixed Furnace crash 2016-09-28 13:59:53 +01:00
42e8120961 Remove creative container open checks (lines up with 0.14) 2016-09-28 13:59:53 +01:00
2a4f85107d Less duplication, more consistency 2016-09-28 13:59:53 +01:00
97f6b80969 Fix players levitating in beds and teleportation of sleeping players 2016-09-28 13:59:52 +01:00
a6f8379c40 Fix time bugs 2016-09-28 13:59:52 +01:00
bf4b96e144 Block: Fix fence gate rotation when opened or closed. TODO: fix gate opening direction 2016-09-28 13:59:52 +01:00
4f26e5598c Network: Fix crashes caused by AddEntityPacket 2016-09-28 13:59:52 +01:00
e00176b677 Closes #4181 @ PM
https://github.com/PocketMine/PocketMine-MP/issues/4181
2016-09-28 13:59:51 +01:00
f32d588b9b Inventory: Creative Inventory update 2016-09-28 13:59:51 +01:00
f14a8e46be Inventory: Fix creative/spectator inventory sending 2016-09-28 13:59:46 +01:00
5851e7fe55 Network: Do not attempt to decode further for non-accepted protocols
Prevents 0.16 players crashing 0.15 servers
2016-09-06 11:54:52 +01:00
Tux
8e9a078ff9 Use built-in random_bytes functionality 2016-09-06 11:47:58 +01:00
b16f7e4dd5 Fix a really annoying movement bug on player join 2016-09-06 11:42:30 +01:00
15b9578245 Fix reach distance bugs 2016-09-06 11:33:27 +01:00
765bd5ced7 Inventory: Fix hotbar spaz 2016-09-06 11:23:49 +01:00
df4c3ec4a6 Bump version and protocol to 0.15.4 2016-09-06 11:12:18 +01:00
6fb41c5c7f UpdateBlockPacket fixed and changed skinName to skinId 2016-06-22 01:09:48 +02:00
df8e1e8702 Spawn unleashed, movement fixed and some Player DataProperty cleanup 2016-06-22 00:08:52 +02:00
ef8227a074 Bump version to 0.15.0.0 and protocol changes 2016-06-15 23:59:35 +02:00
80d6f8dfb3 Updated submodule 2016-06-07 10:41:57 -04:00
e2d079a7df Bump version to 0.14.3.0 and protocol changes 2016-05-20 00:21:44 +02:00
ee9ba9f1a0 Merge branch 'mob-heads' 2016-05-18 10:10:10 -05:00
292a212827 Merge branch master 2016-05-18 10:07:57 -05:00
ac482621a1 Bump version to 0.14.2.0 and protocol changes 2016-04-28 01:50:54 +02:00
754ff9b4c4 Fixes #3223 2016-04-04 17:59:23 +08:00
aade3fe390 Closes #3432 2016-03-28 02:42:08 +08:00
8441169365 Fixed warning messages when parsing @notscript files 2016-03-28 02:27:03 +08:00
e51c6b4b42 Merge branch 'notscript' 2016-03-28 01:26:29 +08:00
73f24786cd Fixed @notscript without trailing spaces not detected 2016-03-28 01:26:15 +08:00
13d1089d30 Fixed PluginManager:: type doc 2016-03-23 23:57:02 +08:00
eb3c1f95b0 Updated .gitignore to stage src/pocketmine/resources/pocketmine.yml 2016-03-23 23:56:29 +08:00
012d46dfd8 Added Mob Heads
Fixed duplicated items in JSON file
2016-03-22 22:25:36 -06:00
2fb3b41b8d Added the @notscript tag in potential script plugins
Then we can have .php files in the plugins folder that contain /** but are not script plugins
2016-03-23 02:32:11 +08:00
085ff56362 Clearer Config::__construct() documentation. 2016-03-21 14:41:49 +08:00
23da42f8a4 Merge pull request #4068 from PocketMine/PEMapModder-patch-2
Promotes the use of reactions
2016-03-18 23:35:36 +08:00
f82c59bdc4 Fixes #3991, closes #4011 2016-03-15 22:52:49 +08:00
3f801ff6f4 Promotes the use of reactions 2016-03-13 23:40:30 +08:00
6ba0abf587 Update README.md
Mentions that mbstring is used (already used in Player.php)
2016-03-11 01:16:07 +08:00
0b06a4f703 Fixed #3692; fixed "arrows should not catch fire in fire blocks" 2016-03-10 17:45:06 +08:00
8a0c2b7c4a Fixed time 2016-03-09 19:13:20 +08:00
8e909f05ca Fixed setSaturation() working incorrectly 2016-03-09 19:13:06 +08:00
27b7260c0a Merge branch 'master' of https://github.com/PocketMine/PocketMine-MP 2016-03-09 18:03:50 +08:00
dd22e4963f Fixed #4051 2016-03-09 18:02:35 +08:00
54254ffc88 Merge pull request #2955 from TruDan/master
Add DATA_SIZE to Slime!
2016-03-08 23:05:39 +08:00
9a3929d8ad Merge pull request #3724 from thebigsmileXD/patch-2
Fixed commit #3595
2016-03-07 18:58:01 +08:00
913a1fdce4 Fixed #3463 2016-03-07 18:56:24 +08:00
6e41e6837f Fixed #3266 2016-03-07 18:50:26 +08:00
df7eaa7242 Closes #3548 2016-03-07 18:48:27 +08:00
08e6caad88 Fixed #3563 2016-03-07 18:38:42 +08:00
fc08759199 Merge pull request #3978 from PEMapModder/attr
Implemented attributes
2016-03-07 18:15:15 +08:00
09ce8fab82 Fixed speed and slowness potions 2016-03-07 18:12:54 +08:00
781de3efab Addresses #4024 2016-03-06 23:13:33 +08:00
95abec1886 Merge pull request #4009 from Falkirks/patch-1
Update ISSUE_TEMPLATE.md
2016-03-02 01:31:47 +08:00
5e1f38bdb3 Update ISSUE_TEMPLATE.md 2016-03-01 08:42:46 -08:00
de10dfa737 Added issue template 2016-02-29 00:06:20 +01:00
a43db5ca25 fixed #4006 2016-02-28 22:54:56 +01:00
ccadb5f2bb Merge pull request #3526 from PEMapModder/patch-9
Fixed getNested() using cache desynchroinized from set()
2016-02-28 23:10:12 +08:00
218eed1e7a Merge pull request #3959 from dongjoon-hyun/show_travis_build_status
Show Travis-CI Build Status on README.md.
2016-02-28 10:29:29 +08:00
d39f3059dd Show Travis-CI Build Status on README.md.
For Github visitors, many projects shows its project build status in README.md.
It would be nice if PocketMine-MP shows Travis-CI build status, too.
Here is the sample layout in this PR branch.

https://github.com/dongjoon-hyun/PocketMine-MP/tree/show_travis_build_status

Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
2016-02-27 18:05:56 -08:00
2c1ef0ada3 Updated raklib module 2016-02-28 00:14:25 +01:00
e11b76318c fixing chunk sending 2016-02-27 16:35:38 +01:00
b766b969e2 Merge pull request #3387 from PEMapModder/patch-6
Allow saving resources with parent directory being recursively created
2016-02-27 20:52:03 +08:00
d6c9bcbabb Merge pull request #3993 from dongjoon-hyun/fix_travis_test
Fix Travis Test.
2016-02-27 19:40:53 +08:00
f00b52f04d Fix Travis Test. 2016-02-24 19:10:07 -08:00
Dan
35f0f36524 Update Grass.php
@PEMapModder is that all correct now?
2016-02-24 12:06:28 +01:00
e9eaf69a41 Removed redundant debug code 2016-02-23 22:33:53 +08:00
f34f54664f Merge branch 'master' of https://github.com/PocketMine/PocketMine-MP 2016-02-23 21:13:29 +08:00
7ba7eaf303 Fixed wrong InteractPacket constants
Thanks @thebigsmileXD
2016-02-23 21:05:59 +08:00
16c36d5a50 Updated TesterPlugin submodule 2016-02-23 13:36:03 +01:00
ad70e23659 Updated travis 2016-02-23 13:08:57 +01:00
ccb60ff81e update loop die 2016-02-23 18:25:04 +08:00
eb00dee8a6 removed int return from getSeed 2016-02-22 13:03:27 +01:00
068ad5e924 Added ACTION_JUMP
Thanks @thebigsmileXD
2016-02-22 19:41:30 +08:00
ed9888a2cb Fixed #3963, closes #3979, added hash for non-numeric seeds 2016-02-22 19:40:40 +08:00
41a847567c RandomSeed should be a TAG_Long 2016-02-22 18:42:49 +08:00
d59fd42fc6 Fixed EntityEatItemEvent::setResidue() declaration 2016-02-22 18:34:11 +08:00
86ec7ed771 Fixed player not dying 2016-02-22 18:24:51 +08:00
1574a823d4 Fixed #3864 2016-02-22 16:29:41 +08:00
17c73e9764 Fixed #3690 2016-02-22 16:26:35 +08:00
6945256e30 Resolved #3684 2016-02-22 16:05:45 +08:00
56644fed9d Fixed #3961 2016-02-22 15:42:44 +08:00
e2f7d657e8 Fixed trapdoors 2016-02-22 15:32:07 +08:00
83f29fd871 Fixed a crash 2016-02-22 15:06:45 +08:00
a2641f923d Merge branch master 2016-02-22 14:32:48 +08:00
36028679d8 Merge pull request #3956 from redcrab2016/redcrab2016-patch-1
PR: Bug Fix - Crash if player is spawn to Y coord. >0 & <1
2016-02-22 14:15:11 +08:00
542781c2b1 Merge branch 'php7-0.14-64ff00-01' of https://github.com/PurePlugins/PocketMine-MP 2016-02-22 01:11:55 -05:00
3640e13f17 Added some assertions for level seed 2016-02-21 22:46:44 -05:00
f98f180bbd fix for #3972 2016-02-21 22:21:50 +01:00
a6cd526e60 PHP7 to master 2016-02-21 12:47:30 +01:00
9acbd85b25 Bump version to 0.14.0.0 2016-02-19 13:39:42 +01:00
ffa835d730 Fixed #3557 2016-02-19 18:50:38 +08:00
80250aa78e Resolved 1️⃣ in #3961 2016-02-19 18:33:21 +08:00
675583293f Crash if player spawn back to Y coord. >0 & <1
The issue come from  line 2664 : $v = $spawn->floor()  
If $spawn->y is in ]0..1[ then $v->y == 0
Then getBlockId : line 2670 use  'y' as -1 => Crash boom
2016-02-18 10:54:54 +01:00
fc42fc534b Merge pull request #3952 from dongjoon-hyun/add_docs_for_throws
Add @throws docs.
2016-02-18 16:45:54 +08:00
302fb9e65e Add @throws docs.
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
2016-02-17 14:22:47 -08:00
fe2957c315 Fixed imports 2016-02-18 01:43:42 +08:00
21c2e2d429 Closes #3832 2016-02-18 00:08:44 +08:00
3a184ddf97 Merge pull request #3915 from legoboy0215/patch-3 2016-02-18 00:05:10 +08:00
92ee4b3c73 Merge pull request #3876 from PEMapModder/patch-12
Add return value for PluginBase::saveDefaultConfig()
2016-02-17 20:33:15 +08:00
420007cef8 Merge remote-tracking branch 'origin/php7-0.14' into attr 2016-02-17 19:58:48 +08:00
5459576833 Added hunger and experience saving 2016-02-17 19:56:19 +08:00
05530bedc6 Bump to 0.14.0.7, new packets and fixes 2016-02-16 00:43:59 +01:00
1b4880a22f Merge branch 'patch-1' of https://github.com/Pub4Game/PocketMine-MP 2016-02-14 21:36:12 +08:00
a75c713d34 Merge pull request #3665 from zhsj/fix-start-sh
fix test php binary in start.sh
2016-02-14 21:30:02 +08:00
ef0f74bbd8 Merge pull request #3564 from PEMapModder/patch-11
Added additional information to Plugin::getDataFolder()
2016-02-14 16:09:45 +08:00
03c19aefbf Merge branch 'master' of https://github.com/PocketMine/PocketMine-MP 2016-02-12 14:09:39 +08:00
3b51d2c217 Resolved #3937 2016-02-12 14:08:59 +08:00
e79976bdac Added events 2016-02-11 22:07:04 +08:00
8807617480 Fixed attriutes not sending 2016-02-11 18:45:58 +08:00
cfca0a8726 Fixed TallGrass::getDrops() 2016-02-11 16:51:27 +08:00
28967ca495 Fixed eating 2016-02-11 15:42:07 +08:00
52e8781d36 Implemented hunger-related regen and damage 2016-02-11 01:53:51 +08:00
329a525ea1 Implemented food and hunger 2016-02-10 22:49:48 +08:00
d538a254ee Resolves #3918 2016-02-09 18:25:16 +08:00
074d7ed95c Resolve CompressBatchedTask-related crashes 2016-02-07 23:36:16 +09:00
1b6e8c14f0 Bump protocol version for 0.13.2 2016-02-06 22:01:26 +01:00
1082e32fd7 Fixed ShapedRecipe constructor 2016-02-07 01:02:40 +08:00
d5d2f46db2 Added "getter" for in air ticks. 2016-02-01 07:25:40 +08:00
e5937926cd Fix typo on ContainerSetSlotPacket
hotboar -> hotbar ![](http://i.imgur.com/n97uQb9.png)
2016-01-30 14:03:28 +01:00
e597314331 Read creative menu items from json 2016-01-28 04:39:30 +01:00
8a0bd85656 Item and Block, some wont work yet 2016-01-28 04:37:09 +01:00
b7d8956f23 Use ingredient damage to check inventory items on crafting event 2016-01-26 23:43:54 +01:00
bc3dca4736 Support for 0.14.0.1 2016-01-26 22:01:35 +01:00
d5f3c19054 Fix crafting not taking item from inventory 2016-01-25 23:10:18 +01:00
c7c78b1159 Read recipes from json 2016-01-25 20:40:26 +01:00
e2a400dd6b Fix for command alias arguments 2016-01-25 18:47:20 +01:00
99855773d7 Fix for command alias arguments 2016-01-24 18:33:34 +01:00
a2734f6dc0 Merged master into php7 to support 0.13.1 2016-01-22 17:36:45 +01:00
b66ce90c94 Add return value for PluginBase::saveDefaultConfig() 2016-01-16 11:39:11 +08:00
73b97c9490 fix sound error 2015-12-29 19:11:39 +03:00
ee0d4aa124 Merge pull request #3810 from markkrueg/markkrueg-patch-1
Fix Stair.php : add "use pocketmine\item\Tool;"
2015-12-28 17:42:26 +01:00
0b42ead2ab Update Stair.php to add use pocketmine\item\Tool;
Without this >= Tool::TIER_WOODEN does not work; so stone stairs do not give drops when broken. They also revert to not being broken on next connection.
2015-12-27 12:44:56 -08:00
78525e1f74 Seperated kick/ban messages 2015-12-22 21:26:26 +01:00
fb87165cd5 Merge branch 'PEMapModder-patch-12' 2015-12-20 00:41:03 +01:00
9f481fbdbe Merge branch 'patch-12' of https://github.com/PEMapModder/PocketMine-MP into PEMapModder-patch-12 2015-12-20 00:40:52 +01:00
7125148756 Merge branch 'MagicDroidX-patch-6' 2015-12-20 00:39:32 +01:00
9ca8c06f82 Merge branch 'patch-6' of https://github.com/MagicDroidX/PocketMine-MP into MagicDroidX-patch-6 2015-12-20 00:39:19 +01:00
32a0b61c2d Merge branch 'PEMapModder-patch-14' 2015-12-20 00:37:28 +01:00
15d6bf663d Merge branch 'patch-14' of https://github.com/PEMapModder/PocketMine-MP into PEMapModder-patch-14 2015-12-20 00:37:07 +01:00
d67fb9a721 Merge branch 'TrinityDevelopers-patch-1' 2015-12-20 00:32:07 +01:00
9ff58f6ab3 Merge branch 'patch-1' of https://github.com/TrinityDevelopers/PocketMine-MP into TrinityDevelopers-patch-1 2015-12-20 00:31:52 +01:00
b83964e527 Merge branch 'PEMapModder-patch-19' 2015-12-20 00:31:04 +01:00
c3e756a712 Merge branch 'patch-19' of https://github.com/PEMapModder/PocketMine-MP into PEMapModder-patch-19 2015-12-20 00:30:53 +01:00
55ce453e17 Merge branch 'Creeperface01-patch-11' 2015-12-20 00:30:15 +01:00
e4ab7a08ec Merge branch 'patch-11' of https://github.com/Creeperface01/PocketMine-MP into Creeperface01-patch-11 2015-12-20 00:28:50 +01:00
c1a484ee5c fixed #3702 and fix for setting timezone from php.ini 2015-12-19 23:58:05 +01:00
261ce1ba8b Merge branch 'mcpe-0.13' 2015-12-19 11:38:05 +01:00
90c3e66e6b Updated for .13.1. skinName replaces isSlim, API bump 2015-12-16 14:37:46 +01:00
7954754d4c Update Cake.php 2015-12-04 16:00:02 +01:00
2ddc4455c5 Added some blocks and items 2015-11-29 01:46:35 +01:00
c803dd8e69 skins fixed and added SetPlayerGameTypePacket 2015-11-26 00:47:58 +01:00
2e5490fb5b Merge pull request #3743 from hmy2001/patch-3
From TileEntityDataPacket in BlockEntityDataPacket
2015-11-25 17:05:16 +01:00
4f12533ad3 Update ChestInventory.php 2015-11-25 21:08:28 +09:00
8edebed11c Update DoubleChestInventory.php 2015-11-25 21:08:04 +09:00
963f7ee077 Update Spawnable.php 2015-11-25 21:00:03 +09:00
734736492a Added some creative items and removed nether reactor 2015-11-23 21:56:38 +01:00
58709293cf Fixed crafting 2015-11-23 21:04:23 +01:00
2ea81710ad Bump protocol and fixed packets for 0.13.0 2015-11-23 21:01:02 +01:00
Dan
f35db4a183 Fixed commit #3595
See https://github.com/PocketMine/PocketMine-MP/pull/3595
2015-11-20 13:01:28 +01:00
815411968b Silence the ifconfig not found message 2015-11-20 00:34:29 +08:00
cbed8d40ff Fix a mispelled "new" call 2015-11-05 17:11:42 -06:00
680d40d070 fix test php binary in start.sh 2015-11-01 20:47:41 +08:00
ea8ba995ac Update Player.php 2015-10-31 21:18:06 +08:00
6ae0f3c8d8 Cleaner (and maybe faster) INI parsing 2015-10-31 20:31:24 +08:00
4d5da41cd0 Fix autoSave in PlayerQuitEvent 2015-10-31 13:22:45 +08:00
f9d7e204c8 Block update on WallSign fix 2015-10-11 01:32:33 +02:00
94b79ac28a Tool tier added to getDrops 2015-10-11 00:52:44 +02:00
958c3589c9 Fix for #3569 NetherBrickFence 2015-10-10 23:40:59 +02:00
8ce02d8687 Hunger effect is not implemented 2015-10-10 23:30:42 +02:00
09b4d4dc7a Fixes for derps found with PHPStorm code inspector 2015-10-10 23:10:24 +02:00
813acc54dc Fixed translation for banlist command usage 2015-10-10 23:06:28 +02:00
c4fb469b4e Fixed recursive call 2015-10-10 05:26:01 +02:00
04fc062b2a Merge pull request #3568 from MagicDroidX/patch-3
Fixed recursive call
2015-10-08 07:40:58 +10:30
4e59d85cca Fixed recursive call 2015-10-07 17:04:27 +08:00
ae9a3dbd81 Added additional information to Plugin::getDataFolder() 2015-10-06 20:32:33 +08:00
84be56fefb edited TODO.md 2015-10-02 00:49:56 +02:00
19b2e1b4af sorted items in init() 2015-10-01 20:05:31 +02:00
cc8eca3084 Fixed string class conflict 2015-10-02 01:52:10 +08:00
6013213159 More items 2015-10-01 08:23:05 +02:00
a7413dac92 Merge branch with fixes for recipes 2015-09-30 18:14:51 +02:00
34df516d94 new branch to fix all issues with items and blocks 2015-09-30 18:09:09 +02:00
85dc136631 Crafting recipes, and packet fix 2015-09-29 00:45:57 +02:00
72e9765ec8 Merge branch 'Stonecutter-Recipes' of git://github.com/willowmaster66/PocketMine-MP into recipes-0.12-fix
Testing pull request.
2015-09-29 00:40:23 +02:00
cf3d8f449e Added some asserts 2015-09-27 19:48:42 +02:00
eaef40618b Send default reliable and ordered packets on RakNet 2015-09-27 19:48:31 +02:00
f560d07c97 Merge remote-tracking branch 'origin/mcpe-0.12' into php7 2015-09-27 14:31:28 +02:00
606948ef8e Fixed return value of Level::getTickRateTime() 2015-09-27 14:31:15 +02:00
46760abafc Require pthreads 3.0.7 2015-09-27 14:30:50 +02:00
a7e5e33db8 Merge pull request #3507 from alejandroliu/crafting-event
Added Player to CraftItemEvent
2015-09-27 14:05:38 +02:00
ddc140af5e Updated to new pthreads version, updated RakLib 2015-09-27 13:37:27 +02:00
a3ad5783b7 Fixed getNested() using cache desynchroinized from set() 2015-09-26 12:21:43 +08:00
cbef0e25a1 Merge pull request #3454 from Yosshi999/master
Fixed DoorSound won't be played
2015-09-25 10:01:15 +02:00
6273875a22 Added Player to CraftItemEvent 2015-09-19 23:08:57 +02:00
0b9ef5b856 Update of the stonecutter recipes
Added the shaped recipes and removed the shapeless ones.
2015-09-18 22:18:14 +02:00
a3bce67d35 Updating blocks and items
Added new blocks/items and added constants to existing blocks/items for
clearer recipe making.
2015-09-18 22:17:24 +02:00
cd6afb2020 Merge remote-tracking branch 'PocketMine/mcpe-0.12' into Stonecutter-Recipes 2015-09-18 22:14:34 +02:00
0bcf639a98 Changed how exceptions work and are logged, throw proper exceptions on tasks 2015-09-18 12:03:24 +02:00
472fcfa4c7 Removed ThreadedFactory 2015-09-18 11:18:41 +02:00
8768b7fdbd Merge remote-tracking branch 'origin/mcpe-0.12' into php7 2015-09-17 12:25:05 +02:00
86c1198648 Merge pull request #3495 from 0929hitoshi/mcpe-0.12
Changing the return value of getName
2015-09-17 09:47:30 +02:00
9665dfd63e Changing the return value of getName 2015-09-16 01:21:07 +09:00
ed559fdf98 Fixed not sending UUIDs properly 2015-09-15 12:23:15 +02:00
24f8de2cc3 Bad hack, TODO REMOVE, workarounds client bug by sending inventory contents specifically for creative players <-- this commit is full of sadness 2015-09-14 20:25:57 +02:00
885fc07e5c Merge pull request #3481 from LouisBHirst/patch-getOnlinePlayers
getOnlinePlayers() only returns the players already connected
2015-09-13 21:01:51 +02:00
3892d5d74f Removed call to detach 2015-09-13 17:56:21 +02:00
c7b915639d getOnlinePlayers() only returns the players already connected 2015-09-13 11:43:51 -04:00
21c3d03000 Removed sleep from ServerKiller 2015-09-13 17:38:55 +02:00
2d1b2050dc Merge remote-tracking branch 'origin/mcpe-0.12' into php7 2015-09-12 17:10:45 +02:00
3ffdb8e552 Removed @deprecated classes, methods and properties, added some type hints 2015-09-12 17:10:11 +02:00
79aa7583ec Merge pull request #3471 from PEMapModder/patch-7
Update Player.php
2015-09-12 15:16:10 +02:00
0d6f13cb4f Update Player.php 2015-09-12 20:53:35 +08:00
29a5012c02 Merge remote-tracking branch 'origin/mcpe-0.12' into php7 2015-09-12 01:03:09 +02:00
a1a1327415 Removed signed parameter in BinaryStream->getShort() in favor of getSignedShort() 2015-09-12 00:57:09 +02:00
16ff2d99b0 Merge remote-tracking branch 'origin/master' into mcpe-0.12 2015-09-11 17:34:11 +02:00
cb222601fd Haters gonna hate, also fix misleading interface default parameter 2015-09-11 16:50:57 +02:00
922e9d93d5 Moved exception handler to a big try catch 2015-09-11 09:09:45 +02:00
e137ac4c56 Base PHP7 work to make it "run" - READ NEXT LINES!
All plugins will need to bump the API if they want to use this.
NOTE THAT THIS IS NOT THE FINAL API 2.0.0 AND THAT THERE WILL BE MORE CHANGES.
To start updating, you might also want to read https://secure.php.net/manual/en/migration70.php and specifically https://secure.php.net/manual/en/migration70.incompatible.php

To compile PHP7 with some of the required dependencies, use https://gist.github.com/shoghicp/166ab26ce5cc7a390f45
ONLY LINUX IS TESTED, DO NOT ASK FOR OTHER PLATFORMS!

----- THIS VERSION IS NOT SUPPORTED -----

This version WILL crash randomly in unexpected places due to PHP7, pthreads, PocketMine or cosmic rays.

Handle with care, and store under direct sunlight for the best performance.
2015-09-10 21:29:29 +02:00
9501d03552 FIxed a bug No sound for TrapDoor
missing "use pocketmine\level\sound\DoorSound;"
2015-09-06 22:59:02 +09:00
ccca3ec0bf FIxed a bug No sound for FenceGate
missing "use pocketmine\level\sound\DoorSound;"
2015-09-06 22:55:56 +09:00
8f24306d65 Merge remote-tracking branch 'origin/master' into mcpe-0.12 2015-09-05 18:22:28 +02:00
59a775f82c Merge pull request #3448 from willowmaster66/willowmaster66-patch-4
First item in the hotbar is not loaded correctly
2015-09-05 18:19:45 +02:00
5baa87e9fe First item in the hotbar is not loaded correctly
When you logon the first hotbar item contains the first item of the inventory, but it should contain the previously selected item.
2015-09-04 23:40:19 +02:00
bdf5c46793 Merge branch 'master' into mcpe-0.12 2015-08-31 17:51:07 +02:00
4bd14e7424 Revert commit that removed useful parameter for plugins that made backwards-incompatible changes
Revert "@PEMapModder Removed redundant parameters for Living::knockBack. Closes #3427."

This reverts commit 9adcc19154.
2015-08-31 17:48:52 +02:00
a18826473b Added enderman teleport sound 2015-08-31 17:48:28 +02:00
9adcc19154 @PEMapModder Removed redundant parameters for Living::knockBack. Closes #3427. 2015-08-31 22:05:49 +09:30
66b86c3685 Merge pull request #3423 from willowmaster66/willowmaster66-patch-1
Block cache not cleared with a call to clearcache
2015-08-31 21:43:03 +09:30
7d18b92ea1 Merge pull request #3426 from PEMapModder/patch-7
Remove unused parameter in Level::requestChunk
2015-08-30 02:56:26 +09:30
0348d181d4 Remove unused parameter in Level::requestChunk 2015-08-29 18:03:40 +08:00
0b9b1738b3 Block cache not cleared with a call to clearcache
While trying to figure out Github and looking for a different bug I found this small bug in the code. The ClearCache function on Level.php did not correctly clear the blockcache.
2015-08-27 10:44:44 +02:00
244cef3b00 . <-- descriptive commit ftw! 2015-08-23 00:25:30 +02:00
b47cebb1d5 PHP7 changes 2015-08-23 00:25:30 +02:00
7f8b39a63c Renamed NBT tags to have Tag in the name 2015-08-23 00:25:29 +02:00
34dc6ea0d6 NOTE! THIS SHOULD BE REVERTED LATER! Removed WeakRef dependency 2015-08-23 00:25:29 +02:00
d7d05c20a9 Bumped to API 2.0.0 2015-08-23 00:25:29 +02:00
91bda131be Merge pull request #3395 from luca28pet/patch-1
Spelling fix
2015-08-22 23:37:23 +02:00
1a9ec65983 Spelling fix 2015-08-22 15:58:45 +02:00
4e0fc6d1de Allow saving resources with parent directory being recursively created 2015-08-18 10:20:04 +08:00
fabb632286 More changes! 2015-08-13 18:02:10 +02:00
99df6f8edc Updated language 2015-08-13 09:17:43 +02:00
6e2ea63ce1 Merge remote-tracking branch 'origin/master' into mcpe-0.12 2015-08-12 15:00:04 +02:00
31ef7721b1 Removed network channels, bumped protocol 2015-08-12 14:59:48 +02:00
f1cc8ddde4 Merge pull request #3372 from SuperMarcus/patch-2
Fix wrong id passed to constructer in CookedFish.php
2015-08-11 19:57:33 +02:00
25b9946d9e Fix wrong id passed to constructer in CookedFish.php 2015-08-11 23:06:40 +08:00
5a626405e3 Merge pull request #3368 from thebigsmileXD/patch-2
Added sound for opening/closing (FenceGates)
2015-08-11 12:58:34 +02:00
311d8d94dd Added sound for opening/closing (FenceGates)
Added DoorSound on opening/closing FenceGates depending on #3367 @0929hitoshi 's Idea
2015-08-11 12:48:41 +02:00
7d0810a5af Merge pull request #3367 from thebigsmileXD/patch-1
Added opening/closing sound
2015-08-11 12:27:18 +02:00
a5efd0bdf8 Added opening sound 2015-08-11 11:52:08 +02:00
ff232a9f04 Merge pull request #3332 from PEMapModder/dec
Disallow registration of events without handlerList, fixes #3330
2015-08-11 16:12:59 +09:30
8889e687c9 Changed TextPacket 2015-08-10 23:40:14 +02:00
0f993f8beb setDisplayName skin fix 2015-08-10 16:33:27 +02:00
d5c2702908 Update PluginManager.php 2015-08-10 22:14:11 +08:00
62848b914d Fixed String values on NBT parsing 2015-08-10 15:09:23 +02:00
0ce343d8ca Fixed escaping values in NBT parser 2015-08-09 13:52:15 +02:00
534b988a1c Added basic Nether generator 2015-08-09 00:38:23 +02:00
a9ead5567b Improved NBT json parsing, attribute base 2015-08-08 22:39:43 +02:00
f5429ef585 Merge remote-tracking branch 'origin/master' into mcpe-0.12 2015-08-08 16:50:37 +02:00
d729961bde Merge pull request #3331 from PEMapModder/patch-5
Fixes #3330
2015-08-09 00:12:35 +09:30
f093a6498d Added base enchantment adding utilities, /enchant command 2015-08-08 16:03:04 +02:00
4dd0469792 Base enchantment class 2015-08-08 14:53:03 +02:00
fe196c6404 Added display of names on death 2015-08-08 13:35:57 +02:00
fdf10b60dc Added PlayerToggleSneakEVent and PlayerToggleSprintEvent 2015-08-08 13:10:59 +02:00
d4163ea01c Added sneaking, sprinting 2015-08-08 13:02:59 +02:00
b3efb733a2 Improved block breaking timing, added faster block breaking with swords 2015-08-08 00:33:52 +02:00
fcba9596d6 Added CanDestroy and Lock tag 2015-08-07 22:20:01 +02:00
01d93d6e10 Added CanPlaceOn tag 2015-08-07 22:13:52 +02:00
1fa467eb58 Proper recipe ingredient matching, fixed crafting type resetting 2015-08-07 22:00:35 +02:00
3e2cce3c2c use cleanup 2015-08-07 21:26:24 +02:00
d026e2ecf0 Implemented new crafting mechanism 2015-08-07 21:26:12 +02:00
696edfd31f Added custom block data (example, chests), better deep checking of same NBT 2015-08-07 17:24:35 +02:00
e9c981b586 Updated lang 2015-08-07 16:28:49 +02:00
75b7b03857 Added support for more NBT data, renaming inventories, fixed tags not being saved, added support for tags in /give 2015-08-07 16:28:27 +02:00
d1bfb304cb Added some extra tile entities, fake enchanting table 2015-08-07 12:07:39 +02:00
cba9ff393c Fixed properties for NBT, fixed dropping items removing extra data set 2015-08-06 21:51:39 +02:00
02cb9d69a9 Save items properly on several places, added NBT::getItemHelper() and NBT::putItemHelper() 2015-08-06 21:44:00 +02:00
554bfb4855 Added methods for adding custom names directly to items 2015-08-06 21:09:37 +02:00
091d0b3ff9 Added compound tag checking for Item->equals() 2015-08-06 20:25:22 +02:00
a65109ff34 Oh well that fixes block placing 2015-08-06 17:47:17 +02:00
8a3c5ab6a1 Removed DropItemPacket field 2015-08-06 16:26:38 +02:00
2cec6812a8 Added extra data printing for Items, non-automatic bytearray on NBT 2015-08-06 14:51:41 +02:00
d0bfc826ea Updated protocol details, anvil menu creation 2015-08-06 11:51:41 +02:00
2e0ef645fa Fixed several issues with spawning/despawning Players/Humans, close #3345, close #3342 2015-08-05 13:40:11 +02:00
09720a2d90 Properly implemented Shaped recipes on Network and manager, no crafting! 2015-08-04 21:59:54 +02:00
9456e20770 Added support for extra data, improved BinaryStream 2015-08-04 18:29:13 +02:00
7fd053fb09 More changes! Alsp added Anvil block and BinaryStream 2015-08-03 18:04:13 +02:00
522932d7c0 Added new sounds, events, particles 2015-08-03 12:42:47 +02:00
2b2a1b18e7 Updated RakLib protocol 2015-08-03 10:54:24 +02:00
1b812d373c Updated protocol packet ids 2015-08-03 10:53:23 +02:00
5621ab0c49 Updated some packets for 0.12, UUIDs, other stuff! 2015-08-02 01:22:36 +02:00
4258e22c02 Made some changes for 0.12 2015-08-01 19:14:44 +02:00
ff16f2ef05 Disallow registration of events without handlerList 2015-07-29 21:47:39 -04:00
9bbaf5d00d Possible workaround with #3330
Filters away non-public event handlers
2015-07-30 09:21:35 +08:00
0380e9009a Added block break tool type, fixed falling sand, fixed duplicated jungle leaves 2015-07-27 20:31:55 +02:00
866fde5351 Improved speed of some int arrays, fixed block metadata 2015-07-27 20:31:55 +02:00
9f953fa675 Fixed #3232 2015-07-27 20:31:55 +02:00
4d95c65d95 Changed TIER_IRON to TIER_STONE 2015-07-27 20:31:55 +02:00
26c9eed82e Added all block hardness 2015-07-27 20:31:55 +02:00
f3c46b12c5 Block breaking part 1 2015-07-27 20:31:55 +02:00
b14d14d3d5 Merge pull request #3305 from SuperMarcus/patch-1
Fix wrong size increasing code.
2015-07-24 09:19:55 +02:00
60ab35774a Fix wrong size increasing code. 2015-07-24 15:14:17 +08:00
2df901b064 Merge pull request #3274 from SopaXorzTaker/patch-1
Update Utils.php #2
2015-07-17 06:44:15 +09:30
0c09361c46 Added main-hard-limit memory property similar to old memory-limit, use less memory on startup (RakLib) 2015-07-11 13:16:39 +02:00
1ebf2476df Merge pull request #3245 from alejandroliu/lastPlayed-fix
Fixes lastPlayed
2015-07-03 08:33:42 +02:00
fe85b5026d Fixes lastPlayed 2015-07-02 00:54:20 +02:00
bfd3fb6636 Merge pull request #3199 from alejandroliu/tile-fix-teleport-glitch-new
Teleport glitch fix
2015-06-20 09:48:08 +02:00
0723112207 Once again... 2015-06-19 21:06:15 +02:00
be9f5521e1 Fixed undefined index on async worker crash 2015-06-19 18:36:08 +02:00
6063738e69 Fixed setting inventory index after new entity id 0 for players 2015-06-19 17:14:09 +02:00
ef738ef299 Fixed effect entity id 2015-06-19 15:34:33 +02:00
5796784442 Stop calculating permissions on closed Players 2015-06-19 14:52:08 +02:00
a1cc60d472 Fixed eye height 2015-06-19 14:49:41 +02:00
f7ec1de0fd Players now have entity id 0 2015-06-19 14:40:05 +02:00
b856e5e909 Fixed #3093 2015-06-19 13:42:20 +02:00
f7e6246dc2 Destroy cycles that reference player for faster collection 2015-06-19 13:31:29 +02:00
b166628940 Added ability to dump memory 2015-06-19 13:01:49 +02:00
4e76c30788 Update Utils.php
Correct a typo
2015-06-17 08:39:18 +03:00
33e312c7d0 Added extra memory reportings (heap, stack), stop tasks faster, added extra timeouts fro ServerKiller 2015-06-13 15:37:02 +02:00
2ac27bd382 Improved safe spawn calculation, fixes #3094 2015-06-13 14:43:14 +02:00
f490ff8074 Added mossy stone brick recipe, added chiseled stone brick recipe, added cracked stone brick furnace recipe, fixed crafting stone bricks, fixed crafting stone brick slabs, closes #3161, fixes #3160 2015-06-13 13:45:05 +02:00
eeef81e2b1 Fixed #3154 2015-06-10 10:10:07 +02:00
4a8ca96aaa Skip getting bigger bounding boxes on higher tick rates 2015-06-09 18:24:17 +02:00
eef33d64e6 Fixed new players having air ticks to 0 instead of 300 2015-06-09 15:26:28 +02:00
7cf5df7e46 New console output formatting 2015-06-09 14:40:40 +02:00
ac2bcf7e30 Made /list output similar to PC output 2015-06-09 12:21:00 +02:00
ec226105e4 Added support for overriding properties over the command line 2015-06-09 11:23:57 +02:00
2a1a09a923 Create chunks in case of dropping items outside of world boundaries 2015-06-09 09:45:40 +02:00
20911930cf Fixed bad permission nodes on /kill, closes #3139 2015-06-09 09:45:10 +02:00
2eaa12005e Changed knockback process 2015-06-08 15:52:57 +02:00
fdcddcc04b Fix entity unloading after teleporting, closes #3136 2015-06-08 15:02:00 +02:00
4fd5e9ba7d Improved RakNet encapsulated packet encoding 2015-06-08 12:45:52 +02:00
7b17bf416e Fixed Arrows not hitting entities, added new movement system 2015-06-07 21:08:46 +02:00
d0f743a99e Fixed /time add message, chunk tick reset default 2015-06-07 20:15:30 +02:00
cbb1c55a06 Improved biome generation, get grass color from gradient interpolation, improved performance of generation, try to recreate grass colors from imported chunks, closes #2845, closes #1792 2015-06-07 15:17:02 +02:00
d881dbf1a2 Only spawn break particles when needed 2015-06-07 12:33:53 +02:00
383fcba8e1 Fixed skins issue 2015-06-07 12:17:27 +02:00
e5f28e0f7a Throw exception on invalid parameters on Inventory addItem() and removeItem() 2015-06-07 12:05:10 +02:00
cf3f32fdae Added Script plugin loader 2015-06-06 23:09:54 +02:00
c4bdbc5443 Report players as EntityPlayer all the time 2015-06-06 23:09:43 +02:00
62a8f58bb0 Improved block and chunk cache, fixed PlayerQuitEvent player save 2015-06-06 20:28:37 +02:00
f21ed39c1c Improved timing reports 2015-06-06 19:07:12 +02:00
b358a2e474 Fixed underscores >.< 2015-06-06 18:12:39 +02:00
21c6eeef11 Fixed A-Z range 2015-06-06 17:57:07 +02:00
96f67bdadf Added auto save to PlayerQuitEvent 2015-06-06 17:56:36 +02:00
6ee61cce7b Faster player login 2015-06-06 17:38:32 +02:00
7f6704f761 Chunk ticking depends on chunk loaders, fixes #3118 2015-06-06 17:38:10 +02:00
9e4d88a852 New extended packet timings 2015-06-06 16:58:49 +02:00
5682026eae Fixed state corruption for auto saving 2015-06-06 15:53:28 +02:00
2a805dc0ed Limited chat and sign length using UTF-8 2015-06-05 17:08:24 +02:00
bdb9b1865b Added exception when unloading the default level without switching it first, #3112 2015-06-05 16:48:27 +02:00
1e03c5b795 Workaround for players getting stuck on far chunks 2015-06-05 16:48:27 +02:00
ec82434ef4 Added charcoal for torches, improved recipe matching for wildcards, closes #3108 2015-06-05 16:48:27 +02:00
7bafa217c8 Fixed some saving 2015-06-05 16:46:53 +02:00
fe55023761 Better Terminal detection 2015-06-05 14:07:32 +02:00
ac4194eb3f Added lily pad, checked some bounding boxes 2015-06-05 13:58:59 +02:00
6e69e15dfd Moved network check out of level, added server killer for long stops 2015-06-05 11:46:33 +02:00
a53b041984 Improved region save and saving of chunks before population 2015-06-05 02:27:37 +02:00
d542dfc2ce Split player into more methods, added extra timings 2015-06-05 00:19:45 +02:00
188f4d7778 Clear chunk cache on tile change 2015-06-04 17:36:12 +02:00
71490f60f2 Fixed other invisibility issues 2015-06-04 16:51:48 +02:00
05dbf7b47f Fixed some corrupted states, probably fixed most invisible players cases 2015-06-04 15:46:57 +02:00
14ff537e71 Improved damage sources for projectiles, falling blocks, TNT, and items 2015-05-31 14:19:47 +02:00
9e14435dbb Moved network ids to constants, improved some entity methods, more performance 2015-05-30 23:59:24 +02:00
32680843fa Added multisize loading 2015-05-30 19:38:57 +02:00
9768bf4f8a Added BlockBreakEvent::getDrops() and BlockBreakEvent::setDrops(Item[] $drops) 2015-05-30 18:26:47 +02:00
7c806c7920 Added missing brace 2015-05-30 17:29:38 +02:00
b61c54c9cb Send motion to players on downwards movement 2015-05-30 17:16:12 +02:00
a349f6d4dd Merge pull request #3083 from PEMapModder/patch-5
Added Location::fromObject(Vector3, Level, yaw, pitch)
2015-05-30 17:11:40 +02:00
9541c9751b Merge pull request #3087 from PEMapModder/patch-6
Block break optimization
2015-05-30 17:09:36 +02:00
3c0efe9af2 Block break optimization 2015-05-30 22:20:05 +08:00
24c1e6880d Added Location::fromObject(Vector3, Level, yaw, pitch) 2015-05-30 12:46:40 +08:00
74917923b6 Improved checks, area collision checks, etc 2015-05-29 15:13:19 +02:00
f20d5b2c69 Fixed MainLogger 2015-05-29 11:38:18 +02:00
eaa42f8449 Workaround for bad calls to teleport, closes #3074 2015-05-29 10:17:27 +02:00
1e2038fac5 Faster respawn when needed 2015-05-29 10:04:56 +02:00
c8abbf4f2f Added Snowballs to the creative inventory 2015-05-29 10:04:31 +02:00
009a3b657f Merge pull request #3076 from xpyctum/patch-1
Torches didn't craft
2015-05-29 08:27:24 +02:00
5b57fe6967 Update CraftingManager.php
Torch can't crafting
2015-05-29 10:30:20 +05:00
f133154919 New chunk ordering algorithm 2015-05-29 00:35:40 +02:00
8d4decc548 Fixed bad vector initialization 2015-05-28 23:58:29 +02:00
3bb037204e light population is now optional via pocketmine.yml 2015-05-28 23:39:09 +02:00
c578898aa4 Moved light population to an async task when needed, improved empty chunks 2015-05-28 23:34:07 +02:00
0f5f71e612 Forgot to check chunks after moving 2015-05-28 22:55:09 +02:00
75cab3dfc3 Improved updates after first tick 2015-05-28 22:43:39 +02:00
03f178379e Fixed items getting corrupted pickup delay, not being able to be killed by other damage sources 2015-05-28 22:17:12 +02:00
ce59703dd0 Merge pull request #3072 from alejandroliu/Kill-entity-bug
Fixes bug #3071
2015-05-28 17:34:38 +02:00
a77d82ac81 Changed how creator tag works on signs 2015-05-28 16:44:31 +02:00
1833da01fe oops 2015-05-28 15:16:09 +02:00
c97e1fdce0 Made Player::close() final, fixes several plugin issues that crashed the server 2015-05-28 15:03:45 +02:00
0e9bff6f4e Fixed armor not being sent correctly to current player, fixes #3073 2015-05-28 14:28:23 +02:00
3dd4fe706c Changed Vector3 floor() and ceil() 2015-05-28 14:20:50 +02:00
9a2170d296 protocol 27, added player spawn events after death from new protocol, added EntityEvent constants 2015-05-28 14:19:00 +02:00
8a41512194 Fixes bug #3071 2015-05-28 00:44:16 +02:00
51062940c5 Implemented QueryRegenerateEvent as base for other interfaces 2015-05-26 01:17:34 +02:00
66435d4f6a Workaround client-sede issue, remove this when fixed 2015-05-24 10:16:43 +02:00
c4d63326be Fixed fix for flowers, removed corrupted flower state, added proper identifiers that do not collide, added remaining IDs everywhere for consistency, removed magic number for constants, closes #3058 2015-05-23 22:49:06 +02:00
f91a3a2666 Fixed invalid fix for block updates that corrupted state 2015-05-23 22:47:46 +02:00
d429992f5b Fix Fallable not dropping after explosion, Fixes #2735, Fixes #2806.
Signed-off-by: Michael Yoo <michael@yoo.id.au>
2015-05-23 22:36:23 +09:30
76c27fc18b Use broadcast permission to broadcast tips and popups 2015-05-23 22:05:48 +09:30
a0f8bc15dc Fix small whitespace issues, make broadcasts return count() as specified in PHPDoc 2015-05-23 22:05:48 +09:30
adc5aa11ac Added Server->broadcastTip() and Server->broadcastPopup()
Signed-off-by: Michael Yoo <michael@yoo.id.au>
2015-05-23 22:05:48 +09:30
388f5c2c91 Added flowers compatible with MCPE 0.11.
Signed-off-by: Michael Yoo <michael@yoo.id.au>
2015-05-23 21:57:59 +09:30
f64caf6c96 Use best method to create identifier on linux 2015-05-23 14:10:42 +02:00
b2b4cf788c Fixed possible channel order issue with chunks and start game packet 2015-05-23 13:38:50 +02:00
d7be531868 Limit amount of messages per tick per player to 2 2015-05-23 12:09:26 +02:00
5ad4f44dce Fixes sending newlines on messages to impersonate chat messages 2015-05-23 12:03:47 +02:00
7201372b0d oops 2015-05-23 12:02:20 +02:00
744ea6af8f Fixed #3023 2015-05-23 11:47:07 +02:00
1da0a48edb Fixed #3055 2015-05-23 11:37:48 +02:00
be6b0656a0 Do async saving only when needed 2015-05-23 10:54:15 +02:00
4f7aac50d3 build 13 2015-05-22 16:46:23 +02:00
149234f125 Added asynchronous file writing 2015-05-22 16:32:08 +02:00
cfe5ca91b2 Updated endpoint 2015-05-21 16:31:42 +02:00
46f20d36b3 Improved unique id generation for server 2015-05-21 12:59:33 +02:00
cde2d39029 New statistics system 2015-05-21 11:41:11 +02:00
36ddbf286d Build 12, added SILENT flag to entities, closes #3052 2015-05-21 11:40:51 +02:00
8d4abe2f39 Improved world loading, added chunk queue delay, closes #3046 2015-05-20 11:05:35 +02:00
32722856ea Updated FloatingTextParticle to use less heavy method 2015-05-19 21:59:23 +02:00
7753b1d8be Fixed items (and other entities) vibrating, bad offsets in tile calculation 2015-05-19 21:29:30 +02:00
92a2be024a Improved saving of modified properties 2015-05-19 20:49:47 +02:00
66f28f6dc4 Fixes #3042 2015-05-19 17:48:35 +02:00
1122a3c511 More undefined variables D: 2015-05-19 16:02:59 +02:00
0c6d8b9815 Fixed loader counter on Level, closes #1147 2015-05-19 14:49:18 +02:00
70a7c4c552 Added nametag saving 2015-05-18 19:04:37 +02:00
840690d801 Replaced old deprecated calls 2015-05-18 15:52:31 +02:00
f3a53be117 Moved Human->setNameTag() to Entity 2015-05-18 15:29:31 +02:00
ea7c0cb357 Removed debug code 2015-05-18 14:00:21 +02:00
85c43ba011 Allow setting nametag for any kind of entity 2015-05-18 13:08:06 +02:00
fbbe02a3bc Fixed some issues related to new indexes 2015-05-16 22:36:55 +02:00
fb05636694 Fixed Item vibration 2015-05-16 21:38:10 +02:00
63a5269313 Added settings.profile-report-trigger to only extract timings on a given tps rate 2015-05-16 16:02:32 +02:00
7705d8c52f Updated translations 2015-05-16 15:49:08 +02:00
419abdaad6 Proper chunk unloading in case of generation/loading without players 2015-05-16 15:43:34 +02:00
d6ebff412c Added ChunkLoader interface 2015-05-16 15:28:31 +02:00
7a34417e67 Kill player below -16 as now the bottom of the world can be rendered, send player count 2015-05-15 16:51:20 +02:00
76e6ccebd5 Proper recipe matching from network, bumped protocol, build 11, fixed entities not being killed on void (closes #3021), fixes achievement acquireIron not being possible (fixes #2600) 2015-05-15 13:59:29 +02:00
e61db8ad06 Added login timeout for players that do not complete the login process in time 2015-05-14 14:52:39 +02:00
b1edfd7631 Improved Falling blocks physics, entity kill, chunk unserialize, fixed flat generator color, fixed nbt tags __toString(), fixed explosion offsets, fixed increased player interaction range in creative 2015-05-13 12:18:59 +02:00
f3bdef7513 Fixed Anvil chunks not having NBT set 2015-05-12 16:52:11 +02:00
9791071262 Added Player->teleportImmediate() for tp force 2015-05-12 00:21:02 +02:00
aa38a4885f Fixed some issues with world generation and not creating chunks, closes #3008 2015-05-11 23:53:01 +02:00
de0f653027 build 10, improved levelDB constants 2015-05-11 20:31:28 +02:00
13906b32b8 Check connection status on batch, check sleep when players leave a level 2015-05-10 14:58:07 +02:00
925b0c1b07 Fixed empty chunks on generation, closes #2998 2015-05-10 13:18:39 +02:00
db409851e9 World generation is timed by type and chunks can be created on the fly 2015-05-09 19:03:41 +02:00
ab18b7833f Fixed light population happening before population 2015-05-09 16:37:34 +02:00
1a1b8830a4 Added MemoryManager object watcher for object leak debugging, improved SPL Thread/Worker stopping, fixed some possible weak references crashing unexpectedly 2015-05-09 16:11:12 +02:00
7e539ec85a Fixed invalid check 2015-05-08 15:38:51 +02:00
563f6f8e4f Interaction checks happen using the plane and not 3d space 2015-05-07 15:38:22 +02:00
82b0dbfe8e Improved /status, added world information 2015-05-06 19:11:47 +02:00
a4769248fb Set nextTick on start 2015-05-06 19:11:47 +02:00
fb03df3d06 Calculate skylight on chunk population 2015-05-06 16:57:49 +02:00
44b5c23ee1 Fixed dead entities and Item picking, improved timing reports 2015-05-06 16:21:35 +02:00
bff51322af Merge pull request #2986 from 64FF00/master
Fixed /tell command not displaying the sender's name correctly (aka "I'm Bored x3")
2015-05-05 14:27:49 +02:00
cc58d96071 Fixed /tell command not displaying the sender's name correctly 2015-05-05 19:59:12 +09:00
001915fcd6 beta build 9 2015-05-04 17:58:29 +02:00
cd607b0cec Oops distance 2015-05-04 17:57:03 +02:00
5ec4b3f46f "Fixed" #2982 2015-05-04 17:53:48 +02:00
d9a9808844 Added interaction and 3rd person cheat protection 2015-05-04 17:52:55 +02:00
f718d06a7d Updated RakLib, tick inside thread instead of depending on main thread 2015-05-03 23:40:36 +02:00
563f7404fe Time less than target fix 2015-05-03 23:20:40 +02:00
0ddf396b08 Use time_sleep_until() instead of usleep(), improved thread kill 2015-05-03 23:17:39 +02:00
d830386786 Changed default async compression 2015-05-03 22:14:57 +02:00
49f34ec524 Send spawn position after respawn on death, fixes #2976 2015-05-03 21:46:46 +02:00
9ec609d025 Improved Player flight detection after setMotion(), other method improvement 2015-05-03 13:42:54 +02:00
0ead3ec781 Changed round/floor to floor on BlockIterator 2015-05-02 17:38:45 +02:00
fdf395721e Improvements on player move updates 2015-05-01 15:09:37 +02:00
211e1ae121 Fixed slots on creative 2015-04-30 17:51:04 +02:00
923be2fffc Improved slot selection on creative mode, closes #2960 2015-04-30 12:53:03 +02:00
fb257c16f1 Set entities on fire if hit by an entity on fire 2015-04-30 11:40:22 +02:00
b33706d427 Merge pull request #2959 from LDX-MCPE/patch-1
fixed typo
2015-04-30 08:34:57 +02:00
LDX
6bcb319fb5 fixed typo 2015-04-29 23:12:22 -04:00
d4b2e3d1b7 Improved heightmap generation 2015-04-29 23:19:27 +02:00
7754aa71a3 Fixed end of regex on Config 2015-04-29 21:09:35 +02:00
978aa2ba0f Protocol changes 2015-04-29 17:04:34 +02:00
f74f5cfde7 Add DATA_SIZE to Slime! 2015-04-29 15:55:11 +01:00
c2b3f7cd7f Noclip in spectator mode, changed chunk format 2015-04-29 12:29:59 +02:00
3872a21474 Allow setting the flying status for any given player 2015-04-29 11:31:04 +02:00
11e2d23b83 Improved LoginPacket and BatchPacket handling 2015-04-29 10:55:29 +02:00
2cd78d4ae3 Merge pull request #2951 from EnderBrine101/patch-1
No longer needed :P
2015-04-28 18:52:21 +02:00
08f09cc3c8 No longer needed :P 2015-04-28 17:34:38 +01:00
1b13a4c1ec Protocol 25 2015-04-28 16:56:59 +02:00
71587db2be Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2015-04-28 14:49:52 +02:00
8caf04ade5 build 8, allow setting selected hotbar slot, auto_jump setting 2015-04-28 14:20:35 +02:00
488fbc27fe Fixed issue reading/writing YAML 2015-04-27 21:26:50 +02:00
84d1f4596b Improved Anvil live conversion speed 2015-04-27 14:43:33 +02:00
6fc7ee2775 Fixed some bad defaults, improved spawning 2015-04-27 14:43:33 +02:00
ef00103fec Merge pull request #2944 from alejandroliu/generator-list
Added a getGeneratorList
2015-04-27 09:53:50 +02:00
bdf069ebe1 Added a getGeneratorList 2015-04-27 01:18:04 +02:00
5942cafa53 Send in the correct channel 2015-04-26 23:11:07 +02:00
fbdbac06cc New delayed teleporting system 2015-04-26 23:04:24 +02:00
fba12f2a13 Be sure that AsyncTask finish executing, fixes #2931 2015-04-25 17:52:57 +02:00
7ad98d4659 Deprecated CallbackTask, moved sleep checking to level 2015-04-25 17:28:30 +02:00
1d8c29add7 Fixed Block Iterator and getLineOfSight() 2015-04-24 18:10:45 +02:00
d4cae729c3 Added AsyncTasks timings 2015-04-24 17:21:39 +02:00
529f9b148b Save/reload skin on Human based entities 2015-04-24 17:05:00 +02:00
20842636f9 Added timings to chunk sending 2015-04-24 16:59:46 +02:00
7b699d9afd Improved fall damage while on jump boost, new protocol update, build 7, allow for live inventory resizing 2015-04-24 16:43:59 +02:00
ba635b8858 Fixed particles being emmited on non-player block breaks 2015-04-23 17:02:37 +02:00
04f3cc4905 Measure highest TPS load and lowest TPS between measurements 2015-04-23 15:34:42 +02:00
4a1e122605 Move UUID generation before PreLogin 2015-04-23 12:07:34 +02:00
a0739a7b03 Added more level tick options, force player ticks, base tick rate for levels 2015-04-23 11:34:01 +02:00
f73bd02198 Allow to tick players partially 2015-04-23 11:19:27 +02:00
ec7db3be4f build 6! 2015-04-22 17:08:59 +02:00
2ea8835b12 Removed possible crash on RakLibInterface 2015-04-22 15:45:04 +02:00
0aebcb9f81 Correctly load Anvil worlds 2015-04-22 12:07:27 +02:00
1578fc3ddb Improved world generation manager, UUIDs (some work for future usage) 2015-04-21 19:54:16 +02:00
514ce0fb04 Fixed colors not being shown on windows :s 2015-04-20 17:55:49 +02:00
f6e88ec055 Protect against null chunk on entity 2015-04-20 17:29:58 +02:00
15b4cd8fb3 Improved format constants, fixed cake eating when max health is > 20 2015-04-20 17:25:58 +02:00
f88aed1208 Fixed NBT parsing on false properties 2015-04-20 13:57:16 +02:00
6ed63edd89 Removed some remaining references, removed duplicated code on Anvil 2015-04-19 16:49:15 +02:00
897774f848 Increased manuall garbage collection rate 2015-04-19 16:16:05 +02:00
bf4a8398c4 Moved chunk garbage collector to memory manager 2015-04-19 16:14:54 +02:00
05385acb36 Added Memory Manager timings 2015-04-19 16:01:46 +02:00
094234dc0f Updated references and submodules 2015-04-19 15:37:18 +02:00
c2f72ea9ac Updated languages 2015-04-19 11:50:30 +02:00
e3c48b22cb Anvil fixes, improved memory settings 2015-04-19 11:45:43 +02:00
5860bdcc4d Improved network 2015-04-18 22:38:57 +02:00
1b84340e3f Improved manager 2015-04-18 22:35:00 +02:00
61828baa8f Improved manager 2015-04-18 22:33:50 +02:00
11ecaaa87f fixed oops in RakLib 2015-04-18 21:04:07 +02:00
b2c25eaf36 Added MemoryManager, new memory properties, improved performance, updated RakLib, fixed misc. bugs 2015-04-18 20:13:52 +02:00
ddc152ae0a Merge pull request #2903 from PEMapModder/patch-4
Added paramter types for some Config.php functions
2015-04-17 18:15:12 +02:00
08a612954e Added creative mode block list API 2015-04-17 18:01:10 +02:00
5b10ccf431 0.11.0 build 5, removed chat format workaround, improved gamemode switch, send allowed creative blocks (TBI as API) 2015-04-17 17:10:25 +02:00
2add19a4c8 Added paramter types for some Config.php functions 2015-04-17 16:32:40 +08:00
7ee21f6254 Try to clean chunks on other threads 2015-04-15 22:14:51 +02:00
f79476f530 Fixed health setting 2015-04-15 22:00:01 +02:00
4fbafe7c2f HACK: added workaround for MCPE eating characters, enable settings.force-language 2015-04-15 21:14:24 +02:00
d6186fa7c6 Moved Player->setGamemode() message to /gamemode command 2015-04-15 20:49:38 +02:00
88797d4c6c Enabled GC on AsyncWorker 2015-04-15 20:47:34 +02:00
fc2e4ddc63 Fixed long trunk generation 2015-04-15 20:47:18 +02:00
7f28deefcb Better BatchPacket decoding and LoginPacket handling 2015-04-15 19:30:49 +02:00
81fe98d4cc Added Milk bucket to creative inventory 2015-04-15 17:19:05 +02:00
dfec44645b Added milk drinking 2015-04-15 16:45:03 +02:00
1ef6328635 Allow negative potion effects 2015-04-15 16:37:13 +02:00
c0782caab9 Added alternate name for Swiftness 2015-04-15 16:15:17 +02:00
298b973604 Fixed a crash when saving chunks 2015-04-15 15:54:27 +02:00
5ca4f5416c More protocol updates 2015-04-15 15:53:11 +02:00
c36c0dfa66 Fixed health boost addition 2015-04-15 13:04:53 +02:00
64c366bdb5 Protocol 22 2015-04-15 12:38:52 +02:00
68ea9b067f Added health boost potion effect, added Player->sendTip(), MCPE 0.11.0 build 4 2015-04-15 12:33:16 +02:00
79adbdeafe Fixed trees not generating trunk 2015-04-15 11:04:00 +02:00
e09ebb0623 Oops! 2015-04-14 21:12:57 +02:00
91388c6b86 Added chunk-sending.cache-chunks property (old advanced-cache), improved chunk unload saving times 2015-04-14 20:57:09 +02:00
42eda170b5 Oops, forgot to do it correctly! 2015-04-14 20:39:37 +02:00
6ee3a7b8d7 Updated languages 2015-04-14 18:28:57 +02:00
18f6e1805f MCPE 0.11.0 build 3 2015-04-14 18:25:05 +02:00
0b176b3fe0 Implemented Channeled packet sending 2015-04-14 18:24:40 +02:00
bb945446b7 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2015-04-14 14:04:26 +02:00
1d1766a876 Removed format characters correctly :) 2015-04-14 14:04:10 +02:00
bd560ab3b1 Spawning mechanics change 2015-04-14 01:04:17 +02:00
547aa2ae31 Removed formatting on signs, allow OPs to use colored chat (or people with disabled remove format) 2015-04-13 16:45:20 +02:00
a993f15387 Added tick ms to level warning, call correct method on Anvil 2015-04-13 16:34:42 +02:00
1865622b89 Added settings.force-language property to force server language on clients 2015-04-13 12:02:40 +02:00
31387ff0be Added localized invalid name message 2015-04-13 11:36:15 +02:00
928660d59a Updated languages 2015-04-13 00:25:39 +02:00
5e2a21fc26 Added level-settings.auto-tick-rate property, added Level tick rate 2015-04-12 14:13:36 +02:00
410f6ba618 Fixed some potion effect names 2015-04-12 12:46:06 +02:00
05a9ad57bd Fixed BaseLang->get() 2015-04-12 12:41:38 +02:00
ba226d03c3 Added more translations 2015-04-12 12:27:55 +02:00
674a486654 Fixed #2863 2015-04-12 12:19:28 +02:00
e9963b603d Fixed #2864, closes #2864 2015-04-12 12:17:53 +02:00
e2bae92df8 Updated language files and command descriptions 2015-04-12 00:59:12 +02:00
8d468a1efb Format fix 2015-04-11 21:59:55 +02:00
ddeea2942c Updated RakLib, improved packet reading 2015-04-11 21:41:05 +02:00
a65c300a0a Fixed moving from different chunks, lots of issues fixed (all kind of strange things) 2015-04-11 21:39:51 +02:00
363e0e3b13 Revert slot change harder 2015-04-11 18:50:27 +02:00
6504047292 New translations, fixed multiplayer.player.leave 2015-04-11 18:19:28 +02:00
87a779afaf Enforced max distance checks 2015-04-11 18:07:12 +02:00
6b1b6711bd Send extra id on Add/Remove player 2015-04-11 18:00:25 +02:00
f71cf1c749 Added Fallback formatting codes to Windows/Android 2015-04-11 17:27:20 +02:00
3685d967a8 Fixed crash on /ban 2015-04-11 17:09:01 +02:00
d1006de421 Added fallback to BaseLang, better use by plugins 2015-04-11 16:15:45 +02:00
3cf42b558c Fixed language selection 2015-04-11 15:37:44 +02:00
5a0d1affcc Base translations moved to submodule! 2015-04-11 15:31:22 +02:00
414549659a Fixed crash on already dead players, closes #2856 2015-04-11 15:13:27 +02:00
3b6e10b759 More langs :D 2015-04-11 14:59:15 +02:00
c2138aa30c More language files 2015-04-11 12:56:38 +02:00
de052a79de Localized kick messages 2015-04-11 02:31:34 +02:00
c29ae333a2 Translate format text 2015-04-11 02:15:46 +02:00
0c041ebca3 Added base translation system 2015-04-11 01:32:08 +02:00
3224cd7dc5 Added Grass Path block, fixed redstone blocks not being able to be placed 2015-04-10 19:05:10 +02:00
3f60f7c0fb Merge pull request #2847 from matcracker/patch-3
Added Iron Shovel
2015-04-10 16:52:01 +02:00
c786ace355 Skin methods 2015-04-10 16:47:18 +02:00
60ac8f91ba Fixed pre-login disconnect messages 2015-04-10 15:26:32 +02:00
5720cb2be7 Added Iron Shovel
I think to have add Iron Shovel in creative inventory.
2015-04-10 15:06:02 +02:00
c32a7467bb Fixed wrong shift due to compiler change 2015-04-10 15:05:15 +02:00
0626d27003 Moved skin checks after protocol checks 2015-04-10 10:23:28 +02:00
2ae095a15a Fixed disable-ansi not working 2015-04-10 10:16:57 +02:00
5d102c2ede Fixed backwards compatibility issue on PlayerInteractyEvent 2015-04-10 10:16:03 +02:00
a7b1c6e086 Merge pull request #2844 from Falkirks/patch-1
Fix #2843
2015-04-10 08:48:22 +02:00
d855bbba0b Fix #2843 2015-04-09 20:59:42 -07:00
73d1d131e1 Added skin checks to Player and Human 2015-04-09 20:58:38 +02:00
0aa9586a52 Packet crashes fixed :D 2015-04-09 20:44:04 +02:00
205f6d50c1 Fixed PlayerActionPacket encode 2015-04-09 20:00:39 +02:00
ac6e2f9bf7 Fixed packet issues 2015-04-09 19:55:19 +02:00
1ddd58fd3b Fixed a few issues 2015-04-09 18:50:34 +02:00
66b58e36a1 Updated Code Guidelines 2015-04-09 18:24:29 +02:00
86184a230e Merge branch 'mcpe-0.11' 2015-04-09 18:18:10 +02:00
b4a0afc2c8 Getting ready, protocol changes! 2015-04-09 17:42:06 +02:00
f2e2cec024 Removed entity mask 2015-04-09 14:23:37 +02:00
0117e8dfae New codename, MCPE version, bumped split packet limit 2015-04-09 12:30:07 +02:00
69f841a00c Added Squids with basic AI 2015-04-09 00:12:50 +02:00
02ba9ffc16 Improved entity movement ySize offset 2015-04-08 22:09:06 +02:00
71657a2a4e Improved effects, threading changes 2015-04-08 17:31:06 +02:00
76767294bf Fish items, block of redstone! 2015-04-08 15:34:50 +02:00
3cae81c01b Added Nausea effect 2015-04-08 13:40:48 +02:00
141c0a297e Skins, protocol changes, handle split packets 2015-04-08 13:00:15 +02:00
45c6694ef9 Merge pull request #2827 from PEMapModder/patch-3
Removed useless code in Entity::getDirectionVector()
2015-04-07 10:11:09 +02:00
9b09b7ddd1 Removed useless code in Entity::getDirectionVector() 2015-04-03 15:15:35 +08:00
c9adc336ee Fixed items doing crazy things 2015-03-29 18:10:02 +02:00
d5ba2a72a5 Added strength, weakness, resistance effects, fixed entity area 2015-03-29 14:49:47 +02:00
9f6b5992e3 Merge pull request #2813 from Gamecrafter/patch-1
Really small fix
2015-03-29 20:32:11 +10:30
e51858ae17 Update ReloadCommand.php 2015-03-28 11:58:32 -07:00
c2baaf435d Merge branch 'master' into mcpe-0.11 2015-03-28 19:14:02 +01:00
c422b83abf Merge pull request #2812 from alejandroliu/patch-1
Added missing LEATHER_BOOTs to Item::$list
2015-03-28 18:08:08 +01:00
e0a6d0feab Critical arrows, fixed arrow interception calculation 2015-03-28 17:54:10 +01:00
0a85ad0d1f Improved trees, improved inventory transactions, improved snowball/bow usage 2015-03-28 16:59:15 +01:00
91315645cd Added missing LEATHER_BOOTs to Item::$list
For some reason the leather boots are missing.
2015-03-28 07:25:42 +01:00
47de616ac5 Fixed commands, added level automatic tick delay, improved biome gradient 2015-03-28 01:26:06 +01:00
e0522d8b1a Fixed data on generation, biome gradient 2015-03-27 12:42:59 +01:00
08f2b7f291 Moved chunk population to async tasks, and no more cut trees! 2015-03-27 01:57:08 +01:00
72c4c01542 Yay generation uses async tasks 2015-03-26 18:21:39 +01:00
668ddeeb13 Removed outdated Cache 2015-03-26 11:55:51 +01:00
286c1ee880 Added chunk spawn threshold for players 2015-03-26 11:28:44 +01:00
ed2ba70a29 Merge remote-tracking branch 'origin/master' into mcpe-0.11 2015-03-26 01:32:44 +01:00
962c28aaca BatchPacket, compress any packet depending on the size, really fast threaded chunk sending 2015-03-26 00:06:46 +01:00
7d1313c63d >= <= on move 2015-03-25 20:00:55 +01:00
d19631226f Improved Entity attack()/heal() event firing 2015-03-25 11:11:02 +01:00
6836e4fe58 Merge pull request #2800 from alejandroliu/patch-1
Corrected MINECART constant definition on Item.php
2015-03-25 11:03:39 +01:00
4a79c65544 Corrected MINECART constant definition on Item.php
MINECART was defined as 329, where it should be 328.
2015-03-24 23:47:33 +01:00
d1760d9bb8 Synchronize hotbar slots, removed RotateHeadPacket, improved MoveEntityPacket, FullChunkDataPacket 2015-03-24 16:26:46 +01:00
355ddc469c Merge pull request #2788 from alejandroliu/patch-1
Clone initial chunk in Flat.php
2015-03-24 10:23:35 +01:00
4e934654ef More awesomeness, No AI flag! 2015-03-23 14:44:04 +01:00
38f3dda13b Oops! 2015-03-23 11:15:03 +01:00
c68cd2c496 Cloned the initial empty chunk 2015-03-23 10:28:29 +01:00
a6b8170d9c Improved biomes 2015-03-23 08:02:18 +01:00
9da26fdb88 World generation with biomes! 2015-03-22 22:57:40 +01:00
1666602652 Improved memory output, logging, removed locks 2015-03-22 03:20:48 +01:00
d2bf92c3ed New batched UpdateBlockPacket, added Level->sendBlocks() 2015-03-22 02:44:39 +01:00
93a50d08e7 Merge branch 'master' into mcpe-0.11 2015-03-22 02:20:32 +01:00
1f977f68c0 Merge pull request #2794 from sekjun9878/master
Utils\Config preserves document type between reloads. Fixes #2777
2015-03-21 15:03:05 +01:00
91a26c15dd Utils\Config preserves document type between reloads. Fixes #2777 2015-03-21 21:35:57 +10:30
add380c7ed A few fixes! 2015-03-21 00:45:29 +01:00
652987110a Added popup notices! 2015-03-20 17:56:07 +01:00
58253be0a0 Implemented swiftness, added invisible status to FloatingTextParticle 2015-03-20 17:19:06 +01:00
b42424eb22 Sounds! 2015-03-20 16:42:50 +01:00
1d1a8a316e Take-2: Delay "parsePreset" until we have to really generate a block 2015-03-20 08:13:55 +01:00
a2b3e48b45 Added /particle command 2015-03-20 03:37:58 +01:00
ebc8928c21 Implemented effect colors 2015-03-20 02:31:54 +01:00
62ba36b474 New TextPacket, second part! 2015-03-19 20:27:51 +01:00
2c59983672 New TextPacket, first part 2015-03-19 18:48:03 +01:00
8ae9cd4eaf Clone initial chunk in Flat.php
The Flat generator destroys Chunk at 0,0.

What happens is that it request the level to read Chunk at 0,0.  It then uses that chunk to create the template chunk.  However this obliterates whatever was in Chunk at 0,0.

Added a line to "clone" this chunk, so when parsePreset generates the template chunk, all this goes to a copy rather than the original file chunk 0,0.
2015-03-19 15:41:26 +01:00
275a1e3f60 Water breathing potion 2015-03-19 10:14:35 +01:00
6735234bf4 Protocol update 2015-03-19 10:12:09 +01:00
d66a2d7105 Merge branch 'master' into mcpe-0.11 2015-03-19 09:18:39 +01:00
c882df7465 Fixed destroyblock particle duplicating on clients 2015-03-19 08:30:07 +01:00
f21e457dc0 Fixed particle constructor 2015-03-18 21:49:01 +01:00
6bf30c133a Merge pull request #2785 from PocketMine/revert-2776-armor-fix
Revert "Implemented proportional armor modifier, applied armor in other ...
2015-03-18 17:26:53 +01:00
d34499e67b Revert "Implemented proportional armor modifier, applied armor in other damage types and consume armor when player is damaged" 2015-03-18 17:26:06 +01:00
c2a3298a7e Particles. 2015-03-18 16:34:19 +01:00
b31604a536 Fixed data sending, more particles 2015-03-18 12:11:44 +01:00
c00370cfbf Added experimental particles 2015-03-18 08:51:38 +01:00
7c0bd45d1d Merge pull request #2779 from alejandroliu/patch-1
Fixed a silly typo in Server.php line 1142.
2015-03-18 14:04:36 +10:30
5f2254cc42 Fixed a silly typo in Server.php line 1142.
Fixed a silly typo in Server.php line 1142.  Yes, the "t" is next to the "y" on my keyboard too!
2015-03-17 23:48:23 +01:00
8169803bb4 Updated Water/Lava to use new methods 2015-03-17 21:22:51 +01:00
5a35e7b058 Removed damage reduction by armor for lava 2015-03-17 21:10:54 +01:00
1b25cd6ffa Merge branch 'master' into mcpe-0.11 2015-03-17 19:12:03 +01:00
891eeff75a PocketMine 1.4.1 2015-03-17 18:01:58 +01:00
b4f62bf423 Fixed salling sand breaking on full BB partial blocks, closes #2770 2015-03-17 18:00:19 +01:00
7c76c1e3d7 Changed generator choosing logic, add proper preset if needed, fixes #2751 2015-03-17 18:00:19 +01:00
37bc1273ee Implemented double chest fix, closes #2744, fixes #2493 2015-03-17 18:00:19 +01:00
ffcdf49912 Allow plugins to cancel some kicks better, closes #2743 2015-03-17 18:00:18 +01:00
3e893ed0f7 Implemented hardcore banning, closes #2574 2015-03-17 18:00:18 +01:00
bfb7e8bb9e Merge pull request #2776 from PEMapModder/armor-fix
Implemented proportional armor modifier, applied armor in other damage types and consume armor when player is damaged
2015-03-17 17:57:28 +01:00
5067b96184 Merge pull request #2631 from 64FF00/master
TallGrass blocks should be only placed on grass blocks
2015-03-17 17:49:46 +01:00
cb2157ea80 Merge pull request #2614 from mmlmml1/master
Fixed for Iron bars and stonecutter
2015-03-17 17:36:01 +01:00
6af87814e3 Added 64-bit entity data field 2015-03-17 16:26:02 +01:00
5b3e65345f Fixed a typo
`$source->isCancelled()` shouldn't be checked twice
2015-03-17 22:20:33 +08:00
8aa8ae5094 Implemented proportional armor modifier, applied armor in other damage types and consume armor when player is damaged 2015-03-17 20:04:59 +08:00
b5b46bfd7e Improved thread count 2015-03-17 00:47:43 +01:00
2ae80031f0 New implementation of sending/setting/getting entity data, added effect saving 2015-03-17 00:01:54 +01:00
85c5714cbf API 1.12.0, 1.5dev 2015-03-16 21:39:32 +01:00
bc31df37d0 Added invisibility potion, metadata sending for invisibility/nametags 2015-03-16 19:05:31 +01:00
29ca349b3d Less protocol madness 2015-03-16 12:13:52 +01:00
4ec584d800 Added real memory and thread usage 2015-03-16 11:56:00 +01:00
4383e272eb Added Effects base, /effect and methods 2015-03-15 23:15:54 +01:00
f9361aa931 Use new colors in terminal 2015-03-15 18:32:36 +01:00
220d2b7bee Fixed NBT IntArray off-by-one reading 2015-03-15 16:40:44 +01:00
d5601b0c9f Generator works! 2015-03-15 16:40:18 +01:00
5bfc747622 Fixed NBT IntArray off-by-one reading 2015-03-15 16:39:53 +01:00
b0f8c14640 Added Terminal class, Improved normal generator speed 2015-03-15 00:15:24 +01:00
328cd585c0 Merge branch 'biome-generation' into mcpe-0.11 2015-03-14 15:52:38 +01:00
807107e581 Fixed constructors, default memory to -1, default async generator 2015-03-14 15:51:21 +01:00
94c2ec8498 Fixed constructors, default memory to -1, default async generator 2015-03-14 15:50:33 +01:00
9158cc4f19 Implemented Threaded ClassLoader, improves class loading while on different threads (no need to synchronize states) 2015-03-14 15:22:42 +01:00
11c13cd666 Implemented Threaded ClassLoader, improves class loading while on different threads (no need to synchronize states) 2015-03-14 15:22:13 +01:00
284958a21e Merge branch 'mcpe-0.11' of bitbucket.org:pocketmine/pocketmine-mp into mcpe-0.11 2015-03-14 02:39:12 +01:00
91e8bdbd37 Fixed size on MobSpawnParticle 2015-03-13 16:21:33 +01:00
9e0b9a6e5b Added right and left click interaction events 2015-03-13 14:39:37 +01:00
e48a3e5713 Added some types of Particles, Block break particles 2015-03-13 14:24:19 +01:00
1ce7cc64a6 Use ContainerSetSlotPacket instead of ContainerSetContentsPacket 2015-03-13 10:25:48 +01:00
7f9aad6840 Removed player foreach on Entity 2015-03-13 09:27:09 +01:00
3af784012c Fixed packets 2015-03-13 09:27:09 +01:00
a6c19734ce Fixed picking up items, entity IDs on packets 2015-03-13 09:27:09 +01:00
8ddd701d76 Renamed LoginStatusPacket to PlayStatusPacket, added spawn status, new colors 2015-03-13 09:27:09 +01:00
15ee0c37c6 Fixed Entity->setMotion() for Players 2015-03-13 09:27:09 +01:00
fc128affc5 Removed chat wrapping, deprecated TextWrapper 2015-03-13 09:27:09 +01:00
218fd999b0 More packets changed, unique IDs D: 2015-03-13 09:27:09 +01:00
eeeaac04e9 Updated packet order, removed player entity id as 0 2015-03-13 09:27:09 +01:00
8679ad5b86 Added colors, Disconnect Packet, protocol 21 2015-03-13 09:27:09 +01:00
2cd757d80a Fixed formatting of #2771 2015-03-13 09:26:45 +01:00
be20f61a93 Merge pull request #2771 from alejandroliu/ChunkCorruption
Fix some Chunk corruption due to Chunk overlap
2015-03-13 09:24:24 +01:00
59e9446fe5 Added another place where the same happens 2015-03-13 08:19:47 +01:00
4f47dac8ec Fix some Chunk corrumption due to Chunk overlap 2015-03-13 06:23:32 +01:00
b54c0835b7 Update RakLib 2015-03-12 18:40:12 +01:00
1e00ff9e4a Update RakLib 2015-03-12 18:37:22 +01:00
1ac7f9f061 Removed player foreach on Entity 2015-03-12 15:58:10 +01:00
5b3ce2da9d Fixed packets 2015-03-12 15:38:17 +01:00
00942d3a2b Fixed picking up items, entity IDs on packets 2015-03-12 12:02:37 +01:00
4b442a9d7c Renamed LoginStatusPacket to PlayStatusPacket, added spawn status, new colors 2015-03-12 11:43:50 +01:00
44dfb59409 Fixed Entity->setMotion() for Players 2015-03-12 11:43:50 +01:00
696ba08a81 Removed chat wrapping, deprecated TextWrapper 2015-03-12 11:43:50 +01:00
d80b8524fb More packets changed, unique IDs D: 2015-03-12 11:43:50 +01:00
2175d7922a Updated packet order, removed player entity id as 0 2015-03-12 11:43:50 +01:00
5fcb0d6aa5 Added colors, Disconnect Packet, protocol 21 2015-03-12 11:43:50 +01:00
9ca3ad8971 Merge pull request #2767 from alejandroliu/blockskylight
Fixed some typos in Anvil
2015-03-10 09:57:48 +01:00
a644b46ec4 Fixed some typos 2015-03-09 23:57:53 +01:00
9d3f59fab6 Merge pull request #2750 from LDX-MCPE/patch-2
Fixed Dark Oak Fence's name
2015-03-09 11:10:17 +01:00
6309d4abf1 Fixed #2762 2015-03-08 15:53:01 +01:00
LDX
39291e4061 Fixed Dark Oak Fence's name 2015-03-02 16:14:31 -05:00
bb71a3c4a6 Added Entity->fastMove() for players and direct-controlled entities, improved speed checking 2015-02-22 21:16:05 +01:00
eb0525e892 Ignore spawn protection when no ops are set 2015-02-22 19:07:45 +01:00
f49db47b2e Added basic speed protection 2015-02-18 00:37:57 +01:00
3ff5e12302 Updated RakLib 2015-02-17 21:12:28 +01:00
99ad65ba44 Catch file saving exceptions 2015-02-15 20:01:47 +01:00
5f4f996efe Fixed #2599 2015-02-15 19:01:25 +01:00
21e0739845 Fixed #2598 2015-02-15 18:48:30 +01:00
3a157d0f02 Future workaround for #2626 2015-02-15 18:45:25 +01:00
8e56782138 Fixed #2619 BlockMetadataStore 2015-02-15 18:25:40 +01:00
116ede3679 Improved flight detection, added Entity->resetFallDistance(), closes #2632 2015-02-15 17:40:17 +01:00
7c0f5987d3 Fixed players getting kicked for flying when going through special blocks 2015-02-15 16:26:05 +01:00
547e152e40 Fixed #2615, closes #2634 invalid pull request 2015-02-15 15:12:33 +01:00
7905fbdd29 TallGrass blocks should be only placed on grass blocks 2015-02-12 19:33:44 +09:00
ae65701a23 Update IronBars.php 2015-02-05 20:11:08 +08:00
9134a69936 Merge pull request #2613 from 64FF00/master
OH-GAWD-WHY blame @PEMapModder
2015-02-05 12:57:44 +01:00
907fe8aff6 Fixed for wrong hardness and stonecutter 2015-02-05 19:05:00 +08:00
afa9acf22f OH-GAWD-WHY 2015-02-05 19:30:52 +09:00
9a5afff4ab Merge pull request #2612 from PEMapModder/patch-1
Added Location::__toString()
2015-02-05 11:06:52 +01:00
2f8c281a2e Added Location::__toString() 2015-02-05 18:00:25 +08:00
2096dace68 fixed for some bugs
Signed-off-by: mmlmml1 <mmlmml1@126.com>
2015-02-04 23:12:06 +08:00
8421985102 Merge pull request #2577 from Falkirks/master
Improve FallingSand behaviour
2015-01-28 08:48:01 +01:00
f63e859b3a Falling sand will become block when in contact with a Liquid
This replicates the behaviour of MCPE.
2015-01-27 17:09:31 -08:00
c56eb0b9df Merge pull request #2566 from sekjun9878/master
Fixed #2565
2015-01-26 19:01:22 +10:30
3f2e5bbef4 Fixed #2565 2015-01-26 18:59:56 +10:30
9886eb4768 Return on Level->getSafeSpawn() in case of invalid position 2015-01-25 10:23:04 +01:00
ea44eee5df Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2015-01-24 10:35:24 +01:00
9173f930ca Fixed #2541 server not saving chunks on chunk unloading 2015-01-24 10:35:08 +01:00
80b6a8ebaf Merge pull request #2555 from Striker209MPE/patch-6
Removed useless spawned check...
2015-01-24 10:29:18 +01:00
7c64a33389 Fixed #2557 2015-01-21 14:48:31 +01:00
9fac896f28 Removed useless spawned check...
because it has already be done before
2015-01-20 16:29:29 +01:00
5bd76e955c Added rotation transformations to remaining packet 2015-01-16 01:43:40 +01:00
63f1a50be4 Added new predictive flight protection 2015-01-14 23:47:01 +01:00
24c6cca664 Updated RakLib, fixed help message not showing command, added documentation to Plugin->getResource() 2015-01-14 17:23:16 +01:00
9fac990b19 Throw exception when RakLib crashes 2015-01-13 18:44:15 +01:00
e8e7938490 Fixed PHPRC env. variable being set 2015-01-13 17:25:52 +01:00
f6c4a726b3 Bump Minecraft version to 0.10.5 2015-01-12 20:00:11 +01:00
8eec5e6b5e Allow placing Snow Layers on top of solid transparent blocks 2015-01-12 02:18:02 +01:00
bd7fa71d7f Updated RakLib 2015-01-11 20:33:17 +01:00
7d406066a7 Added outdated event static properties 2015-01-11 19:37:21 +01:00
3e9196d224 Changed max speed per tick from 100 to 10 blocks 2015-01-11 17:31:34 +01:00
f30986d187 Block saving chunks too big 2015-01-11 15:48:08 +01:00
f8c144be31 Fixed #2529 2015-01-11 15:06:16 +01:00
c61e4adcf1 Improved chunk ticking a bit more 2015-01-08 23:27:14 +01:00
5a55040ab9 Improved chunk ticking 2015-01-08 23:22:47 +01:00
83360187c9 Removed fence classes, added fence damage (¬¬ Mojang) 2015-01-08 17:51:29 +01:00
a893174473 Second biome generator iteration 2015-01-08 01:05:23 +01:00
9d97a940a6 Merge pull request #2517 from PEMapModder/patch-1
Fixed /timings off
2015-01-07 14:42:17 +01:00
cd21c28d46 Fixed /timings off
When issuing `/timings off`, the message `Please enable timings by typing /timings on` is sent to the issuer. This commit fixes this issue.
2015-01-07 17:34:45 +08:00
a76be6cf38 First biome based generator iteration 2015-01-07 04:07:11 +01:00
37fd0372cc Added GarbageCollectionTask, workaround for weird PHP behaviour when using --disable-ansi 2015-01-06 19:45:41 +01:00
ed02026815 Improved file resource usage 2015-01-06 19:04:24 +01:00
042a143dd6 Unload unused regions after 5 minutes 2015-01-06 18:59:21 +01:00
4b73dbd9f8 Fixed Flat generator on existing chunks, region issues 2015-01-06 18:46:18 +01:00
d4e4430df0 Fixed Entities being placed in recreated chunks 2015-01-06 18:45:08 +01:00
469ef84733 Fixed issue where plugins schedule a Player update before log in 2015-01-06 00:25:40 +01:00
efe75f2836 Catch more coruption issues in Region-based worlds, fixed first chunk being generated on an invalid sector 2015-01-06 00:11:38 +01:00
53f2f21f2d Fixed #2511 2015-01-05 16:15:57 +01:00
9c28f0a5be Decrease async worker task amount after crashed task 2015-01-05 02:41:14 +01:00
5bf5014b60 Added Async Task crash warning 2015-01-05 00:16:47 +01:00
f37e79b611 Added Level->getChunks(), fixed some Doc Comments 2015-01-04 23:16:03 +01:00
7a0118820c Improved chunk saving times by not marking it as changed when Players are added/removed 2015-01-04 23:07:08 +01:00
c8b5c023cd Fixed visual typo in /ban-ip, closes #2503 2015-01-04 09:36:07 +01:00
f9dd929e04 Fixed phar check 2015-01-03 16:49:10 +01:00
87970726e4 Added PlayerCreationEvent->setBaseClass() 2015-01-03 16:46:00 +01:00
1daf9a96a3 Added PlayerCreationEvent->setBaseClass() 2015-01-03 16:45:43 +01:00
6c8b33fcc8 Fixed PlayerCreationEvent 2015-01-03 16:41:14 +01:00
438591bd75 API 1.11.0, fixed phar check 2015-01-03 16:38:36 +01:00
7ef8edccf4 Added PlayerCreationEvent 2015-01-03 16:38:00 +01:00
074c8b876d Cleaned up code 2015-01-03 16:07:49 +01:00
f9762c870a Cleaned up BanEntry creation 2015-01-03 15:47:03 +01:00
4039895d3c Fixed #2489 2015-01-03 03:43:41 +01:00
d207a5daea WTF, ghost objects and why does this fix it? (and btw, fixes #2488) 2015-01-03 03:38:25 +01:00
8e3667c95b Fixed messages and default settings 2015-01-03 02:56:46 +01:00
0da628deca Fixed some crashes related to crashing 2015-01-02 19:19:34 +01:00
04bdb13103 Improved move offset check 2015-01-02 19:14:18 +01:00
e8ad828498 Catch exceptions on level generation 2015-01-02 18:56:27 +01:00
f46473bbe8 Removed all @mkdir() calls 2015-01-02 18:52:45 +01:00
692045d714 Improved threading and resource usage, new defaults 2015-01-02 18:46:39 +01:00
47cbf56725 Version bump 2015-01-02 07:04:20 +01:00
3de14d8ba6 Preparing release 2015-01-02 01:37:33 +01:00
5fffabe05b Fixed players not calculating onGround correctly 2015-01-02 01:22:33 +01:00
3128ae9736 Improved exception handling and trace creation 2015-01-01 22:50:45 +01:00
7be4e2fa81 Merge pull request #2438 from PocketMine/new-version-format
New release version format
2014-12-31 17:53:12 +01:00
95b305ce87 Detect really big corrupted chunks, closes #2471 2014-12-31 12:40:11 +01:00
767800662c Added chunk check on Level 2014-12-30 15:54:12 +01:00
fe32e6f5d0 Merge branch 'master' into new-version-format 2014-12-29 12:43:15 +01:00
2cec0d9f36 Improved Simplex 2D noise 2014-12-28 03:51:08 +01:00
d800a21bd4 Higher chunk defaults 2014-12-28 02:58:17 +01:00
8d9fbec4ce Fixed memory leak issues on chunk generation under 32-bit hosts, fixed issue with generated chunks not having a provider. Closes #2419, fixes #2308, closes #2421 2014-12-28 02:22:13 +01:00
ab72c32769 Improved Normal generator speed 2014-12-28 02:12:48 +01:00
346626305c Corrected fence crafting recipes, closes #2457 2014-12-28 01:49:42 +01:00
fafbd500e1 Added typehints to HelpCommand 2014-12-28 01:49:10 +01:00
2db2e8cfc4 Block IP addresses on ban-ip 2014-12-26 13:56:35 +01:00
854479180f Move Query exceptions to debug level > 1 2014-12-26 13:47:15 +01:00
902ba81e02 Added automatic/manual RakLib IP address, block addresses when exceptions are thrown 2014-12-26 13:33:41 +01:00
1ac17abec0 Fixed #2446 2014-12-24 23:00:11 +01:00
714ea54121 Players won't take damage 60 ticks after spawning / respawning. 2014-12-24 20:44:22 +01:00
aa992684ba Possible workaround for some PHP bug 2014-12-24 00:55:23 +01:00
0c58de86b7 New version format 2014-12-23 14:02:35 +01:00
7ecac019a9 Bitmask block state 2014-12-23 13:58:30 +01:00
6cb88afe1a Improved block breaking time and event handling 2014-12-22 23:49:17 +01:00
a677bcb331 Increased transaction timeout, not needed anymore due to packet ordering 2014-12-22 23:38:47 +01:00
2f6007342c Fixed server.log created in two different places on path changed 2014-12-22 23:00:28 +01:00
b6c0eb8c96 Added optional parameter for multiple NBT read 2014-12-22 16:25:12 +01:00
afa8496767 Fixed possible memory leak when hiding players from each other 2014-12-21 20:03:39 +01:00
d7be2ce439 Added Chest recreation on imported levels 2014-12-21 14:29:18 +01:00
6dcb5da069 Added Double Plant block, fixes damage walking inside it. 2014-12-21 14:28:45 +01:00
3cf1692c96 Possible fix for #2424 2014-12-21 13:59:04 +01:00
d04af590d1 Updated RakLib
* Fixes issues with packets without messageIndex
* Workarounds possible CPU-hog DoS attack over ACK/NACK packets
2014-12-21 13:45:28 +01:00
d4c43215b1 Fixed typo about async chunk generation 2014-12-19 16:10:01 +01:00
a40918aabf LevelDB load/write fixes 2014-12-19 10:35:16 +01:00
20f9352714 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-12-19 01:07:13 +01:00
a605e90dfc Added experimental LevelDB support, fixed a few issues with NBT, spawning and Binary R/W 2014-12-19 00:28:50 +01:00
9fc250956f Merge pull request #2395 from PEMapModder/patch-6
Allow $base in knockback() to be dynamic and getters/setters in EntityDa...
2014-12-18 20:39:48 +09:00
db2dfc47a6 Update RakLib 2014-12-18 03:33:33 +01:00
408a537001 Added TesterPlugin submodule, updated RakLib to fix packet loop issues 2014-12-17 23:29:57 +01:00
922bfb33ac Updated .gitignore 2014-12-16 18:50:57 +01:00
8e47c93fbc Fixed some issues with chunks being generated on a loop 2014-12-16 02:57:44 +01:00
c175485cd8 Added World Generation timings 2014-12-15 17:52:07 +01:00
b6981cc31d Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-12-15 01:05:55 +01:00
1f9cd6a99b Added default parameter to Config getters, implements and closes #2398 2014-12-15 01:05:32 +01:00
ded7ada7d7 Merge pull request #2399 from PEMapModder/patch-7
Update documentation of PluginBase::getCommand() for IDEs' auto completion
2014-12-15 00:52:43 +01:00
1b50879823 Snow layer recipe added: Fix for #2400 2014-12-13 17:10:17 +01:00
1bd9cbd4d3 Update documentation of PluginBase::getCommand() for IDEs' auto completion 2014-12-13 20:42:23 +08:00
96122d3be7 Allow $base in knockback() to be dynamic and getters/setters in EntityDamageByEntityEvent
This change is backwards-compatible.
2014-12-12 23:01:31 +08:00
71d602a4cf Faster chunk setting on provider 2014-12-12 15:51:31 +01:00
c81bbdaaa9 Possible fix for #2394 2014-12-12 12:05:36 +01:00
2752393c42 Fixed #2392 2014-12-12 12:05:15 +01:00
312e064b07 Updated RakLib, changed some Entity move AABB calls 2014-12-11 17:39:59 +01:00
94f91967f3 Updated RakLib: Implemented packet reordering, fixed packet recovery in both sides, errors are now debug level 2014-12-11 03:13:44 +01:00
fe900b417e Less calls! 2014-12-10 02:42:02 +01:00
4c30b6b8a1 Optimized Liquid spreading, optimized light updates, improved side block get/update, fixed raw set not cleaning Block cache (TNT explosions) 2014-12-10 00:37:04 +01:00
c41ac7b0a2 Updated PocketMine-SPL, added trait autoloading 2014-12-09 16:33:42 +01:00
b220bd2a45 Updated chunk indexes on generator 2014-12-09 15:14:11 +01:00
04ee94dc91 Fixed #2388 2014-12-09 15:05:36 +01:00
ea8f10efa4 Limited death animation to Living entities 2014-12-09 14:57:28 +01:00
04ecbd1a76 Level optimization, added new chunk/block hashes 2014-12-09 14:55:21 +01:00
ddfc9d9ce1 Fixed players not getting sound when they are harmed 2014-12-09 02:22:42 +01:00
a4735eaf76 Replaced some instanceof to null checks 2014-12-09 02:22:18 +01:00
306f492fc0 Added Player death animations, improved spawning behavior to correct invisible players, fixed players getting stuck when dead, closes #2304 2014-12-09 01:36:46 +01:00
5e5f8bf33d Better block creation on Level 2014-12-08 22:02:36 +01:00
3bb2f12cde Improved block reading
* Created global block states array
* Improved Level->getBlock() using block states
* Improved Level->getBlock() for 64-bit systems
* Added Level->getFullBlock()
* Added FullChunk->getFullBlock()
* Added Chunk->getFullBlock()
* Added ChunkSection->getFullBlock()
* Deprecated FullChunk->getBlock()
* Deprecated Chunk->getBlock()
* Deprecated ChunkSection->getBlock()
2014-12-08 20:54:47 +01:00
1041bb0e6a Do not quiet error messages when parsing config files 2014-12-07 23:21:47 +01:00
49e93cee80 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-12-07 22:05:58 +01:00
8b6681c56d FIxed some preprocessor includes 2014-12-07 22:05:45 +01:00
9e3d432b9e Faster Level provider chunk unloading 2014-12-07 21:51:57 +01:00
841a3d5ee6 Merge pull request #2381 from PocketMine/revert-2379-master
Revert "Fixed small possible error in permission"
2014-12-07 20:54:46 +01:00
a5294d5ec7 Revert "Fixed small possible error in permission" 2014-12-07 20:54:38 +01:00
5373e6be07 Merge pull request #2379 from sudoku173/master
Fixed small possible error in permission
2014-12-07 20:41:08 +01:00
075137bd3c Fixed small possible error in permission
Changed permission to "pocketmine.command.deop" from "pocketmine.command.op.take"
2014-12-07 11:38:44 -08:00
68da4b5b39 Collect unallocated chunks from the Level provider 2014-12-07 18:27:11 +01:00
e4557a2e8e Added HeightMap get/set methods on chunks, Level 2014-12-07 18:02:07 +01:00
964bf98ca6 Added Config->getNested(key) and Config->setNested(key, value) 2014-12-07 16:41:43 +01:00
747f7685e7 Fix formatting issues due to bad IDE settings 2014-12-07 16:30:04 +01:00
bb82e7be50 Handle a hotbar queue to allow using more than the first slot (won't save order due to the protocol) 2014-12-07 16:01:45 +01:00
7506f01302 Improved Item property handling 2014-12-07 15:51:00 +01:00
a98da3bab1 Renamed old getID() calls to getId() 2014-12-07 15:21:32 +01:00
f0d6128282 Use squared distance on movement handling 2014-12-07 15:18:14 +01:00
161e7ae7ec Fix CPU issue when starting without STDIN 2014-12-07 02:42:38 +01:00
6104c5b5a3 API 1.9.0, backwards-compatible 2014-12-07 02:24:45 +01:00
af82d616c1 Block creating and property handling rewrite, part2 2014-12-07 02:20:26 +01:00
a0d4bff385 Block creating and property handling rewrite, part1 2014-12-07 01:53:27 +01:00
79236c971c Possibly fix issues related to new lines on different operating systems and event listeners modifiers 2014-12-05 22:43:31 +01:00
20e63ae543 Force player setting their new position 2014-12-05 02:24:34 +01:00
add7879720 Implemented no damage ticks 2014-12-05 02:24:08 +01:00
1a064d38b1 Merge remote-tracking branch 'origin/master' 2014-12-04 00:04:18 +01:00
294e680d5d Added armor items and max stack size for them. 2014-12-04 00:04:09 +01:00
811970e58d Merge pull request #2352 from PEMapModder/patch-3
Added internal use warning for TaskHandler::cancel()
2014-12-01 12:07:30 +01:00
941961f5ef Added internal use warning for TaskHandler::cancel()
It is confusing for some developers to whether to use this function or `ServerScheduler::cancelTask($taskId)`. It is better to add warning in the documentation.
2014-12-01 16:25:37 +08:00
1963d8fde0 Change last X/Y/Z/Yaw/Pitch on teleport 2014-11-30 12:49:35 +01:00
e44ed4da3b Enabled batch block sending again 2014-11-29 12:58:31 +01:00
a72488d41e Updated player movement processing and event handling 2014-11-29 12:43:34 +01:00
3930f379cf Updated light filter values 2014-11-29 11:58:50 +01:00
66ba327e62 Improved light spread algorithm even more 2014-11-29 11:27:22 +01:00
329ca62465 Improved light spread algorithm 2014-11-28 19:54:25 +01:00
26e47ef694 Removed old revert flag from Player->processMovement() 2014-11-28 14:49:06 +01:00
61ea149ff0 API 1.8.0 2014-11-28 14:44:56 +01:00
b3c3f896a3 Implemented light population, added Level->getFullLight() 2014-11-28 14:44:27 +01:00
d139e5f342 Removed temporal pthreads workaround 2014-11-28 13:01:25 +01:00
3abf36ad07 Fixed invalid worlds property being set by users 2014-11-28 12:47:28 +01:00
0bc9a9bdab Fixed armor dropping twice 2014-11-27 23:19:46 +01:00
98340522d9 Fixed items getting added on the same empty slot 2014-11-27 20:49:18 +01:00
6d09754ea7 Improved Inventory->addItem(), fixed breaking containers duplicating the last slot, removed not necessary slot changes 2014-11-27 20:10:55 +01:00
a3b1d318cc Fixed ladder crafting recipe 2014-11-27 20:02:38 +01:00
f866efb622 Removed unused Block->isLiquid property 2014-11-27 17:26:43 +01:00
b1c4578726 Fixed #2340 2014-11-27 16:18:43 +01:00
f4181a6e36 Bump Minecraft: PE version 2014-11-27 14:37:44 +01:00
38089af098 Improved global entity motion encoding using per-player queues 2014-11-27 14:26:36 +01:00
cd135b39ad Improved player spawn item in hand sending 2014-11-27 13:59:32 +01:00
dd3207cbd8 Possible fix for #2267, #2314 2014-11-27 13:47:17 +01:00
a7abd5ff9d Catch exceptions when chunks are unloaded 2014-11-27 13:35:54 +01:00
a3e50f6337 Properly close inventory windows from Players 2014-11-27 13:32:07 +01:00
441a98e60a Removed old trigger_error() calls, closes #2335 2014-11-27 13:16:39 +01:00
4a90ac270f Improved exception handling and debugging 2014-11-22 13:52:36 +01:00
a906a2988b Bumped Minecraft: PE version string 2014-11-22 13:44:34 +01:00
545f68382c Increased Fence, Fence Gate and Stone Wall Y bounding box 2014-11-22 13:44:05 +01:00
8249cac592 Catch corrupted chunk data errors 2014-11-20 22:02:00 +01:00
7b7bbe9105 Regenerate corrupt player data if invalid data is found 2014-11-20 21:58:27 +01:00
05679c7872 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-11-20 21:46:14 +01:00
8eb80be691 Remove duplicated tiles from chunk table automatically 2014-11-20 21:45:52 +01:00
f55b0d0b45 Merge pull request #2295 from LukeDarling/patch-1
Fixed Server->getOps() capitalization
2014-11-19 13:10:03 +01:00
754e0dbb49 Protect permission removal against bad plugins 2014-11-18 18:43:30 +01:00
525c8db779 Improved chunk loading/unloading 2014-11-18 18:33:24 +01:00
c7f578f297 Possible fix for #2297 2014-11-18 13:57:03 +01:00
19c030281f Fixed #1969 2014-11-18 13:53:38 +01:00
ca9fe1b89a Improved and fixed command exception message, closes #2301 2014-11-18 13:46:00 +01:00
9fd6a695f6 Fixed permission-related memory leak 2014-11-18 13:42:24 +01:00
c07b0ff35b Fixed tile entities not being placed in the correct array 2014-11-15 11:49:09 +01:00
00be3f0dd3 Fixed Server->getOps() capitalization
I'm not 100% sure, but I believe this is how it's supposed to be.
2014-11-15 00:01:57 -05:00
6796fca2b6 Merge pull request #2294 from LukeDarling/patch-1
fixed version message color
2014-11-15 14:20:14 +10:30
5657cce3db fixed version message color 2014-11-14 15:52:38 -05:00
05ac256cc3 Fixed Acacia / Dark Oak logs crafting recipes 2014-11-14 15:58:31 +01:00
49977c5410 Bumped weakref version, fixes travis builds 2014-11-14 10:30:06 +01:00
ca40bb678c Merge pull request #2288 from sekjun9878/master
Get timezone directly. Fixes #2287.
2014-11-13 23:08:22 +10:30
2068cc9cdf Merge pull request #2243 from PEMapModder/patch-1
cmd files comment syntax should be like this.
2014-11-13 21:42:25 +10:30
ea4617cedd Get timezone directly. Fixes #2287. 2014-11-13 21:13:12 +10:30
1a5544f68c Fixed Chunk tile indexes 2014-11-08 15:00:18 +01:00
0128a7aeb2 API version 1.7.1 (fixes) 2014-11-07 09:45:30 +01:00
fd954ce708 Fixed PlayerInventory->setItem() with null items 2014-11-07 09:43:36 +01:00
d63a82de0a MCPE protocol 20 2014-11-06 19:08:32 +01:00
92143d523c Added SetDifficultyPacket 2014-11-06 19:07:24 +01:00
1818e64c8e Merge branch 'master' into 0.10 2014-11-06 18:56:47 +01:00
7e1095e28d Reenabled collision against entities on move 2014-11-06 12:57:17 +01:00
f1519e6d13 Improved Level->getTile() to a direct lookup instead of linear search 2014-11-06 12:34:33 +01:00
3b9a9bcd5d Use proper indexes on Living->getLineOfSight() when a max length is set 2014-11-06 12:23:45 +01:00
263bff01c8 Change RuntimeException to InvalidStateException on BlockIterator 2014-11-06 12:16:12 +01:00
987d647b76 Return proper BlockIterator index, throw more exceptions, improved blockQueue performance 2014-11-06 12:12:31 +01:00
522b75645c Merge branch 'master' into 0.10 2014-11-05 19:04:36 +01:00
9eed0a579c Fixed red sand smelting recipe 2014-11-05 17:41:12 +01:00
064976d32b Fixed ladder recipe 2014-11-05 17:38:23 +01:00
2abb577178 Fixed String -> Wool recipe 2014-11-05 17:36:44 +01:00
127855c220 Fixed Snow block recipe 2014-11-05 17:36:06 +01:00
93c7a3c170 Fixed bonemeal recipe, closes #2260 2014-11-05 17:32:28 +01:00
31903a764a Fixed unloaded chunks residing on memory and getting loaded again causing crash, fixed spawn chunks getting unloaded by players 2014-11-04 17:16:02 +01:00
79bc1d6c85 Fixed server not stopping after a special crash 2014-11-04 17:15:20 +01:00
cc7f12739d Added vertical and horizontal collision detection to Entities 2014-11-04 12:23:42 +01:00
32dae93ef9 Removed unused imports 2014-11-04 12:08:24 +01:00
8fd6582e74 Automatically set Entity / Tile entity save identifiers 2014-11-04 12:04:08 +01:00
a5369b3570 Fixed unloading chunks 2014-11-04 11:18:34 +01:00
abbd33210a Possible fix for #2245 2014-11-04 00:19:50 +01:00
6b6222c09c Allow passing a Player source as last parameter on Inventory->addItem() and Inventory->removeItem() 2014-11-04 00:16:25 +01:00
a8c997d88a ¬¬ 2014-11-03 12:54:46 +01:00
6993718a83 Added EntityDamageByChildEntityEvent 2014-11-03 12:03:37 +01:00
86afecec89 Improved inventory sending, send single slots instead of full inventory as much as possible 2014-11-03 11:48:10 +01:00
29d1fd1fc8 Fixed player viewer list including themselves 2014-11-03 11:29:01 +01:00
af4eb2ab1e Create server.log properly on non-existent directories 2014-11-02 16:15:15 +01:00
f7baf46a54 Fire PlayerInteractEvent on 0xff face 2014-11-02 16:12:51 +01:00
75c0d8324c Fixed some inventory events not firing on players 2014-11-02 13:26:58 +01:00
da4334f06b Revert Armor then Inventory instead of Inventory then Armor on failed transaction 2014-11-01 23:02:59 +01:00
413bd3c0df Use SplFixedArray for improved performance 2014-11-01 22:12:35 +01:00
1a0428654b Updated timings command, give direct link to results 2014-11-01 21:20:44 +01:00
2803a38fd1 Fixed random block updates not firing 2014-11-01 20:26:13 +01:00
95a5ca7889 Added command message to /time add 2014-11-01 20:12:55 +01:00
240f14c425 Fixed #2253 2014-11-01 19:40:15 +01:00
cb9b6ab1d1 Fixed server not using the correct provided path if it did not exist 2014-11-01 19:23:10 +01:00
8a87280566 Added /time start and /time stop 2014-11-01 17:45:11 +01:00
4d97827d44 Improved level switching for players 2014-11-01 17:39:09 +01:00
f8f1e0e9df Despawn entities correctly from clients as they move 2014-11-01 16:47:40 +01:00
bf596ebf05 Fixed Query-related crash 2014-11-01 16:20:40 +01:00
90777014b6 Fixed Stone crash 2014-11-01 16:17:47 +01:00
4a78ffd2dd Fixed FallingSand crash 2014-11-01 16:15:09 +01:00
7c361a52d2 Fixed #2252 2014-11-01 13:52:20 +01:00
13fc0df92c Fixed #2251 2014-11-01 12:40:45 +01:00
d5012f6fcf Fixed server not stopping after a fatal error 2014-11-01 03:07:47 +01:00
4569a73f3d Fixed Entity being set position after being closed 2014-10-31 23:10:29 +01:00
66acb5cdd7 Possible fix for crashing server not stopping 2014-10-31 23:10:12 +01:00
8601405a88 Fixed CPU leak 2014-10-31 21:07:00 +01:00
ae06681b60 Added packet exception handling, updated RakLib 2014-10-31 19:14:59 +01:00
01ffb14e39 Fixed #2204 2014-10-31 17:34:45 +01:00
ce989876af Improved freeing chunks 2014-10-31 16:39:32 +01:00
f8d6ebabf3 Removed some calls 2014-10-31 15:57:07 +01:00
094b600a0c Updated NBT/DataPacket reading 2014-10-31 01:02:31 +01:00
82cfe6ea9c Updated NBT/DataPacket reading 2014-10-31 00:32:50 +01:00
4fba6d7c86 Merge branch 'master' into 0.10 2014-10-30 23:20:59 +01:00
f72d7284b9 Added EncapsulatedPacket reuse on broadcast 2014-10-30 23:20:28 +01:00
8f0527832f Removed extra AxisAlignedBB generation on Door and Trapdoor 2014-10-30 22:15:19 +01:00
f66944368d Update RakLib 2014-10-30 22:06:23 +01:00
7ab3c57b00 Optimized networking code & AxisAlignedBB 2014-10-30 22:06:07 +01:00
673b867ee8 Fixed players not loading chunks when stuck on a unloaded chunk 2014-10-30 20:05:40 +01:00
2424c8a76c Update RakLib, possible fix for notifyACK 2014-10-30 19:44:05 +01:00
92eb5cb0b8 Added LE Triad methods 2014-10-30 17:56:58 +01:00
fd46c71120 Updated RakLib 2014-10-30 17:18:43 +01:00
6a4259bf24 Updated RakLib 2014-10-30 17:04:19 +01:00
9a65279c6a Added ifndef for packets Binary 2014-10-30 16:41:11 +01:00
09a01be709 Added ifndef for NBT Binary 2014-10-30 16:32:57 +01:00
57d1847c50 Updated to receive new optimizations 2014-10-30 16:02:48 +01:00
6e8e2a79dd Fixed Event name being null 2014-10-30 14:52:11 +01:00
d8f9def7f4 Added preprocessor optimizations 2014-10-30 07:58:53 +01:00
8cb9dd9a14 Fixed #2244 2014-10-29 22:58:40 +01:00
c4c374e3fa Added extra chunk sending timings 2014-10-29 21:52:27 +01:00
d57e37896d Improved Region / RakLib 2014-10-29 17:43:21 +01:00
022a978ffb Added InventoryPickupArrowEvent 2014-10-29 16:29:00 +01:00
00b282d40c Improved cache pool cleanup times 2014-10-29 16:13:47 +01:00
8a768cea33 EntityDamageEvent and children now only fire if the attack is possible, moved event trigger to Entity->attack() 2014-10-29 16:02:40 +01:00
289bc56b4b Blocks now save their bounding box, fixed entity block collision check 2014-10-29 15:43:23 +01:00
6f64af3066 Reuse even more objects! 2014-10-29 14:23:51 +01:00
72c09045d5 Fixed Zombie drops crash 2014-10-29 13:21:54 +01:00
5e55c3a8f0 Fixed Chest->unpair() 2014-10-29 13:21:14 +01:00
afaa2cf722 Fixed Double Chest behavior 2014-10-29 12:57:26 +01:00
50cfeaa393 Fixed Stonecutter recipe 2014-10-29 12:36:34 +01:00
dda8b03349 Fixed Bowl recipe 2014-10-29 12:12:54 +01:00
56e848488a Fixed Trapdoor recipe 2014-10-29 12:10:48 +01:00
7e4f862634 Fixed typo in OfflinePlayer 2014-10-29 11:42:29 +01:00
577a7a1c3d cmd files comment syntax should be like this. 2014-10-29 17:20:36 +08:00
78f8d0280d Removed unused imports 2014-10-29 01:14:09 +01:00
0680b98380 Remove chunks from advanced cache after setting 2014-10-29 01:07:30 +01:00
cbe0fe5e46 Added Entity->onGround setting when entities keep moving without checks 2014-10-29 00:41:13 +01:00
7eed92e8fb Use Player->forceMovement on MovePlayerPacket non-tick revert 2014-10-29 00:31:17 +01:00
f772391866 Fixed InventoryPickupItemEvent 2014-10-28 22:05:54 +01:00
8c4faa8622 Added extra Exceptions 2014-10-28 21:07:12 +01:00
b6f7ee20fc Added Error -> Exception handling 2014-10-28 20:43:36 +01:00
0fce83c671 Fixed #2189 2014-10-28 13:27:30 +01:00
8080643cc9 Fixed plugins crashing the server when teleporting players on an invalid event 2014-10-28 13:18:40 +01:00
5bf2174cad Fixed UseItemPacket being able to be sent before spawning 2014-10-28 13:16:20 +01:00
34ae760def New way to spawn entities/tiles using a global register table, allow overriding default entity/tile classes via classes 2014-10-28 13:09:27 +01:00
a5b85c549a Added Snowballs 2014-10-28 12:13:31 +01:00
b9f1812f61 Disallow further modification of Signs by its creator after load/unload 2014-10-28 11:05:32 +01:00
350cee3d41 Added Event allocation pool, updated SPL with Class::onClassLoaded() 2014-10-28 10:47:40 +01:00
144a871c07 Improved Vector3 and Block handling, less allocation on Positions 2014-10-28 10:03:10 +01:00
69492474e4 Improve #2238, do not crash when an invalid/corrupt RCON stop event happens 2014-10-28 02:09:36 +01:00
4299ebebcc Bump API version to 1.6.1 2014-10-28 00:55:07 +01:00
119b429ab8 RakLib update 2014-10-28 00:43:47 +01:00
8f1eb41ca5 RakLib update 2014-10-28 00:23:55 +01:00
ca92d2a0d3 Bumped API version to 1.7.0 2014-10-27 20:30:58 +01:00
db82f76c11 Improved network packets allocation 2014-10-27 20:30:33 +01:00
3f5b129cf5 Updated RakLib 2014-10-27 19:39:24 +01:00
f6aac8728b Mark chunk to be saved when removing invalid entities/tiles 2014-10-27 18:43:58 +01:00
809fc44813 Bump API version to 1.6.1 2014-10-27 16:07:00 +01:00
64f1ff066d Fixed /setworldspawn changing sender data 2014-10-27 15:57:26 +01:00
a5a3f4801a Fixed entities not getting ticks on movement 2014-10-27 15:53:14 +01:00
23d1532ff9 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-10-27 15:44:44 +01:00
ecbbcc2e8e Drop invalid entities / tile entities on chunk loading 2014-10-27 15:44:36 +01:00
7abf52e615 Implemented Vector3 List and AxisAlignedBB Pool to decrease object allocation 2014-10-27 15:39:20 +01:00
9e01e2ef49 Merge pull request #2235 from nno88551/patch-2
Update BaseInventory.php
2014-10-26 15:52:08 +01:00
df81b365e5 Update BaseInventory.php 2014-10-26 22:21:21 +09:00
db8ac0b9cb Merge pull request #2225 from PEMapModder/falling-sand
Update FallingBlock to new Anvil formats, possible fix for #2189
2014-10-25 17:58:47 +02:00
ee4f416d93 Fix FallingBlock.php 2014-10-25 18:15:47 +08:00
8feea721e3 Merge pull request #2223 from Falkirks/set-armour-fix
Fix various get and set armour in PlayerInventory
2014-10-25 12:13:28 +02:00
8e7077ff4b Update FallingBlock to new Anvil formats, possible fix for #2189
I don't have time to test yet, so I am not sure if it does fix it.
2014-10-25 12:26:57 +08:00
4f4a6e7446 Fixes get and set armour 2014-10-24 17:11:59 -07:00
1fc066fc37 Updated time steps from x2.5 to x1.25 2014-10-24 12:12:01 +02:00
b565844062 Merge branch 'master' into 0.10 2014-10-24 12:07:35 +02:00
be948f99cc Fixed #2207 Server crashing if players are closed before logging in 2014-10-24 12:06:55 +02:00
5cb428e5cc Updated build number 2014-10-23 17:23:59 +02:00
d2f4a14d66 Merge branch 'master' into 0.10 2014-10-23 17:21:24 +02:00
516bb37a50 Removed some direct type checks on Entity/Tile->closed 2014-10-21 19:28:29 +02:00
580ade9092 Possible fix for entities not closing correctly 2014-10-21 19:26:16 +02:00
8f7dfe0b71 Removed extra ; from if, fixes #2205 2014-10-21 18:37:29 +02:00
5310ba3ae6 Fixed crash when doing var_dump() of anything that contains the Server object 2014-10-20 13:06:53 +02:00
ef97efcd96 Added explosion death message 2014-10-20 13:00:03 +02:00
30c3718ea8 Improved Explosion item drop position 2014-10-20 12:58:05 +02:00
5437567e95 Merge branch 'master' into 0.10 2014-10-20 12:53:14 +02:00
e3e97a4205 Improved Player->onGround checking 2014-10-20 12:52:00 +02:00
fec387d2ec Fixed entities not being pushed out of blocks 2014-10-20 12:37:17 +02:00
481e2b08ee Removed debug call 2014-10-20 12:05:40 +02:00
15de0eece7 Improved inventory and window allocation, fixes #2200 2014-10-20 09:48:11 +02:00
2f8267aa1e Improved Level object deallocation 2014-10-19 20:45:03 +02:00
f2b573c32f Fixed Level->getMetadata() and similar, removed extra references 2014-10-19 19:51:36 +02:00
34946faf94 Remove errors from Utils::getRandomBytes() 2014-10-19 13:44:38 +02:00
3b47513439 Return result directly on Server->getOfflinePlayer() 2014-10-19 02:49:58 +02:00
7d9a98ec6b Updated UseItemPacket 2014-10-18 23:42:41 +02:00
92facc94b9 Added new fences and fence gates to fuel types 2014-10-18 18:02:39 +02:00
d3327f450c Added different Fence Gates, new Fence Gate crafting recipes 2014-10-18 17:56:18 +02:00
570cab9c66 Added different Fences, new Fence crafting recipes 2014-10-18 17:44:24 +02:00
582ba100b0 Bumped protocol version to 19 2014-10-18 17:01:36 +02:00
4c0daa462d Merge branch 'master' into 0.10 2014-10-18 16:54:03 +02:00
2e6366868d Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-10-18 16:53:42 +02:00
245e9b4f18 Fixes inventory changes getting the wrong window, closes #2187 2014-10-18 16:53:06 +02:00
68e73d4e3a Merge pull request #2188 from aodzip/patch-1
Update Skeleton.php
2014-10-18 15:36:02 +02:00
684617d370 Update Skeleton.php
fixed a little wrong
2014-10-18 21:13:35 +08:00
a879104a6f Minecraft: PE version bump 2014-10-17 14:43:10 +02:00
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
05a42712bf Added non-packaged plugins & pocketmine warnings 2014-04-01 04:59:44 +02:00
207c2c4aba Fixed namespaces paths 2014-04-01 04:47:04 +02:00
3605bc36c5 Fixed PluginManager::parseYamlCommands() 2014-04-01 02:12:05 +02:00
9cae532d7e Remove compile script DEBUG trap on php.ini generation 2014-04-01 01:47:28 +02:00
e8477fec53 Added /difficulty, removed old API files 2014-04-01 01:37:43 +02:00
760695e4bc Added Phar plugins 2014-03-31 23:49:43 +02:00
e8c4507ac6 Re-added kill 2014-03-31 22:51:00 +02:00
c167defa72 Fixed plugin dataFolder 2014-03-31 22:35:42 +02:00
5dafe8e7f0 Fixed lots of errors, added auto-save 2014-03-31 20:42:58 +02:00
8571796611 Load correct plugin permissions 2014-03-31 18:24:59 +02:00
b03ef8b61c More flexible match on plugin registration 2014-03-31 17:29:47 +02:00
0422540114 New automatic event listener plugin declaration 2014-03-31 17:01:56 +02:00
00d777a68d Fixed commands, NBT Player saving 2014-03-31 15:42:08 +02:00
2f03251795 Added /list, Player::canSee(), Player::showPlayer(), Player::hidePlayer(), removed RealHuman 2014-03-31 15:18:50 +02:00
f9a7385b47 Added /me and /say, fixed a bunch of things, chat working 2014-03-31 06:51:34 +02:00
22b5255421 Formatting 2014-03-31 05:53:51 +02:00
befe1c606f Added /ban, /ban-ip, /pardon, /pardon-ip 2014-03-31 05:51:42 +02:00
1ff381ebf4 Things are working ヽ༼ຈل͜ຈ༽ノ 2014-03-31 05:04:36 +02:00
2b8df410d1 Player is instanceof CommandSender 2014-03-31 02:53:37 +02:00
5bb909adf1 Fixed case 2014-03-30 23:51:41 +02:00
f789e6e6e3 Lots of new things added 2014-03-30 18:04:56 +02:00
ccec74076b Fixed PluginBase::getServer() 2014-03-30 14:35:58 +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
de6e8f6fe1 Removed WeakRef 2014-03-29 04:39:45 +01:00
7599fb436d Fixed #1365 2014-03-29 04:35:12 +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
e03c8ed32e Updated compiler 2014-03-29 03:27:29 +01:00
0d30dca5aa Updated pthreads to 2.0.4 2014-03-28 23:50:09 +01:00
7e03109576 Moved default level registration 2014-03-28 13:07:36 +01:00
38809f7da2 Reformatting, removing unused imports 2014-03-28 12:57:08 +01:00
fd8e5b27e5 Added new global autoloader 2014-03-28 05:04:34 +01:00
b59926bece Added Recursive class loading in FolderPluginLoader 2014-03-28 04:25:17 +01:00
a7269c7900 Added /tell 2014-03-28 03:40:12 +01:00
2f20d95e5d Added new Event system 2014-03-28 02:13:03 +01:00
9e8cf2d42c Update CONTRIBUTING.md 2014-03-27 22:32:00 +01:00
926afa3903 New Task scheduler 2014-03-27 22:16:09 +01:00
9a2934b85b More unloading 2014-03-27 19:40:05 +01:00
1c341337a3 Set default console color at start 2014-03-27 18:58:36 +01:00
f60b526c9e Changed default log path 2014-03-27 18:53:20 +01:00
3bc3db0740 Added /stop, plugin disable / unload, remaining TaskCanceller classes 2014-03-27 18:49:43 +01:00
2385b94ba3 Added PluginBase::getCommand() 2014-03-27 14:56:02 +01:00
605231251a Fire plugin onLoad() 2014-03-27 14:35:44 +01:00
1c7be84703 Added CommandExecutor interface to PluginBase 2014-03-27 05:25:47 +01:00
530d705d39 Fully loadable plugins 2014-03-27 04:59:18 +01:00
120efad01f Colors fix D: 2014-03-26 20:23:04 +01:00
9fe68003eb Added Help command 2014-03-26 20:11:53 +01:00
76438e78d2 Changed Command inheritance 2014-03-26 18:10:49 +01:00
2112de42ad removed travis on Core-Rewrite 2014-03-26 16:50:36 +01:00
92a0ddb4fe Threaded networking :D 2014-03-26 16:48:27 +01:00
7ea9e4c862 It runs :O (Added more Permissions, executors and such things) 2014-03-26 04:14:53 +01:00
b1b8c89227 Removed SQLite3 from Recipe, converted to a lookup table 2014-03-25 18:53:39 +01:00
b6e0905c3e Implemented scheduler classes 2014-03-25 13:19:15 +01:00
af80c056c7 Added pthreads / yaml documentation stubs 2014-03-25 01:13:35 +01:00
5b90c4a716 safe_var_dump() now supports any amount of parameters 2014-03-23 21:56:50 +01:00
1429a74beb Player event 2014-03-23 15:14:11 +01:00
ee265d44bd Added more new Events 2014-03-23 13:41:45 +01:00
fd0fcecb46 Oops, seems like Utils::readInt() is reading an unsigned long because of PHP silliness 2014-03-23 01:55:26 +01:00
d18952a06e Removed not necessary code from Utils::readInt() and Utils::readLInt() 2014-03-23 01:50:15 +01:00
86f9d3e233 Merge branch 'master' of https://github.com/PocketMine/PocketMine-MP 2014-03-23 10:37:44 +10:30
f03ab9a587 Removed Deprecation 2014-03-23 00:43:45 +01:00
80cfa7cc84 Formatting code 2014-03-23 00:32:05 +01:00
af14c87572 Added new Plugin and Permissions stuff :D 2014-03-23 00:22:14 +01:00
28c5443b0d Changed player achievement method names 2014-03-23 00:21:51 +01:00
08c6c1c1ac Updated compile scripts 2014-03-23 00:19:54 +01:00
cb2b08b248 Fixed Level generators 2014-03-23 00:19:11 +01:00
63f1f7581f Renamed Stackable to Threaded 2014-03-18 01:00:35 +01:00
d53656b2a8 pthreads 2.0.2 \(^.^)/ 2014-03-18 00:50:03 +01:00
28e17fe808 Added PHP WeakRef 2014-03-15 13:19:48 +01:00
c266cb991c Fix /list adding a trailing comma. 2014-03-14 16:45:54 -05:00
6f0f86dc0c More docs 2014-03-14 03:11:23 +01:00
3ff8ddc652 Fixed a few errors in new Events 2014-03-14 02:02:31 +01:00
68abafef7a Added multiple Player events using the new system 2014-03-14 01:51:10 +01:00
279472b01a Added generic block relative place/break on Level 2014-03-13 23:04:49 +01:00
91c4cbfedb Moved Player::buffer 2014-03-13 10:51:38 +01:00
b24120a863 Updated all undefined constants/classes, place resent packets to the recovery queue for NACK 2014-03-13 10:48:33 +01:00
3c3b346fd3 Use NBT Compounds instead of a NBT codec in PMF level data 2014-03-12 22:54:32 +01:00
63542a2f13 Updated NBT library to remove read overhead 2014-03-12 22:40:19 +01:00
cc5a30a0c2 Fixed ANSI color codes on Windows 2014-03-12 14:07:14 +01:00
8f990472c6 Fixed PHP 5.4 issues 2014-03-12 14:03:42 +01:00
18117b91ed Fixed issues with CPU loop 2014-03-12 03:25:50 +01:00
e033af0e72 Added -s (static) flag to compiler 2014-03-12 02:41:49 +01:00
69c829c302 Use pthreads 1.0.1 2014-03-11 21:58:40 +01:00
a84f756fd5 Optimize Imports 2014-03-11 20:47:31 +01:00
b3a2d3164f Finally, I can spawn AGAIN! 2014-03-11 20:45:53 +01:00
b28bc3ae9b Merge branch 'master' of https://github.com/PocketMine/PocketMine-MP 2014-03-09 20:01:02 +10:30
b4df7c9456 Moved compile scripts 2014-03-08 18:16:55 +01:00
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
19d98869fd Modified compile.sh 2014-03-08 05:33:11 +01:00
099716920b Updated permissions 2014-03-08 04:43:15 +01:00
cbc64462e6 New directory structure. More powerful startup scripts 2014-03-08 04:41:43 +01:00
8d75bff34b Merge branch 'master' into Core-Rewrite
Conflicts:
	src/level/LevelImport.php
	src/pmf/LevelFormat.php
2014-03-08 03:34:53 +01:00
ababc879b5 Removed warning message about not-bundled PHP 2014-03-08 03:28:00 +01:00
a817234aa8 Do not generate Phar utilities by default, only generate extension 2014-03-07 23:29:28 +01:00
e246e10a82 Added NEON optimizations to iOS 2014-03-07 20:04:18 +01:00
5ad511cd11 Disabled phar cmdtools generation on crosscompile 2014-03-07 19:12:06 +01:00
47ad8b6fac Added PHP_VAR_NAME to crosscompile 2014-03-07 18:26:12 +01:00
a74f5809c7 Added -lresolv 2014-03-07 17:38:36 +01:00
8c02555a8d Added sed -i ".backup" 2014-03-07 17:02:05 +01:00
612cf98a08 typo fix 2014-03-07 16:42:18 +01:00
971e18d9b0 Added php.ini Phar directives 2014-03-07 16:33:29 +01:00
4a2dea4e45 Added correct toolchain for iOS 2014-03-07 16:25:40 +01:00
2916b0f049 Added Phar extension to PHP 2014-03-07 16:22:16 +01:00
bfe746235f Removed iOS -arch 2014-03-07 16:20:17 +01:00
604f068112 Added iOS flags 2014-03-07 15:41:08 +01:00
c7854a3417 Added arm flags 2014-03-07 15:33:32 +01:00
8bfd22c9ac Added arch-specific compile optimizations 2014-03-07 13:34:31 +01:00
052f641715 Fixed levels not being read properly 2014-03-07 06:29:35 +01:00
ee51f75c78 Fixed issues with zlib 2014-03-07 05:15:01 +01:00
73b78e1455 Updated helper scripts PHP version to 5.5.10 2014-03-07 04:49:26 +01:00
7ad7398f2b Updated PHP version to 5.5.10 2014-03-07 04:47:15 +01:00
e81f4430cb Fixed mac 32-bit compilation 2014-03-07 04:29:47 +01:00
c12c6f1f18 Added remaining env. vars to compile.sh 2014-03-07 04:24:41 +01:00
a375a17d17 New compile script 2014-03-07 04:21:21 +01:00
801e924783 Comments 2014-03-06 23:38:46 +01:00
993620341a Added Villager class and NPC interface 2014-03-06 23:33:35 +01:00
59246dd5ec Added API Docs link 2014-03-06 22:03:30 +01:00
f7c7eac05a Updated README.md 2014-03-06 21:48:06 +01:00
331a26931f It staaaarts! 2014-03-06 20:41:04 +01:00
56d3b89f57 Updated class constants 2014-03-06 19:31:41 +01:00
80356d8794 fixed syntax error 2014-03-06 19:29:33 +01:00
028adce245 Used namespacer to identify moved files 2014-03-06 19:28:20 +01:00
a54d33957e Added multiple comments and info 2014-03-06 18:52:23 +01:00
5c00b415a5 typos 2014-03-06 17:24:26 +01:00
18443c0cd7 Reformatted code 2014-03-06 17:17:45 +01:00
6a736aa822 Used namespacer on Blocks and Items 2014-03-06 17:16:05 +01:00
d490972a42 fix typo 2014-03-06 17:14:54 +01:00
6f74ef80f9 Added Block and Item namespaces 2014-03-06 17:14:15 +01:00
2e0d9153b3 used namespacer 2014-03-06 15:15:50 +01:00
64a9650765 fixed typo 2014-03-06 15:12:52 +01:00
419f246e68 Added Item namespace 2014-03-06 15:11:46 +01:00
e3f1db0f45 Added Network\Handler namespace 2014-03-06 13:19:00 +01:00
c08bf3ef86 Removed code remove comments 2014-03-06 13:16:44 +01:00
bbd66e6ad1 Removed code remove comments 2014-03-06 13:05:54 +01:00
a14deae634 Removed code remove comments 2014-03-06 12:58:54 +01:00
42ae544d0d Used namespacer tool 2014-03-06 05:47:00 +01:00
c9c6d5a5f4 Added Ores to objects 2014-03-06 05:43:40 +01:00
eeb8244f26 Fixed Normal generator name 2014-03-06 05:35:17 +01:00
e0267799fb Fixed class namespaces 2014-03-06 05:33:04 +01:00
da4bc302c4 Fixed Utils endianness 2014-03-06 04:10:07 +01:00
5109566c9f Updated .gitignore 2014-03-06 03:53:59 +01:00
5de9fa77d7 Moved objects 2014-03-06 03:16:03 +01:00
ee53e21159 small fixes 2014-03-06 03:03:42 +01:00
dd2d229f74 renamed PocketMine\PMF\Level to PocketMine\PMF\LevelFormat 2014-03-06 02:45:09 +01:00
e3c0ea6be5 fixed typo 2014-03-06 02:40:19 +01:00
5b02666828 fixed typo 2014-03-06 02:38:57 +01:00
bc0c185cb5 fixed typo 2014-03-06 02:36:30 +01:00
928519f226 fixed typo 2014-03-06 02:30:16 +01:00
edf0d44416 fixed typo 2014-03-06 02:27:28 +01:00
3465a5f7e8 fixed typo 2014-03-06 02:26:17 +01:00
024e219292 fixed typo 2014-03-06 02:22:52 +01:00
42b5af23db Moved files 2014-03-06 01:18:55 +01:00
5ea31b57ce First step to namespaces 2014-03-05 23:43:16 +01:00
23b8fc32ff removed DocBlock header for logo 2014-03-05 11:15:47 +01:00
5f53f61121 Faster NBT parsing 2014-03-05 10:37:14 +01:00
98c0dfef43 Removed entity.motion from Player 2014-03-05 10:17:22 +01:00
d69fe5d5e7 New events, item methods 2014-03-05 10:16:08 +01:00
2bdc8c400e EventHandler code cleanup 2014-03-05 03:42:22 +01:00
ccdf587135 go away E_NOTICEs 2014-03-05 02:53:20 +01:00
b00da18f41 faster packet decode using pure-PHP functions instead of core-PHP ones :P. WTF PHP 2014-03-05 02:49:40 +01:00
9c38ead76d fixed time not being sent correctly on creative mode the first time 2014-03-05 01:25:53 +01:00
274f8a6113 Block placement fixes 2014-03-05 01:19:05 +01:00
a529e7566a Removed not needed network steps, corrected slot methods 2014-03-05 00:54:12 +01:00
bf412b1c20 Do not sleep on main Thread when actions are being done 2014-03-04 20:37:15 +01:00
980ee223d0 Save correct NBT Compound tag on Level chunk save 2014-03-04 19:52:52 +01:00
5241d8ff13 Fixed derp x3 2014-03-04 19:49:39 +01:00
c6c0b75eae Fixed derp x2 2014-03-04 19:46:47 +01:00
547ca74feb Fixed derp 2014-03-04 19:46:06 +01:00
4697d9d4ed Added player NBT save format, auto-upgrade 2014-03-04 19:41:56 +01:00
4449af2213 Implemented InventorySourceEntity into HumanEntity 2014-03-04 19:40:30 +01:00
f6589db064 Send Entity motion, update on schedule 2014-03-03 00:27:44 +01:00
c904e8bc0e Remove ANSI characters on clean 2014-03-03 00:26:33 +01:00
12ddf530b1 Added AxisAlignedBB::getMixedBoundingBox() (?) 2014-03-02 23:32:48 +01:00
df20467f3b Added Player block place/break (to be rewritten soon) 2014-03-02 17:56:54 +01:00
9cc9de8dae New Random block update tick 2014-03-02 17:56:24 +01:00
f6daaf76c8 Update CONTRIBUTING.md 2014-03-02 02:05:40 +01:00
ca308f8159 Merge branch 'master' into Core-Rewrite
Conflicts:
	src/pmf/PMFLevel.php
2014-03-01 22:12:22 +01:00
11f5691104 Fixed Pocket format importing 2014-03-01 22:08:28 +01:00
c8deefdb12 derp 2014-03-01 21:55:10 +01:00
75b34b6c2a Merged master into Core-Rewrite 2014-03-01 21:48:09 +01:00
5bf440d820 Fixed level upgrade and direct save on load 2014-03-01 21:45:07 +01:00
4d9e781f27 Tuned PMFLevel version upgrade 2014-03-01 21:43:55 +01:00
2a23eadbb6 Fixed things 2014-03-01 21:42:40 +01:00
573fe0e5cc Save player position, removed several methods from PluginAPI 2014-03-01 20:32:49 +01:00
f8d91b5888 Rolling chunk load 2014-03-01 19:13:08 +01:00
fdbefa0571 Added index to Level::getUsingChunk() 2014-03-01 19:04:18 +01:00
c2ad811451 Added chunk move spawning logic 2014-03-01 19:01:24 +01:00
dad2f21888 Players are fully spawnable and can see each other! 2014-03-01 18:23:38 +01:00
9d02ed9a28 New chunk indexing and sending algorithm 2014-03-01 17:35:44 +01:00
8403a34eb3 Removed entities, tiles, players SQLite3 tables 2014-03-01 14:07:27 +01:00
648b02bc79 Added Entity level switch, global Player static container 2014-03-01 14:05:45 +01:00
914098310c Guess NBTTag_List components type automatically 2014-03-01 11:26:19 +01:00
734b066131 removed debug messages 2014-02-28 22:03:09 +01:00
5651fc1cb1 Fixed level block and chunk sending 2014-02-28 20:39:59 +01:00
f08bedf2fe Added Biome methods to Level 2014-02-28 20:04:41 +01:00
6ac5647e2c Fixed load order 2014-02-28 20:04:31 +01:00
c488c19db9 I can spawn!! 2014-02-28 19:47:08 +01:00
f1d6726615 Added TextFormat::toHTML() 2014-02-28 16:08:33 +01:00
573c3ea377 Added /msg alias to /tell :P 2014-02-28 16:08:19 +01:00
16eb45925a Remove non-implemented chat colors from player messages 2014-02-28 00:12:57 +01:00
6d5e2648cf extra changes 2014-02-28 00:00:04 +01:00
2bf3f0de73 Removed EntityAPI 2014-02-27 16:47:49 +01:00
e314f46b5b Added biome saving to PMFLevel version 2 2014-02-27 15:34:00 +01:00
dc8cc2ab9f fixed empty world generation 2014-02-27 15:17:45 +01:00
6bd91cf39e fixes, new Tile update algorithm 2014-02-27 15:12:05 +01:00
c9dfdc288d Updated global Tile code 2014-02-27 12:23:22 +01:00
44b9d33b65 removed debug code 2014-02-27 00:24:43 +01:00
9acc867a94 fix 2014-02-27 00:14:05 +01:00
103d0bf2ea Updated TextFormat constants 2014-02-27 00:11:06 +01:00
4a2852bb90 Reworked Level things to handle new NBT structure 2014-02-27 00:03:53 +01:00
398fbbfb31 Added array things to NBT 2014-02-27 00:03:27 +01:00
4ffdb029f0 Removed TileAPI 2014-02-27 00:02:59 +01:00
b7ca8aac5c New Tile structure 2014-02-27 00:02:28 +01:00
b374783486 Allow direct property naming on NBT TAG_Compound 2014-02-26 17:55:17 +01:00
3864630bcd New PMF level (uses NBT Entity and TileEntity) 2014-02-26 17:15:31 +01:00
38c5174da7 Merged branch master into Core-Rewrite (includes new NBT changes) 2014-02-26 16:26:59 +01:00
21671b133a New NBT library finished 2014-02-26 15:20:16 +01:00
9cfa49c112 Added core NBT modifications 2014-02-26 15:12:58 +01:00
0231bf406e new NBT fixes 2014-02-26 13:53:50 +01:00
28d1da1286 New NBT tags 2014-02-26 13:08:53 +01:00
85f8613803 Fix RCON packet structure #1278 2014-02-24 20:13:15 +01:00
8e1cd2d6bd Check for block changes each 2 ticks instead of each 15 ticks 2014-02-23 13:47:30 +01:00
24722e3c9a Added #1196 async function queuing
Type ID: ASYNC_FUNCTION
Params: array("function" => $functionName, "arguments" => array
$argumentArray)
2014-02-23 13:39:57 +01:00
13274ebefa send-usage is now an advanced property :P 2014-02-23 13:39:56 +01:00
378e9c8720 Merge pull request #1274 from iksaku/patch-1
/sudo param help more descriptive
2014-02-23 13:37:49 +01:00
ba761faf74 Update BanAPI.php
/sudo help more descriptive?
2014-02-22 22:43:58 -06:00
734abf2fbb Fix E_STRICT errors 2014-02-20 23:43:42 +01:00
46ff7d43f4 Forgot to remove crash debug code. Fix #1260 2014-02-20 23:41:36 +01:00
8208fd2389 Changed class name 2014-02-20 17:22:51 +01:00
fded039485 Fixed #1258 2014-02-20 13:13:46 +01:00
9bc69f4c17 Update memory data on crash 2014-02-20 11:24:48 +01:00
eb40c34547 Fix error dump not dumped on memory problems 2014-02-20 10:57:42 +01:00
772fa2b9e3 Query token now depends on the source IP 2014-02-20 09:00:17 +01:00
7bdc48509e things 2014-02-19 17:41:12 +01:00
be13d0a921 Merge remote-tracking branch 'origin/PluginAPI-Rewrite' into Entities 2014-02-19 15:59:01 +01:00
7a44e8041f Entity $chunkIndex 2014-02-19 15:37:59 +01:00
b36d754e5b Merge remote-tracking branch 'origin/master' into Entities 2014-02-19 15:28:23 +01:00
62ef1f6b20 Added more entities 2014-02-19 12:41:19 +01:00
d12ce8fd6c small fixes 2014-02-19 02:23:45 +01:00
dd177b689b Added -mmacosx-version-min=10.5 to compile.sh 2014-02-19 02:09:02 +01:00
b4c6a0bf22 oops, typo 2014-02-19 01:56:25 +01:00
f1b5f83fd4 Lots of typos fixed, undefined variables, unused code 2014-02-19 01:55:42 +01:00
3d3111fef6 Changed preg_match() code in Player username handling 2014-02-19 00:49:07 +01:00
a1b2cf4b34 Added -undefined dynamic_lookup 2014-02-18 21:36:52 +01:00
1961e82645 Downgrade OpenSSL to 0.9.8y 2014-02-18 21:31:04 +01:00
15881d328d Added -weak-lSystem to MacOS x86_64 2014-02-18 20:41:54 +01:00
80e2a7e486 Update installer.sh 2014-02-18 19:46:39 +01:00
08c1dbe3a7 fix fix* 2014-02-18 18:52:27 +01:00
0cfb5aa720 fixed typo 2014-02-18 18:42:41 +01:00
60cf2c824f This should do for MacOS x86 2014-02-18 18:22:27 +01:00
f8dc01ccb3 Fixed things compile.sh 2014-02-18 17:47:40 +01:00
2c9337f200 Revert "Added $WITH_OPENSSL again to PHP"
This reverts commit c290b07382.
2014-02-18 17:31:12 +01:00
c290b07382 Added $WITH_OPENSSL again to PHP 2014-02-18 17:26:36 +01:00
0e5c532f5e Changed Android OpenSSL target 2014-02-18 17:24:46 +01:00
9006e5afad Added custom zlib to OpenSSL 2014-02-18 17:13:36 +01:00
bd3544e917 Added DYLD_LIBRARY_PATH 2014-02-18 16:28:30 +01:00
f384dfc40a Changed @loader_path to @executable_path on MacOS 2014-02-18 15:33:32 +01:00
2ee76182ad Compile OpenSSL on MacOS 2014-02-18 15:16:10 +01:00
c7acc3f221 Updated -rpath for MacOS 2014-02-18 15:00:29 +01:00
4573389840 Use Github URL for zlib 2014-02-18 14:48:51 +01:00
ea2fc1fb03 MacOS 32-bit compilation 2014-02-18 14:37:56 +01:00
0245ebe9f6 Update jenkins.sh 2014-02-18 13:00:33 +01:00
d38ae3c230 Added tar.gz files to jenkins.sh 2014-02-18 11:58:34 +01:00
daf27f46be Update installer.sh 2014-02-18 11:54:33 +01:00
2e2990fe33 Update compile.sh 2014-02-18 11:25:01 +01:00
aae66930b6 Update compile.sh to remove unused data 2014-02-18 10:27:32 +01:00
7472238510 Updated installer to handle full paths right and discard warnings on PHP checking 2014-02-17 19:10:28 +01:00
943e038772 Remove OpenSSL from PHP build :P 2014-02-17 18:37:37 +01:00
42e7467dba Added OpenSSL to Jenkins 2014-02-17 18:32:02 +01:00
697d96e60c Updated compile script to handle shared libraries 2014-02-17 18:30:18 +01:00
5b5dcd6d77 Removed not used code in compile.sh 2014-02-17 14:43:58 +01:00
0e39131e76 *fix 2014-02-17 13:26:51 +01:00
109f97ae00 Added ODROID detection to installer.sh 2014-02-17 13:20:28 +01:00
8b4abcc558 Generate OpenSSL shared binaries 2014-02-17 03:09:58 +01:00
5f3772d14a fixed cURL SSL for Darwin 2014-02-17 02:13:35 +01:00
98c50f9a9c OpenSSL is now not enforced compile.sh 2014-02-17 01:46:28 +01:00
6b2bca10a3 Added PHP check on installer.sh 2014-02-16 22:51:25 +01:00
5f6c9b7fad Normal compile.sh 2014-02-16 20:47:32 +01:00
696792cd2a Pre-sed 2014-02-16 20:21:42 +01:00
7e979f40cb Use full path on compile.sh 2014-02-16 20:05:21 +01:00
b0a6631b8e Update jenkins.sh 2014-02-16 19:45:09 +01:00
bb680e6e67 Fix compile.sh things 2014-02-16 18:52:55 +01:00
e999de22d5 oh my god. well, this should do. works for 32 and 64 bit FINALLY 2014-02-16 18:16:17 +01:00
bab5a36d39 Well, I found what broke everything 2014-02-16 17:10:04 +01:00
1a7cdc5cea No OpenSSL for PHP :( 2014-02-16 17:03:36 +01:00
7497e32042 Update jenkins.sh 2014-02-16 16:56:19 +01:00
d0c5f27ed3 OpenSSL make depend :S 2014-02-16 16:54:48 +01:00
65940719c2 OpenSSL + cURL 2014-02-16 16:44:07 +01:00
9847f38a9f Include OpenSSL in builds 2014-02-16 16:10:05 +01:00
e22b70296f Update compile.sh 2014-02-16 13:52:10 +01:00
5725b5a1a8 Update compile.sh 2014-02-16 13:36:13 +01:00
e7565e4183 Update jenkins.sh 2014-02-16 13:34:41 +01:00
878c3a3e3a Update compile.sh 2014-02-16 13:27:29 +01:00
0915e751c4 Update jenkins.sh 2014-02-16 13:11:15 +01:00
e740124b43 Update jenkins.sh 2014-02-16 13:03:31 +01:00
b6ad889057 Trying to fix libssl.so.10 error, re-added libedit 2014-02-16 12:46:26 +01:00
0e4b7f85c4 */ 2014-02-15 20:19:33 +01:00
905fa23d18 methods* 2014-02-15 12:17:17 +01:00
d699a97bb7 small things 2014-02-15 01:39:37 +01:00
9301c04e1f Added pre-compiled Linux binaries to installer 2014-02-14 23:09:29 +01:00
12141fe2b1 Updated jenkins.sh 2014-02-14 22:41:50 +01:00
5d1c79379b *and 2014-02-14 21:49:26 +01:00
08149fa4b3 Fixed #1229 2014-02-14 20:56:00 +01:00
dfe7269019 Fixed #1193 using #1194 2014-02-14 20:53:15 +01:00
2b15c440ee Send inventory on invalid crafting/invalid movement of item 2014-02-14 19:54:14 +01:00
daf3198136 Tall Grass can be replaced 2014-02-14 19:37:57 +01:00
fdf519398a Do not unload spawn chunks 2014-02-14 19:37:39 +01:00
f0ff420659 Fixed negative chunk indexes on PMFLevel 2014-02-14 18:25:06 +01:00
4acb4541ab Infinite player chunk sending (not yet visible :( ) 2014-02-14 17:59:34 +01:00
7ea0bf5067 Merge remote-tracking branch 'origin/master' into Entities 2014-02-14 17:16:51 +01:00
cbe07a1fa0 Fixed PMFLevel infinite loop 2014-02-14 14:21:28 +01:00
47893ed765 Generate backtrace on error/crash 2014-02-14 14:21:13 +01:00
63f4f87d37 Fixed PMFLevel bugs, crashes and weird methods 2014-02-14 13:17:05 +01:00
c1251a25bd Removed water PMFLevel update that caused locks 2014-02-14 01:36:10 +01:00
da554fbf23 Fixed Trees 2014-02-14 00:25:44 +01:00
715e51b7c5 Automatic population on side loading 2014-02-14 00:19:26 +01:00
5d7198396d Added TallGrassPopulator 2014-02-13 22:39:53 +01:00
4fecbc2dbc Added water sand and gravel 2014-02-13 22:05:50 +01:00
9600d61454 Modified max-chunks-per-second default value 2014-02-13 20:48:50 +01:00
5929b510d5 Better, faster world generation. Needs more things 2014-02-13 20:44:15 +01:00
4eebbba5bf PHP 5.4, PHP 5.5 and PHP 5.6 on Travis CI 2014-02-13 11:06:55 +01:00
1bbf211a37 Set a world spawnpoint using /spawnpoint w:WORLD x y z 2014-02-13 09:47:30 +01:00
acece47a37 Merge remote-tracking branch 'origin/master' into Entities 2014-02-13 09:30:21 +01:00
4d1adb98a8 Removed $i on WorldGenerator 2014-02-13 09:29:50 +01:00
c3a6149b29 added protocol number to /version 2014-02-13 08:52:27 +01:00
89e556755d Updated WorldGenerator to use correct generation variables 2014-02-13 08:38:23 +01:00
ab5c6341fe Added /plugins and /version 2014-02-13 08:37:54 +01:00
d0af367395 Use integers instead of booleans 2014-02-13 01:59:08 +01:00
4523b15991 do not send chunk updates on chunk generation 2014-02-13 01:53:30 +01:00
bd73cced6e Do not send block changes during chunk generation 2014-02-13 01:47:18 +01:00
e4c8142681 Removed var_dump() 2014-02-13 01:41:40 +01:00
c9a2a0ea50 Updated API version 2014-02-13 01:34:42 +01:00
268e8c1164 Force PMF save on PMF Level upgrade 2014-02-13 01:34:41 +01:00
e83e424671 Removed entity limits 2014-02-13 01:34:39 +01:00
3e68972253 fix an include 2014-02-13 01:34:37 +01:00
7f86746cbe woo :D 2014-02-13 01:34:36 +01:00
1ab90b1409 PMFLevel upgrade tested 2014-02-13 01:34:35 +01:00
b7ed2f765c Added PMFLevel upgrade 2014-02-13 01:34:33 +01:00
f7b8ad0e37 Infinite generation, in-place chunk creation working. New PMF Format 2014-02-13 01:34:32 +01:00
8377416f48 Nice generation :D 2014-02-13 01:34:30 +01:00
f91e2a5cfe Better parameters ^^ 2014-02-13 01:34:29 +01:00
2d88739005 normalize 2014-02-13 01:34:27 +01:00
4e820ab89f Use single Perlin noise 2014-02-13 01:34:26 +01:00
1bc54dbc44 Such noise 2014-02-13 01:34:24 +01:00
26772082da Random generator with signed int/float methods 2014-02-13 01:34:23 +01:00
3cbcb4871a Changed a few packet things 2014-02-13 01:14:14 +01:00
ac50577255 Typo and fixed a filename 2014-02-12 19:28:33 +01:00
aff2b9882a Merge pull request #1214 from nno88551/patch-2
fixed disconnected message
2014-02-12 11:14:29 +01:00
4352fce82d fixed disconnected message 2014-02-12 19:12:07 +09:00
df865d3456 Entity changes 2014-02-11 20:50:09 +01:00
b392a357e9 More classes 2014-02-11 20:49:38 +01:00
aab0cfb0d8 Added AxisAlignedBB bounding box for entities 2014-02-11 19:37:04 +01:00
a373a581c5 Better fix for #1201 (case-insensitive) 2014-02-11 16:57:45 +01:00
fccca5827f Moar 2014-02-11 16:20:51 +01:00
1206cbf993 Basic Entity structure 2014-02-11 13:31:48 +01:00
89a0e84404 Fixed handlerPriority order 2014-02-11 12:47:28 +01:00
755cafa600 Alpha_1.4dev 2014-02-11 12:47:18 +01:00
c09bc259fc Added #1142 OP players can bypass the player limit 2014-02-11 10:27:53 +01:00
8b23568fe7 Changed codename to new scheme. Alpha_1.3.12 ready \o/ 2014-02-11 02:31:41 +01:00
ad3bf0998f Halt NBT parsing if end of data is found 2014-02-11 01:41:04 +01:00
9cd5c1581b oops x4 2014-02-10 21:38:32 +01:00
94f2da1e38 Oops x3 2014-02-10 20:52:10 +01:00
b635a54b13 Oops x2 2014-02-10 20:47:21 +01:00
5057a3965e Ooops, ;) 2014-02-10 20:46:47 +01:00
5bdb61117f Merge pull request #1188 from PocketMine/Faster-Network
Merge Faster-Network into master. Added new Networking system, new Event system
2014-02-10 19:07:12 +01:00
0bf74d4139 Two packet event types ;) 2014-02-10 18:46:58 +01:00
a2ec9d6688 Moved a file 2014-02-10 18:10:51 +01:00
4b14d5d900 Final structure with example events 2014-02-10 18:08:25 +01:00
a4cbb2f938 Added PluginEvent 2014-02-10 17:33:12 +01:00
9ab993c817 Basic event system written 2014-02-10 17:23:35 +01:00
830530d868 Basic Event types (extended from Bukkit) 2014-02-10 16:09:32 +01:00
7c12f6ce8a Implemented QueryPacket and QueryHandler 2014-02-10 15:05:12 +01:00
b9aa3a0e70 Removed old code for property migration 2014-02-10 13:29:21 +01:00
d925640f03 Moved max-chunks-per-second to server.properties, increased to 8 2014-02-10 13:28:54 +01:00
7e174eac5a Decreased SO_SNDBUF 2014-02-10 13:26:09 +01:00
d5ff5d0066 Merge branches 'Faster-Network' and 'master' of https://github.com/PocketMine/PocketMine-MP 2014-02-10 19:20:37 +10:30
8de39db59d Updated chunk packet field names 2014-02-09 14:39:17 +01:00
f1245a551e Increased UDP buffer size 2014-02-09 13:30:06 +01:00
11c9972eb9 Fixed RotateHeadPacket not having pitch 2014-02-09 05:53:16 +01:00
8739017002 Check if the specified length is correct 2014-02-09 05:37:40 +01:00
5c1550e116 Set max movement distance, disallows teleport cheat 2014-02-09 05:30:15 +01:00
072d0589d2 Fixed undefined $data on RotateHeadPacket 2014-02-09 05:08:32 +01:00
7ebaf7e552 Added Android, BSD detection to Utils::getOS() 2014-02-09 04:44:45 +01:00
0e1c099906 Added iOS detection to Utils::getOS() 2014-02-09 03:20:09 +01:00
c2d4dd093a Updated repo name on installer 2014-02-09 03:19:39 +01:00
6046b263dd Possible fix #1189 2014-02-08 23:44:58 +01:00
dfa28d9a9e WTF null packets crash the server?? 2014-02-08 23:29:42 +01:00
7f0693e7e7 Updated packet handling to eliminate loops 2014-02-08 23:01:22 +01:00
3fed63b248 Split packet handling verified 2014-02-08 22:49:13 +01:00
a8b26a3caf Halt parsing when invalid packets are found 2014-02-08 21:16:51 +01:00
296c6904b9 Hide leave messages from non-spawned players 2014-02-08 20:54:50 +01:00
dfd5733969 Handle unknown packets more gracefully 2014-02-08 19:21:45 +01:00
0ff647015c Handle all kind of unknown data packets 2014-02-08 19:17:49 +01:00
f255948eb6 Updated Query to new packet format 2014-02-08 17:56:48 +01:00
d8aea544f3 Fixed DoorBlock crashing the server 2014-02-08 16:55:20 +01:00
1c7539b51a Fixed data packets being sent on player disconnect 2014-02-08 14:52:06 +01:00
1f8e25710d Fixed set up wizard not updating the memory 2014-02-08 14:46:08 +01:00
b107191fdb Renamed ExplosionPacket to ExplodePacket 2014-02-08 13:39:41 +01:00
f77d5dcefd Fixed UseItemPacket 2014-02-08 13:34:05 +01:00
2c3ab612f2 Fixed AddEntityPacket 2014-02-08 13:02:10 +01:00
b8ff5716c7 Packets are cloned on broadcast 2014-02-08 11:47:52 +01:00
8b87733082 Faster-Network now usable! 2014-02-08 01:30:08 +01:00
1f5ff78f06 Fixed a few wrong fields 2014-02-08 01:25:03 +01:00
f6ecf51516 Added RakNetDataPacket::reset() to all the packets 2014-02-08 00:48:00 +01:00
580ef46513 Added packet pid to buffer by default 2014-02-08 00:36:30 +01:00
c40b00288b Merge remote-tracking branch 'origin/master' into Faster-Network 2014-02-08 00:31:14 +01:00
28a753ba60 Fixed split packet sending 2014-02-08 00:29:20 +01:00
5dd7727548 Reverted 8e37627bc0 2014-02-08 00:05:36 +01:00
61953b5507 Fixed online functions on Android - do not use DNS 2014-02-07 22:56:15 +01:00
d4791ceb6c removed time warning 2014-02-07 20:53:29 +01:00
bcee4e7c21 bypass a few errors on installer.sh 2014-02-07 19:23:16 +01:00
af6174508d MacOS fix 2014-02-07 19:15:00 +01:00
d8e34e9ac5 Added iOS support 2014-02-07 18:46:50 +01:00
951ac08703 Updated installer.sh 2014-02-07 18:13:19 +01:00
2562d8fc41 Fixed position error 2014-02-07 18:06:50 +01:00
ac3472eff4 Fixed spawning problems because of packets 2014-02-07 18:03:11 +01:00
84638098d0 Entity spawn packets 2014-02-07 17:24:50 +01:00
083bfcc83c More classes updated 2014-02-07 17:07:57 +01:00
95bff304e4 Changed all Player packets to new network 2014-02-07 16:44:10 +01:00
20f2ef0e82 Updated PHP binaries on the installer 2014-02-07 11:45:12 +01:00
1728656836 PHP 5.5.9 2014-02-07 11:21:31 +01:00
eb375be550 PocketMinecraftServer client join protocol 2014-02-07 01:06:49 +01:00
dbbfbdffaa RakNet data packet codec 2014-02-07 00:56:40 +01:00
c048564981 Server listing working 2014-02-07 00:46:04 +01:00
45a3b54d32 Fixed basic stuff around 2014-02-07 00:16:39 +01:00
0af197a0f7 New packet writing done 2014-02-06 23:30:09 +01:00
415c9f16f4 wow. much packet. many code. such classes 2014-02-06 22:49:13 +01:00
82a486169f Merge remote-tracking branch 'origin/master' into Faster-Network 2014-02-06 15:22:08 +01:00
14a7e0a201 Call Plugin::__destruct() on PluginAPI::__destruct() 2014-02-06 15:21:12 +01:00
84cdc3bde1 RakNetInfo 2014-02-06 15:19:15 +01:00
5700235f80 Merge remote-tracking branch 'origin/master' into Faster-Network 2014-02-06 14:48:00 +01:00
85438aff0d Added verbose error level names 2014-02-06 14:14:08 +01:00
a5efe15030 Fixed #1173 #486 #466 #483 ignore E_NOTICE unpack() errors 2014-02-06 14:13:37 +01:00
55216ae65b Typo 2014-02-06 14:06:08 +01:00
e4b475218b Fixed #1152 get correct timezone from abbr. 2014-02-06 14:02:27 +01:00
bf6e759d97 Added multiple player selection and exact match by default (fixes #1167) 2014-02-06 13:14:10 +01:00
8e37627bc0 Change spawnpoint to setspawn for bukkit compatibility 2014-02-06 21:31:04 +10:30
e2a77b05b7 Remove redundant closing tag 2014-02-06 21:20:29 +10:30
1694e8622d Updated installer languages 2014-02-06 11:45:31 +01:00
112c35c3a1 Fixed #1171 2014-02-05 18:50:04 +01:00
1b5dc2db4d Reset cache timer when used 2014-02-05 17:29:11 +01:00
61ecf3418e fix installer :s 2014-02-05 12:10:32 +01:00
838147c4eb Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-02-05 12:08:46 +01:00
3ac90dec47 New Raspbian build, fixes #1168 #1165 2014-02-05 12:07:03 +01:00
5030dc0bd1 Updated cURL 2014-02-05 11:57:27 +01:00
c80a64650b Merge pull request #1172 from pemapmodder/master
Added BOOK id
2014-02-05 11:11:39 +01:00
77ab494b70 BOOK ID missing? 2014-02-05 16:42:15 +08:00
5762d70414 Updayed ARMv7 Android flags 2014-02-04 14:08:54 +01:00
96d579e90f why is this so hard! 2014-02-04 14:04:07 +01:00
1ac14dba29 new -mtune 2014-02-04 14:01:42 +01:00
fc6515c37f -mtune=none 2014-02-04 12:58:09 +01:00
8bc60ca36f Removed -mtune 2014-02-04 12:56:23 +01:00
28af0e9f87 Updated compile.sh Android parameters 2014-02-04 12:40:16 +01:00
3bf812b3b3 Updated march for Android 2014-02-04 10:11:27 +01:00
0aeed7f458 Updated ARM toolchain to arm-unknown-linux-uclibcgnueabi 2014-02-04 07:50:28 +01:00
6325a2298e Fixed #1161 PluginAPI::readYAML() and PluginAPI::writeYAML() 2014-02-03 19:13:39 +01:00
34378b5776 Show player name on bad username kick 2014-02-03 01:10:30 +01:00
5cd2362c13 Added libtool 2014-02-02 19:12:51 +01:00
24ac7aa931 Added --target=arm-apple-darwin10 2014-02-02 19:09:03 +01:00
e39dad15e5 Added iOS sdk path 2014-02-02 19:06:35 +01:00
a1996063b6 llvm-? 2014-02-02 19:03:33 +01:00
11593ac96c Added experimental iOS cross-compile support 2014-02-02 19:02:29 +01:00
f9adbf33ec Fixed undefined chunk on PMFLevel::getMiniCHunk() 2014-02-02 12:05:35 +01:00
8bbc0af9b5 Fixed #1150 invalid Entity positions on startup 2014-02-02 02:30:21 +01:00
d299e39649 Fixed invalid array when a player has been kicked 2014-02-02 02:27:59 +01:00
5f3829692d Fixed unknown and impossible crash 2014-02-01 16:26:40 +01:00
dbde770fce Fixed typo o.O 2014-02-01 16:19:56 +01:00
cf1c2b3633 nope 2014-02-01 13:19:42 +01:00
df41f04d0f arm-none-linux-uclibceabi, maybe? 2014-02-01 12:53:59 +01:00
4ae7ccff9f Try with arm-none-linux-uclibcgnueabi 2014-02-01 12:50:41 +01:00
17d565e950 Added --enable-static-link for Android 2014-02-01 12:42:18 +01:00
ca99d60f53 Static uclibc linking 2014-02-01 12:32:12 +01:00
b867be9c9d Save install_data on jenkins 2014-02-01 12:15:22 +01:00
60a43df5c7 Removed gcc -pipe on normal build 2014-02-01 12:12:42 +01:00
fbbb114fc6 Removed gcc -pipe on test 2014-02-01 12:11:26 +01:00
e2b9e3d665 Fixed ARMv7 compilation 2014-02-01 11:28:10 +01:00
25d5ea367d Updated installer binaries 2014-02-01 11:27:56 +01:00
0329735712 Added $HAVE_MYSQLI 2014-02-01 01:27:59 +01:00
a9d0716bde Added $CONFIGURE_FLAGS to YAML compilation 2014-02-01 01:21:30 +01:00
6ba6aa5b61 Fixed jenkins script on places where cURL is not installed 2014-02-01 01:11:47 +01:00
9cc624b74e Force Entity health change on respawn 2014-02-01 01:06:05 +01:00
e619ebad61 such fix ¬¬ 2014-01-31 23:55:43 +01:00
e69da264dc Added prefix to libtool compilation 2014-01-31 23:53:48 +01:00
33bbbba806 Move libtoolize ¬¬ 2014-01-31 23:50:06 +01:00
666418752f fix 92dcb90804 2014-01-31 23:45:19 +01:00
92dcb90804 Added libtoolize env. variable 2014-01-31 23:42:48 +01:00
80376d3a4d Move libtool to correct location on jenkins Mac 2014-01-31 23:36:26 +01:00
0a10e76ff9 fixed typo 2014-01-31 23:31:42 +01:00
d313f82984 Added export to libtool 2014-01-31 23:30:59 +01:00
ab845c5dab Added libtool compilation on Mac for install.sh 2014-01-31 23:30:23 +01:00
951e9efb5e Updated installer.sh to include OPCache 2014-01-31 23:14:50 +01:00
329788e506 Save artifacts even when the build fails jenkins.sh 2014-01-31 21:15:12 +01:00
74ad2ddcdd Added cURL on Mac OSX Jenkins build 2014-01-31 21:05:13 +01:00
09cf39b9d5 Added quotes to URLs 2014-01-31 21:03:28 +01:00
d00b489e1d Added universal installer.sh 2014-01-31 17:51:48 +01:00
cf554c67f2 Be sure to respawn players correctly 2014-01-31 17:24:03 +01:00
331904691d Added cURL shared extension to php.ini 2014-01-31 16:21:07 +01:00
dd7c2c850b Updated jenkins.sh to include all binary files generated 2014-01-31 16:09:52 +01:00
263c580fe1 Removed curl from jenkins.sh for Mac 2014-01-31 16:00:36 +01:00
b9ee3fb185 Updated curl path 2014-01-31 16:00:09 +01:00
5e079b740c Modified cURL building 2014-01-31 15:55:16 +01:00
74d4b95a70 Changed jenkins.sh 2014-01-31 14:31:55 +01:00
ee3b1dc11a Added jenkins.sh 2014-01-31 13:55:06 +01:00
126f149f0b Increased hearts restored by Apples 2014-01-31 13:33:49 +01:00
e12290202b Fixed #1135 Entity despawn race condition 2014-01-31 13:30:30 +01:00
974862996b replaced download_file 2014-01-31 13:26:04 +01:00
bcd312ea16 Removed OPCache when cross-compiling 2014-01-31 01:50:59 +01:00
5ff34b22b5 Include OPCache and generate default php.ini 2014-01-31 01:43:57 +01:00
8a9dcbb646 Calculate time offset only if date.timezone is not set 2014-01-31 01:19:51 +01:00
b7c0e08b7d such debug. much fix 2014-01-31 00:45:16 +01:00
13bf17925f compile.sh now supports cURL client 2014-01-31 00:43:47 +01:00
b56a56df2b Merge remote-tracking branch 'origin/master' into Faster-Network 2014-01-30 10:10:20 +01:00
7403516aab Added extra machine data to Utils::getUniqueID() 2014-01-30 01:13:58 +01:00
7560a5416e Replaced printf with echo 2014-01-30 00:42:10 +01:00
eca8fbce30 Fixed undefined index on Slab 2014-01-30 00:42:01 +01:00
f7af625407 Well... printf "\n" | 2014-01-30 00:39:32 +01:00
e15509c352 Removed Spyc 2014-01-30 00:36:51 +01:00
b481c94f45 Added new PHP YAML extension 2014-01-30 00:36:44 +01:00
d8f4e88e5d Fixed Entities not being despawned on restart if they were off-limits 2014-01-29 23:53:58 +01:00
60bc72c6cb Fixed undefined indexes on cases where plugins did things wrong 2014-01-29 20:41:57 +01:00
cd52cb9ae6 Added exec to start.sh 2014-01-29 20:02:16 +01:00
eeeb6d42c2 Added --with-mysqli=mysqlnd to compile script 2014-01-29 19:43:26 +01:00
e799376559 such fail :S 2014-01-29 19:11:47 +01:00
e7aea41f80 More changes ;). Start.sh now supports the new compile path 2014-01-29 19:07:43 +01:00
55f4811847 Oops ;) 2014-01-29 18:56:21 +01:00
ac2abccf41 Compile all PHP binaries 2014-01-29 18:43:13 +01:00
09720a59ec Added Utils::getUniqueID(), returns a machine ID and a even more variable machine ID 2014-01-29 17:07:01 +01:00
7e8ae3a1e1 Main source for ticks is in the packet loop, and PHP ticks as a secondary backup one 2014-01-29 16:22:58 +01:00
73db6cbb96 Removed BitDeli 2014-01-29 12:43:59 +01:00
f2703f5cfb Move BitDeli Badge. 2014-01-29 20:49:53 +10:30
0703145155 Merge pull request #1129 from bitdeli-chef/master
Add a Bitdeli Badge to README
2014-01-29 02:18:42 -08:00
aadef6e2d3 Add a Bitdeli badge to README 2014-01-29 10:20:50 +00:00
edd2331b40 Added GCC -pipe and changed optimization to -O2 2014-01-29 03:27:31 +01:00
079db8d234 Added option to skip save in ServerAPI::serProperty() 2014-01-29 02:36:21 +01:00
c88b1c97b3 Added advanced caching (enable-advanced-cache) 2014-01-29 02:24:02 +01:00
b4971abe91 Added base Cache class for integrated caching 2014-01-29 02:23:27 +01:00
a297574656 Level::unloadChunk() now uses the saveEnabled property 2014-01-28 21:46:29 +01:00
4bcea9b3e5 ¬¬ world 2014-01-28 12:57:46 +01:00
0a27783604 Fixed offset calculation 2014-01-28 12:50:53 +01:00
9a4bae7d64 Improved crash dumps 2014-01-28 12:50:42 +01:00
f8b270e33f such fix. I even made a regular expression to find these 2014-01-28 12:50:24 +01:00
1526c6cae9 Fixed "Take this ridiculously retarded IF formatting!" by @sekjun9878 2014-01-28 11:37:29 +01:00
4002d3013d More OCD 2014-01-28 11:36:18 +01:00
763adb0360 OCD. Blame @sekjun9878 for making me shout in the train 2014-01-28 11:27:55 +01:00
439c0e8280 Removed obsolete Java Random 2014-01-28 11:25:12 +01:00
4aa7b3eaf8 Allow custom arch. build on compiler 2014-01-27 19:28:29 +01:00
cdefcbd72a Fixed #823 /help outputs ansi colors 2014-01-27 18:19:45 +01:00
101402fe56 Fixed #854 return not-safe spawn when safe spawn is not available 2014-01-27 18:16:28 +01:00
c52f6c9376 Fix #1117 fix 2014-01-27 17:46:41 +01:00
76e4bf6d5f Fixed #1117 enforce new pthreads version 2014-01-27 17:41:42 +01:00
431c06073d Updated Travis-CI to PHP 5.5.x and pthreads to 0.1.0 2014-01-27 15:22:12 +01:00
ac8f2646a7 pthreads 0.1.0 and Thread::kill(). Needs fix 2014-01-27 15:18:20 +01:00
b7cf5d08cc Save and send hotbar history 2014-01-27 14:00:53 +01:00
624eb93058 Save and send last slot used by player 2014-01-27 04:00:26 +01:00
01015d0db3 Fixed #1114 Furnace item duplication cheat 2014-01-27 01:13:59 +01:00
f95e8a2c51 Merge pull request #1109 from pemapmodder/master
Include level in $data for event item.drop
2014-01-26 15:36:24 -08:00
d94239771e Merge pull request #1112 from JWhy/patch-2
/op command: Show usage info if no user specified
2014-01-26 11:27:11 -08:00
49e5d930f1 Level included in data for event item.drop 2014-01-26 20:44:26 +08:00
1b227153a9 /op command: Show usage info if no user specified 2014-01-26 13:21:51 +01:00
ec70dd476a Updated Korean, Dutch and Chinese set-up wizard translations 2014-01-25 01:15:56 +01:00
f432f110a4 Fixed invalid Position object on teleport 2014-01-23 19:02:09 +01:00
9f4b5a40e1 Merge remote-tracking branch 'origin/master' into Faster-Network 2014-01-22 23:13:43 +01:00
4ae1709196 Fixed #1100 Item multiplication cheat 2014-01-22 22:11:54 +01:00
edfcdd0c17 Fixed #1031 Correct face when block is replaced 2014-01-22 17:31:23 +01:00
dcd9dbd1dd Fixed #1032 undefined index on PrimedTNT entities 2014-01-22 17:29:23 +01:00
f4d96e3a9b Temp. fix for Ladders popping out 2014-01-22 13:09:27 +01:00
cfb3bbfbf2 Fixed #1058 2014-01-22 01:36:30 +01:00
e659f435df Merge pull request #1099 from repeat83/patch-1
Fixed invalid indexes for Tile Entities
2014-01-21 12:28:55 -08:00
c7d33ee267 hmmm it's feature? 2014-01-21 23:04:02 +03:00
bede216762 Added Chinese to the language list 2014-01-19 01:07:57 +01:00
c13cc7c91d Added Chinese, updated Korean, Russian 2014-01-18 20:48:04 +01:00
0977daa3b4 Fixes #519 #861 #940 #505 #590 #761 #129 compilation on 64-bit systems 2014-01-18 12:44:17 +01:00
218fb5df3e Trying to fix issue #519 2014-01-18 12:23:45 +01:00
c9ab5ee0e9 API version is now 12 2014-01-17 22:31:22 +01:00
cc57475f91 Added player.block.place.bypass and player.block.break.bypass 2014-01-16 23:09:56 +01:00
6cf8698826 Updated German 2014-01-16 22:33:50 +01:00
718c858632 Added French, updated Korean and German 2014-01-16 16:27:04 +01:00
7a2d90c6d0 Updated German, Korean and Japanese 2014-01-16 12:52:10 +01:00
ee7d2f4ebf Updated Japanese 2014-01-16 00:33:39 +01:00
b5406af32e Updated Russian 2014-01-15 23:30:19 +01:00
0949734d38 Updated Russian and Italian 2014-01-15 22:36:24 +01:00
a3d62056d8 Fixed extra \n 2014-01-15 20:53:10 +01:00
40bdfd33ac Added Japanese, Italian 2014-01-15 20:51:38 +01:00
c0b247dd72 Update nl_NL.ini
Dutch translation fixed
2014-01-15 20:26:34 +01:00
f7ac3f5e8a Updated German 2014-01-15 20:10:57 +01:00
36c416fada Use DejaVu Sans Mono for the MinTTY console 2014-01-15 19:57:46 +01:00
81d938cc53 Removed wizard from Travis 2014-01-15 18:09:09 +01:00
609544b1ec Removed debug instruction 2014-01-15 18:07:55 +01:00
e2c678c8a6 Added set-up Wizard 2014-01-15 18:07:35 +01:00
5fe8141ba0 Alpha_1.3.12 "Henteko Minecart" Development 2014-01-15 18:07:23 +01:00
6a7b03e1bf Updated PHP and cURL 2014-01-13 04:35:36 +01:00
8c648fc6f7 PocketMine-MP Alpha_1.3.11 「甘いビートルート」 Added CODENAME 2014-01-13 04:16:38 +01:00
6c5356fc80 Merge branch 'master' of github.com:PocketMine/PocketMine-MP 2014-01-13 03:35:56 +01:00
70445bdeba Added timeout to Utils::getOnline(), fixes #1071 [gh#1071] 2014-01-13 03:34:40 +01:00
65767312a3 Merge pull request #1064 from wrewolf/patch-2
Update Lava.php
2014-01-12 18:28:54 -08:00
2551bd64ca Merge pull request #1063 from wrewolf/patch-1
Update Water.php
2014-01-12 18:28:43 -08:00
1f360c8bfb Update Lava.php 2014-01-12 12:05:17 +03:00
65a7560185 Update Lava.php
Fix Remove for Left Lavas
2014-01-10 09:45:21 +03:00
860f723518 Update Water.php
Fix Remove for Left Waters
2014-01-10 09:43:31 +03:00
969f0f05b0 Fix #1037 2014-01-04 11:59:07 +09:00
1ce7366cc3 Merge pull request #1025 from InusualZ/patch-1
Level::getAll()
2014-01-03 18:52:44 -08:00
3ed2155c5b Merge pull request #1030 from wallace/patch-1
Update compile.sh
2013-12-27 20:44:43 -08:00
1cc12616e8 Update compile.sh
Properly escape nested double quotes.
2013-12-25 21:46:04 -05:00
e3d3f91c54 Level::getAll() 2013-12-23 20:15:53 -05:00
039edead18 Merge remote-tracking branch 'origin/master' 2013-12-19 18:42:58 +10:30
a141ea5018 Config Object PHPDoc 2013-12-19 18:42:45 +10:30
b63e49acf8 Fixed slot AIR offset 2013-12-18 18:01:06 +01:00
5dc52ad97d Add PHPDoc Documentation to block types. 2013-12-18 20:05:04 +10:30
5eed43ddd0 Added Level::startTime() and Level::stopTime() 2013-12-18 09:45:00 +01:00
9137a36b55 MCPE 0.8.1 version change 2013-12-18 09:44:42 +01:00
5623fa3601 Even more grammar! 2013-12-17 15:45:56 -06:00
78d72201ce (ノಠ益ಠ)ノ彡┻━┻ 2013-12-17 22:30:45 +01:00
a0019bfa73 redeclare fix ;) 2013-12-17 12:03:01 +01:00
de5a3175bc Data Packet initial parsing 2013-12-17 12:00:26 +01:00
e6aeb03ec5 Merge remote-tracking branch 'origin/master' into Faster-Network 2013-12-17 11:01:12 +01:00
d4057a2113 Fixed #997 carrots converting to potatoes [gh#997] 2013-12-17 10:34:24 +01:00
1eab1e382a Merge pull request #1007 from InusualZ/fix
Fixed Event "entity.explosion"
2013-12-16 18:40:04 -08:00
351ac0d7af Fixed Event "entity.explosion"
The event don't listen to the handler
2013-12-16 19:42:35 -05:00
b457e63d20 Reverted Item despawn timer 2013-12-16 17:12:25 +01:00
3ef2471041 More Changes 2013-12-16 15:49:28 +01:00
7bc9500484 Increased error level 2013-12-16 13:06:33 +01:00
6d4472a339 Added Source SHA1 sum 2013-12-16 13:06:31 +01:00
e0b8527560 First changes 2013-12-16 13:06:01 +01:00
050d3424f0 Fix #999. 2013-12-14 16:14:41 +10:30
01e9ca7852 Fix #971. Add lowercase checking of Config. 2013-12-14 16:06:28 +10:30
e2298d861c Fix #996 2013-12-14 15:27:38 +10:30
3248066a37 Increased error level 2013-12-13 15:52:17 +01:00
a0b93ed5ff Added Source SHA1 sum 2013-12-13 15:52:08 +01:00
a8f2225c4c PHP 5.5.7 2013-12-13 13:10:19 +01:00
1a7e916928 Fixed player heads not being rotated 2013-12-13 01:17:55 +01:00
2b0fdd5062 Time syncronized again 2013-12-13 00:52:55 +01:00
af8b380d10 Added Cobweb to Creative Inventory 2013-12-13 00:34:37 +01:00
90e598bb2c Added minecart item (not placeable) 2013-12-13 00:33:07 +01:00
4d0eb5e529 Fixed #988 2013-12-09 21:55:49 +01:00
02dc06c58b Fixed plugin path 2013-12-09 21:50:58 +01:00
c23fc0057a PHP plugins are now included using include() 2013-12-08 17:17:47 +01:00
1693f5655e Updeted to protocol 14 MCPE v0.8.0 build 8 2013-12-08 13:25:21 +01:00
565fe70c7e v0.8.0 alpha version 2013-12-07 13:50:14 +01:00
7cf662fb81 Only show private messages in console when the sender or the target is the console 2013-12-07 12:44:23 +01:00
894325aef6 ¬¬ 2013-12-06 01:50:48 +01:00
423ead6b64 Added item pickup animation 2013-12-06 01:49:47 +01:00
a0a7042d43 Look! New PluginAPI! 2013-12-06 01:24:41 +01:00
14e1dda327 Removed KiwiIRC chat, use official freenode webirc 2013-12-04 18:19:39 +01:00
3cffa66490 added Entity::setHealth() force 2013-12-03 22:25:25 +01:00
2b28e26392 Fixed map chunks bug 2013-12-03 20:39:28 +01:00
8543c06db4 Merge pull request #975 from wiezz/master
Allow chat plugins to work with eachother
2013-12-03 10:04:43 -08:00
adcf95f486 Fix
Send the normal message when $data["message"] is removed by a plugin.
2013-12-03 18:33:37 +01:00
736c233e76 Allow chat plugins to work with eachother 2013-12-03 18:26:38 +01:00
fd2eb7b230 OOPS! 2013-12-03 02:10:43 +01:00
bad8365e28 Fixed zero-length packets spamming the console 2013-12-03 02:07:33 +01:00
e9e59c33cc Fixed 969 2013-12-02 17:45:01 +01:00
8532f53f8e Schedule player kick so it can read the reason 2013-12-02 01:00:11 +01:00
230a3c00fc Removed LevelAPI::isLoaded()
Not needed, everything can be obtained with current methods
2013-12-01 22:01:04 +01:00
d515da8963 Fixed Level::setMiniChunk() parameter bug 2013-12-01 21:37:33 +01:00
f5d69e6905 Fixed Level::getMiniChunk() parameter bug 2013-12-01 21:32:35 +01:00
bcf6571cc2 Delete PermissionsAPI. 2013-12-01 23:52:31 +10:30
7d0ff5e073 Formatting OCD
Please refer to CONTRIBUTING.md
2013-12-01 14:16:38 +01:00
5e2de356bf Modified update system to check the Github API 2013-12-01 14:14:37 +01:00
2d67af6fbd Sugarcane now grows when using bonemeal 2013-12-01 14:14:36 +01:00
bd8110edab MCPE v0.8.0 alpha build 5 2013-12-01 14:14:35 +01:00
25cd58bd99 Merge remote-tracking branch 'origin/master' 2013-11-30 13:10:27 +10:30
a6cd8ece1b Added isLoaded function to LevelAPI. Fixes #959. 2013-11-30 13:10:02 +10:30
0bac7418db Updated StackableArray 2013-11-29 00:18:38 +01:00
a4e38689db Added REDSTONE constant 2013-11-27 23:19:48 +01:00
f3f61e7a4a Cobblestone Walls height handling 2013-11-27 17:41:39 +01:00
bc48e70d6c Remove fire effects on Creative mode 2013-11-27 17:24:33 +01:00
b21ee37c07 MCPE v0.8.0 alpha build 4 2013-11-27 17:22:41 +01:00
2f7e5688e2 Fixed #418 Placing blocks on top of Snow replaces it now 2013-11-27 15:28:10 +01:00
0d6ae6067c Fixed #956 BEETROOT_BLOCK typo 2013-11-27 12:10:26 +01:00
3337e5980e Added ZIP to compile script 2013-11-27 00:18:13 +01:00
493b7532df Removed debug code 2013-11-26 17:28:48 +01:00
bd0d708274 Fixed Packet of Death 2013-11-26 17:23:45 +01:00
5ad72b4f49 Return a bowl when eating stew or soup 2013-11-26 15:29:34 +01:00
7b9edffa47 Mushroom Stew and Beetroot Soup are no longer stackable 2013-11-26 15:23:39 +01:00
6e9b70c9cb Better Tall Grass generation with bonemeal 2013-11-26 13:32:19 +01:00
0f01570d01 "Better" Tall Grass drops 2013-11-26 13:20:19 +01:00
cf5bc916c0 Reordered Creative inventory 2013-11-26 13:15:56 +01:00
35119befd9 Tall Grass now drops Melon and Pumpkin seeds with a probability of 1/15 2013-11-26 12:46:30 +01:00
02150da862 Tall Grass can now drop Carrots, potatoes, beetroot seeds 2013-11-26 12:45:27 +01:00
2044269d86 Added Shears, bedrock and Dyes to creative inventory 2013-11-26 12:42:09 +01:00
2d3ba111e0 Rewrote Generic Explosion drop 2013-11-26 12:28:05 +01:00
98097b0703 Check for $newPermissions is_array 2013-11-26 21:38:48 +10:30
c4ba06b58c Add Restriction Interface 2013-11-26 21:32:08 +10:30
3e12a41a91 permissions.request function use instead of additional argument for player variable. 2013-11-26 21:20:44 +10:30
daaa9394c4 PermissionsAPI Basic Structure Complete. Now uses restrictions. Player dedicated emitEvent functions. Use more anonymous functions. 2013-11-26 21:17:44 +10:30
71a1986980 Add EventRestriction 2013-11-26 20:00:15 +10:30
3352c36ba4 Merge branch 'master' of https://github.com/PocketMine/PocketMine-MP 2013-11-26 15:15:30 +10:30
d2fa06cb64 More comments. 2013-11-26 15:15:24 +10:30
0e9458fafc Merge pull request #950 from InusualZ/test
Fixed #332. Temporary Silk Touch fix. Replace this system with class-based silk touch variable.
2013-11-25 20:32:58 -08:00
75e4174a2b Repaired 2013-11-25 19:31:40 -05:00
509e67bfb7 No More Silk Touch On Explosion 2013-11-25 19:28:59 -05:00
0d25118eef Fixed gh#332
Crafting with buckets (milk) returns the bucket
2013-11-25 18:53:36 -05:00
c798a33363 Fixed gh#332
Crafting with buckets (milk) returns the bucket
2013-11-25 18:53:02 -05:00
5fc192b730 Fixed gh#332
Crafting with buckets (milk) returns the bucket
2013-11-25 18:27:34 -05:00
286b30cf4e Giant typo 2013-11-25 18:36:03 +01:00
a0fac71385 Added coding standards by request of @sekjun9878. Fixed #949 [gh#949] 2013-11-25 18:34:06 +01:00
273a74d566 Added Beetroot Soup food value 2013-11-25 18:01:19 +01:00
aefcab9a49 Really minor changes. 2013-11-25 22:37:30 +10:30
f5989d461c Fix possible variable bug with /tell. 2013-11-25 22:06:25 +10:30
68076fedc8 Some PHPDoc comment updates. 2013-11-25 22:05:07 +10:30
2339525478 Merge remote-tracking branch 'origin/master' 2013-11-25 20:34:57 +10:30
62f5f0d325 Add PHPDoc information to sub-APIs. 2013-11-25 20:34:48 +10:30
0ac81968b7 OCD 2013-11-25 11:02:33 +01:00
b8763a7a3f Add PHPDoc information for API parsing. 2013-11-25 20:28:19 +10:30
249e83db91 Merge branch 'master' of https://github.com/PocketMine/PocketMine-MP 2013-11-25 20:11:57 +10:30
e6f855abbd Add Default permission, and remove construct restriction in Permission interface. Note that all changes on permission API are untested therefore not enabled by default. 2013-11-25 20:11:38 +10:30
75e1a6e97e Added bowl crafting 2013-11-25 09:52:28 +01:00
fb9f7891c7 Added Beetroot soup, beetroot seeds, crafting 2013-11-25 09:42:41 +01:00
03e71ee3ff Added comment in Player.php 2013-11-25 09:35:54 +01:00
9cf91ca3fa Added beetroot IDs
TODO: Beetroot Soup ID
2013-11-25 09:34:57 +01:00
fc7c14ae16 BeetRoot soup doesn't need a class 2013-11-25 09:34:36 +01:00
5ac0907aeb Added $permissions property to Player so pthreads doesn't crash 2013-11-25 09:31:02 +01:00
2f3817322b Formatting OCD 2013-11-25 09:28:41 +01:00
624219f680 Merge remote-tracking branch 'origin/master' 2013-11-25 18:57:33 +10:30
646390812a Beetroot Soup Item template. @shoghicp Add in the Item ID to ItemID.php constants file. 2013-11-25 18:57:13 +10:30
7190d444e3 Revert "Remove Achievement API. Alters game play mechanics."
This reverts commit 2621aab2ef.
2013-11-25 09:26:12 +01:00
bfe0d04663 More notes in Contributions.md 2013-11-25 09:25:48 +01:00
44d63c74dd Update some comments on the recipes. 2013-11-25 18:50:01 +10:30
d7d5e66de6 Use interfaces and closures and abstracts and anonymous functions and all the fancy OOP PHP stuff. 2013-11-25 18:33:12 +10:30
eb7d8a3240 Minor Adjustments 2013-11-25 18:05:21 +10:30
698feccd54 Minor Adjustments. 2013-11-25 18:04:47 +10:30
d3e8cba132 Basic PermissionsAPI template for others to improve. 2013-11-25 18:02:31 +10:30
2621aab2ef Remove Achievement API. Alters game play mechanics. 2013-11-25 17:39:19 +10:30
6ab29f993d OCD 2013-11-24 23:29:17 +01:00
d11cf83a47 Added note about pull requests 2013-11-24 23:26:12 +01:00
336a40ae90 Merge pull request #947 from 99leonchang/master
Multiple orders for /gamemode
2013-11-24 14:20:04 -08:00
a8055eb59a Warn about not using the bin/ PHP binary 2013-11-24 20:09:04 +01:00
2b920033ff Drop boots on death 2013-11-24 19:23:56 +01:00
8665035381 Added Cocoa Beans crafting 2013-11-24 19:01:24 +01:00
e0021b8927 Fixed first hotbar item in Creative 2013-11-24 18:43:14 +01:00
44a9639150 Fixed POTATOE constant 2013-11-24 18:41:57 +01:00
e700179bb0 Multiple changes
* Fixed hoe durability
* Fixed some blocks hitbox
* Added Creative pseudo-inventory
* Added Carrots and Carrot Crops
* Added Potatoes, Baked potatoes and Potato Crops
2013-11-24 18:38:37 +01:00
f8d8052ec3 Correct placement for cakes and snow layers 2013-11-24 15:52:35 +01:00
0dc783f285 Added carpets, crafting recipes, placement 2013-11-24 15:50:02 +01:00
7cd5c5cde1 Fixed paintings resetting the hotbar 2013-11-24 15:18:58 +01:00
3968f3b298 Jungle Tree generation placeholder 2013-11-24 15:12:31 +01:00
9105e59f2a Jungle Sapling 2013-11-24 15:12:14 +01:00
5ac92ee0db Formatting 2013-11-24 20:48:03 +08:00
b5a53c04ac Merge pull request #5 from PocketMine/master
Fixed Wheat recipes
2013-11-24 04:40:15 -08:00
a93798719f Fixed Wheat recipes 2013-11-24 13:38:53 +01:00
1eda0d72a8 Different orders for /gamemode 2013-11-24 20:38:40 +08:00
1331c8aeb2 Merge pull request #4 from PocketMine/master
Update
2013-11-24 04:36:13 -08:00
b9e2576208 f 2013-11-24 20:34:58 +08:00
c25607588b Added sideway Hay Bales 2013-11-24 13:32:21 +01:00
ff8363e2ae Added Wooden Slabs, Double Wooden Slabs, new Wooden Slab crafting 2013-11-24 13:22:09 +01:00
64f7a78329 Added achievement.grant and achievement.broadcast handlers for more customization 2013-11-24 12:18:50 +01:00
f377eacc0f Merge pull request #3 from PocketMine/master
Update
2013-11-24 03:11:57 -08:00
8e452831e1 Fixed undefined $orderingChannel 2013-11-24 12:04:40 +01:00
2483614459 Merge pull request #944 from lloydw/master
Fix argument parsing
2013-11-24 02:52:17 -08:00
53fd9cb466 Merge pull request #945 from 99leonchang/master
AchievmentAPI logic change
2013-11-24 02:51:11 -08:00
1c5b473b36 Added player.craft handler 2013-11-24 11:45:18 +01:00
918fb62ce9 Logic changes 2013-11-24 12:42:31 +08:00
1350e1bc4e Merge pull request #2 from PocketMine/master
Update
2013-11-23 20:33:33 -08:00
5d53c259cf Fix argument parsing 2013-11-24 16:27:09 +13:00
5a71043ab0 Fix 2013-11-24 01:52:23 +01:00
6ff6a5fc91 More achievements 2013-11-24 01:10:05 +01:00
6de602a174 Fixed Coal Block ID 2013-11-24 00:52:21 +01:00
3ff4b9eae0 Achievements API 2013-11-24 00:51:04 +01:00
ae8c934b5f Allow accessing Config data keys directly 2013-11-23 19:14:45 +01:00
5803a4e649 Added Coal Blocks, crafting, fuel information 2013-11-23 18:18:02 +01:00
78f7964d57 Fixed bread crafting & added Hay Bales 2013-11-23 18:09:04 +01:00
78f9e40730 Added Compass and Clock 2013-11-23 17:54:19 +01:00
a0ca572d1f Added Cobblestone Walls, Mossy Stone Walls, crafting recipes, correct drops 2013-11-23 17:40:22 +01:00
af66e5a444 iron bars crafting 2013-11-23 17:23:03 +01:00
1ad00a453b Added Iron bars, Pumpkins, lit pumpkins and pumpkin grow, pumpkin growth, pumpkin seeds, pumpkin pie... 2013-11-23 16:36:30 +01:00
5fa6c5962e Added more Wood stairs, and planks 2013-11-23 15:51:09 +01:00
de98dd920b Sponges added 2013-11-23 15:34:32 +01:00
1a0bccf288 Sideway logs placement & correct drop 2013-11-23 15:21:48 +01:00
e4221b8552 Redstone Ore drops Redstone dust 2013-11-23 13:56:47 +01:00
ba7c9503d8 0.8.0 partial compatibility
* Not compatible with Creative mode
2013-11-23 13:52:13 +01:00
3d53b9eb3a Armor drop - tested 2013-11-23 11:06:01 +01:00
f32f379e97 Lava flow code reformatting 2013-11-23 11:04:36 +01:00
809ca802b3 PocketMine-MP Alpha_1.3.10 Stable Release 2013-11-23 11:00:22 +01:00
719df75886 Water flow code reformatting 2013-11-23 10:59:52 +01:00
14a40ac11e Remove keycodes from console input 2013-11-23 10:46:24 +01:00
c973abc36f Added --disable-ansi to disable console colors #887 2013-11-23 10:22:24 +01:00
54d37a432e Check that ServerAPI::request() works, fixes #916 [gh#916] 2013-11-23 10:17:38 +01:00
c7168a6c64 Fixed #926 [gh#926] 2013-11-23 10:11:25 +01:00
079d24055d Updated compile script
* PHP 5.5.6
* pthreads 0.0.45 (stable!)
* cURL 7.33.0
2013-11-22 23:42:48 +01:00
b1748b5393 Removed language include 2013-11-22 15:28:28 +01:00
dafb12c3d3 Merge pull request #1 from PocketMine/master
Merge pull request #930 from beN39sGroup/master
2013-11-22 05:58:19 -08:00
b66f34b308 Merge pull request #930 from beN39sGroup/master 2013-11-22 23:59:50 +10:30
1cb711d32d Temporaily fix multilanguage bug. Waiting on pull request author to remove multi language. 2013-11-22 22:56:02 +10:30
94a9b7b431 Merge pull request #925 from beN39sGroup/master
Liquid Performance
2013-11-22 03:12:16 -08:00
7acdb0dd3f Fix Performance Problem
Welcome, TPS!
2013-11-17 09:39:40 +09:00
fe70fa467d Slower Unflow & Basic for Multi Language
Slower Unflow!
I wanna Multi Language!
2013-11-15 19:14:02 +09:00
d4a5e4e5c4 Merge pull request #920 from beN39sGroup/master
Liquid Flowing. This requires further testing before stable release.
2013-11-12 21:48:02 -08:00
db289f9871 Mixable Lava & Water
I Wanna Make Cobblestone Generator!
2013-11-10 22:11:45 +09:00
b822b314cb Simple Flowable Lava & English Comment
Still A Flowing
2013-11-10 17:59:36 +09:00
77ca6da14c Simple Flowable Water!
Meet the 'Flowing' Water.
2013-11-10 17:19:50 +09:00
9373c93737 Prefix for Kick Flying when Player on Fence 2013-11-10 13:52:41 +09:00
cb47bf82c9 Reset player's armors after death UNTESTED. Fixes #896. 2013-11-09 20:44:09 +10:30
3498c876df Reset player's armors after death 2013-11-09 20:43:06 +10:30
df01e92ab6 Merge pull request #886 from JWhy/patch-1
Extract plugins/ path lookup to pluginsPath() function in PluginAPI
2013-11-09 01:34:54 -08:00
1f1f955eef Add plugin name info to Evaluation Error. 2013-11-09 20:00:24 +10:30
0e471ab38c Fixed leftover reference in pluginsPath() function 2013-10-22 14:53:12 +02:00
9f211bd7fb Extract plugins/ path lookup to pluginsPath() function in PluginAPI 2013-10-22 14:05:11 +02:00
af486917a1 Fixed #884 2013-10-22 21:26:30 +10:30
c197a58a3a Merge pull request #881 from JWhy/patch-1
Use DIRECTORY_SEPERATOR constant for safer cross-platform file access
2013-10-21 04:22:23 -07:00
ca0d682d87 Use DIRECTORY_SEPERATOR constant for safer cross-platform file access 2013-10-21 12:27:48 +02:00
70ec644658 Merge pull request #880 from JWhy/patch-1
Support other local date format for timezone detection to avoid startup errors
2013-10-20 21:55:48 -07:00
a860f16f4a Support other local date format for timezone detection to avoid startup errors
fixes PocketMine/PocketMine-MP#718
2013-10-21 06:12:27 +02:00
9ac72026b9 Fix #831 2013-10-19 11:47:53 +10:30
0ad0071107 Fix crash bug when @all is used in console. 2013-10-19 11:28:43 +10:30
386b2cb0ef Fix 805 2013-10-19 11:20:33 +10:30
58fce0e939 Fix /me @all critical server crash bug. Fix #840. Disabled usage of @all for non-ops. 2013-10-19 11:12:54 +10:30
780f60554d Fix #871 2013-10-19 10:58:49 +10:30
4aa0ae86fb Update config.php 2013-10-18 18:04:45 +10:30
f005b82a70 Fixed typo. Not Longer -> No Longer 2013-10-09 13:09:35 +10:30
c35c004827 Added the ability to shoot arrows
Credit to ljyloo (http://forums.pocketmine.net/index.php?threads/shooting-arrows-in-pm-server.508/#post-4338).
2013-10-08 16:52:37 -05:00
e179de1613 Better :3 2013-10-02 16:57:37 +02:00
3354df0360 More KiwiIRC Buttons 2013-10-03 00:25:38 +09:30
d8cfc06d3a KiwiIRC! 2013-10-03 00:24:48 +09:30
3b0e553e17 Merge pull request #812 from Humerus/patch-2
Made it so deop doesn't op the player.
2013-09-15 13:18:26 -07:00
c53ea830ea Made it so deop doesn't op the player. 2013-09-15 12:00:00 -04:00
0c1afe15fd Added .idea to .gitignore 2013-09-11 11:13:09 +02:00
6a24700f6e Fix compiler again 2013-09-10 22:52:24 +02:00
000dfc8601 Fix 64 bit builds 2013-09-10 22:49:33 +02:00
a011ad8fb6 Reverted DIAMOND_HOE to IRON_HOE 2013-09-10 20:11:31 +02:00
d41c30945b Level optimizations 2013-09-09 10:44:50 +02:00
b3c51c6d2e Faster level generator 2013-09-09 03:32:24 +02:00
4ccaccc126 Fixed Player::setSpawn() 2013-09-08 15:37:28 +02:00
8aef462a68 Fixed #784 Slabs replacing other slabs 2013-09-08 10:45:36 +02:00
c4a5a9c849 Better explosion damage calculation 2013-09-08 01:35:48 +02:00
275e27f7a9 Low level PMF level interface 2013-09-08 01:21:40 +02:00
1abe7626bf Using Vectors for explosions 2013-09-08 00:27:35 +02:00
7c9255e21e Incremented speedMeasure() size 2013-09-07 21:27:05 +02:00
0c6eaa0609 Fixed entity motion condition 2013-09-07 21:19:47 +02:00
1bc3b66afd Player check is done with equal name, not alike 2013-09-07 14:24:17 +02:00
df174d1b8e Tuned power again xD 2013-09-07 13:35:32 +02:00
f56dd60708 Correct item drop related to explosion power 2013-09-07 12:37:04 +02:00
2271d0b6fc Lowered TNT explosion force from 4 to 3 2013-09-07 12:28:18 +02:00
6d2eea8887 Level::getSafeSpawn() on player normal spawn 2013-09-07 12:05:04 +02:00
fb2bcdb722 Level::getSafeSpawn() look for solid block 2013-09-07 12:04:49 +02:00
c8dd85de75 Better fuse calculation 2013-09-07 11:55:14 +02:00
a00375b1a9 Perfect explosions 2013-09-07 11:40:22 +02:00
e7e05d37b3 Moved -mx32 flag 2013-09-07 10:30:08 +02:00
6ac54925ff Added -mx32 flag 2013-09-07 10:26:22 +02:00
555da94612 Moved patch location :P 2013-09-07 10:21:42 +02:00
774debb299 Fixed #781 2013-09-07 10:18:06 +02:00
9b63a0b0bf Fixed colors on MacOS 2013-09-07 10:13:14 +02:00
397b47d719 Added secondary explosions 2013-09-07 02:51:15 +02:00
5952e34995 PrimedTNT Entity implemented 2013-09-07 02:46:18 +02:00
0ddc48ca80 Vanilla-alike Explosions 2013-09-07 01:28:15 +02:00
24211764ce Tuned TNT force 2013-09-06 22:17:13 +02:00
4a2e3d3611 Fixed Flint & Steel order 2013-09-06 19:33:16 +02:00
e5841e623e Fixed comparison order with flint & steel metadata 2013-09-06 17:50:01 +02:00
215141d552 Added Diamond Hoe, Flint & Steel and Diamond Sword to the Creative inventory 2013-09-06 17:40:07 +02:00
94f8cfb59b Added Single Explosions [ignite TNT using fling & steel] 2013-09-06 13:46:52 +02:00
41b1a0f991 Fixed bottom bed offset 2013-09-05 22:58:49 +02:00
08d93fa021 Fixed #774 [gh#774] 2013-09-05 19:58:31 +02:00
ce65801d14 Keep window open 2013-09-05 17:17:54 +02:00
bb9923d210 Fixed position offset when sleeping on beds 2013-09-05 15:19:27 +02:00
ccac35d5a2 Fixed player catching fire after death 2013-09-05 00:39:06 +02:00
c11ee468a2 Added Door sounds 2013-09-05 00:37:07 +02:00
e48126a0c9 Fixed possible cases on infinite loop on addItem and removeItem 2013-09-04 21:29:21 +02:00
b56ee69f0d Alpha_1.3.10dev 2013-09-04 21:27:13 +02:00
4a46d8fd9c Fixed possible infinite loop in hasSpace 2013-09-04 21:26:22 +02:00
1012 changed files with 96003 additions and 21634 deletions

6
.editorconfig Normal file
View File

@ -0,0 +1,6 @@
# http://editorconfig.org/
root = yes
[*]
indent_size = 4
indent_style = tab

1
.gitattributes vendored
View File

@ -5,6 +5,7 @@
*.txt text eol=lf
*.properties text eol=lf
*.bat text eol=crlf
*.cmd text eol=crlf
# Custom for Visual Studio
*.cs diff=csharp

23
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,23 @@
### Issue description
<!--- use our forum https://forums.pmmp.io for questions -->
Write a short description about the issue
### Steps to reproduce the issue
<!--- help us find the problem by adding steps to reproduce the issue -->
1. ...
2. ...
### OS and versions
<!--- use the 'version' command in PocketMine-MP
NOTE: LATEST is not a valid version.
PocketMine version should include Jenkins build number and/or git commit hash.
ALSO NOTE: NO support whatsoever will be provided for forks or spoons of PocketMine. Issues relating to non-official distributions will be closed as spam. Please send such issues to whoever is responsible for the fork or spoon you are using.
-->
* PocketMine-MP:
* PHP:
* Server OS:
* Game version: PE/Win10 (delete as appropriate)
### Crashdump, backtrace or other files
<!--- please use gist or anything else and add links here -->
* ...

18
.gitignore vendored
View File

@ -1,17 +1,18 @@
players/*
worlds/*
plugins/*
logs/*
bin/*
timings/*
*.log
*.pmf
*.txt
*.phar
server.properties
/pocketmine.yml
memoryDump_*/*
############
## Windows
############
# Common IDEs
.idea/*
nbproject/*
# Windows image file caches
Thumbs.db
@ -21,3 +22,8 @@ Desktop.ini
# Mac crap
.DS_Store
/nbproject/private/
# Sphinx-doc
/docs/build/
!/docs/requirements.txt

13
.gitmodules vendored Normal file
View File

@ -0,0 +1,13 @@
[submodule "src/raklib"]
path = src/raklib
url = https://github.com/pmmp/RakLib.git
branch = master
[submodule "src/spl"]
path = src/spl
url = https://github.com/pmmp/PocketMine-SPL.git
[submodule "src/pocketmine/lang/locale"]
path = src/pocketmine/lang/locale
url = https://github.com/pmmp/PocketMine-Language.git
[submodule "tests/preprocessor"]
path = tests/preprocessor
url = https://github.com/pmmp/preprocessor.git

View File

@ -1,14 +1,18 @@
language: php
php:
- 5.4
- 7.0
before_script:
- pecl install channel://pecl.php.net/pthreads-0.0.44
- mkdir plugins
- wget -O plugins/DevTools.phar https://github.com/PocketMine/DevTools/releases/download/v1.11.0/DevTools_v1.11.0.phar
- pecl install channel://pecl.php.net/pthreads-3.1.6
- pecl install channel://pecl.php.net/weakref-0.3.2
- echo | pecl install channel://pecl.php.net/yaml-2.0.0
script:
- php src/tests/ServerSuiteTest.php
- ./tests/lint.sh && ./tests/run.sh
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

@ -1,27 +1,171 @@
![](http://www.pocketmine.net/favicon.png)
![](http://cdn.pocketmine.net/img/PocketMine-MP-h.png)
# PocketMine-MP Contribution Gidelines
# PocketMine-MP Contribution Guidelines
Before contributing to PocketMine-MP, please read this.
You must follow these guidelines if you wish to contribute to the PocketMine-MP code base, or participate in issue tracking.
## I have a question
* For questions, please refer to the _#pmmp_ or _#pocketmine_ IRC channel on Freenode. There is a [WebIRC](http://webchat.freenode.net?channels=pmmp,pocketmine&uio=d4) if you do not want to install an IRC client.
* You can ask directly to _[@PocketMine](https://twitter.com/PocketMine)_ in Twitter, but don't expect an immediate reply.
* You may use our [Forum](https://forums.pmmp.io) to ask questions.
* We do not accept questions or support requests in our issue tracker.
## I've a question
* For questions, please refer to the _#mcpedevs_ IRC
channel on Freenode. There is a [WebIRC](http://webchat.freenode.net?channels=mcpedevs&uio=d4) if you want.
* You can ask directly to _[@PocketMine](https://twitter.com/PocketMine)_ in Twitter.
## Creating an Issue
* First, use the [Issue Search](https://github.com/pmmp/PocketMine-MP/search?ref=cmdform&type=Issues) to check if anyone has reported it. Check also closed issues, as an issue you think is valid may actually be invalid.
* If an issue has been _fixed_ and closed, create another issue.
* If your issue is related to a plugin, do **not** report here. Contact the plugin's original author instead.
* **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. Please refer to the section [I have a quesetion](#i-have-a-question) instead.
* **No generic titles** such as "Question", "Help", "Crash Report" etc.
* If you just got a crash report but you don't understand it, please look for a line starting with `Message`. It summarizes the bug.
* Information must be provided in the issue body, not in the title. No tags like `[BUG]` are allowed in the title, including `[SOLVED]` for solved issues.
* Similarly, no generic issue reports. For bugs, it is the issue author'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.
* In simple words, if your issue does not appear to be a bug or a feature request, or if the issue cannot be properly confirmed to be valid, the issue will be closed until further information is provided.
* To express appreciation, objection, confusion or other supported reactions on pull requests, issues or comments on them, use GitHub [reactions](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments) rather than posting an individual comment with an emoji only. This helps keeping the issue/pull rqeuest conversation clean and readable.
* If your issue is related to the Pocketmine-MP website, forums, etc., please [talk to a human directly](#i-have-a-question).
## 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.
## I want to contribute code
* Use the [Pull Request](https://github.com/PocketMine/PocketMine-MP/pull/new) system, your request will be checked and discussed.
* If you want to be part of PocketMine-MP, we will ask you to.
* Code using the syntax as in PocketMine-MP.
## Contributing Code
* Use the [Pull Request](https://github.com/pmmp/PocketMine-MP/pull/new) system, your request will be checked and discussed.
* Create each pull request on a new branch. Do not create a pull request on commits that exist in another pull request.
* Code should use the same 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
* **Keep each pull request only contain one feature**. The only exception is when all features in the pull request are related to each other, and share the same core changes.
* **Do not create pull requests that only bump the MCPE version**. If it is ready to be updated, the team will update the values directly. Do not change the MCPE version or protocol version in a pull request, unless you have updated the protocol (all packets) entirely.
**Thanks for contributing to PocketMine-MP!**
### Code Syntax
It is mainly [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md) with a few exceptions.
* Opening braces MUST go on the same line, 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 before or after them.
* Code MUST use tabs for indenting.
* Long arrays MAY be split across multiple lines, where each subsequent line is indented once.
* Files MUST use only the `<?php` tag.
* Files MUST NOT have an ending `?>` tag.
* Code MUST use namespaces.
* Strings SHOULD use the double quote `"` except when the single quote is required.
```php
<?php
namespace pocketmine\example;
class ExampleClass{
const EXAMPLE_CLASS_CONSTANT = 1;
public $examplePublicVariable = "defaultValue";
private $examplePrivateVariable;
/**
* Creates an instance of ExampleClass
* @param string $firstArgument the first argument
* @param string|null $secondArgument default null
*/
public function __construct($firstArgument, &$secondArgument = null){
if($firstArgument === "exampleValue"){ //Remember to use === instead == when possible
//do things
}elseif($firstArgument === "otherValue"){
$secondArgument = function(){
$this->examplePrivateVariable = [
0 => "value1",
1 => "value2",
2 => "value3",
3 => "value4",
4 => "value5",
5 => "value6",
];
}
}
}
}
```
<!-- TODO: RFC and voting on the forums instead -->
### 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.
__Thanks for contributing to PocketMine-MP!__
## 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.
Labels are used to identify the type and status of issues and pull requests.
#### Categories
Multiple category labels may be applied to a single issue (but try to keep this to a minimum and do not overuse category labels).
These labels may be applied to issues with bugs related to these, or pull requests that alter the behaviour of these or fix an issue with the same label applied.
- `Category: Core` - Related to PocketMine-MP's core functionality, but not gameplay or API.
- `Category: Gameplay` - Related to gameplay.
- `Category: API` - Related to plugin API.
- `Category: Client` - Related to client functionality or behaviour. This label may be applied to issues reporting client-related bugs, or PRs related to the client such as a protocol update. There are several sub-labels to account for the differences between supported clients.
- `all`: Related to all versions of the client.
- `W10`: Related only to Windows 10 Edition Beta.
- `PE`: Related only to the Pocket Edition
- `beta`: Related only to a beta version of the game.
- `other`: Related only to an uncommon PE-compatible version of the client, such as VR Edition.
- `Category: PHP` - Applied to issues caused by the PHP interpreter or its extensions.
- `Category: Other` - Applied to issues which cannot be categorized with any of the above labels.
#### Pull Requests
Pull Request labels are prefixed by `PR:`. Only one label may be applied for a Pull Request.
- `PR: Bug Fix` - The Pull Request fixes a bug.
- `PR: Contribution` - The Pull Request contributes new features or improvements, but does not fix a bug, nor controversial enough to be an RFC.
- `PR: RFC` - Request for Comments. Refer to [RFC and Voting](#rfc-and-voting).
#### Status
Status labels show the status of the issue. Multiple status labels may be applied.
*Issues*
- `Status: Unconfirmed` - reported issues that have yet to be reproduced by a developer successfully.
- `Status: Reproduced` - a bug that has been reproduced by a developer, or that 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.
- `Status: Debugged` - the cause of the bug has been found, but has not yet been fixed.
- `Status: Resolved` - applied to *valid* issues which have been fixed. *This label may only be applied to a closed issue.*
*Pull requests*
- `Status: Insufficiently tested` - applied for pull requests that have not undergone tests strict enough.
#### Resolution
Resolution labels show the resolution of an issue or pull request. These labels may only be applied to closed issues.
- `Resolution: Invalid` - Applied to support request issues or issues not related to PocketMine.
- `Resolution: Duplicate` - Applied to issues reporting the same problems as another issue.
- `Resolution: Fixed` - Applied to an issue reporting a bug which has been fixed.
- `Resolution: Works As Intended` - Applied to issues reporting false bugs which work the way they are intended to.
- `Resolution: Won't Fix` - Applied to issues reporting bugs which will not be fixed, for example if the bug is beneficial.
- `Resolution: Obsolete` - Applied to pull requests which are rendered unnecessary by other changes, such as another, similar pull request being merged.
#### Miscellaneous
- `Enhancement` - Applied to issues with viable feature requests or TODO lists.
- `High priority` - Applied to issues or PRs related to critical bugs.
### 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:
```
<version_number> [release_title][release_version]
```
For example:
```
1.6.1b1
```
-->

View File

@ -1,50 +1,57 @@
![](http://www.pocketmine.net/favicon.png)
# PocketMine-MP [![Build Status](https://travis-ci.org/PocketMine/PocketMine-MP.png?branch=master)](https://travis-ci.org/PocketMine/PocketMine-MP)
```
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
```
__PocketMine-MP is a sofware for creating Minecraft Pocket Edition servers__. It has a Plugin API that enables a developer to extend it and add new features, or change default ones.
The entire server is done in PHP, and has been tested, profiled and optimized to run smoothly.
### [Homepage](http://www.pocketmine.net/)
### [Forums](http://forums.pocketmine.net/)
### [Wiki](https://github.com/PocketMine/PocketMine-MP/wiki/)
### [FAQ: Frequently Asked Questions](https://github.com/PocketMine/PocketMine-MP/wiki/Frequently-Asked-Questions)
# ![PocketMine-MP](http://cdn.pocketmine.net/img/PocketMine-MP-h.png)
[![Build Status](https://travis-ci.org/pmmp/PocketMine-MP.svg?branch=master)](https://travis-ci.org/pmmp/PocketMine-MP)
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
__PocketMine-MP is a free, open-source software that creates Minecraft: Pocket Edition servers and allows extending its functionalities__
### [Homepage](https://pmmp.io/)
### [Forums](https://forums.pmmp.io/)
### [Documentation](http://pmmp.readthedocs.org/)
### [Plugin Repository](http://plugins.pocketmine.net/)
<!--## [FAQ: Frequently Asked Questions](https://github.com/PocketMine/PocketMine-MP/wiki/Frequently-Asked-Questions)-->
### [Official Jenkins server](https://jenkins.pmmp.io/)
### API Documentation
* [Official Doxygen-generated documentation](http://docs.pocketmine.net/)
* [Latest Doxygen generated from development](https://jenkins.pmmp.io/job/PocketMine-MP%20Docs/doxygen/)
### [Twitter @PocketMine](https://twitter.com/PocketMine)
## IRC #pocketmine (or #mcpedevs) @ irc.freenode.net
* [WebIRC](http://webchat.freenode.net?channels=pocketmine,mcpedevs&uio=d4)
### IRC Chat #pmmp (or #pocketmine) @ irc.freenode.net
[#pmmp + #pocketmine channel WebIRC](http://webchat.freenode.net/?channels=pmmp,pocketmine)
### Want to contribute?
* Check the [Contributing Guidelines](CONTRIBUTING.md)
## Third-party Libraries/Protocols Used
* __[PHP Sockets](http://php.net/manual/en/book.sockets.php)__
* __[PHP mbstring](http://php.net/manual/en/book.mbstring.php)__
* __[PHP SQLite3](http://php.net/manual/en/book.sqlite3.php)__
* __[PHP BCMath](http://php.net/manual/en/book.bc.php)__
* __[PHP pthreads](https://github.com/krakjoe/pthreads)__ by _[krakjoe](https://github.com/krakjoe)_: Threading for PHP - Share Nothing, Do Everything.
* __[Spyc](https://github.com/mustangostang/spyc/blob/master/Spyc.php)__ by _[Vlad Andersen](https://github.com/mustangostang)_: A simple YAML loader/dumper class for PHP.
* __[mintty](https://code.google.com/p/mintty/)__ : xterm Terminal Emulator
* __[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.
* __[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)__
* __[UT3 Query Protocol](http://wiki.unrealadmin.org/UT3_query_protocol)__
* __[UT3 Query Protocol](http://wiki.unrealadmin.org/UT3_query_protocol)__

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/
*
*
*/
class BanAPI{
private $server;
private $whitelist;
private $banned;
private $ops;
private $bannedIPs;
private $cmdWL = array();//Command WhiteList
function __construct(){
$this->server = ServerAPI::request();
}
public function init(){
$this->whitelist = new Config(DATA_PATH."white-list.txt", CONFIG_LIST);//Open whitelist list file
$this->bannedIPs = new Config(DATA_PATH."banned-ips.txt", CONFIG_LIST);//Open Banned IPs list file
$this->banned = new Config(DATA_PATH."banned.txt", CONFIG_LIST);//Open Banned Usernames list file
$this->ops = new Config(DATA_PATH."ops.txt", CONFIG_LIST);//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>", 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
}
public function cmdWhitelist($cmd){//Whitelists a CMD so everyone can issue it - Even non OPs.
$this->cmdWhitelist[strtolower(trim($cmd))] = true;
}
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;
}
public function permissionsCheck($data, $event){
switch($event){
case "player.flying"://OPs can fly around the server.
if($this->isOp($data->iusername)){
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"]->iusername)){
$t = new Vector2($data["target"]->x, $data["target"]->z);
$s = new Vector2($this->server->spawn->x, $this->server->spawn->z);
if($t->distance($s) <= $this->server->api->getProperty("spawn-protection") and $this->server->api->dhandle($event.".spawn", $data) !== true){
return false;
}
}
return;
break;
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"]->iusername)){
return;
}
}elseif($data["issuer"] === "console" or $data["issuer"] === "rcon"){
return;
}
return false;
break;
}
}
public function commandHandler($cmd, $params, $issuer, $alias){
$output = "";
switch($cmd){
case "sudo":
$target = strtolower(array_shift($params));
$player = $this->server->api->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->username.".\n";
break;
case "op":
$user = strtolower($params[0]);
$player = $this->server->api->player->get($user);
if(!($player instanceof Player)){
$this->ops->set($user);
$this->ops->save($user);
$output .= $user." is now op\n";
break;
}
$this->ops->set($player->iusername);
$this->ops->save();
$output .= $player->iusername." is now op\n";
$this->server->api->chat->sendTo(false, "You are now op.", $player->iusername);
break;
case "deop":
$user = strtolower($params[0]);
$player = $this->server->api->player->get($user);
if(!($player instanceof Player)){
$this->ops->set($user, false);
$this->ops->save($user);
$output .= $user." is no longer op\n";
break;
}
$this->ops->remove($player->iusername);
$this->ops->save();
$output .= $player->iusername." is not longer op\n";
$this->server->api->chat->sendTo(false, "You are no longer op.", $player->iusername);
break;
case "kick":
if(!isset($params[0])){
$output .= "Usage: /kick <player> [reason ...]\n";
}else{
$name = strtolower(array_shift($params));
$player = $this->server->api->player->get($name);
if($player === false){
$output .= "Player \"".$name."\" does not exist\n";
}else{
$reason = implode(" ", $params);
$reason = $reason == "" ? "No reason":$reason;
$player->close("You have been kicked: ".$reason);
if($issuer instanceof Player){
$this->server->api->chat->broadcast($player->username." has been kicked by ".$issuer->username.": $reason\n");
}else{
$this->server->api->chat->broadcast($player->username." 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(DATA_PATH."white-list.txt", CONFIG_LIST);
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 = $this->server->api->player->get($ip);
if($player instanceof Player){
$ip = $player->ip;
$player->close("banned");
}
$this->bannedIPs->set($ip);
$this->bannedIPs->save();
$output .= "IP \"$ip\" added to ban list\n";
break;
case "reload":
$this->bannedIPs = new Config(DATA_PATH."banned-ips.txt", CONFIG_LIST);
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 = $this->server->api->player->get($user);
if($player !== false){
$player->close("You have been banned");
}
if($issuer instanceof Player){
$this->server->api->chat->broadcast($user." has been banned by ".$issuer->username."\n");
}else{
$this->server->api->chat->broadcast($user." has been banned\n");
}
$this->kick($user, "Banned");
$output .= "Player \"$user\" added to ban list\n";
break;
case "reload":
$this->banned = new Config(DATA_PATH."banned.txt", CONFIG_LIST);
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;
}
public function ban($username){
$this->commandHandler("ban", array("add", $username), "console", "");
}
public function pardon($username){
$this->commandHandler("ban", array("pardon", $username), "console", "");
}
public function banIP($ip){
$this->commandHandler("banip", array("add", $ip), "console", "");
}
public function pardonIP($ip){
$this->commandHandler("banip", array("pardon", $ip), "console", "");
}
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", "");
}
public function isIPBanned($ip){
if($this->server->api->dhandle("api.ban.ip.check", $ip) === false){
return true;
}elseif($this->bannedIPs->exists($ip)){
return true;
}
return false;
}
public function isBanned($username){
$username = strtolower($username);
if($this->server->api->dhandle("api.ban.check", $username) === false){
return true;
}elseif($this->banned->exists($username)){
return true;
}
return false;
}
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)){
return true;
}
return false;
}
}

View File

@ -1,825 +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/
*
*
*/
class BlockAPI{
private $server;
private $scheduledUpdates = array();
private $randomUpdates = array();
public static $creative = array(
array(COBBLESTONE, 0),
array(STONE_BRICKS, 0),
array(STONE_BRICKS, 1),
array(STONE_BRICKS, 2),
array(MOSS_STONE, 0),
array(WOODEN_PLANKS, 0),
array(BRICKS, 0),
array(STONE, 0),
array(DIRT, 0),
array(GRASS, 0),
array(CLAY_BLOCK, 0),
array(SANDSTONE, 0),
array(SANDSTONE, 1),
array(SANDSTONE, 2),
array(SAND, 0),
array(GRAVEL, 0),
array(TRUNK, 0),
array(TRUNK, 1),
array(TRUNK, 2),
array(NETHER_BRICKS, 0),
array(NETHERRACK, 0),
array(COBBLESTONE_STAIRS, 0),
array(WOODEN_STAIRS, 0),
array(BRICK_STAIRS, 0),
array(SANDSTONE_STAIRS, 0),
array(STONE_BRICK_STAIRS, 0),
array(NETHER_BRICKS_STAIRS, 0),
array(QUARTZ_STAIRS, 0),
array(SLAB, 0),
array(SLAB, 1),
array(SLAB, 2),
array(SLAB, 3),
array(SLAB, 4),
array(SLAB, 5),
array(SLAB, 6),
array(QUARTZ_BLOCK, 0),
array(QUARTZ_BLOCK, 1),
array(QUARTZ_BLOCK, 2),
array(COAL_ORE, 0),
array(IRON_ORE, 0),
array(GOLD_ORE, 0),
array(DIAMOND_ORE, 0),
array(LAPIS_ORE, 0),
array(REDSTONE_ORE, 0),
array(GOLD_BLOCK, 0),
array(IRON_BLOCK, 0),
array(DIAMOND_BLOCK, 0),
array(LAPIS_BLOCK, 0),
array(OBSIDIAN, 0),
array(SNOW_BLOCK, 0),
array(GLASS, 0),
array(GLOWSTONE_BLOCK, 0),
array(NETHER_REACTOR, 0),
array(WOOL, 0),
array(WOOL, 7),
array(WOOL, 6),
array(WOOL, 5),
array(WOOL, 4),
array(WOOL, 3),
array(WOOL, 2),
array(WOOL, 1),
array(WOOL, 15),
array(WOOL, 14),
array(WOOL, 13),
array(WOOL, 12),
array(WOOL, 11),
array(WOOL, 10),
array(WOOL, 9),
array(WOOL, 8),
array(LADDER, 0),
array(TORCH, 0),
array(GLASS_PANE, 0),
array(BUCKET, 0),
array(BUCKET, 8),
array(BUCKET, 10),
array(WOODEN_DOOR, 0),
array(TRAPDOOR, 0),
array(FENCE, 0),
array(FENCE_GATE, 0),
array(BED, 0),
array(BOOKSHELF, 0),
array(PAINTING, 0),
array(WORKBENCH, 0),
array(STONECUTTER, 0),
array(CHEST, 0),
array(FURNACE, 0),
array(TNT, 0),
array(DANDELION, 0),
array(CYAN_FLOWER, 0),
array(BROWN_MUSHROOM, 0),
array(RED_MUSHROOM, 0),
array(CACTUS, 0),
array(MELON_BLOCK, 0),
array(SUGARCANE, 0),
array(SAPLING, 0),
array(SAPLING, 1),
array(SAPLING, 2),
array(LEAVES, 0),
array(LEAVES, 1),
array(LEAVES, 2),
array(SEEDS, 0),
array(MELON_SEEDS, 0),
array(DYE, 15), //Bonemeal
array(IRON_HOE, 0),
array(CAKE, 0),
array(EGG, 0),
array(IRON_SWORD, 0),
array(BOW, 0),
array(SIGN, 0),
array(SPAWN_EGG, MOB_CHICKEN),
array(SPAWN_EGG, MOB_COW),
array(SPAWN_EGG, MOB_PIG),
array(SPAWN_EGG, MOB_SHEEP),
);
public static function fromString($str, $multiple = false){
if($multiple === true){
$blocks = array();
foreach(explode(",",$str) as $b){
$blocks[] = BlockAPI::fromString($b, false);
}
return $blocks;
}else{
$b = explode(":", str_replace(" ", "_", trim($str)));
if(!isset($b[1])){
$meta = 0;
}else{
$meta = ((int) $b[1]) & 0xFFFF;
}
if(defined(strtoupper($b[0]))){
$item = BlockAPI::getItem(constant(strtoupper($b[0])), $meta);
if($item->getID() === AIR and strtoupper($b[0]) !== "AIR"){
$item = BlockAPI::getItem(((int) $b[0]) & 0xFFFF, $meta);
}
}else{
$item = BlockAPI::getItem(((int) $b[0]) & 0xFFFF, $meta);
}
return $item;
}
}
public static function get($id, $meta = 0, $v = false){
$id = (int) $id;
if(isset(Block::$class[$id])){
$classname = Block::$class[$id];
$b = new $classname($meta);
}else{
$b = new GenericBlock($id, $meta);
}
if($v instanceof Position){
$b->position($v);
}
return $b;
}
public static function getItem($id, $meta = 0, $count = 1){
$id = (int) $id;
if(isset(Item::$class[$id])){
$classname = Item::$class[$id];
$i = new $classname($meta, $count);
}else{
$i = new Item($id, $meta, $count);
}
return $i;
}
function __construct(){
$this->server = ServerAPI::request();
}
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 = $this->server->api->player->get($params[0]);
$item = BlockAPI::fromString($params[1]);
if(!isset($params[2])){
$item->count = $item->getMaxStackSize();
}else{
$item->count = (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($item->getID(), $item->getMetadata(), $item->count);
$output .= "Giving ".$item->count." of ".$item->getName()." (".$item->getID().":".$item->getMetadata().") to ".$player->username."\n";
}else{
$output .= "Unknown player.\n";
}
break;
}
return $output;
}
private function cancelAction(Block $block, Player $player, $send = true){
$player->dataPacket(MC_UPDATE_BLOCK, array(
"x" => $block->x,
"y" => $block->y,
"z" => $block->z,
"block" => $block->getID(),
"meta" => $block->getMetadata()
));
if($send === true){
$player->sendInventorySlot($player->slot);
}
return false;
}
public function playerBlockBreak(Player $player, Vector3 $vector){
$target = $player->level->getBlock($vector);
$item = $player->getSlot($player->slot);
if($this->server->api->dhandle("player.block.touch", array("type" => "break", "player" => $player, "target" => $target, "item" => $item)) === false){
return $this->cancelAction($target, $player, false);
}
if((!$target->isBreakable($item, $player) and $this->server->api->dhandle("player.block.break.invalid", array("player" => $player, "target" => $target, "item" => $item)) !== true) or ($player->gamemode & 0x02) === 0x02 or (($player->lastBreak - $player->getLag() / 1000) + $target->getBreakTime($item, $player) - 0.1) >= microtime(true)){
return $this->cancelAction($target, $player, false);
}
$player->lastBreak = microtime(true);
if($this->server->api->dhandle("player.block.break", array("player" => $player, "target" => $target, "item" => $item)) !== false){
$drops = $target->getDrops($item, $player);
if($target->onBreak($item, $player) === false){
return $this->cancelAction($target, $player, false);
}
if($item->useOn($target) and ($player->gamemode & 0x01) === 0 and $item->getMetadata() >= $item->getMaxDurability()){
$player->setSlot($player->slot, new Item(AIR, 0, 0), false);
}
}else{
return $this->cancelAction($target, $player, false);
}
if(($player->gamemode & 0x01) === 0x00 and count($drops) > 0){
foreach($drops as $drop){
$this->server->api->entity->drop(new Position($target->x + 0.5, $target->y, $target->z + 0.5, $target->level), BlockAPI::getItem($drop[0] & 0xFFFF, $drop[1] & 0xFFFF, $drop[2]));
}
}
return false;
}
public function playerBlockAction(Player $player, Vector3 $vector, $face, $fx, $fy, $fz){
if($face < 0 or $face > 5){
return false;
}
$target = $player->level->getBlock($vector);
$block = $target->getSide($face);
$item = $player->getSlot($player->slot);
if($target->getID() === AIR and $this->server->api->dhandle("player.block.place.invalid", array("player" => $player, "block" => $block, "target" => $target, "item" => $item)) !== true){ //If no block exists or not allowed in CREATIVE
$this->cancelAction($target, $player);
return $this->cancelAction($block, $player);
}
if($this->server->api->dhandle("player.block.touch", array("type" => "place", "player" => $player, "block" => $block, "target" => $target, "item" => $item)) === false){
return $this->cancelAction($block, $player);
}
$this->blockUpdate($target, BLOCK_UPDATE_TOUCH);
if($target->isActivable === true){
if($this->server->api->dhandle("player.block.activate", array("player" => $player, "block" => $block, "target" => $target, "item" => $item)) !== false and $target->onActivate($item, $player) === true){
return false;
}
}
if(($player->gamemode & 0x02) === 0x02){ //Adventure mode!!
return $this->cancelAction($block, $player, false);
}
if($block->y > 127 or $block->y < 0){
return false;
}
if($item->isActivable === true and $item->onActivate($player->level, $player, $block, $target, $face, $fx, $fy, $fz) === true){
if($item->count <= 0){
$player->setSlot($player->slot, BlockAPI::getItem(AIR, 0, 0), false);
}
return false;
}
if($item->isPlaceable()){
$hand = $item->getBlock();
$hand->position($block);
}elseif($block->getID() === FIRE){
$player->level->setBlock($block, new AirBlock(), true, false, true);
return false;
}else{
return $this->cancelAction($block, $player, false);
}
if(!($block->isReplaceable === true or ($hand->getID() === SLAB and $block->getID() === SLAB))){
return $this->cancelAction($block, $player, false);
}
if($hand->isSolid === true and $player->entity->inBlock($block)){
return $this->cancelAction($block, $player, false); //Entity in block
}
if($this->server->api->dhandle("player.block.place", array("player" => $player, "block" => $block, "target" => $target, "item" => $item)) === false){
return $this->cancelAction($block, $player);
}elseif($hand->place($item, $player, $block, $target, $face, $fx, $fy, $fz) === false){
return $this->cancelAction($block, $player, false);
}
if($hand->getID() === SIGN_POST or $hand->getID() === WALL_SIGN){
$t = $this->server->api->tile->addSign($player->level, $block->x, $block->y, $block->z);
$t->data["creator"] = $player->username;
}
if(($player->gamemode & 0x01) === 0x00){
--$item->count;
if($item->count <= 0){
$player->setSlot($player->slot, BlockAPI::getItem(AIR, 0, 0), false);
}
}
return false;
}
/*
public function flowLavaOn($source, $face){
$down = 0;
if($face === BlockFace::BOTTOM){
$level = 0;
$down = 1;
}else{
$level = ($source[1] & 0x07) + 2;
if($level > 0x07){
return false;
}
}
$spread = $this->server->api->level->getBlockFace($source, $face);
if(($source[0] === 10 or $source[0] === 11) and $spread[0] === 10){
if($level < ($spread[1] & 0x07)){
$this->server->schedule(20, array($this, "blockScheduler"), array(
"x" => $spread[2][0],
"y" => $spread[2][1],
"z" => $spread[2][2],
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->api->level->setBlock($spread[2][0], $spread[2][1], $spread[2][2], $spread[0], $level | $down, false);
return true;
}
}elseif($spread[0] === 9 or $spread[0] === 8){
if($source[0] === 11){
$this->server->api->level->setBlock($source[2][0], $source[2][1], $source[2][2], 49, 0);
}elseif($face === 0){
$this->server->api->level->setBlock($source[2][0], $source[2][1], $source[2][2], 1, 0);
}else{
$this->server->api->level->setBlock($source[2][0], $source[2][1], $source[2][2], 4, 0);
}
return true;
}elseif(isset(Material::$flowable[$spread[0]])){
$this->server->schedule(20, array($this, "blockScheduler"), array(
"x" => $spread[2][0],
"y" => $spread[2][1],
"z" => $spread[2][2],
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->api->level->setBlock($spread[2][0], $spread[2][1], $spread[2][2], 10, $level | $down, false);
return true;
}elseif(($source[1] & 0x08) === 0x08){
$this->server->api->level->setBlock($spread[2][0], $spread[2][1], $spread[2][2], $source[0], $source[1] & 0x07, false);
return true;
}
return false;
}
public function flowWaterOn($source, $face, &$spread = null){
$down = 0;
if($face === BlockFace::BOTTOM){
$level = 0;
$down = 1;
}else{
$level = ($source[1] & 0x07) + 1;
if($level > 0x07){
return false;
}
}
$spread = $this->server->api->level->getBlockFace($source, $face);
if(($source[0] === 8 or $source[0] === 9) and $spread[0] === 8){
if($level < ($spread[1] & 0x07)){
$this->server->schedule(10, array($this, "blockScheduler"), array(
"x" => $spread[2][0],
"y" => $spread[2][1],
"z" => $spread[2][2],
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->api->level->setBlock($spread[2][0], $spread[2][1], $spread[2][2], $spread[0], $level | $down, false);
return true;
}
}elseif($spread[0] === 11){
$this->server->api->level->setBlock($spread[2][0], $spread[2][1], $spread[2][2], 49, 0, true);
return true;
}elseif($spread[0] === 10){
if($face === 0 or ($spread[1] & 0x08) === 0){
$this->server->api->level->setBlock($spread[2][0], $spread[2][1], $spread[2][2], 4, 0, true);
return true;
}
}elseif(isset(Material::$flowable[$spread[0]])){
$this->server->schedule(10, array($this, "blockScheduler"), array(
"x" => $spread[2][0],
"y" => $spread[2][1],
"z" => $spread[2][2],
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->api->level->setBlock($spread[2][0], $spread[2][1], $spread[2][2], 8, $level | $down, false);
return true;
}elseif(($source[1] & 0x08) === 0x08){
$this->server->api->level->setBlock($spread[2][0], $spread[2][1], $spread[2][2], $source[0], $source[1] & 0x07, false);
return true;
}
return false;
}
public function updateBlock($x, $y, $z, $type = BLOCK_UPDATE_NORMAL){
$block = $this->server->api->level->getBlock($x, $y, $z);
$changed = false;
switch($block[0]){
case 8:
case 9:
$faces = array();
if(!$this->flowWaterOn($block, 0, $floor) or $block[0] === 9){
$this->flowWaterOn($block, 2, $faces[0]);
$this->flowWaterOn($block, 3, $faces[1]);
$this->flowWaterOn($block, 4, $faces[2]);
$this->flowWaterOn($block, 5, $faces[3]);
}
if($block[0] === 8){
//Source creation
if(!isset(Material::$flowable[$floor[0]])){
$sources = 0;
foreach($faces as $i => $b){
if($b[0] === 9){
++$sources;
}
}
if($sources >= 2){
$this->server->api->level->setBlock($block[2][0], $block[2][1], $block[2][2], 9, 0, false);
$this->server->schedule(10, array($this, "blockScheduler"), array(
"x" => $block[2][0],
"y" => $block[2][1],
"z" => $block[2][2],
"type" => BLOCK_UPDATE_NORMAL,
));
break;
}
}
$drained = true;
$level = $block[1] & 0x07;
$up = $this->server->api->level->getBlockFace($block, BlockFace::UP);
if($up[0] === 8 or $up[0] === 9){
$drained = false;
}else{
$b = $this->server->api->level->getBlockFace($block, BlockFace::NORTH);
if($b[0] === 9 or ($b[0] === 8 and ($b[1] & 0x08) === 0 and ($b[1] & 0x07) < $level)){
$drained = false;
}else{
$b = $this->server->api->level->getBlockFace($block, BlockFace::SOUTH);
if($b[0] === 9 or ($b[0] === 8 and ($b[1] & 0x08) === 0 and ($b[1] & 0x07) < $level)){
$drained = false;
}else{
$b = $this->server->api->level->getBlockFace($block, BlockFace::EAST);
if($b[0] === 9 or ($b[0] === 8 and ($b[1] & 0x08) === 0 and ($b[1] & 0x07) < $level)){
$drained = false;
}else{
$b = $this->server->api->level->getBlockFace($block, BlockFace::WEST);
if($b[0] === 9 or ($b[0] === 8 and ($b[1] & 0x08) === 0 and ($b[1] & 0x07) < $level)){
$drained = false;
}
}
}
}
}
if($drained === true){
++$level;
if($level > 0x07){
$this->server->schedule(10, array($this, "blockScheduler"), array(
"x" => $block[2][0] + 1,
"y" => $block[2][1],
"z" => $block[2][2],
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->schedule(10, array($this, "blockScheduler"), array(
"x" => $block[2][0] - 1,
"y" => $block[2][1],
"z" => $block[2][2],
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->schedule(10, array($this, "blockScheduler"), array(
"x" => $block[2][0],
"y" => $block[2][1],
"z" => $block[2][2] + 1,
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->schedule(10, array($this, "blockScheduler"), array(
"x" => $block[2][0],
"y" => $block[2][1],
"z" => $block[2][2] - 1,
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->schedule(10, array($this, "blockScheduler"), array(
"x" => $block[2][0],
"y" => $block[2][1] - 1,
"z" => $block[2][2],
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->api->level->setBlock($block[2][0], $block[2][1], $block[2][2], 0, 0, false);
}else{
$block[1] = ($block[1] & 0x08) | $level;
$this->server->schedule(10, array($this, "blockScheduler"), array(
"x" => $block[2][0] + 1,
"y" => $block[2][1],
"z" => $block[2][2],
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->schedule(10, array($this, "blockScheduler"), array(
"x" => $block[2][0] - 1,
"y" => $block[2][1],
"z" => $block[2][2],
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->schedule(10, array($this, "blockScheduler"), array(
"x" => $block[2][0],
"y" => $block[2][1],
"z" => $block[2][2] + 1,
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->schedule(10, array($this, "blockScheduler"), array(
"x" => $block[2][0],
"y" => $block[2][1],
"z" => $block[2][2] - 1,
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->schedule(10, array($this, "blockScheduler"), array(
"x" => $block[2][0],
"y" => $block[2][1] - 1,
"z" => $block[2][2],
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->schedule(10, array($this, "blockScheduler"), array(
"x" => $block[2][0],
"y" => $block[2][1],
"z" => $block[2][2],
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->api->level->setBlock($block[2][0], $block[2][1], $block[2][2], $block[0], $block[1], false);
}
}
}
break;
case 10:
case 11:
if(!$this->flowLavaOn($block, 0) or $block[0] === 11){
$this->flowLavaOn($block, 2);
$this->flowLavaOn($block, 3);
$this->flowLavaOn($block, 4);
$this->flowLavaOn($block, 5);
}
if($block[0] === 10){
$drained = true;
$level = $block[1] & 0x07;
$up = $this->server->api->level->getBlockFace($block, BlockFace::UP);
if($up[0] === 10 or $up[0] === 11){
$drained = false;
}else{
$b = $this->server->api->level->getBlockFace($block, BlockFace::NORTH);
if($b[0] === 11 or ($b[0] === 10 and ($b[1] & 0x08) === 0 and ($b[1] & 0x07) < $level)){
$drained = false;
}else{
$b = $this->server->api->level->getBlockFace($block, BlockFace::SOUTH);
if($b[0] === 11 or ($b[0] === 10 and ($b[1] & 0x08) === 0 and ($b[1] & 0x07) < $level)){
$drained = false;
}else{
$b = $this->server->api->level->getBlockFace($block, BlockFace::EAST);
if($b[0] === 11 or ($b[0] === 10 and ($b[1] & 0x08) === 0 and ($b[1] & 0x07) < $level)){
$drained = false;
}else{
$b = $this->server->api->level->getBlockFace($block, BlockFace::WEST);
if($b[0] === 11 or ($b[0] === 10 and ($b[1] & 0x08) === 0 and ($b[1] & 0x07) < $level)){
$drained = false;
}
}
}
}
}
if($drained === true){
++$level;
if($level > 0x07){
$this->server->schedule(20, array($this, "blockScheduler"), array(
"x" => $block[2][0] + 1,
"y" => $block[2][1],
"z" => $block[2][2],
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->schedule(20, array($this, "blockScheduler"), array(
"x" => $block[2][0] - 1,
"y" => $block[2][1],
"z" => $block[2][2],
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->schedule(20, array($this, "blockScheduler"), array(
"x" => $block[2][0],
"y" => $block[2][1],
"z" => $block[2][2] + 1,
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->schedule(20, array($this, "blockScheduler"), array(
"x" => $block[2][0],
"y" => $block[2][1],
"z" => $block[2][2] - 1,
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->schedule(20, array($this, "blockScheduler"), array(
"x" => $block[2][0],
"y" => $block[2][1] - 1,
"z" => $block[2][2],
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->api->level->setBlock($block[2][0], $block[2][1], $block[2][2], 0, 0, false);
}else{
$block[1] = ($block[1] & 0x08) | $level;
$this->server->schedule(20, array($this, "blockScheduler"), array(
"x" => $block[2][0] + 1,
"y" => $block[2][1],
"z" => $block[2][2],
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->schedule(20, array($this, "blockScheduler"), array(
"x" => $block[2][0] - 1,
"y" => $block[2][1],
"z" => $block[2][2],
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->schedule(20, array($this, "blockScheduler"), array(
"x" => $block[2][0],
"y" => $block[2][1],
"z" => $block[2][2] + 1,
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->schedule(20, array($this, "blockScheduler"), array(
"x" => $block[2][0],
"y" => $block[2][1],
"z" => $block[2][2] - 1,
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->schedule(20, array($this, "blockScheduler"), array(
"x" => $block[2][0],
"y" => $block[2][1] - 1,
"z" => $block[2][2],
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->schedule(20, array($this, "blockScheduler"), array(
"x" => $block[2][0],
"y" => $block[2][1],
"z" => $block[2][2],
"type" => BLOCK_UPDATE_NORMAL,
));
$this->server->api->level->setBlock($block[2][0], $block[2][1], $block[2][2], $block[0], $block[1], false);
}
}
}
break;
}
if($type === BLOCK_TYPE_SCHEDULED){
$type = BLOCK_UPDATE_WEAK;
}
if($changed === true){
$this->updateBlocksAround($x, $y, $z, $type);
}
}*/
public function blockUpdateAround(Position $pos, $type = 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 = BLOCK_UPDATE_NORMAL){
if(!($pos instanceof 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 === BLOCK_UPDATE_NORMAL){
$this->blockUpdateAround($block, $level);
$this->server->api->entity->updateRadius($pos, 1);
}elseif($level === BLOCK_UPDATE_RANDOM){
$this->nextRandomUpdate($pos);
}
return $level;
}
public function scheduleBlockUpdate(Position $pos, $delay, $type = 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 nextRandomUpdate(Position $pos){
if(!isset($this->scheduledUpdates[$pos->x.".".$pos->y.".".$pos->z.".".$pos->level->getName().".".BLOCK_UPDATE_RANDOM])){
$X = (($pos->x >> 4) << 4);
$Y = (($pos->y >> 4) << 4);
$Z = (($pos->z >> 4) << 4);
$time = microtime(true);
$i = 0;
$offset = 0;
while(true){
$t = $offset + Utils::getRandomUpdateTicks() * 0.05;
$update = $this->server->query("SELECT COUNT(*) FROM blockUpdates WHERE level = '".$pos->level->getName()."' AND type = ".BLOCK_UPDATE_RANDOM." AND delay >= ".($time + $t - 1)." AND delay <= ".($time + $t + 1).";");
if($update instanceof SQLite3Result){
$update = $update->fetchArray(SQLITE3_NUM);
if($update[0] < 3){
break;
}
}else{
break;
}
$offset += mt_rand(25, 75);
}
$this->scheduleBlockUpdate($pos, $t / 0.05, BLOCK_UPDATE_RANDOM);
}
}
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,123 +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/
*
*
*/
class ChatAPI{
private $server;
function __construct(){
$this->server = ServerAPI::request();
}
public function init(){
$this->server->api->console->register("tell", "<player> <private message ...>", array($this, "commandHandler"));
$this->server->api->console->register("me", "<action ...>", array($this, "commandHandler"));
$this->server->api->console->register("say", "<message ...>", array($this, "commandHandler"));
$this->server->api->ban->cmdWhitelist("tell");
$this->server->api->ban->cmdWhitelist("me");
}
public function commandHandler($cmd, $params, $issuer, $alias){
$output = "";
switch($cmd){
case "say":
$s = implode(" ", $params);
if(trim($s) == ""){
$output .= "Usage: /say <message>\n";
break;
}
$sender = ($issuer instanceof Player) ? "Server":ucfirst($issuer);
$this->server->api->chat->broadcast("[$sender] ".$s);
break;
case "me":
if(!($issuer instanceof Player)){
if($issuer === "rcon"){
$sender = "Rcon";
}else{
$sender = ucfirst($issuer);
}
}else{
$sender = $issuer->username;
}
$this->broadcast("* $sender ".implode(" ", $params));
break;
case "tell":
if(!isset($params[0]) or !isset($params[1])){
$output .= "Usage: /$cmd <player> <message>\n";
break;
}
if(!($issuer instanceof Player)){
$sender = ucfirst($issuer);
}else{
$sender = $issuer->username;
}
$n = array_shift($params);
$target = $this->server->api->player->get($n);
if($target instanceof Player){
$target = $target->username;
}else{
$target = strtolower($n);
if($t === "server" or $t === "console" or $t === "rcon"){
$target = "Console";
}
}
$mes = implode(" ", $params);
$output .= "[me -> ".$target."] ".$mes."\n";
if($target !== "Console" and $target !== "Rcon"){
$this->sendTo(false, "[".$sender." -> me] ".$mes, $target);
}
console("[INFO] [".$sender." -> ".$target."] ".$mes);
break;
}
return $output;
}
public function broadcast($message){
$this->send(false, $message);
}
public function sendTo($owner, $text, $player){
$this->send($owner, $text, array($player));
}
public function send($owner, $text, $whitelist = false, $blacklist = false){
$message = array(
"player" => $owner,
"message" => $text,
);
if($owner !== false){
if($owner instanceof Player){
if($whitelist === false){
console("[INFO] <".$owner->username."> ".$text);
}
}else{
if($whitelist === false){
console("[INFO] <".$owner."> ".$text);
}
}
}else{
if($whitelist === false){
console("[INFO] $text");
}
$message["player"] = "";
}
$this->server->handle("server.chat", new Container($message, $whitelist, $blacklist));
}
}

View File

@ -1,319 +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/
*
*
*/
class ConsoleAPI{
private $loop, $server, $event, $help, $cmds, $alias;
function __construct(){
$this->help = array();
$this->cmds = array();
$this->alias = array();
$this->server = ServerAPI::request();
$this->last = microtime(true);
}
public function init(){
$this->server->schedule(2, array($this, "handle"), array(), true);
if(!defined("NO_THREADS")){
$this->loop = new ConsoleLoop();
}
$this->register("help", "[page|command name]", array($this, "defaultCommands"));
$this->register("status", "", array($this, "defaultCommands"));
$this->register("difficulty", "<0|1|2|3>", array($this, "defaultCommands"));
$this->register("stop", "", array($this, "defaultCommands"));
$this->register("defaultgamemode", "<mode>", array($this, "defaultCommands"));
$this->server->api->ban->cmdWhitelist("help");
}
function __destruct(){
$this->server->deleteEvent($this->event);
if(!defined("NO_THREADS")){
$this->loop->stop();
$this->loop->notify();
//$this->loop->join();
}
}
public function defaultCommands($cmd, $params, $issuer, $alias){
$output = "";
switch($cmd){
case "defaultgamemode":
$gms = array(
"0" => SURVIVAL,
"survival" => SURVIVAL,
"s" => SURVIVAL,
"1" => CREATIVE,
"creative" => CREATIVE,
"c" => CREATIVE,
"2" => ADVENTURE,
"adventure" => ADVENTURE,
"a" => ADVENTURE,
"3" => VIEW,
"view" => VIEW,
"viewer" => VIEW,
"spectator" => VIEW,
"v" => VIEW,
);
if(!isset($gms[strtolower($params[0])])){
$output .= "Usage: /$cmd <mode>\n";
break;
}
$this->server->api->setProperty("gamemode", $gms[strtolower($params[0])]);
$output .= "Default Gamemode is now ".strtoupper($this->server->getGamemode()).".\n";
break;
case "status":
if(!($issuer instanceof Player) and $issuer === "console"){
$this->server->debugInfo(true);
}
$info = $this->server->debugInfo();
$output .= "TPS: ".$info["tps"].", Memory usage: ".$info["memory_usage"]." (Peak ".$info["memory_peak_usage"].")\n";
break;
case "update-done":
$this->server->api->setProperty("last-update", time());
break;
case "stop":
$this->loop->stop = true;
$output .= "Stopping the server\n";
$this->server->close();
break;
case "difficulty":
$s = trim(array_shift($params));
if($s === "" or (((int) $s) > 3 and ((int) $s) < 0)){
$output .= "Usage: /difficulty <0|1|2|3>\n";
break;
}
$this->server->api->setProperty("difficulty", (int) $s);
$output .= "Difficulty changed to ".$this->server->difficulty."\n";
break;
case "?":
if($issuer !== "console" and $issuer !== "rcon"){
break;
}
case "help":
if(isset($params[0]) and !is_numeric($params[0])){
$c = trim(strtolower($params[0]));
if(isset($this->help[$c]) or isset($this->alias[$c])){
$c = isset($this->help[$c]) ? $c : $this->alias[$c];
if($this->server->api->dhandle("console.command.".$c, array("cmd" => $c, "parameters" => array(), "issuer" => $issuer, "alias" => false)) === false or $this->server->api->dhandle("console.command", array("cmd" => $c, "parameters" => array(), "issuer" => $issuer, "alias" => false)) === false){
break;
}
$output .= "Usage: /$c ".$this->help[$c]."\n";
break;
}
}
$cmds = array();
foreach($this->help as $c => $h){
if($this->server->api->dhandle("console.command.".$c, array("cmd" => $c, "parameters" => array(), "issuer" => $issuer, "alias" => false)) === false or $this->server->api->dhandle("console.command", array("cmd" => $c, "parameters" => array(), "issuer" => $issuer, "alias" => false)) === false){
continue;
}
$cmds[$c] = $h;
}
$max = ceil(count($cmds) / 5);
$page = (int) (isset($params[0]) ? min($max, max(1, intval($params[0]))):1);
$output .= "\x1b[31;1m-\x1b[0m Showing help page $page of $max (/help <page>) \x1b[31;1m-\x1b[0m\n";
$current = 1;
foreach($cmds as $c => $h){
$curpage = (int) ceil($current / 5);
if($curpage === $page){
$output .= "/$c ".$h."\n";
}elseif($curpage > $page){
break;
}
++$current;
}
break;
default:
$output .= "Command doesn't exist! Use /help\n";
break;
}
return $output;
}
public function alias($alias, $cmd){
$this->alias[strtolower(trim($alias))] = trim($cmd);
return true;
}
public function register($cmd, $help, $callback){
if(!is_callable($callback)){
return false;
}
$cmd = strtolower(trim($cmd));
$this->cmds[$cmd] = $callback;
$this->help[$cmd] = $help;
ksort($this->help, SORT_NATURAL | SORT_FLAG_CASE);
}
public function run($line = "", $issuer = "console", $alias = false){
if($line != ""){
$output = "";
$end = strpos($line, " ");
if($end === false){
$end = strlen($line);
}
$cmd = strtolower(substr($line, 0, $end));
$params = (string) substr($line, $end + 1);
if(isset($this->alias[$cmd])){
return $this->run($this->alias[$cmd] . ($params !== "" ? " " .$params:""), $issuer, $cmd);
}
if($issuer instanceof Player){
console("[DEBUG] ".FORMAT_AQUA.$issuer->username.FORMAT_RESET." issued server command: ".ltrim("$alias ")."/$cmd ".$params, true, true, 2);
}else{
console("[DEBUG] ".FORMAT_YELLOW."*".$issuer.FORMAT_RESET." issued server command: ".ltrim("$alias ")."/$cmd ".$params, true, true, 2);
}
if(preg_match_all('#@([@a-z]{1,})#', $params, $matches, PREG_OFFSET_CAPTURE) > 0){
$offsetshift = 0;
foreach($matches[1] as $selector){
if($selector[0]{0} === "@"){ //Escape!
$params = substr_replace($params, $selector[0], $selector[1] + $offsetshift - 1, strlen($selector[0]) + 1);
--$offsetshift;
continue;
}
switch(strtolower($selector[0])){
case "u":
case "player":
case "username":
$p = ($issuer instanceof Player) ? $issuer->username:$issuer;
$params = substr_replace($params, $p, $selector[1] + $offsetshift - 1, strlen($selector[0]) + 1);
$offsetshift -= strlen($selector[0]) - strlen($p) + 1;
break;
case "w":
case "world":
$p = ($issuer instanceof Player) ? $issuer->level->getName():$this->server->api->level->getDefault()->getName();
$params = substr_replace($params, $p, $selector[1] + $offsetshift - 1, strlen($selector[0]) + 1);
$offsetshift -= strlen($selector[0]) - strlen($p) + 1;
break;
case "a":
case "all":
$output = "";
foreach($this->server->api->player->getAll() as $p){
$output .= $this->run($cmd . " ". substr_replace($params, $p->username, $selector[1] + $offsetshift - 1, strlen($selector[0]) + 1), $issuer, $alias);
}
return $output;
case "r":
case "random":
$l = array();
foreach($this->server->api->player->getAll() as $p){
if($p !== $issuer){
$l[] = $p;
}
}
if(count($l) === 0){
return;
}
$p = $l[mt_rand(0, count($l) - 1)]->username;
$params = substr_replace($params, $p, $selector[1] + $offsetshift - 1, strlen($selector[0]) + 1);
$offsetshift -= strlen($selector[0]) - strlen($p) + 1;
break;
}
}
}
$params = explode(" ", $params);
if(count($params) === 1 and $params[0] === ""){
$params = array();
}
if(($d1 = $this->server->api->dhandle("console.command.".$cmd, array("cmd" => $cmd, "parameters" => $params, "issuer" => $issuer, "alias" => $alias))) === false
or ($d2 = $this->server->api->dhandle("console.command", array("cmd" => $cmd, "parameters" => $params, "issuer" => $issuer, "alias" => $alias))) === false){
$output = "You don't have permissions to use this command.\n";
}elseif($d1 !== true and $d2 !== true){
if(isset($this->cmds[$cmd]) and is_callable($this->cmds[$cmd])){
$output = @call_user_func($this->cmds[$cmd], $cmd, $params, $issuer, $alias);
}elseif($this->server->api->dhandle("console.command.unknown", array("cmd" => $cmd, "params" => $params, "issuer" => $issuer, "alias" => $alias)) !== false){
$output = $this->defaultCommands($cmd, $params, $issuer, $alias);
}
}
if($output != "" and ($issuer instanceof Player)){
$issuer->sendChat(trim($output));
}
return $output;
}
}
public function handle($time){
if(defined("NO_THREADS")){
return;
}
if($this->loop->line !== false){
$line = trim($this->loop->line);
$this->loop->line = false;
$output = $this->run($line, "console");
if($output != ""){
$mes = explode("\n", trim($output));
foreach($mes as $m){
console("[CMD] ".$m);
}
}
}else{
$this->loop->notify();
}
}
}
class ConsoleLoop extends Thread{
public $line;
public $stop;
public $base;
public $ev;
public $fp;
public function __construct(){
$this->line = false;
$this->stop = false;
$this->start();
}
public function stop(){
$this->stop = true;
}
private function readLine(){
if($this->fp){
$line = trim(fgets($this->fp));
}else{
$line = trim(readline(""));
if($line != ""){
readline_add_history( $line );
}
}
return $line;
}
public function run(){
if(!extension_loaded("readline")){
$this->fp = fopen( "php://stdin", "r" );
}
while($this->stop === false){
$this->line = $this->readLine();
$this->wait();
$this->line = false;
}
if(!$this->haveReadline){
@fclose($fp);
}
exit(0);
}
}

View File

@ -1,173 +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/
*
*
*/
class EntityAPI{
private $server;
private $entities;
private $eCnt = 1;
function __construct(){
$this->entities = array();
$this->server = ServerAPI::request();
}
public function get($eid){
if(isset($this->entities[$eid])){
return $this->entities[$eid];
}
return false;
}
public function init(){
$this->server->schedule(25, array($this, "updateEntities"), array(), true);
}
public function updateEntities(){
$l = $this->server->query("SELECT EID FROM entities WHERE hasUpdate = 1;");
if($l !== false and $l !== true){
while(($e = $l->fetchArray(SQLITE3_ASSOC)) !== false){
$e = $this->get($e["EID"]);
if($e instanceof Entity){
$e->update();
$this->server->query("UPDATE entities SET hasUpdate = 0 WHERE EID = ".$e->eid.";");
}
}
}
}
public function updateRadius(Position $center, $radius = 15, $class = false){
$this->server->query("UPDATE entities SET hasUpdate = 1 WHERE level = '".$center->level->getName()."' ".($class !== false ? "AND class = $class ":"")."AND abs(x - {$center->x}) <= $radius AND abs(y - {$center->y}) <= $radius AND abs(z - {$center->z}) <= $radius;");
}
public function getRadius(Position $center, $radius = 15, $class = false){
$entities = array();
$l = $this->server->query("SELECT EID FROM entities WHERE level = '".$center->level->getName()."' ".($class !== false ? "AND class = $class ":"")."AND abs(x - {$center->x}) <= $radius AND abs(y - {$center->y}) <= $radius AND abs(z - {$center->z}) <= $radius;");
if($l !== false and $l !== true){
while(($e = $l->fetchArray(SQLITE3_ASSOC)) !== false){
$e = $this->get($e["EID"]);
if($e instanceof Entity){
$entities[$e->eid] = $e;
}
}
}
return $entities;
}
public function getAll($level = null){
if($level instanceof Level){
$entities = array();
$l = $this->server->query("SELECT EID FROM entities WHERE level = '".$level->getName()."';");
if($l !== false and $l !== true){
while(($e = $l->fetchArray(SQLITE3_ASSOC)) !== false){
$e = $this->get($e["EID"]);
if($e instanceof Entity){
$entities[$e->eid] = $e;
}
}
}
return $entities;
}
return $this->entities;
}
public function heal($eid, $heal = 1, $cause){
$this->harm($eid, -$heal, $cause);
}
public function harm($eid, $attack = 1, $cause, $force = false){
$e = $this->get($eid);
if($e === false or $e->dead === true){
return false;
}
$e->setHealth($e->getHealth() - $attack, $cause, $force);
}
public function add(Level $level, $class, $type = 0, $data = array()){
$eid = $this->eCnt++;
$this->entities[$eid] = new Entity($level, $eid, $class, $type, $data);
$this->server->handle("entity.add", $this->entities[$eid]);
return $this->entities[$eid];
}
public function spawnToAll(Entity $e){
foreach($this->server->api->player->getAll($e->level) as $player){
if($player->eid !== false and $player->eid !== $e->eid and $e->class !== ENTITY_PLAYER){
$e->spawn($player);
}
}
}
public function drop(Position $pos, Item $item){
if($item->getID() === AIR or $item->count <= 0){
return;
}
$data = array(
"x" => $pos->x + mt_rand(-10, 10) / 50,
"y" => $pos->y + 0.19,
"z" => $pos->z + mt_rand(-10, 10) / 50,
//"speedX" => mt_rand(-3, 3) / 8,
"speedY" => mt_rand(5, 8) / 2,
//"speedZ" => mt_rand(-3, 3) / 8,
"item" => $item,
);
if($this->server->api->handle("item.drop", $data) !== false){
for($count = $item->count; $count > 0; ){
$item->count = min($item->getMaxStackSize(), $count);
$count -= $item->count;
$e = $this->add($pos->level, ENTITY_ITEM, $item->getID(), $data);
$this->spawnToAll($e);
$this->server->api->handle("entity.motion", $e);
}
}
}
public function spawnAll(Player $player){
foreach($this->getAll($player->level) as $e){
if($e->class !== ENTITY_PLAYER){
$e->spawn($player);
}
}
}
public function remove($eid){
if(isset($this->entities[$eid])){
$entity = $this->entities[$eid];
$this->entities[$eid] = null;
unset($this->entities[$eid]);
$entity->closed = true;
$this->server->query("DELETE FROM entities WHERE EID = ".$eid.";");
if($entity->class === ENTITY_PLAYER){
$this->server->api->player->broadcastPacket($this->server->api->player->getAll(), MC_REMOVE_PLAYER, array(
"clientID" => 0,
"eid" => $entity->eid,
));
}else{
$this->server->api->player->broadcastPacket($this->server->api->player->getAll($entity->level), MC_REMOVE_ENTITY, array(
"eid" => $entity->eid,
));
}
$this->server->api->dhandle("entity.remove", $entity);
$entity = null;
unset($entity);
}
}
}

View File

@ -1,240 +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/
*
*
*/
class LevelAPI{
private $server, $levels, $default;
public function __construct(){
$this->server = ServerAPI::request();
$this->levels = array();
}
public function get($name){
if(isset($this->levels[$name])){
return $this->levels[$name];
}
return false;
}
public function getDefault(){
return $this->levels[$this->default];
}
public function init(){
$this->server->api->console->register("seed", "[world]", array($this, "commandHandler"));
$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"));
$this->default = $this->server->api->getProperty("level-name");
if($this->loadLevel($this->default) === false){
$this->generateLevel($this->default, $this->server->seed);
$this->loadLevel($this->default);
}
$this->server->spawn = $this->getDefault()->getSafeSpawn();
}
public function commandHandler($cmd, $params, $issuer, $alias){
$output = "";
switch($cmd){
case "save-all":
$save = $this->server->saveEnabled;
$this->server->saveEnabled = true;
$this->saveAll();
$this->server->saveEnabled = $save;
break;
case "save-on":
$this->server->saveEnabled = true;
break;
case "save-off":
$this->server->saveEnabled = false;
break;
case "seed":
if(!isset($params[0]) and ($issuer instanceof Player)){
$output .= "Seed: ".$issuer->level->getSeed()."\n";
}elseif(isset($params[0])){
if(($lv = $this->server->api->level->get(trim(implode(" ", $params)))) !== false){
$output .= "Seed: ".$lv->getSeed()."\n";
}
}else{
$output .= "Seed: ".$this->server->api->level->getDefault()->getSeed()."\n";
}
}
return $output;
}
public function generateLevel($name, $seed = false, $generator = false){
if($this->levelExists($name)){
return false;
}
$options = array();
if($this->server->api->getProperty("generator-settings") !== false and trim($this->server->api->getProperty("generator-settings")) != ""){
$options["preset"] = $this->server->api->getProperty("generator-settings");
}
if($generator !== false and class_exists($generator)){
$generator = new $generator($options);
}else{
if(strtoupper($this->server->api->getProperty("level-type")) == "FLAT"){
$generator = new SuperflatGenerator($options);
}else{
$generator = new TemporalGenerator($options);
}
}
$gen = new WorldGenerator($generator, $name, $seed === false ? Utils::readInt(Utils::getRandomBytes(4, false)):(int) $seed);
$gen->generate();
$gen->close();
return true;
}
public function levelExists($name){
if($name === ""){
return false;
}
$path = DATA_PATH."worlds/".$name."/";
if($this->get($name) === false and !file_exists($path."level.pmf")){
$level = new LevelImport($path);
if($level->import() === false){
return false;
}
}
return true;
}
public function unloadLevel(Level $level, $force = false){
$name = $level->getName();
if($name === $this->default and $force !== true){
return false;
}
console("[INFO] Unloading level \"".$name."\"");
$level->nextSave = PHP_INT_MAX;
$level->save();
foreach($this->server->api->player->getAll($level) as $player){
$player->teleport($this->server->spawn);
}
foreach($this->server->api->entity->getAll($level) as $entity){
if($entity->class !== ENTITY_PLAYER){
$entity->close();
}
}
foreach($this->server->api->tile->getAll($level) as $tile){
$tile->close();
}
$level->close();
unset($this->levels[$name]);
return true;
}
public function loadLevel($name){
if($this->get($name) !== false){
return true;
}elseif($this->levelExists($name) === false){
console("[NOTICE] Level \"".$name."\" not found");
return false;
}
$path = DATA_PATH."worlds/".$name."/";
console("[INFO] Preparing level \"".$name."\"");
$level = new PMFLevel($path."level.pmf");
$entities = new Config($path."entities.yml", CONFIG_YAML);
if(file_exists($path."tileEntities.yml")){
@rename($path."tileEntities.yml", $path."tiles.yml");
}
$tiles = new Config($path."tiles.yml", CONFIG_YAML);
$blockUpdates = new Config($path."bupdates.yml", CONFIG_YAML);
$this->levels[$name] = new Level($level, $entities, $tiles, $blockUpdates, $name);
foreach($entities->getAll() as $entity){
if(!isset($entity["id"])){
break;
}
if($entity["id"] === 64){ //Item Drop
$e = $this->server->api->entity->add($this->levels[$name], ENTITY_ITEM, $entity["Item"]["id"], array(
"meta" => $entity["Item"]["Damage"],
"stack" => $entity["Item"]["Count"],
"x" => $entity["Pos"][0],
"y" => $entity["Pos"][1],
"z" => $entity["Pos"][2],
"yaw" => $entity["Rotation"][0],
"pitch" => $entity["Rotation"][1],
));
}elseif($entity["id"] === FALLING_SAND){
$e = $this->server->api->entity->add($this->levels[$name], ENTITY_FALLING, $entity["id"], $entity);
$e->setPosition(new Vector3($entity["Pos"][0], $entity["Pos"][1], $entity["Pos"][2]), $entity["Rotation"][0], $entity["Rotation"][1]);
$e->setHealth($entity["Health"]);
}elseif($entity["id"] === OBJECT_PAINTING or $entity["id"] === OBJECT_ARROW){ //Painting
$e = $this->server->api->entity->add($this->levels[$name], ENTITY_OBJECT, $entity["id"], $entity);
$e->setPosition(new Vector3($entity["Pos"][0], $entity["Pos"][1], $entity["Pos"][2]), $entity["Rotation"][0], $entity["Rotation"][1]);
$e->setHealth(1);
}else{
$e = $this->server->api->entity->add($this->levels[$name], ENTITY_MOB, $entity["id"], $entity);
$e->setPosition(new Vector3($entity["Pos"][0], $entity["Pos"][1], $entity["Pos"][2]), $entity["Rotation"][0], $entity["Rotation"][1]);
$e->setHealth($entity["Health"]);
}
}
foreach($tiles->getAll() as $tile){
if(!isset($tile["id"])){
break;
}
$t = $this->server->api->tile->add($this->levels[$name], $tile["id"], $tile["x"], $tile["y"], $tile["z"], $tile);
}
$timeu = microtime(true);
foreach($blockUpdates->getAll() as $bupdate){
$this->server->api->block->scheduleBlockUpdate(new Position((int) $bupdate["x"],(int) $bupdate["y"],(int) $bupdate["z"], $this->levels[$name]), (float) $bupdate["delay"], (int) $bupdate["type"]);
}
return true;
}
public function handle($data, $event){
switch($event){
}
}
public function saveAll(){
foreach($this->levels as $level){
$level->save();
}
}
public function __destruct(){
$this->saveAll();
foreach($this->levels as $level){
$this->unloadLevel($level, true);
}
}
public function getSpawn(){
return $this->server->spawn;
}
public function loadMap(){
if($this->mapName !== false and trim($this->mapName) !== ""){
if(!file_exists($this->mapDir."level.pmf")){
$level = new LevelImport($this->mapDir);
$level->import();
}
$this->level = new PMFLevel($this->mapDir."level.pmf");
console("[INFO] Preparing level \"".$this->level->getData("name")."\"");
$this->time = (int) $this->level->getData("time");
$this->seed = (int) $this->level->getData("seed");
$this->spawn = $this->level->getSpawn();
}
}
}

View File

@ -1,470 +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/
*
*
*/
class PlayerAPI{
private $server;
function __construct(){
$this->server = ServerAPI::request();
}
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] [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");
$this->server->preparedSQL->selectPlayersToHeal = $this->server->database->prepare("SELECT EID FROM entities WHERE class = ".ENTITY_PLAYER." AND health < 20;");
}
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 = $this->server->api->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 = $this->server->api->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;
default:
$message = " died";
break;
}
}
$this->server->api->chat->broadcast($data["player"]->username . $message);
return true;
break;
}
}
public function commandHandler($cmd, $params, $issuer, $alias){
$output = "";
switch($cmd){
case "spawnpoint":
if(!($issuer instanceof Player)){
$output .= "Please run this command in-game.\n";
break;
}
if(count($params) === 1 or count($params) === 4){
$target = $this->server->api->player->get(array_shift($params));
}else{
$target = $issuer;
}
if(!($target instanceof Player)){
$output .= "That player cannot be found.\n";
break;
}
if(count($params) === 3){
$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);
$output .= "Spawnpoint set correctly!\n";
break;
case "spawn":
if(!($issuer instanceof Player)){
$output .= "Please run this command in-game.\n";
break;
}
$issuer->teleport($this->server->spawn);
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;
$gms = array(
"0" => SURVIVAL,
"survival" => SURVIVAL,
"s" => SURVIVAL,
"1" => CREATIVE,
"creative" => CREATIVE,
"c" => CREATIVE,
"2" => ADVENTURE,
"adventure" => ADVENTURE,
"a" => ADVENTURE,
"3" => VIEW,
"view" => VIEW,
"viewer" => VIEW,
"spectator" => VIEW,
"v" => VIEW,
);
if($issuer instanceof Player){
$player = $issuer;
}
if(isset($params[1])){
$player = $this->server->api->player->get($params[1]);
}
if(!($player instanceof Player) or !isset($gms[strtolower($params[0])])){
$output .= "Usage: /$cmd <mode> [player]\n";
break;
}
if($player->setGamemode($gms[strtolower($params[0])])){
$output .= "Gamemode of ".$player->username." 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->username;
$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>\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->username;
$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 = $this->get($params[0]);
}
if($player instanceof Player){
$player->entity->harm(1000, "console", true);
$player->sendChat("Ouch. That looks like it hurt.\n");
}else{
$output .= "Usage: /$cmd [player]\n";
}
break;
case "list":
$output .= "There are ".count($this->server->clients)."/".$this->server->maxClients." players online:\n";
if(count($this->server->clients) == 0){
break;
}
foreach($this->server->clients as $c){
$output .= $c->username.", ";
}
$output = substr($output, 0, -2)."\n";
break;
}
return $output;
}
public function teleport(&$name, &$target){
if(substr($target, 0, 2) === "w:"){
$lv = $this->server->api->level->get(substr($target, 2));
if($lv instanceof Level){
$origin = $this->get($name);
if($origin instanceof Player){
$name = $origin->username;
return $origin->teleport($lv->getSafeSpawn());
}
}else{
return false;
}
}
$player = $this->get($target);
if(($player instanceof Player) and ($player->entity instanceof Entity)){
$target = $player->username;
$origin = $this->get($name);
if($origin instanceof Player){
$name = $origin->username;
return $origin->teleport($player->entity);
}
}
return false;
}
public function tppos(&$name, &$x, &$y, &$z){
$player = $this->get($name);
if(($player instanceof Player) and ($player->entity instanceof Entity)){
$name = $player->username;
$x = $x{0} === "~" ? $player->entity->x + floatval(substr($x, 1)):floatval($x);
$y = $y{0} === "~" ? $player->entity->y + floatval(substr($y, 1)):floatval($y);
$z = $z{0} === "~" ? $player->entity->z + floatval(substr($z, 1)):floatval($z);
$player->teleport(new Vector3($x, $y, $z));
return true;
}
return false;
}
public function get($name, $alike = true){
$name = trim(strtolower($name));
if($name === ""){
return false;
}
$CID = $this->server->query("SELECT ip,port FROM players WHERE name ".($alike === true ? "LIKE '%".$name."%'":"= '".$name."'").";", true);
$CID = PocketMinecraftServer::clientID($CID["ip"], $CID["port"]);
if(isset($this->server->clients[$CID])){
return $this->server->clients[$CID];
}
return false;
}
public function getAll($level = null){
if($level instanceof Level){
$clients = array();
$l = $this->server->query("SELECT EID FROM entities WHERE level = '".$level->getName()."' AND class = '".ENTITY_PLAYER."';");
if($l !== false and $l !== true){
while(($e = $l->fetchArray(SQLITE3_ASSOC)) !== false){
$e = $this->getByEID($e["EID"]);
if($e instanceof Player){
$clients[$e->CID] = $e;
}
}
}
return $clients;
}
return $this->server->clients;
}
public function broadcastPacket(array $players, $id, $data = array()){
$data = new CustomPacketHandler($id, "", $data, true);
$packet = array("raw" => chr($id).$data->raw);
foreach($players as $p){
$p->dataPacket(false, $packet);
}
}
public function getByEID($eid){
$eid = (int) $eid;
$CID = $this->server->query("SELECT ip,port FROM players WHERE EID = '".$eid."';", true);
$CID = PocketMinecraftServer::clientID($CID["ip"], $CID["port"]);
if(isset($this->server->clients[$CID])){
return $this->server->clients[$CID];
}
return false;
}
public function online(){
$o = array();
foreach($this->server->clients as $p){
if($p->auth === true){
$o[] = $p->username;
}
}
return $o;
}
public function add($CID){
if(isset($this->server->clients[$CID])){
$player = $this->server->clients[$CID];
$player->data = $this->getOffline($player->username);
$player->gamemode = $player->data->get("gamemode");
if(($player->level = $this->server->api->level->get($player->data->get("position")["level"])) === false){
$player->level = $this->server->api->level->getDefault();
$player->data->set("position", array(
"level" => $player->level->getName(),
"x" => $player->level->getSpawn()->x,
"y" => $player->level->getSpawn()->y,
"z" => $player->level->getSpawn()->z,
));
}
$this->server->query("INSERT OR REPLACE INTO players (CID, ip, port, name) VALUES (".$player->CID.", '".$player->ip."', ".$player->port.", '".strtolower($player->username)."');");
}
}
public function spawnAllPlayers(Player $player){
foreach($this->getAll() as $p){
if($p !== $player and ($p->entity instanceof Entity)){
$p->entity->spawn($player);
if($p->level !== $player->level){
$player->dataPacket(MC_MOVE_ENTITY_POSROT, array(
"eid" => $p->entity->eid,
"x" => -256,
"y" => 128,
"z" => -256,
"yaw" => 0,
"pitch" => 0,
));
}
}
}
}
public function spawnToAllPlayers(Player $player){
foreach($this->getAll() as $p){
if($p !== $player and ($p->entity instanceof Entity)){
$player->entity->spawn($p);
if($p->level !== $player->level){
$p->dataPacket(MC_MOVE_ENTITY_POSROT, array(
"eid" => $player->entity->eid,
"x" => -256,
"y" => 128,
"z" => -256,
"yaw" => 0,
"pitch" => 0,
));
}
}
}
}
public function remove($CID){
if(isset($this->server->clients[$CID])){
$player = $this->server->clients[$CID];
unset($this->server->clients[$CID]);
$player->close();
if($player->username != "" and ($player->data instanceof Config)){
$this->saveOffline($player->data);
}
$this->server->query("DELETE FROM players WHERE name = '".$player->username."';");
if($player->entity instanceof Entity){
unset($player->entity->player);
unset($player->entity);
}
$this->server->api->entity->remove($player->eid);
$player = null;
unset($player);
}
}
public function getOffline($name){
$iname = strtolower($name);
$default = array(
"caseusername" => $name,
"position" => array(
"level" => $this->server->spawn->level->getName(),
"x" => $this->server->spawn->x,
"y" => $this->server->spawn->y,
"z" => $this->server->spawn->z,
),
"spawn" => array(
"level" => $this->server->spawn->level->getName(),
"x" => $this->server->spawn->x,
"y" => $this->server->spawn->y,
"z" => $this->server->spawn->z,
),
"inventory" => array_fill(0, PLAYER_SURVIVAL_SLOTS, array(AIR, 0, 0)),
"armor" => array_fill(0, 4, array(AIR, 0)),
"gamemode" => $this->server->gamemode,
"health" => 20,
"lastIP" => "",
"lastID" => 0,
);
if(!file_exists(DATA_PATH."players/".$iname.".yml")){
console("[NOTICE] Player data not found for \"".$iname."\", creating new profile");
$data = new Config(DATA_PATH."players/".$iname.".yml", CONFIG_YAML, $default);
$data->save();
}else{
$data = new Config(DATA_PATH."players/".$iname.".yml", CONFIG_YAML, $default);
}
if(($data->get("gamemode") & 0x01) === 1){
$data->set("health", 20);
}
$this->server->handle("player.offline.get", $data);
return $data;
}
public function saveOffline(Config $data){
$this->server->handle("player.offline.save", $data);
$data->save();
}
}

View File

@ -1,208 +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/
*
*
*/
class PluginAPI extends stdClass{
private $server;
private $plugins = array();
public function __construct(){
$this->server = ServerAPI::request();
}
public function getList(){
$list = array();
foreach($this->plugins as $p){
$list[] = $p[1];
}
return $list;
}
public function getInfo($className){
$className = strtolower($className);
if(!isset($this->plugins[$className])){
return false;
}
$plugin = $this->plugins[$className];
return array($plugin[1], get_class_methods($plugin[0]));
}
public function load($file){
if(strtolower(substr($file, -3)) === "pmf"){
$pmf = new PMFPlugin($file);
$info = $pmf->getPluginInfo();
}else{
$content = file_get_contents($file);
$info = strstr($content, "*/", true);
$content = str_repeat(PHP_EOL, substr_count($info, "\n")).substr(strstr($content, "*/"),2);
if(preg_match_all('#([a-zA-Z0-9\-_]*)=([^\r\n]*)#u', $info, $matches) == 0){ //false or 0 matches
console("[ERROR] Failed parsing of ".basename($file));
return false;
}
$info = array();
foreach($matches[1] as $k => $i){
$v = $matches[2][$k];
switch(strtolower($v)){
case "on":
case "true":
case "yes":
$v = true;
break;
case "off":
case "false":
case "no":
$v = false;
break;
}
$info[$i] = $v;
}
$info["code"] = $content;
$info["class"] = trim(strtolower($info["class"]));
}
if(!isset($info["name"]) or !isset($info["version"]) or !isset($info["class"]) or !isset($info["author"])){
console("[ERROR] Failed parsing of ".basename($file));
return false;
}
console("[INFO] Loading plugin \"".FORMAT_GREEN.$info["name"].FORMAT_RESET."\" ".FORMAT_AQUA.$info["version"].FORMAT_RESET." by ".FORMAT_AQUA.$info["author"].FORMAT_RESET);
if($info["class"] !== "none" and class_exists($info["class"])){
console("[ERROR] Failed loading plugin: class already exists");
return false;
}
if(eval($info["code"]) === false or ($info["class"] !== "none" and !class_exists($info["class"]))){
console("[ERROR] Failed loading plugin: evaluation error");
return false;
}
$className = $info["class"];
$apiversion = array_map("intval", explode(",", (string) $info["apiversion"]));
if(!in_array((string) CURRENT_API_VERSION, $apiversion)){
console("[WARNING] Plugin \"".$info["name"]."\" may not be compatible with the API (".$info["apiversion"]." != ".CURRENT_API_VERSION.")! It can crash or corrupt the server!");
}
if($info["class"] !== "none"){
$object = new $className($this->server->api, false);
if(!($object instanceof Plugin)){
console("[ERROR] Plugin \"".$info["name"]."\" doesn't use the Plugin Interface");
if(method_exists($object, "__destruct")){
$object->__destruct();
}
$object = null;
unset($object);
}else{
$this->plugins[$className] = array($object, $info);
}
}else{
$this->plugins[md5($info["name"])] = array(new DummyPlugin($this->server->api, false), $info);
}
}
public function get(Plugin $plugin){
foreach($this->plugins as &$p){
if($p[0] === $plugin){
return $p;
}
}
return false;
}
public function configPath(Plugin $plugin){
$p = $this->get($plugin);
if($p === false){
return false;
}
$path = DATA_PATH."plugins/".$p[1]["name"]."/";
$this->plugins[$p[1]["class"]][1]["path"] = $path;
@mkdir($path);
return $path;
}
public function createConfig(Plugin $plugin, $default = array()){
$p = $this->get($plugin);
if($p === false){
return false;
}
$path = $this->configPath($plugin);
$cnf = new Config($path."config.yml", CONFIG_YAML, $default);
$cnf->save();
return $path;
}
private function fillDefaults($default, &$yaml){
foreach($default as $k => $v){
if(is_array($v)){
if(!isset($yaml[$k]) or !is_array($yaml[$k])){
$yaml[$k] = array();
}
$this->fillDefaults($v, $yaml[$k]);
}elseif(!isset($yaml[$k])){
$yaml[$k] = $v;
}
}
}
public function readYAML($file){
return Spyc::YAMLLoad(file_get_contents($file));
}
public function writeYAML($file, $data){
return file_put_contents($file, Spyc::YAMLDump($data));
}
public function init(){
$this->server->event("server.start", array($this, "initAll"));
$this->loadAll();
}
public function loadAll(){
$dir = dir(DATA_PATH."plugins/");
while(false !== ($file = $dir->read())){
if($file{0} !== "."){
$ext = strtolower(substr($file, -3));
if($ext === "php" or $ext === "pmf"){
$this->load(DATA_PATH."plugins/" . $file);
}
}
}
}
public function initAll(){
console("[INFO] Starting plugins...");
foreach($this->plugins as $p){
$p[0]->init(); //ARGHHH!!! Plugin loading randomly fails!!
}
}
}
interface Plugin{
public function __construct(ServerAPI $api, $server = false);
public function init();
public function __destruct();
}
class DummyPlugin implements Plugin{
public function __construct(ServerAPI $api, $server = false){
}
public function init(){
}
public function __destruct(){
}
}

View File

@ -1,420 +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/
*
*
*/
class ServerAPI{
public $restart = false;
private static $serverRequest = false;
private $asyncCalls = array();
private $server;
private $config;
private $apiList = array();
private $asyncCnt = 0;
private $rcon;
private $query;
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(DATA_PATH."players/", 0755);
@mkdir(DATA_PATH."worlds/", 0755);
@mkdir(DATA_PATH."plugins/", 0755);
$version = new VersionString();
console("[INFO] Starting Minecraft PE server version ".FORMAT_AQUA.CURRENT_MINECRAFT_VERSION);
console("[INFO] Loading properties...");
$this->config = new Config(DATA_PATH . "server.properties", CONFIG_PROPERTIES, array(
"server-name" => "Minecraft: PE Server",
"description" => "Server made using PocketMine-MP",
"motd" => "Welcome @player to this server!",
"server-ip" => "",
"server-port" => 19132,
"server-type" => "normal",
"memory-limit" => "128M",
"last-update" => false,
"white-list" => false,
"spawn-protection" => 16,
"view-distance" => 10,
"max-players" => 20,
"allow-flight" => false,
"spawn-animals" => true,
"spawn-mobs" => true,
"gamemode" => SURVIVAL,
"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),
"send-usage" => true,
"auto-save" => true,
));
$this->parseProperties();
define("DEBUG", $this->getProperty("debug", 1));
if($this->getProperty("port") !== false){
$this->setProperty("server-port", $this->getProperty("port"));
$this->config->remove("port");
$this->config->remove("invisible");
}
$this->server = new PocketMinecraftServer($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() ? FORMAT_YELLOW:"").MAJOR_VERSION.FORMAT_RESET." (MCPE: ".CURRENT_MINECRAFT_VERSION.") (API ".CURRENT_API_VERSION.")", true, true, 0);
console("[INFO] PocketMine-MP is distibuted under the LGPL License", true, true, 0);
if($this->getProperty("upnp-forwarding") === true){
console("[INFO] [UPnP] Trying to port forward...");
UPnP_PortForward($this->getProperty("server-port"));
}
if($this->getProperty("last-update") === false or ($this->getProperty("last-update") + 3600) < time()){
console("[INFO] Checking for new server version");
console("[INFO] Last check: ".FORMAT_AQUA.date("Y-m-d H:i:s", $this->getProperty("last-update"))."\x1b[0m");
$info = json_decode(Utils::curl_get("http://www.pocketmine.net/latest"), true);
if($this->server->version->isDev()){
if($info === false or !isset($info["development"])){
console("[ERROR] PocketMine API error");
}else{
$last = $info["development"]["date"];
if($last >= $this->getProperty("last-update") and $this->getProperty("last-update") !== false and GIT_COMMIT != $info["development"]["commit"]){
console("[NOTICE] ".FORMAT_YELLOW."A new DEVELOPMENT version of PocketMine-MP has been released");
console("[NOTICE] ".FORMAT_YELLOW."Version \"".$info["development"]["version"]."\" [".substr($info["development"]["commit"], 0, 10)."]");
console("[NOTICE] ".FORMAT_YELLOW."Get it at PocketMine.net or ".$info["development"]["download"]);
console("[NOTICE] This message will dissapear after issuing the command \"/update-done\"");
}else{
$this->setProperty("last-update", time());
console("[INFO] ".FORMAT_AQUA."This is the latest DEVELOPMENT version");
}
}
}else{
if($info === false or !isset($info["stable"])){
console("[ERROR] PocketMine API error");
}else{
$newest = new VersionString(MAJOR_VERSION);
$newestN = $newest->getNumber();
$update = new VersionString($info["stable"]["version"]);
$updateN = $update->getNumber();
if($updateN > $newestN){
console("[NOTICE] ".FORMAT_GREEN."A new STABLE version of PocketMine-MP has been released");
console("[NOTICE] ".FORMAT_GREEN."Version \"".$info["stable"]["version"]."\" #".$updateN);
console("[NOTICE] Get it at PocketMine.net or ".$info["stable"]["download"]);
console("[NOTICE] This message will dissapear as soon as you update");
}else{
$this->setProperty("last-update", time());
console("[INFO] ".FORMAT_AQUA."This is the latest STABLE version");
}
}
}
}
$this->loadProperties();
$this->loadAPI("console", "ConsoleAPI");
$this->loadAPI("level", "LevelAPI");
$this->loadAPI("block", "BlockAPI");
$this->loadAPI("chat", "ChatAPI");
$this->loadAPI("ban", "BanAPI");
$this->loadAPI("entity", "EntityAPI");
$this->loadAPI("tile", "TileAPI");
$this->loadAPI("player", "PlayerAPI");
$this->loadAPI("time", "TimeAPI");
foreach($this->apiList as $ob){
if(is_callable(array($ob, "init"))){
$ob->init(); //Fails sometimes!!!
}
}
$this->loadAPI("plugin", "PluginAPI"); //fix :(
$this->plugin->init();
}
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 autoSave(){
console("[DEBUG] Saving....", true, true, 2);
$this->server->api->level->saveAll();
}
public function sendUsage(){
console("[DEBUG] Sending usage data...", true, true, 2);
$plist = "";
foreach($this->plugin->getList() as $p){
$plist .= str_replace(array(";", ":"), "", $p["name"]).":".str_replace(array(";", ":"), "", $p["version"]).";";
}
$this->asyncOperation(ASYNC_CURL_POST, array(
"url" => "http://stats.pocketmine.net/usage.php",
"data" => array(
"serverid" => $this->server->serverID,
"port" => $this->server->port,
"os" => Utils::getOS(),
"memory_total" => $this->getProperty("memory-limit"),
"memory_usage" => memory_get_usage(true),
"php_version" => PHP_VERSION,
"version" => MAJOR_VERSION,
"mc_version" => CURRENT_MINECRAFT_VERSION,
"protocol" => CURRENT_PROTOCOL,
"online" => count($this->server->clients),
"max" => $this->server->maxClients,
"plugins" => $plist,
),
), NULL);
}
public function __destruct(){
foreach($this->apiList as $i => $ob){
if(method_exists($ob, "__destruct")){
$ob->__destruct();
unset($this->apiList[$i]);
}
}
}
private function loadProperties(){
if(($memory = str_replace("B", "", strtoupper($this->getProperty("memory-limit")))) !== false){
$value = array("M" => 1, "G" => 1024);
$real = ((int) substr($memory, 0, -1)) * $value[substr($memory, -1)];
if($real < 128){
console("[WARNING] PocketMine-MP may not work right with less than 128MB of RAM", true, true, 0);
}
@ini_set("memory_limit", $memory);
}else{
$this->setProperty("memory-limit", "128M");
}
if($this->server instanceof PocketMinecraftServer){
$this->server->setType($this->getProperty("server-type"));
$this->server->maxClients = $this->getProperty("max-players");
$this->server->description = $this->getProperty("description");
$this->server->motd = $this->getProperty("motd");
$this->server->gamemode = $this->getProperty("gamemode");
$this->server->difficulty = $this->getProperty("difficulty");
$this->server->whitelist = $this->getProperty("white-list");
$this->server->reloadConfig();
}
}
private function writeProperties(){
$this->config->save();
}
private function parseProperties(){
foreach($this->config->getAll() as $n => $v){
switch($n){
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;
case "server-id":
if($v !== false){
$v = preg_match("/[^0-9\-]/", $v) > 0 ? Utils::readInt(substr(md5($v, true), 0, 4)):$v;
}
break;
}
$this->config->set($n, $v);
}
if($this->getProperty("hardcore") == 1 and $this->getProperty("difficulty") < 3){
$this->setProperty("difficulty", 3);
}
}
public function init(){
if($this->getProperty("send-usage") !== 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 Query();
}
CraftingRecipes::init();
$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){
if(($v = arg($name)) !== false){ //Allow for command-line arguments
switch(strtolower(trim($v))){
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":
case "time-per-second":
$v = (int) $v;
break;
case "server-id":
if($v !== false){
$v = preg_match("/[^0-9\-]/", $v) > 0 ? Utils::readInt(substr(md5($v, true), 0, 4)):$v;
}
break;
}
return $v;
}
return ($this->config->exists($name) ? $this->config->get($name):$default);
}
public function setProperty($name, $value){
$this->config->set($name, $value);
$this->writeProperties();
$this->loadProperties();
}
public function getList(){
return $this->apiList;
}
public function loadAPI($name, $class, $dir = false){
if(isset($this->$name)){
return false;
}elseif(!class_exists($class)){
$internal = false;
if($dir === false){
$internal = true;
$dir = FILE_PATH."src/API/";
}
$file = $dir.$class.".php";
if(!file_exists($file)){
console("[ERROR] API ".$name." [".$class."] in ".$dir." doesn't exist", true, true, 0);
return false;
}
require_once($file);
}else{
$internal = true;
}
$this->$name = new $class();
$this->apiList[] = $this->$name;
console("[".($internal === true ? "INTERNAL":"DEBUG")."] API \x1b[36m".$name."\x1b[0m [\x1b[30;1m".$class."\x1b[0m] loaded", true, true, ($internal === true ? 3:2));
}
}

View File

@ -1,116 +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/
*
*
*/
class TileAPI{
private $server;
private $tiles;
private $tCnt = 1;
function __construct(){
$this->tiles = array();
$this->server = ServerAPI::request();
}
public function get(Position $pos){
$tile = $this->server->query("SELECT * FROM tiles WHERE level = '".$pos->level->getName()."' AND x = {$pos->x} AND y = {$pos->y} AND z = {$pos->z};", true);
if($tile !== false and $tile !== true and ($tile = $this->getByID($tile["ID"])) !== false){
return $tile;
}
return false;
}
public function getByID($id){
if($id instanceof Tile){
return $id;
}elseif(isset($this->tiles[$id])){
return $this->tiles[$id];
}
return false;
}
public function init(){
}
public function getAll($level = null){
if($level instanceof Level){
$tiles = array();
$l = $this->server->query("SELECT ID FROM tiles WHERE level = '".$level->getName()."';");
if($l !== false and $l !== true){
while(($t = $l->fetchArray(SQLITE3_ASSOC)) !== false){
$t = $this->getByID($t["ID"]);
if($t instanceof Tile){
$tiles[$t->id] = $t;
}
}
}
return $tiles;
}
return $this->tiles;
}
public function add(Level $level, $class, $x, $y, $z, $data = array()){
$id = $this->tCnt++;
$this->tiles[$id] = new Tile($level, $id, $class, $x, $y, $z, $data);
$this->spawnToAll($this->tiles[$id]);
return $this->tiles[$id];
}
public function addSign(Level $level, $x, $y, $z, $lines = array("", "", "", "")){
return $this->add($level, TILE_SIGN, $x, $y, $z, $data = array(
"id" => "Sign",
"x" => $x,
"y" => $y,
"z" => $z,
"Text1" => $lines[0],
"Text2" => $lines[1],
"Text3" => $lines[2],
"Text4" => $lines[3],
));
}
public function spawnToAll(Tile $t){
foreach($this->server->api->player->getAll($t->level) as $player){
if($player->eid !== false){
$t->spawn($player);
}
}
}
public function spawnAll(Player $player){
foreach($this->getAll($player->level) as $t){
$t->spawn($player);
}
}
public function remove($id){
if(isset($this->tiles[$id])){
$t = $this->tiles[$id];
$this->tiles[$id] = null;
unset($this->tiles[$id]);
$t->closed = true;
$t->close();
$this->server->query("DELETE FROM tiles WHERE ID = ".$id.";");
$this->server->api->dhandle("tile.remove", $t);
$t = null;
unset($t);
}
}
}

View File

@ -1,131 +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/
*
*
*/
class TimeAPI{
public static $phases = array(
"day" => 0,
"sunset" => 9500,
"night" => 10900,
"sunrise" => 17800,
);
private $server;
function __construct(){
$this->server = ServerAPI::request();
}
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 = $this->server->api->level->getDefault();
}
return $raw === true ? $level->getTime():abs($level->getTime()) % 19200;
}
public function add($time, $level = false){
if(!($level instanceof Level)){
$level = $this->server->api->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 = $this->server->api->level->getDefault();
}
if(is_string($time) and isset(TimeAPI::$phases[$time])){
$level->setTime(TimeAPI::$phases[$time]);
}else{
$level->setTime((int) $time);
}
return $level->getTime();
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,675 +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/
*
*
*/
class PocketMinecraftServer{
public $tCnt;
public $serverID, $interface, $database, $version, $invisible, $api, $tickMeasure, $preparedSQL, $seed, $gamemode, $name, $maxClients, $clients, $eidCnt, $custom, $description, $motd, $port, $saveEnabled;
private $serverip, $evCnt, $handCnt, $events, $eventsID, $handlers, $serverType, $lastTick, $ticks, $memoryStats, $async = array(), $asyncID = 0;
private function load(){
$this->version = new VersionString();
/*if(defined("DEBUG") and DEBUG >= 0){
@cli_set_process_title("PocketMine-MP ".MAJOR_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(Utils::getRandomBytes(8, false)):$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->levelData = false;
$this->difficulty = 1;
$this->tiles = array();
$this->entities = array();
$this->custom = array();
$this->evCnt = 1;
$this->handCnt = 1;
$this->eidCnt = 1;
$this->maxClients = 20;
$this->schedule = array();
$this->scheduleCnt = 1;
$this->description = "";
$this->whitelist = false;
$this->memoryStats = array();
$this->clients = array();
$this->spawn = false;
$this->saveEnabled = true;
$this->tickMeasure = array_fill(0, 40, 0);
$this->setType("normal");
$this->interface = new MinecraftInterface($this, "255.255.255.255", $this->port, true, false, $this->serverip);
$this->reloadConfig();
$this->stop = false;
$this->ticks = 0;
if(!defined("NO_THREADS")){
$this->asyncThread = new AsyncMultipleQueue();
}
}
function __construct($name, $gamemode = SURVIVAL, $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;
$this->load();
}
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("DEBUG") and DEBUG >= 0 and ENABLE_ANSI === true){
echo "\x1b]0;PocketMine-MP ".MAJOR_VERSION." | Online ". count($this->clients)."/".$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(ENABLE_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, 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:");
$this->query("PRAGMA journal_mode = OFF;");
$this->query("PRAGMA encoding = \"UTF-8\";");
$this->query("PRAGMA secure_delete = OFF;");
$this->query("CREATE TABLE players (CID INTEGER PRIMARY KEY, EID NUMERIC, ip TEXT, port NUMERIC, name TEXT UNIQUE COLLATE NOCASE);");
$this->query("CREATE TABLE entities (EID INTEGER PRIMARY KEY, level TEXT, type NUMERIC, class NUMERIC, hasUpdate NUMERIC, name TEXT, x NUMERIC, y NUMERIC, z NUMERIC, yaw NUMERIC, pitch NUMERIC, health NUMERIC);");
$this->query("CREATE TABLE tiles (ID INTEGER PRIMARY KEY, level TEXT, class TEXT, x NUMERIC, y NUMERIC, z NUMERIC, spawnable NUMERIC);");
$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;");
$this->preparedSQL->entity->setPosition = $this->database->prepare("UPDATE entities SET x = :x, y = :y, z = :z, pitch = :pitch, yaw = :yaw WHERE EID = :eid ;");
$this->preparedSQL->entity->setLevel = $this->database->prepare("UPDATE entities SET level = :level WHERE EID = :eid ;");
}
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 reloadConfig(){
}
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"] = $this->query("SELECT count(EID) as count FROM entities;", true);
$info["entities"] = $info["entities"]["count"];
$info["players"] = $this->query("SELECT count(CID) as count FROM players;", true);
$info["players"] = $info["players"]["count"];
$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;
}
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){
$this->api->chat->broadcast("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;
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;
}
$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]);
}
}
public function addHandler($event,callable $callable, $priority = 5){
if(!is_callable($callable)){
return false;
}elseif(isset(Deprecation::$events[$event])){
$sub = "";
if(Deprecation::$events[$event] !== false){
$sub = " Substitute \"".Deprecation::$events[$event]."\" found.";
}
console("[ERROR] Event \"$event\" has been deprecated.$sub [Adding handle to ".(is_array($callable) ? get_class($callable[0])."::".$callable[1]:$callable)."]");
}
$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){
$called[$hnid] = 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;
}
}
}elseif(isset(Deprecation::$events[$event])){
$sub = "";
if(Deprecation::$events[$event] !== false){
$sub = " Substitute \"".Deprecation::$events[$event]."\" found.";
}
console("[ERROR] Event \"$event\" has been deprecated.$sub [Handler]");
}
if($result !== false){
$this->trigger($event, $data);
}
return $result;
}
public function eventHandler($data, $event){
switch($event){
}
}
public function getGamemode(){
switch($this->gamemode){
case SURVIVAL:
return "survival";
case CREATIVE:
return "creative";
case ADVENTURE:
return "adventure";
case VIEW:
return "view";
}
}
public function init(){
register_tick_function(array($this, "tick"));
console("[DEBUG] Starting internal ticker calculation", true, true, 2);
$t = 0;
while(true){
switch($t){
case 0:
declare(ticks=100);
break;
case 1:
declare(ticks=60);
break;
case 2:
declare(ticks=40);
break;
case 3:
declare(ticks=30);
break;
case 4:
declare(ticks=20);
break;
case 5:
declare(ticks=15);
break;
default:
declare(ticks=10);
break;
}
if($t > 5){
break;
}
$this->ticks = 0;
while($this->ticks < 20){
usleep(1);
}
if($this->getTPS() < 19.5){
++$t;
}else{
break;
}
}
$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) - START_TIME, 3).'s)! For help, type "help" or "?"');
$this->process();
}
public function dumpError(){
if($this->stop === true){
return;
}
console("[ERROR] 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();
$dump .= "Error: ".var_export($er, true)."\r\n\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";
$version = new VersionString();
$dump .= "PM Version: ".$version." #".$version->getNumber()." [Protocol ".CURRENT_PROTOCOL."]\r\n";
$dump .= "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($this->api->plugin instanceof PluginAPI){
$plist = $this->api->plugin->getList();
$dump .= "Loaded plugins:\r\n";
foreach($plist as $p){
$dump .= $p["name"]." ".$p["version"]." by ".$p["author"]."\r\n";
}
$dump .= "\r\n\r\n";
}
$dump .= "Loaded Modules: ".var_export(get_loaded_extensions(), true)."\r\n";
$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");
logg($dump, $name, true, 0, true);
console("[ERROR] 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;
$this->tickerFunction($time);
}
}
public static function clientID($ip, $port){
//faster than string indexes in PHP
return crc32($ip . $port) ^ crc32($port . $ip . BOOTUP_RANDOM);
}
public function packetHandler($packet){
$data =& $packet["data"];
$CID = PocketMinecraftServer::clientID($packet["ip"], $packet["port"]);
if(isset($this->clients[$CID])){
$this->clients[$CID]->handlePacket($packet["pid"], $data);
}else{
if($this->handle("server.noauthpacket", $packet) === false){
return;
}
switch($packet["pid"]){
case 0x01:
case 0x02:
if($this->invisible === true){
$this->send(0x1c, array(
$data[0],
$this->serverID,
RAKNET_MAGIC,
$this->serverType,
), false, $packet["ip"], $packet["port"]);
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));
$this->send(0x1c, array(
$data[0],
$this->serverID,
RAKNET_MAGIC,
$this->serverType. $this->name . " [".count($this->clients)."/".$this->maxClients."] ".$txt,
), false, $packet["ip"], $packet["port"]);
$this->custom["times_".$CID] = ($this->custom["times_".$CID] + 1) % strlen($this->description);
break;
case 0x05:
$version = $data[1];
$size = strlen($data[2]);
if($version !== CURRENT_STRUCTURE){
console("[DEBUG] Incorrect structure #$version from ".$packet["ip"].":".$packet["port"], true, true, 2);
$this->send(0x1a, array(
CURRENT_STRUCTURE,
RAKNET_MAGIC,
$this->serverID,
), false, $packet["ip"], $packet["port"]);
}else{
$this->send(0x06, array(
RAKNET_MAGIC,
$this->serverID,
0,
strlen($packet["raw"]),
), false, $packet["ip"], $packet["port"]);
}
break;
case 0x07:
if($this->invisible === true){
break;
}
$port = $data[2];
$MTU = $data[3];
$clientID = $data[4];
if(count($this->clients) < $this->maxClients){
$this->clients[$CID] = new Player($clientID, $packet["ip"], $packet["port"], $MTU); //New Session!
$this->send(0x08, array(
RAKNET_MAGIC,
$this->serverID,
$this->port,
$data[3],
0,
), false, $packet["ip"], $packet["port"]);
}
break;
}
}
}
public function send($pid, $data = array(), $raw = false, $dest = false, $port = false){
return $this->interface->writePacket($pid, $data, $raw, $dest, $port);
}
public function process(){
$lastLoop = 0;
while($this->stop === false){
$packet = $this->interface->readPacket();
if($packet !== false){
$this->packetHandler($packet);
$lastLoop = 0;
}else{
++$lastLoop;
if($lastLoop < 16){
usleep(1);
}elseif($lastLoop < 128){
usleep(100);
}elseif($lastLoop < 256){
usleep(512);
}else{
usleep(10000);
}
}
}
}
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);
}
}
}elseif(isset(Deprecation::$events[$event])){
$sub = "";
if(Deprecation::$events[$event] !== false){
$sub = " Substitute \"".Deprecation::$events[$event]."\" found.";
}
console("[ERROR] Event \"$event\" has been deprecated.$sub [Trigger]");
}
}
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();
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();
$schedule = $this->schedule[$cid];
if(!is_callable($schedule[0])){
$return = false;
}else{
$return = call_user_func($schedule[0], $schedule[1], $schedule[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();
}
}
public function event($event,callable $func){
if(!is_callable($func)){
return false;
}elseif(isset(Deprecation::$events[$event])){
$sub = "";
if(Deprecation::$events[$event] !== false){
$sub = " Substitute \"".Deprecation::$events[$event]."\" found.";
}
console("[ERROR] Event \"$event\" has been deprecated.$sub [Attach to ".(is_array($func) ? get_class($func[0])."::".$func[1]:$func)."]");
}
$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,280 +0,0 @@
#!/bin/bash
COMPILER_VERSION="0.13"
PHP_VERSION="5.5.3"
ZEND_VM="GOTO"
LIBEDIT_VERSION="0.3"
ZLIB_VERSION="1.2.8"
PTHREADS_VERSION="0.0.44"
CURL_VERSION="curl-7_32_0"
echo "[PocketMine] PHP installer and compiler for Linux & Mac"
DIR="$(pwd)"
date > "$DIR/install.log" 2>&1
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 || { echo >&2 "[ERROR] Please install \"wget\""; read -p "Press [Enter] to continue..."; exit 1; }
export CC="gcc"
COMPILE_FOR_ANDROID=no
RANLIB=ranlib
if [ "$1" == "rpi" ]; then
[ -z "$march" ] && march=armv6zk;
[ -z "$mtune" ] && mtune=arm1176jzf-s;
[ -z "$CFLAGS" ] && CFLAGS="-mfloat-abi=hard -mfpu=vfp";
echo "[INFO] Compiling for Raspberry Pi ARMv6zk hard float"
elif [ "$1" == "mac" ]; then
[ -z "$march" ] && march=prescott;
[ -z "$mtune" ] && mtune=generic;
[ -z "$CFLAGS" ] && CFLAGS="-fomit-frame-pointer";
echo "[INFO] Compiling for Intel MacOS"
elif [ "$1" == "crosscompile" ]; then
if [ "$2" == "android" ] || [ "$2" == "android-armv6" ]; then
COMPILE_FOR_ANDROID=yes
[ -z "$march" ] && march=armv6;
[ -z "$mtune" ] && mtune=generic;
TOOLCHAIN_PREFIX="arm-none-linux-gnueabi"
export CC="$TOOLCHAIN_PREFIX-gcc"
CONFIGURE_FLAGS="--host=$TOOLCHAIN_PREFIX"
[ -z "$CFLAGS" ] && CFLAGS="-uclibc";
echo "[INFO] Cross-compiling for Android ARMv6"
elif [ "$2" == "android-armv7" ]; then
COMPILE_FOR_ANDROID=yes
[ -z "$march" ] && march=armv7a;
[ -z "$mtune" ] && mtune=generic-armv7-a;
TOOLCHAIN_PREFIX="arm-none-linux-gnueabi"
export CC="$TOOLCHAIN_PREFIX-gcc"
CONFIGURE_FLAGS="--host=$TOOLCHAIN_PREFIX"
[ -z "$CFLAGS" ] && CFLAGS="-uclibc";
echo "[INFO] Cross-compiling for Android ARMv7"
elif [ "$2" == "rpi" ]; then
TOOLCHAIN_PREFIX="arm-linux-gnueabihf"
[ -z "$march" ] && march=armv6zk;
[ -z "$mtune" ] && mtune=arm1176jzf-s;
[ -z "$CFLAGS" ] && CFLAGS="-mfloat-abi=hard -mfpu=vfp";
export CC="$TOOLCHAIN_PREFIX-gcc"
CONFIGURE_FLAGS="--host=$TOOLCHAIN_PREFIX"
[ -z "$CFLAGS" ] && CFLAGS="-uclibc";
echo "[INFO] Cross-compiling for Raspberry Pi ARMv6zk hard float"
elif [ "$2" == "mac" ]; then
[ -z "$march" ] && march=prescott;
[ -z "$mtune" ] && mtune=generic;
[ -z "$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
echo "[INFO] Cross-compiling for Intel MacOS"
else
echo "Please supply a proper platform [android android-armv6 android-armv7 rpi mac] to cross-compile"
exit 1
fi
else
echo "[INFO] Compiling for current machine"
fi
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 "$CONFIGURE_FLAGS" ] && CONFIGURE_FLAGS="";
$CC -O3 -march=$march -mtune=$mtune -fno-gcse $CFLAGS -Q --help=target >> "$DIR/install.log" 2>&1
if [ $? -ne 0 ]; then
$CC -O3 -fno-gcse $CFLAGS -Q --help=target >> "$DIR/install.log" 2>&1
if [ $? -ne 0 ]; then
export CFLAGS="-O3 -fno-gcse "
else
export CFLAGS="-O3 -fno-gcse $CFLAGS"
fi
else
export CFLAGS="-O3 -march=$march -mtune=$mtune -fno-gcse $CFLAGS"
fi
rm -r -f install_data/ >> "$DIR/install.log" 2>&1
rm -r -f php5/ >> "$DIR/install.log" 2>&1
rm -r -f bin/ >> "$DIR/install.log" 2>&1
mkdir -m 0777 install_data >> "$DIR/install.log" 2>&1
mkdir -m 0777 php5 >> "$DIR/install.log" 2>&1
mkdir -m 0777 bin >> "$DIR/install.log" 2>&1
cd install_data
set -e
#PHP 5
echo -n "[PHP] downloading $PHP_VERSION..."
wget http://php.net/get/php-$PHP_VERSION.tar.gz/from/this/mirror -q -O - | tar -zx >> "$DIR/install.log" 2>&1
mv php-$PHP_VERSION php
echo " done!"
if [ 1 ] || [ "$1" == "crosscompile" ] || [ "$1" == "rpi" ]; then
HAVE_LIBEDIT="--without-libedit"
else
#libedit
echo -n "[libedit] downloading $LIBEDIT_VERSION..."
wget http://download.sourceforge.net/project/libedit/libedit/libedit-$LIBEDIT_VERSION/libedit-$LIBEDIT_VERSION.tar.gz -q -O - | tar -zx >> "$DIR/install.log" 2>&1
echo -n " checking..."
cd libedit
./configure --prefix="$DIR/install_data/php/ext/libedit" --enable-static >> "$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_LIBEDIT="--with-libedit=\"$DIR/install_data/php/ext/libedit\""
else
echo -n " disabling..."
HAVE_LIBEDIT="--without-libedit"
fi
echo -n " cleaning..."
cd ..
rm -r -f ./libedit
echo " done!"
fi
#zlib
echo -n "[zlib] downloading $ZLIB_VERSION..."
wget http://zlib.net/zlib-$ZLIB_VERSION.tar.gz -q -O - | tar -zx >> "$DIR/install.log" 2>&1
mv zlib-$ZLIB_VERSION zlib
echo -n " checking..."
cd zlib
RANLIB=$RANLIB ./configure --prefix="$DIR/install_data/php/ext/zlib" \
--static >> "$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
echo " done!"
if [ "$(uname -s)" == "Darwin" ] && [ "$1" != "crosscompile" ] && [ "$2" != "curl" ]; then
HAVE_CURL="shared,/usr/local"
else
#curl
echo -n "[cURL] downloading $CURL_VERSION..."
wget https://github.com/bagder/curl/archive/$CURL_VERSION.tar.gz --no-check-certificate -q -O - | tar -zx >> "$DIR/install.log" 2>&1
mv curl-$CURL_VERSION curl
echo -n " checking..."
cd curl
./buildconf >> "$DIR/install.log" 2>&1
./configure --enable-ipv6 \
--enable-optimize \
--enable-http \
--enable-ftp \
--disable-dict \
--enable-file \
--disable-gopher \
--disable-imap \
--disable-pop3 \
--disable-rtsp \
--disable-smtp \
--disable-telnet \
--disable-tftp \
--prefix="$DIR/install_data/php/ext/curl" \
--disable-shared \
$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/install_data/php/ext/curl"
fi
#pthreads
echo -n "[PHP pthreads] downloading $PTHREADS_VERSION..."
wget http://pecl.php.net/get/pthreads-$PTHREADS_VERSION.tgz --no-check-certificate -q -O - | tar -zx >> "$DIR/install.log" 2>&1
mv pthreads-$PTHREADS_VERSION "$DIR/install_data/php/ext/pthreads"
echo " done!"
echo -n "[PHP]"
set +e
if which free >/dev/null; then
MAX_MEMORY=$(free -m | awk '/^Mem:/{print $2}')
else
MAX_MEMORY=$(top -l 1 | grep PhysMem: | awk '{print $10}' | tr -d 'a-zA-Z')
fi
if [ $MAX_MEMORY -gt 512 ] && [ "$1" != "crosscompile" ]; then
echo -n " enabling optimizations..."
OPTIMIZATION="--enable-inline-optimization "
else
OPTIMIZATION="--disable-inline-optimization "
fi
set -e
echo -n " checking..."
cd php
rm -rf ./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 [ "$1" == "crosscompile" ]; then
sed -i 's/pthreads_working=no/pthreads_working=yes/' ./configure
export LIBS="-lpthread -ldl"
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-opcache=no"
fi
./configure $OPTIMIZATION--prefix="$DIR/php5" \
--exec-prefix="$DIR/php5" \
--with-curl="$HAVE_CURL" \
--with-zlib="$DIR/install_data/php/ext/zlib" \
$HAVE_LIBEDIT \
--disable-libxml \
--disable-xml \
--disable-dom \
--disable-simplexml \
--disable-xmlreader \
--disable-xmlwriter \
--disable-cgi \
--disable-session \
--disable-zip \
--disable-debug \
--disable-phar \
--enable-ctype \
--enable-sockets \
--enable-shared=no \
--enable-static=yes \
--enable-shmop \
--enable-pcntl \
--enable-pthreads \
--enable-maintainer-zts \
--enable-zend-signals \
--enable-embedded-mysqli \
--enable-bcmath \
--enable-cli \
--without-pear \
--without-iconv \
--disable-pdo \
--without-pdo-sqlite \
--with-zend-vm=$ZEND_VM \
$CONFIGURE_FLAGS >> "$DIR/install.log" 2>&1
echo -n " compiling..."
if [ $COMPILE_FOR_ANDROID == "yes" ]; then
sed -i 's/-export-dynamic/-all-static/g' Makefile
fi
make -j $THREADS >> "$DIR/install.log" 2>&1
echo -n " installing..."
make install >> "$DIR/install.log" 2>&1
echo " done!"
cd "$DIR"
echo -n "[INFO] Cleaning up..."
rm -r -f install_data/ >> "$DIR/install.log" 2>&1
mv php5/bin/php bin/php
rm -r -f php5/ >> "$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 works, please send the \"install.log\" file to the Bug Tracker"

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/
*
*
*/
set_time_limit(0);
date_default_timezone_set("GMT");
if(strpos(" ".strtoupper(php_uname("s")), " WIN") !== false){
$time = time();
$time -= $time % 60;
exec("time.exe /T", $hour);
$i = array_map("intval", explode(":", trim($hour[0])));
exec("date.exe /T", $date);
$j = array_map("intval", explode("/", 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");
if($daylight === 0){
$offset -= 3600;
}
date_default_timezone_set(timezone_name_from_abbr("", $offset, $daylight));
gc_enable();
error_reporting(E_ALL ^ E_NOTICE);
ini_set("allow_url_fopen", 1);
ini_set("display_errors", 1);
ini_set("display_startup_errors", 1);
ini_set("default_charset", "utf-8");
if(defined("POCKETMINE_COMPILE") and POCKETMINE_COMPILE === true){
define("FILE_PATH", realpath(dirname(__FILE__))."/");
}else{
define("FILE_PATH", realpath(dirname(__FILE__)."/../")."/");
}
set_include_path(get_include_path() . PATH_SEPARATOR . FILE_PATH);
ini_set("memory_limit", "128M"); //Default
define("LOG", true);
define("START_TIME", microtime(true));
define("MAJOR_VERSION", "Alpha_1.3.9");
define("CURRENT_MINECRAFT_VERSION", "0.7.5 alpha");
define("CURRENT_API_VERSION", 10);
define("CURRENT_PHP_VERSION", "5.5");
$gitsha1 = false;
if(file_exists(FILE_PATH.".git/refs/heads/master")){ //Found Git information!
define(GIT_COMMIT, strtolower(trim(file_get_contents(FILE_PATH.".git/refs/heads/master"))));
}else{ //Unknown :(
define(GIT_COMMIT, str_repeat("00", 20));
}

View File

@ -1,158 +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/
*
*
*/
define("AIR", 0);
define("STONE", 1);
define("GRASS", 2);
define("DIRT", 3);
define("COBBLESTONE", 4);
define("COBBLE", 4);
define("PLANK", 5);
define("PLANKS", 5);
define("WOODEN_PLANK", 5);
define("WOODEN_PLANKS", 5);
define("SAPLING", 6);
define("SAPLINGS", 6);
define("BEDROCK", 7);
define("WATER", 8);
define("STILL_WATER", 9);
define("LAVA", 10);
define("STILL_LAVA", 11);
define("SAND", 12);
define("GRAVEL", 13);
define("GOLD_ORE", 14);
define("IRON_ORE", 15);
define("COAL_ORE", 16);
define("WOOD", 17);
define("TRUNK", 17);
define("LEAVES", 18);
define("LEAVE", 18);
define("GLASS", 20);
define("LAPIS_ORE", 21);
define("LAPIS_BLOCK", 22);
define("SANDSTONE", 24);
define("BED_BLOCK", 26);
define("COBWEB", 30);
define("TALL_GRASS", 31);
define("BUSH", 32);
define("DEAD_BUSH", 32);
define("WOOL", 35);
define("DANDELION", 37);
define("ROSE", 38);
define("CYAN_FLOWER", 38);
define("BROWN_MUSHROOM", 39);
define("RED_MUSHROOM", 40);
define("GOLD_BLOCK", 41);
define("IRON_BLOCK", 42);
define("DOUBLE_SLAB", 43);
define("DOUBLE_SLABS", 43);
define("SLAB", 44);
define("SLABS", 44);
define("BRICKS", 45);
define("BRICKS_BLOCK", 45);
define("TNT", 46);
define("BOOKSHELF", 47);
define("MOSS_STONE", 48);
define("MOSSY_STONE", 48);
define("OBSIDIAN", 49);
define("TORCH", 50);
define("FIRE", 51);
define("WOOD_STAIRS", 53);
define("WOODEN_STAIRS", 53);
define("CHEST", 54);
define("DIAMOND_ORE", 56);
define("DIAMOND_BLOCK", 57);
define("CRAFTING_TABLE", 58);
define("WORKBENCH", 58);
define("WHEAT_BLOCK", 59);
define("FARMLAND", 60);
define("FURNACE", 61);
define("BURNING_FURNACE", 62);
define("LIT_FURNACE", 62);
define("SIGN_POST", 63);
define("DOOR_BLOCK", 64);
define("WOODEN_DOOR_BLOCK", 64);
define("WOOD_DOOR_BLOCK", 64);
define("LADDER", 65);
define("COBBLE_STAIRS", 67);
define("COBBLESTONE_STAIRS", 67);
define("WALL_SIGN", 68);
define("IRON_DOOR_BLOCK", 71);
define("REDSTONE_ORE", 73);
define("GLOWING_REDSTONE_ORE", 74);
define("LIT_REDSTONE_ORE", 74);
define("SNOW", 78);
define("SNOW_LAYER", 78);
define("ICE", 79);
define("SNOW_BLOCK", 80);
define("CACTUS", 81);
define("CLAY_BLOCK", 82);
define("REEDS", 83);
define("SUGARCANE_BLOCK", 83);
define("FENCE", 85);
define("NETHERRACK", 87);
define("SOUL_SAND", 88);
define("GLOWSTONE", 89);
define("GLOWSTONE_BLOCK", 89);
define("CAKE_BLOCK", 92);
define("TRAPDOOR", 96);
define("STONE_BRICKS", 98);
define("STONE_BRICK", 98);
define("GLASS_PANE", 102);
define("GLASS_PANEL", 102);
define("MELON_BLOCK", 103);
define("MELON_STEM", 105);
define("FENCE_GATE", 107);
define("BRICK_STAIRS", 108);
define("STONE_BRICK_STAIRS", 109);
define("NETHER_BRICKS", 112);
define("NETHER_BRICK_BLOCK", 112);
define("NETHER_BRICKS_STAIRS", 114);
define("SANDSTONE_STAIRS", 128);
define("QUARTZ_BLOCK", 155);
define("QUARTZ_STAIRS", 156);
define("STONECUTTER", 245);
define("GLOWING_OBSIDIAN", 246);
define("NETHER_REACTOR", 247);

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/
*
*
*/
define("PMF_LEVEL_DEFLATE_LEVEL", 6);
//Gamemodes
define("SURVIVAL", 0);
define("CREATIVE", 1);
define("ADVENTURE", 2);
define("VIEW", 3);
define("VIEWER", 3);
//Players
define("MAX_CHUNK_RATE", 20 / arg("max-chunks-per-second", 4)); //Default rate ~256 kB/s
define("PLAYER_MAX_QUEUE", 1024);
define("PLAYER_SURVIVAL_SLOTS", 36);
define("PLAYER_CREATIVE_SLOTS", 112);
//Block Updates
define("BLOCK_UPDATE_NORMAL", 1);
define("BLOCK_UPDATE_RANDOM", 2);
define("BLOCK_UPDATE_SCHEDULED", 3);
define("BLOCK_UPDATE_WEAK", 4);
define("BLOCK_UPDATE_TOUCH", 5);
//Entities
define("ENTITY_PLAYER", 1);
define("ENTITY_MOB", 2);
define("MOB_CHICKEN", 10);
define("MOB_COW", 11);
define("MOB_PIG", 12);
define("MOB_SHEEP", 13);
define("MOB_ZOMBIE", 32);
define("MOB_CREEPER", 33);
define("MOB_SKELETON", 34);
define("MOB_SPIDER", 35);
define("MOB_PIGMAN", 36);
define("ENTITY_OBJECT", 3);
define("OBJECT_ARROW", 80);
define("OBJECT_PAINTING", 83);
define("ENTITY_ITEM", 4);
define("ENTITY_FALLING", 5);
define("FALLING_SAND", 66);
//TileEntities
define("TILE_SIGN", "Sign");
define("TILE_CHEST", "Chest");
define("CHEST_SLOTS", 27);
define("TILE_FURNACE", "Furnace");
define("FURNACE_SLOTS", 3);

View File

@ -1,150 +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/
*
*
*/
define("IRON_SHOVEL", 256);//Implemented
define("IRON_PICKAXE", 257);//Implemented
define("IRON_AXE", 258);//Implemented
define("FLINT_STEEL", 259);
define("FLINT_AND_STEEL", 259);
define("APPLE", 260);//Implemented
define("BOW", 261);
define("ARROW", 262);
define("COAL", 263);//Implemented
define("DIAMOND", 264);//Implemented
define("IRON_INGOT", 265);//Implemented
define("GOLD_INGOT", 266);//Implemented
define("IRON_SWORD", 267);
define("WOODEN_SWORD", 268);//Implemented
define("WOODEN_SHOVEL", 269);//Implemented
define("WOODEN_PICKAXE", 270);//Implemented
define("WOODEN_AXE", 271);//Implemented
define("STONE_SWORD", 272);
define("STONE_SHOVEL", 273);
define("STONE_PICKAXE", 274);
define("STONE_AXE", 275);
define("DIAMOND_SWORD", 276);
define("DIAMOND_SHOVEL", 277);
define("DIAMOND_PICKAXE", 278);
define("DIAMOND_AXE", 279);
define("STICK", 280);//Implemented
define("STICKS", 280);
define("BOWL", 281);//Implemented
define("MUSHROOM_STEW", 282);
define("GOLD_SWORD", 283);
define("GOLD_SHOVEL", 284);
define("GOLD_PICKAXE", 285);
define("GOLD_AXE", 286);
define("GOLDEN_SWORD", 283);
define("GOLDEN_SHOVEL", 284);
define("GOLDEN_PICKAXE", 285);
define("GOLDEN_AXE", 286);
define("STRING", 287);
define("FEATHER", 288);//Implemented
define("GUNPOWDER", 289);
define("WOODEN_HOE", 290);
define("STONE_HOE", 291);
define("IRON_HOE", 292);//Implemented
define("DIAMOND_HOE", 293);
define("GOLD_HOE", 294);
define("GOLDEN_HOE", 294);
define("SEEDS", 295);
define("WHEAT_SEEDS", 295);
define("WHEAT", 296);
define("BREAD", 297);
define("LEATHER_CAP", 298);
define("LEATHER_TUNIC", 299);
define("LEATHER_PANTS", 300);
define("LEATHER_BOOTS", 301);
define("CHAIN_HELMET", 302);
define("CHAIN_CHESTPLATE", 303);
define("CHAIN_LEGGINGS", 304);
define("CHAIN_BOOTS", 305);
define("IRON_HELMET", 306);
define("IRON_CHESTPLATE", 307);
define("IRON_LEGGINGS", 308);
define("IRON_BOOTS", 309);
define("DIAMOND_HELMET", 310);
define("DIAMOND_CHESTPLATE", 311);
define("DIAMOND_LEGGINGS", 312);
define("DIAMOND_BOOTS", 313);
define("GOLD_HELMET", 314);
define("GOLD_CHESTPLATE", 315);
define("GOLD_LEGGINGS", 316);
define("GOLD_BOOTS", 317);
define("FLINT", 318);
define("RAW_PORKCHOP", 319);
define("COOKED_PORKCHOP", 320);
define("PAINTING", 321);
define("GOLDEN_APPLE", 322);
define("SIGN", 323);
define("WOODEN_DOOR", 324);
define("BUCKET", 325);
define("IRON_DOOR", 330);
define("SNOWBALL", 332);
define("LEATHER", 334);
define("BRICK", 336);
define("CLAY", 337);
define("SUGARCANE", 338);
define("SUGAR_CANE", 338);
define("SUGAR_CANES", 338);
define("PAPER", 339);
define("SLIMEBALL", 341);
define("EGG", 344);
define("COMPASS", 345);
define("GLOWSTONE_DUST", 348);
//define("RAW_FISH", 349);
//define("COOKED_FISH", 350);
define("DYE", 351);
define("BONE", 352);
define("SUGAR", 353);
define("CAKE", 354);
define("BED", 355);
//define("COOKIE", 357);
define("SHEARS", 359);
define("MELON", 360);
define("MELON_SLICE", 360);
define("MELON_SEEDS", 362);
define("RAW_BEEF", 363);
define("STEAK", 364);
define("COOKED_BEEF", 364);
define("RAW_CHICKEN", 365);
define("COOKED_CHICKEN", 366);
define("SPAWN_EGG", 383);
define("NETHER_BRICK", 405);
define("QUARTZ", 406);
define("NETHER_QUARTZ", 406);
define("CAMERA", 456);

View File

@ -1,85 +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/
*
*
*/
/***REM_START***/
require_once(dirname(__FILE__)."/config.php");
require_once(FILE_PATH."/src/utils/TextFormat.php");
require_once(FILE_PATH."/src/functions.php");
/***REM_END***/
define(DATA_PATH, realpath(arg("data-path", FILE_PATH))."/");
if(arg("enable-ansi", strpos(strtoupper(php_uname("s")), "WIN") === false ? true:false) === true){
define("ENABLE_ANSI", true);
}else{
define("ENABLE_ANSI", false);
}
set_error_handler("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") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "sockets." . PHP_SHLIB_SUFFIX) === false){
console("[ERROR] Unable to find the Socket extension.", true, true, 0);
++$errors;
}
if(!extension_loaded("pthreads") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "pthreads." . PHP_SHLIB_SUFFIX) === false){
console("[ERROR] Unable to find the pthreads extension.", true, true, 0);
++$errors;
}
if(!extension_loaded("curl") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "curl." . PHP_SHLIB_SUFFIX) === false){
console("[ERROR] Unable to find the cURL extension.", true, true, 0);
++$errors;
}
if(!extension_loaded("sqlite3") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "sqlite3." . PHP_SHLIB_SUFFIX) === false){
console("[ERROR] Unable to find the SQLite3 extension.", true, true, 0);
++$errors;
}
if(!extension_loaded("zlib") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "zlib." . PHP_SHLIB_SUFFIX) === false){
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.", true, true, 0);
exit(1); //Exit with error
}
/***REM_START***/
require_once(FILE_PATH."/src/math/Vector3.php");
require_once(FILE_PATH."/src/world/Position.php");
require_once(FILE_PATH."/src/pmf/PMF.php");
require_all(FILE_PATH . "src/");
/***REM_END***/

View File

@ -1,244 +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/
*
*
*/
if(!function_exists("cli_set_process_title")){
function cli_set_process_title($title){
if(ENABLE_ANSI === true){
echo "\x1b]0;".$title."\x07";
return true;
}else{
return false;
}
}
}
function dummy(){
}
function safe_var_dump($var, $cnt = 0){
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;
safe_var_dump($value, $cnt + 1);
}
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 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 require_all($path, &$count = 0){
$dir = dir($path."/");
$dirs = array();
while(false !== ($file = $dir->read())){
if($file !== "." and $file !== ".."){
if(!is_dir($path.$file) and strtolower(substr($file, -3)) === "php"){
require_once($path.$file);
++$count;
}elseif(is_dir($path.$file)){
$dirs[] = $path.$file."/";
}
}
}
foreach($dirs as $dir){
require_all($dir, $count);
}
}
function hard_unset(&$var){
if(is_object($var)){
$unset = new ReflectionClass($var);
foreach($unset->getProperties() as $prop){
$prop->setAccessible(true);
@hard_unset($prop->getValue($var));
$prop->setValue($var, null);
}
$var = null;
unset($var);
}elseif(is_array($var)){
foreach($var as $i => $v){
hard_unset($var[$i]);
}
$var = null;
unset($var);
}else{
$var = null;
unset($var);
}
}
function arg($name, $default = false){
global $arguments, $argv;
if(!isset($arguments)){
$arguments = arguments($argv);
}
if(isset($arguments["commands"][$name])){
return $arguments["commands"][$name];
}else{
return $default;
}
}
function arguments ( $args ){
if(!is_array($args)){
$args = array();
}
array_shift( $args );
$args = join( $args, ' ' );
preg_match_all('/ (--[\w\-]+ (?:[= ] [^-]+ [^\s-] )? ) | (-\w+) | (\w+) /x', $args, $match );
$args = array_shift( $match );
$ret = array(
'input' => array(),
'commands' => array(),
'flags' => array()
);
foreach ( $args as $arg ) {
// Is it a command? (prefixed with --)
if ( substr( $arg, 0, 2 ) === '--' ) {
$value = preg_split( '/[= ]/', $arg, 2 );
$com = substr( array_shift($value), 2 );
$value = join($value);
$ret['commands'][$com] = !empty($value) ? $value : true;
continue;
}
// Is it a flag? (prefixed with -)
if ( substr( $arg, 0, 1 ) === '-' ) {
$ret['flags'][] = substr( $arg, 1 );
continue;
}
$ret['input'][] = $arg;
continue;
}
return $ret;
}
function console($message, $EOL = true, $log = true, $level = 1){
if(!defined("DEBUG") or DEBUG >= $level){
$message .= $EOL === true ? PHP_EOL:"";
$time = (ENABLE_ANSI === true ? FORMAT_AQUA . date("H:i:s") . FORMAT_RESET:date("H:i:s")) . " ";
$replaced = preg_replace('/\x1b\[[0-9;]*m/', "", $time . $message);
if($log === true and (!defined("LOG") or LOG === true)){
logg(date("Y-m-d")." ".$replaced, "console", false, $level);
}
if(ENABLE_ANSI === true){
$add = "";
if(preg_match("/\[([a-zA-Z0-9]*)\]/", $message, $matches) > 0){
switch($matches[1]){
case "ERROR":
$add .= FORMAT_RED;
break;
case "INTERNAL":
case "DEBUG":
$add .= FORMAT_GRAY;
break;
case "WARNING":
$add .= FORMAT_YELLOW;
break;
case "NOTICE":
$add .= FORMAT_AQUA;
break;
default:
$add = "";
break;
}
}
$message = TextFormat::toANSI($time . $add . $message . FORMAT_RESET);
}else{
$message = $replaced;
}
echo $message;
}
}
function error_handler($errno, $errstr, $errfile, $errline){
if(error_reporting() === 0){ //@ error-control
return false;
}
console("[ERROR] A level ".$errno." error happened: \"$errstr\" in \"$errfile\" at line $errline", true, true, 0);
return true;
}
function logg($message, $name, $EOL = true, $level = 2, $close = false){
global $fpointers;
if((!defined("DEBUG") or DEBUG >= $level) and (!defined("LOG") or LOG === true)){
$message .= $EOL === true ? PHP_EOL:"";
if(!isset($fpointers)){
$fpointers = array();
}
if(!isset($fpointers[$name]) or $fpointers[$name] === false){
$fpointers[$name] = @fopen(DATA_PATH."/".$name.".log", "ab");
}
@fwrite($fpointers[$name], $message);
if($close === true){
fclose($fpointers[$name]);
unset($fpointers[$name]);
}
}
}

View File

@ -1,223 +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/
*
*
*/
abstract class Block extends Position{
public static $class = array(
AIR => "AirBlock",
STONE => "StoneBlock",
GRASS => "GrassBlock",
DIRT => "DirtBlock",
COBBLESTONE => "CobblestoneBlock",
PLANKS => "PlanksBlock",
SAPLING => "SaplingBlock",
BEDROCK => "BedrockBlock",
WATER => "WaterBlock",
STILL_WATER => "StillWaterBlock",
LAVA => "LavaBlock",
STILL_LAVA => "StillLavaBlock",
SAND => "SandBlock",
GRAVEL => "GravelBlock",
GOLD_ORE => "GoldOreBlock",
IRON_ORE => "IronOreBlock",
COAL_ORE => "CoalOreBlock",
WOOD => "WoodBlock",
LEAVES => "LeavesBlock",
GLASS => "GlassBlock",
LAPIS_ORE => "LapisOreBlock",
LAPIS_BLOCK => "LapisBlock",
SANDSTONE => "SandstoneBlock",
BED_BLOCK => "BedBlock",
COBWEB => "CobwebBlock",
TALL_GRASS => "TallGrassBlock",
DEAD_BUSH => "DeadBushBlock",
WOOL => "WoolBlock",
DANDELION => "DandelionBlock",
CYAN_FLOWER => "CyanFlowerBlock",
BROWN_MUSHROOM => "BrownMushroomBlock",
RED_MUSHROOM => "RedMushRoomBlock",
GOLD_BLOCK => "GoldBlock",
IRON_BLOCK => "IronBlock",
DOUBLE_SLAB => "DoubleSlabBlock",
SLAB => "SlabBlock",
BRICKS_BLOCK => "BricksBlock",
TNT => "TNTBlock",
BOOKSHELF => "BookshelfBlock",
MOSS_STONE => "MossStoneBlock",
OBSIDIAN => "ObsidianBlock",
TORCH => "TorchBlock",
FIRE => "FireBlock",
WOOD_STAIRS => "WoodStairsBlock",
CHEST => "ChestBlock",
DIAMOND_ORE => "DiamondOreBlock",
DIAMOND_BLOCK => "DiamondBlock",
WORKBENCH => "WorkbenchBlock",
WHEAT_BLOCK => "WheatBlock",
FARMLAND => "FarmlandBlock",
FURNACE => "FurnaceBlock",
BURNING_FURNACE => "BurningFurnaceBlock",
SIGN_POST => "SignPostBlock",
WOOD_DOOR_BLOCK => "WoodDoorBlock",
LADDER => "LadderBlock",
COBBLESTONE_STAIRS => "CobblestoneStairsBlock",
WALL_SIGN => "WallSignBlock",
IRON_DOOR_BLOCK => "IronDoorBlock",
REDSTONE_ORE => "RedstoneOreBlock",
GLOWING_REDSTONE_ORE => "GlowingRedstoneOreBlock",
SNOW_LAYER => "SnowLayerBlock",
ICE => "IceBlock",
SNOW_BLOCK => "SnowBlock",
CACTUS => "CactusBlock",
CLAY_BLOCK => "ClayBlock",
SUGARCANE_BLOCK => "SugarcaneBlock",
FENCE => "FenceBlock",
NETHERRACK => "NetherrackBlock",
SOUL_SAND => "SoulSandBlock",
GLOWSTONE_BLOCK => "GlowstoneBlock",
CAKE_BLOCK => "CakeBlock",
TRAPDOOR => "TrapdoorBlock",
STONE_BRICKS => "StoneBricksBlock",
GLASS_PANE => "GlassPaneBlock",
MELON_BLOCK => "MelonBlock",
MELON_STEM => "MelonStemBlock",
FENCE_GATE => "FenceGateBlock",
BRICK_STAIRS => "BrickStairsBlock",
STONE_BRICK_STAIRS => "StoneBrickStairsBlock",
NETHER_BRICKS => "NetherBricksBlock",
NETHER_BRICKS_STAIRS => "NetherBricksStairsBlock",
SANDSTONE_STAIRS => "SandstoneStairsBlock",
QUARTZ_BLOCK => "QuartzBlock",
QUARTZ_STAIRS => "QuartzStairsBlock",
STONECUTTER => "StonecutterBlock",
GLOWING_OBSIDIAN => "GlowingObsidianBlock",
NETHER_REACTOR => "NetherReactorBlock",
);
protected $id;
protected $meta;
protected $name;
protected $breakTime;
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 function __construct($id, $meta = 0, $name = "Unknown"){
$this->id = (int) $id;
$this->meta = (int) $meta;
$this->name = $name;
$this->breakTime = 0.20;
}
final public function getName(){
return $this->name;
}
final public function getID(){
return $this->id;
}
final public function getMetadata(){
return $this->meta & 0x0F;
}
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;
}
public function getDrops(Item $item, Player $player){
if(!isset(Block::$class[$this->id])){ //Unknown blocks
return array();
}else{
return array(
array($this->id, $this->meta, 1),
);
}
}
public function getBreakTime(Item $item, Player $player){
if(($player->gamemode & 0x01) === 0x01){
return 0.15;
}
return $this->breakTime;
}
public function getSide($side){
$v = parent::getSide($side);
if($this->level instanceof Level){
return $this->level->getBlock($v);
}
return $v;
}
final public function __toString(){
return "Block ". $this->name ." (".$this->id.":".$this->meta.")";
}
abstract function isBreakable(Item $item, Player $player);
abstract function onBreak(Item $item, Player $player);
abstract function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz);
abstract function onActivate(Item $item, Player $player);
abstract function onUpdate($type);
}
/***REM_START***/
require_once("block/GenericBlock.php");
require_once("block/SolidBlock.php");
require_once("block/TransparentBlock.php");
require_once("block/FallableBlock.php");
require_once("block/LiquidBlock.php");
require_once("block/StairBlock.php");
require_once("block/DoorBlock.php");
/***REM_END***/

View File

@ -1,275 +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/
*
*
*/
class Item{
public static $class = array(
SUGARCANE => "SugarcaneItem",
WHEAT_SEEDS => "WheatSeedsItem",
MELON_SEEDS => "MelonSeedsItem",
SIGN => "SignItem",
WOODEN_DOOR => "WoodenDoorItem",
BUCKET => "BucketItem",
IRON_DOOR => "IronDoorItem",
CAKE => "CakeItem",
BED => "BedItem",
PAINTING => "PaintingItem",
COAL => "CoalItem",
APPLE => "AppleItem",
SPAWN_EGG => "SpawnEggItem",
DIAMOND => "DiamondItem",
STICK => "StickItem",
BOWL => "BowlItem",
FEATHER => "FeatherItem",
BRICK => "BrickItem",
IRON_INGOT => "IronIngotItem",
GOLD_INGOT => "GoldIngotItem",
IRON_SHOVEL => "IronShovelItem",
IRON_PICKAXE => "IronPickaxeItem",
IRON_AXE => "IronAxeItem",
IRON_HOE => "IronHoeItem",
WOODEN_SWORD => "WoodenSwordItem",
WOODEN_SHOVEL => "WoodenShovelItem",
WOODEN_PICKAXE => "WoodenPickaxeItem",
WOODEN_AXE => "WoodenAxeItem",
FLINT_STEEL => "FlintSteelItem",
);
protected $block;
protected $id;
protected $meta;
public $count;
protected $maxStackSize = 64;
protected $durability = 0;
protected $name;
public $isActivable = false;
public function __construct($id, $meta = 0, $count = 1, $name = "Unknown"){
$this->id = (int) $id;
$this->meta = (int) $meta;
$this->count = (int) $count;
$this->name = $name;
if(!isset($this->block) and $this->id <= 0xff and isset(Block::$class[$this->id])){
$this->block = BlockAPI::get($this->id, $this->meta);
$this->name = $this->block->getName();
}
if($this->isTool() !== false){
$this->maxStackSize = 1;
}
}
final public function getName(){
return $this->name;
}
final public function isPlaceable(){
return (($this->block instanceof Block) and $this->block->isPlaceable === true);
}
final public function getBlock(){
if($this->block instanceof Block){
return $this->block;
}else{
return BlockAPI::get(AIR);
}
}
final public function getID(){
return $this->id;
}
final public function getMetadata(){
return $this->meta;
}
final public function getMaxStackSize(){
return $this->maxStackSize;
}
final public function getFuelTime(){
if(!isset(FuelData::$duration[$this->id])){
return false;
}
if($this->id !== BUCKET or $this->meta === 10){
return FuelData::$duration[$this->id];
}
return false;
}
final public function getSmeltItem(){
if(!isset(SmeltingData::$product[$this->id])){
return false;
}
if(isset(SmeltingData::$product[$this->id][0]) and !is_array(SmeltingData::$product[$this->id][0])){
return BlockAPI::getItem(SmeltingData::$product[$this->id][0], SmeltingData::$product[$this->id][1]);
}
if(!isset(SmeltingData::$product[$this->id][$this->meta])){
return false;
}
return BlockAPI::getItem(SmeltingData::$product[$this->id][$this->meta][0], SmeltingData::$product[$this->id][$this->meta][1]);
}
public function useOn($object, $force = false){
if($this->isTool() or $force === true){
if(($object instanceof Entity) and !$this->isSword()){
$this->meta += 2;
}else{
$this->meta++;
}
return true;
}
return false;
}
final public function isTool(){
return ($this->id === FLINT_STEEL or $this->id === SHEARS or $this->isPickaxe() !== false or $this->isAxe() !== false or $this->isShovel() !== false or $this->isSword() !== false);
}
final public function getMaxDurability(){
if(!$this->isTool() and $this->isHoe() === false and $this->id !== BOW){
return false;
}
$levels = array(
2 => 33,
1 => 60,
3 => 132,
4 => 251,
5 => 1562,
FLINT_STEEL => 65,
SHEARS => 239,
BOW => 385,
);
if(($type = $this->isPickaxe()) === false){
if(($type = $this->isAxe()) === false){
if(($type = $this->isSword()) === false){
if(($type = $this->isShovel()) === false){
if(($type = $this->isHoe()) === false){
$type = $this->id;
}
}
}
}
}
return $levels[$type];
}
final public function isPickaxe(){ //Returns false or level of the pickaxe
switch($this->id){
case IRON_PICKAXE:
return 4;
case WOODEN_PICKAXE:
return 1;
case STONE_PICKAXE:
return 3;
case DIAMOND_PICKAXE:
return 5;
case GOLD_PICKAXE:
return 2;
default:
return false;
}
}
final public function isAxe(){
switch($this->id){
case IRON_AXE:
return 4;
case WOODEN_AXE:
return 1;
case STONE_AXE:
return 3;
case DIAMOND_AXE:
return 5;
case GOLD_AXE:
return 2;
default:
return false;
}
}
final public function isSword(){
switch($this->id){
case IRON_SWORD:
return 4;
case WOODEN_SWORD:
return 1;
case STONE_SWORD:
return 3;
case DIAMOND_SWORD:
return 5;
case GOLD_SWORD:
return 2;
default:
return false;
}
}
final public function isShovel(){
switch($this->id){
case IRON_SHOVEL:
return 4;
case WOODEN_SHOVEL:
return 1;
case STONE_SHOVEL:
return 3;
case DIAMOND_SHOVEL:
return 5;
case GOLD_SHOVEL:
return 2;
default:
return false;
}
}
public function isHoe(){
switch($this->id){
case IRON_HOE:
case WOODEN_HOE:
case STONE_HOE:
case DIAMOND_HOE:
case GOLD_HOE:
return true;
default:
return false;
}
}
public function isShears(){
return ($this->id === SHEARS);
}
final public function __toString(){
return "Item ". $this->name ." (".$this->id.":".$this->meta.")";
}
public function getDestroySpeed(Block $block, Player $player){
return 1;
}
public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
return false;
}
}

View File

@ -1,101 +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/
*
*
*/
class DoorBlock extends TransparentBlock{
public function __construct($id, $meta = 0, $name = "Unknown"){
parent::__construct($id, $meta, $name);
$this->isSolid = false;
}
public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->getID() === AIR){ //Replace with common break method
$this->level->setBlock($this, new AirBlock(), false);
if($this->getSide(1) instanceof DoorBlock){
$this->level->setBlock($this->getSide(1), new AirBlock(), false);
}
return BLOCK_UPDATE_NORMAL;
}
}
return false;
}
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
if($face === 1){
$blockUp = $this->getSide(1);
$blockDown = $this->getSide(0);
if($blockUp->isReplaceable === false or $blockDown->isTransparent === true){
return false;
}
$direction = $player->entity->getDirection();
$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, BlockAPI::get($this->id, $metaUp), true, false, true); //Top
$this->meta = $direction & 0x03;
$this->level->setBlock($block, $this, true, false, true); //Bottom
return true;
}
return false;
}
public function onBreak(Item $item, Player $player){
if(($this->meta & 0x08) === 0x08){
$down = $this->getSide(0);
if($down->getID() === $this->id){
$this->level->setBlock($down, new AirBlock(), true, false, true);
}
}else{
$up = $this->getSide(1);
if($up->getID() === $this->id){
$this->level->setBlock($up, new AirBlock(), true, false, true);
}
}
$this->level->setBlock($this, new AirBlock(), true, false, true);
return true;
}
public function onActivate(Item $item, Player $player){
if(($this->meta & 0x08) === 0x08){ //Top
$down = $this->getSide(0);
if($down->getID() === $this->id){
$meta = $down->getMetadata() ^ 0x04;
$this->level->setBlock($down, BlockAPI::get($this->id, $meta), true, false, true);
return true;
}
return false;
}else{
$this->meta ^= 0x04;
$this->level->setBlock($this, $this, true, false, true);
}
return true;
}
}

View File

@ -1,63 +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/
*
*
*/
class GenericBlock extends Block{
public function __construct($id, $meta = 0, $name = "Unknown"){
parent::__construct($id, $meta, $name);
}
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
return $this->level->setBlock($this, $this, true, false, true);
}
public function isBreakable(Item $item, Player $player){
return ($this->breakable);
}
public function onBreak(Item $item, Player $player){
return $this->level->setBlock($this, new AirBlock(), true, false, true);
}
public function onUpdate($type){
if($this->hasPhysics === true and $type === BLOCK_UPDATE_NORMAL){
$down = $this->getSide(0);
if($down->getID() === AIR or ($down instanceof LiquidBlock)){
$data = array(
"x" => $this->x + 0.5,
"y" => $this->y + 0.5,
"z" => $this->z + 0.5,
"Tile" => $this->id,
);
$server = ServerAPI::request();
$this->level->setBlock($this, new AirBlock(), false, false, true);
$e = $server->api->entity->add($this->level, ENTITY_FALLING, FALLING_SAND, $data);
$server->api->entity->spawnToAll($e);
$server->api->block->blockUpdateAround(clone $this, BLOCK_UPDATE_NORMAL, 1);
}
return false;
}
return false;
}
public function onActivate(Item $item, Player $player){
return $this->isActivable;
}
}

View File

@ -1,31 +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/
*
*
*/
class LiquidBlock extends TransparentBlock{
public function __construct($id, $meta = 0, $name = "Unknown"){
parent::__construct($id, $meta, $name);
$this->isLiquid = true;
$this->breakable = false;
$this->isReplaceable = true;
$this->isSolid = false;
$this->isFullBlock = true;
}
}

View File

@ -1,56 +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/
*
*
*/
class StairBlock extends TransparentBlock{
public function __construct($id, $meta = 0, $name = "Unknown"){
parent::__construct($id, $meta, $name);
if(($this->meta & 0x04) === 0x04){
$this->isFullBlock = true;
}else{
$this->isFullBlock = false;
}
}
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$faces = array(
0 => 0,
1 => 2,
2 => 1,
3 => 3,
);
$this->meta = $faces[$player->entity->getDirection()] & 0x03;
if(($fy > 0.5 and $face !== 1) or $face === 0){
$this->meta |= 0x04; //Upside-down stairs
}
$this->level->setBlock($block, $this, true, false, true);
return true;
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
return array(
array($this->id, 0, 1),
);
}else{
return array();
}
}
}

View File

@ -1,33 +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/
*
*
*/
class TransparentBlock extends GenericBlock{
public function __construct($id, $meta = 0, $name = "Unknown"){
parent::__construct($id, $meta, $name);
$this->isActivable = false;
$this->breakable = true;
$this->isFlowable = false;
$this->isTransparent = true;
$this->isReplaceable = false;
$this->isPlaceable = true;
$this->isSolid = true;
}
}

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/
*
*
*/
class SignPostBlock extends TransparentBlock{
public function __construct($meta = 0){
parent::__construct(SIGN_POST, $meta, "Sign Post");
$this->isSolid = false;
$this->isFullBlock = false;
}
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
if($face !== 0){
$faces = array(
2 => 2,
3 => 3,
4 => 4,
5 => 5,
);
if(!isset($faces[$face])){
$this->meta = floor((($player->entity->yaw + 180) * 16 / 360) + 0.5) & 0x0F;
$this->level->setBlock($block, BlockAPI::get(SIGN_POST, $this->meta), true, false, true);
return true;
}else{
$this->meta = $faces[$face];
$this->level->setBlock($block, BlockAPI::get(WALL_SIGN, $this->meta, true, false, true));
return true;
}
}
return false;
}
public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->getID() === AIR){ //Replace with common break method
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem(SIGN, 0, 1));
$this->level->setBlock($this, new AirBlock(), true, true, true);
return BLOCK_UPDATE_NORMAL;
}
}
return false;
}
public function onBreak(Item $item, Player $player){
$this->level->setBlock($this, new AirBlock(), true, true, true);
return true;
}
public function getDrops(Item $item, Player $player){
return array(
array(SIGN, 0, 1),
);
}
}

View File

@ -1,73 +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/
*
*
*/
class TorchBlock extends FlowableBlock{
public function __construct($meta = 0){
parent::__construct(TORCH, $meta, "Torch");
}
public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){
$side = $this->getMetadata();
$faces = array(
1 => 4,
2 => 5,
3 => 2,
4 => 3,
5 => 0,
6 => 0,
0 => 0,
);
if($this->getSide($faces[$side])->isTransparent === true and !($side === 0 and $this->getSide(0)->getID() === FENCE)){ //Replace with common break method
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id, 0, 1));
$this->level->setBlock($this, new AirBlock(), true, false, true);
return BLOCK_UPDATE_NORMAL;
}
}
return false;
}
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
if($target->isTransparent === false and $face !== 0){
$faces = array(
1 => 5,
2 => 4,
3 => 3,
4 => 2,
5 => 1,
);
$this->meta = $faces[$face];
$this->level->setBlock($block, $this, true, false, true);
return true;
}elseif($this->getSide(0)->isTransparent === false or $this->getSide(0)->getID() === FENCE){
$this->meta = 0;
$this->level->setBlock($block, $this, true, false, true);
return true;
}
return false;
}
public function getDrops(Item $item, Player $player){
return array(
array($this->id, 0, 1),
);
}
}

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/
*
*
*/
class TrapdoorBlock extends TransparentBlock{
public function __construct($meta = 0){
parent::__construct(TRAPDOOR, $meta, "Trapdoor");
$this->isActivable = true;
if(($this->meta & 0x04) === 0x04){
$this->isFullBlock = false;
}else{
$this->isFullBlock = true;
}
}
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
if(($target->isTransparent === false or $target->getID() === SLAB) and $face !== 0 and $face !== 1){
$faces = array(
2 => 0,
3 => 1,
4 => 2,
5 => 3,
);
$this->meta = $faces[$face] & 0x03;
if($fy > 0.5){
$this->meta |= 0x08;
}
$this->level->setBlock($block, $this, true, false, true);
return true;
}
}
public function getDrops(Item $item, Player $player){
return array(
array($this->id, 0, 1),
);
}
public function onActivate(Item $item, Player $player){
$this->meta ^= 0x04;
$this->level->setBlock($this, $this, true, false, true);
return true;
}
}

View File

@ -1,112 +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/
*
*
*/
class WaterBlock extends LiquidBlock{
public function __construct($meta = 0){
parent::__construct(WATER, $meta, "Water");
}
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$ret = $this->level->setBlock($this, $this, true, false, true);
ServerAPI::request()->api->block->scheduleBlockUpdate(clone $this, 10, BLOCK_UPDATE_NORMAL);
return $ret;
}
public function onUpdate($type){
return false;
$newId = $this->id;
$level = $this->meta & 0x07;
if($type !== BLOCK_UPDATE_NORMAL){
return false;
}
$falling = $this->meta >> 3;
$down = $this->getSide(0);
if($falling === 0){
$countSources = 0;
$maxLevel = $level;
$hasPath = false;
for($side = 2; $side <= 5; ++$side){
$b = $this->getSide($side);
if($b->isFlowable === true and $level < 0x07){
$d = $b->getSide(0);
$this->level->setBlock($b, new WaterBlock($level + 1), false, false, true);
ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($b, 0, 0, $this->level), 10, BLOCK_UPDATE_NORMAL);
}elseif($b instanceof WaterBlock){
$oLevel = $b->getMetadata();
$oFalling = $oLevel >> 3;
$oLevel &= 0x07;
if($oFalling === 0){
if($oLevel === 0){
++$countSources;
$maxLevel = 1;
$hasPath = true;
}elseif($oLevel < 0x07 and ($oLevel + 1) <= $maxLevel){
$maxLevel = $oLevel + 1;
$hasPath = true;
}elseif(($level + 1) < $oLevel){
$this->level->setBlock($b, new WaterBlock($level + 1), false, false, true);
ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($b, 0, 0, $this->level), 10, BLOCK_UPDATE_NORMAL);
}elseif($level === $oLevel){
ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($b, 0, 0, $this->level), 10, BLOCK_UPDATE_NORMAL);
}
}
}
}
if($countSources >= 2){
$level = 0; //Source block
}elseif($maxLevel < $level){
$level = $maxLevel;
}elseif($maxLevel === $level and $level > 0 and $hasPath === false){
if($level < 0x07){
++$level;
}else{
$newId = AIR;
$level = 0;
}
}
}
if($down->isFlowable){
$this->level->setBlock($down, new WaterBlock(0b1001), false, false, true);
ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($down, 0, 0, $this->level), 5, BLOCK_UPDATE_NORMAL);
return false;
}elseif($down instanceof LiquidBlock){
if($down instanceof WaterBlock and ($down->getMetadata() >> 3) === 0){
$this->level->setBlock($down, new WaterBlock(0b1000 & min($down->getMetadata(), 1)), false, false, true);
ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($down, 0, 0, $this->level), 5, BLOCK_UPDATE_NORMAL);
}
}else{
$falling = 0;
}
$newMeta = ($falling << 0x03) | $level;
if($newMeta !== $this->meta or $newId !== $this->id){
$this->id = $newId;
$this->meta = $newMeta;
$this->level->setBlock($this, $this, false, false, true);
ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), 10, BLOCK_UPDATE_NORMAL);
return false;
}
return false;
}
}

View File

@ -1,37 +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/
*
*
*/
class AirBlock extends TransparentBlock{
public function __construct(){
parent::__construct(AIR, 0, "Air");
$this->isActivable = false;
$this->breakable = false;
$this->isFlowable = true;
$this->isTransparent = true;
$this->isReplaceable = true;
$this->isPlaceable = false;
$this->hasPhysics = false;
$this->isSolid = false;
$this->isFullBlock = true;
}
}

View File

@ -1,103 +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/
*
*
*/
class BedBlock extends TransparentBlock{
public function __construct($type = 0){
parent::__construct(BED_BLOCK, $type, "Bed Block");
$this->isActivable = true;
$this->isFullBlock = false;
}
public function onActivate(Item $item, Player $player){
if(ServerAPI::request()->api->time->getPhase($player->level) !== "night"){
$player->dataPacket(MC_CLIENT_MESSAGE, array(
"message" => "You can only sleep at night"
));
return true;
}
if($player->sleepOn($this) === false){
$player->dataPacket(MC_CLIENT_MESSAGE, array(
"message" => "This bed is occupied"
));
}
return true;
}
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0);
if($down->isTransparent === false){
$faces = array(
0 => 3,
1 => 4,
2 => 2,
3 => 5,
);
$d = $player->entity->getDirection();
$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, BlockAPI::get($this->id, $meta), true, false, true);
$this->level->setBlock($next, BlockAPI::get($this->id, $meta | 0x08), true, false, true);
return true;
}
}
return false;
}
public function onBreak(Item $item, Player $player){
$blockNorth = $this->getSide(2); //Gets the blocks around them
$blockSouth = $this->getSide(3);
$blockEast = $this->getSide(5);
$blockWest = $this->getSide(4);
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 AirBlock(), true, false, true);
}elseif($blockSouth->getID() === $this->id and $blockSouth->meta !== 0x08){
$this->level->setBlock($blockSouth, new AirBlock(), true, false, true);
}elseif($blockEast->getID() === $this->id and $blockEast->meta !== 0x08){
$this->level->setBlock($blockEast, new AirBlock(), true, false, true);
}elseif($blockWest->getID() === $this->id and $blockWest->meta !== 0x08){
$this->level->setBlock($blockWest, new AirBlock(), true, false, true);
}
}else{ //Bottom Part of Bed
if($blockNorth->getID() === $this->id and ($blockNorth->meta & 0x08) === 0x08){
$this->level->setBlock($blockNorth, new AirBlock(), true, false, true);
}elseif($blockSouth->getID() === $this->id and ($blockSouth->meta & 0x08) === 0x08){
$this->level->setBlock($blockSouth, new AirBlock(), true, false, true);
}elseif($blockEast->getID() === $this->id and ($blockEast->meta & 0x08) === 0x08){
$this->level->setBlock($blockEast, new AirBlock(), true, false, true);
}elseif($blockWest->getID() === $this->id and ($blockWest->meta & 0x08) === 0x08){
$this->level->setBlock($blockWest, new AirBlock(), true, false, true);
}
}
$this->level->setBlock($this, new AirBlock(), true, false, true);
return true;
}
public function getDrops(Item $item, Player $player){
return array(
array(BED, 0, 1),
);
}
}

View File

@ -1,64 +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/
*
*
*/
class FenceGateBlock extends TransparentBlock{
public function __construct($meta = 0){
parent::__construct(FENCE_GATE, $meta, "Fence Gate");
$this->isActivable = true;
if(($this->meta & 0x04) === 0x04){
$this->isFullBlock = true;
}else{
$this->isFullBlock = false;
}
}
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$faces = array(
0 => 3,
1 => 0,
2 => 1,
3 => 2,
);
$this->meta = $faces[$player->entity->getDirection()] & 0x03;
$this->level->setBlock($block, $this, true, false, true);
return true;
}
public function getDrops(Item $item, Player $player){
return array(
array($this->id, 0, 1),
);
}
public function onActivate(Item $item, Player $player){
$faces = array(
0 => 3,
1 => 0,
2 => 1,
3 => 2,
);
$this->meta = ($faces[$player->entity->getDirection()] & 0x03) | ((~$this->meta) & 0x04);
if(($this->meta & 0x04) === 0x04){
$this->isFullBlock = true;
}else{
$this->isFullBlock = false;
}
$this->level->setBlock($this, $this, true, false, true);
return true;
}
}

View File

@ -1,108 +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/
*
*
*/
class SlabBlock extends TransparentBlock{
public function __construct($meta = 0){
parent::__construct(SLAB, $meta, "Slab");
$names = array(
0 => "Stone",
1 => "Sandstone",
2 => "Wooden",
3 => "Cobblestone",
4 => "Brick",
5 => "Stone Brick",
//6 => "Nether Brick",
6 => "Quartz",
);
$this->name = (($this->meta & 0x08) === 0x08 ? "Upper ":"") . $names[$this->meta & 0x07] . " Slab";
if(($this->meta & 0x08) === 0x08){
$this->isFullBlock = true;
}else{
$this->isFullBlock = false;
}
}
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$this->meta &= 0x07;
if($face === 0){
if($target->getID() === SLAB and ($target->getMetadata() & 0x08) === 0x08 and ($target->getMetadata() & 0x07) === ($this->meta & 0x07)){
$this->level->setBlock($target, BlockAPI::get(DOUBLE_SLAB, $this->meta), true, false, true);
return true;
}else{
$this->meta |= 0x08;
}
}elseif($face === 1){
if($target->getID() === SLAB and ($target->getMetadata() & 0x08) === 0 and ($target->getMetadata() & 0x07) === ($this->meta & 0x07)){
$this->level->setBlock($target, BlockAPI::get(DOUBLE_SLAB, $this->meta), true, false, true);
return true;
}
}elseif(!$player->entity->inBlock($block)){
if($block->getID() === SLAB){
if(($block->getMetadata() & 0x07) === ($this->meta & 0x07)){
$this->level->setBlock($block, BlockAPI::get(DOUBLE_SLAB, $this->meta), true, false, true);
return true;
}
return false;
}else{
if($fy > 0.5){
$this->meta |= 0x08;
}
}
}else{
return false;
}
if($block->getID() === SLAB and ($target->getMetadata() & 0x07) !== ($this->meta & 0x07)){
return false;
}
$this->level->setBlock($block, $this, true, false, true);
return true;
}
public function getBreakTime(Item $item, Player $player){
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
case 5:
return 0.4;
case 4:
return 0.5;
case 3:
return 0.75;
case 2:
return 0.25;
case 1:
return 1.5;
default:
return 10;
}
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
return array(
array($this->id, $this->meta & 0x07, 1),
);
}else{
return array();
}
}
}

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/
*
*
*/
class NetherBricksStairsBlock extends StairBlock{
public function __construct($meta = 0){
parent::__construct(NETHER_BRICKS_STAIRS, $meta, "Nether Bricks Stairs");
}
}

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/
*
*
*/
class QuartzStairsBlock extends StairBlock{
public function __construct($meta = 0){
parent::__construct(QUARTZ_STAIRS, $meta, "Quartz Stairs");
}
}

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/
*
*
*/
class SandstoneStairsBlock extends StairBlock{
public function __construct($meta = 0){
parent::__construct(SANDSTONE_STAIRS, $meta, "Sandstone Stairs");
}
}

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/
*
*
*/
class StoneBrickStairsBlock extends StairBlock{
public function __construct($meta = 0){
parent::__construct(STONE_BRICK_STAIRS, $meta, "Stone Brick Stairs");
}
}

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/
*
*
*/
class CoalOreBlock extends SolidBlock{
public function __construct(){
parent::__construct(COAL_ORE, 0, "Coal Ore");
}
public function getBreakTime(Item $item, Player $player){
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
case 3:
return 1.15;
case 2:
return 0.4;
case 1:
return 2.25;
default:
return 15;
}
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
return array(
array(COAL, 0, 1),
);
}else{
return array();
}
}
}

View File

@ -1,50 +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/
*
*
*/
class DiamondOreBlock extends SolidBlock{
public function __construct(){
parent::__construct(DIAMOND_ORE, 0, "Diamond Ore");
}
public function getBreakTime(Item $item, Player $player){
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
default:
return 15;
}
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 4){
return array(
array(DIAMOND, 0, 1),
);
}else{
return array();
}
}
}

View File

@ -1,62 +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/
*
*
*/
class GlowingRedstoneOreBlock extends SolidBlock{
public function __construct(){
parent::__construct(GLOWING_REDSTONE_ORE, 0, "Glowing Redstone Ore");
}
public function onUpdate($type){
if($type === BLOCK_UPDATE_SCHEDULED or $type === BLOCK_UPDATE_RANDOM){
$this->level->setBlock($this, BlockAPI::get(REDSTONE_ORE, $this->meta), false, false, true);
return BLOCK_UPDATE_WEAK;
}else{
$this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM);
}
return false;
}
public function getBreakTime(Item $item, Player $player){
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
case 5:
return 0.6;
case 4:
return 0.75;
default:
return 15;
}
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 4){
return array(
//array(331, 4, mt_rand(4, 5)),
);
}else{
return array();
}
}
}

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/
*
*
*/
class BrownMushroomBlock extends FlowableBlock{
public function __construct(){
parent::__construct(BROWN_MUSHROOM, 0, "Brown Mushroom");
}
public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id));
$this->level->setBlock($this, new AirBlock(), false, false, true);
return BLOCK_UPDATE_NORMAL;
}
}
return false;
}
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0);
if($down->isTransparent === false){
$this->level->setBlock($block, $this, true, false, true);
return true;
}
return false;
}
}

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/
*
*
*/
class CactusBlock extends TransparentBlock{
public function __construct($meta = 0){
parent::__construct(CACTUS, $meta, "Cactus");
$this->isFullBlock = false;
}
public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){
$down = $this->getSide(0);
if($down->getID() !== SAND and $down->getID() !== CACTUS){ //Replace with common break method
$this->level->setBlock($this, new AirBlock(), false);
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id));
return BLOCK_UPDATE_NORMAL;
}
}elseif($type === BLOCK_UPDATE_RANDOM){
if($this->getSide(0)->getID() !== CACTUS){
if($this->meta == 0x0F){
for($y = 1; $y < 3; ++$y){
$b = $this->level->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
if($b->getID() === AIR){
$this->level->setBlock($b, new CactusBlock(), true, false, true);
break;
}
}
$this->meta = 0;
$this->level->setBlock($this, $this, false);
}else{
++$this->meta;
$this->level->setBlock($this, $this, false);
}
return BLOCK_UPDATE_RANDOM;
}
}
return false;
}
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0);
if($down->getID() === SAND or $down->getID() === CACTUS){
$block0 = $this->getSide(2);
$block1 = $this->getSide(3);
$block2 = $this->getSide(4);
$block3 = $this->getSide(5);
if($block0->isTransparent === true and $block1->isTransparent === true and $block2->isTransparent === true and $block3->isTransparent === true){
$this->level->setBlock($this, $this, true, false, true);
$this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM);
return true;
}
}
return false;
}
public function getDrops(Item $item, Player $player){
return array(
array($this->id, 0, 1),
);
}
}

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/
*
*
*/
class CyanFlowerBlock extends FlowableBlock{
public function __construct(){
parent::__construct(CYAN_FLOWER, 0, "Cyan Flower");
}
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0);
if($down->getID() === 2 or $down->getID() === 3 or $down->getID() === 60){
$this->level->setBlock($block, $this, true, false, true);
return true;
}
return false;
}
public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id));
$this->level->setBlock($this, new AirBlock(), false, false, true);
return BLOCK_UPDATE_NORMAL;
}
}
return false;
}
}

View File

@ -1,86 +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/
*
*
*/
class MelonStemBlock extends FlowableBlock{
public function __construct($meta = 0){
parent::__construct(MELON_STEM, $meta, "Melon Stem");
$this->isActivable = true;
}
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0);
if($down->getID() === FARMLAND){
$this->level->setBlock($block, $this, true, false, true);
$this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM);
return true;
}
return false;
}
public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem(MELON_SEEDS, 0, mt_rand(0, 2)));
$this->level->setBlock($this, new AirBlock(), false, false, true);
return BLOCK_UPDATE_NORMAL;
}
}elseif($type === BLOCK_UPDATE_RANDOM){
if(mt_rand(0, 2) == 1){
if($this->meta < 0x07){
++$this->meta;
$this->level->setBlock($this, $this, true, false, true);
return BLOCK_UPDATE_RANDOM;
}else{
for($side = 2; $side <= 5; ++$side){
$b = $this->getSide($side);
if($b->getID() === MELON_BLOCK){
return BLOCK_UPDATE_RANDOM;
}
}
$side = $this->getSide(mt_rand(2,5));
$d = $side->getSide(0);
if($side->getID() === AIR and ($d->getID() === FARMLAND or $d->getID() === GRASS or $d->getID() === DIRT)){
$this->level->setBlock($side, new MelonBlock(), true, false, true);
}
}
}
return BLOCK_UPDATE_RANDOM;
}
return false;
}
public function onActivate(Item $item, Player $player){
if($item->getID() === 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 getDrops(Item $item, Player $player){
return array(
array(MELON_SEEDS, 0, mt_rand(0, 2)),
);
}
}

View File

@ -1,87 +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/
*
*
*/
class SaplingBlock extends FlowableBlock{
const OAK = 0;
const SPRUCE = 1;
const BIRCH = 2;
const BURN_TIME = 5;
public function __construct($meta = Sapling::OAK){
parent::__construct(SAPLING, $meta, "Sapling");
$this->isActivable = true;
$names = array(
0 => "Oak Sapling",
1 => "Spruce Sapling",
2 => "Birch Sapling",
);
$this->name = $names[$this->meta & 0x03];
}
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0);
if($down->getID() === GRASS or $down->getID() === DIRT or $down->getID() === FARMLAND){
$this->level->setBlock($block, $this, true, false, true);
$this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM);
return true;
}
return false;
}
public function onActivate(Item $item, Player $player){
if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal
TreeObject::growTree($this->level, $this, new Random(), $this->meta & 0x03);
if(($player->gamemode & 0x01) === 0){
$item->count--;
}
return true;
}
return false;
}
public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id));
$this->level->setBlock($this, new AirBlock(), false, false, true);
return BLOCK_UPDATE_NORMAL;
}
}elseif($type === BLOCK_UPDATE_RANDOM){ //Growth
if(mt_rand(1,7) === 1){
if(($this->meta & 0x08) === 0x08){
TreeObject::growTree($this->level, $this, new Random(), $this->meta & 0x03);
}else{
$this->meta |= 0x08;
$this->level->setBlock($this, $this, true, false, true);
return BLOCK_UPDATE_RANDOM;
}
}else{
return BLOCK_UPDATE_RANDOM;
}
}
return false;
}
public function getDrops(Item $item, Player $player){
return array(
array($this->id, $this->meta & 0x03, 1),
);
}
}

View File

@ -1,81 +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/
*
*
*/
class SugarcaneBlock extends FlowableBlock{
public function __construct($meta = 0){
parent::__construct(SUGARCANE_BLOCK, $meta, "Sugarcane");
}
public function getDrops(Item $item, Player $player){
return array(
array(SUGARCANE, 0, 1),
);
}
public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){
$down = $this->getSide(0);
if($down->isTransparent === true and $down->getID() !== SUGARCANE_BLOCK){ //Replace with common break method
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem(SUGARCANE));
$this->level->setBlock($this, new AirBlock(), false, false, true);
return BLOCK_UPDATE_NORMAL;
}
}elseif($type === BLOCK_UPDATE_RANDOM){
if($this->getSide(0)->getID() !== SUGARCANE_BLOCK){
if($this->meta === 0x0F){
for($y = 1; $y < 3; ++$y){
$b = $this->level->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
if($b->getID() === AIR){
$this->level->setBlock($b, new SugarcaneBlock(), true, false, true);
break;
}
}
$this->meta = 0;
$this->level->setBlock($this, $this, true, false, true);
}else{
++$this->meta;
$this->level->setBlock($this, $this, true, false, true);
}
return BLOCK_UPDATE_RANDOM;
}
}
return false;
}
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0);
if($down->getID() === SUGARCANE_BLOCK){
$this->level->setBlock($block, new SugarcaneBlock(), true, false, true);
return true;
}elseif($down->getID() === GRASS or $down->getID() === DIRT or $down->getID() === SAND){
$block0 = $down->getSide(2);
$block1 = $down->getSide(3);
$block2 = $down->getSide(4);
$block3 = $down->getSide(5);
if(($block0 instanceof WaterBlock) or ($block1 instanceof WaterBlock) or ($block2 instanceof WaterBlock) or ($block3 instanceof WaterBlock)){
$this->level->setBlock($block, new SugarcaneBlock(), true, false, true);
$this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM);
return true;
}
}
return false;
}
}

View File

@ -1,52 +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/
*
*
*/
class TallGrassBlock extends FlowableBlock{
public function __construct($meta = 1){
parent::__construct(TALL_GRASS, $meta, "Tall Grass");
$this->isReplaceable = true;
$names = array(
0 => "Dead Shrub",
1 => "Tall Grass",
2 => "Fern",
);
$this->name = $names[$this->meta & 0x03];
}
public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
$this->level->setBlock($this, new AirBlock(), false, false, true);
return BLOCK_UPDATE_NORMAL;
}
}
return false;
}
public function getDrops(Item $item, Player $player){
$drops = array();
if(mt_rand(1,10) === 1){//Seeds
$drops[] = array(WHEAT_SEEDS, 0, 1);
}
return $drops;
}
}

View File

@ -1,81 +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/
*
*
*/
class WheatBlock extends FlowableBlock{
public function __construct($meta = 0){
parent::__construct(WHEAT_BLOCK, $meta, "Wheat Block");
$this->isActivable = true;
}
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$down = $this->getSide(0);
if($down->getID() === FARMLAND){
$this->level->setBlock($block, $this, true, false, true);
$this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM);
return true;
}
return false;
}
public function onActivate(Item $item, Player $player){
if($item->getID() === 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 === BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem(WHEAT_SEEDS, 0, 1));
$this->level->setBlock($this, new AirBlock(), false, false, true);
return BLOCK_UPDATE_NORMAL;
}
}elseif($type === BLOCK_UPDATE_RANDOM){
if(mt_rand(0, 2) == 1){
if($this->meta < 0x07){
++$this->meta;
$this->level->setBlock($this, $this, true, false, true);
return BLOCK_UPDATE_RANDOM;
}
}else{
return BLOCK_UPDATE_RANDOM;
}
}
return false;
}
public function getDrops(Item $item, Player $player){
$drops = array();
if($this->meta >= 0x07){
$drops[] = array(WHEAT, 0, 1);
$drops[] = array(WHEAT_SEEDS, 0, mt_rand(0, 3));
}else{
$drops[] = array(WHEAT_SEEDS, 0, 1);
}
return $drops;
}
}

View File

@ -1,106 +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/
*
*
*/
class BurningFurnaceBlock extends SolidBlock{
public function __construct($meta = 0){
parent::__construct(BURNING_FURNACE, $meta, "Burning Furnace");
$this->isActivable = true;
}
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$faces = array(
0 => 4,
1 => 2,
2 => 5,
3 => 3,
);
$this->meta = $faces[$player->entity->getDirection()];
$this->level->setBlock($block, $this, true, false, true);
return true;
}
public function onBreak(Item $item, Player $player){
$this->level->setBlock($this, new AirBlock(), true, true, true);
return true;
}
public function onActivate(Item $item, Player $player){
$server = ServerAPI::request();
$t = $server->api->tile->get($this);
$furnace = false;
if($t !== false){
$furnace = $t;
}else{
$furnace = $server->api->tile->add($this->level, TILE_FURNACE, $this->x, $this->y, $this->z, array(
"Items" => array(),
"id" => TILE_FURNACE,
"x" => $this->x,
"y" => $this->y,
"z" => $this->z
));
}
if(($player->gamemode & 0x01) === 0x01){
return true;
}
$furnace->openInventory($player);
return true;
}
public function getBreakTime(Item $item, Player $player){
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
case 5:
return 0.7;
case 4:
return 0.9;
case 3:
return 1.35;
case 2:
return 0.45;
case 1:
return 2.65;
default:
return 17.5;
}
}
public function getDrops(Item $item, Player $player){
$drops = array();
if($item->isPickaxe() >= 1){
$drops[] = array(FURNACE, 0, 1);
}
$t = ServerAPI::request()->api->tile->get($this);
if($t !== false and $t->class === TILE_FURNACE){
for($s = 0; $s < FURNACE_SLOTS; ++$s){
$slot = $t->getSlot($s);
if($slot->getID() > AIR and $slot->count > 0){
$drops[] = array($slot->getID(), $slot->getMetadata(), $slot->count);
}
}
}
return $drops;
}
}

View File

@ -1,125 +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/
*
*
*/
class ChestBlock extends TransparentBlock{
public function __construct($meta = 0){
parent::__construct(CHEST, $meta, "Chest");
$this->isActivable = true;
}
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$server = ServerAPI::request();
$faces = array(
0 => 4,
1 => 2,
2 => 5,
3 => 3,
);
$chest = false;
$this->meta = $faces[$player->entity->getDirection()];
for($side = 2; $side <= 5; ++$side){
if(($this->meta === 4 or $this->meta === 5) and ($side === 4 or $side === 5)){
continue;
}elseif(($this->meta === 3 or $this->meta === 2) and ($side === 2 or $side === 3)){
continue;
}
$c = $this->getSide($side);
if(($c instanceof ChestBlock) and $c->getMetadata() === $this->meta){
if((($tile = $server->api->tile->get($c)) instanceof Tile) and !$tile->isPaired()){
$chest = $tile;
break;
}
}
}
$this->level->setBlock($block, $this, true, false, true);
$tile = $server->api->tile->add($this->level, TILE_CHEST, $this->x, $this->y, $this->z, array(
"Items" => array(),
"id" => TILE_CHEST,
"x" => $this->x,
"y" => $this->y,
"z" => $this->z
));
if($chest instanceof Tile){
$chest->pairWith($tile);
$tile->pairWith($chest);
}
return true;
}
public function onBreak(Item $item, Player $player){
$t = ServerAPI::request()->api->tile->get($this);
if($t !== false){
$t->unpair();
}
$this->level->setBlock($this, new AirBlock(), true, true, true);
return true;
}
public function onActivate(Item $item, Player $player){
$top = $this->getSide(1);
if($top->isTransparent !== true){
return true;
}
$server = ServerAPI::request();
$t = $server->api->tile->get($this);
$chest = false;
if($t !== false){
$chest = $t;
}else{
$chest = $server->api->tile->add($this->level, TILE_CHEST, $this->x, $this->y, $this->z, array(
"Items" => array(),
"id" => TILE_CHEST,
"x" => $this->x,
"y" => $this->y,
"z" => $this->z
));
}
if(($player->gamemode & 0x01) === 0x01){
return true;
}
$chest->openInventory($player);
return true;
}
public function getDrops(Item $item, Player $player){
$drops = array(
array($this->id, 0, 1),
);
$t = ServerAPI::request()->api->tile->get($this);
if($t !== false and $t->class === TILE_CHEST){
for($s = 0; $s < CHEST_SLOTS; ++$s){
$slot = $t->getSlot($s);
if($slot->getID() > AIR and $slot->count > 0){
$drops[] = array($slot->getID(), $slot->getMetadata(), $slot->count);
}
}
}
return $drops;
}
}

View File

@ -1,56 +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/
*
*
*/
class CobblestoneBlock extends SolidBlock{
public function __construct(){
parent::__construct(COBBLESTONE, 0, "Cobblestone");
}
public function getBreakTime(Item $item, Player $player){
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
case 5:
return 0.4;
case 4:
return 0.5;
case 3:
return 0.75;
case 2:
return 0.25;
case 1:
return 1.5;
default:
return 10;
}
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
return array(
array(COBBLESTONE, 0, 1),
);
}else{
return array();
}
}
}

View File

@ -1,50 +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/
*
*
*/
class DiamondBlock extends SolidBlock{
public function __construct(){
parent::__construct(DIAMOND_BLOCK, 0, "Diamond Block");
}
public function getBreakTime(Item $item, Player $player){
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
case 5:
return 0.95;
case 4:
return 1.25;
default:
return 25;
}
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 4){
return array(
array(DIAMOND_BLOCK, 0, 1),
);
}else{
return array();
}
}
}

View File

@ -1,31 +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/
*
*
*/
class FarmlandBlock extends SolidBlock{
public function __construct($meta = 0){
parent::__construct(FARMLAND, $meta, "Farmland");
}
public function getDrops(Item $item, Player $player){
return array(
array(DIRT, 0, 1),
);
}
}

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/
*
*
*/
class GlowingObsidianBlock extends SolidBlock{
public function __construct($meta = 0){
parent::__construct(GLOWING_OBSIDIAN, $meta, "Glowing Obsidian");
}
}

View File

@ -1,49 +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/
*
*
*/
class GrassBlock extends SolidBlock{
public function __construct(){
parent::__construct(GRASS, 0, "Grass");
$this->isActivable = true;
}
public function getDrops(Item $item, Player $player){
return array(
array(DIRT, 0, 1),
);
}
public function onActivate(Item $item, Player $player){
if($item->getID() === DYE and $item->getMetadata() === 0x0F){
if(($player->gamemode & 0x01) === 0){
$item->count--;
}
TallGrassObject::growGrass($this->level, $this, new Random());
return true;
}elseif($item->isHoe()){
if(($player->gamemode & 0x01) === 0){
$item->useOn($this);
}
$this->level->setBlock($this, new FarmlandBlock());
return true;
}
return false;
}
}

View File

@ -1,59 +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/
*
*
*/
class IceBlock extends TransparentBlock{
public function __construct(){
parent::__construct(ICE, 0, "Ice");
}
public function onBreak(Item $item, Player $player){
if(($player->gamemode & 0x01) === 0){
$this->level->setBlock($this, new WaterBlock(), true, false, true);
}else{
$this->level->setBlock($this, new AirBlock(), true, false, true);
}
return true;
}
public function getBreakTime(Item $item, Player $player){
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
case 5:
return 0.1;
case 4:
return 0.15;
case 3:
return 0.2;
case 2:
return 0.1;
case 1:
return 0.4;
default:
return 0.75;
}
}
public function getDrops(Item $item, Player $player){
return array();
}
}

View File

@ -1,56 +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/
*
*
*/
class MossStoneBlock extends SolidBlock{
public function __construct(){
parent::__construct(MOSS_STONE, 0, "Moss Stone");
}
public function getBreakTime(Item $item, Player $player){
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
case 5:
return 0.4;
case 4:
return 0.5;
case 3:
return 0.75;
case 2:
return 0.25;
case 1:
return 1.5;
default:
return 10;
}
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
return array(
array(MOSS_STONE, 0, 1),
);
}else{
return array();
}
}
}

View File

@ -1,56 +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/
*
*
*/
class NetherBricksBlock extends SolidBlock{
public function __construct(){
parent::__construct(NETHER_BRICKS, 0, "Nether Bricks");
}
public function getBreakTime(Item $item, Player $player){
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
case 5:
return 0.4;
case 4:
return 0.5;
case 3:
return 0.75;
case 2:
return 0.25;
case 1:
return 1.5;
default:
return 10;
}
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
return array(
array(NETHER_BRICKS, 0, 1),
);
}else{
return array();
}
}
}

View File

@ -1,56 +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/
*
*
*/
class NetherrackBlock extends SolidBlock{
public function __construct(){
parent::__construct(NETHERRACK, 0, "Netherrack");
}
public function getBreakTime(Item $item, Player $player){
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
case 5:
return 0.1;
case 4:
return 0.1;
case 3:
return 0.15;
case 2:
return 0.05;
case 1:
return 0.3;
default:
return 2;
}
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
return array(
array(NETHERRACK, 0, 1),
);
}else{
return array();
}
}
}

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/
*
*
*/
class PlanksBlock extends SolidBlock{
public function __construct($meta = 0){
parent::__construct(PLANKS, $meta, "Wooden Planks");
}
}

View File

@ -1,63 +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/
*
*
*/
class QuartzBlock extends SolidBlock{
public function __construct($meta = 0){
parent::__construct(QUARTZ_BLOCK, $meta, "Quartz Block");
$names = array(
0 => "Quartz Block",
1 => "Chiseled Quartz Block",
2 => "Quartz Pillar",
3 => "Quartz Pillar",
);
$this->name = $names[$this->meta & 0x03];
}
public function getBreakTime(Item $item, Player $player){
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
case 5:
return 0.15;
case 4:
return 0.2;
case 3:
return 0.3;
case 2:
return 0.1;
case 1:
return 0.6;
default:
return 4;
}
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
return array(
array(QUARTZ_BLOCK, $this->meta & 0x03, 1),
);
}else{
return array();
}
}
}

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/
*
*
*/
class SoulSandBlock extends SolidBlock{
public function __construct(){
parent::__construct(SOUL_SAND, 0, "Soul Sand");
}
}

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/
*
*
*/
class StoneBlock extends SolidBlock{
public function __construct(){
parent::__construct(STONE, 0, "Stone");
}
public function getBreakTime(Item $item, Player $player){
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
case 5:
return 0.4;
case 4:
return 0.5;
case 3:
return 0.75;
case 2:
return 0.25;
case 1:
return 1.5;
default:
return 7.5;
}
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
return array(
array(COBBLESTONE, 0, 1),
);
}else{
return array();
}
}
}

View File

@ -1,64 +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/
*
*
*/
class StoneBricksBlock extends SolidBlock{
public function __construct($meta = 0){
parent::__construct(STONE_BRICKS, $meta, "Stone Bricks");
$names = array(
0 => "Stone Bricks",
1 => "Mossy Stone Bricks",
2 => "Cracked Stone Bricks",
3 => "Chiseled Stone Bricks",
);
$this->name = $names[$this->meta & 0x03];
}
public function getBreakTime(Item $item, Player $player){
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
case 5:
return 0.4;
case 4:
return 0.5;
case 3:
return 0.75;
case 2:
return 0.25;
case 1:
return 1.5;
default:
return 7.5;
}
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
return array(
array(STONE_BRICKS, $this->meta & 0x03, 1),
);
}else{
return array();
}
}
}

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/
*
*
*/
class BucketItem extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(BUCKET, $meta, $count, "Bucket");
$this->isActivable = true;
$this->maxStackSize = 1;
}
public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
if($this->meta === AIR){
if($target instanceof LiquidBlock){
$level->setBlock($target, new AirBlock(), true, false, true);
if(($player->gamemode & 0x01) === 0){
$this->meta = ($target instanceof WaterBlock) ? WATER:LAVA;
}
return true;
}
}elseif($this->meta === WATER){
if($block->getID() === AIR){
$level->setBlock($block, new StillWaterBlock(), true, false, true);
if(($player->gamemode & 0x01) === 0){
$this->meta = 0;
}
return true;
}
}elseif($this->meta === LAVA){
if($block->getID() === AIR){
$level->setBlock($block, new StillLavaBlock(), true, false, true);
if(($player->gamemode & 0x01) === 0){
$this->meta = 0;
}
return true;
}
}
return false;
}
}

View File

@ -1,28 +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/
*
*
*/
class SignItem extends Item{
public function __construct($meta = 0, $count = 1){
$this->block = BlockAPI::get(SIGN_POST);
$this->maxStackSize = 16;
parent::__construct(SIGN, 0, $count, "Sign");
}
}

View File

@ -1,50 +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/
*
*
*/
class SpawnEggItem extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(SPAWN_EGG, 0, $count, "Spawn Egg");
$this->meta = $meta;
$this->isActivable = true;
}
public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
switch($this->meta){
case MOB_CHICKEN:
case MOB_SHEEP:
case MOB_COW:
case MOB_PIG:
$data = array(
"x" => $block->x + 0.5,
"y" => $block->y,
"z" => $block->z + 0.5,
);
$e = ServerAPI::request()->api->entity->add($block->level, ENTITY_MOB, $this->meta, $data);
ServerAPI::request()->api->entity->spawnToAll($e);
if(($player->gamemode & 0x01) === 0){
--$this->count;
}
return true;
break;
}
return false;
}
}

View File

@ -1,194 +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/
*
*
*/
class Vector3{
public $x, $y, $z;
public function __construct($x = 0, $y = 0, $z = 0){
if(($x instanceof Vector3) === true){
$this->__construct($x->x, $x->y, $x->z);
}else{
$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($x = 0, $y = 0, $z = 0){
if(($x instanceof Vector3) === true){
return sqrt($this->distanceSquared($x->x, $x->y, $x->z));
}else{
return sqrt($this->distanceSquared($x, $y, $z));
}
}
public function distanceSquared($x = 0, $y = 0, $z = 0){
if(($x instanceof Vector3) === true){
return $this->distanceSquared($x->x, $x->y, $x->z);
}else{
return pow($this->x - $x, 2) + pow($this->y - $y, 2) + pow($this->z - $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,840 +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/
*
*
*/
class CustomPacketHandler{
public $offset;
public $raw;
public $c;
public $data;
public $name = "";
public function get($len = true, $check = true){
if($len === true){
$data = substr($this->raw, $this->offset);
if($check === true){
$this->offset = strlen($this->raw);
}
return $data;
}
$data = substr($this->raw, $this->offset, $len);
if($check === true){
$this->offset += $len;
}
return $data;
}
public function __construct($pid, $raw = "", $data = array(), $create = false){
$this->raw = $raw;
$this->data = $data;
$this->offset = 0;
$this->c = (bool) $create;
if($pid === false){
return;
}
switch($pid){
case MC_PING:
if($this->c === false){
$this->data["time"] = Utils::readLong($this->get(8));
}else{
$this->raw .= Utils::writeLong($this->data["time"]);
}
break;
case MC_PONG:
if($this->c === false){
$this->data["ptime"] = Utils::readLong($this->get(8));
$this->data["time"] = Utils::readLong($this->get(8));
}else{
$this->raw .= Utils::writeLong($this->data["ptime"]);
$this->raw .= Utils::writeLong($this->data["time"]);
}
break;
case MC_CLIENT_CONNECT:
if($this->c === false){
$this->data["clientID"] = Utils::readLong($this->get(8));
$this->data["session"] = Utils::readLong($this->get(8));
$this->data["unknown2"] = $this->get(1);
}else{
$this->raw .= Utils::writeLong($this->data["clientID"]);
$this->raw .= Utils::writeLong($this->data["session"]);
$this->raw .= "\x00";
}
break;
case MC_SERVER_HANDSHAKE:
if($this->c === false){
$this->data["cookie"] = $this->get(4); // 043f57fe
$this->data["security"] = $this->get(1);
$this->data["port"] = Utils::readShort($this->get(2), false);
$this->data["dataArray"] = Utils::readDataArray($this->get(true, false), 10, $offset);
$this->get($offset);
$this->data["timestamp"] = $this->get(2);
$this->data["session"] = Utils::readLong($this->get(8));
$this->data["session2"] = Utils::readLong($this->get(8));
}else{
$this->raw .= "\x04\x3f\x57\xfe";
$this->raw .= "\xcd";
$this->raw .= Utils::writeShort($this->data["port"]);
$this->raw .= Utils::writeDataArray(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->raw .= "\x00\x00";
$this->raw .= Utils::writeLong($this->data["session"]);
$this->raw .= Utils::writeLong($this->data["session2"]);
}
break;
case MC_CLIENT_HANDSHAKE:
if($this->c === false){
$this->data["cookie"] = $this->get(4); // 043f57fe
$this->data["security"] = $this->get(1);
$this->data["port"] = Utils::readShort($this->get(2), false);
$this->data["dataArray0"] = $this->get(ord($this->get(1)));
$this->data["dataArray"] = Utils::readDataArray($this->get(true, false), 9, $offset);
$this->get($offset);
$this->data["timestamp"] = $this->get(2);
$this->data["session2"] = Utils::readLong($this->get(8));
$this->data["session"] = Utils::readLong($this->get(8));
}else{
$this->raw .= "\x04\x3f\x57\xfe";
$this->raw .= "\xed";
$this->raw .= Utils::writeShort($this->data["port"]);
$w = array_shift($this->data["dataArray"]);
$this->raw .= chr(strlen($w)).$w;
$this->raw .= Utils::writeDataArray($this->data["dataArray"]);
$this->raw .= "\x00\x00";
$this->raw .= Utils::writeLong($this->data["session2"]);
$this->raw .= Utils::writeLong($this->data["session"]);
}
break;
case MC_SERVER_FULL:
if($this->c === false){
}else{
$this->raw .= RAKNET_MAGIC;
$this->raw .= Utils::writeLong($this->data["serverID"]);
}
break;
case MC_DISCONNECT:
//null
break;
case MC_BANNED:
if($this->c === false){
}else{
$this->raw .= RAKNET_MAGIC;
$this->raw .= Utils::writeLong($this->data["serverID"]);
}
break;
case MC_LOGIN:
if($this->c === false){
$this->data["username"] = $this->get(Utils::readShort($this->get(2), false));
$this->data["protocol1"] = Utils::readInt($this->get(4));
$this->data["protocol2"] = Utils::readInt($this->get(4));
$this->data["clientId"] = Utils::readInt($this->get(4));
$this->data["realms_data"] = $this->get(Utils::readShort($this->get(2), false));
}else{
$this->raw .= Utils::writeShort(strlen($this->data["username"])).$this->data["username"];
$this->raw .= Utils::writeInt(CURRENT_PROTOCOL).
Utils::writeInt(CURRENT_PROTOCOL).
Utils::writeInt($this->data["clientId"]);
$this->raw .= Utils::writeShort(strlen($this->data["realms_data"])).$this->data["realms_data"];
}
break;
case MC_LOGIN_STATUS:
if($this->c === false){
$this->data["status"] = Utils::readInt($this->get(4));
}else{
$this->raw .= Utils::writeInt($this->data["status"]);
}
break;
case MC_READY:
if($this->c === false){
$this->data["status"] = ord($this->get(1));
}else{
$this->raw .= chr($this->data["status"]);
}
break;
case MC_CHAT:
if($this->c === false){
$this->data["player"] = $this->get(Utils::readShort($this->get(2), false));
$this->data["message"] = $this->get(Utils::readShort($this->get(2), false));
}else{
$this->raw .= Utils::writeShort(strlen($this->data["player"])).$this->data["player"];
$this->raw .= Utils::writeShort(strlen($this->data["message"])).$this->data["message"];
}
break;
case MC_SET_TIME:
if($this->c === false){
$this->data["time"] = Utils::readInt($this->get(4));
}else{
$this->raw .= Utils::writeInt($this->data["time"]);
}
break;
case MC_START_GAME:
if($this->c === false){
$this->data["seed"] = Utils::readInt($this->get(4));
$this->data["generator"] = Utils::readInt($this->get(4));
$this->data["gamemode"] = Utils::readInt($this->get(4));
$this->data["eid"] = Utils::readInt($this->get(4));
$this->data["x"] = Utils::readFloat($this->get(4));
$this->data["y"] = Utils::readFloat($this->get(4));
$this->data["z"] = Utils::readFloat($this->get(4));
}else{
$this->raw .= Utils::writeInt($this->data["seed"]);
$this->raw .= Utils::writeInt($this->data["generator"]);
$this->raw .= Utils::writeInt($this->data["gamemode"]);
$this->raw .= Utils::writeInt($this->data["eid"]);
$this->raw .= Utils::writeFloat($this->data["x"]);
$this->raw .= Utils::writeFloat($this->data["y"]);
$this->raw .= Utils::writeFloat($this->data["z"]);
}
break;
case MC_ADD_MOB:
if($this->c === false){
$this->data["eid"] = Utils::readInt($this->get(4));
$this->data["type"] = Utils::readInt($this->get(4));
$this->data["x"] = Utils::readFloat($this->get(4));
$this->data["y"] = Utils::readFloat($this->get(4));
$this->data["z"] = Utils::readFloat($this->get(4));
$this->data["pitch"] = Utils::readByte($this->get(1));
$this->data["yaw"] = Utils::readByte($this->get(1));
$this->data["metadata"] = Utils::readMetadata($this->get(true));
}else{
$this->raw .= Utils::writeInt($this->data["eid"]);
$this->raw .= Utils::writeInt($this->data["type"]);
$this->raw .= Utils::writeFloat($this->data["x"]);
$this->raw .= Utils::writeFloat($this->data["y"]);
$this->raw .= Utils::writeFloat($this->data["z"]);
$this->raw .= Utils::writeByte($this->data["pitch"]);
$this->raw .= Utils::writeByte($this->data["yaw"]);
$this->raw .= Utils::writeMetadata($this->data["metadata"]);
}
break;
case MC_ADD_PLAYER:
if($this->c === false){
$this->data["clientID"] = Utils::readLong($this->get(8));
$this->data["username"] = $this->get(Utils::readShort($this->get(2), false));
$this->data["eid"] = Utils::readInt($this->get(4));
$this->data["x"] = Utils::readFloat($this->get(4));
$this->data["y"] = Utils::readFloat($this->get(4));
$this->data["z"] = Utils::readFloat($this->get(4));
$this->data["pitch"] = Utils::readByte($this->get(1));
$this->data["yaw"] = Utils::readByte($this->get(1));
$this->data["unknown1"] = Utils::readShort($this->get(2));
$this->data["unknown2"] = Utils::readShort($this->get(2));
$this->data["metadata"] = Utils::readMetadata($this->get(true));
}else{
$this->raw .= Utils::writeLong($this->data["clientID"]);
$this->raw .= Utils::writeShort(strlen($this->data["username"])).$this->data["username"];
$this->raw .= Utils::writeInt($this->data["eid"]);
$this->raw .= Utils::writeFloat($this->data["x"]);
$this->raw .= Utils::writeFloat($this->data["y"]);
$this->raw .= Utils::writeFloat($this->data["z"]);
$this->raw .= Utils::writeByte($this->data["pitch"]);
$this->raw .= Utils::writeByte($this->data["yaw"]);
$this->raw .= Utils::writeShort($this->data["unknown1"]);
$this->raw .= Utils::writeShort($this->data["unknown2"]);
$this->raw .= Utils::writeMetadata($this->data["metadata"]);
}
break;
case MC_REMOVE_PLAYER:
if($this->c === false){
$this->data["eid"] = Utils::readInt($this->get(4));
$this->data["clientID"] = Utils::readLong($this->get(8));
}else{
$this->raw .= Utils::writeInt($this->data["eid"]);
$this->raw .= Utils::writeLong($this->data["clientID"]);
}
break;
case MC_ADD_ENTITY:
if($this->c === false){
$this->data["eid"] = Utils::readInt($this->get(4));
$this->data["type"] = ord($this->get(1));
$this->data["x"] = Utils::readFloat($this->get(4));
$this->data["y"] = Utils::readFloat($this->get(4));
$this->data["z"] = Utils::readFloat($this->get(4));
$this->data["did"] = Utils::readInt($this->get(4));
if($this->data["did"] > 0){
$this->data["speedX"] = Utils::readShort($this->get(2));
$this->data["speedY"] = Utils::readShort($this->get(2));
$this->data["speedZ"] = Utils::readShort($this->get(2));
}
}else{
$this->raw .= Utils::writeInt($this->data["eid"]);
$this->raw .= chr($this->data["type"]);
$this->raw .= Utils::writeFloat($this->data["x"]);
$this->raw .= Utils::writeFloat($this->data["y"]);
$this->raw .= Utils::writeFloat($this->data["z"]);
$this->raw .= Utils::writeInt($this->data["did"]);
if($this->data["did"] > 0){
$this->raw .= Utils::writeShort($this->data["speedX"]);
$this->raw .= Utils::writeShort($this->data["speedY"]);
$this->raw .= Utils::writeShort($this->data["speedZ"]);
}
}
break;
case MC_REMOVE_ENTITY:
if($this->c === false){
$this->data["eid"] = Utils::readInt($this->get(4));
}else{
$this->raw .= Utils::writeInt($this->data["eid"]);
}
break;
case MC_ADD_ITEM_ENTITY:
if($this->c === false){
$this->data["eid"] = Utils::readInt($this->get(4));
$this->data["block"] = Utils::readShort($this->get(2), false);
$this->data["stack"] = ord($this->get(1));
$this->data["meta"] = Utils::readShort($this->get(2), false);
$this->data["x"] = Utils::readFloat($this->get(4));
$this->data["y"] = Utils::readFloat($this->get(4));
$this->data["z"] = Utils::readFloat($this->get(4));
$this->data["yaw"] = Utils::readByte($this->get(1));
$this->data["pitch"] = Utils::readByte($this->get(1));
$this->data["roll"] = Utils::readByte($this->get(1));
}else{
$this->raw .= Utils::writeInt($this->data["eid"]);
$this->raw .= Utils::writeShort($this->data["block"]);
$this->raw .= chr($this->data["stack"]);
$this->raw .= Utils::writeShort($this->data["meta"]);
$this->raw .= Utils::writeFloat($this->data["x"]);
$this->raw .= Utils::writeFloat($this->data["y"]);
$this->raw .= Utils::writeFloat($this->data["z"]);
$this->raw .= Utils::writeByte($this->data["yaw"]);
$this->raw .= Utils::writeByte($this->data["pitch"]);
$this->raw .= Utils::writeByte($this->data["roll"]);
}
break;
case MC_TAKE_ITEM_ENTITY:
if($this->c === false){
$this->data["target"] = Utils::readInt($this->get(4));
$this->data["eid"] = Utils::readInt($this->get(4));
}else{
$this->raw .= Utils::writeInt($this->data["target"]);
$this->raw .= Utils::writeInt($this->data["eid"]);
}
break;
case MC_MOVE_ENTITY:
if($this->c === false){
$this->data["eid"] = Utils::readInt($this->get(4));
$this->data["x"] = Utils::readFloat($this->get(4));
$this->data["y"] = Utils::readFloat($this->get(4));
$this->data["z"] = Utils::readFloat($this->get(4));
}else{
$this->raw .= Utils::writeInt($this->data["eid"]);
$this->raw .= Utils::writeFloat($this->data["x"]);
$this->raw .= Utils::writeFloat($this->data["y"]);
$this->raw .= Utils::writeFloat($this->data["z"]);
}
break;
case MC_MOVE_ENTITY_POSROT:
if($this->c === false){
$this->data["eid"] = Utils::readInt($this->get(4));
$this->data["x"] = Utils::readFloat($this->get(4));
$this->data["y"] = Utils::readFloat($this->get(4));
$this->data["z"] = Utils::readFloat($this->get(4));
$this->data["yaw"] = Utils::readFloat($this->get(4));
$this->data["pitch"] = Utils::readFloat($this->get(4));
}else{
$this->raw .= Utils::writeInt($this->data["eid"]);
$this->raw .= Utils::writeFloat($this->data["x"]);
$this->raw .= Utils::writeFloat($this->data["y"]);
$this->raw .= Utils::writeFloat($this->data["z"]);
$this->raw .= Utils::writeFloat($this->data["yaw"]);
$this->raw .= Utils::writeFloat($this->data["pitch"]);
}
break;
case MC_MOVE_PLAYER:
if($this->c === false){
$this->data["eid"] = Utils::readInt($this->get(4));
$this->data["x"] = Utils::readFloat($this->get(4));
$this->data["y"] = Utils::readFloat($this->get(4));
$this->data["z"] = Utils::readFloat($this->get(4));
$this->data["yaw"] = Utils::readFloat($this->get(4));
$this->data["pitch"] = Utils::readFloat($this->get(4));
}else{
$this->raw .= Utils::writeInt($this->data["eid"]);
$this->raw .= Utils::writeFloat($this->data["x"]);
$this->raw .= Utils::writeFloat($this->data["y"]);
$this->raw .= Utils::writeFloat($this->data["z"]);
$this->raw .= Utils::writeFloat($this->data["yaw"]);
$this->raw .= Utils::writeFloat($this->data["pitch"]);
}
break;
case MC_PLACE_BLOCK:
if($this->c === false){
$this->data["eid"] = Utils::readInt($this->get(4));
$this->data["x"] = Utils::readInt($this->get(4));
$this->data["z"] = Utils::readInt($this->get(4));
$this->data["y"] = ord($this->get(1));
$this->data["block"] = ord($this->get(1));
$this->data["meta"] = ord($this->get(1));
$this->data["face"] = Utils::readByte($this->get(1));
}else{
$this->raw .= Utils::writeInt($this->data["eid"]);
$this->raw .= Utils::writeInt($this->data["x"]);
$this->raw .= Utils::writeInt($this->data["z"]);
$this->raw .= chr($this->data["y"]);
$this->raw .= chr($this->data["block"]);
$this->raw .= chr($this->data["meta"]);
$this->raw .= chr($this->data["face"]);
}
break;
case MC_REMOVE_BLOCK: //Sent when a player removes a block, not used
if($this->c === false){
$this->data["eid"] = Utils::readInt($this->get(4));
$this->data["x"] = Utils::readInt($this->get(4));
$this->data["z"] = Utils::readInt($this->get(4));
$this->data["y"] = ord($this->get(1));
}else{
$this->raw .= Utils::writeInt($this->data["eid"]);
$this->raw .= Utils::writeInt($this->data["x"]);
$this->raw .= Utils::writeInt($this->data["z"]);
$this->raw .= chr($this->data["y"]);
}
break;
case MC_UPDATE_BLOCK:
if($this->c === false){
$this->data["x"] = Utils::readInt($this->get(4));
$this->data["z"] = Utils::readInt($this->get(4));
$this->data["y"] = ord($this->get(1));
$this->data["block"] = ord($this->get(1));
$this->data["meta"] = ord($this->get(1));
}else{
$this->raw .= Utils::writeInt($this->data["x"]);
$this->raw .= Utils::writeInt($this->data["z"]);
$this->raw .= chr($this->data["y"]);
$this->raw .= chr($this->data["block"]);
$this->raw .= chr($this->data["meta"]);
}
break;
case MC_ADD_PAINTING:
if($this->c === false){
$this->data["eid"] = Utils::readInt($this->get(4));
$this->data["x"] = Utils::readInt($this->get(4));
$this->data["y"] = Utils::readInt($this->get(4));
$this->data["z"] = Utils::readInt($this->get(4));
$this->data["direction"] = Utils::readInt($this->get(4));
$this->data["title"] = $this->get(Utils::readShort($this->get(2), false));
}else{
$this->raw .= Utils::writeInt($this->data["eid"]);
$this->raw .= Utils::writeInt($this->data["x"]);
$this->raw .= Utils::writeInt($this->data["y"]);
$this->raw .= Utils::writeInt($this->data["z"]);
$this->raw .= Utils::writeInt($this->data["direction"]);
$this->raw .= Utils::writeShort(strlen($this->data["title"])).$this->data["title"];
}
break;
case MC_EXPLOSION:
if($this->c === false){
$this->data["x"] = Utils::readFloat($this->get(4));
$this->data["y"] = Utils::readFloat($this->get(4));
$this->data["z"] = Utils::readFloat($this->get(4));
$this->data["radius"] = Utils::readFloat($this->get(4));
$this->data["count"] = Utils::readInt($this->get(4));
$this->data["records"] = array();
for($r = 0; $r < $this->data["count"]; ++$r){
$this->data["records"][] = new Vector3(Utils::readByte($this->get(1)), Utils::readByte($this->get(1)), Utils::readByte($this->get(1)));
}
}else{
$this->raw .= Utils::writeFloat($this->data["x"]);
$this->raw .= Utils::writeFloat($this->data["y"]);
$this->raw .= Utils::writeFloat($this->data["z"]);
$this->raw .= Utils::writeFloat($this->data["radius"]);
$this->data["records"] = (array) $this->data["records"];
$this->raw .= Utils::writeInt(count($this->data["records"]));
if(count($this->data["records"]) > 0){
foreach($this->data["records"] as $record){
$this->raw .= Utils::writeByte($record->x) . Utils::writeByte($record->y) . Utils::writeByte($record->z);
}
}
}
break;
case MC_LEVEL_EVENT:
if($this->c === false){
$this->data["unknown1"] = Utils::readShort($this->get(2));
$this->data["unknown2"] = Utils::readShort($this->get(2));
$this->data["unknown3"] = Utils::readShort($this->get(2));
$this->data["unknown4"] = Utils::readShort($this->get(2));
$this->data["unknown5"] = Utils::readInt($this->get(4));
}else{
$this->raw .= Utils::writeShort($this->data["unknown1"]);
$this->raw .= Utils::writeShort($this->data["unknown2"]);
$this->raw .= Utils::writeShort($this->data["unknown3"]);
$this->raw .= Utils::writeShort($this->data["unknown4"]);
$this->raw .= Utils::writeInt($this->data["unknown5"]);
}
break;
case MC_TILE_EVENT:
if($this->c === false){
$this->data["x"] = Utils::readInt($this->get(4));
$this->data["y"] = Utils::readInt($this->get(4));
$this->data["z"] = Utils::readInt($this->get(4));
$this->data["case1"] = Utils::readInt($this->get(4));
$this->data["case2"] = Utils::readInt($this->get(4));
}else{
$this->raw .= Utils::writeInt($this->data["x"]);
$this->raw .= Utils::writeInt($this->data["y"]);
$this->raw .= Utils::writeInt($this->data["z"]);
$this->raw .= Utils::writeInt($this->data["case1"]);
$this->raw .= Utils::writeInt($this->data["case2"]);
}
break;
case MC_ENTITY_EVENT:
if($this->c === false){
$this->data["eid"] = Utils::readInt($this->get(4));
$this->data["event"] = ord($this->get(1));
}else{
$this->raw .= Utils::writeInt($this->data["eid"]);
$this->raw .= chr($this->data["event"]);
}
break;
case MC_REQUEST_CHUNK:
if($this->c === false){
$this->data["x"] = Utils::readInt($this->get(4));
$this->data["z"] = Utils::readInt($this->get(4));
}else{
$this->raw .= Utils::writeInt($this->data["x"]);
$this->raw .= Utils::writeInt($this->data["z"]);
}
break;
case MC_CHUNK_DATA:
if($this->c === false){
$this->data["x"] = Utils::readInt($this->get(4));
$this->data["z"] = Utils::readInt($this->get(4));
$this->data["data"] = $this->get(true);
}else{
$this->raw .= Utils::writeInt($this->data["x"]);
$this->raw .= Utils::writeInt($this->data["z"]);
$this->raw .= $this->data["data"];
}
break;
case MC_PLAYER_EQUIPMENT:
if($this->c === false){
$this->data["eid"] = Utils::readInt($this->get(4));
$this->data["block"] = Utils::readShort($this->get(2), false);
$this->data["meta"] = Utils::readShort($this->get(2), false);
$this->data["slot"] = ord($this->get(1));
}else{
$this->raw .= Utils::writeInt($this->data["eid"]);
$this->raw .= Utils::writeShort($this->data["block"]);
$this->raw .= Utils::writeShort($this->data["meta"]);
$this->raw .= chr($this->data["slot"]);
}
break;
case MC_PLAYER_ARMOR_EQUIPMENT:
if($this->c === false){
$this->data["eid"] = Utils::readInt($this->get(4));
$this->data["slot0"] = ord($this->get(1));
$this->data["slot1"] = ord($this->get(1));
$this->data["slot2"] = ord($this->get(1));
$this->data["slot3"] = ord($this->get(1));
}else{
$this->raw .= Utils::writeInt($this->data["eid"]);
$this->raw .= chr($this->data["slot0"]);
$this->raw .= chr($this->data["slot1"]);
$this->raw .= chr($this->data["slot2"]);
$this->raw .= chr($this->data["slot3"]);
}
break;
case MC_INTERACT:
if($this->c === false){
$this->data["action"] = Utils::readByte($this->get(1));
$this->data["eid"] = Utils::readInt($this->get(4));
$this->data["target"] = Utils::readInt($this->get(4));
}else{
$this->raw .= Utils::writeByte($this->data["action"]);
$this->raw .= Utils::writeInt($this->data["eid"]);
$this->raw .= Utils::writeInt($this->data["target"]);
}
break;
case MC_USE_ITEM:
if($this->c === false){
$this->data["x"] = Utils::readInt($this->get(4));
$this->data["y"] = Utils::readInt($this->get(4));
$this->data["z"] = Utils::readInt($this->get(4));
$this->data["face"] = Utils::readInt($this->get(4));
$this->data["block"] = Utils::readShort($this->get(2));
$this->data["meta"] = Utils::readByte($this->get(1));
$this->data["eid"] = Utils::readInt($this->get(4));
$this->data["fx"] = Utils::readFloat($this->get(4));
$this->data["fy"] = Utils::readFloat($this->get(4));
$this->data["fz"] = Utils::readFloat($this->get(4));
$this->data["posX"] = Utils::readFloat($this->get(4));
$this->data["posY"] = Utils::readFloat($this->get(4));
$this->data["posZ"] = Utils::readFloat($this->get(4));
}else{
$this->raw .= Utils::writeInt($this->data["x"]);
$this->raw .= Utils::writeInt($this->data["y"]);
$this->raw .= Utils::writeInt($this->data["z"]);
$this->raw .= Utils::writeInt($this->data["face"]);
$this->raw .= Utils::writeShort($this->data["block"]);
$this->raw .= Utils::writeByte($this->data["meta"]);
$this->raw .= Utils::writeInt($this->data["eid"]);
$this->raw .= Utils::writeFloat($this->data["fx"]);
$this->raw .= Utils::writeFloat($this->data["fy"]);
$this->raw .= Utils::writeFloat($this->data["fz"]);
$this->raw .= Utils::writeFloat($this->data["posX"]);
$this->raw .= Utils::writeFloat($this->data["posY"]);
$this->raw .= Utils::writeFloat($this->data["posZ"]);
}
break;
case MC_PLAYER_ACTION:
if($this->c === false){
$this->data["action"] = Utils::readInt($this->get(4));
$this->data["x"] = Utils::readInt($this->get(4));
$this->data["y"] = Utils::readInt($this->get(4));
$this->data["z"] = Utils::readInt($this->get(4));
$this->data["face"] = Utils::readInt($this->get(4));
$this->data["eid"] = Utils::readInt($this->get(4));
}else{
$this->raw .= Utils::writeInt($this->data["action"]);
$this->raw .= Utils::writeInt($this->data["x"]);
$this->raw .= Utils::writeInt($this->data["y"]);
$this->raw .= Utils::writeInt($this->data["z"]);
$this->raw .= Utils::writeInt($this->data["face"]);
$this->raw .= Utils::writeInt($this->data["eid"]);
}
break;
case MC_SET_ENTITY_DATA:
if($this->c === false){
$this->data["eid"] = Utils::readInt($this->get(4));
$this->data["metadata"] = Utils::readMetadata($this->get(true));
}else{
$this->raw .= Utils::writeInt($this->data["eid"]);
$this->raw .= Utils::writeMetadata($this->data["metadata"]);
}
break;
case MC_SET_ENTITY_MOTION:
if($this->c === false){
$this->data["eid"] = Utils::readInt($this->get(4));
$this->data["speedX"] = Utils::readShort($this->get(2));
$this->data["speedY"] = Utils::readShort($this->get(2));
$this->data["speedZ"] = Utils::readShort($this->get(2));
}else{
$this->raw .= Utils::writeInt($this->data["eid"]);
$this->raw .= Utils::writeShort($this->data["speedX"]);
$this->raw .= Utils::writeShort($this->data["speedY"]);
$this->raw .= Utils::writeShort($this->data["speedZ"]);
}
break;
case MC_HURT_ARMOR:
if($this->c === false){
$this->data["health"] = Utils::readByte($this->get(1));
}else{
$this->raw .= Utils::writeByte($this->data["health"]);
}
break;
case MC_SET_HEALTH:
if($this->c === false){
$this->data["health"] = Utils::readByte($this->get(1));
}else{
$this->raw .= Utils::writeByte($this->data["health"]);
}
break;
case MC_SET_SPAWN_POSITION:
if($this->c === false){
$this->data["x"] = Utils::readInt($this->get(4));
$this->data["z"] = Utils::readInt($this->get(4));
$this->data["y"] = ord($this->get(1));
}else{
$this->raw .= Utils::writeInt($this->data["x"]);
$this->raw .= Utils::writeInt($this->data["z"]);
$this->raw .= chr($this->data["y"]);
}
break;
case MC_ANIMATE:
if($this->c === false){
$this->data["action"] = Utils::readByte($this->get(1));
$this->data["eid"] = Utils::readInt($this->get(4));
}else{
$this->raw .= Utils::writeByte($this->data["action"]);
$this->raw .= Utils::writeInt($this->data["eid"]);
}
break;
case MC_RESPAWN:
if($this->c === false){
$this->data["eid"] = Utils::readInt($this->get(4));
$this->data["x"] = Utils::readFloat($this->get(4));
$this->data["y"] = Utils::readFloat($this->get(4));
$this->data["z"] = Utils::readFloat($this->get(4));
}else{
$this->raw .= Utils::writeInt($this->data["eid"]);
$this->raw .= Utils::writeFloat($this->data["x"]);
$this->raw .= Utils::writeFloat($this->data["y"]);
$this->raw .= Utils::writeFloat($this->data["z"]);
}
break;
case MC_SEND_INVENTORY:
if($this->c === false){
$this->data["eid"] = Utils::readInt($this->get(4));
$this->data["windowid"] = ord($this->get(1));
$this->data["count"] = Utils::readShort($this->get(2), false);
$this->data["slots"] = array();
for($s = 0; $s < $this->data["count"]; ++$s){
$this->data["slots"][$s] = Utils::readSlot($this);
}
if($this->data["windowid"] === 1){ //Armor is also sent
$this->data["armor"] = array(
Utils::readSlot($this),
Utils::readSlot($this),
Utils::readSlot($this),
Utils::readSlot($this)
);
}
}else{
$this->raw .= Utils::writeInt($this->data["eid"]);
$this->raw .= chr($this->data["windowid"]);
$this->raw .= Utils::writeShort(count($this->data["slots"]));
foreach($this->data["slots"] as $slot){
$this->raw .= Utils::writeSlot($slot);
}
if($this->data["windowid"] === 1 and isset($this->data["armor"])){
$this->raw .= Utils::writeSlot($this->data["armor"][0]);
$this->raw .= Utils::writeSlot($this->data["armor"][1]);
$this->raw .= Utils::writeSlot($this->data["armor"][2]);
$this->raw .= Utils::writeSlot($this->data["armor"][3]);
}
}
break;
case MC_DROP_ITEM:
if($this->c === false){
$this->data["eid"] = Utils::readInt($this->get(4));
$this->data["unknown1"] = ord($this->get(1));
$this->data["block"] = Utils::readShort($this->get(2), false);
$this->data["stack"] = ord($this->get(1));
$this->data["meta"] = Utils::readShort($this->get(2), false);
}else{
$this->raw .= Utils::writeInt($this->data["eid"]);
$this->raw .= chr($this->data["unknown1"]);
$this->raw .= Utils::writeShort($this->data["block"]);
$this->raw .= chr($this->data["stack"]);
$this->raw .= Utils::writeShort($this->data["meta"]);
}
break;
case MC_CONTAINER_OPEN:
if($this->c === false){
$this->data["windowid"] = ord($this->get(1));
$this->data["type"] = ord($this->get(1));
$this->data["slots"] = ord($this->get(1));
//$this->data["title"] = $this->get(Utils::readShort($this->get(2), false));
}else{
$this->raw .= chr($this->data["windowid"]);
$this->raw .= chr($this->data["type"]);
$this->raw .= chr($this->data["slots"]);
$this->raw .= Utils::writeInt($this->data["x"]);
$this->raw .= Utils::writeInt($this->data["y"]);
$this->raw .= Utils::writeInt($this->data["z"]);
}
break;
case MC_CONTAINER_CLOSE:
if($this->c === false){
$this->data["windowid"] = ord($this->get(1));
}else{
$this->raw .= chr($this->data["windowid"]);
}
break;
case MC_CONTAINER_SET_SLOT:
if($this->c === false){
$this->data["windowid"] = ord($this->get(1));
$this->data["slot"] = Utils::readShort($this->get(2), false);
$this->data["block"] = Utils::readShort($this->get(2), false);
$this->data["stack"] = ord($this->get(1));
$this->data["meta"] = Utils::readShort($this->get(2), false);
}else{
$this->raw .= chr($this->data["windowid"]);
$this->raw .= Utils::writeShort($this->data["slot"]);
$this->raw .= Utils::writeShort($this->data["block"]);
$this->raw .= chr($this->data["stack"]);
$this->raw .= Utils::writeShort($this->data["meta"]);
}
break;
case MC_CONTAINER_SET_CONTENT:
if($this->c === false){
$this->data["windowid"] = ord($this->get(1));
$this->data["count"] = Utils::readShort($this->get(2), false);
$this->data["slots"] = array();
for($s = 0; $s < $this->data["count"]; ++$s){
$this->data["slots"][$s] = Utils::readSlot($this);
}
}else{
$this->raw .= chr($this->data["windowid"]);
$this->raw .= Utils::writeShort(count($this->data["slots"]));
foreach($this->data["slots"] as $slot){
$this->raw .= Utils::writeSlot($slot);
}
}
break;
case MC_CONTAINER_SET_DATA:
if($this->c === false){
$this->data["windowid"] = ord($this->get(1));
$this->data["property"] = Utils::readShort($this->get(2));
$this->data["value"] = Utils::readShort($this->get(2));
}else{
$this->raw .= chr($this->data["windowid"]);
$this->raw .= Utils::writeShort($this->data["property"]);
$this->raw .= Utils::writeShort($this->data["value"]);
}
break;
case MC_CLIENT_MESSAGE:
if($this->c === false){
$this->data["message"] = $this->get(Utils::readShort($this->get(2), false));
}else{
$this->raw .= Utils::writeShort(strlen($this->data["message"])).$this->data["message"];
}
break;
case MC_ADVENTURE_SETTINGS:
if($this->c === false){
$this->data["flags"] = Utils::readInt($this->get(4));
}else{
$this->raw .= Utils::writeInt($this->data["flags"]);
}
break;
case MC_ENTITY_DATA:
if($this->c === false){
$this->data["x"] = Utils::readShort($this->get(2));
$this->data["y"] = ord($this->get(1));
$this->data["z"] = Utils::readShort($this->get(2));
$this->data["namedtag"] = $this->get(true);
}else{
$this->raw .= Utils::writeShort($this->data["x"]);
$this->raw .= chr($this->data["y"]);
$this->raw .= Utils::writeShort($this->data["z"]);
$this->raw .= $this->data["namedtag"];
}
break;
default:
if($this->c === false){
console("[DEBUG] Received unknown Data Packet ID 0x".dechex($pid), true, true, 2);
}else{
console("[DEBUG] Sent unknown Data Packet ID 0x".dechex($pid), true, true, 2);
}
break;
}
}
}

View File

@ -1,263 +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/
*
*
*/
class MinecraftInterface{
public $client;
public $bandwidth;
private $socket;
private $data;
private $chunked;
private $toChunk;
private $needCheck;
function __construct($object, $server, $port = 25565, $listen = false, $client = false, $serverip = "0.0.0.0"){
$this->socket = new UDPSocket($server, $port, (bool) $listen, $serverip);
if($this->socket->connected === false){
console("[ERROR] Couldn't bind to $serverip:".$port, true, true, 0);
exit(1);
}
$this->bandwidth = array(0, 0, microtime(true));
$this->client = (bool) $client;
$this->start = microtime(true);
$this->chunked = array();
$this->toChunk = array();
$this->needCheck = array();
$object->schedule(1, array($this, "checkChunked"), array(), true);
}
public function close(){
return $this->socket->close(false);
}
protected function getStruct($pid){
if(isset(Protocol::$raknet[$pid])){
return Protocol::$raknet[$pid];
}
return false;
}
public function readPacket(){
$pk = $this->popPacket();
if($this->socket->connected === false){
return $pk;
}
$buf = "";
$source = false;
$port = 1;
$len = $this->socket->read($buf, $source, $port);
if($len === false){
return $pk;
}
$this->bandwidth[0] += $len;
$this->parsePacket($buf, $source, $port);
return ($pk !== false ? $pk : $this->popPacket());
}
private function parsePacket($buf, $source, $port){
$pid = ord($buf{0});
$struct = $this->getStruct($pid);
if($struct === false){
if(ServerAPI::request()->api->dhandle("server.unknownpacket", array(
"pid" => $pid,
"data" => array(),
"raw" => $buf,
"ip" => $source,
"port" => $port
)) !== true){
console("[ERROR] Unknown Packet ID 0x".Utils::strToHex(chr($pid)), true, true, 2);
}
return false;
}
$packet = new Packet($pid, $struct, $buf);
@$packet->parse();
if($pid === 0x99){
$CID = PocketMinecraftServer::clientID($source, $port);
if(!isset($this->chunked[$CID]) and $packet->data[0] !== 0){ //Drop packet
return false;
}
switch($packet->data[0]){
case 0:
$this->initChunked($CID, $source, $port);
return false;
case 1:
$this->stopChunked($CID);
return false;
case 3:
$this->ackChunked($CID, $data[1]["id"], $data[1]["index"]);
return false;
case 4:
$this->receiveChunked($CID, $data[1]["id"], $data[1]["index"], $data[1]["count"], $data[1]["data"]);
return true;
}
}
$this->data[] = array($pid, $packet->data, $buf, $source, $port);
return true;
}
public function checkChunked($CID){
$time = microtime(true);
foreach($this->needCheck as $CID => $packets){
if($packets[-1] < $time){
$d = $this->chunked[$CID];
unset($packets[-1]);
foreach($packets as $packet){
$this->writePacket(0x99, $packet, true, $d[1], $d[2], true);
}
$this->needCheck[$CID][-1] = $time + 5;
}
}
foreach($this->toChunk as $CID => $packets){
$d = $this->chunked[$CID];
$raw = "";
$MTU = 512;
foreach($packets as $packet){
$raw .= $packet;
if(($len = strlen($packet)) > $MTU){
$MTU = $len;
}
}
if($MTU > $d[0][2]){
$this->chunked[$CID][0][2] = $MTU;
}else{
$MTU = $d[0][2];
}
$raw = str_split(gzdeflate($raw, DEFLATEPACKET_LEVEL), $MTU - 9); // - 1 - 2 - 2 - 2 - 2
$count = count($raw);
$messageID = $this->chunked[$CID][0][0]++;
$this->chunked[$CID][0][0] &= 0xFFFF;
if(!isset($this->needCheck[$CID])){
$this->needCheck[$CID] = array();
}
$this->needCheck[$CID][$messageID] = array(-1 => $time + 1);
foreach($raw as $index => $r){
$p = "\x99\x02".Utils::writeShort($messageID).Utils::writeShort($index).Utils::writeShort($count).Utils::writeShort(strlen($r)).$r;
$this->needCheck[$CID][$messageID][$index] = $p;
$this->writePacket(0x99, $p, true, $d[1], $d[2], true);
}
unset($this->toChunk[$CID]);
}
}
public function isChunked($CID){
return isset($this->chunked[$CID]);
}
private function initChunked($CID, $source, $port){
console("[DEBUG] Starting DEFLATEPacket for $source:$port", true, true, 2);
$this->chunked[$CID] = array(
0 => array(0, 0, 0), //index, sent/received; MTU
1 => $source,
2 => $port,
3 => array(), //Received packets
);
$this->writePacket(0x99, array(
0 => 0, //start
), false, $source, $port, true);
}
public function stopChunked($CID){
if(!isset($this->chunked[$CID])){
return false;
}
$this->writePacket(0x99, array(
0 => 1, //stop
), false, $this->chunked[$CID][1], $this->chunked[$CID][2], true);
console("[DEBUG] Stopping DEFLATEPacket for ".$this->chunked[$CID][1].":".$this->chunked[$CID][2], true, true, 2);
$this->chunked[$CID][3] = null;
$this->chunked[$CID][4] = null;
unset($this->chunked[$CID]);
unset($this->toChunk[$CID]);
unset($this->needCheck[$CID]);
}
private function ackChunked($CID, $ID, $index){
unset($this->needCheck[$CID][$ID][$index]);
if(count($this->needCheck[$CID][$ID]) <= 1){
unset($this->needCheck[$CID][$ID]);
}
}
private function receiveChunked($CID, $ID, $index, $count, $data){
if(!isset($this->chunked[$CID][3][$ID])){
$this->chunked[$CID][3][$ID] = array();
}
$this->chunked[$CID][3][$ID][$index] = $data;
if(count($this->chunked[$CID][3][$ID]) === $count){
ksort($this->chunked[$CID][3][$ID]);
$data = gzinflate(implode($this->chunked[$CID][3][$ID]), 524280);
unset($this->chunked[$CID][3][$ID]);
if($data === false or strlen($data) === 0){
console("[ERROR] Invalid DEFLATEPacket for ".$this->chunked[$CID][1].":".$this->chunked[$CID][2], true, true, 2);
}
$offset = 0;
while(($plen = Utils::readShort(substr($data, $offset, 2), false)) !== 0xFFFF or $offset >= $len){
$offset += 2;
$packet = substr($data, $offset, $plen);
$this->parsePacket($packet, $this->chunked[$CID][1], $this->chunked[$CID][2]);
}
}
}
public function popPacket(){
if(count($this->data) > 0){
$p = each($this->data);
unset($this->data[$p[0]]);
$p = $p[1];
return array("pid" => $p[0], "data" => $p[1], "raw" => $p[2], "ip" => $p[3], "port" => $p[4]);
}
return false;
}
public function writePacket($pid, $data = array(), $raw = false, $dest = false, $port = false, $force = false){
$CID = PocketMinecraftServer::clientID($dest, $port);
if($raw === false){
$packet = new Packet($pid, $this->getStruct($pid));
$packet->data = $data;
@$packet->create();
if($force === false and $this->isChunked($CID)){
if(!isset($this->toChunk[$CID])){
$this->toChunk[$CID] = array();
}
$this->toChunk[$CID][] = $packet->raw;
$write = strlen($packet->raw);
}else{
$write = $this->socket->write($packet->raw, $dest, $port);
$this->bandwidth[1] += $write;
}
}else{
if($force === false and $this->isChunked($CID)){
if(!isset($this->toChunk[$CID])){
$this->toChunk[$CID] = array();
}
$this->toChunk[$CID][] = $data;
$write = strlen($data);
}else{
$write = $this->socket->write($data, $dest, $port);
$this->bandwidth[1] += $write;
}
}
return $write;
}
}
?>

View File

@ -1,339 +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/
*
*
*/
class Packet{
private $struct;
protected $pid, $packet;
public $data, $raw;
function __construct($pid, $struct, $data = ""){
$this->pid = $pid;
$this->offset = 1;
$this->raw = $data;
$this->data = array();
if($data === ""){
$this->addRaw(chr($pid));
}
$this->struct = $struct;
}
public function create($raw = false){
foreach($this->struct as $field => $type){
if(!isset($this->data[$field])){
$this->data[$field] = "";
}
if($raw === true){
$this->addRaw($this->data[$field]);
continue;
}
switch($type){
case "special1":
switch($this->pid){
case 0x99:
if($this->data[0] >= 2){
$this->addRaw(Utils::writeShort($this->data[1]["id"]));
$this->addRaw(Utils::writeShort($this->data[1]["index"]));
if($this->data[0] === 2){
$this->addRaw(Utils::writeShort($this->data[1]["count"]));
$this->addRaw(Utils::writeShort(strlen($this->data[1]["data"])).$this->data[1]["data"]);
}
}
break;
case 0xc0:
case 0xa0:
$payload = "";
$records = 0;
$pointer = 0;
sort($this->data[$field], SORT_NUMERIC);
$max = count($this->data[$field]);
while($pointer < $max){
$type = true;
$curr = $start = $this->data[$field][$pointer];
for($i = $start + 1; $i < $max; ++$i){
$n = $this->data[$field][$i];
if(($n - $curr) === 1){
$curr = $end = $n;
$type = false;
$pointer = $i + 1;
}else{
break;
}
}
++$pointer;
if($type === false){
$payload .= Utils::writeBool(false);
$payload .= strrev(Utils::writeTriad($start));
$payload .= strrev(Utils::writeTriad($end));
}else{
$payload .= Utils::writeBool(true);
$payload .= strrev(Utils::writeTriad($start));
}
++$records;
}
$this->addRaw(Utils::writeShort($records) . $payload);
break;
case 0x05:
$this->addRaw($this->data[$field]);
break;
}
break;
case "customData":
$this->addRaw(chr($this->data[1]));
if($this->data[2]["id"] === false){
$this->addRaw($this->data[2]["raw"]);
}else{
switch($this->data[1]){
case 0x40:
$reply = new CustomPacketHandler($this->data[2]["id"], "", $this->data[2], true);
$this->addRaw(Utils::writeShort((strlen($reply->raw) + 1) << 3));
$this->addRaw(strrev(Utils::writeTriad($this->data[2]["count"])));
$this->addRaw(chr($this->data[2]["id"]));
$this->addRaw($reply->raw);
break;
case 0x00:
$raw = new CustomPacketHandler($this->data[2]["id"], "", $this->data[2], true);
$raw = $raw->raw;
$this->addRaw(Utils::writeShort((strlen($raw) + 1) << 3));
$this->addRaw(chr($this->data[2]["id"]));
$this->addRaw($raw);
break;
}
}
break;
case "magic":
$this->addRaw(RAKNET_MAGIC);
break;
case "float":
$this->addRaw(Utils::writeFloat($this->data[$field]));
break;
case "triad":
$this->addRaw(Utils::writeTriad($this->data[$field]));
break;
case "itriad":
$this->addRaw(strrev(Utils::writeTriad($this->data[$field])));
break;
case "int":
$this->addRaw(Utils::writeInt($this->data[$field]));
break;
case "double":
$this->addRaw(Utils::writeDouble($this->data[$field]));
break;
case "long":
$this->addRaw(Utils::writeLong($this->data[$field]));
break;
case "bool":
case "boolean":
$this->addRaw(Utils::writeBool($this->data[$field]));
break;
case "ubyte":
case "byte":
$this->addRaw(Utils::writeByte($this->data[$field]));
break;
case "short":
$this->addRaw(Utils::writeShort($this->data[$field]));
break;
case "string":
$this->addRaw(Utils::writeShort(strlen($this->data[$field])));
$this->addRaw($this->data[$field]);
break;
default:
$this->addRaw(Utils::writeByte($this->data[$field]));
break;
}
}
}
private function get($len = true){
if($len === true){
$data = substr($this->raw, $this->offset);
$this->offset = strlen($this->raw);
return $data;
}
$data = substr($this->raw, $this->offset, $len);
$this->offset += $len;
return $data;
}
protected function addRaw($str){
$this->raw .= $str;
return $str;
}
public function parse(){
foreach($this->struct as $field => $type){
switch($type){
case "special1":
switch($this->pid){
case 0x07:
$this->data[] = $this->get(5);
break;
case 0x99:
if($this->data[0] >= 2){ //
$messageID = Utils::readShort($this->get(2), false);
$messageIndex = Utils::readShort($this->get(2), false);
$this->data[1] = array("id" => $messageID, "index" => $messageIndex);
if($this->data[0] === 2){
$this->data[1]["count"] = Utils::readShort($this->get(2), false);
$dataLength = Utils::readShort($this->get(2), false);
$this->data[1]["data"] = $this->get($dataLength);
}
}
break;
case 0xc0:
case 0xa0:
$cnt = Utils::readShort($this->get(2), false);
$this->data[$field] = array();
for($i = 0; $i < $cnt; ++$i){
if(Utils::readBool($this->get(1)) === false){
$start = Utils::readTriad(strrev($this->get(3)));
$end = Utils::readTriad(strrev($this->get(3)));
for($c = $start; $c <= $end; ++$c){
$this->data[$field][] = $c;
}
}else{
$this->data[$field][] = Utils::readTriad(strrev($this->get(3)));
}
}
break;
case 0x05:
$this->data[] = $this->get(true);
break;
}
break;
case "customData":
$raw = $this->get(true);
$len = strlen($raw);
$offset = 0;
$this->data["packets"] = array();
while($len > $offset){
$pid = ord($raw{$offset});
++$offset;
$reliability = ($pid & 0b11100000) >> 5;
$hasSplit = ($pid & 0b00010000) >> 4;
$length = Utils::readShort(substr($raw, $offset, 2), false);
$offset += 2;
if($reliability === 2
or $reliability === 3
or $reliability === 4
or $reliability === 6
or $reliability === 7){
$messageIndex = Utils::readTriad(strrev(substr($raw, $offset, 3)));
$offset += 3;
}else{
$messageIndex = 0;
}
if($reliability === 1
or $reliability === 3
or $reliability === 4
or $reliability === 7){
$orderIndex = Utils::readTriad(strrev(substr($raw, $offset, 3)));
$offset += 3;
$orderChannel = ord($raw{$offset}); //5 bits, 32 values
++$offset;
}else{
$orderIndex = 0;
$orderChannel = 0;
}
if($hasSplit === 1){
$splitCount = Utils::readInt(substr($raw, $offset, 4));
$offset += 4;
$splitID = Utils::readShort(substr($raw, $offset, 2));
$offset += 2;
$splitIndex = Utils::readInt(substr($raw, $offset, 4));
$offset += 4;
//error! no split packets allowed!
break;
}else{
$splitCount = 0;
$splitID = 0;
$splitIndex = 0;
}
if($length == 0
or $orderingChannel >= 32
or ($hasSplit === 1 and $splitIndex >= $splitCount)){
continue;
}
$ln = ceil($length / 8);
$id = ord($raw{$offset});
++$offset;
$pak = substr($raw, $offset, $ln - 1);
$offset += $ln - 1;
$pk = new CustomPacketHandler($id, $pak);
$pk->data["length"] = $ln;
$pk->data["id"] = $id;
$pk->data["counter"] = $messageIndex;
$pk->data["packetName"] = $pk->name;
$this->data["packets"][] = array($pid, $pk->data, $pak);
}
break;
case "magic":
$this->data[] = $this->get(16);
break;
case "triad":
$this->data[] = Utils::readTriad($this->get(3));
break;
case "itriad":
$this->data[] = Utils::readTriad(strrev($this->get(3)));
break;
case "int":
$this->data[] = Utils::readInt($this->get(4));
break;
case "string":
$this->data[] = $this->get(Utils::readShort($this->get(2)));
break;
case "long":
$this->data[] = Utils::readLong($this->get(8));
break;
case "byte":
$this->data[] = Utils::readByte($this->get(1));
break;
case "ubyte":
$this->data[] = ord($this->get(1));
break;
case "float":
$this->data[] = Utils::readFloat($this->get(4));
break;
case "double":
$this->data[] = Utils::readDouble($this->get(8));
break;
case "ushort":
$this->data[] = Utils::readShort($this->get(2), false);
break;
case "short":
$this->data[] = Utils::readShort($this->get(2));
break;
case "bool":
case "boolean":
$this->data[] = Utils::readBool($this->get(1));
break;
}
}
}
}

View File

@ -1,341 +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/
*
*
*/
define("DEFLATEPACKET_LEVEL", 1);
define("CURRENT_STRUCTURE", 5);
define("CURRENT_PROTOCOL", 12);
define("RAKNET_MAGIC", "\x00\xff\xff\x00\xfe\xfe\xfe\xfe\xfd\xfd\xfd\xfd\x12\x34\x56\x78");
define("MC_PING", 0x00);
define("MC_PONG", 0x03);
define("MC_CLIENT_CONNECT", 0x09);
define("MC_SERVER_HANDSHAKE", 0x10);
define("MC_CLIENT_HANDSHAKE", 0x13);
define("MC_SERVER_FULL", 0x14);
define("MC_DISCONNECT", 0x15);
define("MC_BANNED", 0x17);
define("MC_LOGIN", 0x82);
define("MC_LOGIN_STATUS", 0x83);
define("MC_READY", 0x84);
define("MC_CHAT", 0x85);
define("MC_SET_TIME", 0x86);
define("MC_START_GAME", 0x87);
define("MC_ADD_MOB", 0x88);
define("MC_ADD_PLAYER", 0x89);
define("MC_REMOVE_PLAYER", 0x8a);
define("MC_ADD_ENTITY", 0x8c);
define("MC_REMOVE_ENTITY", 0x8d);
define("MC_ADD_ITEM_ENTITY", 0x8e);
define("MC_TAKE_ITEM_ENTITY", 0x8f);
define("MC_MOVE_ENTITY", 0x90);
define("MC_MOVE_ENTITY_POSROT", 0x93);
define("MC_MOVE_PLAYER", 0x94);
define("MC_PLACE_BLOCK", 0x95);
define("MC_REMOVE_BLOCK", 0x96);
define("MC_UPDATE_BLOCK", 0x97);
define("MC_ADD_PAINTING", 0x98);
define("MC_EXPLOSION", 0x99);
define("MC_LEVEL_EVENT", 0x9a);
define("MC_TILE_EVENT", 0x9b);
define("MC_ENTITY_EVENT", 0x9c);
define("MC_REQUEST_CHUNK", 0x9d);
define("MC_CHUNK_DATA", 0x9e);
define("MC_PLAYER_EQUIPMENT", 0x9f);
define("MC_PLAYER_ARMOR_EQUIPMENT", 0xa0);
define("MC_INTERACT", 0xa1);
define("MC_USE_ITEM", 0xa2);
define("MC_PLAYER_ACTION", 0xa3);
define("MC_HURT_ARMOR", 0xa5);
define("MC_SET_ENTITY_DATA", 0xa6);
define("MC_SET_ENTITY_MOTION", 0xa7);
//define("MC_SET_RIDING_PACKET", 0xa8);
define("MC_SET_HEALTH", 0xa9);
define("MC_SET_SPAWN_POSITION", 0xaa);
define("MC_ANIMATE", 0xab);
define("MC_RESPAWN", 0xac);
define("MC_SEND_INVENTORY", 0xad);
define("MC_DROP_ITEM", 0xae);
define("MC_CONTAINER_OPEN", 0xaf);
define("MC_CONTAINER_CLOSE", 0xb0);
define("MC_CONTAINER_SET_SLOT", 0xb1);
define("MC_CONTAINER_SET_DATA", 0xb2);
define("MC_CONTAINER_SET_CONTENT", 0xb3);
//define("MC_CONTAINER_ACK", 0xb4);
define("MC_CLIENT_MESSAGE", 0xb5);
define("MC_ADVENTURE_SETTINGS", 0xb6);
define("MC_ENTITY_DATA", 0xb7);
class Protocol{
public static $dataName = array(
MC_PING => "Ping",
MC_CLIENT_CONNECT => "Client Connect",
MC_SERVER_HANDSHAKE => "Server Handshake",
MC_CLIENT_HANDSHAKE => "Client Handshake",
//MC_SERVER_FULL => "Server Full",
MC_DISCONNECT => "Disconnect",
0x18 => "Unknown",
MC_LOGIN => "Login",
MC_LOGIN_STATUS => "Login Status",
MC_READY => "Ready",
MC_CHAT => "Chat",
MC_SET_TIME => "Set Time",
MC_START_GAME => "Start Game",
MC_ADD_MOB => "Add Mob",
MC_ADD_PLAYER => "Add Player",
MC_ADD_ENTITY => "Add Entity",
MC_REMOVE_ENTITY => "Remove Entity",
MC_ADD_ITEM_ENTITY => "Add Item",
MC_TAKE_ITEM_ENTITY => "Take Item",
MC_MOVE_ENTITY => "Move Entity",
MC_MOVE_ENTITY_POSROT => "Move Entity PosRot",
MC_MOVE_PLAYER => "Move Player",
MC_PLACE_BLOCK => "Place Block",
MC_REMOVE_BLOCK => "Remove Block",
MC_UPDATE_BLOCK => "Update Block",
MC_ADD_PAINTING => "Add Painting",
MC_EXPLOSION => "Explosion",
MC_LEVEL_EVENT => "Level Event",
MC_ENTITY_EVENT => "Entity Event",
MC_REQUEST_CHUNK => "Chunk Request",
MC_CHUNK_DATA => "Chunk Data",
MC_PLAYER_EQUIPMENT => "Player Equipment",
MC_PLAYER_ARMOR_EQUIPMENT => "Player Armor",
MC_INTERACT => "Interact",
MC_USE_ITEM => "Use Item",
MC_PLAYER_ACTION => "Player Action",
MC_SET_ENTITY_DATA => "Entity Data",
MC_SET_ENTITY_MOTION => "Entity Motion",
MC_HURT_ARMOR => "Hurt Armor",
MC_SET_HEALTH => "Set Health",
MC_SET_SPAWN_POSITION => "Set Spawn Position",
MC_ANIMATE => "Animate",
MC_RESPAWN => "Respawn",
MC_SEND_INVENTORY => "Send Inventory",
MC_DROP_ITEM => "Drop Item",
MC_CONTAINER_OPEN => "Open Container",
MC_CONTAINER_CLOSE => "Close Container",
MC_CONTAINER_SET_SLOT => "Set Container Slot",
MC_CLIENT_MESSAGE => "Client Message",
MC_ADVENTURE_SETTINGS => "Adventure Settings",
MC_ENTITY_DATA => "Entity Data",
);
public static $packetName = array(
0x01 => "ID_CONNECTED_PING_OPEN_CONNECTIONS", //RakNet
0x02 => "ID_UNCONNECTED_PING_OPEN_CONNECTIONS", //RakNet
0x05 => "ID_OPEN_CONNECTION_REQUEST_1", //RakNet
0x06 => "ID_OPEN_CONNECTION_REPLY_1", //RakNet
0x07 => "ID_OPEN_CONNECTION_REQUEST_2", //RakNet
0x08 => "ID_OPEN_CONNECTION_REPLY_2", //RakNet
0x1a => "ID_INCOMPATIBLE_PROTOCOL_VERSION", //RakNet
0x1c => "ID_UNCONNECTED_PONG", //RakNet
0x1d => "ID_ADVERTISE_SYSTEM", //RakNet
0x80 => "Custom Packet", //Minecraft Implementation
0x84 => "Custom Packet", //Minecraft Implementation
0x88 => "Custom Packet", //Minecraft Implementation
0x8c => "Custom Packet", //Minecraft Implementation
0xa0 => "NACK", //Minecraft Implementation
0xc0 => "ACK", //Minecraft Implementation
);
public static $raknet = array(
0x01 => array(
"long", //Ping ID
"magic",
),
0x02 => array(
"long", //Ping ID
"magic",
),
0x05 => array(
"magic",
"byte", //Protocol Version
"special1", //MTU Size Null Lenght
),
0x06 => array(
"magic",
"long", //Server GUID
"byte", //Server Security
"short", //MTU Size
),
0x07 => array(
"magic",
"special1", //Security Cookie
"short", //Server UDP Port
"short", //MTU Size
"long", //Client GUID
),
0x08 => array(
"magic",
"long", //Server GUID
"short", //Client UDP Port
"short", //MTU Size
"byte", //Security
),
0x1a => array(
"byte", //Server Version
"magic",
"long", //Server GUID
),
0x1c => array(
"long", //Ping ID
"long", //Server GUID
"magic",
"string", //Data
),
0x1d => array(
"long", //Ping ID
"long", //Server GUID
"magic",
"string", //Data
),
0x80 => array(
"itriad",
"customData",
),
0x81 => array(
"itriad",
"customData",
),
0x82 => array(
"itriad",
"customData",
),
0x83 => array(
"itriad",
"customData",
),
0x84 => array(
"itriad",
"customData",
),
0x85 => array(
"itriad",
"customData",
),
0x86 => array(
"itriad",
"customData",
),
0x87 => array(
"itriad",
"customData",
),
0x88 => array(
"itriad",
"customData",
),
0x89 => array(
"itriad",
"customData",
),
0x8a => array(
"itriad",
"customData",
),
0x8b => array(
"itriad",
"customData",
),
0x8c => array(
"itriad",
"customData",
),
0x8d => array(
"itriad",
"customData",
),
0x8e => array(
"itriad",
"customData",
),
0x8f => array(
"itriad",
"ubyte",
"customData",
),
0x99 => array(
"byte",
"special1",
),
0xa0 => array(
"special1",
),
0xc0 => array(
"special1",
),
);
}

View File

@ -1,133 +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
*/
class Query{
private $socket, $server, $lastToken, $token, $longData, $timeout;
public function __construct(){
console("[INFO] Starting GS4 status listener");
$this->server = ServerAPI::request();
$addr = ($ip = $this->server->api->getProperty("server-ip")) != "" ? $ip:"0.0.0.0";
$port = $this->server->api->getProperty("server-port");
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->server->addHandler("server.unknownpacket", array($this, "packetHandler"), 50);
$this->server->schedule(20 * 30, array($this, "regenerateToken"), array(), true);
$this->regenerateToken();
$this->lastToken = $this->token;
$this->regenerateInfo();
console("[INFO] Query running on $addr:$port");
}
public function regenerateInfo(){
$str = "";
$plist = "PocketMine-MP ".MAJOR_VERSION;
$pl = $this->server->api->plugin->getList();
if(count($pl) > 0){
$plist .= ":";
foreach($pl as $p){
$plist .= " ".str_replace(array(";", ":", " "), array("", "", "_"), $p["name"])." ".str_replace(array(";", ":", " "), array("", "", "_"), $p["version"]).";";
}
$plist = substr($plist, 0, -1);
}
$KVdata = array(
"splitnum" => chr(128),
"hostname" => $this->server->name,
"gametype" => ($this->server->gamemode & 0x01) === 0 ? "SMP":"CMP",
"game_id" => "MINECRAFTPE",
"version" => CURRENT_MINECRAFT_VERSION,
"server_engine" => "PocketMine-MP ".MAJOR_VERSION,
"plugins" => $plist,
"map" => $this->server->api->level->getDefault()->getName(),
"numplayers" => count($this->server->clients),
"maxplayers" => $this->server->maxClients,
"whitelist" => $this->server->api->getProperty("white-list") === true ? "on":"off",
"hostport" => $this->server->api->getProperty("server-port"),
//"hostip" => $this->server->api->getProperty("server-ip", "0.0.0.0")
);
foreach($KVdata as $key => $value){
$str .= $key."\x00".$value."\x00";
}
$str .= "\x00\x01player_\x00\x00";
foreach($this->server->clients as $player){
if($player->username != ""){
$str .= $player->username."\x00";
}
}
$str .= "\x00";
$this->longData = $str;
$this->timeout = microtime(true) + 5;
}
public function regenerateToken(){
$this->lastToken = $this->token;
$this->token = Utils::readInt("\x00".Utils::getRandomBytes(3, false));
}
public function packetHandler(&$packet, $event){
if($event !== "server.unknownpacket"){
return;
}
$magic = substr($packet["raw"], 0, 2);
$offset = 2;
if($magic !== "\xfe\xfd"){
return;
}
$type = ord($packet["raw"]{2});
++$offset;
$sessionID = Utils::readInt(substr($packet["raw"], $offset, 4));
$offset += 4;
$payload = substr($packet["raw"], $offset);
switch($type){
case 9: //Handshake
$this->server->send(9, chr(9).Utils::writeInt($sessionID).$this->token."\x00", true, $packet["ip"], $packet["port"]);
break;
case 0: //Stat
$token = Utils::readInt(substr($payload, 0, 4));
if($token !== $this->token and $token !== $this->lastToken){
break;
}
if(strlen($payload) === 8){
if($this->timeout < microtime(true)){
$this->regenerateInfo();
}
$this->server->send(0, chr(0).Utils::writeInt($sessionID).$this->longData, true, $packet["ip"], $packet["port"]);
}else{
$this->server->send(0, chr(0).Utils::writeInt($sessionID).$this->server->name."\x00".(($this->server->gamemode & 0x01) === 0 ? "SMP":"CMP")."\x00".$this->server->api->level->getDefault()->getName()."\x00".count($this->server->clients)."\x00".$this->server->maxClients."\x00".Utils::writeLShort($this->server->api->getProperty("server-port")).$this->server->api->getProperty("server-ip", "0.0.0.0")."\x00", true, $packet["ip"], $packet["port"]);
}
break;
}
return true;
}
}

View File

@ -1,224 +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 Source RCON Protocol to allow remote console commands
Source: https://developer.valvesoftware.com/wiki/Source_RCON_Protocol
*/
class RCON{
private $socket, $password, $workers, $threads, $clientsPerThread;
public function __construct($password, $port = 19132, $interface = "0.0.0.0", $threads = 1, $clientsPerThread = 50){
$this->workers = array();
$this->password = (string) $password;
console("[INFO] Starting remote control listener");
if($this->password === ""){
console("[ERROR] RCON can't be started: Empty password");
return;
}
$this->threads = (int) max(1, $threads);
$this->clientsPerThread = (int) max(1, $clientsPerThread);
$this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if($this->socket === false or !socket_bind($this->socket, $interface, (int) $port) or !socket_listen($this->socket)){
console("[ERROR] RCON can't be started: ".socket_strerror(socket_last_error()));
return;
}
@socket_set_block($this->socket);
for($n = 0; $n < $this->threads; ++$n){
$this->workers[$n] = new RCONInstance($this->socket, $this->password, $this->clientsPerThread);
}
@socket_getsockname($this->socket, $addr, $port);
console("[INFO] RCON running on $addr:$port");
ServerAPI::request()->schedule(2, array($this, "check"), array(), true);
}
public function stop(){
for($n = 0; $n < $this->threads; ++$n){
$this->workers[$n]->close();
$this->workers[$n]->join();
}
@socket_close($this->socket);
$this->threads = 0;
}
public function check(){
for($n = 0; $n < $this->threads; ++$n){
if($this->workers[$n]->isTerminated() === true){
$this->workers[$n] = new RCONInstance($this->socket, $this->password, $this->clientsPerThread);
}elseif($this->workers[$n]->isWaiting()){
if($this->workers[$n]->response !== ""){
console($this->workers[$n]->response);
$this->workers[$n]->notify();
}else{
$this->workers[$n]->response = ServerAPI::request()->api->console->run($this->workers[$n]->cmd, "rcon");
$this->workers[$n]->notify();
}
}
}
}
}
class RCONInstance extends Thread{
public $stop;
public $cmd;
public $response;
private $socket;
private $password;
private $maxClients;
public function __construct($socket, $password, $maxClients = 50){
$this->stop = false;
$this->cmd = "";
$this->response = "";
$this->socket = $socket;
$this->password = $password;
$this->maxClients = (int) $maxClients;
for($n = 0; $n < $this->maxClients; ++$n){
$this->{"client".$n} = null;
$this->{"status".$n} = 0;
$this->{"timeout".$n} = 0;
}
$this->start();
}
private function writePacket($client, $requestID, $packetType, $payload){
return socket_write($client, Utils::writeLInt(strlen($payload)).Utils::writeLInt((int) $requestID).Utils::writeLInt((int) $packetType).($payload === "" ? "\x00":$payload)."\x00");
}
private function readPacket($client, &$size, &$requestID, &$packetType, &$payload){
@socket_set_nonblock($client);
$d = socket_read($client, 4);
if($this->stop === true){
return false;
}elseif($d === false){
return null;
}elseif($d === "" or strlen($d) < 4){
return false;
}
@socket_set_block($client);
$size = Utils::readLInt($d);
if($size < 0 or $size > 65535){
return false;
}
$requestID = Utils::readLInt(socket_read($client, 4));
$packetType = Utils::readLInt(socket_read($client, 4));
$payload = rtrim(socket_read($client, $size + 2)); //Strip two null bytes
return true;
}
public function close(){
$this->stop = true;
}
public function run(){
while($this->stop !== true){
usleep(1);
$r = array($socket = $this->socket);
$w = null;
$e = null;
if(socket_select($r, $w, $e, 0) === 1){
if(($client = socket_accept($this->socket)) !== false){
socket_set_block($client);
socket_set_option($client, SOL_SOCKET, SO_KEEPALIVE, 1);
$done = false;
for($n = 0; $n < $this->maxClients; ++$n){
if($this->{"client".$n} === null){
$this->{"client".$n} = $client;
$this->{"status".$n} = 0;
$this->{"timeout".$n} = microtime(true) + 5;
$done = true;
break;
}
}
if($done === false){
@socket_close($client);
}
}
}
for($n = 0; $n < $this->maxClients; ++$n){
$client = &$this->{"client".$n};
if($client !== null){
if($this->{"status".$n} !== -1 and $this->stop !== true){
if($this->{"status".$n} === 0 and $this->{"timeout".$n} < microtime(true)){ //Timeout
$this->{"status".$n} = -1;
continue;
}
$p = $this->readPacket($client, $size, $requestID, $packetType, $payload);
if($p === false){
$this->{"status".$n} = -1;
continue;
}elseif($p === null){
continue;
}
switch($packetType){
case 3: //Login
if($this->{"status".$n} !== 0){
$this->{"status".$n} = -1;
continue;
}
if($payload === $this->password){
@socket_getpeername($client, $addr, $port);
$this->response = "[INFO] Successful Rcon connection from: /$addr:$port";
$this->wait();
$this->response = "";
$this->writePacket($client, $requestID, 2, "");
$this->{"status".$n} = 1;
}else{
$this->{"status".$n} = -1;
$this->writePacket($client, -1, 2, "");
continue;
}
break;
case 2: //Command
if($this->{"status".$n} !== 1){
$this->{"status".$n} = -1;
continue;
}
if(strlen($payload) > 0){
$this->cmd = ltrim($payload);
$this->wait();
$this->writePacket($client, $requestID, 0, str_replace("\n", "\r\n", trim($this->response)));
$this->response = "";
$this->cmd = "";
}
break;
}
usleep(1);
}else{
@socket_set_option($client, SOL_SOCKET, SO_LINGER, array("l_onoff" => 1, "l_linger" => 1));
@socket_shutdown($client, 2);
@socket_set_block($client);
@socket_read($client, 1);
@socket_close($client);
$this->{"status".$n} = 0;
$this->{"client".$n} = null;
}
}
}
}
unset($this->socket, $this->cmd, $this->response, $this->stop);
exit(0);
}
}

View File

@ -1,76 +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/
*
*
*/
class UDPSocket{
public $connected, $sock, $server;
function __construct($server, $port, $listen = false, $serverip = "0.0.0.0"){
$this->server = $server;
$this->port = $port;
$this->sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_set_option($this->sock, SOL_SOCKET, SO_BROADCAST, 1); //Allow sending broadcast messages
if($listen !== true){
$this->connected = true;
$this->unblock();
}else{
if(socket_bind($this->sock, $serverip, $port) === true){
socket_set_option($this->sock, SOL_SOCKET, SO_REUSEADDR, 0);
socket_set_option($this->sock, SOL_SOCKET, SO_SNDBUF, 65535);
socket_set_option($this->sock, SOL_SOCKET, SO_RCVBUF, 65535);
$this->unblock();
$this->connected = true;
}else{
$this->connected = false;
}
}
}
public function close($error = 125){
$this->connected = false;
return @socket_close($this->sock);
}
public function block(){
socket_set_block($this->sock);
}
public function unblock(){
socket_set_nonblock($this->sock);
}
public function read(&$buf, &$source, &$port){
if($this->connected === false){
return false;
}
return @socket_recvfrom($this->sock, $buf, 65535, 0, $source, $port);
}
public function write($data, $dest = false, $port = false){
if($this->connected === false){
return false;
}
return @socket_sendto($this->sock, $data, strlen($data), 0, ($dest === false ? $this->server:$dest), ($port === false ? $this->port:$port));
}
}
?>

View File

@ -1,417 +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/
*
*
*/
define("PMF_CURRENT_LEVEL_VERSION", 0x00);
class PMFLevel extends PMF{
private $levelData = array();
private $locationTable = array();
public $isLoaded = true;
private $log = 4;
private $payloadOffset = 0;
private $chunks = array();
private $chunkChange = array();
public function getData($index){
if(!isset($this->levelData[$index])){
return false;
}
return ($this->levelData[$index]);
}
public function setData($index, $data){
if(!isset($this->levelData[$index])){
return false;
}
$this->levelData[$index] = $data;
return true;
}
public function close(){
$chunks = null;
unset($chunks, $chunkChange, $locationTable);
parent::close();
}
public function __construct($file, $blank = false){
if(is_array($blank)){
$this->create($file, 0);
$this->levelData = $blank;
$this->createBlank();
$this->isLoaded = true;
$this->log = (int) ((string) log($this->levelData["width"], 2));
}else{
if($this->load($file) !== false){
$this->parseInfo();
if($this->parseLevel() === false){
$this->isLoaded = false;
}else{
$this->isLoaded = true;
$this->log = (int) ((string) log($this->levelData["width"], 2));
}
}else{
$this->isLoaded = false;
}
}
}
public function saveData($locationTable = true){
$this->levelData["version"] = PMF_CURRENT_LEVEL_VERSION;
@ftruncate($this->fp, 5);
$this->seek(5);
$this->write(chr($this->levelData["version"]));
$this->write(Utils::writeShort(strlen($this->levelData["name"])).$this->levelData["name"]);
$this->write(Utils::writeInt($this->levelData["seed"]));
$this->write(Utils::writeInt($this->levelData["time"]));
$this->write(Utils::writeFloat($this->levelData["spawnX"]));
$this->write(Utils::writeFloat($this->levelData["spawnY"]));
$this->write(Utils::writeFloat($this->levelData["spawnZ"]));
$this->write(chr($this->levelData["width"]));
$this->write(chr($this->levelData["height"]));
$extra = gzdeflate($this->levelData["extra"], PMF_LEVEL_DEFLATE_LEVEL);
$this->write(Utils::writeShort(strlen($extra)).$extra);
$this->payloadOffset = ftell($this->fp);
if($locationTable !== false){
$this->writeLocationTable();
}
}
private function createBlank(){
$this->saveData(false);
$this->locationTable = array();
$cnt = pow($this->levelData["width"], 2);
@mkdir(dirname($this->file)."/chunks/", 0755);
for($index = 0; $index < $cnt; ++$index){
$this->chunks[$index] = false;
$this->chunkChange[$index] = false;
$this->locationTable[$index] = array(
0 => 0,
);
$this->write(Utils::writeShort(0));
$X = $Z = null;
$this->getXZ($index, $X, $Z);
@file_put_contents($this->getChunkPath($X, $Z), gzdeflate("", PMF_LEVEL_DEFLATE_LEVEL));
}
if(!file_exists(dirname($this->file)."/entities.yml")){
$entities = new Config(dirname($this->file)."/entities.yml", CONFIG_YAML);
$entities->save();
}
if(!file_exists(dirname($this->file)."/tiles.yml")){
$tiles = new Config(dirname($this->file)."/tiles.yml", CONFIG_YAML);
$tiles->save();
}
}
protected function parseLevel(){
if($this->getType() !== 0x00){
return false;
}
$this->seek(5);
$this->levelData["version"] = ord($this->read(1));
if($this->levelData["version"] > PMF_CURRENT_LEVEL_VERSION){
return false;
}
$this->levelData["name"] = $this->read(Utils::readShort($this->read(2), false));
$this->levelData["seed"] = Utils::readInt($this->read(4));
$this->levelData["time"] = Utils::readInt($this->read(4));
$this->levelData["spawnX"] = Utils::readFloat($this->read(4));
$this->levelData["spawnY"] = Utils::readFloat($this->read(4));
$this->levelData["spawnZ"] = Utils::readFloat($this->read(4));
$this->levelData["width"] = ord($this->read(1));
$this->levelData["height"] = ord($this->read(1));
if(($this->levelData["width"] !== 16 and $this->levelData["width"] !== 32) or $this->levelData["height"] !== 8){
return false;
}
$lastseek = ftell($this->fp);
if(($len = $this->read(2)) === false or ($this->levelData["extra"] = @gzinflate($this->read(Utils::readShort($len, false)))) === false){ //Corruption protection
console("[NOTICE] Empty/corrupt location table detected, forcing recovery");
fseek($this->fp, $lastseek);
$c = gzdeflate("");
$this->write(Utils::writeShort(strlen($c)).$c);
$this->payloadOffset = ftell($this->fp);
$this->levelData["extra"] = "";
$cnt = pow($this->levelData["width"], 2);
for($index = 0; $index < $cnt; ++$index){
$this->write("\x00\xFF"); //Force index recreation
}
fseek($this->fp, $this->payloadOffset);
}else{
$this->payloadOffset = ftell($this->fp);
}
return $this->readLocationTable();
}
public function getIndex($X, $Z){
$X = (int) $X;
$Z = (int) $Z;
return ($Z << $this->log) + $X;
}
public function getXZ($index, &$X = null, &$Z = null){
$X = $index >> $this->log;
$Z = $index & (pow($this->log, 2) - 1);
return array($X, $Z);
}
private function readLocationTable(){
$this->locationTable = array();
$cnt = pow($this->levelData["width"], 2);
$this->seek($this->payloadOffset);
for($index = 0; $index < $cnt; ++$index){
$this->chunks[$index] = false;
$this->chunkChange[$index] = false;
$this->locationTable[$index] = array(
0 => Utils::readShort($this->read(2)), //16 bit flags
);
}
return true;
}
private function writeLocationTable(){
$cnt = pow($this->levelData["width"], 2);
@ftruncate($this->fp, $this->payloadOffset);
$this->seek($this->payloadOffset);
for($index = 0; $index < $cnt; ++$index){
$this->write(Utils::writeShort($this->locationTable[$index][0]));
}
}
private function getChunkPath($X, $Z){
return dirname($this->file)."/chunks/".$Z.".".$X.".pmc";
}
public function loadChunk($X, $Z){
$X = (int) $X;
$Z = (int) $Z;
$index = $this->getIndex($X, $Z);
if($this->isChunkLoaded($X, $Z)){
return true;
}elseif(!isset($this->locationTable[$index])){
return false;
}
$info = $this->locationTable[$index];
$this->seek($info[0]);
$chunk = @gzopen($this->getChunkPath($X, $Z), "rb");
if($chunk === false){
return false;
}
$this->chunks[$index] = array();
$this->chunkChange[$index] = array(-1 => false);
for($Y = 0; $Y < $this->levelData["height"]; ++$Y){
$t = 1 << $Y;
if(($info[0] & $t) === $t){
// 4096 + 2048 + 2048, Block Data, Meta, Light
if(strlen($this->chunks[$index][$Y] = gzread($chunk, 8192)) < 8192){
console("[NOTICE] Empty corrupt chunk detected [$X,$Z,:$Y], recovering contents");
$this->fillMiniChunk($X, $Z, $Y);
}
}else{
$this->chunks[$index][$Y] = false;
}
}
@gzclose($chunk);
return true;
}
public function unloadChunk($X, $Z, $save = true){
$X = (int) $X;
$Z = (int) $Z;
if(!$this->isChunkLoaded($X, $Z)){
return false;
}elseif($save !== false){
$this->saveChunk($X, $Z);
}
$index = $this->getIndex($X, $Z);
$this->chunks[$index] = null;
$this->chunkChange[$index] = null;
unset($this->chunks[$index], $this->chunkChange[$index]);
return true;
}
public function isChunkLoaded($X, $Z){
$index = $this->getIndex($X, $Z);
if(!isset($this->chunks[$index]) or $this->chunks[$index] === false){
return false;
}
return true;
}
protected function isMiniChunkEmpty($X, $Z, $Y){
$index = $this->getIndex($X, $Z);
if($this->chunks[$index][$Y] !== false){
if(substr_count($this->chunks[$index][$Y], "\x00") < 8192){
return false;
}
}
return true;
}
protected function fillMiniChunk($X, $Z, $Y){
if($this->isChunkLoaded($X, $Z) === false){
return false;
}
$index = $this->getIndex($X, $Z);
$this->chunks[$index][$Y] = str_repeat("\x00", 8192);
$this->chunkChange[$index][-1] = true;
$this->chunkChange[$index][$Y] = 8192;
$this->locationTable[$index][0] |= 1 << $Y;
return true;
}
public function getMiniChunk($X, $Z, $Y){
if($this->loadChunk($X, $Z) === false){
return str_repeat("\x00", 8192);
}
$index = $this->getIndex($X, $Z);
if($this->chunks[$index][$Y] === false){
return str_repeat("\x00", 8192);
}
return $this->chunks[$index][$Y];
}
public function setMiniChunk($X, $Z, $Y, $data){
if($this->isChunkLoaded($X, $Z) === false){
$this->loadChunk($X, $Z);
}
if(strlen($data) !== 8192){
return false;
}
$index = $this->getIndex($X, $Z);
$this->chunks[$index][$Y] = (string) $data;
$this->chunkChange[$index][-1] = true;
$this->chunkChange[$index][$Y] = 8192;
$this->locationTable[$index][0] |= 1 << $Y;
return true;
}
public function getBlock($x, $y, $z){
$X = $x >> 4;
$Z = $z >> 4;
$Y = $y >> 4;
if($x < 0 or $z < 0 or $X >= $this->levelData["width"] or $Z >= $this->levelData["width"] or $Y >= $this->levelData["height"] or $y < 0){
return array(AIR, 0);
}
$index = $this->getIndex($X, $Z);
if(!isset($this->chunks[$index]) or $this->chunks[$index] === false){
if($this->loadChunk($X, $Z) === false){
return array(AIR, 0);
}
}elseif($this->chunks[$index][$Y] === false){
return array(AIR, 0);
}
$aX = $x - ($X << 4);
$aZ = $z - ($Z << 4);
$aY = $y - ($Y << 4);
$bindex = (int) ($aY + ($aX << 5) + ($aZ << 9));
$mindex = (int) (($aY >> 1) + 16 + ($aX << 5) + ($aZ << 9));
$b = ord($this->chunks[$index][$Y]{$bindex});
$m = ord($this->chunks[$index][$Y]{$mindex});
if(($y & 1) === 0){
$m = $m & 0x0F;
}else{
$m = $m >> 4;
}
return array($b, $m);
}
public function setBlock($x, $y, $z, $block, $meta = 0){
$X = $x >> 4;
$Z = $z >> 4;
$Y = $y >> 4;
$block &= 0xFF;
$meta &= 0x0F;
if($X >= 32 or $Z >= 32 or $Y >= $this->levelData["height"] or $y < 0){
return false;
}
$index = $this->getIndex($X, $Z);
if(!isset($this->chunks[$index]) or $this->chunks[$index] === false){
if($this->loadChunk($X, $Z) === false){
return false;
}
}elseif($this->chunks[$index][$Y] === false){
$this->fillMiniChunk($X, $Z, $Y);
}
$aX = $x - ($X << 4);
$aZ = $z - ($Z << 4);
$aY = $y - ($Y << 4);
$bindex = (int) ($aY + ($aX << 5) + ($aZ << 9));
$mindex = (int) (($aY >> 1) + 16 + ($aX << 5) + ($aZ << 9));
$old_b = ord($this->chunks[$index][$Y]{$bindex});
$old_m = ord($this->chunks[$index][$Y]{$mindex});
if(($y & 1) === 0){
$m = ($old_m & 0xF0) | $meta;
}else{
$m = ($meta << 4) | ($old_m & 0x0F);
}
if($old_b !== $block or $old_m !== $m){
$this->chunks[$index][$Y]{$bindex} = chr($block);
$this->chunks[$index][$Y]{$mindex} = chr($m);
if(!isset($this->chunkChange[$index][$Y])){
$this->chunkChange[$index][$Y] = 1;
}else{
++$this->chunkChange[$index][$Y];
}
$this->chunkChange[$index][-1] = true;
return true;
}
return false;
}
public function saveChunk($X, $Z){
$X = (int) $X;
$Z = (int) $Z;
if(!$this->isChunkLoaded($X, $Z)){
return false;
}
$index = $this->getIndex($X, $Z);
if(!isset($this->chunkChange[$index]) or $this->chunkChange[$index][-1] === false){//No changes in chunk
return true;
}
$chunk = @gzopen($this->getChunkPath($X, $Z), "wb".PMF_LEVEL_DEFLATE_LEVEL);
$bitmap = 0;
for($Y = 0; $Y < $this->levelData["height"]; ++$Y){
if($this->chunks[$index][$Y] !== false and ((isset($this->chunkChange[$index][$Y]) and $this->chunkChange[$index][$Y] === 0) or !$this->isMiniChunkEmpty($X, $Z, $Y))){
gzwrite($chunk, $this->chunks[$index][$Y]);
$bitmap |= 1 << $Y;
}else{
$this->chunks[$index][$Y] = false;
}
$this->chunkChange[$index][$Y] = 0;
}
$this->chunkChange[$index][-1] = false;
$this->locationTable[$index][0] = $bitmap;
$this->seek($this->payloadOffset + ($index << 1));
$this->write(Utils::writeShort($this->locationTable[$index][0]));
return true;
}
public function doSaveRound(){
foreach($this->chunks as $index => $chunk){
$this->getXZ($index, $X, $Z);
$this->saveChunk($X, $Z);
}
}
}

View File

@ -1,127 +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/
*
*
*/
define("PMF_CURRENT_VERSION", 0x01);
class PMF{
protected $fp;
protected $file;
private $version;
private $type;
public function __construct($file, $new = false, $type = 0, $version = PMF_CURRENT_VERSION){
if($new === true){
$this->create($file, $type, $version);
}else{
if($this->load($file) !== true){
$this->parseInfo();
}
}
}
public function getVersion(){
return $this->version;
}
public function getType(){
return $this->type;
}
public function load($file){
$this->close();
$this->file = $file;
if(($this->fp = @fopen($file, "c+b")) !== false){
fseek($this->fp, 0, SEEK_END);
if(ftell($this->fp) >= 5){ //Header + 2 Bytes
@flock($this->fp, LOCK_EX);
return true;
}
$this->close();
}
return false;
}
public function parseInfo(){
$this->seek(0);
if(fread($this->fp, 3) !== "PMF"){
return false;
}
$this->version = ord($this->read(1));
switch($this->version){
case 0x01:
$this->type = ord($this->read(1));
break;
default:
console("[ERROR] Tried loading non-supported PMF version ".$this->version." on file ".$this->file);
return false;
}
return true;
}
public function getFile(){
return $this->file;
}
public function close(){
unset($this->version, $this->type, $this->file);
if(is_object($this->fp)){
@flock($this->fp, LOCK_UN);
fclose($this->fp);
}
}
public function create($file, $type, $version = PMF_CURRENT_VERSION){
$this->file = $file;
@mkdir(dirname($this->file), 0755, true);
if(!is_resource($this->fp)){
if(($this->fp = @fopen($file, "c+b")) === false){
return false;
}
}
$this->seek(0);
$this->write("PMF" . chr((int) $version) . chr((int) $type));
}
public function read($length){
if($length <= 0){
return "";
}
if(is_resource($this->fp)){
return fread($this->fp, (int) $length);
}
return false;
}
public function write($string, $length = false){
if(is_resource($this->fp)){
return ($length === false ? fwrite($this->fp, $string) : fwrite($this->fp, $string, $length));
}
return false;
}
public function seek($offset, $whence = SEEK_SET){
if(is_resource($this->fp)){
return fseek($this->fp, (int) $offset, (int) $whence);
}
return false;
}
}

View File

@ -1,81 +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/
*
*
*/
/***REM_START***/
require_once(FILE_PATH."/src/pmf/PMF.php");
/***REM_END***/
define("PMF_CURRENT_PLUGIN_VERSION", 0x02);
class PMFPlugin extends PMF{
private $pluginData = array();
public function __construct($file){
$this->load($file);
$this->parseInfo();
$this->parsePlugin();
}
public function getPluginInfo(){
return $this->pluginData;
}
protected function parsePlugin(){
if($this->getType() !== 0x01){
return false;
}
$this->seek(5);
$this->pluginData["fversion"] = ord($this->read(1));
if($this->pluginData["fversion"] > PMF_CURRENT_PLUGIN_VERSION){
return false;
}
$this->pluginData["name"] = $this->read(Utils::readShort($this->read(2), false));
$this->pluginData["version"] = $this->read(Utils::readShort($this->read(2), false));
$this->pluginData["author"] = $this->read(Utils::readShort($this->read(2), false));
if($this->pluginData["fversion"] >= 0x01){
$this->pluginData["apiversion"] = $this->read(Utils::readShort($this->read(2), false));
}else{
$this->pluginData["apiversion"] = Utils::readShort($this->read(2), false);
}
$this->pluginData["class"] = $this->read(Utils::readShort($this->read(2), false));
$this->pluginData["identifier"] = $this->read(Utils::readShort($this->read(2), false)); //Will be used to check for updates
if($this->pluginData["fversion"] >= 0x02){
$data = explode(";", gzinflate($this->read(Utils::readInt($this->read(4)))));
$this->pluginData["extra"] = array();
foreach($data as $v){
$v = trim($v);
if($v != ""){
$v = base64_decode($v);
$kl = strpos($v, ":");
$this->pluginData["extra"][substr($v, 0, $kl)] = substr($v, $kl + 1);
}
}
}else{
$this->pluginData["extra"] = gzinflate($this->read(Utils::readShort($this->read(2), false)));
}
$this->pluginData["code"] = "";
while(!feof($this->fp)){
$this->pluginData["code"] .= $this->read(4096);
}
$this->pluginData["code"] = gzinflate($this->pluginData["code"]);
}
}

View File

@ -0,0 +1,137 @@
<?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\event\TranslationContainer;
use pocketmine\utils\TextFormat;
/**
* Handles the achievement list and a bit more
*/
abstract class Achievement{
/**
* @var array[]
*/
public static $list = [
/*"openInventory" => array(
"name" => "Taking Inventory",
"requires" => [],
),*/
"mineWood" => [
"name" => "Getting Wood",
"requires" => [ //"openInventory",
],
],
"buildWorkBench" => [
"name" => "Benchmarking",
"requires" => [
"mineWood",
],
],
"buildPickaxe" => [
"name" => "Time to Mine!",
"requires" => [
"buildWorkBench",
],
],
"buildFurnace" => [
"name" => "Hot Topic",
"requires" => [
"buildPickaxe",
],
],
"acquireIron" => [
"name" => "Acquire hardware",
"requires" => [
"buildFurnace",
],
],
"buildHoe" => [
"name" => "Time to Farm!",
"requires" => [
"buildWorkBench",
],
],
"makeBread" => [
"name" => "Bake Bread",
"requires" => [
"buildHoe",
],
],
"bakeCake" => [
"name" => "The Lie",
"requires" => [
"buildHoe",
],
],
"buildBetterPickaxe" => [
"name" => "Getting an Upgrade",
"requires" => [
"buildPickaxe",
],
],
"buildSword" => [
"name" => "Time to Strike!",
"requires" => [
"buildWorkBench",
],
],
"diamonds" => [
"name" => "DIAMONDS!",
"requires" => [
"acquireIron",
],
],
];
public static function broadcast(Player $player, $achievementId){
if(isset(Achievement::$list[$achievementId])){
$translation = new TranslationContainer("chat.type.achievement", [$player->getDisplayName(), TextFormat::GREEN . Achievement::$list[$achievementId]["name"]]);
if(Server::getInstance()->getConfigString("announce-player-achievements", true) === true){
Server::getInstance()->broadcastMessage($translation);
}else{
$player->sendMessage($translation);
}
return true;
}
return false;
}
public static function add($achievementId, $achievementName, array $requires = []){
if(!isset(Achievement::$list[$achievementId])){
Achievement::$list[$achievementId] = [
"name" => $achievementName,
"requires" => $requires,
];
return true;
}
return false;
}
}

View File

@ -0,0 +1,35 @@
<?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;
abstract class Collectable extends \Threaded implements \Collectable{
private $isGarbage = false;
public function isGarbage() : bool{
return $this->isGarbage;
}
public function setGarbage(){
$this->isGarbage = true;
}
}

View File

@ -0,0 +1,26 @@
<?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{
}

View File

@ -0,0 +1,251 @@
<?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\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");
if(!is_resource($this->fp)){
throw new \RuntimeException("Could not create Crash Dump");
}
$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(3);
$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,333 @@
<?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\event\server\LowMemoryEvent;
use pocketmine\event\Timings;
use pocketmine\scheduler\GarbageCollectionTask;
use pocketmine\utils\Utils;
class MemoryManager{
/** @var Server */
private $server;
private $memoryLimit;
private $globalMemoryLimit;
private $checkRate;
private $checkTicker = 0;
private $lowMemory = false;
private $continuousTrigger = true;
private $continuousTriggerRate;
private $continuousTriggerCount = 0;
private $continuousTriggerTicker = 0;
private $garbageCollectionPeriod;
private $garbageCollectionTicker = 0;
private $garbageCollectionTrigger;
private $garbageCollectionAsync;
private $chunkLimit;
private $chunkCollect;
private $chunkTrigger;
private $chunkCache;
private $cacheTrigger;
public function __construct(Server $server){
$this->server = $server;
$this->init();
}
private function init(){
$this->memoryLimit = ((int) $this->server->getProperty("memory.main-limit", 0)) * 1024 * 1024;
$defaultMemory = 1024;
if(preg_match("/([0-9]+)([KMGkmg])/", $this->server->getConfigString("memory-limit", ""), $matches) > 0){
$m = (int) $matches[1];
if($m <= 0){
$defaultMemory = 0;
}else{
switch(strtoupper($matches[2])){
case "K":
$defaultMemory = $m / 1024;
break;
case "M":
$defaultMemory = $m;
break;
case "G":
$defaultMemory = $m * 1024;
break;
default:
$defaultMemory = $m;
break;
}
}
}
$hardLimit = ((int) $this->server->getProperty("memory.main-hard-limit", $defaultMemory));
if($hardLimit <= 0){
ini_set("memory_limit", -1);
}else{
ini_set("memory_limit", $hardLimit . "M");
}
$this->globalMemoryLimit = ((int) $this->server->getProperty("memory.global-limit", 0)) * 1024 * 1024;
$this->checkRate = (int) $this->server->getProperty("memory.check-rate", 20);
$this->continuousTrigger = (bool) $this->server->getProperty("memory.continuous-trigger", true);
$this->continuousTriggerRate = (int) $this->server->getProperty("memory.continuous-trigger-rate", 30);
$this->garbageCollectionPeriod = (int) $this->server->getProperty("memory.garbage-collection.period", 36000);
$this->garbageCollectionTrigger = (bool) $this->server->getProperty("memory.garbage-collection.low-memory-trigger", true);
$this->garbageCollectionAsync = (bool) $this->server->getProperty("memory.garbage-collection.collect-async-worker", true);
$this->chunkLimit = (int) $this->server->getProperty("memory.max-chunks.trigger-limit", 96);
$this->chunkCollect = (bool) $this->server->getProperty("memory.max-chunks.trigger-chunk-collect", true);
$this->chunkTrigger = (bool) $this->server->getProperty("memory.max-chunks.low-memory-trigger", true);
$this->chunkCache = (bool) $this->server->getProperty("memory.world-caches.disable-chunk-cache", true);
$this->cacheTrigger = (bool) $this->server->getProperty("memory.world-caches.low-memory-trigger", true);
gc_enable();
}
public function isLowMemory(){
return $this->lowMemory;
}
public function canUseChunkCache(){
return !($this->lowMemory and $this->chunkTrigger);
}
public function getViewDistance($distance){
return $this->lowMemory ? min($this->chunkLimit, $distance) : $distance;
}
public function trigger($memory, $limit, $global = false, $triggerCount = 0){
$this->server->getLogger()->debug(sprintf("[Memory Manager] %sLow memory triggered, limit %gMB, using %gMB",
$global ? "Global " : "", round(($limit / 1024) / 1024, 2), round(($memory / 1024) / 1024, 2)));
if($this->cacheTrigger){
foreach($this->server->getLevels() as $level){
$level->clearCache(true);
}
}
if($this->chunkTrigger and $this->chunkCollect){
foreach($this->server->getLevels() as $level){
$level->doChunkGarbageCollection();
}
}
$ev = new LowMemoryEvent($memory, $limit, $global, $triggerCount);
$this->server->getPluginManager()->callEvent($ev);
$cycles = 0;
if($this->garbageCollectionTrigger){
$cycles = $this->triggerGarbageCollector();
}
$this->server->getLogger()->debug(sprintf("[Memory Manager] Freed %gMB, $cycles cycles", round(($ev->getMemoryFreed() / 1024) / 1024, 2)));
}
public function check(){
Timings::$memoryManagerTimer->startTiming();
if(($this->memoryLimit > 0 or $this->globalMemoryLimit > 0) and ++$this->checkTicker >= $this->checkRate){
$this->checkTicker = 0;
$memory = Utils::getMemoryUsage(true);
$trigger = false;
if($this->memoryLimit > 0 and $memory[0] > $this->memoryLimit){
$trigger = 0;
}elseif($this->globalMemoryLimit > 0 and $memory[1] > $this->globalMemoryLimit){
$trigger = 1;
}
if($trigger !== false){
if($this->lowMemory and $this->continuousTrigger){
if(++$this->continuousTriggerTicker >= $this->continuousTriggerRate){
$this->continuousTriggerTicker = 0;
$this->trigger($memory[$trigger], $this->memoryLimit, $trigger > 0, ++$this->continuousTriggerCount);
}
}else{
$this->lowMemory = true;
$this->continuousTriggerCount = 0;
$this->trigger($memory[$trigger], $this->memoryLimit, $trigger > 0);
}
}else{
$this->lowMemory = false;
}
}
if($this->garbageCollectionPeriod > 0 and ++$this->garbageCollectionTicker >= $this->garbageCollectionPeriod){
$this->garbageCollectionTicker = 0;
$this->triggerGarbageCollector();
}
Timings::$memoryManagerTimer->stopTiming();
}
public function triggerGarbageCollector(){
Timings::$garbageCollectorTimer->startTiming();
if($this->garbageCollectionAsync){
$size = $this->server->getScheduler()->getAsyncTaskPoolSize();
for($i = 0; $i < $size; ++$i){
$this->server->getScheduler()->scheduleAsyncTaskToWorker(new GarbageCollectionTask(), $i);
}
}
$cycles = gc_collect_cycles();
Timings::$garbageCollectorTimer->stopTiming();
return $cycles;
}
public function dumpServerMemory($outputFolder, $maxNesting, $maxStringSize){
gc_disable();
if(!file_exists($outputFolder)){
mkdir($outputFolder, 0777, true);
}
$this->server->getLogger()->notice("[Dump] After the memory dump is done, the server might crash");
$obData = fopen($outputFolder . "/objects.js", "wb+");
$staticProperties = [];
$data = [];
$objects = [];
$refCounts = [];
$this->continueDump($this->server, $data, $objects, $refCounts, 0, $maxNesting, $maxStringSize);
do{
$continue = false;
foreach($objects as $hash => $object){
if(!is_object($object)){
continue;
}
$continue = true;
$className = get_class($object);
$objects[$hash] = true;
$reflection = new \ReflectionObject($object);
$info = [
"information" => "$hash@$className",
"properties" => []
];
if($reflection->getParentClass()){
$info["parent"] = $reflection->getParentClass()->getName();
}
if(count($reflection->getInterfaceNames()) > 0){
$info["implements"] = implode(", ", $reflection->getInterfaceNames());
}
foreach($reflection->getProperties() as $property){
if($property->isStatic()){
continue;
}
if(!$property->isPublic()){
$property->setAccessible(true);
}
$this->continueDump($property->getValue($object), $info["properties"][$property->getName()], $objects, $refCounts, 0, $maxNesting, $maxStringSize);
}
fwrite($obData, "$hash@$className: " . json_encode($info, JSON_UNESCAPED_SLASHES) . "\n");
if(!isset($objects["staticProperties"][$className])){
$staticProperties[$className] = [];
foreach($reflection->getProperties() as $property){
if(!$property->isStatic() or $property->getDeclaringClass()->getName() !== $className){
continue;
}
if(!$property->isPublic()){
$property->setAccessible(true);
}
$this->continueDump($property->getValue($object), $staticProperties[$className][$property->getName()], $objects, $refCounts, 0, $maxNesting, $maxStringSize);
}
}
}
echo "[Dump] Wrote " . count($objects) . " objects\n";
}while($continue);
file_put_contents($outputFolder . "/staticProperties.js", json_encode($staticProperties, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
file_put_contents($outputFolder . "/serverEntry.js", json_encode($data, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
file_put_contents($outputFolder . "/referenceCounts.js", json_encode($refCounts, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
echo "[Dump] Finished!\n";
gc_enable();
$this->server->forceShutdown();
}
private function continueDump($from, &$data, &$objects, &$refCounts, $recursion, $maxNesting, $maxStringSize){
if($maxNesting <= 0){
$data = "(error) NESTING LIMIT REACHED";
return;
}
--$maxNesting;
if(is_object($from)){
if(!isset($objects[$hash = spl_object_hash($from)])){
$objects[$hash] = $from;
$refCounts[$hash] = 0;
}
++$refCounts[$hash];
$data = "(object) $hash@" . get_class($from);
}elseif(is_array($from)){
if($recursion >= 5){
$data = "(error) ARRAY RECURSION LIMIT REACHED";
return;
}
$data = [];
foreach($from as $key => $value){
$this->continueDump($value, $data[$key], $objects, $refCounts, $recursion + 1, $maxNesting, $maxStringSize);
}
}elseif(is_string($from)){
$data = sprintf("(string) len(%d) " . substr(Utils::printable($from), 0, $maxStringSize), strlen($from));
}elseif(is_resource($from)){
$data = "(resource) " . print_r($from, true);
}else{
$data = $from;
}
}
}

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\Metadatable;
use pocketmine\metadata\MetadataValue;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\plugin\Plugin;
class OfflinePlayer implements IPlayer, Metadatable{
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 CompoundTag ? $this->namedtag["firstPlayed"] : null;
}
public function getLastPlayed(){
return $this->namedtag instanceof CompoundTag ? $this->namedtag["lastPlayed"] : null;
}
public function hasPlayedBefore(){
return $this->namedtag instanceof CompoundTag;
}
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);
}
}

3586
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_int($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\Binary;
use pocketmine\utils\MainLogger;
use pocketmine\utils\ServerKiller;
use pocketmine\utils\Terminal;
use pocketmine\utils\Utils;
use pocketmine\wizard\Installer;
use raklib\RakLib;
const VERSION = "1.6.1dev";
const API_VERSION = "2.1.0";
const CODENAME = "Unleashed";
const MINECRAFT_VERSION = "v0.16.0.5 alpha";
const MINECRAFT_VERSION_NETWORK = "0.16.0.5";
/*
* 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(version_compare("7.0", PHP_VERSION) > 0){
echo "[CRITICAL] You must use PHP >= 7.0" . PHP_EOL;
echo "[CRITICAL] Please use the installer provided on the homepage." . PHP_EOL;
exit(1);
}
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)){
if(!is_file(\pocketmine\PATH . "src/spl/ClassLoader.php")){
echo "[CRITICAL] Unable to find the PocketMine-SPL library." . PHP_EOL;
echo "[CRITICAL] Please use provided builds or clone the repository recursively." . PHP_EOL;
exit(1);
}
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->register(true);
try{
if(!class_exists(RakLib::class)){
throw new \Exception;
}
}catch(\Exception $e){
echo "[CRITICAL] Unable to find the RakLib library." . PHP_EOL;
exit(1);
}
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", -1);
define('pocketmine\START_TIME', microtime(true));
$opts = getopt("", ["data:", "plugins:", "no-wizard", "enable-profiler"]);
define('pocketmine\DATA', isset($opts["data"]) ? $opts["data"] . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR);
define('pocketmine\PLUGIN_PATH', isset($opts["plugins"]) ? $opts["plugins"] . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR);
Terminal::init();
define('pocketmine\ANSI', Terminal::hasFormattingCodes());
if(!file_exists(\pocketmine\DATA)){
mkdir(\pocketmine\DATA, 0777, true);
}
//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 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 people don't come to us complaining and fill up the issue tracker when they put
* an incorrect timezone abbreviation in php.ini apparently.
*/
$timezone = ini_get("date.timezone");
if(strpos($timezone, "/") === false){
$default_timezone = timezone_name_from_abbr($timezone);
ini_set("date.timezone", $default_timezone);
date_default_timezone_set($default_timezone);
}else{
date_default_timezone_set($timezone);
}
}
function detect_system_timezone(){
switch(Utils::getOS()){
case 'win':
$regex = '/(UTC)(\+*\-*\d*\d*\:*\d*\d*)/';
/*
* wmic timezone get Caption
* Get the timezone offset
*
* Sample Output var_dump
* array(3) {
* [0] =>
* string(7) "Caption"
* [1] =>
* string(20) "(UTC+09:30) Adelaide"
* [2] =>
* string(0) ""
* }
*/
exec("wmic timezone get Caption", $output);
$string = trim(implode("\n", $output));
//Detect the Time Zone string
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:
if(function_exists("posix_kill")){
posix_kill($pid, SIGKILL);
}else{
exec("kill -9 " . ((int) $pid) . " > /dev/null 2>&1");
}
}
}
/**
* @param object $value
* @param bool $includeCurrent
*
* @return int
*/
function getReferenceCount($value, $includeCurrent = true){
ob_start();
debug_zval_dump($value);
$ret = explode("\n", ob_get_contents());
ob_end_clean();
if(count($ret) >= 1 and preg_match('/^.* refcount\\(([0-9]+)\\)\\{$/', trim($ret[0]), $m) > 0){
return ((int) $m[1]) - ($includeCurrent ? 3 : 4); //$value + zval call + extra call
}
return -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) . " " . (is_array($value) ? "Array()" : Utils::printable(@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"] . "(" . Utils::printable(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), "/");
}
$errors = 0;
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, "3.1.5") < 0){
$logger->critical("pthreads >= 3.1.5 is required, while you have $pthreads_version.");
++$errors;
}
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("xdebug")){
$logger->warning("
You are running PocketMine with xdebug enabled. This has a major impact on performance.
");
}
if(!extension_loaded("curl")){
$logger->critical("Unable to find the cURL extension.");
++$errors;
}
if(!extension_loaded("yaml")){
$logger->critical("Unable to find the YAML extension.");
++$errors;
}
if(!extension_loaded("sqlite3")){
$logger->critical("Unable to find the SQLite3 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(random_bytes(8))); //Fix OPCache address errors
if(!file_exists(\pocketmine\DATA . "server.properties") and !isset($opts["no-wizard"])){
new Installer();
}
if(\Phar::running(true) === ""){
$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");
$killer = new ServerKiller(8);
$killer->start();
foreach(ThreadManager::getInstance()->getAll() as $id => $thread){
$logger->debug("Stopping " . $thread->getThreadName() . " thread");
$thread->quit();
}
$logger->shutdown();
$logger->join();
echo Terminal::$FORMAT_RESET . "\n";
exit(0);
}

2461
src/pocketmine/Server.php Normal file

File diff suppressed because it is too large Load Diff

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

@ -0,0 +1,88 @@
<?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{
/** @var \ClassLoader */
protected $classLoader;
protected $isKilled = false;
public function getClassLoader(){
return $this->classLoader;
}
public function setClassLoader(\ClassLoader $loader = null){
if($loader === null){
$loader = Server::getInstance()->getLoader();
}
$this->classLoader = $loader;
}
public function registerClassLoader(){
if(!interface_exists("ClassLoader", false)){
require(\pocketmine\PATH . "src/spl/ClassLoader.php");
require(\pocketmine\PATH . "src/spl/BaseClassLoader.php");
require(\pocketmine\PATH . "src/pocketmine/CompatibleClassLoader.php");
}
if($this->classLoader !== null){
$this->classLoader->register(true);
}
}
public function start(int $options = PTHREADS_INHERIT_ALL){
ThreadManager::getInstance()->add($this);
if(!$this->isRunning() and !$this->isJoined() and !$this->isTerminated()){
if($this->getClassLoader() === null){
$this->setClassLoader();
}
return parent::start($options);
}
return false;
}
/**
* Stops the thread using the best way possible. Try to stop it yourself before calling this.
*/
public function quit(){
$this->isKilled = true;
$this->notify();
if(!$this->isJoined()){
if(!$this->isTerminated()){
$this->join();
}
}
ThreadManager::getInstance()->remove($this);
}
public function getThreadName(){
return (new \ReflectionClass($this))->getShortName();
}
}

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 \Volatile{
/** @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;
}
}

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