13456 Commits

Author SHA1 Message Date
Dylan K. Taylor
0ef5c67b9b
Use static constructor for MovePlayerPacket
this marks the last of the packets created using the old way.
2021-10-27 21:10:16 +01:00
Dylan K. Taylor
6d89265510
Player: reduce code duplication
back when this was just hardcoded >> 4 everywhere, nobody thought anything of it, but now it uses constants, it's easy to cross-reference and see where the duplicates are.
2021-10-26 23:02:50 +01:00
Dylan K. Taylor
a7d8a598e1
World: reduce code duplication for chunk coordinate calculation 2021-10-26 22:58:17 +01:00
Dylan K. Taylor
51fbff204b
World: make PhpStorm understand return type of getAdjacentChunks() 2021-10-26 20:32:09 +01:00
Dylan K. Taylor
1873457840
PopulationTask: stop using dynamic properties 2021-10-26 20:21:58 +01:00
Dylan K. Taylor
fca70efbb1
World: move chunk population related methods to be in the same overall place 2021-10-26 16:44:08 +01:00
Dylan K. Taylor
8f88393184
World: Specialize generateChunkCallback() for PopulationTask
this allows us to also set the adjacent chunks before calling ChunkPopulateEvent, to give a more accurate picture of what changed.
2021-10-26 15:28:00 +01:00
Dylan K. Taylor
b9d9b69bbe
ConsoleReaderThread: trim the string before returning it
it will have a newline at the end that was added by the subprocess when posting it to the main process.
2021-10-26 01:07:14 +01:00
Dylan K. Taylor
1d99cd329a
CS again 2021-10-26 00:50:43 +01:00
Dylan K. Taylor
24d4daec90
Utils::testValidInstance() now accepts interfaces for the baseName 2021-10-26 00:32:32 +01:00
Dylan K. Taylor
4178c81209
Utils: fixed testValidInstance() not accepting the same valid class for both className and baseName
this caused problems in PlayerCreationEvent because plugins set the base class and then set the player class to the same thing.
2021-10-26 00:31:30 +01:00
Dylan K. Taylor
94f4ef5862
PopulationTask: Throw AssumptionFailedError if center chunk is null for some reason 2021-10-25 21:07:03 +01:00
Dylan K. Taylor
2e2515354c
PopulationTask: fixed undefined method call
fuck you PhpStorm! fuck you PhpStorm! fuck you PhpStorm!
2021-10-25 20:57:43 +01:00
Dylan K. Taylor
359d0835f3
CS 2021-10-25 20:54:39 +01:00
Dylan K. Taylor
d4cbde6f10
PopulationTask: use modification counters to detect changed chunks
instead of using terrain dirty flags, which aren't suitable for this purpose
2021-10-25 20:53:50 +01:00
Dylan K. Taylor
a5418a019d
Chunk: added modification counter
this is independent from the terrain dirty flags (which are specifically used to track state of chunks needing to be saved).
2021-10-25 20:53:11 +01:00
Dylan K. Taylor
baba25953f
Chunk: make all parameters of __construct() mandatory and non-nullable
having the constructor fill in defaults for these invariably causes bugs.
2021-10-25 20:22:50 +01:00
Dylan K. Taylor
d53347454b
Chunk: use HeightArray::fill() 2021-10-25 20:17:30 +01:00
Dylan K. Taylor
401e8d117b
Flat: use a less dumb way to build biome array 2021-10-25 20:15:33 +01:00
Dylan K. Taylor
9835d75f65
Chunk: removed heighArray parameter from constructor
we don't pass this anywhere, and really it should be dynamically initialized anyway, just like light.
2021-10-25 20:13:50 +01:00
Dylan K. Taylor
b8519d1af4
World: fixed every chunk having terrain saved at least once, even if unmodified
setPopulated() sets dirty flags on the chunk, causing the autosave sweep
to think they've been changed when they haven't. We now pass
terrainPopulated to the constructor to avoid this ambiguity recurring in
the future.
2021-10-25 19:53:47 +01:00
Dylan K. Taylor
f6e53f826b
Fixed Anvil/McRegion chunks getting autosaved on first time, even when unchanged
setGenerated/setPopulated and friends set hasChanged = true, which causes the world to autosave them the first time around, even though they weren't modified.
2021-10-25 19:52:44 +01:00
Dylan K. Taylor
42ede30e77
... 2021-10-23 23:57:28 +01:00
Dylan K. Taylor
04aedc6494
Updated BedrockProtocol 2021-10-23 23:54:49 +01:00
Dylan K. Taylor
701a71a4ee
Sound::encode() position is no longer nullable
making this nullable was based on the invalid assumption that global sounds have no position, but it turns out they _do_ still use the position to make the sound come from the correct direction.
2021-10-23 02:01:26 +01:00
Dylan K. Taylor
c77829f4ad
Migrate packet creation to use ::create() methods in all but one case
MovePlayerPacket doesn't yet have a ::create() due to a complication with fields that aren't always present.
2021-10-23 01:46:01 +01:00
Dylan K. Taylor
c773e43eda
Updated BedrockProtocol to pmmp/BedrockProtocol@97fa88e9ef 2021-10-23 01:16:45 +01:00
Dylan K. Taylor
a4b65d6a3f
PlayerCreationEvent: verify that the class actually exists and is instantiable
this ensures that crashdumps blame the plugin instead of the core on bad classes, such as in this case: https://crash.pmmp.io/view/5331225
2021-10-21 20:37:45 +01:00
Dylan K. Taylor
4f2bcb61d6
Fixed crashdump generation when crashing before PluginManager was created 2021-10-20 23:35:04 +01:00
Dylan K. Taylor
e2275cc8ec
PluginManager: Prevent infinite recursion in loadPlugins()
if a plugin calls loadPlugins(server->getPluginPath()) during its onLoad(), and it itself is in that plugin path, an infinite recursion will occur.
2021-10-20 23:10:18 +01:00
Dylan K. Taylor
620874d902
PluginManager: Extract checkPluginLoadability() to a PluginLoadabilityChecker unit
this can be more easily unit-tested.
2021-10-20 22:31:56 +01:00
Dylan K. Taylor
44508a138f
Moved plugin extension requirement checks to PluginManager::checkPluginLoadability()
these don't really belong in PluginDescription.
2021-10-20 22:13:30 +01:00
Dylan K. Taylor
aa408c9a97
Fixed 9646128d0176240c818dcefa57d39fb46af0de07 2021-10-20 21:54:57 +01:00
Dylan K. Taylor
6d78a0b435
CS 2021-10-20 21:52:42 +01:00
Dylan K. Taylor
76b4b23d98
PluginManager: remove loadPlugin()
loadPlugins() is now the preferred option, since it does all the proper checks.
In addition, the server now acknowledges that loading a single plugin may cause multiple plugins to be loaded, so returning only a single Plugin is not representative of what's actually happening.
2021-10-20 21:52:19 +01:00
Dylan K. Taylor
03fcd844eb
PluginManager::loadPlugins() now accepts files as well as directories
loadPlugins() is now a superior option to loadPlugin(), since it enforces dependency checks and also supports automatic loading of plugins when new loaders are installed.
2021-10-20 21:36:14 +01:00
Dylan T
a788954551
Fixed dependency handling across plugin loaders (#3971) 2021-10-20 20:22:00 +01:00
Dylan K. Taylor
dc07ac33d3
protocol: fixed missing field of CraftRecipeAuto 2021-10-20 19:47:32 +01:00
Dylan K. Taylor
80b402e529
ItemTranslator: throw the proper exceptions when failing to map network IDs 2021-10-20 14:01:39 +01:00
Dylan K. Taylor
a3f8546ac4
4.0.0-BETA7 is next 2021-10-19 19:13:43 +01:00
Dylan K. Taylor
46920818b5
Release 4.0.0-BETA6 2021-10-19 19:13:43 +01:00
Dylan K. Taylor
9c5cec77b1
3.25.1 is next 2021-10-19 18:27:30 +01:00
Dylan K. Taylor
f48b703533
Release 3.25.0 2021-10-19 18:27:26 +01:00
Dylan K. Taylor
70636f6eb4
Protocol changes for 1.17.40 2021-10-19 18:00:34 +01:00
Dylan K. Taylor
c70b80c273
ItemEntity: implement partial itemstack pickups in the dumbest way possible
Given the various limitations and flexibilities posed by EntityItemPickupEvent, I settled on this as the simplest way to deal with the problem.

- EntityItemPickupEvent may have its destination inventory changed, so we can't cache the result of getAddableItemQuantity() to use after the event.
- The item itself may have changed, so even if we thought we could add some items before the change, we might not be able to afterwards.

Considering the above facts, it's better to just give the whole itemstack to EntityItemPickupEvent, and let plugins use getAddableItemQuantity() on their own to decide if their chosen inventory can accommodate the item or not.
If it can't, then we'll just drop it on the ground.
This also fixes a potential issue where plugins changing the item to a custom one might end up with their items and the actual items both just vanishing if the target inventory was full.
closes #4499
2021-10-17 22:37:49 +01:00
Dylan K. Taylor
8db5732b44
Drop respect/validation
it's not worth this turning into compatibility baggage just so that we can parse plugin_list.yml, especially when we have new ways to handle data parsing coming in the pipeline.
For something as small as plugin_list.yml, it's easier (and in this case better too) to just validate it manually (respect/validation was anyway too strict considering it's YAML we're dealing with).
2021-10-15 17:15:46 +01:00
Dylan K. Taylor
0348236860
fucking CS again 2021-10-14 15:56:50 +01:00
Dylan K. Taylor
8c07748100
RakLibInterface: print packet exception info as a block using Utils::printableExceptionInfo() 2021-10-14 15:55:08 +01:00
Dylan K. Taylor
06e7338ff9
Move exception printing utilities from MainLogger to Utils
where they can be useful to other stuff apart from just the logger
2021-10-14 15:54:20 +01:00
Dylan K. Taylor
bdbfa70558
Server: break some isolated stuff out of Server::__construct() 2021-10-14 15:44:18 +01:00