Commit Graph

8455 Commits

Author SHA1 Message Date
36548a335c Fixed some items disappeared after 5fb7825485 2018-10-06 21:30:21 +01:00
5fb7825485 Flatten Item variants, remove Item->setDamage() 2018-10-06 20:09:11 +01:00
14ef4558c2 Allow BlockFactory to handle position setting of newly created blocks 2018-10-06 19:06:49 +01:00
cdb17b1cee Fixed broken test 2018-10-06 17:39:11 +01:00
a430f7f4f7 Allow static properties and state masks to vary based on variant 2018-10-06 17:33:28 +01:00
9338061390 Update composer lock dependencies 2018-10-06 15:10:43 +01:00
785df3789d Remove now-unused internal function 2018-10-06 14:46:38 +01:00
7ee4fd55d3 Merge branch 'release/3.3' 2018-10-06 14:45:19 +01:00
50b89c30f8 Merge branch 'release/3.2' into release/3.3 2018-10-06 14:45:12 +01:00
17ceb27af4 Merge branch 'release/3.1' into release/3.2 2018-10-06 14:45:05 +01:00
adbd1c7bed RCON: remove redundant sleep
this dates back to the days where PM used to kill threads to stop them. Today we're more civilized and ask it to stop nicely, so this isn't necessary anymore.
2018-10-06 14:44:56 +01:00
78bb0145aa Remove unused imports from Block namespace 2018-10-05 18:31:06 +01:00
4608ecde9b Merge branch 'release/3.3' 2018-10-05 18:29:37 +01:00
495fdbd19f Move block and network namespaces away from PluginManager->callEvent()
the original step that wasn't supposed to cause conflicts, caused messy conflicts... so I might as well do this part too
2018-10-05 18:22:49 +01:00
495a0b1dc2 Merge branch 'release/3.3' 2018-10-05 18:11:33 +01:00
620784e4e7 Merge branch 'release/3.2' into release/3.3 2018-10-05 17:44:03 +01:00
cf20e626e2 Merge branch 'release/3.1' into release/3.2 2018-10-05 17:43:54 +01:00
d75c830a7e Add -f parameter to lint.sh to allow it to not be useless in cygwin
find can conflict with windows' built in find command, which causes it to bug out when running tests.
2018-10-05 17:43:45 +01:00
1dd6591ac1 Migrate a bunch of PluginManager->callEvent() usages to Event->call
This has the triple bonus effect of a) making a lot of code easier to read, b) reducing Server::getInstance() usages, and c) removing a whole bunch of Server dependencies.

The network and block namespaces are untouched by this commit due to potential for merge conflicts. These should be dealt with separately on master.
2018-10-05 17:30:06 +01:00
6efef3bbc7 Move event calling functionality to Event->call() method
This is dependent on the changes made in b1e0f82cbf. This now makes it possible to call events without fetching a Server reference, allowing to eliminate a vast array of Server dependencies.
2018-10-05 16:55:37 +01:00
b1e0f82cbf PluginManager: Stop catching exceptions thrown by event handlers (#2472)
The basic principle here is "if you're not expecting it, don't catch it".

Event handlers are **never** supposed to throw exceptions. If they do throw exceptions, it's usually going to one of two things;
1. Broken code producing an error
2. Code triggering (and not catching) a runtime error

Both 1) and 2) boil down to defective code on the part of the event handler, and thus should not be caught by the caller, but instead allowed to crash the server and produce a crashdump.

It's also undesirable to catch unexpected errors here for a few other reasons
- It leaves the owner of the event handler in an unknown, potentially unstable state
- It allows broken code to cause event handlers to spam the logger in events that happen frequently (for example movement handlers)
- It allows the process to continue down a train of further undefined behaviour, which may lead to more errors or ultimately a crash, so it makes no sense to hold off the inevitable.

This has a few advantages that are not merely inverted disadvantages:
- Crash dumps will now be created and automatically submitted for defective event handlers, allowing quicker issue location, debugging and fixing in plugins without manual user interaction
- Event calling now isn't dependent on Server to work.
2018-10-05 16:46:10 +01:00
47f43c5e6b Remove some internal constants from public API 2018-10-04 20:03:11 +01:00
b407eba1a3 Apply typehints to level\format\io namespace 2018-10-04 19:59:26 +01:00
b214601a82 Silence PhpStorm complaining about hardcoded classpaths 2018-10-04 19:58:39 +01:00
a273a0c8a9 Fixed remaining cases of undefined behaviour on ambiguous world format
It was still possible to produce undefined behaviour by creating a db folder in a region-based world, or adding regions to a leveldb world. This now solves the problem completely by refusing to load the world if multiple formats match the world.
2018-10-04 19:43:31 +01:00
0cc4bc48cc Move generator classpath hack out of BaseLevelProvider 2018-10-04 18:55:20 +01:00
49e47edcf5 Separate level data handling from the main LevelProvider 2018-10-04 18:45:02 +01:00
f23bba053b Merge branch 'release/3.3' 2018-10-04 16:41:11 +01:00
c065cfbeda Merge branch 'release/3.2' into release/3.3 2018-10-04 16:41:03 +01:00
722924a779 Merge branch 'release/3.1' into release/3.2 2018-10-04 16:40:55 +01:00
60e1b29462 RegionLoader: Remove incorrect size cap
This assumes that the region is properly garbage-collected and packed, but if the file contains uncollected garbage this may not be the case, resulting in a region larger than a gigabyte.
2018-10-04 16:40:45 +01:00
b0f1863c4f Region loaders don't need to know their own coordinates 2018-10-04 16:37:19 +01:00
41f335e7d9 Level: Remove setSeed()
Seed is immutable information about the world, like its generator type, generator options, name, etc. We don't allow changing any of those things, so why the fuck would we allow changing the seed? This makes no sense at all.

I'm removing this because a) its existence makes no sense, and b) it will not produce the behaviour expected from such a function (what even is the expected behaviour???)
2018-10-04 16:24:07 +01:00
4d9d4d7c60 More cleanups to level provider hierarchy, move more garbage out of BaseLevelProvider 2018-10-04 16:02:55 +01:00
4f421d561c BaseLevelProvider: clean up not-exists error handling disaster
It checks for the existence of (and creates) the world directory if it doesn't exist. But what sense does this make when the world obviously doesn't exist in this case and must be generated first?
2018-10-04 15:41:18 +01:00
f787552e97 Remove LevelProvider::getProviderName()
This is problematic because child level providers can forget to override the provider name of their parents, and then override them by error. Instead, they should be used in a mapping fashion to make sure they are unique and not inherited.
Also, the old method did not permit registering multiple aliases for the same provider. This now makes that possible.
2018-10-04 14:56:42 +01:00
65b49dec71 Refactor hierarchy of Region-based world formats
In the future, McRegion and PMAnvil will become deprecated legacy formats which we won't support for writing anymore. However, this brings complications because Anvil (which would not be deprecated) would be sandwiched between its deprecated base (McRegion) and its deprecated child (PMAnvil), complicating the implementation (particularly for PMAnvil).

This abstracts away the generic Region-based world functionality into a separate class, making McRegion, Anvil and PMAnvil all inherit from it directly. Since only the chunk formats are different, they are more accurately siblings rather than parent-child (although Anvil and PMAnvil are cousins, ish).
2018-10-04 14:19:19 +01:00
eaf6b316c7 I always commit this submodule when I don't want it, and not when I do 2018-10-04 12:52:09 +01:00
050e972add Clean up default level provider management 2018-10-04 12:49:46 +01:00
23132b899c Added LevelProvider->getAllChunks() method
this returns a generator which yields known chunks. This will be used in the future for world format conversions.
2018-10-03 19:43:16 +01:00
8a062f440d Chunk: remove column methods
these were (mostly) unused, and the places they were used breaks the interface definitions. It also exposes internals that are sensitive to change.
2018-10-03 18:35:39 +01:00
77fd57e11a Removed wtf from Liquid 2018-10-01 16:20:35 -04:00
94936d0f6b Fixed CPU leak in falling water block updating
The cause of this was the flow decay of falling water changing, but the flow decay is ignored for falling water. This caused the block to be repeatedly set to itself, triggering local block updates, causing the disease to spread in large falling water bodies and cause immense amounts of lag.
2018-10-01 16:15:49 -04:00
74486d6880 Remove some state meta constants from API visibility 2018-09-30 14:43:55 +01:00
274a4d892f Rail: detect state and then place, not vice versa 2018-09-30 14:35:57 +01:00
1a2312418b Fixed assert failure when placing northeast/northwest powered rails 2018-09-30 14:17:30 +01:00
5344c0a627 Merge branch 'release/3.3' 2018-09-29 15:39:40 +01:00
0171095036 Merge branch 'release/3.2' into release/3.3 2018-09-29 15:39:34 +01:00
5b511f6d06 Merge branch 'release/3.1' into release/3.2 2018-09-29 15:39:27 +01:00
426dee04a6 Potion: remove unnecessary exception throw in getPotionEffectsById()
this is only used by Potion and SplashPotion, and simply causes errors when trying to use potions with unknown IDs.
2018-09-29 15:39:20 +01:00