Commit graph

3154 commits

Author SHA1 Message Date
Gergely Sarkozi
4e4a4dbf5e 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 16:04:50 +02:00
Aikar
c832bed57d Pull the last upstream updates 2018-08-31 11:51:41 -04:00
Shane Freeder
db5a924b1c Fixup AsyncTabCompletionEvent handling 2018-08-28 19:45:14 +01:00
cakoyo
067cd73889 Add source block to BlockPhysicsEvent (#1364)
Resolves #1275 

For plants, the source block is itself, because the `changed` type is itself.
2018-08-24 22:38:31 +08:00
Aikar
356b56351e [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:50:36 -04:00
Christopher White
314acb5d8f Add isChunkGenerated API (#1363)
Resolves #1329
2018-08-22 18:13:03 -07:00
Aikar
bcb9bb64f0 Fix some false positive warnings printing that shouldnt be
reduces some log spam
2018-08-20 20:20:40 -04:00
Aikar
0f2aaa4364 Fix false positive on Chunk Entity slice messages #1302
Update links too
2018-08-20 00:54:03 -04:00
Aikar
4cf5e15b50 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
9920287a0f Don't iterate twice - Fixes GH-1346 2018-08-18 03:58:53 -05:00
Mystiflow
eb8312e4f9 Send nearby packets from world list instead of server list (#1196) 2018-08-17 23:05:00 +01:00
searchndstroy
612bf465f2 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 14:55:01 -07:00
searchndstroy
93e3a60a2f Optimize BlockPosition helper methods (#1339)
Resolves #1338
2018-08-17 14:51:56 -07:00
searchndstroy
093dd0a9b9 Fix watchdog restarting on short timeout (#1344) 2018-08-17 09:09:08 -07:00
Shane Freeder
69928187c9 Cleanup javadoc warnings 2018-08-16 12:20:58 +01:00
Aikar
609d6bba6a Fix bug in last patch 2018-08-16 17:52:24 -04:00
Aikar
0661cf198e 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
29da1d351d 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-12 13:27:23 -04:00
Riley Park
2053af2fa3 Allow disabling armour stand ticking 2018-08-15 01:26:51 -07:00
Aikar
c0b3072db5 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-04 19:38:58 -04:00
chickeneer
f439f7f20e 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 00:42:31 -05:00
Aikar
b15abb2838 Use a Queue for Queueing Commands
Lists are bad as Queues mmmkay.
2018-08-12 02:34:34 -04:00
prplz
50d88c817f Fix custom permissions reloading (#1325) 2018-08-11 09:39:04 -04:00
egg82
d1f6595317 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 06:46:46 -06:00
miclebrick
d1ceb803d3 Add 5 second short dumps to watchdog (#1314) 2018-08-08 15:31:29 -04:00
Aikar
e5929a071e [CI-SKIP] add .editorconfig for base code style settings 2018-08-07 01:13:55 -04:00
Aikar
dad4f590f0 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
154a6bba21 Fix ItemStack.removeEnchantment returning wrong value 2018-08-04 01:13:10 -04:00
Aikar
7fe1caf23d 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:23:00 -04:00
Aikar
d59b727a40 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
a75c747cd7 Fix logic bug in negative XP bug fix - Closes #1169 2018-08-03 20:59:35 -04:00
Mark Vainomaa
6116576bf3 Fix "MC-135506: Experience should save as Integers" still saving as short" (#1301) 2018-08-03 16:25:21 +03:00
Aikar
9dde9d710e fix missing | on dupe uuid patch 2018-08-03 08:51:04 -04:00
Aikar
a72b697cbb fix missed break statement and enum check on dupe uuid resolve 2018-08-03 01:32:00 -04:00
Aikar
3522a633d6 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
712ded51a2 Fix EXP orb merging causing values to go negative - Closes #1169 2018-08-03 00:06:20 -04:00
Aikar
4128c348c2 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:06:03 -04:00
Zach Brown
8930ecd00e [CI-SKIP] Add paper comment to last patch edit 2018-07-31 16:41:33 -05:00
Zach Brown
cc597bfd1d Ensure players are not marked to be removed after re-add 2018-07-31 16:39:15 -05:00
Shane Freeder
d72dce83ad 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
f036462d5b 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:37:41 -04:00
Aikar
15735117d7 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
2b23006694 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
4bd8975ab6 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
cf817bd292 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
24f2a7f9f6 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
Aikar
372d9c2d4a If Entity is added to chunk, look up the chunk if current isnt set
Hopefully will (f)ix #1280...

I'm suspicious that Citizens isn't calling things in the same order and causes the current
chunk to not be set, which then bugs removals. Though this doesn't make any sense to me,
so this likely won't fix it...

But if the isAddedToChunk is true, we really should be returning a chunk anyways if its loaded.
2018-07-29 12:04:09 -04:00
Aikar
189b80e425 Ignore Dead Entities in entityList iteration
A spigot change delays removal of entities from the entity list.
This causes a change in behavior from Vanilla where getEntities type
methods will return dead entities that they shouldn't otherwise be doing.

This will ensure that dead entities are skipped from iteration since
they shouldn't of been in the list in the first place.
2018-07-28 12:26:36 -04:00
Aikar
f94330b3e4 Always process chunk removal in removeEntity
Spigot might skip chunk registration changes in removeEntity
which can keep them in the chunk when they shouldnt be if done
during entity ticking.

Should fix some cases where "Entity is still in another chunk section"
Related to #1223
2018-07-28 12:13:52 -04:00
Aikar
6cd0bd29ab Fix Dupe UUID logic triggering when the duplicate is pending unload
Vanilla logic checks unload queue and overwrites if its in it.
we're triggering this if a chunk unloads, and reloads immediately in same tick.

Added check for unload queue to not treat as duplicate

Also fixed the config setting not even loading
2018-07-28 01:20:06 -04:00