Commit Graph

1466 Commits

Author SHA1 Message Date
Aikar
18944d81ff Process Chunk.addEntities before chunkLoadEvent
1.13 undesirably changed behavior here that chunk load event fired
before the entities were added to the world.

This means any plugin that spawns entities in chunk load event
causes the entities to be registered to the chunk, and then
added to the world twice.

Moves Entity Add to World to be done anytime a chunk is
registered to the Chunk Map, and ignore other calls.

Fixes #1288
2018-07-29 17:05:24 -04:00
Aikar
82500a59f0 Merge branch 'master' into pre/1.13
* master:
  Always process chunk registration after moving
  Always move Entity to its new Chunk even if unloaded
  If Entity is added to chunk, look up the chunk if current isnt set
  Ignore Dead Entities in entityList iteration
  Always process chunk removal in removeEntity
2018-07-29 13:12:39 -04:00
Aikar
c33b679642 update upstream 2018-07-29 12:42:07 -04:00
Hugo Manrique
3cce0c9f1b Optimize hasItemMeta (remove getItemMeta call) (#1279)
Spigot 1.13 checks if any field (which are manually copied from the ItemStack's "tag" NBT tag) on the ItemMeta class of an ItemStack is set.

We could just check if the "tag" NBT tag is empty, albeit that would break some plugins. The only general tag added on 1.13 is "Damage", and we can just check if the "tag" NBT tag contains any other tag that's not "Damage" (https://minecraft.gamepedia.com/Player.dat_format#Item_structure) making the `hasItemStack` method behave as before.

Check the `ItemMetaTest#testTaggedButNotMeta` method to see how this method behaves. (I also added some extra tests).

`hasItemMeta()` will return true if `ItemStack.getDamage() != 0` or it has the `Damage` tag or any other tag is set.

Closes #1222
2018-07-29 18:30:01 +02: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
BillyGalbreath
07cf46c4e3 Rebuild Patches 2018-07-28 22:15:52 -05:00
BillyGalbreath
3eb423d212 Merge branch 'pre/1.13' of https://github.com/PaperMC/Paper into AnvilDamageEvent 2018-07-28 22:02:56 -05: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
BillyGalbreath
28d01d85cc 1.13: EnderDragon Events (#1247)
Replaces PR #1185 for 1.13

Add some new cancellable enderdragon events dealing with its fireball shooting and the areaeffectcloud it spawns. Based on [talking with someone with a specific use-case](https://www.spigotmc.org/threads/cancel-projectilehitevent.326466/) this was [confirmed to work](http://i.imgur.com/ezlfpKC.png) for them in PM.
2018-07-28 01:03:10 -05:00
Aikar
1ac925f0e0 Merge branch 'master' into pre/1.13
* master:
  Fix Dupe UUID logic triggering when the duplicate is pending unload
2018-07-28 01:59:20 -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
Shane Freeder
5abfd8100e Update CB/S 2018-07-28 03:38:13 +01:00
Aikar
817b9934c7 Merge branch 'master' into pre/1.13
* master:
  Relookup Entity Save ID if was null during precache
2018-07-27 00:44:53 -04:00
Aikar
3c8a4cb1bb Relookup Entity Save ID if was null during precache
Should fix #1280

Citizens hijacks entity map, and im guessing under the right conditions
the result might actually be null during entity creation

Pre the cache patch, the id is looked up on save, so it was fine.

Now, if its null and the save ID is requested, we will try to look
it up again and cache it if found.
2018-07-26 23:57:31 -04:00
Shane Freeder
9629d65220 Fix EntityDismountEvent changes
While upstream has now made this event cancellable, their changes
result in the vechicle being removed before the event is called,
thus leading cancellation to not behave as expected.
2018-07-26 18:41:00 +01:00
Shane Freeder
ff4fc52552 Update B/CB/S 2018-07-26 16:20:37 +01:00
Aikar
42e1254bbe Merge branch 'master' into pre/1.13
* master:
  Prevent Saving Bad entities to chunks
2018-07-26 00:57:16 -04:00
Aikar
119ae29b37 Prevent Saving Bad entities to chunks
See https://github.com/PaperMC/Paper/issues/1223

Should fix Vanilla bugs

Minecraft is saving invalid entities to the chunk files.

Avoid saving bad data, and also make improvements to handle
loading these chunks. Any invalid entity will be instant killed,
so lets avoid adding it to the world...

This lets us be safer about the dupe UUID resolver too, as now
we can ignore instant killed entities and avoid risk of duplicating
an invalid entity.

This should reduce log occurrences of dupe uuid messages.

Also reduce the logging spam overall.
2018-07-26 00:51:20 -04:00
Zach Brown
0b2b5ecc33 Remove deprecated AuthLib API from Paper-API
Use the PlayerProfile API as a replacement
2018-07-25 21:49:43 -05:00
Aikar
7a058415e5 Merge pull request #1256
adbb709f Fix decompile error (Hugo Manrique)
f2fe0329 Re-add Vanished players don't have rights patch (Hugo Manrique)

* pull/1256/head:
  Fix decompile error
  Re-add Vanished players don't have rights patch
2018-07-25 19:41:35 -04:00
Aikar
5d33e18bf8 Merge branch 'master' into pre/1.13
* master:
  Apply spawner delay for cancelled pre spawn events (#1276)
2018-07-25 19:07:56 -04:00
Aikar
8536a71daa Update upstream 2018-07-25 19:05:07 -04:00
Max Lee
dccf0f6a08 Apply spawner delay for cancelled pre spawn events (#1276)
Setting the flag updates the spawner's delay which stops the spawner from trying to find a new spawn position each tick efter the event was cancelled/aborted which makes it usable for mob stackers/mergers and other plugins that don't actually want any mob to spawn in the spawner cycle but keep the overall behaviour close to vanilla.

This might slightly effect existing plugins that use this event but I doubt anyone really relied on this behaviour, the only possible use case that I can think of is cancelling the event until you find a suitable position in your plugin... and this should be handled by the plugin itself by cancelling and spawning at the position manually.
2018-07-25 23:19:51 +01:00
Shane Freeder
10ed7dc6b4 Explictly reset chat format in vanilla scoreboard display (fixes #1263)
Vanilla now uses chat components for scoreboards, thus no longer
returns a string which also resets the chat the chat format, add
this back ourselves.
2018-07-25 09:58:03 +01:00
Aikar
34a60bdae9 Fix RCON Ip Defaulting to wrong value - Closes #1267 2018-07-25 01:24:28 -04:00
Aikar
5992b9f2ad Update upstream and remove hopper patch for #1270 2018-07-25 01:11:08 -04:00
Brokkonaut
875c84df6f Fix broken block iteration (#1269)
Fixes https://github.com/PaperMC/Paper/issues/1259 and generation of the end pillars
2018-07-25 03:39:30 +02:00
Aikar
af10851ed2 restore uuid to Entity.toString 2018-07-24 00:48:07 -04:00
Aikar
a78fe918bf Optimize Region File Cache
CraftBukkit added synchronization to read and write methods. This adds
much more contention on this object for accessing region files, as
the entire read and write of NBT data is now a blocking operation.

This causes issues when something then simply needs to check if a chunk exists
on the main thread, causing a block...

However, this synchronization was unnecessary, because there is already
enough synchronization done to keep things safe

1) Obtaining a Region File: Those methods are still static synchronized.
   Meaning we can safely obtain a Region File concurrently.

2) RegionFile data access: Methods reading and manipulating data from
   a region file are also marked synchronized, ensuring that no 2 processes
   are reading or writing data at the same time.

3) Checking a region file for chunkExists: getOffset is also synchronized
   ensuring that even if a chunk is currently being written, it will be safe.

By removing these synchronizations, we reduce the locking to only
when data is being write or read.

GZIP compression and NBT Buffer creation will no longer be part of the
synchronized context, reducing lock times.

Ultimately: This brings us back to Vanilla, which has had no indication of region file loss.

Closes #1260
2018-07-23 23:50:09 -04:00
Aikar
533770f772 Merge branch 'master' into pre/1.13
* master:
  Add some debug for entity slices
  Mark chunk dirty on entity changes
  Reduce and improve dupe uuid resolve message
  Add more entity debug info
  Bring some 1.13 authors to master
  Fixed more stuff
  Remove unsed method
  Extend player profile API to support skin changes
  Extend player profile API to support skin changes
2018-07-23 23:20:41 -04:00
Aikar
6ee16a913b Update upstream 2018-07-23 23:00:57 -04:00
Aikar
782c68dad7 Add some debug for entity slices
If we find any entity in an unexpected state, log it so we can discover
what potentially put it in that state to relate to issue #1223
2018-07-23 22:55:27 -04:00
Aikar
f41ff893dd Mark chunk dirty on entity changes
This is to hopefully help avoid any chunk saving entity issues.
Marks the chunk that it NEEDS to be saved, ensuring the latest state gets saved.
2018-07-23 22:54:52 -04:00
Aikar
3b12d748b4 Reduce and improve dupe uuid resolve message 2018-07-23 22:50:56 -04:00
Aikar
64077154ff Add more entity debug info 2018-07-23 22:50:47 -04:00
Aikar
1eee376989 Merge pull request #1250
Cleaned up some implementation notes to use existing Vanilla method for some things.
merged into parent patch

9526c764 Fixed more stuff (NickAcPT)
8672424c Remove unsed method (NickAcPT)
a7f45fb1 Extend player profile API to support skin changes (NickAcPT)
4cccd48a Extend player profile API to support skin changes (NickAcPT)

* pull/1250/head:
  Fixed more stuff
  Remove unsed method
  Extend player profile API to support skin changes
  Extend player profile API to support skin changes
2018-07-23 20:31:33 -04:00
Aikar
af3bd62f9e Merge pull request #1248
1cff9820 PlayerElytraBoostEvent (BillyGalbreath)

* pull/1248/head:
  PlayerElytraBoostEvent

Also merged paper config into parent
2018-07-23 20:24:44 -04:00
Aikar
1ec5f04a0e Merge pull request #1254
d6bfa1a0 Re-add Option to prevent armor stands from doing entity lookups (Hugo Manrique)

* pull/1254/head:
  Re-add Option to prevent armor stands from doing entity lookups
2018-07-23 20:21:28 -04:00
Aikar
8e2ae7eb37 Merge pull request #1257
5e14f241 Put the decompile fixes into MC Dev Fixes patch (Andrew Steinborn)
9399a74c Optimize RegistryID.c() (Andrew Steinborn)

* pull/1257/head:
  Put the decompile fixes into MC Dev Fixes patch
  Optimize RegistryID.c()
2018-07-23 20:15:56 -04:00
Aikar
f3a76d261a Fix a concurrency issue with chunk scheduler
It's possible we won't hit this on the servers current state since nothing is async,
but we are working towards that.

I experienced a crash due to this code during my work.
2018-07-23 19:41:41 -04:00
Aikar
7349a434ad Fix memory leak in proto chunk change 2018-07-23 19:41:29 -04:00
Aikar
77c51f1785 Update upstream 2018-07-23 18:57:54 -04:00
Shane Freeder
ceedd8c4f1 Update S
Also drop a few patches which are no longer needed/already merged in.
2018-07-23 18:21:07 +01:00
Andrew Steinborn
5e14f2410c Put the decompile fixes into MC Dev Fixes patch 2018-07-23 13:10:06 -04:00
Andrew Steinborn
9399a74c2a Optimize RegistryID.c()
Fixes #1253
2018-07-23 12:58:01 -04:00
Hugo Manrique
adbb709ff5 Fix decompile error 2018-07-23 16:57:21 +02:00
Hugo Manrique
f2fe0329c1 Re-add Vanished players don't have rights patch 2018-07-23 14:31:18 +02:00
Hugo Manrique
d6bfa1a05c Re-add Option to prevent armor stands from doing entity lookups
Remove old patch
2018-07-23 13:08:02 +02:00
Shane Freeder
fea7cd7e3c Avoid ArithmeticException should server be stopped before worlds are loaded
Our changes for the spawn radius have the potential to throw an ArithmeticException
should the server be stopped before we've loaded worlds, we check if the server is
running earlier to check if we should even consider attempting to load chunks, which
would cause us to, 1) not load chunks anyways, as we're disabled; 2) throw an
ArithmeticException due to us expecting that we're going to be loading more than 0 chunks.
2018-07-23 10:24:51 +01:00
Shane Freeder
0c14fc6ee6 Update B/CB/S 2018-07-23 09:39:55 +01:00
Aikar
68c928477c Remove debug that got left in proto chunk change last build 2018-07-22 22:33:43 -04:00
Aikar
fa09f31f10 Don't save Proto Chunks
These chunks are unfinished, and waste cpu time saving these unfinished chunks.
the loadChunk method refuses to acknoledge they exists, and will restart
a new chunk generation process to begin with, so saving them serves no benefit.
2018-07-22 21:25:48 -04:00
Aikar
7c1ad2bc8d Fix spawn loading percentages 2018-07-22 19:53:01 -04:00
Aikar
84b819bcb8 Fix Chest open/close animations 2018-07-22 19:39:56 -04:00
Aikar
9108f443a8 Re-add Optimize Hoppers patch 2018-07-22 19:03:54 -04:00
Aikar
1fbc4f4d9b Re-add block inlining - Closes #1229
Also reordered MC Utils to be higher up
2018-07-22 18:46:13 -04:00
Aikar
d5a4135e98 Update upstream 2018-07-22 13:10:15 -04:00
Aikar
70c967fb6b Update Paper to 1.13 proper - THIS IS STILL HIGHLY UNSTABLE
DO NOT RUN ON PRODUCTION SERVERS!!! Use Backups!!
2018-07-22 01:27:46 -04:00
Aikar
6b5f080374 Add mc util methods 2018-07-22 00:45:49 -04:00
Aikar
1db0b7ed58 Readd configurable max chunk gens per tick 2018-07-21 17:24:18 -04:00
Aikar
d6293c533d Restore Configurable Allowance of Perm Chunk Loaders 2018-07-21 17:03:26 -04:00
Aikar
58a8ca3eae Restore World.loadChunkAsync API - but load chunks sync
We are still missing Async Chunk Loading, but plugins may be
depending on this API, so it missing blocks upgrading.
2018-07-21 16:55:43 -04:00
Aikar
1b778924c3 Rebuild patches for upstream merge 2018-07-21 16:43:00 -04:00
Aikar
7c13469d6c Merge branch 'master' into pre/1.13
* master:
  Duplicate UUID Resolve Option
  Add more information to Entity.toString
  change LAST_EDIT to PAPER_LAST_EDIT for edit commands
  Add more information to Entity.toString()
  Add Debug Entities option to debug dupe uuid issues
  Guard the Entity.SHARED_RANDOM from seed changes
  Create a symlink on not-windows to current minecraft decompile dir
2018-07-21 16:13:27 -04:00
Aikar
97d99711ff Update Upstream 2018-07-21 16:03:10 -04:00
Aikar
51f03d3579 Duplicate UUID Resolve Option
Due to a bug in bd75ff8b5b
which was added all the way back in March of 2016, it was unknown (potentially not at the time)
that an entity might actually change the seed of the random object.

At some point, EntitySquid did start setting the seed. Due to this shared random, this caused
every entity to use a Random object with a predictable seed.

This has caused entities to potentially generate with the same UUID....

Over the years, servers have had entities disappear, but no sign of trouble
because CraftBukkit removed the log lines indicating that something was wrong.

We have fixed the root issue causing duplicate UUID's, however we now have chunk
files full of entities that have the same UUID as another entity!

When these chunks load, the 2nd entity will not be added to the world correctly.

If that chunk loads in a different order in the future, then it will reverse and the
missing one is now the one added to the world and not the other. This results in very
inconsistent entity behavior.

This change allows you to recover any duplicate entity by generating a new UUID for it.
This also lets you delete them instead if you don't want to risk having new entities added to
the world that you previously did not see.

But for those who are ok with leaving this inconsistent behavior, you may use WARN or NOTHING options.

It is recommended you regenerate the entities, as these were legit entities, and deserve your love.
2018-07-21 14:47:05 -04:00
Aikar
1b8cee45a0 Add more information to Entity.toString 2018-07-21 14:46:56 -04:00
NickAcPT
9526c76438 Fixed more stuff 2018-07-21 18:17:54 +01:00
NickAcPT
8672424ca1 Remove unsed method 2018-07-21 16:54:52 +01:00
NickAcPT
a7f45fb1b4 Extend player profile API to support skin changes
Added code that refreshes the player's skin by sending packets with a special order, telling the client to respawn the player and re-apply the game profile
2018-07-21 16:22:10 +01:00
Aikar
f8af5faa43 Add more information to Entity.toString() 2018-07-21 10:29:37 -04:00
Aikar
19cec88852 Add Debug Entities option to debug dupe uuid issues
Add -Ddebug.entities=true to your JVM flags to enable more logging
2018-07-21 10:29:14 -04:00
Aikar
33cf273156 Guard the Entity.SHARED_RANDOM from seed changes
I don't clearly see any, but as a protection for future changes.
2018-07-21 09:03:10 -04:00
Brokkonaut
df8c42d4ad 1.13: Resend bed on cancelled interaction (#1245)
Minecraft 1.13 requires resending the block for both parts of the bed
2018-07-21 14:47:22 +02:00
NickAcPT
4cccd48a4c Extend player profile API to support skin changes
Added code that refreshes the player's skin by sending packets with a special order, telling the client to respawn the player and re-apply the game profile
2018-07-21 12:58:48 +01:00
BillyGalbreath
1cff982021 PlayerElytraBoostEvent 2018-07-21 02:00:31 -05:00
BillyGalbreath
9362271fc3 AnvilDamageEvent 2018-07-20 23:37:40 -05:00
Shane Freeder
7dd591d1a6 update B/CB/S 2018-07-20 20:57:43 +01:00
Zach Brown
f899206b89 Merge branch 'master' into pre/1.13 2018-07-20 14:15:12 -05:00
Minecrell
4e5ac2a052 Rebuild patch numbers 2018-07-20 14:06:39 -05:00
Minecrell
593e81812a Update to TerminalConsoleAppender 1.1.1 (#1240)
See https://github.com/Minecrell/TerminalConsoleAppender/releases/tag/1.1.1
2018-07-20 21:04:11 +02:00
Zach Brown
77f54129b4 Move decomp fix from last up to fixes patch 2018-07-19 16:55:27 -05:00
Zach Brown
c17484979e Fix crash in RegionLimitedWorldAccess 2018-07-19 16:51:32 -05:00
Shane Freeder
62511066e1 Merge branch 'master' into pre/1.13 2018-07-19 20:23:18 +01:00
Minecrell
391324437a Avoid adding NetworkManager twice
The removal of `ServerConnection.this.h.add(networkmanager);` got
lost in the 1.13 update, causing network managers to be registered
twice.

Fixes "handleDisconnection() called twice" warning spam in console.
2018-07-19 20:14:27 +02:00
Minecrell
9a1643dab4 Fix decompile/deobfuscation error in BlockPosition iterator
Some of the fields in the anonymous class are named the same as the
surrounding method's parameters, which caused the fields to be
initialized incorrectly.

That way it keeps returning the same block position, resulting
in an infinite loop during chunk generation.
2018-07-19 19:50:34 +02:00
Hugo Manrique
b90705d2ad Avoid item merge if stack size above max stack size (#1217) 2018-07-19 17:51:55 +02:00
Aikar
c3a05c5ba0 Update master patches just merged to 1.13 2018-07-19 01:51:01 -04:00
Aikar
be3fe3da6d Merge branch 'master' into pre/1.13
* master:
  Don't process despawn if entity is in a chunk scheduled for unload
  Fix Squids corrupting the entire servers entity randomness....
  Fix placement of chunk tracking - Fixes #1199
2018-07-19 01:46:11 -04:00
Aikar
bc063a06e8 Don't process despawn if entity is in a chunk scheduled for unload
This won't happen anyways if the user has
"skip ticking for entities in chunks scheduled for unload" turned on,
but if they don't, protect from this instant killing the entity to
keep it vanilla in behavior

a player may teleport away, and trigger instant despawn
2018-07-19 01:25:18 -04:00
Aikar
5353f8878e Fix Squids corrupting the entire servers entity randomness....
Really hope this solves #1223

Also re-add vanilla debug messages back and add uuid to toString
2018-07-19 01:13:53 -04:00
Shane Freeder
bd34c3623b NOT FINISHED! She compiles, and she... suffers the wrath of chunkgen... 2018-07-19 05:42:43 +01:00
Shane Freeder
aea45cba34 NF! 1.13 - more fixes 2018-07-19 00:31:45 +01:00
Shane Freeder
20e3b69061 NOT FINISHED! 1.13 pre-7
I need more creative commit messages.
2018-07-19 00:16:19 +01:00
Shane Freeder
37f7038e10 NOT FINISHED! 1.13 pre-7 - Holy moley, more patches!
Really, don't touch! may harm your cat!
2018-07-18 19:55:52 +01:00
Aikar
96f62ca759 fix a patch catboy asked me to 2018-07-18 01:08:17 -04:00
Aikar
9ce19f0321 NOT FINISHED: Current progress, updated upstream 2018-07-18 00:52:33 -04:00
Shane Freeder
68f8952459 NOT FINISHED! restore dropped patches, fix one more! 2018-07-18 01:37:30 +01:00
Shane Freeder
3cb169aa7c NOT FINISHED! 1.13-pre7 - even more patches!
Patches, patches everywhere!
2018-07-18 01:08:13 +01:00
Shane Freeder
c8d8659ad3 NOT WORKING! Even even more patches! 2018-07-17 21:32:05 +01:00
Shane Freeder
828dea48de NOT FINISHED! Fixed a few decomp issues 2018-07-17 16:14:23 +01:00
Minecrell
2db50592b9 Use asynchronous Log4j 2 loggers 2018-07-17 16:44:32 +02:00
Minecrell
9cfd6ff449 Update TerminalConsoleAppender to 1.1.0
Fixes a race condition when using TerminalConsoleAppender that may
result in IllegalStateExceptions or duplicate input prompts.
2018-07-17 14:48:52 +02:00
Shane Freeder
e7cf7c9168 NOT FINISHED! even more 1.13-pre patches! 2018-07-16 21:08:09 +01:00
Shane Freeder
93a7205ba8 NOT FINISHED!!! More progress on 1.13-pre7
This work is unfinished, keep your paws off this branch!
2018-07-16 16:34:55 +01:00
Aikar
bac47163e8 Delete some dupe patches (should be fixed going forward) 2018-07-16 00:32:35 -04:00
Mark Vainomaa
55d5aef00c Add TNTPrimeEvent 2018-07-16 00:06:26 +03:00
Aikar
9a22d2fdec Fix placement of chunk tracking - Fixes #1199
Spigot had code that returned early in chunk add/remove methods.

This was causing our code added to set current chunks and counts to
be skipped over if the entity was default not persistent but made persistent.

This was the source of many issues

Fixes #1208
2018-07-15 02:44:37 -04:00
Aikar
6d1a918378 NOT FINISHED!!! Current Progress on 1.13-pre7 update
This work is 100% unfinished. I am pushing it up so that we as a team
can work on this update.

Do not try to use this branch. You will fail.
2018-07-14 21:53:17 -04:00
Aikar
fe9d5b5570 Fix issue with entity activation range check - #1199 2018-07-14 00:12:42 -04:00
Minecrell
695beffc27 Refresh player inventory when cancelling PlayerInteractEntityEvent (#1205)
When interacting with entities with an item, the client will assume
the interaction is successful, and update the held item on the
client. However, if the interaction is cancelled on the server side,
the client will still mistakenly remove/replace the item in hand.

Examples for this are milking cows with a bucket or dyeing sheep.
The bucket is replaced with milk and the dye removed from inventory.

Refresh the player inventory when PlayerInteractEntityEvent is
cancelled to avoid this problem.
2018-07-13 22:52:34 +02:00
Minecrell
021305dc62 Avoid visual issues for adjacent blocks when cancelling PIE (#1198)
The adjacent blocks of doors, double plants, pistons and beds need
to be updated manually from the server when cancelling a block break
from a player, as it otherwise causes the other parts to disappear
on the client.

This is already done for doors but only for the BlockBreakEvent,
not for PlayerInteractEvent. Move the code to a common method
and also handle the other blocks in similar ways.
2018-07-13 09:48:51 +02:00
Minecrell
d4ccc60986 Avoid Netty buffer leak in LegacyPingHandler. Fixes #1200 (#1201)
The extra buffer used to decode the strings sent by the client
in the legacy ping protocol was never released. However, creating
an extra copy of the buffer just to decode it to a string isn't
actually necessary: We can just call toString() directly on the
original buffer.

Additionally, free the buffer in handlerRemoved() to handle cases
where the client never sends enough bytes to form a valid legacy
ping request.
2018-07-13 09:43:56 +02:00
Zach Brown
c89e4105d2 Update upstream B/CB 2018-07-13 02:39:44 -05:00
Aikar
eb1140acce Multitude of changes to attempt to fix #1199 2018-07-12 16:42:56 -04:00
Shane Freeder
7754b35d8f Don't send digged block updates for unloaded chunks 2018-07-12 15:19:33 +01:00
Aikar
8981806621 don't use a stream for entity counts (performance) 2018-07-10 01:06:09 -04:00
Shane Freeder
5ef91b3293 hopefully fix entity issues - #1199
@Aikar
2018-07-09 19:48:49 +01:00
Aikar
1ba951ee5d Only use stored chunk ref if it matches current chunk registration
Closes #1197

While this really undoes a lot of the desired performance gains avoiding chunk lookups,
we sadly have to accept this because we are seeing lots of bugs with entities.
2018-07-08 22:39:46 -04:00
Aikar
20aba250df Improve bed search pattern to go inwards out for bed search radius 2018-07-08 03:30:40 -04:00
Aikar
93dc25ecec Fix weird bugs with entities - Fixes #1195 2018-07-05 18:39:43 -04:00
Aikar
8ddd9ddefc Missed a case where to remove a chunk lookup on TE removal (performance, not bug fix) 2018-07-04 17:29:10 -04:00
Aikar
233a81a4ba [CI-SKIP] Remove paper tags - Fixes #1192 2018-07-04 17:26:54 -04:00
Aikar
25f583aaa4 Fix Tile Entities - #1192 Fixed 2018-07-04 17:22:38 -04:00
Aikar
cc84e0fab8 Vex#getOwner API
Get's the NPC that summoned this Vex
2018-07-04 15:32:30 -04:00
Aikar
3ed90751c5 Configurable Bed Search Radius
Allows you to increase how far to check for a safe place to respawn
a player near their bed, allowing a better chance to respawn the
player at their bed should it of became obstructed.

Defaults to vanilla 1.
2018-07-04 15:23:15 -04:00
Aikar
2cde0e40c3 support plugins calling OBC directly for inventory close event 2018-07-04 12:33:38 -04:00
Aikar
2df786eb1f Avoid Chunk Lookups for Entity/TileEntity Current Chunk
In many places where we simply want the current chunk the entity
is in, instead of doing a hashmap lookup for it, we now have access
to the object directly on the Entity/TileEntity object we can directly grab.

Use that local value instead to reduce lookups in many hot places.
2018-07-04 03:56:57 -04:00
Aikar
8778a2ef97 Current Chunk for Entity and Block Entities, counts by entity type
This enables us a fast reference to the entities current chunk instead
of having to look it up by hashmap lookups.

We also store counts by type to further enable other performance optimizations in later patches.
2018-07-04 03:55:24 -04:00
Aikar
58a2e2dc04 InventoryCloseEvent Reason API
Allows you to determine why an inventory was closed, enabling plugin developers
to "confirm" things based on if it was player triggered close or not.
2018-07-03 21:57:33 -04:00
Brokkonaut
651753d370 Add World.getEntity(UUID) API
This is the best way to get an entity when the world and its UUID are known.
It is faster than Server.getEntity(UUID) because it does not have to iterate all worlds
2018-07-03 16:16:01 +02:00
BillyGalbreath
dcfc5893e7 Add config to disable ender dragon legacy check (#1167) 2018-06-22 10:49:10 -05:00
Brokkonaut
d47caaad6a Improve ProjectileHitEvent to include the BlockFace where the projectile has hit (#1182) 2018-06-30 05:50:17 +02:00
Shane Freeder
702bbe6f8a Cleanup allocated favicon ByteBuf (fixes #1191)
Cleanups a bytebuffer which was allocated during the encoding of the
favicon to be sent to the client.
2018-07-03 19:19:47 +01:00
Shane Freeder
9d16e77b90 Extend Player Interact cancellation to handle FlowerPots 2018-07-03 04:33:21 +01:00
Aikar
14ccb8ebeb Add Critical missing Bukkit API - setTarget/getTarget moved down to SentientNPC
This fixes a CRITICAL missing part of the Bukkit API due to mistakes on upstream
refusing to implement the Sentient NPC baseclass of all NPC's.

Until now, the Bukkit API has not provided a way for accessing and setting
a non creature entities target.

Although Flying, Slime, Ambient, and Water mobs all supported targets internally,
you were unable to get/set it.

Now with the SentientNPC API and these API's moved down, every sentient NPC has
access to target data.
2018-07-01 22:07:35 -04:00
Aikar
0a953a924a Fix issues with getBlockState(false) not loading Tile Entity data
This only impacted people who used our useSnapshots new API in a plugin,
which obviously was no one as the data result was completely broken.

Merged the NPE check patch into mine since it has to handle it too.
2018-06-30 01:40:52 -04:00
Aikar
d9c9b9a3d2 LivingEntity Hand Raised/Item Use API
How long an entity has raised hands to charge an attack or use an item

Also aliased isHandsRaised for isChargingAttack in RangedEntity
2018-06-29 00:55:29 -04:00
Aikar
278780623d RangedEntity API
Allows you to determine if an entity is capable of ranged attacks,
and to perform an attack.
2018-06-26 22:08:01 -04:00
Minecrell
2485e50970 Disable JLine event expansion. Fixes #1171 2018-06-25 17:40:35 +02:00
Aikar
6b198b5cfe Fix another case where villages load chunks 2018-06-21 22:58:09 -04:00
Aikar
34c2733939 Update Upstream 2018-06-20 23:29:33 -04:00
Aikar
899149d68d Expand Explosions API
Add Entity as a Source capability, and add more API choices, and on Location.
2018-06-20 23:19:46 -04:00
Brokkonaut
fbe69b61a9 Add EntityKnockbackByEntityEvent (#1162)
This event is called when an entity receives knockback by another entity. The knockback can be modified in the event. If the event is cancelled the entity is not knocked back.
2018-06-21 03:59:11 +02:00
Aikar
5bf1029d82 Fire EntityShootBowEvent for Illusioner 2018-06-18 22:19:59 -04:00
Zach Brown
8e0411a1d3 Tie PlayerList#moveToWorld safety to existing config
Also renames patch file to better express what it's doing.

It is presumed that those using this config option intend for
suffocation checks to be disabled in all instances. In doing so, they
inherently assume the advantages and issues associated with removing
said safety check.

If the community expresses a desire for more specific options regarding
the handling of this safety feature, we can investigate providing them.

Fixes GH-1149
2018-06-18 16:27:33 -05:00
Aikar
be0d8a5f74 PlayerReadyArrowEvent
Called when a player is firing a bow and the server is choosing an arrow to use.
Plugins can skip selection of certain arrows and control which is used.
2018-06-18 01:13:16 -04:00
Aikar
9fc9d3f486 EntityShootBowEvent consumeArrow and getArrowItem API
Adds ability to get what arrow was shot, and control if it should be consumed.
2018-06-18 00:39:04 -04:00
Aikar
23994d33e3 accidently set the wrong collection on last commit
copy pasting...
2018-06-16 16:32:17 -04:00
Aikar
43a2693ca0 Ignore Missing Recipes in RecipeBook to avoid data errors
This code was causing NPE's in saving player data, potentially related to reloads.
2018-06-16 16:30:29 -04:00
BillyGalbreath
4a55e34625 Make shield blocking delay configurable (#1154)
Resolves #1153
2018-06-16 14:54:35 -05:00
Aikar
72ec993b61 Print Error details when failing to save player data 2018-06-15 20:40:39 -04:00
Aikar
133396a0c9 Configurable Alternative LootPool Luck Formula
Rewrites the Vanilla luck application formula so that luck can be
applied to items that do not have any quality defined.

See: https://luckformula.emc.gs for data and details
-----------

The rough summary is:
My goal was that in a pool, when luck was applied, the pool
rebalances so the percentages for bigger items is
lowered and smaller items is boosted.

Do this by boosting and then reducing the weight value,
so that larger numbers are penalized more than smaller numbers.
resulting in a larger reduction of entries for more common
items than the reduction on small weights,
giving smaller weights more of a chance

-----------

This work kind of obsoletes quality, but quality would be useful
for 2 items with same weight that you want luck to impact
in varying directions.

Fishing still falls into that as the weights are closer, so luck
will invalidate junk more.

This change will result in some major changes to fishing formulas.

-----------

I would love to see this change in Vanilla, so Mojang please pull :)
2018-06-15 00:32:35 -04:00
Aikar
5c7524a769 If we remove a corrupt TE, ensure we save the chunk 2018-06-15 00:11:39 -04:00
Black Hole
c0a2597976 Actually call EntityTeleportEndGatewayEvent (#1147) 2018-06-13 23:29:49 +02:00
Brokkonaut
b77a601ae0 Avoid int overflow in lootable refill time calculations (#1146)
Fixes https://github.com/PaperMC/Paper/issues/1141
2018-06-13 20:15:31 +02:00
Shane Freeder
4d3ec19658 [CI-SKIP] Fix comment on unlit chunk sending patch 2018-06-12 15:46:08 +01:00
Aikar
158f100521 Fix CraftEntity hashCode
hashCodes are not allowed to change, however bukkit used a value
that does change, the entityId.

When an entity is teleported dimensions, the entity reference is
replaced with a new one with a new entity ID.

For hashCode, we can simply use the UUID's hashCode to keep
the hashCode from changing.

equals() is ok to use getEntityId() because equals() should only
be true if both the left and right are the same reference.

Since entity ids can not duplicate during runtime, this
check is essentially the same as this.getHandle() == other.getHandle()

However, replaced it too to make it clearer of intent.
2018-06-10 20:29:15 -04:00
Aikar
1e8a800b9a Properly remove entities on dimension teleport
To teleport an entity between dimensions, the server makes a copy
and puts the copy in the new location, and marks the old one dead.

If this method got called for the same world in the same tick,
the entity would not have been removed from the UUID map, and the
world readd would fail.

This can be triggered even with a plugin if the entity is teleported
twice in the same tick, from world A to B, then back from B to A.

The re-add to A will fail to add the entity to the world. It will
actually be there, but it will not be visible on the client until
the server is restarted to re-try the add to world process again.

This bug was unlikely to be seen by many due to the double teleport
requirement, but plugins (such as my own) use this method to
trigger a "reload" of the entity on the client.
2018-06-10 20:09:56 -04:00
Shane Freeder
d8e8748f70 Fix missed change inside of CraftSkullMeta 2018-06-10 12:45:04 +01:00
Aikar
d9dc31cb93 Unset Ignited flag on cancel of Explosion Event
Otherwise the creeper infinite explodes
2018-06-10 01:29:20 -04:00
Shane Freeder
056199bd92 Add EntityTeleportEndGatewayEvent for entities (closes #1124) 2018-06-09 14:21:40 +01:00
Shane Freeder
463d2a2bc0 Allow plugins to replace texture if already set on skulls 2018-06-09 12:09:21 +01:00
Aikar
4e86ff1c24 ItemStack#getMaxItemUseDuration
Allows you to determine how long it takes to use a usable/consumable item
2018-06-05 23:01:16 -04:00
Aikar
0cd3d13ae9 WitchReadyPotionEvent
Control what potion the witch readies to use
2018-06-05 22:48:27 -04:00
Aikar
83cf44e60c Don't load chunks for villager door checks
This avoids villages spam loading chunks sync
2018-06-05 00:33:24 -04:00
Aikar
523d47c095 Allow spawning Item entities with World.spawnEntity
This API has more capabilities than .dropItem with the Consumer function

Item can be set inside of the Consumer pre spawn function.
2018-06-04 20:48:14 -04:00
Kyle Wood
f8c2d3bd11 Report issues to the issue tracker 2018-06-04 01:54:22 -05:00
Aikar
b75c7d96df Closes #1138 2018-06-04 01:53:37 -04:00
Aikar
cb9b5bfa82 add Escape Reason Drown for EndermanEscapeEvent
to detect rain specifically from every other armor ignoring hit
2018-05-31 18:16:26 -04:00
Zach Brown
9c32d79355 Fix config key on last commit 2018-05-30 15:38:27 -05:00
Mark Vainomaa
df3df43dea Skip Entity and Tile Entity ticking in chunks scheduled for unload (#1132)
Fixes #1131
2018-05-30 23:31:55 +03:00
Aikar
efe156b1f7 Fix Witch Throw Potion error - Resolves #1129 2018-05-23 23:08:04 -04:00
Aikar
e8a70d7bd1 Fix Reason = Player for Experience Orb drop 2018-05-18 19:40:33 -04:00
Aikar
375b54fcd1 WitchThrowPotionEvent
Fired when a witch throws a potion at a player
2018-05-16 20:49:47 -04:00
Aikar
9b4be61ac6 WitchConsumePotionEvent
Fires when a witch consumes the potion in their hand
2018-05-16 20:35:33 -04:00
Aikar
4cbc53e9e8 Improve Profile API to directly extend Yggdrasil, Resolves #1117
This improves plugins like Citizens that rely on direct instance of Yggdrasil implementations.

Instead of wrapping, directly extend and override the methods.

Went ahead and wrapped all of the services in prep in the base patch, then features modify what they need
2018-05-10 23:01:52 -04:00
Zach Brown
9fa30854a7 Merge pull request #1105 from stonar96/hotfix/anti-xray-cme
Fix Anti-Xray ConcurrentModificationException
2018-05-03 17:37:57 -04:00
Aikar
ca4b34856d fix inverted logic on enderman attack 2018-05-01 20:37:52 -04:00
Aikar
6f281bc19f EndermanAttackPlayerEvent
Allow control over whether or not an enderman aggros a player.

This allows you to override/extend the pumpkin/stare logic.
2018-05-01 20:19:47 -04:00
Aikar
c476e3abd1 Fix EndermanEscapeEvent RUNAWAY being cancelled should also keep target
This will allow you to keep the enderman attacking the player instead
of running away.
2018-05-01 17:03:12 -04:00
Aikar
c84c87f8b2 Expand World.spawnParticle API and add Builder
Adds ability to control who receives it and who is the source/sender (vanish API)
the standard API is to send the packet to everyone in the world, which is ineffecient.

This adds a new Builder API which is much friendlier to use.
2018-04-30 20:32:15 -04:00
Aikar
a65cdccb5f Block Enderpearl Travel Exploit
Players are able to use alt accounts and enderpearls to travel
long distances utilizing the pearls in unloaded chunks and loading
the chunk later when convenient.

This disables that by not saving the thrower when the chunk is unloaded.

This is mainly useful for survival servers that do not allow freeform teleporting.
2018-04-30 17:21:59 -04:00
Aikar
c25c800a3c Enderman.teleportRandomly()
Ability to trigger the vanilla "teleport randomly" mechanic of an enderman.
2018-04-30 13:30:00 -04:00
Aikar
2c7a08b1df EndermanEscapeEvent
Fires an event anytime an enderman intends to teleport away from the player

You may cancel this, enabling ranged attacks to damage the enderman for example.

Resolves #1101
2018-04-30 13:16:42 -04:00
stonar96
165dddda84 Fix Anti-Xray ConcurrentModificationException 2018-04-30 15:21:07 +02:00
0x22
a6d057b113 Fix exploit that allowed colored signs to be created (#1098) 2018-04-26 04:51:54 -04:00
Aikar
582999642c Add Ban Methods to Player Objects
Allows a more logical API for banning players.

player.banPlayer("Breaking the rules");
2018-04-28 11:31:26 -04:00
Zach Brown
4e4f7912da Remove patches that got added back in merge
Fix build
2018-04-22 15:29:03 -04:00
stonar96
e2b2332062 Make Anti-Xray Update Radius configurable (#1094) 2018-04-22 16:45:56 +02:00
Aikar
5556eda6ba Configurable Allowance of Permanent Chunk Loaders
This disables the behavior that allows players to keep chunks permanently loaded
by default and allows server operators to enable it if they wish.
2018-04-22 10:40:49 -04:00
Aikar
46d4568f31 Update upstream 2018-04-22 10:40:36 -04:00
Brokkonaut
bfd81cc275 Configurable sprint interruption on attack (#1085)
If the sprint interruption is disabled players continue sprinting when they attack entities.
2018-04-18 15:46:48 +02:00
Shane Freeder
45f29dbd99 re-revert Better reloading of pending unload chunks 2018-04-18 13:03:59 +01:00
Aikar
ffe824b61b Revert SPIGOT-3894 to restore vanilla behavior
reporter of this issue was incorrect and did not verify vanilla logic

vanilla logic only skips ticks if the flag is set

spigots change causes bugs as it now skips ticking and processing
chunk teleportation, which was a bug I fixed many many years ago...
2018-04-18 01:44:24 -04:00
Zach Brown
c072993a5c Update upstream CB/S 2018-04-17 22:25:50 -04:00
Zach Brown
973fefe4e5 Be more specific with prior fix 2018-04-17 22:06:24 -04:00
Zach Brown
53c4a446eb Handle bad chunks more gracefully
Prior to this change the server would crash when attempting to load a
chunk from a region with bad data.

After this change the server will defer back to vanilla behavior. At
this time, that means attempting to generate a chunk in its place
(and occasionally just not generating anything and leaving small
holes in the world).

Should Mojang choose to alter this behavior in the future, this change
will simply defer to whatever that new behavior is.
2018-04-17 22:00:51 -04:00
Kyle Wood
f1924ad247 Track previous version and report in command
It is often difficult to diagnose new issues server admins get when
upgrading to a new server version because the only information they are
able to tell us regarding the server version they are running is
"latest". This commit attempts to mitigate this by keeping track of the
previous version of Paper they were running, which is then reported by
the `/version` or `/paper version` command. This gives us a better idea
of the commits included in the upgrade, which may help diagnose new
issues easier.
2018-03-01 19:57:22 -06:00
Aikar
0c446a7dd3 Fix profile requests being made on offline mode servers
Closes #1076
2018-04-08 12:28:04 -04:00
Shane Freeder
0ed67b50a3 remove warning for custom entities in precreaturespawn (closes #1069)
There can be no survivors.
2018-04-08 01:44:14 +01:00
Shane Freeder
492ed12781 revert "Better reloading of pending unload chunks"
This change by spigot ensures that many interactins with chunks,
e.g. getting a list of TEs will cause the chunk to be marked for not
unloading and will block their unload. This is especially true for
servers using Timings (it needs to access the TE list of chunks), or
any plugins which need to access entity/TE lists periodically.
2018-04-08 01:26:37 +01:00
Mark Vainomaa
50f348988d Add method to open already placed sign 2018-04-01 02:30:41 +03:00
Zach Brown
a080350652 Update upstream CB 2018-04-04 20:33:43 -04:00
Zach Brown
2caf69d5ab Silly rabbits, eggs are for chickens 2018-04-02 16:30:24 -04:00
Zach Brown
3229f3b8b8 > not even using java8 time API
Gotta get this rocketship up to speed I guess...
2018-03-31 23:30:19 -04:00
Zach Brown
3b99722641 Easter and April Fools fall on the same day
¯\_(ツ)_/¯
2018-03-31 22:50:11 -04:00
Zach Brown
9bafd0634e Stop explicitly blocking Vanilla Method Profiler
At the time this was re-added, there was concern around how the JIT
would handle the system property that enabled it.

This shouldn't be a problem, and as such we no longer need to block
access to it.

The Vanilla Method Profiler will not provide much to most users however
there is no harm in providing it as an option. For most users, the
recommended and supported method for determining performance issues with
Paper will continue to be Timings.
2018-03-31 14:51:21 -04:00
Shane Freeder
4502a946d7 Flag to disable the channel limit
In some enviroments, the channel limit set by spigot can cause issues,
e.g. servers which allow and support the usage of mod packs.

provide an optional flag to disable this check, at your own risk.
2018-03-31 17:07:09 +01:00
Shane Freeder
75a9b9e07d Delay initial ping sent to the client 2018-03-31 15:27:41 +01:00
Shane Freeder
1872a94c83 Update CB/S 2018-03-31 10:34:25 +01:00
Minecrell
99efa104db Call PaperServerListPingEvent for legacy pings (#1057)
* Make the legacy ping handler more reliable

The Minecraft server often fails to respond to old ("legacy") pings
from old Minecraft versions using the protocol used before the switch
to Netty in Minecraft 1.7.

Due to packet fragmentation[1], we might not have all needed bytes
available when the LegacyPingHandler is called. In this case, it will
run into an error, remove the handler and continue using the modern
protocol.

This is unlikely to happen for the first two revisions of the legacy
ping protocol (used in Minecraft 1.5.x and older) since the request
consists of only one or two bytes, but happens frequently for the
last/third revision introduced in Minecraft 1.6.

It has much larger, variable packet sizes due to the inclusion of
the virtual host (the hostname/port used to connect to the server).

The solution[2] is simple: If we find more than two matching bytes,
we buffer the remaining bytes until we have enough to fully read and
respond to the request.

[1]: https://netty.io/wiki/user-guide-for-4.x.html#wiki-h3-11
[2]: https://netty.io/wiki/user-guide-for-4.x.html#wiki-h4-13

* Add legacy ping support to PaperServerListPingEvent

Add a new method to StatusClient check if the client is a legacy
client that does not support all of the features provided in the
event.
2018-03-30 19:00:01 +02:00
Minecrell
c37016f476 Avoid negative server ping player sample counts. Fixes #1067 (#1068) 2018-03-30 18:53:15 +02:00
Mark Vainomaa
bfa2eab01f Make player data saving configurable (#1063) 2018-03-27 17:45:54 +03:00
Aikar
31c3ae2bb4 Add Setters for ID/Name and add completeByCache for Profile API 2018-03-25 21:50:46 -04:00
Aikar
36f69d38bc Update upstream 2018-03-25 20:06:44 -04:00
Aikar
90d862413b Don't try to complete profile on creation from cache, only on complete()
For one, the wrong API was used that would trigger a network call.
2018-03-25 20:05:30 -04:00
Aikar
3c6db79e46 Use copies for PlayerProfile in PaperServerList and SkullMeta
Don't want to risk mutating players properties in server list (unlikely, but lets be proper)

and Skull also has a setter API, so that should be used too.
2018-03-22 23:32:55 -04:00
Minecrell
5336a6b6bb Add extended PaperServerListPingEvent (#980)
* Drop original implementation for old player sample API

* Add extended PaperServerListPingEvent

Add a new event that extends the original ServerListPingEvent
and allows full control of the response sent to the client.

* Implement deprecated player sample API
2018-03-23 04:19:59 +01:00
Aikar
855f21c54e More improvements to PlayerProfile code
.equals() was wrong
clean up createPlayerProfile code
don't set profile to null if the complete call fails
2018-03-22 21:56:18 -04:00
Aikar
1b8ea6f3bb Fix Profile Textures and expand PlayerProfile .complete() API
I mistakenly thought .complete() also checked for textures, which was not the case

So the logic was not working as desired.

Also some undesired logic paths lead to textures of the logging in player being dropped, forcing
us to always load the textures immediately again on login, leading to rate limits.

Everythings now good

the .complete() api now will default specify to also complete textures, but you may
pass false to it to skip loading textures.
2018-03-22 21:40:57 -04:00
Aikar
e92baf5367 getPlayerUniqueId API
Gets the unique ID of the player currently known as the specified player name
In Offline Mode, will return an Offline UUID

This is a more performant way to obtain a UUID for a name than loading an OfflinePlayer
2018-03-22 01:41:44 -04:00
Aikar
3341a93c7f Check Profile Cache for PlayerProfile API
This ensures we look up the name for ID only Profiles

If the profile is in the UserCache, we can get those details quickly

This should avoid some unnecessary round trips.

Additionally, handle profiles for offline mode to use offline UUID's
2018-03-22 01:28:22 -04:00
Aikar
feaa8460b1 Fix Dragon Server Crashes
If the dragon tries to find "ground" and hits a hole, or off edge,
it will infinitely keep looking for non air and eventually crash.
2018-03-21 20:51:12 -04:00
Aikar
2f9a09cda5 Configurable Unrestricted Signs - Resolves #1054
Bukkit restricts command execution of signs to test if the sender
has permission to run the specified command. This breaks vanilla
maps that use signs to intentionally run as elevated permission.

Bukkit provides an unrestricted advancements setting, so this setting
compliments that one and allows for unrestricted signs.

We still filter sign update packets to strip out commands at edit phase,
however there is no sanity in ever expecting creative mode to not be
able to create signs with any command.

Creative servers should absolutely never enable this.
Non creative servers, enable at own risk!!!
2018-03-21 19:59:54 -04:00
Aikar
6b6373a077 Only complete incomplete profiles - Resolves #1053 2018-03-21 19:12:02 -04:00
MiniDigger | Martin
ace8e99e04 Call PortalCreateEvent for exit portals (#1047) 2018-03-20 19:56:44 +01:00
Brokkonaut
7f21066ba1 Add missing registerPlayer in CraftPlayer.showPlayer0 (#1051) 2018-03-20 17:27:00 +01:00
Aikar
71d64fa4f2 Remove the immediate dispatch optimization and adjust thread executors
hopefully will resolve #1049
2018-03-18 20:09:12 -04:00
Aikar
aa8ad3124a Player.setPlayerProfile API
This can be useful for changing name or skins after a player has logged in.
2018-03-18 12:32:09 -04:00
Aikar
87dc694af9 Ability to change PlayerProfile in AsyncPreLoginEvent
This will allow you to change the players name or skin on login.
2018-03-18 11:46:14 -04:00
Aikar
0094c1669c Add PlayerProfile.complete() API to trigger skin lookup 2018-03-18 11:31:32 -04:00
Aikar
0d220393d1 Fix more issues with async scheduler and cancelling pending task
was a race condition, so do need to use the head/parsePending logic still
2018-03-17 14:59:03 -04:00
Aikar
700c900cc3 Fix isCurrentlyRunning for sync tasks
Not sure where this would of ever been used, but for correctness sake.
2018-03-17 13:14:44 -04:00
Aikar
7241626ffd check that a task is valid before executing incase it was cancelled elsewhere
also set runners in the short circuit path so we know of the pending task incase its long running
2018-03-17 12:58:27 -04:00
Aikar
fb8222874d Improved Async Task Scheduler
The Craft Scheduler still uses the primary thread for task scheduling.
This results in the main thread still having to do work as part of the
dispatching of async tasks.

If plugins make use of lots of async tasks, such as particle emitters
that want to keep the logic off the main thread, the main thread still
receives quite a bit of load from processing all of these queued tasks.

Additionally, resizing and managing the pending entries for all of
these asynchronous tasks takes up time on the main thread too.

This commit replaces the implementation of the scheduler when working
with asynchronous tasks, by forwarding calls to the new scheduler.

The Async Scheduler uses a single thread executor for "management" tasks.
The Management Thread is responsible for all adding and dispatching of
scheduled tasks.

The mainThreadHeartbeat will send a heartbeat task to the management thread
with the currentTick value, so that it can find which tasks to execute.

Scheduling of an async tasks also dispatches a management task, ensuring
that any Queue resizing operation occurs off of the main thread.

The async queue uses a complete separate PriorityQueue, ensuring that resize
operations are decoupled from the sync tasks queue.

Additionally, an optimization was made that if a plugin schedules
a single, non repeating, no delay task, that we immediately dispatch it
to the executor pool instead of scheduling it. This avoids an unnecessary
round trip through the queue, as well as will reduce the size growth of the
queue if a plugin schedules lots of asynchronous tasks.
2018-03-16 23:09:51 -04:00
Aikar
2a34a59149 explicit, not implicit... oops 2018-03-11 14:21:03 -04:00
Aikar
9e35831323 Disable Implicit Network Manager Flushing
This seems completely pointless, as packet dispatch uses .writeAndFlush.

Things seem to work fine without implicit flushing, but incase issues arise,
provide a System property to re-enable it using improved logic of doing the
flushing on the netty event loop, so it won't do the flush on the main thread.

Renable flushing by passing -Dpaper.implicit-flush=true
2018-03-11 14:15:38 -04:00
Aikar
af506a11ee Prevent Frosted Ice from loading/holding chunks 2018-03-10 16:33:49 -05:00
Shane Freeder
d0ccbd3161 Return null instead of players location on EnderChests opened by plugins 2018-03-10 20:26:05 +00:00
Shane Freeder
d207b66009 Add OBFHELPER - InventoryEnderChest#getTileEntity 2018-03-10 17:11:51 +00:00
Shane Freeder
3af34bfe45 Fix NPE when getting location from players EnderChest (fixes #1041) 2018-03-10 13:07:40 +00:00
MiniDigger | Martin
12012ab589 Toggleable player crits, helps mitigate hacked clients. (#1040)
This is a port of https://github.com/PaperMC/Paper/blob/ver/1.8.8/Spigot-Server-Patches/0040-Toggleable-player-crits-helps-mitigate-hacked-client.patch
Also adds me to the MIT list.
2018-03-10 05:14:47 +01:00
Shane Freeder
db23ad30cb Fix ItemStack.damage OBFHelper (fixes #1036) 2018-03-08 19:41:00 +00:00
Shane Freeder
ab5b167d08 Update CB/S 2018-03-08 19:36:35 +00:00
Minecrell
1894a7a608 [CI-SKIP] Add Minecrell to MIT list (#1035)
Change email address for some older patches to make it clear that
they are MIT licensed too.
2018-03-08 16:08:21 +01:00
Aikar
b4c8581812 Fix ProfilePropertyIterator#remove() recursion bug 2018-03-07 21:03:01 -05:00