Commit graph

1111 commits

Author SHA1 Message Date
Spottedleaf
39156be36a Do not sync load chunk for dynamic game event listener registration
These can be called while an entity is being added to the world,
and if the entity is being added from a chunk load context the
sync load will block indefinitely (because the chunk load context
is for completing the chunk to FULL).

This does raise questions about the current system for these
dynamic registrations, as it looks like there is _zero_ logic
to account for the case where the chunk is _not_ currently loaded
and then later loaded.
2022-07-03 22:31:37 -07:00
Owen1212055
dd19a41799 Prevent empty items from being added to world
The previous solution caused a bunch of bandaid fixes inorder to resolve edge cases where minecraft/the api might spawn items that are air.
Just simply prevent them from being added to the world instead.
2022-06-15 21:52:57 -04:00
Jake Potrebic
5cf40e45af Don't broadcast messages to command blocks
Previously the broadcast method would update the last output
in command blocks, and if called asynchronously, would throw
an error
2022-06-16 14:22:56 -07:00
Owen1212055
1f68916ac9 Nameable Banner API 2022-04-07 17:49:25 -04:00
Jake Potrebic
f2dcecf4d9 Add option for strict advancement dimension checks
Craftbukkit attempts to translate worlds that use the
same generation as the Overworld, The Nether, or The End
to use those dimensions when checking the `changed_dimension`
criteria trigger, or whether to trigger the `NETHER_TRAVEL`
distance trigger. This adds a config option to ignore that
and use the exact dimension key of the worlds involved.
2022-06-12 11:47:24 -07:00
nopjar
97cab1d4a4 Add WardenAngerChangeEvent 2022-06-12 02:26:04 +02:00
Jake Potrebic
6a51d13dbf Throw exception on world create while being ticked
There are no plans to support creating worlds while worlds are
being ticked themselvess.
2022-03-22 12:44:30 -07:00
Owen1212055
4c16855bdd Prevent entity loading causing async lookups 2022-03-06 11:09:09 -05:00
Nassim Jahnke
1be6fca1f1 Disable component selector resolving in books by default 2022-06-02 20:35:58 +02:00
Owen1212055
37bf078394 Sanitize sent BlockEntity NBT 2021-12-03 16:55:50 -05:00
PanSzelescik
01cb81413b Add support for Proxy Protocol 2022-04-07 16:13:39 +02:00
Owen1212055
dedddea65d Expand FallingBlock API
- add auto expire setting
- add setter for block data
- add accessors for block state

== AT ==
public net.minecraft.world.entity.item.FallingBlockEntity blockState

Co-authored-by: Lukas Planz <lukas.planz@web.de>
2021-12-05 14:58:17 -05:00
Noah van der Aa
8c8e7968ab Don't tick markers
Fixes https://github.com/PaperMC/Paper/issues/7276 and https://github.com/PaperMC/Paper/issues/8118
by using a config option that, when set to false, does not add markers to the entity
tick list at all and ignores them in Spigot's activation range checks. The entity tick
list is only used in the tick and tickPassenger methods, so we can safely not add the
markers to it. When the config option is set to true, markers are ticked as normal.
2022-01-07 11:58:26 +01:00
u9g
2082797618 Add PlayerStopUsingItemEvent 2022-05-03 20:41:37 -04:00
Jake Potrebic
954f57e596 fix powder snow cauldrons not turning to water
Powder snow cauldrons should turn to water when
extinguishing an entity
2021-12-30 14:02:13 -08:00
Jake Potrebic
f40a8e5f0c Fire CauldronLevelChange on initial fill
Also don't fire level events or game events if stalactite
drip is cancelled
2022-03-29 13:46:23 -07:00
Jake Potrebic
2e86b22228 Add EntityDyeEvent and CollarColorable interface 2022-03-18 21:15:55 -07:00
Jake Potrebic
fc19bf4dc5 Trigger bee_nest_destroyed trigger in the correct place 2022-02-02 13:50:06 -08:00
HexedHero
bc02501cc2 Expand PlayerItemDamageEvent 2022-04-10 06:26:32 +01:00
Doc
90ee0e7de2 Use username instead of display name in PlayerList#getPlayerStats 2022-04-15 17:40:30 -04:00
etil2jz
f97f51d382 Fix NBT pieces overriding a block entity during worldgen deadlock
By checking if the world passed into StructureTemplate's placeInWorld
is not a WorldGenRegion, we can bypass the deadlock entirely.
See https://bugs.mojang.com/browse/MC-246262
2022-04-02 23:29:24 +02:00
Doc
3dc8a5ce57 Allow changing the EnderDragon podium 2022-04-03 11:31:42 -04:00
Jake Potrebic
96c7383ba4 Cache resource keys and optimize reference Holder tags set
TagKeys are always interned, so we can use a reference hash set for them
2022-03-20 22:06:47 -07:00
Spottedleaf
636e993d37 Ensure entity passenger world matches ridden entity
Bad plugins doing this would cause some obvious problems...
2022-03-31 05:11:37 -07:00
Jake Potrebic
7b3898ad66 fix player loottables running when mob loot gamerule is false 2022-03-22 09:50:40 -07:00
SoSeDiK
58f0db0820 Fix new block data for EntityChangeBlockEvent
Also standardizes how to handle EntityChangeBlockEvent before a removeBlock or destroyBlock
call. Always use 'state.getFluidState().createLegacyBlock()' to get the new state instead of
just using the 'air' state.

Also fixes the new block data for EntityBreakDoorEvent (a sub-event from
EntityChangeBlockEvent)

Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2022-03-21 20:00:53 +02:00
Owen1212055
8f23a7f6af Add TameableDeathMessageEvent 2021-06-21 21:24:45 -04:00
Shane Freeder
30ccd487cf Buffer OOB setBlock calls
lets debug mode throw a trace in order to potentially see where
such calls are cascading from easier, but, generally, if you see one setBlock
call, you're gonna see more, and this just potentially causes a flood of logs
which can cause issues for slower terminals, etc.

We can limit the flood by just allowing one for a single gen region,
we'll also only gen a trace for the first one, I see no real pressing need
to generate more, given that that would *massively* negate this patch otherwise
2022-03-19 12:12:22 +00:00
Spottedleaf
0d199767d2 Don't allow vehicle movement from players while teleporting
Bring the vehicle move packet behavior in line with the
regular player move packet.
2022-03-14 12:35:37 -07:00
Spottedleaf
2de1053b58 Fix swamp hut cat generation deadlock
The worldgen thread will attempt to get structure references
via the world's getChunkAt method, which is fine if the gen is
not cancelled - but if the chunk was unloaded, the call will block
indefinitely. Instead of using the world state, we use the already
supplied ServerLevelAccessor which will always have the chunk available.
2022-03-12 06:31:13 -08:00
Owen1212055
df181fa967 More Projectile API
== AT ==
public net.minecraft.world.entity.projectile.FishingHook timeUntilLured
public net.minecraft.world.entity.projectile.FishingHook fishAngle
public net.minecraft.world.entity.projectile.ShulkerBullet targetDeltaX
public net.minecraft.world.entity.projectile.ShulkerBullet targetDeltaY
public net.minecraft.world.entity.projectile.ShulkerBullet targetDeltaZ
public net.minecraft.world.entity.projectile.ShulkerBullet currentMoveDirection
public net.minecraft.world.entity.projectile.ShulkerBullet flightSteps
public net.minecraft.world.entity.projectile.AbstractArrow soundEvent
public net.minecraft.world.entity.projectile.AbstractArrow setPickupItemStack(Lnet/minecraft/world/item/ItemStack;)V
public net.minecraft.world.entity.projectile.ThrownTrident dealtDamage
public net.minecraft.world.entity.projectile.Arrow NO_EFFECT_COLOR
public net.minecraft.world.entity.projectile.Projectile hasBeenShot
public net.minecraft.world.entity.projectile.Projectile leftOwner
public net.minecraft.world.entity.projectile.Projectile ownerUUID
public net.minecraft.world.entity.projectile.Projectile preOnHit(Lnet/minecraft/world/phys/HitResult;)V
public net.minecraft.world.entity.projectile.Projectile canHitEntity(Lnet/minecraft/world/entity/Entity;)Z
public net.minecraft.world.entity.projectile.FireworkRocketEntity getDefaultItem()Lnet/minecraft/world/item/ItemStack;
public net.minecraft.world.item.CrossbowItem FIREWORK_POWER

Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
Co-authored-by: MelnCat <melncatuwu@gmail.com>
Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
2021-06-22 23:41:11 -04:00
Jake Potrebic
c6b07ad816 Fix cancelling ProjectileHitEvent for piercing arrows
Piercing arrows search for multiple entities inside a while
loop that is checking the projectile entity's removed state.
If the hit event is cancelled on the first entity, the event will
be called over and over again inside that while loop until the event
is not cancelled. The solution here, is to make use of an
already-existing field on AbstractArrow for tracking entities hit by
piercing arrows to avoid duplicate damage being applied.

== AT ==
protected net.minecraft.world.entity.projectile.Projectile hitCancelled
2022-02-19 19:05:59 -08:00
Nassim Jahnke
b85ac14d28 Force close world loading screen
Dead players would be stuck in the world loading screen and other players may
miss messages and similar sent in the join event if chunk loading is slow.
Paper already circumvents falling through the world before chunks are loaded,
so we do not need that. The client only needs the chunk it is currently in to
be loaded to close the loading screen, so we just send an empty one.
2022-03-02 09:45:56 +01:00
Jake Potrebic
0b5d7ad8d6 Custom Potion Mixes
== AT ==
public-f net.minecraft.server.MinecraftServer potionBrewing
2021-10-07 14:34:55 -07:00
Spottedleaf
299d7beee0 Put world into worldlist before initing the world
Some parts of legacy conversion will need the overworld
to get the legacy structure data storage
2022-02-22 14:21:35 -08:00
Jake Potrebic
b854576e5d Option to have default CustomSpawners in custom worlds
By default, only LevelStem's that specifically match the ResourceKey for
OVERWORLD will have the 5 (currently) impls of CustomSpawner (for
phantoms, wandering traders, etc.). This adds an option to instead of
just looking at the LevelStem key, look at the DimensionType key which
is one level below that. Defaults to off to keep vanilla behavior.
2022-02-19 20:15:41 -08:00
Jake Potrebic
c21f27243d Configurable sculk sensor listener range
== AT ==
public-f net.minecraft.world.level.gameevent.vibrations.VibrationListener listenerRange
2021-08-19 18:45:42 -07:00
Spottedleaf
62d962ce01 Execute chunk tasks fairly for worlds while waiting for next tick
Currently, only the first world would have had tasks executed.
This might result in chunks loading far slower in the nether,
for example.
2021-12-28 07:19:01 -08:00
Jake Potrebic
140e68625c Fix cancelled powdered snow bucket placement
Cancelling the placement of powdered snow from the powdered
snow bucket didn't revert grass that became snowy because of the
placement.
2021-10-08 13:12:58 -07:00
Jake Potrebic
83b4d889b7 Add missing structure set seed configs
The 4 missing structure set seed configs are strongholds, mineshafts,
buried treasure, and ancient cities.

Strongholds use a ring placement scheme which isn't random so they
utilize the world seed by default, this adds a config to override it
for just generating the ring positions.

Mineshafts and Buried Treasure structure sets are special cases
where the "salt" that can be defined for them via datapacks has 0
effect because the difference between the spacing and separation is 1
which is used as the upper bound in the random with salt. So the random
always returns the same int (0) so the salt has no effect. This adds
seeds/salts to the frequency reducer which has a similar effect.

Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
2022-01-13 23:05:53 -08:00
Shane Freeder
0202f1788d Use a CHM for StructureTemplate.Pallete cache
fixes a CME due to this collection being shared across threads
2021-07-12 12:28:29 +01:00
Owen1212055
0a2552a791 Freeze Tick Lock API 2021-12-26 20:27:43 -05:00
Kieran Wallbanks
e764b2b7f4 Fix NotePlayEvent
== AT ==
public org.bukkit.craftbukkit.block.data.CraftBlockData toNMS(Ljava/lang/Enum;Ljava/lang/Class;)Ljava/lang/Enum;
2021-06-21 14:23:50 +01:00
Brody Beckwith
a17ed327b3 Multi Block Change API Implementation 2022-01-14 00:41:11 -05:00
Jake Potrebic
1476dea76f Fix xp reward for baby zombies
The field that tracks the xpReward was not
getting reset if the death was cancelled
so this resets it after each call to
Zombie#getExperienceReward
2022-01-16 10:34:02 -08:00
Doc
87d0d2d557 Add configurable height for slime spawn 2021-08-02 11:24:39 -04:00
Nassim Jahnke
cbe94e7657 Reset placed block on exception 2022-01-07 11:45:15 +01:00
Cryptite
0fd1e5c650 Multiple Entries with Scoreboards 2021-09-21 18:17:33 -05:00
Jake Potrebic
69548ae4ec Add config option for worlds affected by time cmd 2022-01-02 22:34:51 -08:00
Jason Penilla
25af4f1bec Expose vanilla BiomeProvider from WorldInfo 2022-01-06 15:59:06 -08:00
Brokkonaut
a6dd9f7a68 Make water animal spawn height configurable 2021-12-18 08:26:55 +01:00
Spottedleaf
5be900b223 Validate usernames 2022-01-01 05:19:37 -08:00
Jake Potrebic
29d059d659 Fix sticky pistons and BlockPistonRetractEvent
There is an explicit check in the handling code for empty pistons that
prevents sticky pistons from firing the event. However when we look back
at the history we see that this check was originally added so that ONLY
sticky pistons would fire the retract event. I'm not sure why.
1092acbddf

Over the course of several updates, the meaning of that field appears to
have changed from "is NOT sticky" to "is sticky". So now its having the
opposite effect. Only normal pistons fire the retraction event. And like
all things in CB, it's just been carried around since.

If we are to believe the history, the correct fix for this issue is to
flip it so it only fires for sticky pistons, but that puts us in a
bind. It's already firing for non-sticky pistons, changing it now would
likely result in breakage. Furthermore, there is little documentation as
to WHY that was ever intended to be the case.

Instead we opt to remove the check entirely so that the event fires for
all piston types.

Co-authored-by: Zach Brown <1254957+zachbr@users.noreply.github.com>
Co-authored-by: Madeline Miller <mnmiller1@me.com>
2021-12-22 09:51:48 -08:00
Nassim Jahnke
929de37045 Configurable max block light for monster spawning 2021-12-16 09:40:39 +01:00
Jake Potrebic
d237e02832 Forward CraftEntity in teleport command 2021-12-04 17:04:47 -08:00
LemonCaramel
c5e4146598 Add more Campfire API 2021-07-16 00:39:03 +09:00
stonar96
71ac6d7e6a Optimize HashMapPalette
HashMapPalette uses an instance of CrudeIncrementalIntIdentityHashBiMap
internally. A Palette has a preset maximum size = 1 << bits.
CrudeIncrementalIntIdentityHashBiMap has an initial size but is
automatically resized. The CrudeIncrementalIntIdentityHashBiMap is created
with the maximum size in the constructor of HashMapPalette, with the aim
that it doesn't need to be resized anymore. However, there are two things
that I think Mojang hasn't considered here:
1) The CrudeIncrementalIntIdentityHashBiMap is resized, when its initial
size is reached and not the next time, when a further object is added.
2) HashMapPalette adds objects (unnecessarily) before checking if the
initial size of CrudeIncrementalIntIdentityHashBiMap is reached.
This means to actually avoid resize operations in
CrudeIncrementalIntIdentityHashBiMap, one has to add 2 to the initial size
or add 1 and check the size before adding objects. This commit implements
the second approach. Note that this isn't only an optimization but also
makes async reads of Palettes fail-safe. An async read while the
CrudeIncrementalIntIdentityHashBiMap is resized is fatal and can even lead
to corrupted data. This is also something that Anti-Xray is currently
relying on.
2021-01-17 01:11:36 +01:00
SamB440
24e3d1c857 Add PlayerItemFrameChangeEvent 2021-11-15 18:10:10 +00:00
Shane Freeder
c472c71eca Prevent ContainerOpenersCounter openCount from going negative 2021-11-30 05:30:35 +00:00
Jason Penilla
0919b52439 Fix Spigot growth modifiers
Fixes kelp modifier changing growth for other crops
Also add growth modifiers for glow berries, mangrove propagules,
torchflower crops and pitcher plant crops
Also fix above-mentioned modifiers from having the reverse effect

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
2021-12-03 17:09:24 -08:00
Jason Penilla
22d5c6386f Remove client-side code using deprecated for removal AccessController
Fixes warnings on build
2021-11-26 15:09:58 -08:00
Nassim Jahnke
99808779a1 Prevent excessive velocity through repeated crits 2021-11-25 10:25:09 +01:00
sulu5890
16f4f7a2e0 don't attempt to teleport dead entities 2021-10-24 22:48:14 -05:00
egg82
61353ac496 Add root/admin user detection
This patch detects whether or not the server is currently executing as a privileged user and spits out a warning.
The warning serves as a sort-of PSA for newer server admins who don't understand the risks of running as root.
We've seen plenty of bad/malicious plugins hit markets, and there's been a few close-calls with exploits in the past.
Hopefully this helps mitigate some potential damage to servers, even if it is just a warning.

Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
2021-09-11 22:55:14 +02:00
Nassim Jahnke
987d596834 Configurable feature seeds
Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com>
2021-08-31 17:05:27 +02:00
Jake Potrebic
e259cfeb72 Fix upstreams block state factories
Sometimes, blocks are changed and then logic is called before the associated
tile entity is removed. When this happens, the factories were relying on the
block at the position, not the tile entity. This change prioritizes using the
tile entity type to determine the block state factory and falls back on
the material type of the block at that location.

== AT ==
public net.minecraft.world.level.block.entity.BlockEntityType validBlocks
2021-10-06 20:50:48 -07:00
Jake Potrebic
552c78a7a0 prevent unintended light block manipulation 2021-09-13 18:55:45 -07:00
Owen1212055
8c5582489a Update head rotation in missing places
In certain areas the player's head rotation could be desynced when teleported/moved.
This is because bukkit uses a separate head rotation field for yaw.
This issue only applies to players.
2021-06-21 21:55:23 -04:00
lexikiq
5c4d5afef1 Preserve overstacked loot
Preserves overstacked items in loot tables, such as shulker box drops, to prevent the items
from being deleted (as they'd overflow past the bounds of the container)-- or worse, causing
chunk bans via the large amount of NBT created by unstacking the items.

Fixes GH-5140 and GH-4748.
2021-06-21 23:21:58 -04:00
Jake Potrebic
37fa505050 fix various menus with empty level accesses 2021-07-11 12:52:56 -07:00
Shane Freeder
04a78195ec Fix CocaoDecorator causing a crash when trying to generate without logs 2021-09-07 21:29:38 +01:00
Noah van der Aa
f911fd4880 Prevent softlocked end exit portal generation 2021-08-30 15:22:18 +02:00
Nassim Jahnke
457b4033ab Ensure valid vehicle status 2021-09-28 09:47:47 +02:00
Spottedleaf
0277ecd75d Add packet limiter config
Example config:
packet-limiter:
  kick-message: '&cSent too many packets'
  limits:
    all:
      interval: 7.0
      max-packet-rate: 500.0
    ServerboundPlaceRecipePacket:
      interval: 4.0
      max-packet-rate: 5.0
      action: DROP

all section refers to all incoming packets, the action for all is
hard coded to KICK.

For specific limits, the section name is the class's name,
and an action can be defined: DROP or KICK

If interval or rate are less-than 0, the limit is ignored
2020-10-30 22:37:16 -07:00
stonar96
740e6b1eed Don't respond to ServerboundCommandSuggestionPacket when tab-complete is disabled 2021-09-12 00:14:21 +02:00
stonar96
62607d2c90 Check requirement before suggesting root nodes
Child nodes are handled by CommandDispatcher#parse checking
requirements.

Vanilla clients only send ServerboundCommandSuggestionPacket when
encountering a command node with ASK_SERVER suggestions, however a
modified client can send this packet whenever it wants.
2021-09-12 00:14:21 +02:00
Jake Potrebic
ce689ae7e0 Fix merchant inventory not closing on entity removal 2021-09-02 00:24:06 -07:00
Spottedleaf
d063ae6275 Optimise BlockSoil nearby water lookup
Apparently the abstract block iteration was taking about
75% of the method call.
2021-06-10 14:36:00 -07:00
Spottedleaf
82a8294625 Oprimise map impl for tracked players
Reference2BooleanOpenHashMap is going to have
better lookups than HashMap.
2021-02-19 22:51:52 -08:00
Spottedleaf
12321d761e Don't lookup fluid state when raytracing, skip air blocks
Just use the iblockdata already retrieved, removes a getType call.

Also save approx. 5% for the raytrace call, as most (expensive)
raytracing tends to go through air and returning early is an
easy win. The remaining problems with this function
are mostly with the block getting itself.
2020-08-28 12:33:47 -07:00
Spottedleaf
698c758855 Don't read neighbour chunk data off disk when converting chunks
Lighting is purged on update anyways, so let's not add more
into the conversion process
2021-04-11 02:58:48 -07:00
Spottedleaf
ebaf017f9c Make sure inlined getChunkAt has inlined logic for loaded chunks
Tux did some profiling some time ago and showed that the
previous getChunkAt method which had inlined logic for loaded
chunks did get inlined, but the standard CPS.getChunkAt
method was not inlined.
2020-09-20 16:10:49 -07:00
Spottedleaf
32107198d1 Manually inline methods in BlockPosition 2020-07-06 22:48:48 -07:00
Nassim Jahnke
37bc4f0b04 Sanitize ResourceLocation error logging 2021-08-26 12:09:47 +02:00
Jason Penilla
b67ec825d2 Add '/paper mobcaps' and '/paper playermobcaps'
Add commands to get the mobcaps for a world, as well as the mobcaps for
each player when per-player mob spawning is enabled.

Also has a hover text on each mob category listing what entity types are
in said category
2021-08-16 01:31:54 -05:00
Spottedleaf
c593e8510e Improve and expand AsyncCatcher
Log when the async catcher is tripped
  The chunk system can swallow the exception given it's all
  built with completablefuture, so ensure it is at least printed.

Add/move several async catchers

Async catch modifications to critical entity state
  These used to be here from Spigot, but were dropped with 1.17.
  Now in 1.17, this state is _even more_ critical than it was before,
  so these must exist to catch stupid plugins.

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2021-08-25 20:17:12 -07:00
Spottedleaf
efb3bbf2bb Fix GameProfileCache concurrency
Separate lookup and state access locks prevent lookups
from stalling simple state access/write calls
2020-07-11 05:09:28 -07:00
Spottedleaf
7b293aba08 Do not run close logic for inventories on chunk unload
Still call the event and change the active container though. We
want to avoid close logic because it's possible to load the
chunk through it. This should also be OK from a leak prevention/
state desync POV because the TE is getting unloaded anyways.
2021-03-11 03:03:32 -08:00
Jason Penilla
6dafeceebd Vanilla command permission fixes
Fixes permission checks for vanilla commands which don't have a
requirement, as well as for namespaced vanilla commands.

== AT ==
public-f com.mojang.brigadier.tree.CommandNode requirement
2021-08-25 13:19:53 -07:00
Mariell Hoversholm
33aad47ee1 Add Raw Byte Entity Serialization
== AT ==
public net.minecraft.world.entity.Entity setLevel(Lnet/minecraft/world/level/Level;)V
2021-10-24 16:20:31 -04:00
Seggan
4e20ba8bf7 Goat ram API 2021-08-05 13:10:27 -04:00
Jake Potrebic
310d8c53aa Fix issues with mob conversion 2021-10-24 20:29:45 -07:00
dodison
2852803dbf Add critical damage API 2021-07-26 17:32:36 +02:00
syldium
864494345a Add more advancement API
== AT ==
public net.minecraft.advancements.Advancement decorateName(Lnet/minecraft/advancements/DisplayInfo;)Lnet/minecraft/network/chat/Component;

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2021-07-09 18:50:40 +02:00
Jakub Zacek
067c4e04bd Add methods to find targets for lightning strikes
== AT ==
public net.minecraft.server.level.ServerLevel findLightningRod(Lnet/minecraft/core/BlockPos;)Ljava/util/Optional;
2021-10-04 10:16:44 +02:00
Jake Potrebic
424403988d Add back EntityPortalExitEvent 2021-05-16 09:39:46 -07:00
Jake Potrebic
65ec6cf342 Option to prevent data components copy in smithing recipes 2021-09-26 12:57:28 -07:00
Jake Potrebic
b96b8f7723 Add BlockBreakBlockEvent 2021-01-03 17:58:11 -08:00
Jake Potrebic
a6362921cc Change EnderEye target without changing other things 2021-08-21 12:13:53 -07:00
Warrior
c754319985 Configurable item frame map cursor update interval 2021-08-13 01:14:38 +02:00
Andrew Steinborn
8a3f9f7eb6 Optimize indirect passenger iteration 2021-08-09 00:38:37 -04:00
Jake Potrebic
826dc5744d Add EntityDamageItemEvent 2020-12-22 13:52:48 -08:00
Jason Penilla
d4dfcccc84 Config option for Piglins guarding chests 2020-12-02 03:07:58 -08:00
Andrew Steinborn
ac0d44684a Optimize entity tracker passenger checks 2021-08-08 00:52:54 -04:00
Jake Potrebic
70262052bd Make hoppers respect inventory max stack size 2021-07-07 16:30:17 -07:00
Jake Potrebic
0e4e270396 Add PlayerSetSpawnEvent 2021-05-19 18:59:10 -07:00
Professor Bloodstone
2e42192ea2 Allow skipping writing of comments to server.properties
Makes less git noise, as it won't update the date every single time

Use -DPaper.skipServerPropertiesComments=true flag to disable writing it
2021-07-23 02:32:04 +02:00
Noah van der Aa
bb3dbd3116 Prevent AFK kick while watching end credits 2021-07-24 16:54:11 +02:00
Jake Potrebic
29ce813416 Add missing forceDrop toggles 2021-07-20 21:25:35 -07:00
Phoenix616
a600754f0d Rate options and timings for sensors and behaviors
This adds config options to specify the tick rate for sensors
 and behaviors of different entity types as well as timings
 for those in order to be able to have some metrics as to which
 ones might need tweaking.
2021-06-28 22:38:29 +01:00
Phoenix616
e7de2be721 Don't apply cramming damage to players
It does not make a lot of sense to damage players if they get crammed,
 especially as the usecase of teleporting lots of players to the same
 location isn't too uncommon and killing all those players isn't
 really what one would expect to happen.

For those who really want it a config option is provided.
2021-06-20 16:35:42 +01:00
Jake Potrebic
818a84cfbe Fix kick event leave message not being sent 2021-07-07 16:19:41 -07:00
Jake Potrebic
485db97ad6 Add PlayerArmSwingEvent 2021-03-12 19:22:21 -08:00
Jake Potrebic
39716421ea Fix commands from signs not firing command events
This patch changes sign command logic so that `run_command` click events:
  - are logged to the console
  - fire PlayerCommandPreprocessEvent
  - work with double-slash commands like `//wand`
  - sends failure messages to the player who clicked the sign
2021-07-09 13:50:48 -07:00
Spottedleaf
9ce3172c9f Use getChunkIfLoadedImmediately in places
This prevents us from hitting chunk loads for chunks at or less-than
ticket level 33 (yes getChunkIfLoaded will actually perform a chunk
load in that case).
2019-07-08 00:13:36 -07:00
Owen1212055
df822c00c9 Missing Entity API
== AT ==
public net.minecraft.world.entity.animal.Fox isDefending()Z
public net.minecraft.world.entity.animal.Fox setDefending(Z)V
public net.minecraft.world.entity.animal.Fox setFaceplanted(Z)V
public net.minecraft.world.entity.animal.Panda getEatCounter()I
public net.minecraft.world.entity.animal.Panda setEatCounter(I)V
public net.minecraft.world.entity.animal.Bee isRolling()Z
public net.minecraft.world.entity.animal.Bee setRolling(Z)V
public net.minecraft.world.entity.animal.Bee numCropsGrownSincePollination
public net.minecraft.world.entity.animal.Bee ticksWithoutNectarSinceExitingHive
public net.minecraft.world.entity.monster.piglin.Piglin isChargingCrossbow()Z
public net.minecraft.world.entity.ambient.Bat targetPosition
public net.minecraft.world.entity.monster.Ravager attackTick
public net.minecraft.world.entity.monster.Ravager stunnedTick
public net.minecraft.world.entity.monster.Ravager roarTick
public net.minecraft.world.entity.vehicle.MinecartTNT explode(D)V
public net.minecraft.world.entity.vehicle.MinecartTNT fuse
public net.minecraft.world.entity.monster.Endermite life
public net.minecraft.world.entity.projectile.AbstractArrow soundEvent
public net.minecraft.world.entity.monster.Phantom anchorPoint
public net.minecraft.world.entity.npc.WanderingTrader getWanderTarget()Lnet/minecraft/core/BlockPos;
public net.minecraft.world.entity.animal.AbstractSchoolingFish leader
public net.minecraft.world.entity.animal.AbstractSchoolingFish schoolSize
public net.minecraft.world.entity.animal.Rabbit moreCarrotTicks
public net.minecraft.world.entity.AreaEffectCloud ownerUUID
public net.minecraft.world.entity.animal.MushroomCow stewEffects
public net.minecraft.world.entity.Entity FLAG_INVISIBLE
public net.minecraft.world.entity.animal.Cat setRelaxStateOne(Z)V
public net.minecraft.world.entity.animal.Cat isRelaxStateOne()Z

Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
Co-authored-by: booky10 <boooky10@gmail.com>
Co-authored-by: Amin <amin.haddou@frg.wwschool.de>
Co-authored-by: TrollyLoki <trollyloki@gmail.com>
Co-authored-by: FireInstall <kettnerl@hu-berlin.de>
Co-authored-by: maxcom1 <46265094+maxcom1@users.noreply.github.com>
Co-authored-by: TotalledZebra <Holappa57@gmail.com>
2021-06-21 23:56:07 -04:00
Spottedleaf
ac687d7ecb Fix PlayerDropItemEvent using wrong item 2021-06-20 21:55:59 -07:00
Jake Potrebic
0bf80e49be Fix potions splash events
Fix PotionSplashEvent for water splash potions
Fixes SPIGOT-6221: https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-6221
Fix splash events cancellation that still show particles/sound
2021-05-20 20:40:53 -07:00
TwoLeggedCat
750a4590ce Line Of Sight Changes 2021-05-29 14:33:25 -05:00
Aikar
c002a90053 Optimize Biome Mob Lookups for Mob Spawning
Uses an EnumMap as well as a Set paired List for O(1) contains calls.
2018-09-12 21:47:01 -04:00
Owen1212055
f67092fe39 Add ElderGuardianAppearanceEvent 2021-03-19 23:39:09 -04:00
Max Lee
4198f9a836 Fix invulnerable end crystals
MC-108513
2021-05-27 14:52:30 -07:00
Owen1212055
16ad983f5c Add BellRevealRaiderEvent 2021-05-26 17:09:07 -04:00
GioSDA
c9533ae126 Add option to fix items merging through walls 2021-03-10 10:06:45 -08:00
Aikar
c4f8064fb9 Synchronize PalettedContainer instead of ThreadingDetector/Semaphore
Mojang has flaws in their logic about chunks being concurrently
wrote to. So we constantly see crashes around multiple threads writing.

Additionally, java has optimized synchronization so well that its
in many times faster than trying to manage read write locks for low
contention situations.

And this is extremely a low contention situation.
2020-05-29 20:29:02 -04:00
Jake Potrebic
e86b844e04 Fix PlayerBucketEmptyEvent result itemstack
Fixes SPIGOT-2560: https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-2560
2021-05-20 22:16:37 -07:00
HexedHero
37143dae29 Add PufferFishStateChangeEvent 2021-05-10 16:59:05 +01:00
Jake Potrebic
75225eb102 Add PlayerKickEvent causes 2021-05-15 20:30:45 -07:00
Yive
e8cb0ac761 Limit item frame cursors on maps 2021-05-26 15:09:33 -07:00
Jake Potrebic
f61b2947ad Add cause to Weather/ThunderChangeEvents 2020-12-02 18:23:26 -08:00
Jake Potrebic
eb675d9110 Add EntityInsideBlockEvent 2021-05-08 18:02:36 -07:00
Andrew Steinborn
cc2c25ba55 Add Unix domain socket support 2021-05-11 17:39:22 -04:00
Jake Potrebic
15d02795ea Correctly check if bucket dispenses will succeed for event
Upstream incorrectly checks if the bucket place will succeed
in order to fire the BlockDispenseEvent. This patch corrects
that.
2024-01-01 12:57:19 -08:00
Nassim Jahnke
5392798da4 Move range check for block placing up 2022-06-08 10:52:18 +02:00
Jake Potrebic
d6b69e74a9 Expand PlayerGameModeChangeEvent 2021-05-15 10:04:43 -07:00
Riley Park
64365b4218 Add environment variable to disable server gui 2021-05-17 00:34:55 -07:00
MeFisto94
637bb9a05d Add a "should burn in sunlight" API for Phantoms and Skeletons 2021-05-11 00:48:33 +02:00
Alvinn8
556bc3e8b5 Add Adventure message to PlayerAdvancementDoneEvent 2021-01-08 20:31:13 +01:00
Owen1212055
f24aec2051 Add EntityBlockStorage#clearEntities() 2021-04-05 18:12:29 -04:00
HexedHero
2329a7b1c8 Add more WanderingTrader API 2021-05-06 14:56:43 +01:00
Shane Freeder
6949e999eb Send empty commands if tab completion is disabled 2021-04-26 01:27:08 +01:00
Nassim Jahnke
3ab2001afb Add Channel initialization listeners 2021-04-29 21:19:33 +02:00
Spyridon Pagkalos
639cb2d6aa Introduce beacon activation/deactivation events 2021-03-25 20:28:04 +02:00
HexedHero
73239b4aa7 Expand PlayerRespawnEvent, fix passed parameter issues
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2021-04-23 22:42:42 +01:00
Jason Penilla
b9cab64e46 Implement methods to convert between Component and Brigadier's Message 2021-04-24 02:09:32 -07:00
Jake Potrebic
472880fdde Add PlayerBedFailEnterEvent 2020-12-24 12:27:41 -08:00
Jake Potrebic
bb4539d223 Add PlayerDeepSleepEvent 2021-04-21 15:58:19 -07:00
chickeneer
a3c944c37b fix PlayerItemHeldEvent firing twice 2021-04-22 19:02:07 -07:00
Trigary
83afbd0e3b fix PigZombieAngerEvent cancellation 2021-03-18 21:38:01 +01:00
Jake Potrebic
8683cde7c0 add consumeFuel to FurnaceBurnEvent 2021-04-22 16:45:28 -07:00
Shane Freeder
635832cc39 Add bypass host check
Paper.bypassHostCheck

Seriously, fix your firewalls. -.-
2021-04-18 21:27:01 +01:00
chickeneer
3ab3613d10 Fix PlayerItemConsumeEvent cancelling properly
When the active item is not cleared, the item is still readied
for use and will repeatedly trigger the PlayerItemConsumeEvent
till their item is switched.
This patch clears the active item when the event is cancelled
2021-03-19 00:33:15 -05:00
Jason Penilla
a6eda6cb37 Enhance console tab completions for brigadier commands
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2021-03-30 16:06:08 -07:00
Jason Penilla
273355e28c Don't ignore result of PlayerEditBookEvent 2021-04-05 18:35:15 -07:00
Trigary
f2e70c48f9 forced whitelist: use configurable kick message 2021-03-27 09:24:23 +01:00
Dmitry Sidorov
06ee0e08d7 Drop carried item when player has disconnected
Fixes disappearance of held items, when a player gets disconnected and PlayerDropItemEvent is cancelled.
Closes #5036
2021-02-04 20:32:01 +03:00
Irmo van den Berge
28e1766b3b Add fast alternative constructor for Rotations 2021-03-10 21:26:31 +01:00
Anton Lindroth
a032df8427 Allow using signs inside spawn protection 2020-04-15 01:54:02 +02:00
Thonk
a9cee72542 Add recipe to cook events 2021-01-06 12:04:03 -08:00
Jake Potrebic
000882670b Add PlayerNameEntityEvent 2020-07-05 00:33:54 -07:00
Jake Potrebic
eed0bcb63d Add worldborder events 2021-01-04 22:40:34 -08:00
Jake Potrebic
bf99953fa0 fix converting txt to json file 2021-01-04 19:49:15 -08:00
AlexProgrammerDE
73deb32107 Improve ServerGUI
- Added logo to server frame
- Show tps in the server stats
2020-10-03 08:27:40 +02:00
ysl3000
6b65e03d85 living entity allow attribute registration 2020-10-24 16:37:44 +02:00
Andrew Steinborn
1d6a99b50b Inline shift direction fields
Removes a layer of indirection for EnumDirection.getAdjacent(X|Y|Z)(), which is in the
critical section for much of the server, including the lighting engine.
2021-01-18 20:45:25 -05:00
lukas81298
9ba22a1143 added option to disable pathfinding updates on block changes 2021-01-25 14:37:57 +01:00
William Blake Galbreath
48c492c4d1 Add EntityMoveEvent 2020-02-11 21:56:48 -06:00
Trigary
6f6ed7acb9 Add DragonEggFormEvent 2021-01-25 14:53:57 +01:00
Yive
e3b367dcae Reset shield blocking on dimension change 2021-01-24 08:55:19 -08:00
Nassim Jahnke
a85863338c Expand EntityUnleashEvent 2021-01-29 15:13:11 +01:00
Jake Potrebic
1292627c18 Add PlayerStonecutterRecipeSelectEvent
Co-Authored-By: MiniDigger | Martin <admin@benndorf.dev>
2020-11-27 17:14:27 -08:00
William Blake Galbreath
d4892b5c73 Add toggle for always placing the dragon egg 2020-11-26 11:47:24 +00:00
Jake Potrebic
92507ca231 Add PlayerChangeBeaconEffectEvent 2020-06-24 15:14:51 -06:00
Madeline Miller
b69f8fb10b Add BlockPreDispenseEvent 2021-01-17 13:16:09 +10:00
Jake Potrebic
cd4969468c Configurable max leash distance 2021-01-03 21:04:03 -08:00
Jake Potrebic
0faa210781 Make schedule command per-world 2021-01-04 19:52:44 -08:00
CDFN
3daa3905f0 Return chat component with empty text instead of throwing exception 2020-07-07 17:53:23 +02:00
Mariell Hoversholm
df6902585c Collision option for requiring a player participant 2020-11-14 16:48:37 +01:00
dfsek
33a7c0284d Add StructuresLocateEvent
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2020-09-16 01:12:29 -07:00
Jake Potrebic
239e7a6b37 Add RegistryAccess for managing Registries
RegistryAccess is independant from CraftServer and
doesn't require one to be created allowing the
org.bukkit.Registry class to be loaded earlier.

== AT ==
public net.minecraft.server.RegistryLayer STATIC_ACCESS
2023-02-27 18:28:39 -08:00
Mariell Hoversholm
23b8639dbf Add sendOpLevel API 2020-12-29 15:03:03 +01:00
Jason Penilla
921d396ffa Fix villager boat exploit 2021-01-11 12:43:51 -08:00
Shane Freeder
cabf9f914d Remove stale POIs 2021-01-09 14:17:07 +01:00
Mariell Hoversholm
6ba5436a48 Empty commands shall not be dispatched 2021-01-06 23:38:43 +01:00
Jake Potrebic
36020d6749 Configurable door breaking difficulty
== AT ==
public net.minecraft.world.entity.monster.Vindicator DOOR_BREAKING_PREDICATE
public net.minecraft.world.entity.monster.Zombie DOOR_BREAKING_PREDICATE

Co-authored-by: Doc <nachito94@msn.com>
2021-01-03 22:27:43 -08:00
Jake Potrebic
55c56acfc0 Add PlayerLoomPatternSelectEvent 2020-11-25 16:33:27 -08:00
Jake Potrebic
4054b19800 Add PlayerLecternPageChangeEvent 2020-11-23 12:58:51 -08:00
TheViperShow
36eff9b616 Add BlockFailedDispenseEvent 2020-04-22 09:40:38 +02:00
Jake Potrebic
84d13a09ca Add world settings for mobs picking up loot 2020-11-28 18:43:52 -08:00
Jake Potrebic
1245e2a0de Add ServerResourcesReloadedEvent 2020-12-02 20:04:01 -08:00
Jake Potrebic
1e05072232 Add WorldGameRuleChangeEvent 2020-12-20 16:41:44 -08:00
JRoy
e793c7d8be Add EntityLoadCrossbowEvent 2020-10-07 12:04:01 -04:00
Jake Potrebic
2ff5ce988f Fix nerfed slime when splitting 2020-08-24 08:39:06 -07:00
TheMolkaPL
40789b9ca7 Fix interact event not being called sometimes
* Call PlayerInteractEvent when left-clicking on a block in adventure
  mode.
* Call PlayerInteractEvent when left-clicking an Entity that is out of
  range in adventure/survival (entity reach is 3.0).

Co-authored-by: Moulberry <james.jenour@protonmail.com>
2020-06-21 17:21:46 +02:00
MisterVector
a5f9a41152 Add PlayerFlowerPotManipulateEvent 2019-08-13 19:45:06 -07:00
Aikar
397d058748 Fix "Not a string" Map Conversion spam
The maps did convert successfully, but had noisy logs due to Spigot
implementing this logic incorrectly.

This stops the spam by converting the old format to new before
requesting the world.

Track spigot issue to see when fixed: https://hub.spigotmc.org/jira/browse/SPIGOT-6181
2020-10-08 00:00:25 -04:00
BrodyBeckwith
870ed90a9a Allow disabling mob spawner spawn egg transformation 2020-10-09 20:30:12 -04:00
Madeline Miller
38ea31d1cb API to get Material from Boats and Minecarts
== AT ==
public net.minecraft.world.entity.vehicle.AbstractBoat getDropItem()Lnet/minecraft/world/item/Item;
2020-12-31 12:48:19 +10:00
BillyGalbreath
d9c0a60246 MC-4: Fix item position desync
This fixes item position desync (MC-4) by running the item coordinates
through the encode/decode methods of the packet that causes the precision
loss, which forces the server to lose the same precision as the client
keeping them in sync.
2020-12-08 20:24:52 -06:00
Jason Penilla
c4dc717563 Add TargetHitEvent 2020-11-25 23:20:44 -08:00
Shane Freeder
5b7474984b Fix crash from invalid ingredient lists in VillagerAcquireTradeEvent 2020-12-27 11:31:06 +00:00
Mark Vainomaa
1cedeb97af Expose LivingEntity hurt direction 2020-12-13 05:32:05 +02:00
Aikar
3f4b9fd365 Optimize Dynamic#get Missing Keys
get was calling toString() on every NBT object that was ever asked for an optional
key from the object to build a string for the error text.

When done on large NBT objects, this was using a ton of computation time building the
JSON representation of the NBT object.

Now we will just skip the value when 99.9999% of the time the text is never even printed.
2020-12-21 11:01:42 -05:00
ysl3000
e32901791b Player Chunk Load/Unload Events 2020-10-05 21:25:16 +02:00
Shane Freeder
1f21f3032b Limit recipe packets 2020-12-12 23:45:28 +00:00
JRoy
661fc1e52e Add PlayerShearBlockEvent 2020-08-27 15:02:48 -04:00
William Blake Galbreath
22069fd885 Climbing should not bypass cramming gamerule 2020-08-23 20:59:00 +02:00
SuperCoder7979
e1ec33acb3 Significantly improve performance of the end generation
This patch implements a noise cache for the end which significantly reduces the computation time of generation. This results in about a 3x improvement.

Original code by SuperCoder7979 and Gegy in Lithium, licensed under LGPL-3.0 (Source: https://github.com/jellysquid3/lithium-fabric)

Co-authored-by: Gegy <gegy1000@gmail.com>
Co-authored-by: Dylan Xaldin <Puremin0rez515@gmail.com>
Co-authored-by: pop4959 <pop4959@gmail.com>
2020-11-03 23:48:05 -06:00
Nassim Jahnke
d1d54d35bf Add PlayerItemCooldownEvent 2020-08-25 13:48:33 +02:00
Ineusia
c068010b34 Add Destroy Speed API
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2020-10-26 11:48:06 -05:00
Jason Penilla
93f14c745c Add Wandering Trader spawn rate config options
Adds config options for modifying the spawn rates of Wandering Traders.
These values are all easy to understand and configure after a quick read of this
page on the Minecraft wiki: https://minecraft.wiki/wiki/Wandering_Trader#Spawning
Usages of the vanilla WanderingTraderSpawnDelay and WanderingTraderSpawnChance values
in IWorldServerData are removed as they were only used in certain places, with hardcoded
values used in other places.
2020-08-20 11:20:12 -07:00
Mariell Hoversholm
4b0e4655fd Add API for quit reason 2020-11-14 16:19:52 +01:00
Jake Potrebic
5b1f73e2dc Beacon API - custom effect ranges 2020-06-24 12:39:08 -06:00
Mariell Hoversholm
c8ba4fb789 Toggle for removing existing dragon 2020-09-30 22:49:14 +02:00
Mariell Hoversholm
8bac10ce5e Add ignore discounts API 2020-11-09 20:44:51 +01:00
Toon Schoenmakers
69fa242c6a Avoid error bubbling up when item stack is empty in fishing loot
This can realistically only happen if there's custom loot active on fishing
which can return 0 items. This would disconnect the player who's fishing.
2020-10-23 15:01:44 +02:00
giacomo
053db61214 Fix bell block entity memory leak
BellBlockEntity has a list of entities (entitiesAtRing) that was not being cleared at the right time, causing leaks whenever a bell would be rung near a crowd of entities.
2020-10-10 12:15:33 +02:00
William Blake Galbreath
416280fc29 Fix item locations dropped from campfires
Fixes #4259 by not flooring the blockposition among other weirdness
Vanilla Issue: MC-267622
2020-10-03 20:32:25 -05:00
Spottedleaf
87fdd68f47 Retain block place order when capturing blockstates
Fixes twisted vines not connecting properly when grown via
bonemeal by a player.

In general, look at making this logic more robust (i.e properly handling
cases where a captured entry is overriden) - but for now this will do.
2020-08-07 04:27:56 -07:00
William Blake Galbreath
691c4ee7b6 Villager#resetOffers 2019-10-07 00:15:37 -05:00
Spottedleaf
f24af9bc9c Optimise getType calls
Remove the map lookup for converting from Block->Bukkit Material
2020-06-03 11:37:13 -07:00
Spottedleaf
093bd60eae Fix for large move vectors crashing server
Check movement distance also based on current position.
2020-05-17 23:47:33 -07:00
Aikar
c760673958 Reset Ender Crystals on Dragon Spawn
Crystals can end up in a bad state in certain conditions which causes
an exception on the expected number of crystals going negative.

This ensures the crystals/pillars are in expected state when the dragon spawns.

See #3522
2016-06-01 23:29:17 -04:00
Aikar
1d8508b7ac Fix Concurrency issue in ShufflingList
if multiple threads from worldgen sort at same time, it will crash.
So make a copy of the list for sorting purposes.
2020-07-06 18:36:41 -04:00
William Blake Galbreath
c2be5a5354 Fix deop kicking non-whitelisted player when white list is not enabled 2020-10-03 22:00:27 -05:00
William Blake Galbreath
972b6a6f18 Entity#isTicking 2020-10-03 21:39:16 -05:00
MeFisto94
73b101005b Expose the Entity Counter to allow plugins to use valid and non-conflicting Entity Ids 2020-08-28 01:41:26 +02:00
Shane Freeder
af1fabed04 Extend block drop capture to capture all items added to the world 2020-09-17 00:36:05 +01:00
Aikar
a4cc307c2b Cache DataFixerUpper Rewrite Rules on demand
Mojang precaches every single potential rewrite rule that could ever
exist on server startup. This includes rules from all the way back to versions from 6+ years ago.

This is the source of why the server hogs every CPU core at 100% every start.

For anyone who hard resets for updates or has force upgraded their entire world, this
results in completely wasted cpu cycles.

This massive CPU usage also delays server startup time.

We improve this by making "min version to precache" that defaults to a future version
so that no rewrite rules are precached.

someone who expects to be converting a lot chunks could theoretically set
-DPaper.minPrecachedDatafixVersion=<dataVersionConvertingFrom> as a startup
parameter and only build from that point on.

However this will likely never be needed as the server will still run
the same cache logic on demand when it's actually needed. The only
cost would be some delay on the FIRST chunk conversion, but paper already
runs chunk conversions on another thread so this will likely never be
a concern for TPS.

This patch will significantly reduce CPU use on startup, reduce memory usage,
and improve server startup time.
2020-09-12 17:21:38 -04:00
Aikar
aebf9e869b Fix Entity Teleportation and cancel velocity if teleported
Uses correct setPositionRotation for Entity teleporting instead of setLocation
as this is how Vanilla teleports entities.

Cancel any pending motion when teleported.
2020-08-25 20:45:36 -04:00
miclebrick
74de6853f4 Cache block data strings 2018-12-06 19:52:50 -05:00
JRoy
88335d97a8 Fix hex colors not working in some kick messages 2020-08-27 16:57:25 -04:00
Shane Freeder
5d139ca424 Buffer joins to world
This patch buffers the number of logins which will attempt to join
the world per tick, this attempts to reduce the impact that join floods
has on the server
2020-08-19 05:05:54 +01:00
BillyGalbreath
f1a2ddbc7b Add zombie targets turtle egg config 2020-08-23 15:47:34 +02:00
commandblockguy
54ce8682aa Prevent headless pistons from being created
Prevent headless pistons from being created by explosions or tree/mushroom growth.
2020-08-14 14:44:14 -05:00
Zach Brown
300af129c1 Do not let the server load chunks from newer versions
If the server attempts to load a chunk generated by a newer version of
the game, immediately stop the server to prevent data corruption.

You can override this functionality at your own peril.
2019-07-23 20:44:47 -05:00
William Blake Galbreath
b77fd7dd24 Fix SpawnChangeEvent not firing for all use-cases 2020-08-22 23:36:21 +02:00
Mariell Hoversholm
17cde37876 Don't require FACING data 2020-08-23 19:01:04 +02:00
DigitalRegent
0ef48f1dd1 Brand support 2020-04-11 13:10:58 +02:00
Spottedleaf
07d11145d9 Fix some rails connecting improperly 2020-07-24 15:56:05 -07:00
Andrew Steinborn
5f6808db9a Optimize NetworkManager Exception Handling 2020-07-05 22:38:18 -04:00
Spottedleaf
7b340b4aa2 Fix AdvancementDataPlayer leak due from quitting early in login
Move the criterion storage to the AdvancementDataPlayer object
itself, so the criterion object stores no references - and thus
needs no cleanup.
2020-07-13 06:22:54 -07:00
William Blake Galbreath
760f623ace Fix SPIGOT-5885 Unable to disable advancements 2020-07-10 12:38:12 -05:00
William Blake Galbreath
1110af5fe2 Fix SPIGOT-5824 Bukkit world-container is not used 2020-07-10 13:12:33 -05:00
Aikar
def8b96d4b Thread Safe Vanilla Command permission checking
Datapacks check this on load and are built concurrently. This was breaking them badly due
to race conditions.

Plus, .canUse we want to be safe for async anyways.
2020-07-11 03:54:28 -04:00
William Blake Galbreath
3ceb5297a3 Fix arrows never despawning MC-125757
This forces the despawn counter to start ticking regardless of
state after the arrow has been alive for 200 ticks (10 seconds)
instead of getting stuck in a never despawn state (bubble columns,
etc).
2020-07-08 11:24:30 -05:00
Aikar
9cb53a41ca Don't check chunk for portal on world gen entity add 2020-07-05 14:59:31 -04:00
William Blake Galbreath
ea5eaa7503 Add PrepareResultEvent
Adds a new event for all crafting stations that generate a result slot item

Anvil, Grindstone and Smithing now extend this event
2020-07-03 11:58:56 -05:00
Jake Potrebic
50c31de6f0 Improve/fix EntityTargetLivingEntityEvent 2022-12-09 03:10:23 -08:00
Spottedleaf
74550736aa Do not accept invalid client settings 2022-05-07 14:58:53 -07:00
Aikar
2e3c775b68 Fix Per World Difficulty / Remembering Difficulty
Fixes per world difficulty with /difficulty command and also
makes it so that the server keeps the last difficulty used instead
of restoring the server.properties every single load.
2020-06-28 03:59:10 -04:00
Aikar
454ff5e5b9 Ensure Entity position and AABB are never invalid
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
2020-05-10 22:12:46 -04:00
Mariell Hoversholm
2a6962e59e Add permission for command blocks 2020-05-16 10:05:30 +02:00
Spottedleaf
1b13d5c85e Hide sync chunk writes behind flag
Syncing writes on each write call has terrible performance
on harddrives.

-DPaper.enable-sync-chunk-writes=true to enable
2020-06-26 22:35:08 -07:00
JRoy
6a6851c040 Add PlayerRecipeBookClickEvent 2020-06-05 18:24:06 -04:00
Spottedleaf
4c32788db0 Prevent position desync causing tp exploit
Caused the server to revert to the player's overworld coordinates
after teleporting into the end.

Sidenote: The underlying issue is that the move call can teleport
entities and do other things like kill the entity. In the future,
to fix all exploits derieved from this usually unexpected
behaviour, we need to move all of this dangerous logic outside
of the move call and into an appropriate place in the tick method.
2020-06-12 16:51:39 -07:00
David Slovikosky
c637868aef Fix missing chunks due to integer overflow
This patch fixes a bug in the EndIslandDensityFunction class where the distance
from 0,0 squared overflows the maximum size of an integer. The overflow leads
to hard chunk borders around 370,000 blocks from 0,0. After this cutoff there
is a few hundred thousand block gap before end land resuming to generate at
530,000 blocks from spawn. This is due to the integer flipping back and forth.

The fix for the issue is quite simple, casting chunk coordinates to longs
allows the distance calculation to avoid overflow and work as intended.

This issue is being tracked in Mojira ticket MC-159283
2020-06-09 00:10:03 -07:00
Spottedleaf
47dd7e1c0a Fix piston physics inconsistency - MC-188840
Pistons invoke physics when they move blocks. The physics can cause
tnt blocks to ignite. However, pistons (when storing the blocks they "moved")
don't actually go back to the world state sometimes to check if something
like that happened. As a result they end up moving the tnt like it was
never ignited. This resulted in the ability to create machines
that can duplicate tnt, called "world eaters".
This patch makes the piston logic retrieve the block state from the world
prevent this from occuring.

This patch also sets the moved pos to air immediately after creating
the moving piston TE. This prevents the block from being updated from
other physics calls by the piston.

Tested against the following tnt duper design:
https://www.youtube.com/watch?v=mS7xxNGhjxs

This patch also affects every type of machine that utilises
this mechanic. For example, dead coral is removed by a physics
update when being moved while it is attached to slimeblocks.

Standard piston machines that don't destroy or modify the
blocks they move by physics updates should be entirely
unaffected.

This patch fixes https://bugs.mojang.com/browse/MC-188840

This patch also fixes rail duping and carpet duping.
2020-06-11 17:29:42 -07:00
Aikar
6815064398 Use seed based lookup for Treasure Maps - Fixes lag from carto/sunken maps 2020-06-07 19:25:13 -04:00
Phoenix616
1631c7e251 Maps shouldn't load chunks
Previously maps would load all chunks in a certain radius depending on
 their scale when trying to update their content. This would result in
 main thread chunk loads when they weren't really necessary, especially
 on low view distances or "slow" async chunk loads after teleports or
 other prioritisation.

 This changes it to only try to render already loaded chunks based on
 the assumption that the chunks around the player will get loaded
 eventually anyways and that maps will get checked for update every
 five ticks that movement occur in anyways.
2020-06-07 21:43:42 +01:00
chickeneer
2898b4a7eb Fix villager trading demand - MC-163962
Prevent demand from going negative and tending to negative infinity
2020-06-05 20:02:04 -05:00
kickash32
ed712d373a Ensure EntityRaider respects game and entity rules for picking up items 2020-05-09 02:01:48 -04:00
Aikar
74343ef1be Wait for Async Tasks during shutdown
Server.reload() had this logic to give time for tasks to shutdown,
however shutdown did not...

Adds a 5 second grace period for any async tasks to finish and warns
if any are still running after that delay just as reload does.
2020-05-10 22:16:17 -04:00
BillyGalbreath
e91df097e9 ExperienceOrb merging/stacking API and fixes
Adds an option for maximum exp value when merging orbs

Adds ExperienceOrbMergeEvent
Fired when the server is about to merge 2 experience orbs
as entities. Plugins can cancel it if they want to ensure experience orbs do not lose important
metadata such as spawn reason, or conditionally move data from source to target.

Fixes an issue where the stacked count was not taking into account
for mending repairs and when merging with spigot's merge-on-spawn
logic

== AT ==
public net.minecraft.world.entity.ExperienceOrb count

Co-authored-by: Aikar <aikar@aikar.co>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2017-11-10 23:03:12 -05:00
Mariell Hoversholm
e5e4cc7020 Add villager reputation API
== AT ==
public net.minecraft.world.entity.ai.gossip.GossipContainer$EntityGossips
public net.minecraft.world.entity.ai.gossip.GossipContainer$EntityGossips <init>()V
public net.minecraft.world.entity.ai.gossip.GossipContainer gossips
2020-04-22 23:29:20 +02:00
MiniDigger | Martin
82290d3060 Implement Mob Goal API 2020-01-03 16:26:19 +01:00
Shane Freeder
f5cfd89975 Prevent teleporting dead entities 2020-03-03 05:26:40 +00:00
Shane Freeder
35b7f788a9 misc debugging dumps 2021-02-18 20:23:28 +00:00
Aikar
4b1f23c2e8 Fix item duplication and teleport issues
This notably fixes the newest "Donkey Dupe", but also fixes a lot
of dupe bugs in general around nether portals and entity world transfer

We also fix item duplication generically by anytime we clone an item
to drop it on the ground, destroy the source item.

This avoid an itemstack ever existing twice in the world state pre
clean up stage.

So even if something NEW comes up, it would be impossible to drop the
same item twice because the source was destroyed.
2020-04-25 06:46:35 -04:00
William Blake Galbreath
8a71e1c7da Add phantom creative and insomniac controls 2020-04-25 15:13:41 -05:00
Aikar
56752585e8 Don't fire BlockFade on worldgen threads 2020-04-23 01:36:39 -04:00
nossr50
c157d209f3 Add PlayerAttackEntityCooldownResetEvent 2020-03-26 19:44:50 -07:00
2277
dd3e099c9c Move player to spawn point if spawn in unloaded world
If the playerdata contains an invalid world (missing, unloaded, invalid,
etc.), spawn the player at the spawn point of the main world.

Co-authored-by: Wyatt Childers <wchilders@nearce.com>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2020-03-31 10:33:55 +01:00
Aikar
d7f24e6729 Fire PlayerJoinEvent when Player is actually ready
For years, plugin developers have had to delay many things they do
inside of the PlayerJoinEvent by 1 tick to make it actually work.

This all boiled down to 1 reason why: The event fired before the
player was fully ready and joined to the world!

Additionally, if that player logged out on a vehicle, the event
fired before the vehicle was even loaded, so that plugins had no
access to the vehicle during this event either.

This change finally fixes this issue, fully preparing the player
into the world as a fully ready entity, vehicle included.

There should be no plugins that break because of this change, but might
improve consistency with other plugins instead.

For example, if 2 plugins listens to this event, and the first one
teleported the player in the event, then the 2nd plugin actually
would be getting a valid player!

This was very non deterministic. This change will ensure every plugin
receives a deterministic result, and should no longer require 1 tick
delays anymore.

== AT ==
public net.minecraft.server.level.ChunkMap addEntity(Lnet/minecraft/world/entity/Entity;)V
2020-04-19 00:05:46 -04:00
Aikar
b7898433d0 Don't crash if player is attempted to be removed from untracked chunk.
I suspect it deals with teleporting as it uses players current x/y/z
2020-04-18 15:59:41 -04:00
MiniDigger | Martin
57802a490d Implement Player Client Options API
== AT ==
public net.minecraft.world.entity.player.Player DATA_PLAYER_MODE_CUSTOMISATION
public net.minecraft.server.level.ServerPlayer particleStatus
2020-01-20 21:38:15 +01:00
Spottedleaf
3d63d68ecb Don't run entity collision code if not needed
Will not run if:
Max entity cramming is disabled and the max collisions per entity is less than or equal to 0.
Entity#isPushable() returns false, meaning all entities will not be able to collide with this
entity anyways.
The entity's current team collision rule causes them to NEVER collide.

Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
2020-04-15 17:56:07 -07:00
Shane Freeder
6b7013458d Prevent opening inventories when frozen 2020-04-13 07:31:44 +01:00
Spottedleaf
ee1fd0844d Reduce memory footprint of CompoundTag
Fastutil maps are going to have a lower memory footprint - which
is important because we clone chunk data after reading it for safety.
So, reduce the impact of the clone on GC.
2020-04-06 17:39:25 -07:00
Spottedleaf
60c674b750 Reduce Either Optional allocation
In order to get chunk values, we shouldn't need to create
an optional each time.
2020-04-06 18:35:09 -07:00
Aikar
aa8e04867f Optimize Pathfinding
Prevents pathfinding from spamming failures for things such as
arrow attacks.
2016-03-03 02:02:07 -06:00
Aikar
7659c20386 Don't move existing players to world spawn
This can cause a nasty server lag the spawn chunks are not kept loaded
or they aren't finished loading yet, or if the world spawn radius is
larger than the keep loaded range.

By skipping this, we avoid potential for a large spike on server start.

== AT ==
public net.minecraft.server.level.ServerPlayer fudgeSpawnLocation(Lnet/minecraft/server/level/ServerLevel;)V
2020-04-09 21:20:33 -04:00
Aikar
6242e1dad0 Dead Player's shouldn't be able to move
This fixes a lot of game state issues where packets were delayed for processing
due to 1.15's new queue but processed while dead.
2020-04-02 19:31:16 -04:00
Aikar
e7044bdebb Don't tick dead players
Causes sync chunk loads and who knows what all else.
This is safe because Spectators are skipped in unloaded chunks too in vanilla.
2020-04-02 17:16:48 -04:00
Aikar
ac79088eb6 Prevent Double PlayerChunkMap adds crashing server
Suspected case would be around the technique used in .stopRiding
Stack will identify any causer of this and warn instead of crashing.
2020-04-02 01:42:39 -04:00
chickeneer
c569dccd4e Do not allow Vexes to load chunks 2020-03-17 14:18:50 -05:00
Aikar
a44dc35353 Remote Connections shouldn't hold up shutdown
Bugs in the connection logic appears to leave stale connections even, preventing shutdown
2020-03-31 03:50:42 -04:00
Phoenix616
1273cf0f21 Pillager patrol spawn settings and per player options
This adds config options for defining the spawn chance, spawn delay and
spawn start day as well as toggles for handling the spawn delay and
start day per player. (Based on the time played statistic)
When not per player it will use the Vanilla mechanic of one delay per
world and the world age for the start day.
2020-02-01 16:50:39 +01:00
William Blake Galbreath
db792f5e1d Add tick times API and /mspt command 2020-04-05 22:23:14 -05:00
Spottedleaf
34933f9884 Optimise Chunk#getFluid
Removing the try catch and generally reducing ops should make it
faster on its own, however removing the try catch makes it
easier to inline due to code size
2020-01-14 14:59:08 -08:00
Zero
05df94d332 Configurable chance of villager zombie infection
This allows you to solve an issue in vanilla behavior where:
* On easy difficulty your villagers will NEVER get infected, meaning they will always die.
* On normal difficulty they will have a 50% of getting infected or dying.
2020-02-22 16:10:31 -05:00
William Blake Galbreath
fd378a7262 Add option to allow iron golems to spawn in air 2019-04-13 16:50:58 -05:00
Shane Freeder
26067ca04b Validate tripwire hook placement before update 2020-03-07 00:07:51 +00:00
William Blake Galbreath
fa7c667a3e Make the GUI graph fancier 2020-02-02 04:00:40 -06:00
William Blake Galbreath
196c153504 Add option to nerf pigmen from nether portals 2020-02-07 14:36:56 -06:00
BillyGalbreath
0dd8044178 Entity Jump API
== AT ==
public net.minecraft.world.entity.LivingEntity jumping
2020-02-08 23:26:11 -06:00
William Blake Galbreath
4e20691d59 Add ThrownEggHatchEvent
Adds a new event similar to PlayerEggThrowEvent, but without the Player requirement
(dispensers can throw eggs to hatch them, too).
2020-02-09 00:19:05 -06:00
Spottedleaf
f179cfaff2 Add debug for sync chunk loads
This patch adds a tool to find calls to getChunkAt which would load
chunks, however it must be enabled by setting the startup flag
-Dpaper.debug-sync-loads=true

- To get a debug log for sync loads, the command is
  /paper syncloadinfo
- To clear clear the currently stored sync load info, use
  /paper syncloadinfo clear
2019-07-19 03:29:14 -07:00
Jake Potrebic
2ce266b657 Improve Block#breakNaturally API
Adds bool parameter to play world effect on block break

Adds bool parameter to drop xp from blocks

Fixes fluid-logged blocks not leaving fluid behind if
broken

Handles special cases for ice and turtle eggs

== AT ==
public net.minecraft.world.level.block.TurtleEggBlock decreaseEggs(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)V

Co-authored-by: William Blake Galbreath <Blake.Galbreath@GMail.com>
2020-01-02 12:25:07 -06:00
William Blake Galbreath
e4290a3697 Bees get gravity in void. Fixes MC-167279 2020-01-26 16:30:19 -06:00
kickash32
c7b38e2bc7 Tracking Range Improvements
Sets tracking range of watermobs to animals instead of misc and simplifies code

Also ignores Enderdragon, defaulting it to Mojang's setting
2019-12-21 15:22:09 -05:00
kickash32
7b1d3d673a Alternative item-despawn-rate
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
2019-06-03 02:02:39 -04:00
Spottedleaf
c33f47103e Guard against serializing mismatching chunk coordinate
Should help if something dumb happens
2019-12-27 09:42:26 -08:00
BrodyBeckwith
2eb4908754 Optimize call to getFluid for explosions 2020-01-14 17:49:03 -05:00
Nassim Jahnke
8a2c2db2a5 Fix item EAR ticks
Item entities only have their gravity ticked every 4 ticks when on ground.
Fix that and also remove Spigot's arbitrary tick skipping. It's a terribly
cheap way of getting extra performance that doesn't really work at all.
2024-10-30 13:51:54 +01:00
Spottedleaf
b948d38658 Optimise EntityGetter#getPlayerByUUID
Use the PlayerList map instead of iterating over all players
2020-01-11 21:50:56 -08:00
Aikar
a91c1c2d18 Don't load Chunks from Hoppers and other things
Hoppers call this to I guess "get the primary side" of a double sided chest.

If the double sided chest crosses chunk lines, it causes the chunk to load.
This will end up causing sync chunk loads, which will unload with Chunk GC,
only to be reloaded again the next tick.

This of course is undesirable, so just return the loaded side as "primary"
and treat it as a single chest if the other sides are unloaded
2016-11-03 20:28:12 -04:00
William Blake Galbreath
0e5a5711fc Prevent bees loading chunks checking hive position 2020-01-05 17:24:34 -06:00
Shane Freeder
0664232c53 PlayerDeathEvent#shouldDropExperience 2019-12-24 00:35:42 +00:00
Aikar
cd2f06bbc2 Duplicate UUID Resolve Option
Due to a bug in 2e29af3df0
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:27:34 -04:00
Callahan
a0513959ea Prevent sync chunk loads when villagers try to find beds 2020-01-13 23:47:28 -06:00
William Blake Galbreath
a0dc4eeb99 Add option to disable pillager patrols 2019-10-09 21:46:15 -05:00
Nassim Jahnke
ccc1107255 Dont send unnecessary sign update 2021-09-11 11:56:51 +02:00
kickash32
2cb6b995cc Prevent consuming the wrong itemstack 2019-08-19 19:42:35 +05:00
kickash32
0198ee9c8a offset item frame ticking 2019-07-30 03:17:16 +05:00
Lucavon
a89e4e6ae3 Configurable projectile relative velocity
This patch adds an option "disable relative projectile velocity", which, when
enabled, will cause projectiles to ignore the shooter's current velocity,
like they did in Minecraft 1.8 and prior.
If a player is falling, for example, their shooting range will be drastically
reduced, as a downwards velocity is applied to the projectile. This prevents
players from saving themselves from falling off floating islands, for example,
as a thrown ender pearl will not make it back to the island, while it would
have in 1.8.

While this could easily be done with plugins, too, there are multiple problems:
P1) If multiple plugins cancel the velocity by subtracting the shooter's velocity
from the projectile's velocity, the projectile's velocity would be different.
As there's no way to detect whether the projectile's velocity has already been
adjusted to ignore the player's velocity, plugins can't not do it if it's not
necessary.
P2) I've noticed some inconsistencies, e.g. weird velocity when shooting while
using an elytra. Checking for those inconsistencies is possible, but not as
efficient as just not applying the velocity in the first place.
P3) Solutions for 1) and especially 2) might not be future-proof, while this
server-internal fix makes this change future-proof.
2019-07-23 20:29:20 -05:00
Aikar
2cd6ace7ab Only count Natural Spawned mobs towards natural spawn mob limit
This resolves the super common complaint about mobs not spawning.

This was ultimately a flaw in the vanilla count algorithim that allows
spawners and other misc mobs to count against the mob limit, which are
not bounded, and can prevent the entire world from spawning new.

I believe Bukkits changes around persistence may of actually made it
worse than vanilla.

This should fully solve all of the issues around it so that only natural
influences natural spawns.
2019-03-24 01:01:32 -04:00
Phoenix616
f5be267fbf Fix sounds when item frames are modified (MC-123450)
This also fixes the adding sound playing when the item frame direction is changed.
2019-04-27 20:00:43 +01:00
Shane Freeder
26c77784e5 Fix CB call to changed postToMainThread method 2019-05-10 18:38:19 +01:00
William Blake Galbreath
b68af3dfa1 Mob Spawner API Enhancements
== AT ==
public net.minecraft.world.level.BaseSpawner isNearPlayer(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)Z
public net.minecraft.world.level.BaseSpawner delay(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)V
public net.minecraft.world.level.BaseSpawner setNextSpawnData(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/SpawnData;)V
2019-04-19 12:41:13 -05:00
Aikar
5630b55346 Optimize Captured BlockEntity Lookup
upstream was doing a containsKey/get pattern, and always doing it at that.
that scenario is only even valid if were in the middle of a block place.

Optimize to check if the captured list even has values in it, and also to
just do a get call since the value can never be null.
2019-04-06 10:16:48 -04:00
Aikar
18f38c3167 PlayerDeathEvent#getItemsToKeep
Exposes a mutable array on items a player should keep on death

Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4

== AT ==
public net.minecraft.world.entity.player.Inventory compartments
2019-03-27 23:01:33 -04:00
Aikar
8e13bc622b Server Tick Events
Fires event at start and end of a server tick
2019-03-27 22:48:45 -04:00
MisterVector
4ee0744e6d Add PlayerPostRespawnEvent 2018-10-26 21:31:00 -07:00
Mark Vainomaa
2433988460 Fire event on GS4 query 2019-03-17 21:46:56 +02:00
Aikar
0b77748b35 Fixes and additions to the spawn reason API
Expose an entities spawn reason on the entity.
Pre existing entities will return NATURAL if it was a non
persistenting Living Entity, SPAWNER for spawners,
or DEFAULT since data was not stored.

Additionally, add missing spawn reasons.

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Doc <nachito94@msn.com>
2019-03-24 00:24:52 -04:00
Mark Vainomaa
19bd3b2655 Call WhitelistToggleEvent when whitelist is toggled 2019-03-13 20:08:09 +02:00
Aikar
04c783377e Limit Client Sign length more
modified clients can send more data from the client
to the server and it would get stored on the sign as sent.

Mojang has a limit of 384 which is much higher than reasonable.

the client can barely render around 16 characters as-is, but formatting
codes can get it to be more than 16 actual length.

Set a limit of 80 which should give an average of 16 characters 2
sets of legacy formatting codes which should be plenty for all uses.

This does not strip any existing data from the NBT as plugins
may use this for storing data out of the rendered area.

it only impacts data sent from the client.

Set -DPaper.maxSignLength=XX to change limit or -1 to disable
2019-02-27 22:18:40 -05:00
Aikar
05f977e3d1 Brigadier Mojang API
Adds AsyncPlayerSendCommandsEvent
  - Allows modifying on a per command basis what command data they see.

Adds CommandRegisteredEvent
  - Allows manipulating the CommandNode to add more children/metadata for the client
2020-04-19 18:15:29 -04:00
Callahan
41218728d9 Async command map building
This adds a custom pool inorder to make sure that they are closed
without much though, as it doesn't matter if the client is not sent
commands if the server is restarting. Using the default async pool caused issues to arise
due to the shutdown logic generally being much later.
2020-04-08 02:42:14 -05:00
Aikar
b71ceb5e0f BlockDestroyEvent
Adds an event for when the server is going to destroy a current block,
potentially causing it to drop. This event can be cancelled to avoid
the block destruction, such as preventing signs from popping when
floating in the air.

This can replace many uses of BlockPhysicsEvent
2019-02-06 00:20:33 -05:00
connorhartley
2c43d196e4 Workaround for vehicle tracking issue on disconnect 2019-01-07 14:43:48 -06:00
Zach Brown
f1f016dd5e Replace OfflinePlayer#getLastPlayed
Currently OfflinePlayer#getLastPlayed could more accurately be described
as "OfflinePlayer#getLastTimeTheirDataWasSaved".

The API doc says it should return the last time the server "witnessed"
the player, whilst also saying it should return the last time they
logged in. The current implementation does neither.

Given this interesting contradiction in the API documentation and the
current defacto implementation, I've elected to deprecate (with no
intent to remove) and replace it with two new methods, clearly named and
documented as to their purpose.
2019-01-02 00:35:43 -06:00
Spottedleaf
f5226d3739 Add PlayerConnectionCloseEvent
This event is invoked when a player has disconnected. It is guaranteed that,
if the server is in online-mode, that the provided uuid and username have been
validated.

The event is invoked for players who have not yet logged into the world, whereas
PlayerQuitEvent is only invoked on players who have logged into the world.

The event is invoked for players who have already logged into the world,
although whether or not the player exists in the world at the time of
firing is undefined. (That is, whether the plugin can retrieve a Player object
using the event parameters is undefined). However, it is guaranteed that this
event is invoked AFTER PlayerQuitEvent, if the player has already logged into
the world.

This event is guaranteed to never fire unless AsyncPlayerPreLoginEvent has
been called beforehand, and this event may not be called in parallel with
AsyncPlayerPreLoginEvent for the same connection.

Cancelling the AsyncPlayerPreLoginEvent guarantees the corresponding
PlayerConnectionCloseEvent is never called.

The event may be invoked asynchronously or synchronously. As it stands,
it is never invoked asynchronously. However, plugins should check
Event#isAsynchronous to be future-proof.

On purpose, the deprecated PlayerPreLoginEvent event is left out of the
API spec for this event. Plugins should not be using that event, and
how PlayerPreLoginEvent interacts with PlayerConnectionCloseEvent
is undefined.

== AT ==
public net.minecraft.server.network.ServerLoginPacketListenerImpl$State
public net.minecraft.server.network.ServerLoginPacketListenerImpl state
2018-10-07 12:05:28 -07:00
Aikar
a1a073eaae Book size limits
Puts some limits on the size of books.
2018-11-16 23:08:50 -05:00
BillyGalbreath
ea164c2f4a Add more Zombie API
== AT ==
public net.minecraft.world.entity.monster.Zombie isSunSensitive()Z
2018-10-07 04:29:59 -05:00
Shane Freeder
373c8ff0b2 force entity dismount during teleportation
Entities must be dismounted before teleportation in order to avoid
multiple issues in the server with regards to teleportation, shamefully,
too many plugins rely on the events firing, which means that not firing
these events caues more issues than it solves;

In order to counteract this, Entity dismount/exit vehicle events have
been modified to supress cancellation (and has a method to allow plugins
to check if this has been set), noting that cancellation will be silently
surpressed given that plugins are not expecting this event to not be cancellable.

This is a far from ideal scenario, however: given the current state of this
event and other alternatives causing issues elsewhere, I believe that
this is going to be the best soultion all around.

Improvements/suggestions welcome!
2018-11-15 13:38:37 +00:00
Shane Freeder
4da5176b89 Don't allow digging into unloaded chunks 2018-11-11 21:01:09 +00:00
Shane Freeder
52ea2a0cd9 Fix SpongeAbsortEvent handling
Only process drops when the block is actually going to be removed
2018-11-10 05:15:21 +00:00
Aikar
1d1ddeccb9 Optimize World Time Updates
Splits time updates into incremental updates as well as does
the updates per world, so that we can re-use the same packet
object for every player unless they have per-player time enabled.
2018-11-02 23:11:51 -04:00
Aikar
9902ba8869 Improve Server Thread Pool and Thread Priorities
Use a simple executor since Fork join is a much more complex pool
type and we are not using its capabilities.

Set thread priorities so main thread has above normal priority over
server threads

Allow usage of a single thread executor by not using ForkJoin so single core CPU's
and reduce worldgen thread worker count for low core count CPUs.

== AT ==
public net.minecraft.Util onThreadException(Ljava/lang/Thread;Ljava/lang/Throwable;)V

Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
2018-10-23 23:14:38 -04:00
Aikar
539f1ba018 Don't sleep after profile lookups if not needed
Mojang was sleeping even if we had no more requests to go after
the current one finished, resulting in 100ms lost per profile lookup
2018-10-23 20:25:05 -04:00
GreenMeanie
a48e72fb4d Reset players airTicks on respawn 2018-10-20 22:34:02 -04:00
Gabriele C
7c062523e0 Add option to prevent players from moving into unloaded chunks #1551 2018-10-22 17:34:10 +02:00
BillyGalbreath
8f806f31bb Check Drowned for Villager Aggression Config 2018-10-10 21:22:44 -05:00
BillyGalbreath
a24fb45a27 Add more Witch API
== AT ==
public net.minecraft.world.entity.monster.Witch usingTime
2018-10-12 14:10:46 -05:00
Caleb Bassham
473a79e490 Call player spectator target events and improve implementation
Use a proper teleport for teleporting to entities in different
worlds.

Implementation improvements authored by Spottedleaf <Spottedleaf@users.noreply.github.com>
Validate that the target entity is valid and deny spectate
requests from frozen players.

Also, make sure the entity is spawned to the client before
sending the camera packet. If the entity isn't spawned clientside
when it receives the camera packet, then the client will not
spectate the target entity.

Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
2018-09-28 02:32:19 -05:00
BillyGalbreath
fb18e19bb0 Turtle API
== AT ==
public net.minecraft.world.entity.animal.Turtle getHomePos()Lnet/minecraft/core/BlockPos;
public net.minecraft.world.entity.animal.Turtle setHasEgg(Z)V
public net.minecraft.world.entity.animal.Turtle isGoingHome()Z
public net.minecraft.world.entity.animal.Turtle setGoingHome(Z)V
public net.minecraft.world.entity.animal.Turtle isTravelling()Z
public net.minecraft.world.entity.animal.Turtle setTravelling(Z)V
2018-09-29 16:08:23 -05:00
BillyGalbreath
5a43ef8127 Add LivingEntity#getTargetEntity 2018-09-22 00:33:08 -05:00
Phoenix616
b2cbea9e63 PreSpawnerSpawnEvent
This adds a separate event before an entity is spawned by a spawner
which contains the location of the spawner too similarly to how the
SpawnerSpawnEvent gets called instead of the CreatureSpawnEvent for
spawners.
2018-09-18 23:53:23 +01:00
Aikar
8ea84d0962 Prevent chunk loading from Fluid Flowing 2018-09-10 23:36:16 -04:00
Shane Freeder
fed1922643 Configurable connection throttle kick message 2018-10-02 09:57:50 +01:00
BillyGalbreath
46109028f9 Honor EntityAgeable.ageLock 2018-09-23 20:59:53 -05:00
Tassu
4bea989f34 Implement furnace cook speed multiplier API
Fixed an issue where a furnace's cook-speed multiplier rounds down
to the nearest Integer when updating its current cook time.

== AT ==
public net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity getTotalCookTime(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity;)I

Co-authored-by: Eric Su <ericsu@alumni.usc.edu>
2018-09-13 08:45:21 +03:00
Aikar
ac503c148a Prevent mob spawning from loading/generating chunks
also prevents if out of world border bounds
2018-09-12 21:12:57 -04:00
Aikar
54b44d1f1c Prevent various interactions from causing chunk loads
Co-authored-by: Shane Freeder <theboyetronic@gmail.com>
2018-09-10 23:56:36 -04:00
Aikar
ca42ec8f4e Mob Pathfinding API
Implements Pathfinding API for mobs

== AT ==
public net.minecraft.world.entity.ai.navigation.PathNavigation pathFinder
public net.minecraft.world.level.pathfinder.PathFinder nodeEvaluator
public net.minecraft.world.level.pathfinder.Path nodes
2018-09-09 13:30:00 -04:00
BillyGalbreath
ca341c9de8 Allow chests to be placed with NBT data 2018-09-08 18:43:31 -05:00
Phoenix616
04afedcccf Improve death events
This adds the ability to cancel the death events and to modify the sound
an entity makes when dying. (In cases were no sound should it will be
called with shouldPlaySound set to false allowing unsilencing of silent
entities)

It makes handling of entity deaths a lot nicer as you no longer need
to listen on the damage event and calculate if the entity dies yourself
to cancel the death which has the benefit of also receiving the dropped
items and experience which is otherwise only properly possible by using
internal code.

== AT ==
public net.minecraft.world.entity.LivingEntity getDeathSound()Lnet/minecraft/sounds/SoundEvent;
public net.minecraft.world.entity.LivingEntity getSoundVolume()F
2018-08-21 01:39:35 +01:00
BillyGalbreath
228730983d Add ray tracing methods to LivingEntity 2018-09-03 18:20:03 -05:00
BillyGalbreath
bfd8b7bcef Add More Creeper API 2018-08-24 11:50:26 -05:00
BillyGalbreath
f6b20dccfc Add PhantomPreSpawnEvent 2018-08-25 19:56:51 -05:00
Aikar
1ef5dc7644 Optimize MappedRegistry
Use larger initial sizes to increase bucket capacity on the BiMap

BiMap.get was seen to be using a good bit of CPU time.
2018-08-26 20:49:50 -04:00
miclebrick
68e76b43b8 Optimize CraftBlockData Creation
Avoids a hashmap lookup by cacheing a reference to the CraftBlockData
and cloning it when one is needed.
2018-08-23 11:45:32 -04:00
Byteflux
28ea7bb560 Configurable speed for water flowing over lava 2018-08-08 16:33:21 -06:00
BillyGalbreath
14aa197675 Slime Pathfinder Events 2018-08-24 08:18:42 -05:00
Spottedleaf
4e0ee05920 Optimize BlockPosition helper methods 2018-08-15 12:05:12 -07:00
Aikar
d178f73bb8 Use a Queue for Queueing Commands
Lists are bad as Queues mmmkay.
2018-08-12 02:33:39 -04:00
egg82
f6519a79fe Use ConcurrentHashMap in JsonList
This is specifically aimed at fixing #471

Using a ConcurrentHashMap because thread safety
The performance benefit of Map over ConcurrentMap is negligabe at best in this scenaio, as most operations will be get and not add or remove
Even without considering the use-case the benefits are still negligable

Original ideas for the system included an expiration policy and/or handler
The simpler solution was to use a computeIfPresent in the get method
This will simultaneously have an O(1) lookup time and automatically expire any values
Since the get method (nor other similar methods) don't seem to have a critical need to flush the map to disk at any of these points further processing is simply wasteful
Meaning the original function expired values unrelated to the current value without actually having any explicit need to

The h method was heavily modified to be much more efficient in its processing
Also instead of being called on every get, it's now called just before a save
This will eliminate stale values being flushed to disk

Modified isEmpty to use the isEmpty() method instead of the slightly confusing size() < 1
The point of this is readability, but does have a side-benefit of a small microptimization
2018-08-07 01:24:23 -06:00
miclebrick
31fc02af68 Add Early Warning Feature to WatchDog
Detect when the server has been hung for a long duration, and start printing
thread dumps at an interval until the point of crash.

This will help diagnose what was going on in that time before the crash.
2018-08-08 15:30:52 -04:00
Aikar
2f4d83a219 Add Debug Entities option to debug dupe uuid issues 2018-07-21 08:25:40 -04:00
Aikar
223c6c3b5a Remove unnecessary itemmeta handling 2016-11-22 00:40:42 -05:00
Aikar
394e4c04f7 Fix NBT type issues
Addresses two issues:
- MC-135506: Experience should save as Integers
- Allay duplication cooldown is saved and exposed as a long, but loaded as an int
2018-08-03 00:04:54 -04:00
Shane Freeder
88409ad861 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.
2018-07-29 05:02:15 +01:00
Mark Vainomaa
30f16143ba Add TNTPrimeEvent 2018-07-16 00:05:05 +03:00
BillyGalbreath
f20fbf5477 AnvilDamageEvent 2018-07-20 23:37:03 -05:00
BillyGalbreath
da011362dc SkeletonHorse Additions 2018-07-27 22:36:31 -05:00
Riley Park
c0a3a0d12c Allow disabling armor stand ticking 2018-08-15 01:26:09 -07:00
Hugo Manrique
510b8187c7 Vanished players don't have rights 2018-07-23 14:22:26 +02:00
Hugo Manrique
1549b076df Option to prevent armor stands from doing entity lookups 2018-07-23 12:57:39 +02:00
Techcable
85be8cc620 Improve BlockPosition inlining
Normally the JVM can inline virtual getters by having two sets of code, one is the 'optimized' code and the other is the 'deoptimized' code.
If a single type is used 99% of the time, then its worth it to inline, and to revert to 'deoptimized' the 1% of the time we encounter other types.
But if two types are encountered commonly, then the JVM can't inline them both, and the call overhead remains.

This scenario also occurs with BlockPos and MutableBlockPos.
The variables in BlockPos are final, so MutableBlockPos can't modify them.
MutableBlockPos fixes this by adding custom mutable variables, and overriding the getters to access them.

This approach with utility methods that operate on MutableBlockPos and BlockPos.
Specific examples are BlockPosition.up(), and World.isValidLocation().
It makes these simple methods much slower than they need to be.

This should result in an across the board speedup in anything that accesses blocks or does logic with positions.

This is based upon conclusions drawn from inspecting the assenmbly generated bythe JIT compiler on my microbenchmarks.
They had 'callq' (invoke) instead of 'mov' (get from memory) instructions.
2016-11-30 20:56:58 -06:00
BillyGalbreath
925d397466 PlayerLaunchProjectileEvent 2018-07-21 03:11:03 -05:00
BillyGalbreath
a949eef7aa PlayerElytraBoostEvent 2018-07-21 01:59:59 -05:00
BillyGalbreath
e054d501fb EnderDragon Events 2018-07-21 01:51:27 -05:00
Aikar
eb528f5f37 add more information to Entity.toString()
UUID, ticks lived, valid, dead
2018-07-19 01:13:28 -04:00
Aikar
3430a002d1 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:56:23 -04:00
BillyGalbreath
b7f23ee86d Add config to disable ender dragon legacy check 2018-06-22 10:38:31 -05:00
Aikar
dddd41ac34 Expand Explosions API
Add Entity as a Source capability, and add more API choices, and on Location.

Co-authored-by: Esoteric Enderman <90862990+EsotericEnderman@users.noreply.github.com>
Co-authored-by: Bjarne Koll <git@lynxplay.dev>
2018-06-20 23:17:24 -04:00
Brokkonaut
991875920d Add entity knockback events
- EntityKnockbackEvent
- EntityPushedByEntityAttackEvent
- EntityKnockbackByEntityEvent

Co-authored-by: aerulion <aerulion@gmail.com>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2018-06-18 15:46:23 +02:00
Aikar
d68fcd321f 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:12:53 -04:00
Aikar
26ade76848 Improve EntityShootBowEvent
Adds missing call to Illagers and also adds Arrow ItemStack to skeletons

== AT ==
public net.minecraft.world.entity.projectile.AbstractArrow getPickupItem()Lnet.minecraft.world.item.ItemStack;
2013-06-15 19:51:17 -04:00
BillyGalbreath
2d9d74f9a9 Make shield blocking delay configurable 2018-06-16 01:18:16 -05:00
Aikar
4ec0188c4d Print Error details when failing to save player data 2018-06-15 20:37:03 -04:00
Aikar
d50334d6e8 Configurable 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:30:32 -04:00
Aikar
809fa1fbea Unset Ignited flag on cancel of Explosion Event
Otherwise the creeper infinite explodes
2018-06-10 01:18:49 -04:00
Shane Freeder
d6d2d75fe6 Add EntityTeleportEndGatewayEvent 2018-06-09 14:08:39 +02:00
Aikar
b64e7f96d3 WitchReadyPotionEvent 2018-06-05 22:47:26 -04:00
Aikar
a3b5f969ed WitchThrowPotionEvent
Fired when a witch throws a potion at a player
2018-05-16 20:44:58 -04:00
Aikar
72743537f4 WitchConsumePotionEvent
Fires when a witch consumes the potion in their hand
2018-05-16 20:35:16 -04:00
Aikar
40e2712d61 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:18:54 -04:00
0x22
952a6d631c Fix exploit that allowed colored signs to be created 2018-04-26 04:41:11 -04:00
Aikar
634b639098 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.
Adds an option to control the force mode of the particle.

This adds a new Builder API which is much friendlier to use.
2017-08-15 22:29:12 -04:00
Aikar
b4ece1619f 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.
2018-04-30 13:15:55 -04:00
Brokkonaut
5a528af05e Configurable sprint interruption on attack
If the sprint interruption is disabled players continue sprinting when they attack entities.
2018-04-14 20:20:46 +02:00
Minecrell
0511551203 Call PaperServerListPingEvent for legacy pings 2017-10-11 19:30:51 +02:00
Minecrell
361fc3ab43 Make 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
2017-10-11 18:22:50 +02:00
Aikar
d0d0b1a21e Player.setPlayerProfile API
This can be useful for changing name or skins after a player has logged in.

== AT ==
public-f net.minecraft.world.entity.player.Player gameProfile
2018-03-18 12:29:48 -04:00
Aikar
5fb78725e4 Add more fields to AsyncPreLoginEvent
Co-authored-by: Connor Linfoot <connorlinfoot@me.com>
Co-authored-by: MCMDEV <john-m.1@gmx.de>
2018-03-18 11:45:57 -04:00
Minecrell
ac0c06a72f Implement extended PaperServerListPingEvent 2017-10-11 15:56:26 +02:00
Aikar
a7bc7ca33a Disable Explicit Network Manager Flushing
This seems completely pointless, as packet dispatch uses .writeAndFlush.

Things seem to work fine without explicit 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.explicit-flush=true
2018-03-11 14:13:33 -04:00
MiniDigger | Martin
b9319698ce Toggleable player crits 2018-03-10 00:50:24 +01:00
Shane Freeder
794fc9799b Extend Player Interact cancellation
GUIs are opened on the client, meaning that the server cannot block them from opening,
However, it is possible to close these GUIs from the server.

Flower pots are also not updated on the client when interaction is cancelled, this patch
also resolves this.
2018-02-11 10:43:46 +00:00
BillyGalbreath
ec3ae43c82 Add PlayerAdvancementCriterionGrantEvent 2018-01-19 08:15:29 -06:00
Aikar
4f248b1b5b Fill Profile Property Events
Allows plugins to populate profile properties from local sources to avoid calls out to Mojang API
to fill in textures for example.

If Mojang API does need to be hit, event fire so you can get the results.

This is useful for implementing a ProfileCache for Player Skulls
2018-01-02 00:31:26 -05:00
Aikar
cad0c129c8 PreCreatureSpawnEvent
Adds an event to fire before an Entity is created, so that plugins that need to cancel
CreatureSpawnEvent can do so from this event instead.

Cancelling CreatureSpawnEvent rapidly causes a lot of garbage collection and CPU waste
as it's done after the Entity object has been fully created.

Mob Limiting plugins and blanket "ban this type of monster" plugins should use this event
instead and save a lot of server resources.

See: https://github.com/PaperMC/Paper/issues/917
2018-01-14 17:01:31 -05:00
Aikar
f249b1f39a PlayerNaturallySpawnCreaturesEvent
This event can be used for when you want to exclude a certain player
from triggering monster spawns on a server.

Also a highly more effecient way to blanket block spawns in a world
2018-01-14 17:36:02 -05:00
Aikar
533b86c3fc PlayerPickupExperienceEvent
Allows plugins to cancel a player picking up an experience orb
2017-12-19 22:02:53 -05:00
Jason Penilla
ed76af5637 AsyncTabCompleteEvent
Let plugins be able to control tab completion of commands and chat async.

This will be useful for frameworks like ACF so we can define async safe completion handlers,
and avoid going to main for tab completions.

Especially useful if you need to query a database in order to obtain the results for tab
completion, such as offline players.

Also adds isCommand and getLocation to the sync TabCompleteEvent

Co-authored-by: Aikar <aikar@aikar.co>
2017-11-26 13:19:58 -05:00
Aikar
eb20b0b160 API to get a BlockState without a snapshot
This allows you to get a BlockState without creating a snapshot, operating
on the real tile entity.

This is useful for where performance is needed

also Avoid NPE during CraftBlockEntityState load if could not get TE

If Tile Entity was null, correct Sign to return empty lines instead of null
2017-11-06 21:08:22 -05:00
Shane Freeder
1d1c5a4493 use CB BlockState implementations for captured blocks
When modifying the world, CB will store a copy of the affected
blocks in order to restore their state in the case that the event
is cancelled. This change only modifies the collection of blocks
in the world by normal means, e.g. not during tree population,
as the potentially marginal overheads would serve no advantage.

CB was using a CraftBlockState for all blocks, which causes issues
should any block that uses information beyond a data ID would suffer
from missing information, e.g. Skulls.

By using CBs CraftBlock#getState(), we will maintain a proper copy of
the blockstate that will be valid for restoration, as opposed to dropping
information on restoration when the event is cancelled.
2017-11-16 12:12:41 +00:00
mezz
f1fd83ac7a Fix MC-117075: Block entity unload lag spike 2017-08-09 17:51:22 -05:00
killme
3ce6b37e05 Prevent logins from being processed when the player has disconnected 2017-11-12 19:40:01 +01:00
pkt77
540274bcf2 Add PlayerArmorChangeEvent 2017-11-10 23:46:34 -05:00
Brokkonaut
e0661a5f13 Send attack SoundEffects only to players who can see the attacker 2017-10-31 03:26:18 +01:00
Shane Freeder
2c11c3e2bb revert serverside behavior of keepalives
This patch intends to bump up the time that a client has to reply to the
server back to 30 seconds as per pre 1.12.2, which allowed clients
more than enough time to reply potentially allowing them to be less
tempermental due to lag spikes on the network thread, e.g. that caused
by plugins that are interacting with netty.

We also add a system property to allow people to tweak how long the server
will wait for a reply. There is a compromise here between lower and higher
values, lower values will mean that dead connections can be closed sooner,
whereas higher values will make this less sensitive to issues such as spikes
from networking or during connections flood of chunk packets on slower clients,
 at the cost of dead connections being kept open for longer.
2017-10-15 00:29:07 +01:00
Minecrell
8838089321 Expose client protocol version and virtual host 2017-10-10 18:45:20 +02:00
Shane Freeder
70e24c1b60 handle ServerboundKeepAlivePacket async
In 1.12.2, Mojang moved the processing of ServerboundKeepAlivePacket off the main
thread, while entirely correct for the server, this causes issues with
plugins which are expecting the PlayerQuitEvent on the main thread.

In order to counteract some bad behavior, we will post handling of the
disconnection to the main thread, but leave the actual processing of the packet
off the main thread.

also adding some additional logging in order to help work out what is causing
random disconnections for clients.
2017-10-05 01:54:07 +01:00
Zach Brown
8c951e13df Add PlayerJumpEvent 2017-09-28 17:21:44 -04:00
Riley Park
ebbb3ee8b5 Allow specifying a custom "authentication servers down" kick message 2017-08-17 16:08:20 -07:00
BillyGalbreath
d00d3df166 Reset spawner timer when spawner event is cancelled 2017-07-31 01:45:19 -05:00
BillyGalbreath
08aaee1b77 Ocelot despawns should honor nametags and leash 2017-07-31 01:54:40 -05:00
Kyle Wood
0dcb203960 Fix this stupid bullshit
Disable the 15 second sleep when the server jar hasn't been rebuilt within a period of time.

modified in order to prevent merge conflicts when Spigot changes/disables the warning,
and to provide some level of hint without being disruptive.
2017-08-06 17:17:53 -05:00
Aikar
2f6c221649 ProfileWhitelistVerifyEvent 2017-07-03 18:11:10 -05:00
BillyGalbreath
760d9e300f Entity#fromMobSpawner() 2017-06-18 18:17:05 -05:00
Zach Brown
3edcdeaf22 Block player logins during server shutdown 2017-07-02 21:35:56 -05:00
Aikar
aab7ec1655 Shoulder Entities Release API 2017-06-17 15:18:30 -04:00
Sweepyoface
551d6ee71e Add UnknownCommandEvent
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2017-06-17 18:48:21 -04:00
Aikar
bb90110894 Basic PlayerProfile API
Establishes base extension of profile systems for future edits too

== AT ==
public org.bukkit.craftbukkit.profile.CraftProfileProperty
public org.bukkit.craftbukkit.profile.CraftPlayerTextures
public org.bukkit.craftbukkit.profile.CraftPlayerTextures copyFrom(Lorg/bukkit/profile/PlayerTextures;)V
public org.bukkit.craftbukkit.profile.CraftPlayerTextures rebuildPropertyIfDirty()V
public org.bukkit.craftbukkit.profile.CraftPlayerProfile toString(Lcom/mojang/authlib/properties/PropertyMap;)Ljava/lang/String;
public org.bukkit.craftbukkit.profile.CraftPlayerProfile getProperty(Ljava/lang/String;)Lcom/mojang/authlib/properties/Property;
public org.bukkit.craftbukkit.profile.CraftPlayerProfile setProperty(Ljava/lang/String;Lcom/mojang/authlib/properties/Property;)V
2018-01-15 22:11:48 -05:00
Spottedleaf
40654111d1 Do not submit profile lookups to worldgen threads
They block. On network I/O.

If enough tasks are submitted the server will eventually stall
out due to a sync load, as the worldgen threads will be
stalling on profile lookups.
2021-08-08 16:26:46 -07:00
BillyGalbreath
8eb7ab6946 PlayerAttemptPickupItemEvent 2017-06-11 16:30:30 -05:00
BillyGalbreath
eb52c5e2f2 PlayerPickupItemEvent#setFlyAtPlayer 2017-05-07 06:26:09 -05:00
BillyGalbreath
b41abcdb68 Item#canEntityPickup 2017-05-05 03:57:17 -05:00
Shane Freeder
918da37691 provide a configurable option to disable creeper lingering effect spawns 2017-06-11 21:01:18 +01:00
Zach Brown
49fbdd7336 Add option to make parrots stay on shoulders despite movement
Makes parrots not fall off whenever the player changes height, or touches water, or gets hit by a passing leaf.
Instead, switches the behavior so that players have to sneak to make the birds leave.

I suspect Mojang may switch to this behavior before full release.

To be converted into a Paper-API event at some point in the future?

== AT ==
public net.minecraft.world.entity.player.Player removeEntitiesOnShoulder()V
2017-05-16 21:29:08 -05:00
Zach Brown
2f74bdb56b Properly handle async calls to restart the server
The watchdog thread calls the server restart function asynchronously. Prior to
this change, it attempted to do several non-safe operations from the watchdog
thread, rather than the main. Specifically, because of a separate upstream change,
it causes player entities to be ticked asynchronously, among other things.

This is dangerous.

This patch moves the old handling into a synchronous variant, for calls from the
restart command, and adds separate handling for async calls, such as those from
the watchdog thread.

When calling from the watchdog thread, we cannot assume the main thread is in a
tickable state; it may be completely deadlocked. In order to handle this, we mark
the server as stopping, in order to account for situations where the server should
complete a tick reasonbly soon, i.e. 99% of cases.

Should the server not enter a state where it is stopping within 10 seconds, We
will assume that the server has in fact deadlocked and will proceed to force
kill the server.

This modification does not force restart the server should we actually enter a
deadlocked state where the server is stopping, whereas this will in most cases
exit within a reasonable amount of time, to put a fixed limit on a process that
will have plugins and worlds saving to the disk has a high potential to result
in corruption/dataloss.
2017-05-12 23:34:11 -05:00
Aikar
d2f4d82ce2 Cap Entity Collisions
Limit a single entity to colliding a max of configurable times per tick.
This will alleviate issues where living entities are hoarded in 1x1 pens

This is not tied to the maxEntityCramming rule. Cramming will still apply
just as it does in Vanilla, but entity pushing logic will be capped.

You can set this to 0 to disable collisions.
2017-01-22 18:07:56 -05:00
Aikar
110bcadcdf ExperienceOrbs API for Reason/Source/Triggering player
Adds lots of information about why this orb exists.

Replaces isFromBottle() with logic that persists entity reloads too.
2017-12-19 16:31:46 -05:00
Aikar
aa6fe30766 Enforce Sync Player Saves
Saving players async is extremely dangerous. This will force it to main
the same way we handle async chunk loads.
2017-01-07 15:41:58 -05:00
Aikar
4ca188a20e Provide E/TE/Chunk count stat methods
Provides counts without the ineffeciency of using .getEntities().size()
which creates copy of the collections.
2017-01-07 15:24:46 -05:00
Aikar
2aa9d5bf18 PlayerTeleportEndGatewayEvent
Allows you to access the Gateway being used in a teleport event
Fix the offset used for player teleportation
2016-12-31 21:44:50 -05:00
Aikar
746f540e81 Firework API's
== AT ==
public net.minecraft.world.entity.projectile.FireworkRocketEntity attachedToEntity
2016-12-28 07:18:33 +01:00
Alfie Cleveland
26ff64cadc Properly fix item duplication bug
Credit to prplz for figuring out the real issue
2016-12-27 01:57:57 +00:00
Riley Park
e27e53d201 Add API methods to control if armor stands can move 2016-12-21 11:47:25 -06:00
Aikar
c28a11a1d8 Configurable Cartographer Treasure Maps
Allow configuring for cartographers to return the same map location

Also allow turning off treasure maps all together as they can eat up Map ID's
which are limited in quantity.
2016-12-20 15:26:27 -05:00
Aikar
63de7b1ff6 Bound Treasure Maps to World Border
Make it so a Treasure Map does not target a structure outside of the
World Border, where players are not even able to reach.

This also would help the case where a players close to the border, and one
that is outside happens to be closer, but unreachable, yet another reachable
one is in border that would of been missed.
2016-12-20 15:15:11 -05:00
Aikar
ddd1807ad5 Optimize Level.hasChunkAt(BlockPosition)Z
Reduce method invocations for World.isLoaded(BlockPosition)Z
2016-12-02 00:11:43 -05:00
Aikar
1f63668ee9 Prevent Pathfinding out of World Border
This prevents Entities from trying to run outside of the World Border

TODO: This doesn't prevent the pathfinder from using blocks outside the world border as nodes. We can fix this
by adding code to all overrides in:
    NodeEvaluator:
    public abstract BlockPathTypes getBlockPathType(BlockGetter world, int x, int y, int z);

to return BLOCKED if it is outside the world border.
2016-12-19 23:07:42 -05:00
AlphaBlend
087a701e69 Add source to PlayerExpChangeEvent 2016-09-08 08:48:33 -07:00
Alfie Cleveland
3e9512a6fc Cache user authenticator threads 2016-11-25 13:22:40 +00:00
Zach Brown
b1018e6808 Filter bad block entity nbt data from falling blocks 2016-11-12 23:25:22 -06:00
AlphaBlend
472983f423 Add EntityZapEvent 2016-10-16 23:19:30 -07:00
Riley Park
8141041554 Configurable flying kick messages 2016-09-20 00:58:01 +00:00
Zach Brown
72bc20c589 Configurable packet in spam threshold 2016-09-11 14:30:57 -05:00
Alfie Cleveland
c7287dd5ee Optimise BlockState's hashCode/equals
These are singleton "single instance" objects. We can rely on
object identity checks safely.

Use a simpler optimized hashcode
2016-08-19 01:52:56 +01:00
Gabriele C
f7ae11f984 Add setting for proxy online mode status
TODO: Add isProxyOnlineMode check to Metrics
2016-08-05 01:03:08 +02:00
Zach Brown
a55727ff06 Don't lookup game profiles that have no UUID and no name 2016-07-16 19:11:17 -05:00
Aikar
d072c2d5fb Avoid blocking on Network Manager creation
Per Paper issue 294
2016-05-16 23:19:16 -04:00
Jake Potrebic
08698c4642 Fix global sound handling
* Only send global sounds to same world if limiting radius
* respect global sound events gamerule

Co-authored-by: Evan McCarthy <evanmccarthy@outlook.com>
Co-authored-by: lexikiq <noellekiq@gmail.com>
Co-authored-by: Aikar <aikar@aikar.co>
2016-05-31 22:53:50 -04:00
Martin Panzer
ef21fd4166 Faster redstone torch rapid clock removal
Only resize the the redstone torch list once, since resizing arrays / lists is costly
2016-05-23 12:12:37 +02:00
Zach Brown
bdd96190e0 Optional TNT doesn't move in water 2016-05-22 20:20:55 -05:00
Aikar
cda878cf64 Async GameProfileCache saving 2016-05-16 20:47:41 -04:00
Aikar
07c767b6f4 LootTable API and replenishable lootables
Provides an API to control the loot table for an object.
Also provides a feature that any Lootable Inventory (Chests in Structures)
can automatically replenish after a given time.

This feature is good for long term worlds so that newer players
do not suffer with "Every chest has been looted"

== AT ==
public org.bukkit.craftbukkit.block.CraftBlockEntityState getTileEntity()Lnet/minecraft/world/level/block/entity/BlockEntity;
public org.bukkit.craftbukkit.block.CraftLootable setLootTable(Lorg/bukkit/loot/LootTable;J)V
public org.bukkit.craftbukkit.entity.CraftMinecartContainer setLootTable(Lorg/bukkit/loot/LootTable;J)V
2016-05-01 21:19:14 -04:00
Aikar
b8d05bbc27 Don't save empty scoreboard teams to scoreboard.dat 2016-05-07 23:33:08 -04:00
Aikar
6d39090450 remove null possibility for getServer singleton
to stop IDE complaining about potential NPE
2016-04-28 00:57:27 -04:00
Riley Park
217a52eaa8 Add ability to configure frosted_ice properties 2016-04-21 23:51:55 -07:00
Zach Brown
3532e55dab EntityRegainHealthEvent isFastRegen API
Don't even get me started
2016-04-22 01:43:11 -05:00
Aikar
b414f3d993 Configurable RCON IP address
For servers with multiple IP's, ability to bind to a specific interface.

== AT ==
public net.minecraft.server.dedicated.Settings getStringRaw(Ljava/lang/String;)Ljava/lang/String;
2016-04-16 00:39:33 -04:00
Riley Park
d743b03fb6 Add handshake event to allow plugins to handle client handshaking logic themselves 2016-04-13 20:21:38 -07:00
Aikar
a99426b5fe Configurable Player Collision 2016-04-13 02:10:49 -04:00
Aikar
1056951a73 Optimize DataBits
Remove Debug checks as these are super hot and causing noticeable hits

Before: http://i.imgur.com/nQsMzAE.png
After: http://i.imgur.com/nJ46crB.png

Optimize redundant converting of static fields into an unsigned long each call by precomputing it in ctor
2016-04-05 21:38:58 -04:00
Aikar
55db966770 Fix Cancelling BlockPlaceEvent triggering physics 2016-04-03 17:48:50 -04:00
Aikar
eb76e508f5 Configurable random tick rates for blocks
A general purpose patch that includes config options for the tick rate
of a variety of blocks that are random ticked.

Co-authored-by: MrPowerGamerBR <git@mrpowergamerbr.com>
2016-04-03 16:28:17 -04:00
Jedediah Smith
e2263633d4 Add PlayerUseUnknownEntityEvent
Adds the PlayerUseUnknownEntityEvent to be used by plugins dealing with
virtual entities/entities that are not actually known to the server.

Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
2016-04-02 05:09:16 -04:00
Aikar
f9ef3612f7 Do not load chunks for Pathfinding 2016-03-31 19:17:58 -04:00
Antony Riley
db2502d732 Sanitise RegionFileCache and make configurable
RegionFileCache prior to this patch would close every single open region
file upon reaching a size of 256.
This patch modifies that behaviour so it closes the the least recently
used RegionFile.
The implementation uses a LinkedHashMap as an LRU cache (modified from HashMap).
The maximum size of the RegionFileCache is also made configurable.
2016-03-29 08:22:55 +03:00
Aikar
c801c5439d EntityPathfindEvent
Fires when an Entity decides to start moving to a location.
2016-03-28 21:22:26 -04:00
Aikar
e2accd8d62 Configurable Chunk Inhabited Time
Vanilla stores how long a chunk has been active on a server, and dynamically scales some
aspects of vanilla gameplay to this factor.

For people who want all chunks to be treated equally, you can chose a fixed value.

This allows to fine-tune vanilla gameplay.
2016-03-28 20:46:14 -04:00
Aikar
93bbce1c69 Entity AddTo/RemoveFrom World Events 2016-03-28 20:32:58 -04:00
Aikar
63fa3068c6 Only process BlockPhysicsEvent if a plugin has a listener
Saves on some object allocation and processing when no plugin listens to this
2016-03-28 19:55:45 -04:00
Zach Brown
b2671f4dd1 Configurable spawn chances for skeleton horses 2016-03-22 12:04:28 -05:00
Aikar
d989bc5d17 Use a Shared Random for Entities
Reduces memory usage and provides ensures more randomness, Especially since a lot of garbage entity objects get created.
2016-03-22 00:33:47 -04:00
Aikar
becb30e9e6 handle NaN health/absorb values and repair bad data 2015-09-27 01:18:02 -04:00
Jedediah Smith
54fe0287a2 Custom replacement for eaten items 2015-06-21 15:07:20 -04:00
Aikar
f54f356a35 Add World Util Methods
Methods that can be used for other patches to help improve logic.
2016-03-18 20:16:03 -04:00
Aikar
686b77345f Configurable Non Player Arrow Despawn Rate
Can set a much shorter despawn rate for arrows that players can not pick up.
2016-03-18 15:12:22 -04:00
Aikar
20b9d3de7b Handle Item Meta Inconsistencies
First, Enchantment order would blow away seeing 2 items as the same,
however the Client forces enchantment list in a certain order, as well
as does the /enchant command. Anvils can insert it into forced order,
causing 2 same items to be considered different.

This change makes unhandled NBT Tags and Enchantments use a sorted tree map,
so they will always be in a consistent order.

Additionally, the old enchantment API was never updated when ItemMeta
was added, resulting in 2 different ways to modify an items enchantments.

For consistency, the old API methods now forward to use the
ItemMeta API equivalents, and should deprecate the old API's.
2015-05-28 23:00:19 -04:00
Jedediah Smith
f55b057ffb Complete resource pack API 2015-04-04 23:17:52 -04:00
Aikar
5764c71185 Disable Scoreboards for non players by default
Entities collision is checking for scoreboards setting.
This is very heavy to do map lookups for every collision to check
this setting.

So avoid looking up scoreboards and short circuit to the "not on a team"
logic which is most likely to be true.
2016-03-08 23:25:45 -05:00
Joseph Hirschfeld
68979dd492 Add exception reporting event 2016-03-03 03:15:41 -06:00
Joseph Hirschfeld
1f86344458 Add configurable portal search radius 2016-03-03 02:46:17 -06:00
vemacs
886d8e6ac3 All chunks are slime spawn chunks toggle 2016-03-03 01:19:22 -06:00
Aikar
bcc07d07b6 Improve Player chat API handling
Properly split up the chat and command handling to reflect the server now
having separate packets for both, and the client always using the correct packet. Text
from a chat packet should never be parsed into a command, even if it starts with the `/`
character.

Add a missing async catcher and improve Spigot's async catcher error message.

== AT ==
public net.minecraft.server.network.ServerGamePacketListenerImpl isChatMessageIllegal(Ljava/lang/String;)Z

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
2016-03-03 01:17:12 -06:00
Aikar
b380d6445b Configurable Disabling Cat Chest Detection
Offers a gameplay feature to stop cats from blocking chests
2016-03-03 01:13:45 -06:00
Steve Anton
dd1cfc07db Fix spawn location event changing location
== AT ==
public net.minecraft.world.entity.Entity setRot(FF)V
2016-03-03 00:09:38 -06:00
Zach Brown
c8c53412a4 Disable spigot tick limiters 2016-03-02 23:45:17 -06:00
Sudzzy
5b0e06e8e8 Configurable container update tick rate 2016-03-02 23:34:44 -06:00
Byteflux
adb6c35b17 Add BeaconEffectEvent 2016-03-02 23:30:53 -06:00
Isaac Moore
c9cf82340d Use null Locale by default 2016-04-19 14:09:31 -05:00
Sudzzy
1ac857b531 Configurable mob spawner tick rate 2016-03-02 15:03:53 -06:00
Sudzzy
3816346f1c Disable ice and snow 2016-03-02 14:57:24 -06:00
Sudzzy
d75a64eff3 Disable thunder 2016-03-02 14:52:43 -06:00
Sudzzy
fb3f2c1b8e Disable explosion knockback 2016-03-02 14:48:03 -06:00
Byteflux
68603a72c5 Optimize explosions
The process of determining an entity's exposure from explosions can be
expensive when there are hundreds or more entities in range.

This patch adds a per-tick cache that is used for storing and retrieving
an entity's exposure during an explosion.
2016-03-02 11:59:48 -06:00
Iceee
e2ead8262e Fix lag from explosions processing dead entities 2016-03-02 01:39:52 -06:00
DoctorDark
b083157a8c Configurable end credits 2016-03-16 02:21:39 -05:00
Zach Brown
188e3332d6 Check online mode before converting and renaming player data 2016-03-02 00:03:55 -06:00
Zach Brown
b8b1eef98c Configurable top of nether void damage
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2016-03-01 23:58:50 -06:00
Aikar
0255317409 Prevent block entity and entity crashes 2016-03-01 23:52:34 -06:00
Byteflux
6212f523fa Entity Origin API 2016-03-01 23:45:08 -06:00
Jedediah Smith
840b8a7bfa Player affects spawning API 2016-03-01 14:47:52 -06:00
Zach Brown
f41436f787 Expose server build information
Co-authored-by: Zach Brown <1254957+zachbr@users.noreply.github.com>
Co-authored-by: Kyle Wood <kyle@denwav.dev>
Co-authored-by: Mark Vainomaa <mikroskeem@mikroskeem.eu>
Co-authored-by: Riley Park <rileysebastianpark@gmail.com>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: masmc05 <masmc05@gmail.com>
2016-03-01 14:32:43 -06:00
Byteflux
560b13ca08 Drop falling block and tnt entities at the specified height
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2016-03-01 14:14:15 -06:00
Suddenly
a24a98199a Add configurable entity despawn distances 2016-03-01 13:51:54 -06:00
Zach Brown
92ffacc419 Allow nerfed mobs to jump 2016-03-01 13:24:16 -06:00
Zach Brown
c7125aaa48 Configurable fishing time ranges 2016-03-01 13:14:11 -06:00
Zach Brown
92ebed543f Configurable baby zombie movement speed 2016-03-01 13:09:16 -06:00
Zach Brown
097b7fd752 Configurable cactus bamboo and reed growth height
Bamboo - Both the minimum fully-grown height and the maximum are configurable
- Machine_Maker
2016-03-01 13:02:51 -06:00
Aikar
770ee3eebd Remove Spigot timings 2016-03-03 04:00:11 -06:00
Aikar
a371d5fefe Further improve server tick loop
Improves how the catchup buffer is handled, allowing it to roll both ways
increasing the effeciency of the thread sleep so it only will sleep once.

Also increases the buffer of the catchup to ensure server stays at 20 TPS unless extreme conditions

Previous implementation did not calculate TPS correctly.
Switch to a realistic rolling average and factor in std deviation as an extra reporting variable
2016-03-01 23:09:29 -06:00
Jason Penilla
13e0a1a71e Plugin remapping
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
2022-10-29 15:22:32 -07:00
Owen1212055
216388dfdf Paper Plugins
Co-authored-by: Micah Rao <micah.s.rao@gmail.com>
2022-07-06 23:00:31 -04:00
Zach Brown
329dfdabdc Paper Metrics
Removes Spigot's mcstats metrics in favor of a system using bStats

To disable for privacy or other reasons go to the bStats folder in your plugins folder
and edit the config.yml file present there.

Please keep in mind the data collected is anonymous and collection should have no
tangible effect on server performance. The data is used to allow the authors of
PaperMC to track version and platform usage so that we can make better management
decisions on behalf of the project.
2017-03-24 23:56:01 -05:00
Jason Penilla
bd7282c66d Paper command
Co-authored-by: Zach Brown <1254957+zachbr@users.noreply.github.com>
2016-02-29 21:02:09 -06:00
Jason Penilla
34407fe880 Deobfuscate stacktraces in log messages, crash reports, and etc. 2021-06-20 18:19:09 -07:00
Minecrell
36723cdd60 Use TerminalConsoleAppender for console improvements
Rewrite console improvements (console colors, tab completion,
persistent input line, ...) using JLine 3.x and TerminalConsoleAppender.

Also uses the new ANSIComponentSerializer to serialize components when
logging them via the ComponentLogger, or when sending messages to the
console, for hex color support.

New features:
  - Support console colors for Vanilla commands
  - Add console colors for warnings and errors
  - Server can now be turned off safely using CTRL + C. JLine catches
    the signal and the implementation shuts down the server cleanly.
  - Support console colors and persistent input line when running in
    IntelliJ IDEA

Other changes:
  - Server starts 1-2 seconds faster thanks to optimizations in Log4j
    configuration

Co-Authored-By: Emilia Kond <emilia@rymiel.space>
2017-06-09 19:03:43 +02:00
Riley Park
66779f5c86 Adventure
== AT ==
public net.minecraft.network.chat.HoverEvent$ItemStackInfo item
public net.minecraft.network.chat.HoverEvent$ItemStackInfo count
public net.minecraft.network.chat.HoverEvent$ItemStackInfo components
public net.minecraft.network.chat.contents.TranslatableContents filterAllowedArguments(Ljava/lang/Object;)Lcom/mojang/serialization/DataResult;

Co-authored-by: zml <zml@stellardrift.ca>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2021-01-29 17:54:03 +01:00
Aikar
b01c811c2f MC Utils
== AT ==
public net.minecraft.server.level.ServerChunkCache mainThread
public net.minecraft.server.level.ServerLevel chunkSource
public org.bukkit.craftbukkit.inventory.CraftItemStack handle
public net.minecraft.server.level.ChunkMap getVisibleChunkIfPresent(J)Lnet/minecraft/server/level/ChunkHolder;
public net.minecraft.server.level.ServerChunkCache mainThreadProcessor
public net.minecraft.server.level.ServerChunkCache$MainThreadExecutor
public net.minecraft.world.level.chunk.LevelChunkSection states
2016-03-28 20:55:47 -04:00
Jake Potrebic
a82a09d198 CB fixes
* Missing Level -> LevelStem generic in StructureCheck
  Need to use the right for injectDatafixingContext (Spottedleaf)

* Fix summon_entity effect attempting to add incorrect entity (granny)

* Removed incorrect parent perm for `minecraft.debugstick.always` (Machine_Maker)

* Fixed method signature of Marker#addPassenger (Machine_Maker)

* Removed unneeded UOE in CustomWorldChunkManager (extends BiomeSource) (Machine_Maker)

* Honor Server#getLootTable method contract (Machine_Maker)

Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
2022-02-25 07:14:48 -08:00
Aikar
f829dcd46a MC Dev fixes 2016-03-30 19:36:20 -04:00
Jake Potrebic
769119f918 Paper config files
== AT ==
public org.spigotmc.SpigotWorldConfig getBoolean(Ljava/lang/String;Z)Z
public org.spigotmc.SpigotWorldConfig getDouble(Ljava/lang/String;)D
public org.spigotmc.SpigotWorldConfig getDouble(Ljava/lang/String;D)D
public org.spigotmc.SpigotWorldConfig getInt(Ljava/lang/String;)I
public org.spigotmc.SpigotWorldConfig getInt(Ljava/lang/String;I)I
public org.spigotmc.SpigotWorldConfig getList(Ljava/lang/String;Ljava/lang/Object;)Ljava/util/List;
public org.spigotmc.SpigotWorldConfig getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
public net.minecraft.server.dedicated.DedicatedServerProperties reload(Lnet/minecraft/core/RegistryAccess;Ljava/util/Properties;Ljoptsimple/OptionSet;)Lnet/minecraft/server/dedicated/DedicatedServerProperties;
public net.minecraft.world.level.NaturalSpawner SPAWNING_CATEGORIES
2022-06-08 22:20:16 -07:00
Zach Brown
bc10922ef3 Build system changes
== AT ==
public net.minecraft.server.packs.VanillaPackResourcesBuilder safeGetPath(Ljava/net/URI;)Ljava/nio/file/Path;

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2016-02-29 20:40:33 -06:00
Kyle Wood
f161aac557 Remap fixes 2021-06-11 05:25:03 -05:00
CraftBukkit/Spigot
9940174241 Add unload-frozen-chunks option
By: md_5 <git@md-5.net>
2024-05-18 11:39:58 +10:00
CraftBukkit/Spigot
479ce445d6 Configurable Below Zero Generation
By: DerFrZocker <derrieple@gmail.com>
2021-11-28 12:09:29 +11:00
CraftBukkit/Spigot
7cfc37b17d Configurable Thunder Chance
By: md_5 <git@md-5.net>
2021-10-24 20:29:25 +11:00
CraftBukkit/Spigot
e81bcdf643 Allow Disabling Player Data Saving
By: Sander Knauff <sanderknauff@hotmail.com>
2020-11-07 18:23:42 +11:00
CraftBukkit/Spigot
76c24a1454 Add log-villager-deaths option
By: md_5 <git@md-5.net>
2019-12-14 10:26:52 +11:00
CraftBukkit/Spigot
9ef9823b3b Allow Reading Old Large Chunks
The size of chunks in the region format is overdetermined. In particular their size on disk is indicated by both a sector count in the header, and actual size in the body.
If their size would overflow the header field (>= 255 sectors), it can just be read directly from the body instead.

This code/concept was adapted from MinecraftForge.

By: md_5 <git@md-5.net>
2019-02-19 22:30:00 +11:00
CraftBukkit/Spigot
6fcc9cce6d Add creative mode NBT permissions
By: md_5 <git@md-5.net>
2019-02-25 19:26:56 +11:00
CraftBukkit/Spigot
d16d3c3548 Configurable Advancement Disabling
Allow disabling any (or all) inbuilt advancements with a configuration option.

By: md_5 <git@md-5.net>
2017-06-09 16:29:31 +10:00