Commit Graph

3202 Commits

Author SHA1 Message Date
Zach Brown
b380338244
Ensure entity is always dying before Death Event
Prior to this it was possible for plugins to put the server into a never
ending recursive loop until it eventually killed itself.

Fixes GH-1432
2018-09-11 17:38:57 -04:00
Aikar
6793fee387
Remove no longer needed tests due to last change 2018-09-09 01:14:18 -04:00
Aikar
5228a4f24c
Remove deadlock risk in firing async events
The PluginManager incorrectly used synchronization on firing any event
that was marked as synchronous.

This synchronized did not even protect any concurrency risk as
handlers were already thread safe in terms of mutations during event
dispatch.

The way it was used, has commonly led to deadlocks on the server,
which results in a hard crash.

This change removes the synchronize and adds some protection around enable/disable
2018-09-09 01:04:59 -04:00
Max Lee
4e30b91d4e Improve death events (#1362)
* Improve death events

This adds the ability to cancel the events and to specify the sound.
2018-09-07 20:14:48 -04:00
Gergely Sarkozi
2d45ec855f Cached, local-class-supporting task names (#1409)
Fixes issue #1177 

`MapMaker#weakKeys()` makes the `Map` use identity comparison for the keys, while also enabling the automatical removal of dropped classes from the cache.

The changes are the same as in #1399, except now the original patch is modified instead of a new one being created.
2018-09-03 10:04:50 -04:00
Aikar
2ae60bd203
Pull the last upstream updates 2018-08-31 11:51:41 -04:00
Shane Freeder
cd5da239f8
Fixup AsyncTabCompletionEvent handling 2018-08-28 22:12:21 +01:00
cakoyo
a1e9cd39d2 Add source block to BlockPhysicsEvent (#1364)
Resolves #1275 

For plants, the source block is itself, because the `changed` type is itself.
2018-08-24 10:38:31 -04:00
Aikar
0ade5595ad
[CI-SKIP] Ensure symlink process never fails build
not sure if this is source of #1365, but doesn't hurt to make
this a non fatal error if the symlink command fails.
2018-08-23 21:51:13 -04:00
Christopher White
6c32ee4a5c Add isChunkGenerated API (#1363)
Resolves #1329
2018-08-22 21:13:03 -04:00
Aikar
1218b4aae6
Fix some false positive warnings printing that shouldnt be
reduces some log spam
2018-08-20 20:20:40 -04:00
Aikar
c775246c69
Fix false positive on Chunk Entity slice messages #1302
Update links too
2018-08-20 00:54:03 -04:00
Aikar
66733df5f9
add World#getLocationAtKey for Block Key API
For when you don't want to actually load the block
2018-08-19 11:50:40 -04:00
Zach Brown
ce750d7618
Don't iterate twice - Fixes GH-1346 2018-08-18 03:58:53 -05:00
Mystiflow
51e29fb2a1 Send nearby packets from world list instead of server list (#1196) 2018-08-17 18:05:00 -04:00
searchndstroy
af57a5fed5 Allow Blocks to be accessed via a long key (#1335)
The key can be retrieved via methods Location#toBlockKey() and
Block#getBlockKey()

World provides lookup for blocks by long key via method World#getBlockAtKey(long)

The formatting for the key is as follows:

10 bit y|27 bit z|27 bit x

The y value is considered unsigned while z and x are considered two's complement

Y range: [0, 1023]
X, Z range: [-67 108 864, 67 108 863]


Checked encoding and decoding via https://gist.github.com/Spottedleaf/74f4e241012ca2fa67d8f1c7e8e34722
2018-08-17 17:55:01 -04:00
searchndstroy
9c4490bda4 Optimize BlockPosition helper methods (#1339)
Resolves #1338
2018-08-17 17:51:56 -04:00
searchndstroy
3f883badab Fix watchdog restarting on short timeout (#1344) 2018-08-17 12:09:08 -04:00
Shane Freeder
4f4a4fc100
Cleanup javadoc warnings 2018-08-17 04:02:03 +01:00
Aikar
6e2711d666
Fix bug in last patch 2018-08-16 17:52:24 -04:00
Aikar
0645364ee5
Ensure chunks are always loaded on hard position sets
Player Movement, Entity Creation and Teleportation move
entities with a very "You are here, no debate" change, making
the server register them as there, regardless if that chunk was
loaded or not.

It appears possible that with hack clients and lag, a player
may be able to move fast enough to move into an unloaded
chunk and get into a buggy state.

To prevent this, we will ensure a chunk is always loaded,
guaranteeing that the entity will be properly registered
into its new home comfortably.

Closes #1316
2018-08-16 17:46:38 -04:00
Aikar
dc428860cf
Improve Watchdog Early Warning Feature - Closes #1319
1) Don't kick in until server has started (the full crash will still kick in before full start)
2) Delay reporting until 10 seconds, then print every 5
3) Make the intervals configurable
4) Make it able to be disabled by setting every interval to <= 0
2018-08-16 17:30:26 -04:00
kashike
edb9d18aed Allow disabling armour stand ticking 2018-08-15 01:29:41 -07:00
Aikar
4c1a7f1265
Provide Chunk Coordinates as a Long API
Allows you to easily access the chunks X/z as a long, and a method
to look up by the long key too.
2018-08-14 18:43:17 -04:00
chickeneer
bd1d0bf426 Add a force option to the ParticleBuilder API (#1322)
Particle packets contain a boolean which marks the particle to either force or show normal to the receiver.
Spigot has been sending all particles with the force boolean which overrides client particle settings.

Related changes in this commit;
- Add a force option to the ParticleBuilder API, which defaults to true to keep spigot consistent with existing api.
- Add a new spawnParticle method to support this mode as a parameter. Of course kept existing api methods the same so as to not break them.

Let me know if changes are needed.
2018-08-14 01:42:31 -04:00
Aikar
2900e7fa79
Use a Queue for Queueing Commands
Lists are bad as Queues mmmkay.
2018-08-12 02:34:34 -04:00
prplz
895a4dcafc
Fix custom permissions reloading (#1325) 2018-08-11 09:39:53 -04:00
egg82
6ef9abeec2 Use ConcurrentHashMap in JsonList & Optimize (#471) (#1309)
* [CI-SKIP] add .editorconfig for base code style settings

* * Created patch 0349 (fixes #471)

* * Made requested modifications

* * Made requested modifications (x2)

* * Made recommended changes (x3)

* * Moved ConcurrentMap return values to Map as no functions specific to ConcurrentMap were used (backing map is still ConcurrentMap)
* Removed ConcurrentMap import
2018-08-11 08:46:46 -04:00
miclebrick
b369e70970
Add 5 second short dumps to watchdog (#1314) 2018-08-08 15:58:02 -05:00
Aikar
e861035fc4
[CI-SKIP] add .editorconfig for base code style settings 2018-08-07 01:14:22 -04:00
Aikar
28caff2299
Undo a mistaken chunk registration change - Closes #1302
I misinterpreted some code as a risk of entity loss, but now
after deeper study, I see how that code was used more and why
it was adding entities to chunks that they shouldn't have been
in during a world transfer process.
2018-08-04 12:53:38 -04:00
Aikar
b78002eeba
Fix ItemStack.removeEnchantment returning wrong value 2018-08-04 01:13:10 -04:00
Aikar
aea67db7a0
make dupe uuid saferegen delete range configurable
also ensure we never process already valid entities. this shouldnt be possible as of recent
commits as we made the entity slice array safer, but doesn't hurt for this logic to be safe too
incase that patch got dropped in a future version by accident/necessarily
2018-08-04 00:26:56 -04:00
Aikar
444ce86194
Entity add to world fixes - #1223
1) Chunk Registration might kill an entity, don't add it to the world if it did!

2) By default, entities are added to the world per slice iteration.
This opens risk of the slices being manipulated during chunk add if an
EntityAddToWorldEvent spawns an entity into this chunk.
Fix this by differing entity add to world for all entities at the same time

3) If a duplicate entity is attempted to add to the world of an entity, and
the original entity is dead, overwrite it as the logic does for unloaod queued entities.

Should hopefully finish up issues with #1223
2018-08-03 23:02:44 -04:00
Aikar
b3eb265ab5
Fix logic bug in negative XP bug fix - Closes #1169 2018-08-03 20:59:35 -04:00
Mark Vainomaa
22b2bf6270 Fix "MC-135506: Experience should save as Integers" still saving as short" (#1301) 2018-08-03 09:25:21 -04:00
Aikar
3c61083c72
fix missing | on dupe uuid patch 2018-08-03 08:51:29 -04:00
Aikar
f4f8a3be2d
fix missed break statement and enum check on dupe uuid resolve 2018-08-03 01:32:00 -04:00
Aikar
38af7610e3
MC-135506: Experience should save as Integers
A large orb will lose its EXP value if it went over 32k due to short truncation.
2018-08-03 00:07:02 -04:00
Aikar
56b92ff216
Fix EXP orb merging causing values to go negative - Closes #1169 2018-08-03 00:06:20 -04:00
Aikar
17dca0a0fe
Add "Safe Regen" Duplicate UUID resolver and make default
After witnessing behavior of the regeneration logs, its clear that Vanilla
has had bugs with saving duplicate entities for a while....

Some entities are saved in multiple chunks, and now we are bringing those duplicates
out that use to never surface.

This mode will analyze if the entity appears to be a duplicate (near the other dupe uuid)
and delete the entity instead.

This should reduce regenerations to entities that are nowhere near each other, and
therefore more likely to be subject to real UUID collisions due to our
previous bug, and therefor should survive the chunk load.
2018-08-02 23:25:37 -04:00
Zach Brown
2a5c62f3fc
[CI-SKIP] Add paper comment to last patch edit 2018-07-31 16:41:33 -05:00
Zach Brown
ef1242fc36
Ensure players are not marked to be removed after re-add 2018-07-31 16:39:15 -05:00
Shane Freeder
81806abef6
Break up and make tab spam limits configurable
Due to the changes in 1.13, clients will send a tab completion request
for all bukkit commands in order to factor in the lack of support for
brigadier and provide backwards support in the API.

Craftbukkit, however; has moved the chat spam limiter to also interact
with the tab completion request, which while good for avoiding abuse,
causes 1.13 clients to easilly be kicked from a server in bukkit due
to this. Removing the spam limit could cause issues for servers, however,
there is no way for servers to manipulate this without blindly cancelling
kick events, which only causes additional complications. This also causes
issues in that the tab spam limit and chat share the same field but different
limits, meaning that a player having typed a long command may be kicked from
the server.

Splitting the field up and making it configurable allows for server owners
to take the burden of this into their own hand without having to rely on
plugins doing unsafe things.

This patch has been applied to 1.12.2 in order to allow people using
plugins which allow clients of newer versions to connect, this is
not a common practice, however is being done as a level of nicety
given the current status of 1.13
2018-07-31 13:53:49 +01:00
Aikar
a3db62f3c2
PlayerProfile.complete shouldn't throw NPE
We have a result boolean for this already, and this
method was meant to be "Try from cache, if that fails, look it up"

So NPE'ing there just wasn't correct.
2018-07-31 01:41:43 -04:00
Aikar
d54ce6c17f
Properly forward exit 1 code from the paper root command
This is so the CI server can pick up when applying patches fails,
and mark the build as a failure.
2018-07-30 17:37:24 -04:00
Aikar
e7a59cde75
clear current chunk and entity slice on chunk unload
ideally this should of never mattered, as it will only
be hit if you teleport out of an unloaded chunk...

But apparently some people are triggering this.

See #1223
2018-07-30 00:51:58 -04:00
Aikar
fb19b8c1c1
MC-111480: Start Entity ID's at 1 - Closes #1287
DataWatchers that store Entity ID's treat 0 as special,
and can break things such as Elytra Fireworks.
2018-07-29 23:00:00 -04:00
Aikar
f35324dbed
Always process chunk registration after moving
This will help guarantee that entities are always in the
chunk that they are currently located at.

Should hopefully also fix Citizens triggering the "Saved to wrong chunk" message
2018-07-29 12:10:20 -04:00
Aikar
c6d6773678
Always move Entity to its new Chunk even if unloaded
Vanilla logic here would allow us to remvoe an entity from
its current chunk, and if it was going to move into an unloaded
chunk, that entity would not be added to the unloaded chunk.

This is bad because this will result in the entity being lost!

In almost all cases, the chunk will be loaded, but in the event
it wasn't, instead of losing the entity, load the chunk to add
the entity to it.
2018-07-29 12:06:35 -04:00