456 Commits

Author SHA1 Message Date
Dylan K. Taylor
6772a69c55 Server: Prevent construction of more than one server instance at a time
I have no idea when one might choose to do this, but it could cause extremely undesirable effects, so it should be prevented.
2018-01-06 14:58:51 +00:00
Dylan K. Taylor
9a956692de Fixed wasteful throwaway objects used for spawn positions 2018-01-02 12:21:11 +00:00
Dylan K. Taylor
965c19375f NBT: Split up concerns of endianness and varint NBT into their own classes, separate stream handling from NBT class
The remaining methods, constants and fields in the NBT class now pertain to generic NBT functionality (except for the matchList()/matchTree() methods, but that's a job for another time). All NBT I/O specific logic has now been moved to NBTStream and its descendents.
2017-12-30 14:55:45 +00:00
Dylan K. Taylor
1896576a24 ResourcePackManager: Remove Server constructor dependency 2017-12-22 11:11:58 +00:00
Dylan K. Taylor
dfc2d1dfe6 Stop hardcoding src/pocketmine/resources everywhere 2017-12-11 19:52:49 +00:00
Dylan K. Taylor
1f1531810d Added \pocketmine\RESOURCE_PATH and Server->getResourcePath() 2017-12-11 19:52:20 +00:00
Dylan K. Taylor
98cb7f2e10 Removed redundant filePath from Server constructor
This parameter is hardcoded to \pocketmine\PATH in PocketMine.php. Additionally, it does not make sense for the server source path to not be the server source path. \pocketmine\PATH is accessible from the Server context, therefore it should be used and does not need to be stored.
2017-12-11 19:25:06 +00:00
Dylan K. Taylor
8a90d159fe Cleanup unused imports 2017-12-10 12:09:46 +00:00
Dylan K. Taylor
990a48d858 Better error message when a level is unloaded during its level tick
Plugins may cause this issue unexpectedly by unloading levels directly during events such as EntityDamageEvent. This adds a better error message to allow developers to understand what is going on and create appropriate workarounds.
2017-12-04 10:01:55 +00:00
JackNoordhuis
686e1c4470 Implement ender chest (#1462) 2017-11-22 14:25:21 +00:00
Dylan K. Taylor
74b074753f Bulk addition of constant visibilities
thanks PhpStorm inspections plugin for annoying the shit out of me until
I did this.
2017-11-21 14:44:10 +00:00
Dylan K. Taylor
32714d4564 Don't write server.properties to disk unless it's been modified at runtime 2017-11-20 10:04:39 +00:00
Dylan K. Taylor
7e496afdd1 Fixed issues with LevelDB worlds silently getting overwritten with the default format when LevelDB extension is not loaded
Always register the level provider (to allow detecting the world format) but throw exceptions if anything tries to use it without the extension being loaded.
2017-11-19 17:28:16 +00:00
Johnmacrocraft
8abad33048 Change TextFormat::WHITE to RESET in Server.php 2017-11-19 10:22:04 +00:00
Dylan K. Taylor
7c2dccd2a6 Replace Player->joined with Player->spawned, remove redundant field
spawned serves basically the same purpose as joined does.
2017-11-17 13:44:37 +00:00
Dylan K. Taylor
432d90bddd quickfixes for command messages
these will have to be fixed properly at a later date
2017-11-16 08:56:01 +00:00
SOFe
34d2047ac3
A better error message for Server::getInstance() access on other threads 2017-11-05 18:40:47 +08:00
Dylan K. Taylor
6ebe3bfbea use Player->sendDataPacket() with immediate parameter 2017-11-03 19:00:08 +00:00
Dylan K. Taylor
8aca373194 added some docs to shut PhpStorm up 2017-10-29 13:02:19 +00:00
Dylan K. Taylor
1d651046c9 Compute time in milliseconds once and use it for both firstPlayed and lastPlayed
fixes issues where lastPlayed can be a tiny fraction of time into the future of firstPlayed when players join for the first time
2017-10-25 17:12:17 +01:00
Dylan K. Taylor
1dea25d123 Fixed wrong translation key used for level generation errors 2017-10-25 16:42:49 +01:00
Dylan K. Taylor
b6264d188e Change Server->getConfigBoolean() to getConfigBool()
to be consistent, deprecated the original
2017-10-25 16:30:39 +01:00
Dylan K. Taylor
2635c85873 beware users putting garbage in pocketmine.yml 2017-10-25 12:54:53 +01:00
Dylan K. Taylor
cdebb62c35 added typecast for forceLanguage property read 2017-10-14 23:26:00 +01:00
Dylan K. Taylor
8fafef2f7f Added tagType parameter to ListTag constructor, remove some boilerplate code 2017-10-08 13:28:01 +01:00
Dylan K. Taylor
18448cbcb8 Fixed several bugs with statistics updating and resetting
- fixed ridiculous network stats when title ticker or console colours are disabled (shoghicp, what fit of madness led you to think this was a good idea)
- fixed network stats reporting kb/16ticks instead of kb/s
- fixed TPS reporting getting reset after 16 ticks instead of 20
- title ticker and MOTD is now updated every 20 ticks instead of 16
2017-10-05 16:48:50 +01:00
Dylan K. Taylor
afa37bd2aa check range of valid compression values
zero is not allowed because it's pointless, just raise your compression threshold if you want zero compression.

Chunks will always be compressed regardless of threshold because they are huge. It doesn't make sense to allow uncompressed chunks when even compression level 1 will reduce their size 50x. The point of the last two (reverted) commits was to prevent compression level zero being used on chunks. Probably obvious that I was up late and not thinking very clearly.

Revert "Reduced chunk compression level to 7"

This reverts commit 49ac2555ce3d410c49eba4045ffe8a5138066346.

Revert "Always use best compression for chunks"

This reverts commit 42dd9d6abd4e7a66611cd171abd0f8f7969166c1.
2017-10-01 11:06:14 +01:00
Dylan K. Taylor
f6e30d4225 s/online-mode/xbox-auth/
lots of servers are currently running in insecure mode without realizing because of old Genisys shit configs?!
2017-09-30 12:19:24 +01:00
Dylan K. Taylor
e6cecabf3f New skin API, add support for custom capes & custom geometry (#1416)
* Added support for changing skins ingame, custom capes & geometry
* Use PlayerSkinPacket for setting Human skin instead of PlayerList hack
2017-09-29 14:09:00 +01:00
Dylan K. Taylor
f565791e41 World loading: Actually use the data in each item instead of getProperty() 2017-09-28 16:38:10 +01:00
Dylan K. Taylor
bc0434913e Fixed crash when a numeric world seed is set in pocketmine.yml 2017-09-28 16:35:19 +01:00
Dylan K. Taylor
38fad4b963 Implement difficulty per-world (#878)
* Moved Server::getDifficultyFromString() to Level
* Added ability to set difficulty in worlds section of pocketmine.yml for generation
2017-09-26 11:16:51 +01:00
Dylan K. Taylor
85ec7d9732 Change default MOTD
"Minecraft: PE Server" is no longer accurate, "Minecraft: Bedrock
Edition Server" is too wordy, and "Minecraft: BE Server" just sounds
weird.

and I'm not calling it simply a "Minecraft Server"
2017-09-25 23:43:09 +01:00
Dylan K. Taylor
10f597cd64 Stop hardcoding "PocketMine-MP" everywhere 2017-09-25 18:17:35 +01:00
Dylan K. Taylor
03d3e595d6 Implement JWT signature verification and Xbox Live checks, close #315
This can be enabled or disabled using the "online-mode" directive in
server.properties.

NOTE: For safety reasons it is enabled by default, since many naive server owners currently believe that authentication is not needed because "the client is forced to sign-in".
Newsflash for readers: the forced authentication is easily bypassed using a LAN proxy.

Un-authenticated LAN connections will still work fine if the online mode is disabled.

Added the following API methods:
- Server->getOnlineMode() : bool
- Server->requiresAuthentication() : bool
- Player->isAuthenticated() : bool

JWT verification is rather expensive, so it is done in an AsyncTask. Make sure you don't hog your worker threads.
2017-09-25 12:30:58 +01:00
Dylan K. Taylor
89e4defa29 use null coalesce in Server->getLevel() 2017-09-25 09:51:21 +01:00
Dylan K. Taylor
f5534a9ab0 Server: add some typehints 2017-09-25 09:49:19 +01:00
Dylan K. Taylor
28bce8d48c Fixed plugins causing crashes by using Level->unload() and add a warning
yes, we don't want you to use this, but it still shouldn't crash if it can be prevented...
2017-09-25 09:46:19 +01:00
Dylan K. Taylor
d7091f4460 Fixed not being able to disable stats reporting using command line options 2017-09-21 17:14:44 +01:00
Dylan K. Taylor
fcb3c4820e Merge branch 'php/7.0' into mcpe-1.2 2017-09-07 10:42:20 +01:00
Dylan K. Taylor
2c6205e3f3 Added new events for network interface handling, close #1232 (#1250)
Added 
- NetworkInterfaceRegisterEvent (cancellable)
- NetworkInterfaceUnregisterEvent
- NetworkInterfaceCrashEvent
2017-09-06 11:22:10 +01:00
Dylan K. Taylor
f0c1ea7dd7 Fixed string seeds in pocketmine.yml crash the server, close #1355 2017-09-04 10:01:21 +01:00
Dylan K. Taylor
95752ef542 Merge branch 'master' into mcpe-1.2 2017-08-23 13:20:35 +01:00
Dylan K. Taylor
84c8ac03fb Fixed #1179
This solution isn't ideal, but it works...
2017-08-23 13:19:34 +01:00
Dylan K. Taylor
445a67954d Merge changes from master 2017-08-22 14:13:31 +01:00
Dylan K. Taylor
876659cc73 Item factory refactor and added capability to register custom items 2017-08-21 17:49:26 +01:00
Dylan K. Taylor
1f70a7830e Branch merge 2017-08-20 21:07:19 +01:00
Dylan K. Taylor
02f42eba48 Move block registration to its own class 2017-08-20 18:05:01 +01:00
Dylan K. Taylor
17053389b0 Added memory limits for AsyncWorkers 2017-08-20 12:15:48 +01:00
Dylan K. Taylor
e0307411da Cleaned up PlayerList handling 2017-08-19 19:36:15 +01:00