From 6d1a918378d9c6abe3345cc475d4ca37c66e4530 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 14 Jul 2018 21:53:17 -0400 Subject: [PATCH] NOT FINISHED!!! Current Progress on 1.13-pre7 update This work is 100% unfinished. I am pushing it up so that we as a team can work on this update. Do not try to use this branch. You will fail. --- ...-get-a-BlockState-without-a-snapshot.patch | 2 +- .../Ability-to-apply-mending-to-XP-API.patch | 2 +- .../Add-Ban-Methods-to-Player-Objects.patch | 2 +- ...dd-SentientNPC-Interface-to-Entities.patch | 11 - .../Add-SkullMeta.setPlayerProfile-API.patch | 7 +- .../Add-String-based-Action-Bar-API.patch | 2 +- .../Add-World.getEntity-UUID-API.patch | 2 +- .../Add-getI18NDisplayName-API.patch | 2 +- ...working-with-arrows-stuck-in-living-.patch | 2 +- ...tional-world.getNearbyEntities-API-s.patch | 2 +- ...f-Player-Sample-in-ServerListPingEve.patch | 45 -- ...low-plugins-to-use-SLF4J-for-logging.patch | 2 +- ...ly-disable-plugins-that-fail-to-load.patch | 2 +- ...lose-Plugin-Class-Loaders-on-Disable.patch | 2 +- .../Complete-resource-pack-API.patch | 12 +- .../Enderman.teleportRandomly.patch | 4 +- Spigot-API-Patches/Entity-Origin-API.patch | 2 +- .../Expand-Explosions-API.patch | 2 +- ...ld.spawnParticle-API-and-add-Builder.patch | 2 +- ...nt-protocol-version-and-virtual-host.patch | 2 +- ...upstream-javadoc-warnings-and-errors.patch | 6 +- ...plement-deprecated-player-sample-API.patch | 75 -- ...ivingEntity-Hand-Raised-Item-Use-API.patch | 2 +- ...e-shield-blocking-delay-configurable.patch | 2 +- Spigot-API-Patches/POM-changes.patch | 17 +- .../Player.setPlayerProfile-API.patch | 2 +- Spigot-API-Patches/Timings-v2.patch | 4 +- .../Use-ASM-for-event-executors.patch | 4 +- .../ensureServerConversions-API.patch | 2 +- .../Access-items-by-EquipmentSlot.patch | 2 +- .../Add-BeaconEffectEvent.patch | 10 +- ...-MinecraftKey-Information-to-Objects.patch | 103 ++- .../Add-PlayerInitialSpawnEvent.patch | 2 +- .../Add-PlayerUseUnknownEntityEvent.patch | 4 +- .../Add-World-Util-Methods.patch | 86 +-- .../Add-async-chunk-load-API.patch | 2 +- ...-despawn-distances-for-living-entiti.patch | 2 +- ...dd-configurable-portal-search-radius.patch | 12 +- .../Add-exception-reporting-event.patch | 120 ++-- ...ent-to-allow-plugins-to-handle-clien.patch | 2 +- ...working-with-arrows-stuck-in-living-.patch | 2 +- .../Add-player-view-distance-API.patch | 8 +- .../Add-velocity-warnings.patch | 6 +- ...chunks-are-slime-spawn-chunks-toggle.patch | 20 +- ...llow-Reloading-of-Custom-Permissions.patch | 2 +- .../Allow-for-toggling-of-spawn-chunks.patch | 4 +- .../Allow-nerfed-mobs-to-jump.patch | 22 +- .../Always-tick-falling-blocks.patch | 6 +- ...opper-searches-if-there-are-no-items.patch | 51 +- ...e-informative-in-maxHealth-exception.patch | 2 +- ...atch-Async-PlayerChunkMap-operations.patch | 2 +- ...entation-of-tile-entity-removal-list.patch | 63 +- ...heck-async-remove-unused-vars-GH-159.patch | 30 - ...e-before-converting-and-renaming-pla.patch | 4 +- .../Chunk-Save-Reattempt.patch | 10 +- .../Chunk-save-queue-improvements.patch | 140 ++-- .../Complete-resource-pack-API.patch | 29 +- .../Configurable-Chunk-Inhabited-Timer.patch | 23 +- .../Configurable-Grass-Spread-Tick-Rate.patch | 20 +- ...le-Keep-Spawn-Loaded-range-per-world.patch | 32 +- ...urable-Non-Player-Arrow-Despawn-Rate.patch | 20 +- .../Configurable-Player-Collision.patch | 48 +- .../Configurable-RCON-IP-address.patch | 6 +- ...figurable-baby-zombie-movement-speed.patch | 24 +- ...ctus-and-reed-natural-growth-heights.patch | 34 +- ...figurable-container-update-tick-rate.patch | 4 +- .../Configurable-end-credits.patch | 22 +- .../Configurable-fishing-time-ranges.patch | 6 +- ...ble-inter-world-teleportation-safety.patch | 6 +- .../Configurable-lava-flow-speed.patch | 49 -- .../Configurable-mob-spawner-tick-rate.patch | 20 +- ...le-spawn-chances-for-skeleton-horses.patch | 8 +- ...le-speed-for-water-flowing-over-lava.patch | 59 -- ...nfigurable-top-of-nether-void-damage.patch | 36 +- .../Custom-replacement-for-eaten-items.patch | 10 +- ...ading-permissions.yml-before-plugins.patch | 2 +- ...oreboards-for-non-players-by-default.patch | 34 +- .../Disable-chest-cat-detection.patch | 14 +- .../Disable-explosion-knockback.patch | 18 +- .../Disable-ice-and-snow.patch | 10 +- .../Disable-spigot-tick-limiters.patch | 6 +- Spigot-Server-Patches/Disable-thunder.patch | 11 +- .../Do-not-load-chunks-for-light-checks.patch | 8 +- ...-don-t-need-to-when-cerealising-text.patch | 2 +- ...am-reload-spawn-chunks-in-nether-end.patch | 19 +- .../Don-t-teleport-dead-entities.patch | 4 +- .../Don-t-tick-Skulls-unused-code.patch | 6 +- ...ck-and-tnt-entities-at-the-specified.patch | 12 +- .../Ensure-commands-are-not-ran-async.patch | 4 +- .../Ensure-inv-drag-is-in-bounds.patch | 4 +- ...Entity-AddTo-RemoveFrom-World-Events.patch | 8 +- Spigot-Server-Patches/Entity-Origin-API.patch | 28 +- .../EntityPathfindEvent.patch | 6 +- ...ityRegainHealthEvent-isFastRegen-API.patch | 4 +- .../Expose-server-CommandMap.patch | 2 +- Spigot-Server-Patches/Fast-draining.patch | 111 --- ...g-BlockPlaceEvent-triggering-physics.patch | 6 +- .../Fix-Furnace-cook-time-bug.patch | 10 +- .../Fix-cooked-fish-legacy-import.patch | 20 - ...-explosions-processing-dead-entities.patch | 2 +- ...dDebugInfo-not-initialized-on-client.patch | 8 +- .../Further-improve-server-tick-loop.patch | 11 +- .../Generator-Settings.patch | 310 --------- .../Handle-Item-Meta-Inconsistencies.patch | 133 ++-- .../Implement-PlayerLocaleChangeEvent.patch | 46 +- Spigot-Server-Patches/Lighting-Queue.patch | 75 +- Spigot-Server-Patches/MC-Dev-fixes.patch | 251 +------ Spigot-Server-Patches/MC-Utils.patch | 136 ++-- .../Only-refresh-abilities-if-needed.patch | 2 +- .../Optimize-Chunk-Access.patch | 58 +- .../Optimize-Pathfinding.patch | 4 +- .../Optimize-TileEntity-Ticking.patch | 223 +++--- .../Optimize-explosions.patch | 26 +- ...Location-getType-and-getBlockData-fo.patch | 214 +++--- .../Optimized-Light-Level-Comparisons.patch | 117 +--- ...sable-BlockPhysicsEvent-for-Redstone.patch | 29 +- ...nilla-per-world-scoreboard-coloring-.patch | 10 +- Spigot-Server-Patches/POM-Changes.patch | 11 +- Spigot-Server-Patches/Paper-Metrics.patch | 2 +- .../Paper-config-files.patch | 144 ++-- .../Pass-world-to-Village-creation.patch | 6 +- .../Player-Tab-List-and-Title-APIs.patch | 4 +- .../Player-affects-spawning-API.patch | 42 +- .../Prevent-Fire-from-loading-chunks.patch | 24 +- ...w-BlockFromToEvent-from-loading-chun.patch | 50 -- ...event-tile-entity-and-entity-crashes.patch | 26 +- ...uce-IO-ops-opening-a-new-region-file.patch | 2 +- .../Remove-Debug-checks-from-DataBits.patch | 8 +- .../Remove-Metadata-on-reload.patch | 2 +- ...ve-invalid-mob-spawner-tile-entities.patch | 8 +- ...Remove-unused-World-Tile-Entity-List.patch | 24 +- ...egionFileCache-and-make-configurable.patch | 6 +- ...sition-the-first-time-an-entity-is-s.patch | 2 +- ...ient-crashes-server-lists-and-Mojang.patch | 35 +- ...lowing-block-if-material-has-changed.patch | 19 - ...ts-for-each-Entity-Block-Entity-Type.patch | 22 +- ...to-current-Chunk-for-Entity-and-Bloc.patch | 88 +-- ...ne-mode-in-whitelist-command-as-well.patch | 91 --- Spigot-Server-Patches/Timings-v2.patch | 654 +++++++++--------- .../Undead-horse-leashing.patch | 6 +- .../Use-Optimized-Collections.patch | 2 +- .../Use-UserCache-for-player-heads.patch | 2 +- .../Use-a-Shared-Random-for-Entities.patch | 10 +- ...-mobs-should-only-spawn-in-the-water.patch | 28 - ...nd-for-setting-passengers-on-players.patch | 2 +- ...th-absorb-values-and-repair-bad-data.patch | 4 +- pre/Bukkit-Patches/0001-POM-Changes.patch | 30 - .../0002-Skeleton-API-Implementations.patch | 187 ----- pre/Bukkit-Patches/0003-Spigot-Timings.patch | 483 ------------- .../0004-Add-PlayerItemDamageEvent.patch | 67 -- .../0005-BungeeCord-Support.patch | 85 --- pre/Bukkit-Patches/0006-Add-Arrow-API.patch | 27 - .../0007-Add-Particle-API.patch | 436 ------------ ...titySpawnEvent-and-SpawnerSpawnEvent.patch | 217 ------ ...009-Entity-Mount-and-Dismount-Events.patch | 110 --- ...entoryClickEvent-getClickedInventory.patch | 52 -- ...lSessionData-to-the-Conversation-API.patch | 26 - .../0012-Player-Collision-API.patch | 43 -- .../0013-Expand-Boolean-Prompt-Values.patch | 26 - ...dd-Getter-for-Entity-Invulnerability.patch | 27 - pre/Bukkit-Patches/0015-Add-respawn-API.patch | 26 - ...-Implement-Locale-Getter-for-Players.patch | 30 - ...-support-for-fetching-hidden-players.patch | 28 - .../0018-Silenceable-Lightning-API.patch | 62 -- ...cation-on-some-player-lookup-methods.patch | 92 --- .../0020-Add-PlayerSpawnLocationEvent.patch | 63 -- ...ClassLoader-Deadlocks-Where-Possible.patch | 65 -- ...Undeprecate-Player-updateInventory-V.patch | 23 - ...kable-and-setUnbreakable-to-ItemMeta.patch | 41 -- .../0024-BungeeCord-Chat-API.patch | 449 ------------ pre/Bukkit-Patches/0025-Add-restart-API.patch | 25 - scripts/applyPatches.sh | 19 +- scripts/importmcdev.sh | 118 +--- scripts/rebuildPatches.sh | 3 +- scripts/remap.sh | 3 +- scripts/testServer.sh | 2 +- work/BuildData | 2 +- work/Bukkit | 2 +- work/CraftBukkit | 2 +- work/Spigot | 2 +- 180 files changed, 1801 insertions(+), 5796 deletions(-) delete mode 100644 Spigot-API-Patches/Allow-Changing-of-Player-Sample-in-ServerListPingEve.patch delete mode 100644 Spigot-API-Patches/Implement-deprecated-player-sample-API.patch delete mode 100644 Spigot-Server-Patches/Check-async-remove-unused-vars-GH-159.patch delete mode 100644 Spigot-Server-Patches/Configurable-lava-flow-speed.patch delete mode 100644 Spigot-Server-Patches/Configurable-speed-for-water-flowing-over-lava.patch delete mode 100644 Spigot-Server-Patches/Fast-draining.patch delete mode 100644 Spigot-Server-Patches/Fix-cooked-fish-legacy-import.patch delete mode 100644 Spigot-Server-Patches/Generator-Settings.patch delete mode 100644 Spigot-Server-Patches/Prevent-Waterflow-BlockFromToEvent-from-loading-chun.patch delete mode 100644 Spigot-Server-Patches/Stop-updating-flowing-block-if-material-has-changed.patch delete mode 100644 Spigot-Server-Patches/Support-offline-mode-in-whitelist-command-as-well.patch delete mode 100644 Spigot-Server-Patches/Water-mobs-should-only-spawn-in-the-water.patch delete mode 100644 pre/Bukkit-Patches/0001-POM-Changes.patch delete mode 100644 pre/Bukkit-Patches/0002-Skeleton-API-Implementations.patch delete mode 100644 pre/Bukkit-Patches/0003-Spigot-Timings.patch delete mode 100644 pre/Bukkit-Patches/0004-Add-PlayerItemDamageEvent.patch delete mode 100644 pre/Bukkit-Patches/0005-BungeeCord-Support.patch delete mode 100644 pre/Bukkit-Patches/0006-Add-Arrow-API.patch delete mode 100644 pre/Bukkit-Patches/0007-Add-Particle-API.patch delete mode 100644 pre/Bukkit-Patches/0008-Define-EntitySpawnEvent-and-SpawnerSpawnEvent.patch delete mode 100644 pre/Bukkit-Patches/0009-Entity-Mount-and-Dismount-Events.patch delete mode 100644 pre/Bukkit-Patches/0010-InventoryClickEvent-getClickedInventory.patch delete mode 100644 pre/Bukkit-Patches/0011-Added-getAllSessionData-to-the-Conversation-API.patch delete mode 100644 pre/Bukkit-Patches/0012-Player-Collision-API.patch delete mode 100644 pre/Bukkit-Patches/0013-Expand-Boolean-Prompt-Values.patch delete mode 100644 pre/Bukkit-Patches/0014-Add-Getter-for-Entity-Invulnerability.patch delete mode 100644 pre/Bukkit-Patches/0015-Add-respawn-API.patch delete mode 100644 pre/Bukkit-Patches/0016-Implement-Locale-Getter-for-Players.patch delete mode 100644 pre/Bukkit-Patches/0017-Add-support-for-fetching-hidden-players.patch delete mode 100644 pre/Bukkit-Patches/0018-Silenceable-Lightning-API.patch delete mode 100644 pre/Bukkit-Patches/0019-Remove-deprecation-on-some-player-lookup-methods.patch delete mode 100644 pre/Bukkit-Patches/0020-Add-PlayerSpawnLocationEvent.patch delete mode 100644 pre/Bukkit-Patches/0021-Ease-ClassLoader-Deadlocks-Where-Possible.patch delete mode 100644 pre/Bukkit-Patches/0022-Undeprecate-Player-updateInventory-V.patch delete mode 100644 pre/Bukkit-Patches/0023-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch delete mode 100644 pre/Bukkit-Patches/0024-BungeeCord-Chat-API.patch delete mode 100644 pre/Bukkit-Patches/0025-Add-restart-API.patch diff --git a/Spigot-API-Patches/API-to-get-a-BlockState-without-a-snapshot.patch b/Spigot-API-Patches/API-to-get-a-BlockState-without-a-snapshot.patch index 8b4faf369f..1634367d3e 100644 --- a/Spigot-API-Patches/API-to-get-a-BlockState-without-a-snapshot.patch +++ b/Spigot-API-Patches/API-to-get-a-BlockState-without-a-snapshot.patch @@ -9,7 +9,7 @@ on the real tile entity. This is useful for where performance is needed diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index bda9900e..d5d0e255 100644 +index 1aa3373f..9aab043c 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java @@ -0,0 +0,0 @@ public interface Block extends Metadatable { diff --git a/Spigot-API-Patches/Ability-to-apply-mending-to-XP-API.patch b/Spigot-API-Patches/Ability-to-apply-mending-to-XP-API.patch index e2925ad534..4b0efce538 100644 --- a/Spigot-API-Patches/Ability-to-apply-mending-to-XP-API.patch +++ b/Spigot-API-Patches/Ability-to-apply-mending-to-XP-API.patch @@ -10,7 +10,7 @@ of giving the player experience points. Both an API To standalone mend, and apply mending logic to .giveExp has been added. diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 60cdd620..32ead009 100644 +index 362467e5..6709168b 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline diff --git a/Spigot-API-Patches/Add-Ban-Methods-to-Player-Objects.patch b/Spigot-API-Patches/Add-Ban-Methods-to-Player-Objects.patch index 0b968d131d..f1d76c4e09 100644 --- a/Spigot-API-Patches/Add-Ban-Methods-to-Player-Objects.patch +++ b/Spigot-API-Patches/Add-Ban-Methods-to-Player-Objects.patch @@ -69,7 +69,7 @@ index 3ab2e4c7..8daf2ddc 100644 /** * Checks if this player is whitelisted or not diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index cd82ff64..2dd9ecfb 100644 +index 99080b27..59c6a097 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -0,0 +0,0 @@ diff --git a/Spigot-API-Patches/Add-SentientNPC-Interface-to-Entities.patch b/Spigot-API-Patches/Add-SentientNPC-Interface-to-Entities.patch index 641a064b6b..f66a96fee3 100644 --- a/Spigot-API-Patches/Add-SentientNPC-Interface-to-Entities.patch +++ b/Spigot-API-Patches/Add-SentientNPC-Interface-to-Entities.patch @@ -152,15 +152,4 @@ index 0d87d203..d4eee19c 100644 /** * @return The size of the slime -diff --git a/src/main/java/org/bukkit/entity/WaterMob.java b/src/main/java/org/bukkit/entity/WaterMob.java -index 3e89ca0c..8d105e72 100644 ---- a/src/main/java/org/bukkit/entity/WaterMob.java -+++ b/src/main/java/org/bukkit/entity/WaterMob.java -@@ -0,0 +0,0 @@ package org.bukkit.entity; - /** - * Represents a Water Mob - */ --public interface WaterMob extends LivingEntity {} -+public interface WaterMob extends LivingEntity, com.destroystokyo.paper.entity.SentientNPC { // Paper -+} -- \ No newline at end of file diff --git a/Spigot-API-Patches/Add-SkullMeta.setPlayerProfile-API.patch b/Spigot-API-Patches/Add-SkullMeta.setPlayerProfile-API.patch index fb8f64c338..b5298265f3 100644 --- a/Spigot-API-Patches/Add-SkullMeta.setPlayerProfile-API.patch +++ b/Spigot-API-Patches/Add-SkullMeta.setPlayerProfile-API.patch @@ -7,20 +7,19 @@ This allows you to create already filled textures on Skulls to avoid texture loo which commonly cause rate limit issues with Mojang API diff --git a/src/main/java/org/bukkit/inventory/meta/SkullMeta.java b/src/main/java/org/bukkit/inventory/meta/SkullMeta.java -index c60860e1..3eea5909 100644 +index 15c1dfd9..a458000f 100644 --- a/src/main/java/org/bukkit/inventory/meta/SkullMeta.java +++ b/src/main/java/org/bukkit/inventory/meta/SkullMeta.java @@ -0,0 +0,0 @@ package org.bukkit.inventory.meta; +import com.destroystokyo.paper.profile.PlayerProfile; - import org.bukkit.Material; ++import javax.annotation.Nullable; import org.bukkit.OfflinePlayer; -+import javax.annotation.Nullable; + /** - * Represents a skull ({@link Material#SKULL_ITEM}) that can have an owner. + * Represents a skull that can have an owner. */ @@ -0,0 +0,0 @@ public interface SkullMeta extends ItemMeta { @Deprecated diff --git a/Spigot-API-Patches/Add-String-based-Action-Bar-API.patch b/Spigot-API-Patches/Add-String-based-Action-Bar-API.patch index 0d03d9723e..3676b554fc 100644 --- a/Spigot-API-Patches/Add-String-based-Action-Bar-API.patch +++ b/Spigot-API-Patches/Add-String-based-Action-Bar-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add String based Action Bar API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index f1876a05..d06f26b9 100644 +index 5638a077..bc2f9621 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline diff --git a/Spigot-API-Patches/Add-World.getEntity-UUID-API.patch b/Spigot-API-Patches/Add-World.getEntity-UUID-API.patch index b9ba35d8f1..c9ec9c94f3 100644 --- a/Spigot-API-Patches/Add-World.getEntity-UUID-API.patch +++ b/Spigot-API-Patches/Add-World.getEntity-UUID-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add World.getEntity(UUID) API diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 2c1056d1..c98349cc 100644 +index 04c174f7..121033e9 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable { diff --git a/Spigot-API-Patches/Add-getI18NDisplayName-API.patch b/Spigot-API-Patches/Add-getI18NDisplayName-API.patch index 958b77602c..9867851286 100644 --- a/Spigot-API-Patches/Add-getI18NDisplayName-API.patch +++ b/Spigot-API-Patches/Add-getI18NDisplayName-API.patch @@ -8,7 +8,7 @@ Currently the server only supports the English language. To override this, You must replace the language file embedded in the server jar. diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java -index ab33e09e..061954f9 100644 +index 045c26d9..47bbc0f9 100644 --- a/src/main/java/org/bukkit/inventory/ItemFactory.java +++ b/src/main/java/org/bukkit/inventory/ItemFactory.java @@ -0,0 +0,0 @@ public interface ItemFactory { diff --git a/Spigot-API-Patches/Add-methods-for-working-with-arrows-stuck-in-living-.patch b/Spigot-API-Patches/Add-methods-for-working-with-arrows-stuck-in-living-.patch index b13a01079a..e464a66a70 100644 --- a/Spigot-API-Patches/Add-methods-for-working-with-arrows-stuck-in-living-.patch +++ b/Spigot-API-Patches/Add-methods-for-working-with-arrows-stuck-in-living-.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add methods for working with arrows stuck in living entities diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 5a30fa93..be51e389 100644 +index 97c2172b..f6ae0a6d 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Entity, Damageable, Projecti diff --git a/Spigot-API-Patches/Additional-world.getNearbyEntities-API-s.patch b/Spigot-API-Patches/Additional-world.getNearbyEntities-API-s.patch index 9da8bd9b0e..bfba1c5b69 100644 --- a/Spigot-API-Patches/Additional-world.getNearbyEntities-API-s.patch +++ b/Spigot-API-Patches/Additional-world.getNearbyEntities-API-s.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Additional world.getNearbyEntities API's Provides more methods to get nearby entities, and filter by types and predicates diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 6417cefa..9b49ed38 100644 +index 4cc70326..97badc63 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -0,0 +0,0 @@ package org.bukkit; diff --git a/Spigot-API-Patches/Allow-Changing-of-Player-Sample-in-ServerListPingEve.patch b/Spigot-API-Patches/Allow-Changing-of-Player-Sample-in-ServerListPingEve.patch deleted file mode 100644 index 7d1f669df1..0000000000 --- a/Spigot-API-Patches/Allow-Changing-of-Player-Sample-in-ServerListPingEve.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: willies952002 -Date: Thu, 20 Jul 2017 18:05:36 -0400 -Subject: [PATCH] Allow Changing of Player Sample in ServerListPingEvent - - -diff --git a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java -index 3c38d857..cb8d0fcd 100644 ---- a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java -+++ b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java -@@ -0,0 +0,0 @@ package org.bukkit.event.server; - - import java.net.InetAddress; - import java.util.Iterator; -+import java.util.List; - - import org.apache.commons.lang.Validate; - import org.bukkit.entity.Player; -@@ -0,0 +0,0 @@ public class ServerListPingEvent extends ServerEvent implements Iterable - public Iterator iterator() throws UnsupportedOperationException { - throw new UnsupportedOperationException(); - } -+ -+ // Paper start -+ private java.util.List sample; -+ -+ /** -+ * @deprecated Will be replaced in 1.13 -+ */ -+ @Deprecated -+ public void setSampleText(java.util.List sample) { -+ this.sample = sample; -+ } -+ -+ /** -+ * @deprecated Will be replaced in 1.13 -+ */ -+ @Deprecated -+ public java.util.List getSampleText() { -+ return sample; -+ } -+ // Paper end -+ - } --- \ No newline at end of file diff --git a/Spigot-API-Patches/Allow-plugins-to-use-SLF4J-for-logging.patch b/Spigot-API-Patches/Allow-plugins-to-use-SLF4J-for-logging.patch index 7efb54bf68..6f0cc01a1e 100644 --- a/Spigot-API-Patches/Allow-plugins-to-use-SLF4J-for-logging.patch +++ b/Spigot-API-Patches/Allow-plugins-to-use-SLF4J-for-logging.patch @@ -14,7 +14,7 @@ it without having to shade it in the plugin and going through several layers of logging abstraction. diff --git a/pom.xml b/pom.xml -index e1a39bfe..db9a57b0 100644 +index 44a8b2a5..c176dd7b 100644 --- a/pom.xml +++ b/pom.xml @@ -0,0 +0,0 @@ diff --git a/Spigot-API-Patches/Automatically-disable-plugins-that-fail-to-load.patch b/Spigot-API-Patches/Automatically-disable-plugins-that-fail-to-load.patch index f5e953382b..b6b6b24e6d 100644 --- a/Spigot-API-Patches/Automatically-disable-plugins-that-fail-to-load.patch +++ b/Spigot-API-Patches/Automatically-disable-plugins-that-fail-to-load.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Automatically disable plugins that fail to load diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +index 81b42822..3af99b5b 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader { diff --git a/Spigot-API-Patches/Close-Plugin-Class-Loaders-on-Disable.patch b/Spigot-API-Patches/Close-Plugin-Class-Loaders-on-Disable.patch index 89f9dfc08f..5bbe7de440 100644 --- a/Spigot-API-Patches/Close-Plugin-Class-Loaders-on-Disable.patch +++ b/Spigot-API-Patches/Close-Plugin-Class-Loaders-on-Disable.patch @@ -100,7 +100,7 @@ index bd0588a2..cb2b0b9c 100644 lookupNames.clear(); HandlerList.unregisterAll(); diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 40fd71dc..3e87c3dd 100644 +index 72d506d1..3cff01b6 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader { diff --git a/Spigot-API-Patches/Complete-resource-pack-API.patch b/Spigot-API-Patches/Complete-resource-pack-API.patch index 3d2c24d0f5..3a8c34cd45 100644 --- a/Spigot-API-Patches/Complete-resource-pack-API.patch +++ b/Spigot-API-Patches/Complete-resource-pack-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Complete resource pack API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 5955b20c..f1876a05 100644 +index 1837a14c..5638a077 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline @@ -77,30 +77,34 @@ index 5955b20c..f1876a05 100644 public class Spigot extends Entity.Spigot { diff --git a/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java b/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java -index 4c498016..4c838519 100644 +index 4c498016..aa18a766 100644 --- a/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java @@ -0,0 +0,0 @@ import org.bukkit.event.HandlerList; public class PlayerResourcePackStatusEvent extends PlayerEvent { private static final HandlerList handlers = new HandlerList(); ++ @Deprecated + private final String hash; // Paper private final Status status; -+ @Deprecated // Paper public PlayerResourcePackStatusEvent(final Player who, Status resourcePackStatus) { super(who); + this.hash = null; // Paper this.status = resourcePackStatus; } -+ // Paper start ++ @Deprecated // Paper + public PlayerResourcePackStatusEvent(final Player who, Status resourcePackStatus, String hash) { + super(who); + this.hash = hash; // Paper + this.status = resourcePackStatus; + } + ++ @Deprecated ++ /** ++ * @deprecated Hash does not seem to ever be set ++ */ + public String getHash() { + return this.hash; + } diff --git a/Spigot-API-Patches/Enderman.teleportRandomly.patch b/Spigot-API-Patches/Enderman.teleportRandomly.patch index 15611f0c05..755706cd0b 100644 --- a/Spigot-API-Patches/Enderman.teleportRandomly.patch +++ b/Spigot-API-Patches/Enderman.teleportRandomly.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Enderman.teleportRandomly() Ability to trigger the vanilla "teleport randomly" mechanic of an enderman. diff --git a/src/main/java/org/bukkit/entity/Enderman.java b/src/main/java/org/bukkit/entity/Enderman.java -index c8b4efde..bc2df752 100644 +index ab827f83..459ec0c9 100644 --- a/src/main/java/org/bukkit/entity/Enderman.java +++ b/src/main/java/org/bukkit/entity/Enderman.java @@ -0,0 +0,0 @@ import org.bukkit.material.MaterialData; @@ -25,6 +25,6 @@ index c8b4efde..bc2df752 100644 + // Paper end + /** - * Get the id and data of the block that the Enderman is carrying. + * Gets the id and data of the block that the Enderman is carrying. * -- \ No newline at end of file diff --git a/Spigot-API-Patches/Entity-Origin-API.patch b/Spigot-API-Patches/Entity-Origin-API.patch index bdead47acf..6af144086e 100644 --- a/Spigot-API-Patches/Entity-Origin-API.patch +++ b/Spigot-API-Patches/Entity-Origin-API.patch @@ -25,7 +25,7 @@ index 28b169d2..9b0f97f1 100644 + // Paper end } diff --git a/src/main/java/org/bukkit/entity/FallingBlock.java b/src/main/java/org/bukkit/entity/FallingBlock.java -index 0b5c062f..48d6c951 100644 +index 9d34e691..b0b1defc 100644 --- a/src/main/java/org/bukkit/entity/FallingBlock.java +++ b/src/main/java/org/bukkit/entity/FallingBlock.java @@ -0,0 +0,0 @@ public interface FallingBlock extends Entity { diff --git a/Spigot-API-Patches/Expand-Explosions-API.patch b/Spigot-API-Patches/Expand-Explosions-API.patch index f9a5a110d8..e27b6b5d1f 100644 --- a/Spigot-API-Patches/Expand-Explosions-API.patch +++ b/Spigot-API-Patches/Expand-Explosions-API.patch @@ -95,7 +95,7 @@ index c1689168..d0d86e1a 100644 @Override public boolean equals(Object obj) { diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index cc74cf53..2c1056d1 100644 +index a22e47ea..04c174f7 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable { diff --git a/Spigot-API-Patches/Expand-World.spawnParticle-API-and-add-Builder.patch b/Spigot-API-Patches/Expand-World.spawnParticle-API-and-add-Builder.patch index 40abeaf9a2..463753e442 100644 --- a/Spigot-API-Patches/Expand-World.spawnParticle-API-and-add-Builder.patch +++ b/Spigot-API-Patches/Expand-World.spawnParticle-API-and-add-Builder.patch @@ -410,7 +410,7 @@ index 4d0acaf5..0ae85d85 100644 * Options which can be applied to redstone dust particles - a particle * color and size. diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 9b49ed38..cc74cf53 100644 +index 97badc63..a22e47ea 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable { diff --git a/Spigot-API-Patches/Expose-client-protocol-version-and-virtual-host.patch b/Spigot-API-Patches/Expose-client-protocol-version-and-virtual-host.patch index b19f89c44b..4fefba0623 100644 --- a/Spigot-API-Patches/Expose-client-protocol-version-and-virtual-host.patch +++ b/Spigot-API-Patches/Expose-client-protocol-version-and-virtual-host.patch @@ -55,7 +55,7 @@ index 00000000..9072e384 + +} diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 5c29c11e..60cdd620 100644 +index 47a12d71..362467e5 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -0,0 +0,0 @@ import org.bukkit.scoreboard.Scoreboard; diff --git a/Spigot-API-Patches/Fix-upstream-javadoc-warnings-and-errors.patch b/Spigot-API-Patches/Fix-upstream-javadoc-warnings-and-errors.patch index 612a9e71d2..5c4e24918c 100644 --- a/Spigot-API-Patches/Fix-upstream-javadoc-warnings-and-errors.patch +++ b/Spigot-API-Patches/Fix-upstream-javadoc-warnings-and-errors.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix upstream javadoc warnings and errors Upstream still refuses to use Java 8 with the API so they are likely unaware these are even issues. diff --git a/src/main/java/org/bukkit/NamespacedKey.java b/src/main/java/org/bukkit/NamespacedKey.java -index 19632d17..de1b1112 100644 +index 1ed8f7e4..bd5238ce 100644 --- a/src/main/java/org/bukkit/NamespacedKey.java +++ b/src/main/java/org/bukkit/NamespacedKey.java @@ -0,0 +0,0 @@ public final class NamespacedKey { @@ -21,7 +21,7 @@ index 19632d17..de1b1112 100644 */ @Deprecated diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 65156e80..6417cefa 100644 +index 1e980d2d..4cc70326 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable { @@ -112,7 +112,7 @@ index cfce8fa5..8660070b 100644 */ @Deprecated diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index d06f26b9..5c29c11e 100644 +index bc2f9621..47a12d71 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline diff --git a/Spigot-API-Patches/Implement-deprecated-player-sample-API.patch b/Spigot-API-Patches/Implement-deprecated-player-sample-API.patch deleted file mode 100644 index dc0d259bc0..0000000000 --- a/Spigot-API-Patches/Implement-deprecated-player-sample-API.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Minecrell -Date: Mon, 27 Nov 2017 16:21:19 +0100 -Subject: [PATCH] Implement deprecated player sample API - - -diff --git a/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java b/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java -index dd1deafd..db992df2 100644 ---- a/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java -+++ b/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java -@@ -0,0 +0,0 @@ import static java.util.Objects.requireNonNull; - - import com.destroystokyo.paper.network.StatusClient; - import com.destroystokyo.paper.profile.PlayerProfile; -+import com.google.common.base.Strings; - import org.bukkit.Bukkit; - import org.bukkit.entity.Player; - import org.bukkit.event.Cancellable; -@@ -0,0 +0,0 @@ public class PaperServerListPingEvent extends ServerListPingEvent implements Can - } - } - -+ // TODO: Remove in 1.13 -+ -+ @Override -+ @Deprecated -+ public List getSampleText() { -+ List sampleText = new ArrayList<>(); -+ for (PlayerProfile profile : getPlayerSample()) { -+ sampleText.add(Strings.nullToEmpty(profile.getName())); -+ } -+ return sampleText; -+ } -+ -+ @Override -+ @Deprecated -+ public void setSampleText(List sample) { -+ getPlayerSample().clear(); -+ for (String name : sample) { -+ getPlayerSample().add(Bukkit.createProfile(name)); -+ } -+ } -+ - } -diff --git a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java -index cb8d0fcd..116d7c7a 100644 ---- a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java -+++ b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java -@@ -0,0 +0,0 @@ import java.net.InetAddress; - import java.util.Iterator; - import java.util.List; - -+import com.destroystokyo.paper.event.server.PaperServerListPingEvent; - import org.apache.commons.lang.Validate; - import org.bukkit.entity.Player; - import org.bukkit.event.HandlerList; -@@ -0,0 +0,0 @@ public class ServerListPingEvent extends ServerEvent implements Iterable - private java.util.List sample; - - /** -- * @deprecated Will be replaced in 1.13 -+ * @deprecated Will be removed in 1.13, use {@link PaperServerListPingEvent#getPlayerSample()} - */ - @Deprecated - public void setSampleText(java.util.List sample) { -@@ -0,0 +0,0 @@ public class ServerListPingEvent extends ServerEvent implements Iterable - } - - /** -- * @deprecated Will be replaced in 1.13 -+ * @deprecated Will be removed in 1.13, use {@link PaperServerListPingEvent#getPlayerSample()} - */ - @Deprecated - public java.util.List getSampleText() { --- \ No newline at end of file diff --git a/Spigot-API-Patches/LivingEntity-Hand-Raised-Item-Use-API.patch b/Spigot-API-Patches/LivingEntity-Hand-Raised-Item-Use-API.patch index 3624415105..b5a32f3001 100644 --- a/Spigot-API-Patches/LivingEntity-Hand-Raised-Item-Use-API.patch +++ b/Spigot-API-Patches/LivingEntity-Hand-Raised-Item-Use-API.patch @@ -6,7 +6,7 @@ Subject: [PATCH] LivingEntity Hand Raised/Item Use API How long an entity has raised hands to charge an attack or use an item diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 5921c952..5ccb8ef3 100644 +index 7ea7ccf0..fea831e6 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -0,0 +0,0 @@ import org.bukkit.Material; diff --git a/Spigot-API-Patches/Make-shield-blocking-delay-configurable.patch b/Spigot-API-Patches/Make-shield-blocking-delay-configurable.patch index 358679ef77..ac887d6e85 100644 --- a/Spigot-API-Patches/Make-shield-blocking-delay-configurable.patch +++ b/Spigot-API-Patches/Make-shield-blocking-delay-configurable.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Make shield blocking delay configurable diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 42cf95e1..5921c952 100644 +index 700ed29f..7ea7ccf0 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Entity, Damageable, Projecti diff --git a/Spigot-API-Patches/POM-changes.patch b/Spigot-API-Patches/POM-changes.patch index 5f38cdc251..c1ae35f2f9 100644 --- a/Spigot-API-Patches/POM-changes.patch +++ b/Spigot-API-Patches/POM-changes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] POM changes diff --git a/pom.xml b/pom.xml -index 99ff13b3..cc8fca48 100644 +index 3e6c8707..c2d0651e 100644 --- a/pom.xml +++ b/pom.xml @@ -0,0 +0,0 @@ @@ -20,9 +20,8 @@ index 99ff13b3..cc8fca48 100644 + dev-SNAPSHOT + + -+ com.destroystokyo.paper + paper-api - 1.13-pre5-R0.1-SNAPSHOT + 1.13-pre7-R0.1-SNAPSHOT jar - Spigot-API @@ -32,7 +31,13 @@ index 99ff13b3..cc8fca48 100644 An enhanced plugin API for Minecraft servers. -@@ -0,0 +0,0 @@ +- 1.7 +- 1.7 ++ ++ 1.8 ++ 1.8 + UTF-8 + @@ -111,7 +116,7 @@ index 99ff13b3..cc8fca48 100644 - - org.codehaus.mojo - animal-sniffer-maven-plugin -- 1.16 +- 1.17 - - - process-classes @@ -123,7 +128,7 @@ index 99ff13b3..cc8fca48 100644 - - - org.codehaus.mojo.signature -- java18 +- java17 - 1.0 - - diff --git a/Spigot-API-Patches/Player.setPlayerProfile-API.patch b/Spigot-API-Patches/Player.setPlayerProfile-API.patch index 7ee38c73ef..5ca4e33d3e 100644 --- a/Spigot-API-Patches/Player.setPlayerProfile-API.patch +++ b/Spigot-API-Patches/Player.setPlayerProfile-API.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Player.setPlayerProfile API This can be useful for changing name or skins after a player has logged in. diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 32ead009..cd82ff64 100644 +index 6709168b..99080b27 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -0,0 +0,0 @@ package org.bukkit.entity; diff --git a/Spigot-API-Patches/Timings-v2.patch b/Spigot-API-Patches/Timings-v2.patch index e8af699d75..f42963ee09 100644 --- a/Spigot-API-Patches/Timings-v2.patch +++ b/Spigot-API-Patches/Timings-v2.patch @@ -3529,7 +3529,7 @@ index bba914d7..00000000 - // Spigot end -} diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 86eca9e1..116a1e7a 100644 +index 115c5b0b..90b22bcc 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline @@ -3602,7 +3602,7 @@ index 8b130abb..80c152ba 100644 } } diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 80c6a72e..759c4617 100644 +index 113b899c..81b42822 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -0,0 +0,0 @@ import org.bukkit.plugin.PluginLoader; diff --git a/Spigot-API-Patches/Use-ASM-for-event-executors.patch b/Spigot-API-Patches/Use-ASM-for-event-executors.patch index 8801ff5b2b..ed93a1e2ab 100644 --- a/Spigot-API-Patches/Use-ASM-for-event-executors.patch +++ b/Spigot-API-Patches/Use-ASM-for-event-executors.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Use ASM for event executors. Uses method handles for private or static methods. diff --git a/pom.xml b/pom.xml -index f5e8d49d..dfc6c9b5 100644 +index 5e2024ca..bd9146dd 100644 --- a/pom.xml +++ b/pom.xml @@ -0,0 +0,0 @@ @@ -401,7 +401,7 @@ index 3b2c99ea..b45b6c1c 100644 + // Paper end } diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index d8b9c244..40fd71dc 100644 +index 3af99b5b..72d506d1 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader { diff --git a/Spigot-API-Patches/ensureServerConversions-API.patch b/Spigot-API-Patches/ensureServerConversions-API.patch index f28651e7be..7bd554a9ef 100644 --- a/Spigot-API-Patches/ensureServerConversions-API.patch +++ b/Spigot-API-Patches/ensureServerConversions-API.patch @@ -7,7 +7,7 @@ This will take a Bukkit ItemStack and run it through any conversions a server pr to ensure it meets latest minecraft expectations. diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java -index f74f8ae9..ab33e09e 100644 +index 762c43d6..045c26d9 100644 --- a/src/main/java/org/bukkit/inventory/ItemFactory.java +++ b/src/main/java/org/bukkit/inventory/ItemFactory.java @@ -0,0 +0,0 @@ public interface ItemFactory { diff --git a/Spigot-Server-Patches/Access-items-by-EquipmentSlot.patch b/Spigot-Server-Patches/Access-items-by-EquipmentSlot.patch index c288755351..af16c17273 100644 --- a/Spigot-Server-Patches/Access-items-by-EquipmentSlot.patch +++ b/Spigot-Server-Patches/Access-items-by-EquipmentSlot.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Access items by EquipmentSlot diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java -index 67c54899d..3f58c34e0 100644 +index 6cbe06956..7b62f26d7 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java @@ -0,0 +0,0 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i diff --git a/Spigot-Server-Patches/Add-BeaconEffectEvent.patch b/Spigot-Server-Patches/Add-BeaconEffectEvent.patch index 12c9972271..4734fc2851 100644 --- a/Spigot-Server-Patches/Add-BeaconEffectEvent.patch +++ b/Spigot-Server-Patches/Add-BeaconEffectEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add BeaconEffectEvent diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java -index b84a2ce55..a57b17171 100644 +index c0db08f61..32b53bcae 100644 --- a/src/main/java/net/minecraft/server/TileEntityBeacon.java +++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java @@ -0,0 +0,0 @@ import org.bukkit.entity.HumanEntity; @@ -15,15 +15,13 @@ index b84a2ce55..a57b17171 100644 +// Paper start +import org.bukkit.craftbukkit.event.CraftEventFactory; +import org.bukkit.entity.Player; -+import org.bukkit.potion.PotionData; -+import org.bukkit.potion.PotionEffect; +import com.destroystokyo.paper.event.block.BeaconEffectEvent; +// Paper end + - public class TileEntityBeacon extends TileEntityContainer implements ITickable, IWorldInventory { + public class TileEntityBeacon extends TileEntityContainer implements IWorldInventory, ITickable { public static final MobEffectList[][] a = new MobEffectList[][] { { MobEffects.FASTER_MOVEMENT, MobEffects.FASTER_DIG}, { MobEffects.RESISTANCE, MobEffects.JUMP}, { MobEffects.INCREASE_DAMAGE}, { MobEffects.REGENERATION}}; -@@ -0,0 +0,0 @@ public class TileEntityBeacon extends TileEntityContainer implements ITickable, +@@ -0,0 +0,0 @@ public class TileEntityBeacon extends TileEntityContainer implements IWorldInven } private void applyEffect(List list, MobEffectList effects, int i, int b0) { @@ -55,7 +53,7 @@ index b84a2ce55..a57b17171 100644 } } } -@@ -0,0 +0,0 @@ public class TileEntityBeacon extends TileEntityContainer implements ITickable, +@@ -0,0 +0,0 @@ public class TileEntityBeacon extends TileEntityContainer implements IWorldInven int i = getLevel(); List list = getHumansInRange(); diff --git a/Spigot-Server-Patches/Add-MinecraftKey-Information-to-Objects.patch b/Spigot-Server-Patches/Add-MinecraftKey-Information-to-Objects.patch index 9c3751abc8..fab2560e99 100644 --- a/Spigot-Server-Patches/Add-MinecraftKey-Information-to-Objects.patch +++ b/Spigot-Server-Patches/Add-MinecraftKey-Information-to-Objects.patch @@ -5,26 +5,66 @@ Subject: [PATCH] Add MinecraftKey Information to Objects Stores the reference to the objects respective MinecraftKey +diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java +index a0ebc1eaa..e4c771a39 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java ++++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java +@@ -0,0 +0,0 @@ public class PaperCommand extends Command { + + List entities = world.entityList; + entities.forEach(e -> { +- MinecraftKey key = new MinecraftKey(""); // TODO: update in next patch ++ MinecraftKey key = e.getMinecraftKey(); + + MutablePair> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap())); + ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ()); +@@ -0,0 +0,0 @@ public class PaperCommand extends Command { + + Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Paper config reload complete."); + } +- ++ + } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index ed39b122e..3a8902bf1 100644 +index 515c9d875..53fc37088 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityPortalEvent; import org.bukkit.plugin.PluginManager; // CraftBukkit end --public abstract class Entity implements ICommandListener { -+public abstract class Entity implements ICommandListener, KeyedObject { // Paper +-public abstract class Entity implements INamableTileEntity, ICommandListener { ++public abstract class Entity implements INamableTileEntity, ICommandListener, KeyedObject { // Paper // CraftBukkit start private static final int CURRENT_LEVEL = 2; -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener { + private static final AxisAlignedBB b = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + private static double c = 1.0D; + private static int entityCount; +- private final EntityTypes g; ++ private final EntityTypes g; public EntityTypes getEntityType() { return g; } // Paper - OBFHELPER + private int id; + public boolean j; + public final List passengers; +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener { + } else { + this.defaultActivationState = false; + } ++ // Paper start ++ this.entityKey = EntityTypes.getName(entitytypes); ++ this.entityKeyString = this.entityKey != null ? this.entityKey.toString() : null; ++ // Paper end + // Spigot end + + this.datawatcher = new DataWatcher(this); +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener { return true; } + // Paper start -+ public final MinecraftKey entityKey = EntityTypes.getKey(this); -+ public final String entityKeyString = entityKey != null ? entityKey.toString() : null; ++ public final MinecraftKey entityKey; ++ public final String entityKeyString; + + @Override + public MinecraftKey getMinecraftKey() { @@ -37,14 +77,28 @@ index ed39b122e..3a8902bf1 100644 + } @Nullable public final String getSaveID() { -- MinecraftKey minecraftkey = EntityTypes.a(this); +- EntityTypes entitytypes = this.P(); +- MinecraftKey minecraftkey = EntityTypes.getName(entitytypes); - -- return minecraftkey == null ? null : minecraftkey.toString(); -+ return entityKeyString; +- return entitytypes.a() && minecraftkey != null ? minecraftkey.toString() : null; ++ EntityTypes type = this.getEntityType(); ++ return type != null && type.isPersistable() ? entityKeyString : null; + // Paper end } protected abstract void a(NBTTagCompound nbttagcompound); +diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java +index 557a3f97f..97cfd6695 100644 +--- a/src/main/java/net/minecraft/server/EntityTypes.java ++++ b/src/main/java/net/minecraft/server/EntityTypes.java +@@ -0,0 +0,0 @@ public class EntityTypes { + } + } + ++ public boolean isPersistable() { return a(); } // Paper - OBFHELPER + public boolean a() { + return this.aV; + } diff --git a/src/main/java/net/minecraft/server/KeyedObject.java b/src/main/java/net/minecraft/server/KeyedObject.java new file mode 100644 index 000000000..61c2b993c @@ -60,7 +114,7 @@ index 000000000..61c2b993c + } +} diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 5a5a588e7..672ba3134 100644 +index 093e7eb7f..b09325097 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; @@ -72,15 +126,22 @@ index 5a5a588e7..672ba3134 100644 public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot private static final Logger a = LogManager.getLogger(); +- private final TileEntityTypes e; ++ private final TileEntityTypes e; public TileEntityTypes getTileEntityType() { return e; } // Paper - OBFHELPER + protected World world; + protected BlockPosition position; + protected boolean d; @@ -0,0 +0,0 @@ public abstract class TileEntity { - TileEntity.f.a(new MinecraftKey(s), oclass); + public TileEntity(TileEntityTypes tileentitytypes) { + this.position = BlockPosition.ZERO; + this.e = tileentitytypes; ++ // Paper start ++ this.tileEntityKey = TileEntityTypes.a(tileentitytypes); ++ this.tileEntityKeyString = tileEntityKey != null ? tileEntityKey.toString() : null; } -- @Nullable -- public static MinecraftKey a(Class oclass) { -+ // Paper start -+ public final MinecraftKey tileEntityKey = getKey(this.getClass()); -+ public final String tileEntityKeyString = tileEntityKey != null ? tileEntityKey.toString() : null; ++ public final MinecraftKey tileEntityKey; ++ public final String tileEntityKeyString; + + @Override + public MinecraftKey getMinecraftKey() { @@ -91,9 +152,9 @@ index 5a5a588e7..672ba3134 100644 + public String getMinecraftKeyString() { + return tileEntityKeyString; + } -+ @Nullable public static MinecraftKey getKey(Class oclass) { return a(oclass); } // Paper - OBFHELPER -+ @Nullable public static MinecraftKey a(Class oclass) { - return (MinecraftKey) TileEntity.f.b(oclass); - } - ++ // Paper end ++ + @Nullable + public World getWorld() { + return this.world; -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Add-PlayerInitialSpawnEvent.patch b/Spigot-Server-Patches/Add-PlayerInitialSpawnEvent.patch index d40a60a81c..cd12cfc8eb 100644 --- a/Spigot-Server-Patches/Add-PlayerInitialSpawnEvent.patch +++ b/Spigot-Server-Patches/Add-PlayerInitialSpawnEvent.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add PlayerInitialSpawnEvent For modifying a player's initial spawn location as they join the server diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 1d9f3e3dd..536534d2e 100644 +index 1e3dd22e5..23562388a 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { diff --git a/Spigot-Server-Patches/Add-PlayerUseUnknownEntityEvent.patch b/Spigot-Server-Patches/Add-PlayerUseUnknownEntityEvent.patch index 0d31692b49..11455a9a17 100644 --- a/Spigot-Server-Patches/Add-PlayerUseUnknownEntityEvent.patch +++ b/Spigot-Server-Patches/Add-PlayerUseUnknownEntityEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerUseUnknownEntityEvent diff --git a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java -index c67cb54a3..521f46262 100644 +index 77440ac81..8711462e1 100644 --- a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java +++ b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java @@ -0,0 +0,0 @@ import javax.annotation.Nullable; @@ -18,7 +18,7 @@ index c67cb54a3..521f46262 100644 private Vec3D c; private EnumHand d; diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index e1b85ebae..7c708a0de 100644 +index 2cc277e4f..553011d88 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { diff --git a/Spigot-Server-Patches/Add-World-Util-Methods.patch b/Spigot-Server-Patches/Add-World-Util-Methods.patch index 3d88d7a1ce..e1666e6a86 100644 --- a/Spigot-Server-Patches/Add-World-Util-Methods.patch +++ b/Spigot-Server-Patches/Add-World-Util-Methods.patch @@ -6,65 +6,57 @@ Subject: [PATCH] Add World Util Methods Methods that can be used for other patches to help improve logic. diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 0788f7712..57b23a018 100644 +index fa500e93f..f376b3a34 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -0,0 +0,0 @@ public class Chunk { - +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + } } + public final int getLightSubtracted(BlockPosition blockposition, int i) { return this.a(blockposition, i); } // Paper - OBFHELPER public int a(BlockPosition blockposition, int i) { - int j = blockposition.getX() & 15; - int k = blockposition.getY(); + return this.a(blockposition, i, this.world.o().g()); + } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 6be9c1815..b8ae41704 100644 +index d51ed0f80..1c939e523 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - public final List j = Lists.newArrayList(); +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose + public final List k = Lists.newArrayList(); protected final IntHashMap entitiesById = new IntHashMap(); - private final long K = 16777215L; -- private int L; -+ private int L; private int getSkylightSubtracted() { return this.L; } // Paper - OBFHELPER - protected int l = (new Random()).nextInt(); - protected final int m = 1013904223; - protected float n; -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - return (CraftServer) Bukkit.getServer(); + private final long G = 16777215L; +- private int H; ++ private int H; private int getSkylightSubtracted() { return this.H; } // Paper - OBFHELPER + protected int m = (new Random()).nextInt(); + protected final int n = 1013904223; + protected float o; +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose + return this.getType(blockposition).isAir(); } + // Paper start + public Chunk getChunkIfLoaded(BlockPosition blockposition) { + return ((ChunkProviderServer) this.chunkProvider).getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4); + } -+ // Paper end -+ - public Chunk getChunkIfLoaded(int x, int z) { - return ((ChunkProviderServer) this.chunkProvider).getChunkIfLoaded(x, z); - } -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - } - } - -+ // Paper start - test if meets light level, return faster ++ // test if meets light level, return faster + // logic copied from below + public boolean isLightLevel(BlockPosition blockposition, int level) { + if (isValidLocation(blockposition)) { -+ if (this.getType(blockposition).f()) { -+ if (this.c(blockposition.up(), false) >= level) { ++ if (this.getType(blockposition).c(this, blockposition)) { ++ int sky = getSkylightSubtracted(); ++ if (this.getLightLevel(blockposition.up(), sky) >= level) { + return true; + } -+ if (this.c(blockposition.east(), false) >= level) { ++ if (this.getLightLevel(blockposition.east(), sky) >= level) { + return true; + } -+ if (this.c(blockposition.west(), false) >= level) { ++ if (this.getLightLevel(blockposition.west(), sky) >= level) { + return true; + } -+ if (this.c(blockposition.south(), false) >= level) { ++ if (this.getLightLevel(blockposition.south(), sky) >= level) { + return true; + } -+ if (this.c(blockposition.north(), false) >= level) { ++ if (this.getLightLevel(blockposition.north(), sky) >= level) { + return true; + } + return false; @@ -80,42 +72,26 @@ index 6be9c1815..b8ae41704 100644 + return true; + } + } -+ // Paper end -+ - public int getLightLevel(BlockPosition blockposition) { - return this.c(blockposition, true); - } - -+ public final int getLight(BlockPosition blockposition, boolean checkNeighbors) { return this.c(blockposition, checkNeighbors); } // Paper - OBFHELPER - public int c(BlockPosition blockposition, boolean flag) { - if (blockposition.getX() >= -30000000 && blockposition.getZ() >= -30000000 && blockposition.getX() < 30000000 && blockposition.getZ() < 30000000) { - if (flag && this.getType(blockposition).f()) { -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - return this.worldProvider.o()[this.getLightLevel(blockposition)]; - } - -+ // Paper start - reduces need to do isLoaded before getType ++ // reduces need to do isLoaded before getType + public IBlockData getTypeIfLoaded(BlockPosition blockposition) { + // CraftBukkit start - tree generation + if (captureTreeGeneration) { -+ Iterator it = capturedBlockStates.iterator(); -+ while (it.hasNext()) { -+ BlockState previous = it.next(); ++ for (CraftBlockState previous : capturedBlockStates) { + if (previous.getX() == blockposition.getX() && previous.getY() == blockposition.getY() && previous.getZ() == blockposition.getZ()) { -+ return CraftMagicNumbers.getBlock(previous.getTypeId()).fromLegacyData(previous.getRawData()); ++ return previous.getHandle(); + } + } + } + // CraftBukkit end + Chunk chunk = this.getChunkIfLoaded(blockposition); + if (chunk != null) { -+ return this.isValidLocation(blockposition) ? chunk.getBlockData(blockposition) : Blocks.AIR.getBlockData(); ++ return isValidLocation(blockposition) ? chunk.getBlockData(blockposition) : Blocks.AIR.getBlockData(); + } + return null; + } + // Paper end + - public IBlockData getType(BlockPosition blockposition) { - // CraftBukkit start - tree generation - if (captureTreeGeneration) { + public Chunk getChunkAtWorldCoords(BlockPosition blockposition) { + return this.getChunkAt(blockposition.getX() >> 4, blockposition.getZ() >> 4); + } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Add-async-chunk-load-API.patch b/Spigot-Server-Patches/Add-async-chunk-load-API.patch index cf0e5d542e..33cb6b8c0b 100644 --- a/Spigot-Server-Patches/Add-async-chunk-load-API.patch +++ b/Spigot-Server-Patches/Add-async-chunk-load-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add async chunk load API diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index ef8165da4..01fc193db 100644 +index 0b2a9d09d..4df849eef 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -0,0 +0,0 @@ public class CraftWorld implements World { diff --git a/Spigot-Server-Patches/Add-configurable-despawn-distances-for-living-entiti.patch b/Spigot-Server-Patches/Add-configurable-despawn-distances-for-living-entiti.patch index 0f52075c56..63ac3725c0 100644 --- a/Spigot-Server-Patches/Add-configurable-despawn-distances-for-living-entiti.patch +++ b/Spigot-Server-Patches/Add-configurable-despawn-distances-for-living-entiti.patch @@ -30,7 +30,7 @@ index 1d9dd0e0b..22c1113a1 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 7b02b253c..94967e6b6 100644 +index 27b01d1ee..c8c191667 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { diff --git a/Spigot-Server-Patches/Add-configurable-portal-search-radius.patch b/Spigot-Server-Patches/Add-configurable-portal-search-radius.patch index 3a594b2c32..236c944429 100644 --- a/Spigot-Server-Patches/Add-configurable-portal-search-radius.patch +++ b/Spigot-Server-Patches/Add-configurable-portal-search-radius.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add configurable portal search radius diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index a289ba019..38ccabc0d 100644 +index 0743db5ac..1ba09df9c 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -19,17 +19,17 @@ index a289ba019..38ccabc0d 100644 + } } diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java -index d1c67e396..f49729796 100644 +index 0cb1eeb68..402d8d7d6 100644 --- a/src/main/java/net/minecraft/server/PortalTravelAgent.java +++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java @@ -0,0 +0,0 @@ import org.bukkit.util.Vector; - public class PortalTravelAgent { + private static final BlockPortal a = (BlockPortal) Blocks.NETHER_PORTAL; - private final WorldServer world; -+ protected final WorldServer world; // Paper - private -> protected - private final Random b; - private final Long2ObjectMap c = new Long2ObjectOpenHashMap(4096); ++ public final WorldServer world; // Paper - private -> public + private final Random c; + private final Long2ObjectMap d = new Long2ObjectOpenHashMap(4096); @@ -0,0 +0,0 @@ public class PortalTravelAgent { diff --git a/Spigot-Server-Patches/Add-exception-reporting-event.patch b/Spigot-Server-Patches/Add-exception-reporting-event.patch index 53e5fb468b..508af80fbd 100644 --- a/Spigot-Server-Patches/Add-exception-reporting-event.patch +++ b/Spigot-Server-Patches/Add-exception-reporting-event.patch @@ -50,30 +50,39 @@ index 000000000..93397188b +} \ No newline at end of file diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index a5db14343..0788f7712 100644 +index 32f467b37..fa500e93f 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ package net.minecraft.server; +import com.destroystokyo.paper.exception.ServerInternalException; - import com.google.common.base.Predicate; import com.google.common.collect.Maps; import com.google.common.collect.Queues; -@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; + import com.google.common.collect.Sets; +@@ -0,0 +0,0 @@ import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; import com.google.common.collect.Lists; // CraftBukkit - import org.bukkit.Server; // CraftBukkit ++import org.bukkit.Server; // CraftBukkit +import org.bukkit.craftbukkit.util.CraftMagicNumbers; // Paper - public class Chunk { + public class Chunk implements IChunkAccess { -@@ -0,0 +0,0 @@ public class Chunk { +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + return this.getBlockData(i, j, k).b(this.world, new BlockPosition(i, j, k)); + } + ++ public IBlockData getBlockData(BlockPosition blockposition) { return getType(blockposition); } // Paper + public IBlockData getType(BlockPosition blockposition) { + return this.getBlockData(blockposition.getX(), blockposition.getY(), blockposition.getZ()); + } +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { this.tileEntities.remove(blockposition); // Paper end } else { - System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ() -- + " (" + org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getBlockData(blockposition).getBlock()) + ") where there was no entity tile!"); +- + " (" + getType(blockposition) + ") where there was no entity tile!"); - System.out.println("Chunk coordinates: " + (this.locX * 16) + "," + (this.locZ * 16)); - new Exception().printStackTrace(); + // Paper start @@ -89,33 +98,20 @@ index a5db14343..0788f7712 100644 } } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 2b320cbd1..4e7e8e5fd 100644 +index 51bc23daf..bb96a7392 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -0,0 +0,0 @@ import java.util.Iterator; - import java.util.List; - import java.util.Set; +@@ -0,0 +0,0 @@ import java.util.concurrent.ExecutionException; + import java.util.function.Consumer; + import java.util.function.Function; import javax.annotation.Nullable; +import com.destroystokyo.paper.exception.ServerInternalException; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider { - - return chunk; - } catch (Exception exception) { -- ChunkProviderServer.a.error("Couldn\'t load chunk", exception); -+ // Paper start -+ String msg = "Couldn\'t load chunk"; -+ ChunkProviderServer.a.error(msg, exception); -+ ServerInternalException.reportInternalException(exception); -+ // Paper end - return null; - } - } @@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider { try { - // this.chunkLoader.b(this.world, chunk); // Spigot + // this.chunkLoader.a(this.world, chunk); // Spigot } catch (Exception exception) { - ChunkProviderServer.a.error("Couldn\'t save entities", exception); + // Paper start @@ -127,8 +123,8 @@ index 2b320cbd1..4e7e8e5fd 100644 } @@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider { - chunk.setLastSaved(this.world.getTime()); - this.chunkLoader.saveChunk(this.world, chunk, unloaded); // Spigot + ichunkaccess.setLastSaved(this.world.getTime()); + this.chunkLoader.saveChunk(this.world, ichunkaccess, unloaded); // Spigot } catch (IOException ioexception) { - ChunkProviderServer.a.error("Couldn\'t save chunk", ioexception); + // Paper start @@ -144,17 +140,16 @@ index 2b320cbd1..4e7e8e5fd 100644 } diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -index 83322b85b..b943a9b20 100644 +index 33e5aaf2c..f13534917 100644 --- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java +++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java @@ -0,0 +0,0 @@ package net.minecraft.server; +import com.destroystokyo.paper.exception.ServerInternalException; -+import com.google.common.base.Charsets; - import com.google.common.base.Predicate; - import com.google.common.collect.Iterators; import com.google.common.collect.Lists; + import com.google.common.collect.Maps; + import com.google.common.io.Files; @@ -0,0 +0,0 @@ public class NameReferencingFileConverter { root = NBTCompressedStreamTools.a(new java.io.FileInputStream(file1)); } catch (Exception exception) { @@ -172,7 +167,7 @@ index 83322b85b..b943a9b20 100644 } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/PersistentCollection.java b/src/main/java/net/minecraft/server/PersistentCollection.java -index 936d6c640..50056f49a 100644 +index 0ffca4301..86d8fd0d9 100644 --- a/src/main/java/net/minecraft/server/PersistentCollection.java +++ b/src/main/java/net/minecraft/server/PersistentCollection.java @@ -0,0 +0,0 @@ @@ -181,15 +176,15 @@ index 936d6c640..50056f49a 100644 +import com.destroystokyo.paper.exception.ServerInternalException; import com.google.common.collect.Lists; import com.google.common.collect.Maps; - import java.io.DataInputStream; + import com.mojang.datafixers.DataFixTypes; @@ -0,0 +0,0 @@ public class PersistentCollection { - } - } catch (Exception exception1) { - exception1.printStackTrace(); -+ ServerInternalException.reportInternalException(exception1); // Paper - } - } - + nbttagcompound = GameProfileSerializer.a(this.c.i(), DataFixTypes.SAVED_DATA, nbttagcompound1, j, i); + } catch (Throwable throwable1) { + throwable = throwable1; ++ ServerInternalException.reportInternalException(throwable1); // Paper + throw throwable1; + } finally { + if (fileinputstream != null) { @@ -0,0 +0,0 @@ public class PersistentCollection { } } catch (Exception exception) { @@ -199,7 +194,7 @@ index 936d6c640..50056f49a 100644 } diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 1ba26de5c..6a92b5af8 100644 +index 94364baae..c80d724f0 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java @@ -0,0 +0,0 @@ @@ -218,7 +213,7 @@ index 1ba26de5c..6a92b5af8 100644 } @@ -0,0 +0,0 @@ public class RegionFile { - this.b(i, j, (int) (MinecraftServer.aw() / 1000L)); + this.b(i, j, (int) (SystemUtils.d() / 1000L)); } catch (IOException ioexception) { ioexception.printStackTrace(); + ServerInternalException.reportInternalException(ioexception); // Paper @@ -226,7 +221,7 @@ index 1ba26de5c..6a92b5af8 100644 } diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index c15a0d1f8..5f9e9ddef 100644 +index d394645a5..384628ccc 100644 --- a/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/src/main/java/net/minecraft/server/RegionFileCache.java @@ -0,0 +0,0 @@ @@ -245,11 +240,11 @@ index c15a0d1f8..5f9e9ddef 100644 } diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 1c7c187c7..68a045323 100644 +index aec9cdae5..6d842df62 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java -@@ -0,0 +0,0 @@ import java.util.Random; - import java.util.Set; +@@ -0,0 +0,0 @@ import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; // CraftBukkit start +import com.destroystokyo.paper.exception.ServerInternalException; @@ -257,23 +252,23 @@ index 1c7c187c7..68a045323 100644 import org.bukkit.craftbukkit.util.LongHashSet; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; @@ -0,0 +0,0 @@ public final class SpawnerCreature { - entityinsentient = (EntityInsentient) biomebase_biomemeta.b.getConstructor(new Class[] { World.class}).newInstance(new Object[] { worldserver}); - } catch (Exception exception) { - exception.printStackTrace(); -+ ServerInternalException.reportInternalException(exception); // Paper - return j1; - } + entityinsentient = (EntityInsentient) biomebase_biomemeta.b.a((World) worldserver); + } catch (Exception exception) { + SpawnerCreature.a.warn("Failed to create mob", exception); ++ ServerInternalException.reportInternalException(exception); // Paper + return j1; + } @@ -0,0 +0,0 @@ public final class SpawnerCreature { - entityinsentient = (EntityInsentient) biomebase_biomemeta.b.getConstructor(new Class[] { World.class}).newInstance(new Object[] { world}); + entityinsentient = (EntityInsentient) biomebase_biomemeta.b.a(generatoraccess.getMinecraftWorld()); } catch (Exception exception) { - exception.printStackTrace(); + SpawnerCreature.a.warn("Failed to create mob", exception); + ServerInternalException.reportInternalException(exception); // Paper continue; } diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java -index 9ff4f23ab..6fce3015f 100644 +index 4ff243dab..67b2e41c7 100644 --- a/src/main/java/net/minecraft/server/VillageSiege.java +++ b/src/main/java/net/minecraft/server/VillageSiege.java @@ -0,0 +0,0 @@ @@ -285,7 +280,7 @@ index 9ff4f23ab..6fce3015f 100644 import java.util.List; import javax.annotation.Nullable; @@ -0,0 +0,0 @@ public class VillageSiege { - entityzombie.prepare(this.a.D(new BlockPosition(entityzombie)), (GroupDataEntity) null); + entityzombie.prepare(this.a.getDamageScaler(new BlockPosition(entityzombie)), (GroupDataEntity) null, (NBTTagCompound) null); } catch (Exception exception) { exception.printStackTrace(); + ServerInternalException.reportInternalException(exception); // Paper @@ -293,18 +288,19 @@ index 9ff4f23ab..6fce3015f 100644 } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 89197281e..6be9c1815 100644 +index 26b2a1fd4..d51ed0f80 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ package net.minecraft.server; + import co.aikar.timings.Timings; +import com.destroystokyo.paper.event.server.ServerExceptionEvent; +import com.destroystokyo.paper.exception.ServerInternalException; - import com.google.common.base.Function; import com.google.common.base.MoreObjects; - import com.google.common.base.Predicate; -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + import com.google.common.collect.Lists; + import java.util.ArrayList; +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose } catch (Throwable throwable1) { entity.tickTimer.stopTiming(); // Paper start - Prevent tile entity and entity crashes @@ -316,8 +312,8 @@ index 89197281e..6be9c1815 100644 entity.dead = true; continue; // Paper end -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - this.methodProfiler.b(); +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose + this.methodProfiler.e(); } catch (Throwable throwable2) { // Paper start - Prevent tile entity and entity crashes - System.err.println("TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ()); diff --git a/Spigot-Server-Patches/Add-handshake-event-to-allow-plugins-to-handle-clien.patch b/Spigot-Server-Patches/Add-handshake-event-to-allow-plugins-to-handle-clien.patch index a2d70a2e75..1c2ffd791f 100644 --- a/Spigot-Server-Patches/Add-handshake-event-to-allow-plugins-to-handle-clien.patch +++ b/Spigot-Server-Patches/Add-handshake-event-to-allow-plugins-to-handle-clien.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add handshake event to allow plugins to handle client diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java -index c3c9c3c1f..309ab18df 100644 +index 7c75433f5..088ec198e 100644 --- a/src/main/java/net/minecraft/server/HandshakeListener.java +++ b/src/main/java/net/minecraft/server/HandshakeListener.java @@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener { diff --git a/Spigot-Server-Patches/Add-methods-for-working-with-arrows-stuck-in-living-.patch b/Spigot-Server-Patches/Add-methods-for-working-with-arrows-stuck-in-living-.patch index 522cac864d..a84f973e27 100644 --- a/Spigot-Server-Patches/Add-methods-for-working-with-arrows-stuck-in-living-.patch +++ b/Spigot-Server-Patches/Add-methods-for-working-with-arrows-stuck-in-living-.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add methods for working with arrows stuck in living entities diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 34f1ef176..d4d51688c 100644 +index 2ef1433a7..7e3a9eeb2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/Spigot-Server-Patches/Add-player-view-distance-API.patch b/Spigot-Server-Patches/Add-player-view-distance-API.patch index f236440f9f..fd13a9db4f 100644 --- a/Spigot-Server-Patches/Add-player-view-distance-API.patch +++ b/Spigot-Server-Patches/Add-player-view-distance-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add player view distance API diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index dfaab774d..3058dfef0 100644 +index cb44bf3a7..0531812fb 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @@ -25,7 +25,7 @@ index dfaab774d..3058dfef0 100644 // CraftBukkit start public String displayName; diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index e4ed2e991..9627a9be0 100644 +index d975c2ccf..6ece565c5 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap { @@ -203,12 +203,12 @@ index e4ed2e991..9627a9be0 100644 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index e3ad45aa8..e6ff3fc97 100644 +index 79223dfa6..bb3a48e57 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - return this.getHandle().affectsSpawning; } + // Paper end + @Override + public int getViewDistance() { diff --git a/Spigot-Server-Patches/Add-velocity-warnings.patch b/Spigot-Server-Patches/Add-velocity-warnings.patch index 6b51b86cd5..d27c8c77b1 100644 --- a/Spigot-Server-Patches/Add-velocity-warnings.patch +++ b/Spigot-Server-Patches/Add-velocity-warnings.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Add velocity warnings diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 1386bed52..d56966109 100644 +index 32a05ca18..eaac1430e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { - private boolean unrestrictedAdvancements; + public boolean ignoreVanillaPermissions = false; private final List playerView; public int reloadCount; + public static Exception excessiveVelEx; // Paper - Velocity warnings @@ -17,7 +17,7 @@ index 1386bed52..d56966109 100644 private final class BooleanWrapper { private boolean value = true; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 6c23e88a5..3b25b8b73 100644 +index 0daa15f1b..2b9c571ca 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/Spigot-Server-Patches/All-chunks-are-slime-spawn-chunks-toggle.patch b/Spigot-Server-Patches/All-chunks-are-slime-spawn-chunks-toggle.patch index e5a2c91c07..8ad2fd44d8 100644 --- a/Spigot-Server-Patches/All-chunks-are-slime-spawn-chunks-toggle.patch +++ b/Spigot-Server-Patches/All-chunks-are-slime-spawn-chunks-toggle.patch @@ -5,7 +5,7 @@ Subject: [PATCH] All chunks are slime spawn chunks toggle diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 4c57b9cbf..a289ba019 100644 +index 43aa73e1d..0743db5ac 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -19,18 +19,16 @@ index 4c57b9cbf..a289ba019 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java -index 272b22652..3d3a9ca04 100644 +index 3167c3f5f..3b13b697a 100644 --- a/src/main/java/net/minecraft/server/EntitySlime.java +++ b/src/main/java/net/minecraft/server/EntitySlime.java @@ -0,0 +0,0 @@ public class EntitySlime extends EntityInsentient implements IMonster { - if (biomebase == Biomes.h && this.locY > 50.0D && this.locY < 70.0D && this.random.nextFloat() < 0.5F && this.random.nextFloat() < this.world.G() && this.world.getLightLevel(new BlockPosition(this)) <= this.random.nextInt(8)) { - return super.P(); } -- -- if (this.random.nextInt(10) == 0 && chunk.a(world.spigotConfig.slimeSeed).nextInt(10) == 0 && this.locY < 40.0D) { // Spigot -+ boolean isSlimeChunk = world.paperConfig.allChunksAreSlimeChunks || chunk.a(world.spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper -+ if (this.random.nextInt(10) == 0 && isSlimeChunk && this.locY < 40.0D) { // Paper - return super.P(); - } - } + + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(blockposition); +- boolean flag = SeededRandom.a(chunkcoordintpair.x, chunkcoordintpair.z, generatoraccess.getSeed(), world.spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot ++ boolean flag = world.paperConfig.allChunksAreSlimeChunks || SeededRandom.a(chunkcoordintpair.x, chunkcoordintpair.z, generatoraccess.getSeed(), world.spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper - add allChunksAreSlime + + if (this.random.nextInt(10) == 0 && flag && this.locY < 40.0D) { + return super.a(generatoraccess); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Allow-Reloading-of-Custom-Permissions.patch b/Spigot-Server-Patches/Allow-Reloading-of-Custom-Permissions.patch index 12fe703dcb..ff987c119a 100644 --- a/Spigot-Server-Patches/Allow-Reloading-of-Custom-Permissions.patch +++ b/Spigot-Server-Patches/Allow-Reloading-of-Custom-Permissions.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Allow Reloading of Custom Permissions https://github.com/PaperMC/Paper/issues/49 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index d482589b3..e53f8c58f 100644 +index 6dae117ac..5ffb335f5 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { diff --git a/Spigot-Server-Patches/Allow-for-toggling-of-spawn-chunks.patch b/Spigot-Server-Patches/Allow-for-toggling-of-spawn-chunks.patch index ef8129a3df..97331d0fee 100644 --- a/Spigot-Server-Patches/Allow-for-toggling-of-spawn-chunks.patch +++ b/Spigot-Server-Patches/Allow-for-toggling-of-spawn-chunks.patch @@ -20,10 +20,10 @@ index 22c1113a1..0094d1a87 100644 + } } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index d902e2630..759964b0f 100644 +index e6b916a5d..05d363171 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose this.getServer().addWorld(this.world); // CraftBukkit end timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings diff --git a/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump.patch b/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump.patch index 7d602902e6..2d7f36f0cc 100644 --- a/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump.patch +++ b/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump.patch @@ -19,7 +19,7 @@ index 45bddf3f4..1d9dd0e0b 100644 + } } diff --git a/src/main/java/net/minecraft/server/ControllerJump.java b/src/main/java/net/minecraft/server/ControllerJump.java -index 4f2fa59ac..8af52a61f 100644 +index 4ed5192c6..489beed26 100644 --- a/src/main/java/net/minecraft/server/ControllerJump.java +++ b/src/main/java/net/minecraft/server/ControllerJump.java @@ -0,0 +0,0 @@ public class ControllerJump { @@ -28,20 +28,20 @@ index 4f2fa59ac..8af52a61f 100644 + public void jumpIfSet() { this.b(); } // Paper - OBFHELPER public void b() { - this.b.l(this.a); + this.b.o(this.a); this.a = false; diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 3c48d9463..7b02b253c 100644 +index 5de20721c..27b01d1ee 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { - private boolean bE; - private Entity leashHolder; - private NBTTagCompound bG; + private final EntityAIBodyControl b; + protected NavigationAbstract navigation; + public PathfinderGoalSelector goalSelector; + @Nullable public PathfinderGoalFloat goalFloat; // Paper - - public EntityInsentient(World world) { - super(world); + public PathfinderGoalSelector targetSelector; + private EntityLiving goalTarget; + private final EntitySenses bC; @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { // Spigot Start if ( this.fromMobSpawner ) @@ -56,7 +56,7 @@ index 3c48d9463..7b02b253c 100644 } // Spigot End diff --git a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java -index b3b303b3b..fc6c3bf71 100644 +index 4d8876cae..2cb9d1b5a 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java @@ -0,0 +0,0 @@ public class PathfinderGoalFloat extends PathfinderGoal { @@ -73,7 +73,7 @@ index b3b303b3b..fc6c3bf71 100644 + public boolean validConditions() { return this.a(); } // Paper - OBFHELPER public boolean a() { - return this.a.isInWater() || this.a.au(); + return this.a.isInWater() || this.a.ax(); } + public void update() { this.e(); } // Paper - OBFHELPER diff --git a/Spigot-Server-Patches/Always-tick-falling-blocks.patch b/Spigot-Server-Patches/Always-tick-falling-blocks.patch index 4e5ab11d95..48f6351fba 100644 --- a/Spigot-Server-Patches/Always-tick-falling-blocks.patch +++ b/Spigot-Server-Patches/Always-tick-falling-blocks.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Always tick falling blocks diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 38be7ed71..3265a6c25 100644 +index f68e42c4d..1aade75f3 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -0,0 +0,0 @@ import net.minecraft.server.EntityCreature; @@ -22,6 +22,6 @@ index 38be7ed71..3265a6c25 100644 || entity instanceof EntityTNTPrimed + || entity instanceof EntityFallingBlock // Paper - Always tick falling blocks || entity instanceof EntityEnderCrystal - || entity instanceof EntityFireworks ) - { + || entity instanceof EntityFireworks + || entity instanceof EntityThrownTrident ) -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Avoid-hopper-searches-if-there-are-no-items.patch b/Spigot-Server-Patches/Avoid-hopper-searches-if-there-are-no-items.patch index 230190f119..c1534d19fd 100644 --- a/Spigot-Server-Patches/Avoid-hopper-searches-if-there-are-no-items.patch +++ b/Spigot-Server-Patches/Avoid-hopper-searches-if-there-are-no-items.patch @@ -14,52 +14,45 @@ And since minecart hoppers are used _very_ rarely near we can avoid alot of sear Combined, this adds up a lot. diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index aaf253c89..a5db14343 100644 +index e5567701e..32f467b37 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -0,0 +0,0 @@ public class Chunk { - public boolean d; - protected gnu.trove.map.hash.TObjectIntHashMap entityCount = new gnu.trove.map.hash.TObjectIntHashMap(); // Spigot - -+ // Paper start +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + } + } + final PaperLightingQueue.LightingQueue lightingQueue = new PaperLightingQueue.LightingQueue(this); + // Track the number of minecarts and items + // Keep this synced with entitySlices.add() and entitySlices.remove() + private final int[] itemCounts = new int[16]; + private final int[] inventoryEntityCounts = new int[16]; -+ // Paper end -+ - // CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking - private int neighbors = 0x1 << 12; - public long chunkKey; -@@ -0,0 +0,0 @@ public class Chunk { - entity.ac = k; - entity.ad = this.locZ; + // Paper end + public boolean areNeighborsLoaded(final int radius) { + switch (radius) { +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + entity.ag = this.locZ; this.entitySlices[k].add(entity); -+ // Paper start - update count + // Paper start + if (entity instanceof EntityItem) { + itemCounts[k]++; + } else if (entity instanceof IInventory) { + inventoryEntityCounts[k]++; + } -+ // Paper end - // Spigot start - increment creature type count - // Keep this synced up with World.a(Class) - if (entity instanceof EntityInsentient) { -@@ -0,0 +0,0 @@ public class Chunk { + entity.setCurrentChunk(this); + entityCounts.increment(entity.entityKeyString); + // Paper end +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + if (!this.entitySlices[i].remove(entity)) { + return; } - - this.entitySlices[i].remove(entity); -+ // Paper start - update counts + if (entity instanceof EntityItem) { + itemCounts[i]--; + } else if (entity instanceof IInventory) { + inventoryEntityCounts[i]--; + } -+ // Paper end - // Spigot start - decrement creature type count - // Keep this synced up with World.a(Class) - if (entity instanceof EntityInsentient) { -@@ -0,0 +0,0 @@ public class Chunk { + entity.setCurrentChunk(null); + entityCounts.decrement(entity.entityKeyString); + // Paper end +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { if (!this.entitySlices[k].isEmpty()) { Iterator iterator = this.entitySlices[k].iterator(); @@ -75,7 +68,7 @@ index aaf253c89..a5db14343 100644 while (iterator.hasNext()) { Entity entity1 = (Entity) iterator.next(); -@@ -0,0 +0,0 @@ public class Chunk { +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { i = MathHelper.clamp(i, 0, this.entitySlices.length - 1); j = MathHelper.clamp(j, 0, this.entitySlices.length - 1); diff --git a/Spigot-Server-Patches/Be-a-bit-more-informative-in-maxHealth-exception.patch b/Spigot-Server-Patches/Be-a-bit-more-informative-in-maxHealth-exception.patch index ba03bdb48d..b80e3dbc1f 100644 --- a/Spigot-Server-Patches/Be-a-bit-more-informative-in-maxHealth-exception.patch +++ b/Spigot-Server-Patches/Be-a-bit-more-informative-in-maxHealth-exception.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Be a bit more informative in maxHealth exception diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index bf4428e1c..34f1ef176 100644 +index 0b12ed819..83e6276b8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/Spigot-Server-Patches/Catch-Async-PlayerChunkMap-operations.patch b/Spigot-Server-Patches/Catch-Async-PlayerChunkMap-operations.patch index 85af850771..e525626db9 100644 --- a/Spigot-Server-Patches/Catch-Async-PlayerChunkMap-operations.patch +++ b/Spigot-Server-Patches/Catch-Async-PlayerChunkMap-operations.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Catch Async PlayerChunkMap operations diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 9627a9be0..ad1d90b56 100644 +index 6ece565c5..4d888d6d4 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap { diff --git a/Spigot-Server-Patches/Change-implementation-of-tile-entity-removal-list.patch b/Spigot-Server-Patches/Change-implementation-of-tile-entity-removal-list.patch index 5f48152f48..549cd1ddb3 100644 --- a/Spigot-Server-Patches/Change-implementation-of-tile-entity-removal-list.patch +++ b/Spigot-Server-Patches/Change-implementation-of-tile-entity-removal-list.patch @@ -4,77 +4,64 @@ Date: Thu, 3 Mar 2016 02:39:54 -0600 Subject: [PATCH] Change implementation of (tile)entity removal list -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index aadc426fd..584501787 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper - private static final DataWatcherObject aC = DataWatcher.a(Entity.class, DataWatcherRegistry.h); - private static final DataWatcherObject aD = DataWatcher.a(Entity.class, DataWatcherRegistry.h); - private static final DataWatcherObject aE = DataWatcher.a(Entity.class, DataWatcherRegistry.h); -- public boolean aa; -+ public boolean aa; public boolean isAddedToChunk() { return aa; } // Paper - OBFHELPER - public int ab; public int getChunkX() { return ab; } // Paper - OBFHELPER - public int ac; public int getChunkY() { return ac; } // Paper - OBFHELPER - public int ad; public int getChunkZ() { return ad; } // Paper - OBFHELPER diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index e85ed2e33..89197281e 100644 +index d988fd007..26b2a1fd4 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; +@@ -0,0 +0,0 @@ import org.bukkit.event.block.BlockPhysicsEvent; + import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; import org.bukkit.generator.ChunkGenerator; // CraftBukkit end - +- +// Paper start +import java.util.Set; +import com.google.common.collect.Sets; +// Paper end -+ - public abstract class World implements IBlockAccess { + public abstract class World implements GeneratorAccess, IIBlockAccess, AutoCloseable { - private int a = 63; -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + protected static final Logger e = LogManager.getLogger(); +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose } }; // Spigot end -- protected final List f = Lists.newArrayList(); -+ protected final Set f = Sets.newHashSet(); // Paper +- protected final List g = Lists.newArrayList(); ++ protected final Set g = Sets.newHashSet(); // Paper public final List tileEntityList = Lists.newArrayList(); public final List tileEntityListTick = Lists.newArrayList(); - private final List b = Lists.newArrayList(); + private final List c = Lists.newArrayList(); - private final List tileEntityListUnload = Lists.newArrayList(); + private final Set tileEntityListUnload = Sets.newHashSet(); // Paper public final List players = Lists.newArrayList(); - public final List j = Lists.newArrayList(); + public final List k = Lists.newArrayList(); protected final IntHashMap entitiesById = new IntHashMap(); -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - this.entityList.removeAll(this.f); +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose + this.entityList.removeAll(this.g); int j; + // Paper start - Set based removal lists -+ for (Entity e : this.f) { ++ for (Entity e : this.g) { + j = e.getChunkZ(); + int k = e.getChunkX(); -- for (i = 0; i < this.f.size(); ++i) { -- entity = (Entity) this.f.get(i); -- int k = entity.ab; +- for (i = 0; i < this.g.size(); ++i) { +- entity = (Entity) this.g.get(i); +- int k = entity.ae; - -- j = entity.ad; -- if (entity.aa && this.isChunkLoaded(k, j, true)) { +- j = entity.ag; +- if (entity.inChunk && this.isChunkLoaded(k, j, true)) { - this.getChunkAt(k, j).b(entity); -+ if (e.isAddedToChunk() && this.isChunkLoaded(k, j, true)) { ++ if (e.inChunk && this.isChunkLoaded(k, j, true)) { + this.getChunkAt(k, j).b(e); } } -- for (i = 0; i < this.f.size(); ++i) { -- this.c((Entity) this.f.get(i)); -+ for (Entity e : this.f) { +- for (i = 0; i < this.g.size(); ++i) { +- this.c((Entity) this.g.get(i)); ++ for (Entity e : this.g) { + this.c(e); } + // Paper end - this.f.clear(); - this.l(); + this.g.clear(); + this.p_(); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Check-async-remove-unused-vars-GH-159.patch b/Spigot-Server-Patches/Check-async-remove-unused-vars-GH-159.patch deleted file mode 100644 index 0fb16832fe..0000000000 --- a/Spigot-Server-Patches/Check-async-remove-unused-vars-GH-159.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Sun, 27 Mar 2016 20:24:05 -0500 -Subject: [PATCH] Check async, remove unused vars, GH-159 - - -diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 68a045323..45a83ae99 100644 ---- a/src/main/java/net/minecraft/server/SpawnerCreature.java -+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java -@@ -0,0 +0,0 @@ public final class SpawnerCreature { - // Spigot end - - public int a(WorldServer worldserver, boolean flag, boolean flag1, boolean flag2) { -+ org.spigotmc.AsyncCatcher.catchOp("check for eligible spawn chunks"); // Paper - At least until we figure out what is calling this async - if (!flag && !flag1) { - return 0; - } else { -@@ -0,0 +0,0 @@ public final class SpawnerCreature { - // CraftBukkit end - - if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && (!enumcreaturetype.e() || flag2)) { -+ /* Paper start - As far as I can tell neither of these are even used - k = worldserver.a(enumcreaturetype.a()); - int l1 = limit * i / a; // CraftBukkit - use per-world limits -+ */ // Paper end - - if ((mobcnt = getEntityCount(worldserver, enumcreaturetype.a())) <= limit * i / 256) { - BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Check-online-mode-before-converting-and-renaming-pla.patch b/Spigot-Server-Patches/Check-online-mode-before-converting-and-renaming-pla.patch index 76337aa3af..178d1d875f 100644 --- a/Spigot-Server-Patches/Check-online-mode-before-converting-and-renaming-pla.patch +++ b/Spigot-Server-Patches/Check-online-mode-before-converting-and-renaming-pla.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Check online mode before converting and renaming player data diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java -index b69c6cf97..eba1228fd 100644 +index a5157269c..a562e1e46 100644 --- a/src/main/java/net/minecraft/server/WorldNBTStorage.java +++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java @@ -0,0 +0,0 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { - File file = new File(this.playerDir, entityhuman.bn() + ".dat"); + File file = new File(this.playerDir, entityhuman.bu() + ".dat"); // Spigot Start boolean usingWrongFile = false; - if ( !file.exists() ) diff --git a/Spigot-Server-Patches/Chunk-Save-Reattempt.patch b/Spigot-Server-Patches/Chunk-Save-Reattempt.patch index 48f8d0661c..99a6b7a792 100644 --- a/Spigot-Server-Patches/Chunk-Save-Reattempt.patch +++ b/Spigot-Server-Patches/Chunk-Save-Reattempt.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Chunk Save Reattempt We commonly have "Stream Closed" errors on chunk saving, so this code should re-try to save the chunk in the event of failure and hopefully prevent rollbacks. diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 4c3faa201..12bd558a7 100644 +index 17996af9c..faaa1b36b 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { - // CraftBukkit + NBTTagCompound nbttagcompound = SupplierUtils.getIfExists(chunk.compoundSupplier); // Spigot // Paper if (nbttagcompound != null) { + int attempts = 0; Exception laste = null; while (attempts++ < 5) { // Paper @@ -25,15 +25,15 @@ index 4c3faa201..12bd558a7 100644 + try {Thread.sleep(10);} catch (InterruptedException e) {e.printStackTrace();} } // Paper + if (laste != null) { com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(laste); MinecraftServer.LOGGER.error("Failed to save chunk", laste); } // Paper } - synchronized (lock) { if (this.b.get(chunkcoordintpair) == chunk.compoundSupplier) { this.b.remove(chunkcoordintpair); } }// Paper - This will not equal if a newer version is still pending + flag = true; diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 6a92b5af8..5bcbd718f 100644 +index c80d724f0..3f9aa5923 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java @@ -0,0 +0,0 @@ public class RegionFile { - this.b(i, j, (int) (MinecraftServer.aw() / 1000L)); + this.b(i, j, (int) (SystemUtils.d() / 1000L)); } catch (IOException ioexception) { - ioexception.printStackTrace(); - ServerInternalException.reportInternalException(ioexception); // Paper diff --git a/Spigot-Server-Patches/Chunk-save-queue-improvements.patch b/Spigot-Server-Patches/Chunk-save-queue-improvements.patch index 7fcf4acfc0..f48473e031 100644 --- a/Spigot-Server-Patches/Chunk-save-queue-improvements.patch +++ b/Spigot-Server-Patches/Chunk-save-queue-improvements.patch @@ -41,12 +41,12 @@ index 36689db74..3898ad8fa 100644 + } } diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index a401dec60..4c3faa201 100644 +index e26860516..17996af9c 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -0,0 +0,0 @@ import java.util.List; - import java.util.Map; - import java.util.Set; +@@ -0,0 +0,0 @@ import java.util.function.Consumer; + import java.util.function.Function; + import java.util.function.Predicate; import javax.annotation.Nullable; +import java.util.concurrent.ConcurrentLinkedQueue; // Paper import org.apache.logging.log4j.LogManager; @@ -56,29 +56,70 @@ index a401dec60..4c3faa201 100644 public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { -+ private ConcurrentLinkedQueue queue = new ConcurrentLinkedQueue<>(); // Paper - Chunk queue improvements -+ private final Object lock = new Object(); // Paper - Chunk queue improvements ++ // Paper start - Chunk queue improvements ++ private static class QueuedChunk { ++ public ChunkCoordIntPair coords; ++ public Supplier compoundSupplier; ++ ++ public QueuedChunk(ChunkCoordIntPair coords, Supplier compoundSupplier) { ++ this.coords = coords; ++ this.compoundSupplier = compoundSupplier; ++ } ++ } ++ private ConcurrentLinkedQueue queue = new ConcurrentLinkedQueue<>(); ++ // Paper end ++ private static final Logger a = LogManager.getLogger(); - private final Map> b = Maps.newConcurrentMap(); // Spigot - // CraftBukkit +- private final Object2ObjectMap> b = Object2ObjectMaps.synchronize(new Object2ObjectLinkedOpenHashMap()); // Spigot ++ private final Object2ObjectMap> b = new Object2ObjectLinkedOpenHashMap(); // Spigot // Paper - remove synchronized + private final File c; + private final DataFixer d; + private PersistentStructureLegacy e; @@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { - protected void a(ChunkCoordIntPair chunkcoordintpair, Supplier nbttagcompound) { // Spigot - // CraftBukkit - // if (!this.c.contains(chunkcoordintpair)) -- { -+ synchronized (lock) { // Paper - Chunk queue improvements - this.b.put(chunkcoordintpair, nbttagcompound); - } -+ queue.add(new QueuedChunk(chunkcoordintpair, nbttagcompound)); // Paper - Chunk queue improvements + } + }; + } else { +- if (this.b.containsKey(chunkcoordintpair) && this.a(this.b.get(chunkcoordintpair).get()) == ChunkStatus.Type.LEVELCHUNK || this.a(this.b(world, chunkcoordintpair.x, chunkcoordintpair.z)) == ChunkStatus.Type.LEVELCHUNK) { ++ // Paper start ++ Supplier existingSave; ++ synchronized (this) { ++ existingSave = this.b.get(chunkcoordintpair); ++ } ++ if (existingSave != null && this.a(existingSave.get()) == ChunkStatus.Type.LEVELCHUNK || this.a(this.b(world, chunkcoordintpair.x, chunkcoordintpair.z)) == ChunkStatus.Type.LEVELCHUNK) { // Paper - extract existingSave to synchronized lookup ++ // Paper end + return; + } +@@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { + } + }; + } +- +- this.a(chunkcoordintpair, SupplierUtils.createUnivaluedSupplier(completion, unloaded && this.b.size() < SAVE_QUEUE_TARGET_SIZE)); ++ this.a(chunkcoordintpair, SupplierUtils.createUnivaluedSupplier(completion, unloaded)); // Paper - Remove save queue target size ++ // Paper end + // Spigot end + } catch (Exception exception) { + ChunkRegionLoader.a.error("Failed to save chunk", exception); +@@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { + } + + protected synchronized void a(ChunkCoordIntPair chunkcoordintpair, Supplier nbttagcompound) { // Spigot ++ queue.add(new QueuedChunk(chunkcoordintpair, nbttagcompound)); // Paper - Chunk queue improvements + this.b.put(chunkcoordintpair, nbttagcompound); FileIOThread.a().a(this); } -@@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { + +- public synchronized boolean a() { ++ public boolean a() { // Paper - remove synchronized + // CraftBukkit start + return this.processSaveQueueEntry(false); } - private synchronized boolean processSaveQueueEntry(boolean logCompletion) { +- private synchronized boolean processSaveQueueEntry(boolean logCompletion) { - Iterator>> iter = this.b.entrySet().iterator(); // Spigot - if (!iter.hasNext()) { ++ private boolean processSaveQueueEntry(boolean logCompletion) { // Paper - dont synchronize during save + // CraftBukkit start + // Paper start - Chunk queue improvements + QueuedChunk chunk = queue.poll(); @@ -86,7 +127,7 @@ index a401dec60..4c3faa201 100644 + // Paper - end if (logCompletion) { // CraftBukkit end - ChunkRegionLoader.a.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.d.getName()); + ChunkRegionLoader.a.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.c.getName()); @@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { return false; @@ -101,64 +142,45 @@ index a401dec60..4c3faa201 100644 boolean flag; try { - // this.c.add(chunkcoordintpair); + // NBTTagCompound nbttagcompound = (NBTTagCompound) this.b.get(chunkcoordintpair); // CraftBukkit - NBTTagCompound nbttagcompound = SupplierUtils.getIfExists(value); // Spigot + NBTTagCompound nbttagcompound = SupplierUtils.getIfExists(chunk.compoundSupplier); // Spigot // Paper - // CraftBukkit if (nbttagcompound != null) { + try { @@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { - ChunkRegionLoader.a.error("Failed to save chunk", exception); - } - } -+ synchronized (lock) { if (this.b.get(chunkcoordintpair) == chunk.compoundSupplier) { this.b.remove(chunkcoordintpair); } }// Paper - This will not equal if a newer version is still pending flag = true; } finally { - this.b.remove(chunkcoordintpair, value); // CraftBukkit // Spigot -+ //this.b.remove(chunkcoordintpair, value); // CraftBukkit // Spigot // Paper ++ // Paper start - only synchronize here ++ synchronized (this) { ++ // This will not equal if a newer version is still pending - wait until newest is saved to remove ++ if (this.b.get(chunkcoordintpair) == chunk.compoundSupplier) { ++ this.b.remove(chunkcoordintpair); ++ } ++ } ++ // Paper start } return flag; -@@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { - return entity; - } - } -+ -+ // Paper start - Chunk queue improvements -+ private static class QueuedChunk { -+ public ChunkCoordIntPair coords; -+ public Supplier compoundSupplier; -+ -+ public QueuedChunk(ChunkCoordIntPair coords, Supplier compoundSupplier) { -+ this.coords = coords; -+ this.compoundSupplier = compoundSupplier; -+ } -+ } -+ // Paper end - } diff --git a/src/main/java/net/minecraft/server/FileIOThread.java b/src/main/java/net/minecraft/server/FileIOThread.java -index 1d6b1874c..9ee4115be 100644 +index 34312667a..549fab9a5 100644 --- a/src/main/java/net/minecraft/server/FileIOThread.java +++ b/src/main/java/net/minecraft/server/FileIOThread.java @@ -0,0 +0,0 @@ public class FileIOThread implements Runnable { - ++this.d; + ++this.e; } -- try { -- Thread.sleep(this.e ? 0L : 10L); -- } catch (InterruptedException interruptedexception) { -- interruptedexception.printStackTrace(); -+ // Paper start - Add toggle -+ if (com.destroystokyo.paper.PaperConfig.enableFileIOThreadSleep) { -+ try { -+ Thread.sleep(this.e ? 0L : 2L); -+ } catch (InterruptedException interruptedexception) { -+ interruptedexception.printStackTrace(); -+ } - } -+ // Paper end ++ if (com.destroystokyo.paper.PaperConfig.enableFileIOThreadSleep) { // Paper + try { +- Thread.sleep(this.f ? 0L : 10L); ++ Thread.sleep(this.f ? 0L : 1L); // Paper + } catch (InterruptedException interruptedexception) { + interruptedexception.printStackTrace(); +- } ++ }} // Paper } - if (this.b.isEmpty()) { + if (this.c.isEmpty()) { -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Complete-resource-pack-API.patch b/Spigot-Server-Patches/Complete-resource-pack-API.patch index 80fa117104..b5bf269726 100644 --- a/Spigot-Server-Patches/Complete-resource-pack-API.patch +++ b/Spigot-Server-Patches/Complete-resource-pack-API.patch @@ -5,27 +5,36 @@ Subject: [PATCH] Complete resource pack API diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 060301da6..d23fe82db 100644 +index 27c255c8d..2cc277e4f 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - // CraftBukkit start - public void a(PacketPlayInResourcePackStatus packetplayinresourcepackstatus) { - PlayerConnectionUtils.ensureMainThread(packetplayinresourcepackstatus, this, this.player.x()); -- this.server.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(getPlayer(), PlayerResourcePackStatusEvent.Status.values()[packetplayinresourcepackstatus.status.ordinal()])); -+ // Paper start -+ //this.server.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(getPlayer(), PlayerResourcePackStatusEvent.Status.values()[packetplayinresourcepackstatus.status.ordinal()])); + + } + +- public void a(PacketPlayInResourcePackStatus packetplayinresourcepackstatus) {} ++ public void a(PacketPlayInResourcePackStatus packetplayinresourcepackstatus) { ++ // Paper start; + final PlayerResourcePackStatusEvent.Status status = PlayerResourcePackStatusEvent.Status.values()[packetplayinresourcepackstatus.status.ordinal()]; + this.getPlayer().setResourcePackStatus(status); + this.server.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(getPlayer(), status)); + // Paper end - } - // CraftBukkit end ++ } + public void a(PacketPlayInBoatMove packetplayinboatmove) { + PlayerConnectionUtils.ensureMainThread(packetplayinboatmove, this, this.player.getWorldServer()); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 18a481f2f..ff4512060 100644 +index aacf8ea7f..f6a7f08f9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -0,0 +0,0 @@ import net.minecraft.server.PacketPlayOutCustomSoundEffect; + import net.minecraft.server.PacketPlayOutMap; + import net.minecraft.server.PacketPlayOutNamedSoundEffect; + import net.minecraft.server.PacketPlayOutPlayerInfo; ++import net.minecraft.server.PacketPlayOutPlayerListHeaderFooter; + import net.minecraft.server.PacketPlayOutSpawnPosition; + import net.minecraft.server.PacketPlayOutStopSound; + import net.minecraft.server.PacketPlayOutTitle; @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { private double health = 20; private boolean scaledHealth = false; diff --git a/Spigot-Server-Patches/Configurable-Chunk-Inhabited-Timer.patch b/Spigot-Server-Patches/Configurable-Chunk-Inhabited-Timer.patch index 68655267d6..4e75f06a7e 100644 --- a/Spigot-Server-Patches/Configurable-Chunk-Inhabited-Timer.patch +++ b/Spigot-Server-Patches/Configurable-Chunk-Inhabited-Timer.patch @@ -9,7 +9,7 @@ aspects of vanilla gameplay to this factor. For people who want all chunks to be treated equally, you can disable the timer. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index e634c3afd..54f23ea75 100644 +index 1c2209270..17fb883f6 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -23,16 +23,25 @@ index e634c3afd..54f23ea75 100644 + } } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index bf3b64e37..6b13e1d7d 100644 +index 75fcc693d..aaa65582b 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -0,0 +0,0 @@ public class Chunk { +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + private long lastSaved; + private boolean y; + private int z; +- private long A; ++ private long A; public long getInhabitedTime() { return A; } // Paper - OBFHELPER + private int B; + private final ConcurrentLinkedQueue C; + public boolean d; +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { } - public long x() { -- return this.w; -+ return world.paperConfig.useInhabitedTime ? this.w : 0; // Paper + public long m() { +- return this.A; ++ return world.paperConfig.useInhabitedTime ? getInhabitedTime() : 0; // Paper } - public void c(long i) { + public void b(long i) { -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-Grass-Spread-Tick-Rate.patch b/Spigot-Server-Patches/Configurable-Grass-Spread-Tick-Rate.patch index e84cd684e9..62d0d58ba4 100644 --- a/Spigot-Server-Patches/Configurable-Grass-Spread-Tick-Rate.patch +++ b/Spigot-Server-Patches/Configurable-Grass-Spread-Tick-Rate.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable Grass Spread Tick Rate diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 54f23ea75..6555f1373 100644 +index 17fb883f6..eb09be512 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -19,16 +19,16 @@ index 54f23ea75..6555f1373 100644 + log("Grass Spread Tick Rate: " + grassUpdateRate); + } } -diff --git a/src/main/java/net/minecraft/server/BlockGrass.java b/src/main/java/net/minecraft/server/BlockGrass.java -index 8fc736d6a..b656994b2 100644 ---- a/src/main/java/net/minecraft/server/BlockGrass.java -+++ b/src/main/java/net/minecraft/server/BlockGrass.java -@@ -0,0 +0,0 @@ public class BlockGrass extends Block implements IBlockFragilePlantElement { +diff --git a/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java b/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java +index 6343fb1e0..903e8241b 100644 +--- a/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java ++++ b/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java +@@ -0,0 +0,0 @@ public abstract class BlockDirtSnowSpreadable extends BlockDirtSnow { } - public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { -+ if (world.paperConfig.grassUpdateRate != 1 && (world.paperConfig.grassUpdateRate < 1 || (MinecraftServer.currentTick + blockposition.hashCode()) % world.paperConfig.grassUpdateRate != 0)) { return; } // Paper + public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) { ++ if (this instanceof BlockGrass && world.paperConfig.grassUpdateRate != 1 && (world.paperConfig.grassUpdateRate < 1 || (MinecraftServer.currentTick + blockposition.hashCode()) % world.paperConfig.grassUpdateRate != 0)) { return; } // Paper if (!world.isClientSide) { - int lightLevel = -1; // Paper - if (world.getType(blockposition.up()).c() > 2 && (lightLevel = world.getLightLevel(blockposition.up())) < 4) { // Paper - move light check to end to avoid unneeded light lookups + if (!a((IWorldReader) world, blockposition)) { + // CraftBukkit start -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-Keep-Spawn-Loaded-range-per-world.patch b/Spigot-Server-Patches/Configurable-Keep-Spawn-Loaded-range-per-world.patch index 0c00dfb162..b05f9e8de8 100644 --- a/Spigot-Server-Patches/Configurable-Keep-Spawn-Loaded-range-per-world.patch +++ b/Spigot-Server-Patches/Configurable-Keep-Spawn-Loaded-range-per-world.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Configurable Keep Spawn Loaded range per world This lets you disable it for some worlds and lower it for others. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 6555f1373..abc1aabdd 100644 +index eb09be512..6ac58e5ec 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -21,28 +21,28 @@ index 6555f1373..abc1aabdd 100644 + } } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 4e8ce79ff..2300ee10b 100644 +index 1027b0588..b7aa9e869 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs - long j = aw(); - i = 0; +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati + ArrayList arraylist = Lists.newArrayList(); + Set set = Sets.newConcurrentHashSet(); -- for (int k = -192; k <= 192 && this.isRunning(); k += 16) { -- for (int l = -192; l <= 192 && this.isRunning(); l += 16) { +- for (int i = -192; i <= 192 && this.isRunning(); i += 16) { +- for (int j = -192; j <= 192 && this.isRunning(); j += 16) { + // Paper start + short radius = worldserver.paperConfig.keepLoadedRange; -+ for (int k = -radius; k <= radius && this.isRunning(); k += 16) { -+ for (int l = -radius; l <= radius && this.isRunning(); l += 16) { -+ // Paper end - long i1 = aw(); ++ for (int i = -radius; i <= radius && this.isRunning(); i += 16) { ++ for (int j = -radius; j <= radius && this.isRunning(); j += 16) { ++ // Paper end + arraylist.add(new ChunkCoordIntPair(blockposition.getX() + i >> 4, blockposition.getZ() + j >> 4)); + } - if (i1 - j > 1000L) { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 5d5003920..671927d5c 100644 +index e42a334bc..d15afd595 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose int k = i * 16 + 8 - blockposition.getX(); int l = j * 16 + 8 - blockposition.getZ(); boolean flag = true; @@ -54,7 +54,7 @@ index 5d5003920..671927d5c 100644 public void a(Packet packet) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index d3e949707..054ac1b47 100644 +index f98f355dd..2bcd1c3ca 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { @@ -67,7 +67,7 @@ index d3e949707..054ac1b47 100644 for (int j = -short1; j <= short1; j += 16) { for (int k = -short1; k <= short1; k += 16) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 01fc193db..69dc11e2b 100644 +index 4df849eef..9d88b9ddb 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -0,0 +0,0 @@ public class CraftWorld implements World { diff --git a/Spigot-Server-Patches/Configurable-Non-Player-Arrow-Despawn-Rate.patch b/Spigot-Server-Patches/Configurable-Non-Player-Arrow-Despawn-Rate.patch index 201d60beda..0520ead87d 100644 --- a/Spigot-Server-Patches/Configurable-Non-Player-Arrow-Despawn-Rate.patch +++ b/Spigot-Server-Patches/Configurable-Non-Player-Arrow-Despawn-Rate.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Configurable Non Player Arrow Despawn Rate Can set a much shorter despawn rate for arrows that players can not pick up. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index faacd86ba..f71580393 100644 +index cd20572eb..b9dc0be2c 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -24,16 +24,16 @@ index faacd86ba..f71580393 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java -index 584782adb..86836a5d0 100644 +index e16c8e8d9..75445b00d 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java @@ -0,0 +0,0 @@ public abstract class EntityArrow extends Entity implements IProjectile { - this.ay = 0; - } else { - ++this.ax; -- if (this.ax >= world.spigotConfig.arrowDespawnRate) { // Spigot - First int after shooter -+ if (this.ax >= (fromPlayer != PickupStatus.DISALLOWED ? world.spigotConfig.arrowDespawnRate : world.paperConfig.nonPlayerArrowDespawnRate)) { // Spigot - First int after shooter // Paper - this.die(); - } - } + + protected void f() { + ++this.despawnCounter; +- if (this.despawnCounter >= world.spigotConfig.arrowDespawnRate) { // Spigot ++ if (this.despawnCounter >= (fromPlayer != PickupStatus.DISALLOWED ? world.spigotConfig.arrowDespawnRate : world.paperConfig.nonPlayerArrowDespawnRate)) { // Spigot // Paper + this.die(); + } + -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-Player-Collision.patch b/Spigot-Server-Patches/Configurable-Player-Collision.patch index 9bb3a9c15b..ed20a6c7e6 100644 --- a/Spigot-Server-Patches/Configurable-Player-Collision.patch +++ b/Spigot-Server-Patches/Configurable-Player-Collision.patch @@ -18,64 +18,46 @@ index ec4643384..430b5d0cd 100644 + enablePlayerCollisions = getBoolean("settings.enable-player-collisions", true); + } } -diff --git a/src/main/java/net/minecraft/server/CommandScoreboard.java b/src/main/java/net/minecraft/server/CommandScoreboard.java -index b08274d93..0607e55d3 100644 ---- a/src/main/java/net/minecraft/server/CommandScoreboard.java -+++ b/src/main/java/net/minecraft/server/CommandScoreboard.java -@@ -0,0 +0,0 @@ public class CommandScoreboard extends CommandAbstract { - throw new ExceptionUsage("commands.scoreboard.teams.option.usage", new Object[0]); - } - -+ // Paper start - Block setting options on our collideRule team as it is not persistent -+ if (astring[2].equals(MinecraftServer.getServer().getPlayerList().collideRuleTeamName)) { -+ icommandlistener.sendMessage(new ChatMessage("You cannot set team options on the collideRule team")); -+ return; -+ } -+ // Paper end -+ - this.c(icommandlistener, astring, 2, minecraftserver); - } - } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 2300ee10b..b6c4d98fd 100644 +index b7aa9e869..c5670fe8d 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs - this.v.setPlayerFileData(this.worldServer); +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati + this.a(this.getDifficulty()); - this.l(); + this.g_(); + + // Paper start - Handle collideRule team for player collision toggle -+ final Scoreboard scoreboard = this.getWorld().getScoreboard(); ++ final Scoreboard scoreboard = this.getScoreboard(); + final java.util.Collection toRemove = scoreboard.getTeams().stream().filter(team -> team.getName().startsWith("collideRule_")).map(ScoreboardTeam::getName).collect(java.util.stream.Collectors.toList()); + for (String teamName : toRemove) { + scoreboard.removeTeam(scoreboard.getTeam(teamName)); // Clean up after ourselves + } + + if (!com.destroystokyo.paper.PaperConfig.enablePlayerCollisions) { -+ this.getPlayerList().collideRuleTeamName = org.apache.commons.lang3.StringUtils.left("collideRule_" + this.getWorld().random.nextInt(), 16); ++ this.getPlayerList().collideRuleTeamName = org.apache.commons.lang3.StringUtils.left("collideRule_" + worlds.get(0).random.nextInt(), 16); + ScoreboardTeam collideTeam = scoreboard.createTeam(this.getPlayerList().collideRuleTeamName); + collideTeam.setCanSeeFriendlyInvisibles(false); // Because we want to mimic them not being on a team at all + } + // Paper end } - protected void l() { + protected void a(File file, WorldData worlddata) { diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java -index 549d4e89d..df11764e0 100644 +index 5f54e7b9c..759288b97 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java @@ -0,0 +0,0 @@ public class PacketPlayOutScoreboardTeam implements Packet bx = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.h); - private static final DataWatcherObject by = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.b); - private static final DataWatcherObject bz = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.h); + protected static final IAttribute c = (new AttributeRanged((IAttribute) null, "zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance"); + private static final UUID a = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836"); +- private static final AttributeModifier b = new AttributeModifier(EntityZombie.a, "Baby speed boost", 0.5D, 1); ++ private final AttributeModifier babyModifier = new AttributeModifier(EntityZombie.a, "Baby speed boost", world.paperConfig.babyZombieMovementSpeed, 1); // Paper - Remove static - Make baby speed configurable + private static final DataWatcherObject bC = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); + private static final DataWatcherObject bD = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.b); + private static final DataWatcherObject bE = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { if (this.world != null && !this.world.isClientSide) { AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); -- attributeinstance.c(EntityZombie.c); -+ attributeinstance.c(this.c); +- attributeinstance.c(EntityZombie.b); ++ attributeinstance.c(this.babyModifier); // Paper if (flag) { -- attributeinstance.b(EntityZombie.c); -+ attributeinstance.b(this.c); +- attributeinstance.b(EntityZombie.b); ++ attributeinstance.b(this.babyModifier); // Paper } } diff --git a/Spigot-Server-Patches/Configurable-cactus-and-reed-natural-growth-heights.patch b/Spigot-Server-Patches/Configurable-cactus-and-reed-natural-growth-heights.patch index 8124a385d9..35146002c7 100644 --- a/Spigot-Server-Patches/Configurable-cactus-and-reed-natural-growth-heights.patch +++ b/Spigot-Server-Patches/Configurable-cactus-and-reed-natural-growth-heights.patch @@ -23,29 +23,29 @@ index 621bf7051..4a692ac1b 100644 + } } diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java -index 64b7d08fa..d8fb87f7a 100644 +index 54685157f..83fb53643 100644 --- a/src/main/java/net/minecraft/server/BlockCactus.java +++ b/src/main/java/net/minecraft/server/BlockCactus.java @@ -0,0 +0,0 @@ public class BlockCactus extends Block { - ; - } - -- if (i < 3) { -+ if (i < world.paperConfig.cactusMaxHeight) { // Paper - Configurable growth height - int j = ((Integer) iblockdata.get(BlockCactus.AGE)).intValue(); - - if (j >= (byte) range(3, ((100.0F / world.spigotConfig.cactusModifier) * 15) + 0.5F, 15)) { // Spigot -diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java -index 57f24f55d..d19dce839 100644 ---- a/src/main/java/net/minecraft/server/BlockReed.java -+++ b/src/main/java/net/minecraft/server/BlockReed.java -@@ -0,0 +0,0 @@ public class BlockReed extends Block { ; } - if (i < 3) { -+ if (i < world.paperConfig.reedMaxHeight) { // Paper - Configurable growth height - int j = ((Integer) iblockdata.get(BlockReed.AGE)).intValue(); ++ if (i < world.paperConfig.cactusMaxHeight) { // Paper - Configurable growth height + int j = ((Integer) iblockdata.get(BlockCactus.AGE)).intValue(); - if (j >= (byte) range(3, ((100.0F / world.spigotConfig.caneModifier) * 15) + 0.5F, 15)) { // Spigot + if (j >= (byte) range(3, ((100.0F / world.spigotConfig.cactusModifier) * 15) + 0.5F, 15)) { // Spigot +diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java +index 313821d52..c4e7f318d 100644 +--- a/src/main/java/net/minecraft/server/BlockReed.java ++++ b/src/main/java/net/minecraft/server/BlockReed.java +@@ -0,0 +0,0 @@ public class BlockReed extends Block { + ; + } + +- if (i < 3) { ++ if (i < world.paperConfig.reedMaxHeight) { // Paper - Configurable growth height + int j = ((Integer) iblockdata.get(BlockReed.AGE)).intValue(); + + if (j >= (byte) range(3, ((100.0F / world.spigotConfig.caneModifier) * 15) + 0.5F, 15)) { // Spigot -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-container-update-tick-rate.patch b/Spigot-Server-Patches/Configurable-container-update-tick-rate.patch index 057f5c8912..c07fe92e93 100644 --- a/Spigot-Server-Patches/Configurable-container-update-tick-rate.patch +++ b/Spigot-Server-Patches/Configurable-container-update-tick-rate.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable container update tick rate diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index f431000d1..abcfb9216 100644 +index 47f391243..26d8dbb60 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -19,7 +19,7 @@ index f431000d1..abcfb9216 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 3058dfef0..ed3546ccc 100644 +index 0531812fb..5ca0dec1f 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { diff --git a/Spigot-Server-Patches/Configurable-end-credits.patch b/Spigot-Server-Patches/Configurable-end-credits.patch index ada23399e1..59759947ba 100644 --- a/Spigot-Server-Patches/Configurable-end-credits.patch +++ b/Spigot-Server-Patches/Configurable-end-credits.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable end credits diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 94a173045..db09711e4 100644 +index 1e3405cc1..dccccbf5b 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -20,24 +20,24 @@ index 94a173045..db09711e4 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 730acd971..dfaab774d 100644 +index e035025f0..cb44bf3a7 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - private long cn = System.currentTimeMillis(); - private Entity co; + private long cv = SystemUtils.b(); + private Entity cw; public boolean worldChangeInvuln; -- private boolean cq; -+ private boolean cq; private void setHasSeenCredits(boolean has) { this.cq = has; } // Paper - OBFHELPER - private final RecipeBookServer cr = new RecipeBookServer(); - private Vec3D cs; - private int ct; +- private boolean cy; ++ private boolean cy; private void setHasSeenCredits(boolean has) { this.cy = has; } // Paper - OBFHELPER + private final RecipeBookServer cz; + private Vec3D cA; + private int cB; @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.world.kill(this); if (!this.viewingCredits) { this.viewingCredits = true; + if (world.paperConfig.disableEndCredits) this.setHasSeenCredits(true); // Paper - Toggle to always disable end credits - this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, this.cq ? 0.0F : 1.0F)); - this.cq = true; + this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, this.cy ? 0.0F : 1.0F)); + this.cy = true; } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-fishing-time-ranges.patch b/Spigot-Server-Patches/Configurable-fishing-time-ranges.patch index 3d90982902..871bfd51a6 100644 --- a/Spigot-Server-Patches/Configurable-fishing-time-ranges.patch +++ b/Spigot-Server-Patches/Configurable-fishing-time-ranges.patch @@ -22,16 +22,16 @@ index d44cacc7e..45bddf3f4 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java -index b4d3bcb41..339d1f1b1 100644 +index 2512ad353..866f41980 100644 --- a/src/main/java/net/minecraft/server/EntityFishingHook.java +++ b/src/main/java/net/minecraft/server/EntityFishingHook.java @@ -0,0 +0,0 @@ public class EntityFishingHook extends Entity { - this.at = MathHelper.nextInt(this.random, 20, 80); + this.aw = MathHelper.nextInt(this.random, 20, 80); } } else { - this.h = MathHelper.nextInt(this.random, 100, 600); + this.h = MathHelper.nextInt(this.random, world.paperConfig.fishingMinTicks, world.paperConfig.fishingMaxTicks); // Paper - this.h -= this.ax * 20 * 5; + this.h -= this.aA * 20 * 5; } } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-inter-world-teleportation-safety.patch b/Spigot-Server-Patches/Configurable-inter-world-teleportation-safety.patch index 05f1b1ffbc..dbbdc136eb 100644 --- a/Spigot-Server-Patches/Configurable-inter-world-teleportation-safety.patch +++ b/Spigot-Server-Patches/Configurable-inter-world-teleportation-safety.patch @@ -16,7 +16,7 @@ The wanted destination was on top of the emerald block however the player ended This only is the case if the player is teleporting between worlds. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 38ccabc0d..b241c0380 100644 +index 1ba09df9c..6fc3b7621 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -30,7 +30,7 @@ index 38ccabc0d..b241c0380 100644 + } } diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 536534d2e..bf7aaebd6 100644 +index 23562388a..23cab725d 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -43,7 +43,7 @@ index 536534d2e..bf7aaebd6 100644 entityplayer.getBukkitEntity().setVelocity(velocity); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 9b9e02ae1..18a481f2f 100644 +index 18f68b925..aacf8ea7f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/Spigot-Server-Patches/Configurable-lava-flow-speed.patch b/Spigot-Server-Patches/Configurable-lava-flow-speed.patch deleted file mode 100644 index 76a85308c4..0000000000 --- a/Spigot-Server-Patches/Configurable-lava-flow-speed.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Wed, 2 Mar 2016 12:27:07 -0600 -Subject: [PATCH] Configurable lava flow speed - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index dbd82d5a9..b0b3033e7 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperWorldConfig { - fastDrainLava = getBoolean("fast-drain.lava", false); - fastDrainWater = getBoolean("fast-drain.water", false); - } -+ -+ public int lavaFlowSpeedNormal; -+ public int lavaFlowSpeedNether; -+ private void lavaFlowSpeeds() { -+ lavaFlowSpeedNormal = getInt("lava-flow-speed.normal", 30); -+ lavaFlowSpeedNether = getInt("lava-flow-speed.nether", 10); -+ } - } -diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java -index 3aaa19b2f..739b9aac3 100644 ---- a/src/main/java/net/minecraft/server/BlockFlowing.java -+++ b/src/main/java/net/minecraft/server/BlockFlowing.java -@@ -0,0 +0,0 @@ public class BlockFlowing extends BlockFluids { - * Paper - Get flow speed. Throttle if its water and flowing adjacent to lava - */ - public int getFlowSpeed(World world, BlockPosition blockposition) { -+ if (this.material == Material.LAVA) { -+ return world.worldProvider.isSkyMissing() ? world.paperConfig.lavaFlowSpeedNether : world.paperConfig.lavaFlowSpeedNormal; -+ } - if (this.material == Material.WATER && ( - world.getType(blockposition.north(1)).getBlock().material == Material.LAVA || - world.getType(blockposition.south(1)).getBlock().material == Material.LAVA || -diff --git a/src/main/java/net/minecraft/server/WorldProvider.java b/src/main/java/net/minecraft/server/WorldProvider.java -index f3eb2a797..d0265f960 100644 ---- a/src/main/java/net/minecraft/server/WorldProvider.java -+++ b/src/main/java/net/minecraft/server/WorldProvider.java -@@ -0,0 +0,0 @@ public abstract class WorldProvider { - return this.f; - } - -+ public final boolean isSkyMissing() { return this.n(); } // Paper - OBFHELPER - public boolean n() { - return this.e; - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-mob-spawner-tick-rate.patch b/Spigot-Server-Patches/Configurable-mob-spawner-tick-rate.patch index 5ed4f16be0..d10f1a17af 100644 --- a/Spigot-Server-Patches/Configurable-mob-spawner-tick-rate.patch +++ b/Spigot-Server-Patches/Configurable-mob-spawner-tick-rate.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable mob spawner tick rate diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 70b02f020..f431000d1 100644 +index 0130e5860..47f391243 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -19,13 +19,13 @@ index 70b02f020..f431000d1 100644 + } } diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index 0149726ea..a5261d70b 100644 +index e9650d962..61472a0eb 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { - public int maxNearbyEntities = 6; // CraftBukkit private -> public - public int requiredPlayerRange = 16; // CraftBukkit private -> public - public int spawnRange = 4; // CraftBukkit private -> public + public int maxNearbyEntities = 6; + public int requiredPlayerRange = 16; + public int spawnRange = 4; + private int tickDelay = 0; // Paper public MobSpawnerAbstract() {} @@ -39,18 +39,18 @@ index 0149726ea..a5261d70b 100644 + tickDelay = this.a().paperConfig.mobSpawnerTickRate; + // Paper end if (!this.h()) { - this.e = this.d; + this.f = this.e; } else { @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { - this.a().addParticle(EnumParticle.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); - this.a().addParticle(EnumParticle.FLAME, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); + this.a().addParticle(Particles.M, d0, d1, d2, 0.0D, 0.0D, 0.0D); + this.a().addParticle(Particles.y, d0, d1, d2, 0.0D, 0.0D, 0.0D); if (this.spawnDelay > 0) { - --this.spawnDelay; + this.spawnDelay -= tickDelay; // Paper } - this.e = this.d; - this.d = (this.d + (double) (1000.0F / ((float) this.spawnDelay + 200.0F))) % 360.0D; + this.f = this.e; + this.e = (this.e + (double) (1000.0F / ((float) this.spawnDelay + 200.0F))) % 360.0D; } else { - if (this.spawnDelay == -1) { + if (this.spawnDelay < -tickDelay) { // Paper diff --git a/Spigot-Server-Patches/Configurable-spawn-chances-for-skeleton-horses.patch b/Spigot-Server-Patches/Configurable-spawn-chances-for-skeleton-horses.patch index 25578e3529..5c82733801 100644 --- a/Spigot-Server-Patches/Configurable-spawn-chances-for-skeleton-horses.patch +++ b/Spigot-Server-Patches/Configurable-spawn-chances-for-skeleton-horses.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable spawn chances for skeleton horses diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index f71580393..38d664e00 100644 +index b9dc0be2c..9f586774d 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -19,16 +19,16 @@ index f71580393..38d664e00 100644 + } } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index d0ff0adf5..96792300c 100644 +index 9bd11a5fd..88868b4c4 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { if (this.isRainingAt(blockposition)) { - DifficultyDamageScaler difficultydamagescaler = this.D(blockposition); + DifficultyDamageScaler difficultydamagescaler = this.getDamageScaler(blockposition); - if (this.getGameRules().getBoolean("doMobSpawning") && this.random.nextDouble() < (double) difficultydamagescaler.b() * 0.01D) { + if (this.getGameRules().getBoolean("doMobSpawning") && this.random.nextDouble() < (double) difficultydamagescaler.b() * paperConfig.skeleHorseSpawnChance) { EntityHorseSkeleton entityhorseskeleton = new EntityHorseSkeleton(this); - entityhorseskeleton.p(true); + entityhorseskeleton.s(true); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-speed-for-water-flowing-over-lava.patch b/Spigot-Server-Patches/Configurable-speed-for-water-flowing-over-lava.patch deleted file mode 100644 index 31795fa9e0..0000000000 --- a/Spigot-Server-Patches/Configurable-speed-for-water-flowing-over-lava.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Tue, 1 Mar 2016 14:27:13 -0600 -Subject: [PATCH] Configurable speed for water flowing over lava - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 4da846719..d3484489b 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperWorldConfig { - if (fallingBlockHeightNerf != 0) log("Falling Block Height Limit set to Y: " + fallingBlockHeightNerf); - if (entityTNTHeightNerf != 0) log("TNT Entity Height Limit set to Y: " + entityTNTHeightNerf); - } -+ -+ public int waterOverLavaFlowSpeed; -+ private void waterOverLawFlowSpeed() { -+ waterOverLavaFlowSpeed = getInt("water-over-lava-flow-speed", 5); -+ log("Water over lava flow speed: " + waterOverLavaFlowSpeed); -+ } - } -diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java -index 7b74df5b9..62234a7c9 100644 ---- a/src/main/java/net/minecraft/server/BlockFlowing.java -+++ b/src/main/java/net/minecraft/server/BlockFlowing.java -@@ -0,0 +0,0 @@ public class BlockFlowing extends BlockFluids { - b0 = 2; - } - -- int j = this.a(world); -+ int j = this.getFlowSpeed(world, blockposition); // Paper - int k; - - if (i > 0) { -@@ -0,0 +0,0 @@ public class BlockFlowing extends BlockFluids { - - public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { - if (!this.e(world, blockposition, iblockdata)) { -- world.a(blockposition, (Block) this, this.a(world)); -+ world.a(blockposition, (Block) this, this.getFlowSpeed(world, blockposition)); // Paper - } - - } -+ -+ /** -+ * Paper - Get flow speed. Throttle if its water and flowing adjacent to lava -+ */ -+ public int getFlowSpeed(World world, BlockPosition blockposition) { -+ if (this.material == Material.WATER && ( -+ world.getType(blockposition.north(1)).getBlock().material == Material.LAVA || -+ world.getType(blockposition.south(1)).getBlock().material == Material.LAVA || -+ world.getType(blockposition.west(1)).getBlock().material == Material.LAVA || -+ world.getType(blockposition.east(1)).getBlock().material == Material.LAVA)) { -+ return world.paperConfig.waterOverLavaFlowSpeed; -+ } -+ return super.a(world); -+ } - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-top-of-nether-void-damage.patch b/Spigot-Server-Patches/Configurable-top-of-nether-void-damage.patch index 4135623e11..6a91711c52 100644 --- a/Spigot-Server-Patches/Configurable-top-of-nether-void-damage.patch +++ b/Spigot-Server-Patches/Configurable-top-of-nether-void-damage.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Configurable top of nether void damage diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index d3484489b..bf7af475c 100644 +index 4da846719..a340866f3 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { - waterOverLavaFlowSpeed = getInt("water-over-lava-flow-speed", 5); - log("Water over lava flow speed: " + waterOverLavaFlowSpeed); + if (fallingBlockHeightNerf != 0) log("Falling Block Height Limit set to Y: " + fallingBlockHeightNerf); + if (entityTNTHeightNerf != 0) log("TNT Entity Height Limit set to Y: " + entityTNTHeightNerf); } + + public boolean netherVoidTopDamage; @@ -20,10 +20,10 @@ index d3484489b..bf7af475c 100644 + } } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 43b802855..aadc426fd 100644 +index 2288df268..111eeeecc 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke this.fallDistance *= 0.5F; } @@ -31,7 +31,7 @@ index 43b802855..aadc426fd 100644 + // Extracted to own function + /* if (this.locY < -64.0D) { - this.ac(); + this.aa(); } + */ + this.checkAndDoHeightDamage(); @@ -39,35 +39,31 @@ index 43b802855..aadc426fd 100644 if (!this.world.isClientSide) { this.setFlag(0, this.fireTicks > 0); -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper - this.world.methodProfiler.b(); +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + this.world.methodProfiler.e(); } -+ // Paper start - Configurable top of nether void damage -+ private boolean paperNetherCheck() { -+ return this.world.paperConfig.netherVoidTopDamage && this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER && this.locY >= 128.0D; -+ } -+ ++ // Paper start + protected void checkAndDoHeightDamage() { -+ if (this.locY < -64.0D || paperNetherCheck()) { ++ if (this.locY < -64.0D || (this.world.paperConfig.netherVoidTopDamage && this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER && this.locY >= 128.0D)) { + this.kill(); + } + } + // Paper end + - protected void I() { + protected void E() { if (this.portalCooldown > 0) { --this.portalCooldown; -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke this.fireTicks = 0; } -+ protected final void kill() { this.ac(); } // Paper - OBFHELPER - protected void ac() { ++ protected final void kill() { this.aa(); } // Paper - OBFHELPER + protected void aa() { this.die(); } diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -index a9412d4e0..1f4025486 100644 +index 2f4e1a280..3598998b5 100644 --- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java +++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java @@ -0,0 +0,0 @@ public abstract class EntityMinecartAbstract extends Entity implements INamableT @@ -78,7 +74,7 @@ index a9412d4e0..1f4025486 100644 + // Extracted to own function + /* if (this.locY < -64.0D) { - this.ac(); + this.aa(); } + */ + this.checkAndDoHeightDamage(); diff --git a/Spigot-Server-Patches/Custom-replacement-for-eaten-items.patch b/Spigot-Server-Patches/Custom-replacement-for-eaten-items.patch index 08e41b88f8..d8420e75a0 100644 --- a/Spigot-Server-Patches/Custom-replacement-for-eaten-items.patch +++ b/Spigot-Server-Patches/Custom-replacement-for-eaten-items.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Custom replacement for eaten items diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 2aaeac324..7e2cc66d7 100644 +index f57e0136c..a0af21301 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - protected void v() { + protected void q() { if (!this.activeItem.isEmpty() && this.isHandRaised()) { + PlayerItemConsumeEvent event = null; // Paper this.b(this.activeItem, 16); @@ -33,11 +33,9 @@ index 2aaeac324..7e2cc66d7 100644 + itemstack = CraftItemStack.asNMSCopy(event.getReplacement()); + } + // Paper end -+ - this.a(this.cH(), itemstack); + this.a(this.cT(), itemstack); // CraftBukkit end - this.cN(); -+ + this.cZ(); + // Paper start - if the replacement is anything but the default, update the client inventory + if (this instanceof EntityPlayer && !com.google.common.base.Objects.equal(defaultReplacement, itemstack)) { + ((EntityPlayer) this).getBukkitEntity().updateInventory(); diff --git a/Spigot-Server-Patches/Default-loading-permissions.yml-before-plugins.patch b/Spigot-Server-Patches/Default-loading-permissions.yml-before-plugins.patch index 681eb4b915..5a605f497d 100644 --- a/Spigot-Server-Patches/Default-loading-permissions.yml-before-plugins.patch +++ b/Spigot-Server-Patches/Default-loading-permissions.yml-before-plugins.patch @@ -30,7 +30,7 @@ index 3898ad8fa..2f6e169f5 100644 + } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index d56966109..d482589b3 100644 +index eaac1430e..6dae117ac 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { diff --git a/Spigot-Server-Patches/Disable-Scoreboards-for-non-players-by-default.patch b/Spigot-Server-Patches/Disable-Scoreboards-for-non-players-by-default.patch index ab101e5b52..d1396faff8 100644 --- a/Spigot-Server-Patches/Disable-Scoreboards-for-non-players-by-default.patch +++ b/Spigot-Server-Patches/Disable-Scoreboards-for-non-players-by-default.patch @@ -11,7 +11,7 @@ So avoid looking up scoreboards and short circuit to the "not on a team" logic which is most likely to be true. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index b241c0380..a4c94845b 100644 +index 6fc3b7621..93486b4b8 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -24,28 +24,28 @@ index b241c0380..a4c94845b 100644 + nonPlayerEntitiesOnScoreboards = getBoolean("allow-non-player-entities-on-scoreboards", false); + } } -diff --git a/src/main/java/net/minecraft/server/CommandScoreboard.java b/src/main/java/net/minecraft/server/CommandScoreboard.java -index ec9a87239..b08274d93 100644 ---- a/src/main/java/net/minecraft/server/CommandScoreboard.java -+++ b/src/main/java/net/minecraft/server/CommandScoreboard.java -@@ -0,0 +0,0 @@ public class CommandScoreboard extends CommandAbstract { - - while (iterator.hasNext()) { - Entity entity = (Entity) iterator.next(); -+ if (!entity.world.paperConfig.nonPlayerEntitiesOnScoreboards && !(entity instanceof EntityHuman)) { continue; } // Paper - String s2 = f(minecraftserver, icommandlistener, entity.bn()); - - if (scoreboard.addPlayerToTeam(s2, s)) { diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 804104818..f547dbfd0 100644 +index d378f1a9d..e16579116 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @Nullable - public ScoreboardTeamBase aY() { + public ScoreboardTeamBase be() { + if (!this.world.paperConfig.nonPlayerEntitiesOnScoreboards && !(this instanceof EntityHuman)) { return null; } // Paper - return this.world.getScoreboard().getPlayerTeam(this.bn()); + return this.world.getScoreboard().getPlayerTeam(this.getName()); } +diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +index 43715902e..f57e0136c 100644 +--- a/src/main/java/net/minecraft/server/EntityLiving.java ++++ b/src/main/java/net/minecraft/server/EntityLiving.java +@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { + if (nbttagcompound.hasKeyOfType("Team", 8)) { + String s = nbttagcompound.getString("Team"); + ScoreboardTeam scoreboardteam = this.world.getScoreboard().getTeam(s); ++ if (!world.paperConfig.nonPlayerEntitiesOnScoreboards && !(this instanceof EntityHuman)) { scoreboardteam = null; } // Paper + boolean flag = scoreboardteam != null && this.world.getScoreboard().addPlayerToTeam(this.bu(), scoreboardteam); + + if (!flag) { -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Disable-chest-cat-detection.patch b/Spigot-Server-Patches/Disable-chest-cat-detection.patch index 09e861c169..8e10ef6f50 100644 --- a/Spigot-Server-Patches/Disable-chest-cat-detection.patch +++ b/Spigot-Server-Patches/Disable-chest-cat-detection.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Disable chest cat detection diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index abcfb9216..4c57b9cbf 100644 +index 26d8dbb60..43aa73e1d 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -19,19 +19,19 @@ index abcfb9216..4c57b9cbf 100644 + } } diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java -index da2cfe206..bc398ec52 100644 +index d55122c66..f8be07258 100644 --- a/src/main/java/net/minecraft/server/BlockChest.java +++ b/src/main/java/net/minecraft/server/BlockChest.java -@@ -0,0 +0,0 @@ public class BlockChest extends BlockTileEntity { +@@ -0,0 +0,0 @@ public class BlockChest extends BlockTileEntity implements IFluidSource, IFluidC } - private boolean j(World world, BlockPosition blockposition) { -+ // Paper start - Option ti dsiable chest cat detection + private boolean b(World world, BlockPosition blockposition) { ++ // Paper start - Option to disable chest cat detection + if (world.paperConfig.disableChestCatDetection) { + return false; + } + // Paper end - Iterator iterator = world.a(EntityOcelot.class, new AxisAlignedBB((double) blockposition.getX(), (double) (blockposition.getY() + 1), (double) blockposition.getZ(), (double) (blockposition.getX() + 1), (double) (blockposition.getY() + 2), (double) (blockposition.getZ() + 1))).iterator(); + List list = world.a(EntityOcelot.class, new AxisAlignedBB((double) blockposition.getX(), (double) (blockposition.getY() + 1), (double) blockposition.getZ(), (double) (blockposition.getX() + 1), (double) (blockposition.getY() + 2), (double) (blockposition.getZ() + 1))); - EntityOcelot entityocelot; + if (!list.isEmpty()) { -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Disable-explosion-knockback.patch b/Spigot-Server-Patches/Disable-explosion-knockback.patch index fcb0d054d3..324993af1f 100644 --- a/Spigot-Server-Patches/Disable-explosion-knockback.patch +++ b/Spigot-Server-Patches/Disable-explosion-knockback.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Disable explosion knockback diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index b0b3033e7..afc13e851 100644 +index 3626aa717..be92c1af6 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { - lavaFlowSpeedNormal = getInt("lava-flow-speed.normal", 30); - lavaFlowSpeedNether = getInt("lava-flow-speed.nether", 10); + optimizeExplosions = getBoolean("optimize-explosions", false); + log("Optimize explosions: " + optimizeExplosions); } + + public boolean disableExplosionKnockback; @@ -19,7 +19,7 @@ index b0b3033e7..afc13e851 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index d15cfdd76..2aaeac324 100644 +index 1ee54fa45..43715902e 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -46,9 +46,9 @@ index d15cfdd76..2aaeac324 100644 + if (this.getHealth() <= 0.0F) { if (!this.e(damagesource)) { - SoundEffect soundeffect = this.cf(); + SoundEffect soundeffect = this.cr(); diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index e7f0e84d4..e148901e5 100644 +index ddbf667c4..2652b1575 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java @@ -0,0 +0,0 @@ public class Explosion { @@ -64,9 +64,9 @@ index e7f0e84d4..e148901e5 100644 if (entity instanceof EntityHuman) { EntityHuman entityhuman = (EntityHuman) entity; -- if (!entityhuman.isSpectator() && (!entityhuman.z() || !entityhuman.abilities.isFlying)) { -+ if (!entityhuman.isSpectator() && (!entityhuman.z() && !world.paperConfig.disableExplosionKnockback || !entityhuman.abilities.isFlying)) { // Paper - Disable explosion knockback - this.k.put(entityhuman, new Vec3D(d8 * d13, d9 * d13, d10 * d13)); +- if (!entityhuman.isSpectator() && (!entityhuman.u() || !entityhuman.abilities.isFlying)) { ++ if (!entityhuman.isSpectator() && (!entityhuman.u() && !world.paperConfig.disableExplosionKnockback || !entityhuman.abilities.isFlying)) { // Paper - Disable explosion knockback + this.l.put(entityhuman, new Vec3D(d8 * d13, d9 * d13, d10 * d13)); } } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Disable-ice-and-snow.patch b/Spigot-Server-Patches/Disable-ice-and-snow.patch index 6979b75339..720bd035b6 100644 --- a/Spigot-Server-Patches/Disable-ice-and-snow.patch +++ b/Spigot-Server-Patches/Disable-ice-and-snow.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Disable ice and snow diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 4ae2f9af1..70b02f020 100644 +index efacd5ea0..0130e5860 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -19,7 +19,7 @@ index 4ae2f9af1..70b02f020 100644 + } } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index b12c58732..d0ff0adf5 100644 +index 7a9cd1398..21b8a1dd9 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { @@ -28,7 +28,7 @@ index b12c58732..d0ff0adf5 100644 this.methodProfiler.c("iceandsnow"); - if (this.random.nextInt(16) == 0) { + if (!this.paperConfig.disableIceAndSnow && this.random.nextInt(16) == 0) { // Paper - Disable ice and snow - this.l = this.l * 3 + 1013904223; - l = this.l >> 2; - blockposition = this.p(new BlockPosition(j + (l & 15), 0, k + (l >> 8 & 15))); + this.m = this.m * 3 + 1013904223; + l = this.m >> 2; + blockposition = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, new BlockPosition(j + (l & 15), 0, k + (l >> 8 & 15))); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Disable-spigot-tick-limiters.patch b/Spigot-Server-Patches/Disable-spigot-tick-limiters.patch index 895e585129..8a682b27b5 100644 --- a/Spigot-Server-Patches/Disable-spigot-tick-limiters.patch +++ b/Spigot-Server-Patches/Disable-spigot-tick-limiters.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Disable spigot tick limiters diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index fc7315f7d..e85ed2e33 100644 +index 04493a1f9..d988fd007 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose // CraftBukkit start - Use field for loop variable co.aikar.timings.TimingHistory.entityTicks += this.entityList.size(); // Paper int entitiesThisCycle = 0; @@ -23,7 +23,7 @@ index fc7315f7d..e85ed2e33 100644 tickPosition = (tickPosition < entityList.size()) ? tickPosition : 0; entity = (Entity) this.entityList.get(this.tickPosition); // CraftBukkit end -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose // Spigot start // Iterator iterator = this.tileEntityListTick.iterator(); int tilesThisCycle = 0; diff --git a/Spigot-Server-Patches/Disable-thunder.patch b/Spigot-Server-Patches/Disable-thunder.patch index fca812e39b..c2ae76e56e 100644 --- a/Spigot-Server-Patches/Disable-thunder.patch +++ b/Spigot-Server-Patches/Disable-thunder.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Disable thunder diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index afc13e851..4ae2f9af1 100644 +index be92c1af6..efacd5ea0 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -19,7 +19,7 @@ index afc13e851..4ae2f9af1 100644 + } } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 95964c550..b12c58732 100644 +index 420cbee6a..7a9cd1398 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { @@ -27,9 +27,8 @@ index 95964c550..b12c58732 100644 BlockPosition blockposition; - if (flag && flag1 && this.random.nextInt(100000) == 0) { -+ // Paper - Disable thunder -+ if (!this.paperConfig.disableThunder && flag && flag1 && this.random.nextInt(100000) == 0) { - this.l = this.l * 3 + 1013904223; - l = this.l >> 2; ++ if (!this.paperConfig.disableThunder && flag && flag1 && this.random.nextInt(100000) == 0) { // Paper - Disable thunder + this.m = this.m * 3 + 1013904223; + l = this.m >> 2; blockposition = this.a(new BlockPosition(j + (l & 15), 0, k + (l >> 8 & 15))); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Do-not-load-chunks-for-light-checks.patch b/Spigot-Server-Patches/Do-not-load-chunks-for-light-checks.patch index a1cce3fabd..455a76c11c 100644 --- a/Spigot-Server-Patches/Do-not-load-chunks-for-light-checks.patch +++ b/Spigot-Server-Patches/Do-not-load-chunks-for-light-checks.patch @@ -7,15 +7,15 @@ Should only happen for blocks on the edge that uses neighbors light level (certain blocks). In that case, there will be 3-4 other neighbors to get a light level from. diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 119cd0636..5d5003920 100644 +index e88baae1d..e42a334bc 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose if (blockposition.getY() >= 256) { blockposition = new BlockPosition(blockposition.getX(), 255, blockposition.getZ()); } + if (!this.isLoaded(blockposition)) return 0; // Paper - Chunk chunk = this.getChunkAtWorldCoords(blockposition); - + return this.getChunkAtWorldCoords(blockposition).a(blockposition, i); + } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch b/Spigot-Server-Patches/Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch index 24b11aec01..31e58ea405 100644 --- a/Spigot-Server-Patches/Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch +++ b/Spigot-Server-Patches/Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Don't nest if we don't need to when cerealising text diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -index 67666d35b..5d1a49623 100644 +index 28a262835..eba6aadad 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java @@ -0,0 +0,0 @@ public class PacketPlayOutChat implements Packet { diff --git a/Spigot-Server-Patches/Don-t-spam-reload-spawn-chunks-in-nether-end.patch b/Spigot-Server-Patches/Don-t-spam-reload-spawn-chunks-in-nether-end.patch index 3d2ed1bc23..c4e9c1cb7c 100644 --- a/Spigot-Server-Patches/Don-t-spam-reload-spawn-chunks-in-nether-end.patch +++ b/Spigot-Server-Patches/Don-t-spam-reload-spawn-chunks-in-nether-end.patch @@ -5,27 +5,28 @@ Subject: [PATCH] Don't spam reload spawn chunks in nether/end diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 1189720de..ad422b24b 100644 +index 9fdedc2d7..3bf2cb8d0 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - return this.P; +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose + return this.K; } -+ public boolean shouldStayLoaded(int i, int j) { return e(i, j); } // Paper - OBFHELPER - public boolean e(int i, int j) { ++ public boolean shouldStayLoaded(int i, int j) { return g(i, j); } // Paper - OBFHELPER + public boolean g(int i, int j) { BlockPosition blockposition = this.getSpawn(); int k = i * 16 + 8 - blockposition.getX(); diff --git a/src/main/java/net/minecraft/server/WorldProvider.java b/src/main/java/net/minecraft/server/WorldProvider.java -index d0265f960..35d8d1a6e 100644 +index 6b62235e5..26ef3a41f 100644 --- a/src/main/java/net/minecraft/server/WorldProvider.java +++ b/src/main/java/net/minecraft/server/WorldProvider.java @@ -0,0 +0,0 @@ public abstract class WorldProvider { - public void s() {} + public void l() {} - public boolean c(int i, int j) { + public boolean a(int i, int j) { - return true; + return !this.b.shouldStayLoaded(i, j); // Paper - Use shouldStayLoaded check for all worlds } - } + + protected abstract void m(); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Don-t-teleport-dead-entities.patch b/Spigot-Server-Patches/Don-t-teleport-dead-entities.patch index 9a2a869adc..ef238d4b8c 100644 --- a/Spigot-Server-Patches/Don-t-teleport-dead-entities.patch +++ b/Spigot-Server-Patches/Don-t-teleport-dead-entities.patch @@ -7,10 +7,10 @@ Had some issue with this in past, and this is the vanilla logic. Potentially an old CB change that's no longer needed. diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index eb07d4233..e2202ed0c 100644 +index c0367df20..c37c46e71 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } public Entity teleportTo(Location exit, boolean portal) { diff --git a/Spigot-Server-Patches/Don-t-tick-Skulls-unused-code.patch b/Spigot-Server-Patches/Don-t-tick-Skulls-unused-code.patch index 2f9c5e7656..172704d521 100644 --- a/Spigot-Server-Patches/Don-t-tick-Skulls-unused-code.patch +++ b/Spigot-Server-Patches/Don-t-tick-Skulls-unused-code.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't tick Skulls - unused code diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java -index a796c08ab..dd2665881 100644 +index db4967f24..804236547 100644 --- a/src/main/java/net/minecraft/server/TileEntitySkull.java +++ b/src/main/java/net/minecraft/server/TileEntitySkull.java @@ -0,0 +0,0 @@ import com.mojang.authlib.ProfileLookupCallback; @@ -15,6 +15,6 @@ index a796c08ab..dd2665881 100644 -public class TileEntitySkull extends TileEntity implements ITickable { +public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Paper - remove tickable - private int a; - public int rotation; + private GameProfile a; + private int e; -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Drop-falling-block-and-tnt-entities-at-the-specified.patch b/Spigot-Server-Patches/Drop-falling-block-and-tnt-entities-at-the-specified.patch index 20afcfa27b..290e692da1 100644 --- a/Spigot-Server-Patches/Drop-falling-block-and-tnt-entities-at-the-specified.patch +++ b/Spigot-Server-Patches/Drop-falling-block-and-tnt-entities-at-the-specified.patch @@ -24,11 +24,11 @@ index 0094d1a87..4da846719 100644 + } } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 4540bf9f9..d358ab26a 100644 +index a5d0ae1de..12b86ab75 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper - return this.a(new ItemStack(item, i, 0), f); +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + return this.a(itemstack, 0.0F); } + @Nullable public final EntityItem dropItem(ItemStack itemstack, float offset) { return this.a(itemstack, offset); } // Paper - OBFHELPER @@ -36,7 +36,7 @@ index 4540bf9f9..d358ab26a 100644 public EntityItem a(ItemStack itemstack, float f) { if (itemstack.isEmpty()) { diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index 579e51a0a..2ba5d51a5 100644 +index 850436d42..7aa12c3b4 100644 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java @@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity { @@ -56,9 +56,9 @@ index 579e51a0a..2ba5d51a5 100644 + if (!this.world.isClientSide) { blockposition = new BlockPosition(this); - boolean flag = this.block.getBlock() == Blocks.dS; + boolean flag = this.block.getBlock() instanceof BlockConcretePowder; diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index 44b2d4735..0d70dd1d2 100644 +index 7edc02852..5ceb3f206 100644 --- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java +++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java @@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity { diff --git a/Spigot-Server-Patches/Ensure-commands-are-not-ran-async.patch b/Spigot-Server-Patches/Ensure-commands-are-not-ran-async.patch index 47ca82a1e0..833a07474a 100644 --- a/Spigot-Server-Patches/Ensure-commands-are-not-ran-async.patch +++ b/Spigot-Server-Patches/Ensure-commands-are-not-ran-async.patch @@ -14,7 +14,7 @@ big slowdown in execution but throwing an exception at same time to raise awaren that it is happening so that plugin authors can fix their code to stop executing commands async. diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index da25a8bea..48379f414 100644 +index 2adb21e55..27c255c8d 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -48,7 +48,7 @@ index da25a8bea..48379f414 100644 } else if (this.player.getChatFlags() == EntityHuman.EnumChatVisibility.SYSTEM) { // Do nothing, this is coming from a plugin diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index bfddd1685..462ad1024 100644 +index 2055bf7de..29344593a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { diff --git a/Spigot-Server-Patches/Ensure-inv-drag-is-in-bounds.patch b/Spigot-Server-Patches/Ensure-inv-drag-is-in-bounds.patch index 7b58fe8081..1e08c99c42 100644 --- a/Spigot-Server-Patches/Ensure-inv-drag-is-in-bounds.patch +++ b/Spigot-Server-Patches/Ensure-inv-drag-is-in-bounds.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Ensure inv drag is in bounds diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java -index 7d80b68b2..3a488ce20 100644 +index e86ffb4dc..0bf14b671 100644 --- a/src/main/java/net/minecraft/server/Container.java +++ b/src/main/java/net/minecraft/server/Container.java @@ -0,0 +0,0 @@ public abstract class Container { - this.d(); + this.c(); } } else if (this.g == 1) { - Slot slot = (Slot) this.slots.get(i); diff --git a/Spigot-Server-Patches/Entity-AddTo-RemoveFrom-World-Events.patch b/Spigot-Server-Patches/Entity-AddTo-RemoveFrom-World-Events.patch index d33d1d7351..2881833d06 100644 --- a/Spigot-Server-Patches/Entity-AddTo-RemoveFrom-World-Events.patch +++ b/Spigot-Server-Patches/Entity-AddTo-RemoveFrom-World-Events.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Entity AddTo/RemoveFrom World Events diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 74ae80646..119cd0636 100644 +index c9d0c22d5..e88baae1d 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose } entity.valid = true; // CraftBukkit @@ -16,8 +16,8 @@ index 74ae80646..119cd0636 100644 } protected void c(Entity entity) { -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - ((IWorldAccess) this.u.get(i)).b(entity); +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose + ((IWorldAccess) this.v.get(i)).b(entity); } + new com.destroystokyo.paper.event.entity.EntityRemoveFromWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid diff --git a/Spigot-Server-Patches/Entity-Origin-API.patch b/Spigot-Server-Patches/Entity-Origin-API.patch index e83479c99d..b8967ad9ad 100644 --- a/Spigot-Server-Patches/Entity-Origin-API.patch +++ b/Spigot-Server-Patches/Entity-Origin-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Entity Origin API diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index d358ab26a..011cf59c0 100644 +index 12b86ab75..2288df268 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only public boolean forceExplosionKnockback; // SPIGOT-949 public Timing tickTimer = MinecraftTimings.getEntityTimings(this); // Paper @@ -16,7 +16,7 @@ index d358ab26a..011cf59c0 100644 // Spigot start public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } } @@ -28,7 +28,7 @@ index d358ab26a..011cf59c0 100644 return nbttagcompound; } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT"); -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } // CraftBukkit end @@ -42,7 +42,7 @@ index d358ab26a..011cf59c0 100644 } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded"); -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke protected abstract void b(NBTTagCompound nbttagcompound); @@ -51,7 +51,7 @@ index d358ab26a..011cf59c0 100644 NBTTagList nbttaglist = new NBTTagList(); double[] adouble1 = adouble; diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index 2ba5d51a5..abdc2dea9 100644 +index 7aa12c3b4..1d4a7b64d 100644 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java @@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity { @@ -70,7 +70,7 @@ index 2ba5d51a5..abdc2dea9 100644 public void a(boolean flag) { diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index 0d70dd1d2..bb0904f86 100644 +index 5ceb3f206..87f3205f8 100644 --- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java +++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java @@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity { @@ -89,22 +89,22 @@ index 0d70dd1d2..bb0904f86 100644 @Nullable diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java -index bc6383669..ca9eb2f3b 100644 +index e56d4836d..0bf8d15d7 100644 --- a/src/main/java/net/minecraft/server/NBTTagList.java +++ b/src/main/java/net/minecraft/server/NBTTagList.java -@@ -0,0 +0,0 @@ public class NBTTagList extends NBTBase { +@@ -0,0 +0,0 @@ public class NBTTagList extends NBTList { return new int[0]; } -+ public final double getDoubleAt(int i) { return this.f(i); } // Paper - OBFHELPER - public double f(int i) { ++ public final double getDoubleAt(int i) { return this.k(i); } // Paper - OBFHELPER + public double k(int i) { if (i >= 0 && i < this.list.size()) { NBTBase nbtbase = (NBTBase) this.list.get(i); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 26d4bd690..31b765dea 100644 +index fd64b75ed..3f0b6ac26 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose int j = MathHelper.floor(entity.locZ / 16.0D); boolean flag = entity.attachedToPlayer; @@ -118,7 +118,7 @@ index 26d4bd690..31b765dea 100644 flag = true; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 833e3111d..6c23e88a5 100644 +index 1e3675e4f..0daa15f1b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/Spigot-Server-Patches/EntityPathfindEvent.patch b/Spigot-Server-Patches/EntityPathfindEvent.patch index 0566a258bd..8d1f03abf8 100644 --- a/Spigot-Server-Patches/EntityPathfindEvent.patch +++ b/Spigot-Server-Patches/EntityPathfindEvent.patch @@ -6,7 +6,7 @@ Subject: [PATCH] EntityPathfindEvent Fires when an Entity decides to start moving to a location. diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -index cc44d30b5..3ac6f84d3 100644 +index 1964684ac..0c5215657 100644 --- a/src/main/java/net/minecraft/server/NavigationAbstract.java +++ b/src/main/java/net/minecraft/server/NavigationAbstract.java @@ -0,0 +0,0 @@ import javax.annotation.Nullable; @@ -24,7 +24,7 @@ index cc44d30b5..3ac6f84d3 100644 } else { + if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(), MCUtil.toLocation(getEntity().world, blockposition), null).callEvent()) { return null; } // Paper this.q = blockposition; - float f = this.i(); + float f = this.k(); @@ -0,0 +0,0 @@ public abstract class NavigationAbstract { if (this.c != null && !this.c.b() && blockposition.equals(this.q)) { @@ -32,6 +32,6 @@ index cc44d30b5..3ac6f84d3 100644 } else { + if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(), MCUtil.toLocation(entity.world, blockposition), entity.getBukkitEntity()).callEvent()) { return null; } // Paper this.q = blockposition; - float f = this.i(); + float f = this.k(); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/EntityRegainHealthEvent-isFastRegen-API.patch b/Spigot-Server-Patches/EntityRegainHealthEvent-isFastRegen-API.patch index 898595b5f2..1955a0832b 100644 --- a/Spigot-Server-Patches/EntityRegainHealthEvent-isFastRegen-API.patch +++ b/Spigot-Server-Patches/EntityRegainHealthEvent-isFastRegen-API.patch @@ -6,7 +6,7 @@ Subject: [PATCH] EntityRegainHealthEvent isFastRegen API Don't even get me started diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index a92b89d7c..4b6bb38ae 100644 +index acf0e0281..b12c9e461 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -28,7 +28,7 @@ index a92b89d7c..4b6bb38ae 100644 if (!event.isCancelled()) { diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java -index d42db9b45..c715138ee 100644 +index bbcc488bd..d886e476b 100644 --- a/src/main/java/net/minecraft/server/FoodMetaData.java +++ b/src/main/java/net/minecraft/server/FoodMetaData.java @@ -0,0 +0,0 @@ public class FoodMetaData { diff --git a/Spigot-Server-Patches/Expose-server-CommandMap.patch b/Spigot-Server-Patches/Expose-server-CommandMap.patch index e71d363fcc..3c96425834 100644 --- a/Spigot-Server-Patches/Expose-server-CommandMap.patch +++ b/Spigot-Server-Patches/Expose-server-CommandMap.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Expose server CommandMap diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 462ad1024..1386bed52 100644 +index 29344593a..32a05ca18 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { diff --git a/Spigot-Server-Patches/Fast-draining.patch b/Spigot-Server-Patches/Fast-draining.patch deleted file mode 100644 index 88cedb3968..0000000000 --- a/Spigot-Server-Patches/Fast-draining.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Wed, 2 Mar 2016 12:20:52 -0600 -Subject: [PATCH] Fast draining - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 15675efbf..dbd82d5a9 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperWorldConfig { - optimizeExplosions = getBoolean("optimize-explosions", false); - log("Optimize explosions: " + optimizeExplosions); - } -+ -+ public boolean fastDrainLava; -+ public boolean fastDrainWater; -+ private void fastDrain() { -+ fastDrainLava = getBoolean("fast-drain.lava", false); -+ fastDrainWater = getBoolean("fast-drain.water", false); -+ } - } -diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java -index 3b47253a4..3aaa19b2f 100644 ---- a/src/main/java/net/minecraft/server/BlockFlowing.java -+++ b/src/main/java/net/minecraft/server/BlockFlowing.java -@@ -0,0 +0,0 @@ public class BlockFlowing extends BlockFluids { - } - } - -- if (this.material == Material.LAVA && i < 8 && i1 < 8 && i1 > i && random.nextInt(4) != 0) { -+ if (!world.paperConfig.fastDrainLava && this.material == Material.LAVA && i < 8 && i1 < 8 && i1 > i && random.nextInt(4) != 0) { // Paper - j *= 4; - } - -@@ -0,0 +0,0 @@ public class BlockFlowing extends BlockFluids { - this.f(world, blockposition, iblockdata); - } else { - i = i1; -- if (i1 < 0) { -+ if (i1 < 0 || canFastDrain(world, blockposition)) { // Paper - Fast draining - world.setAir(blockposition); - } else { - iblockdata = iblockdata.set(BlockFlowing.LEVEL, Integer.valueOf(i1)); -@@ -0,0 +0,0 @@ public class BlockFlowing extends BlockFluids { - - } - -+ // Paper start - /** - * Paper - Get flow speed. Throttle if its water and flowing adjacent to lava - */ -@@ -0,0 +0,0 @@ public class BlockFlowing extends BlockFluids { - } - return super.a(world); - } -+ -+ private int getFluidLevel(IBlockAccess iblockaccess, BlockPosition blockposition) { -+ return iblockaccess.getType(blockposition).getMaterial() == this.material ? iblockaccess.getType(blockposition).get(BlockFluids.LEVEL) : -1; -+ } -+ -+ /** -+ * Paper - Data check method for fast draining -+ */ -+ public int getData(World world, BlockPosition position) { -+ int data = this.getFluidLevel((IBlockAccess) world, position); -+ return data < 8 ? data : 0; -+ } -+ -+ /** -+ * Paper - Checks surrounding blocks to determine if block can be fast drained -+ */ -+ public boolean canFastDrain(World world, BlockPosition position) { -+ boolean result = false; -+ int data = getData(world, position); -+ if (this.material == Material.WATER) { -+ if (world.paperConfig.fastDrainWater) { -+ result = true; -+ if (getData(world, position.down()) < 0) { -+ result = false; -+ } else if (world.getType(position.north()).getBlock().getBlockData().getMaterial() == Material.WATER && getData(world, position.north()) < data) { -+ result = false; -+ } else if (world.getType(position.south()).getBlock().getBlockData().getMaterial() == Material.WATER && getData(world, position.south()) < data) { -+ result = false; -+ } else if (world.getType(position.west()).getBlock().getBlockData().getMaterial() == Material.WATER && getData(world, position.west()) < data) { -+ result = false; -+ } else if (world.getType(position.east()).getBlock().getBlockData().getMaterial() == Material.WATER && getData(world, position.east()) < data) { -+ result = false; -+ } -+ } -+ } else if (this.material == Material.LAVA) { -+ if (world.paperConfig.fastDrainLava) { -+ result = true; -+ if (getData(world, position.down()) < 0 || world.getType(position.up()).getBlock().getBlockData().getMaterial() != Material.AIR) { -+ result = false; -+ } else if (world.getType(position.north()).getBlock().getBlockData().getMaterial() == Material.LAVA && getData(world, position.north()) < data) { -+ result = false; -+ } else if (world.getType(position.south()).getBlock().getBlockData().getMaterial() == Material.LAVA && getData(world, position.south()) < data) { -+ result = false; -+ } else if (world.getType(position.west()).getBlock().getBlockData().getMaterial() == Material.LAVA && getData(world, position.west()) < data) { -+ result = false; -+ } else if (world.getType(position.east()).getBlock().getBlockData().getMaterial() == Material.LAVA && getData(world, position.east()) < data) { -+ result = false; -+ } -+ } -+ } -+ return result; -+ } -+ // Paper end - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch b/Spigot-Server-Patches/Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch index dfdac2fe07..188d8fbf04 100644 --- a/Spigot-Server-Patches/Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch +++ b/Spigot-Server-Patches/Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Fix Cancelling BlockPlaceEvent triggering physics diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 671927d5c..1189720de 100644 +index d15afd595..9fdedc2d7 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose } - public void applyPhysics(BlockPosition blockposition, Block block, boolean flag) { + public void applyPhysics(BlockPosition blockposition, Block block) { + if (captureBlockStates) { return; } // Paper - Cancel all physics during placement this.a(blockposition.west(), block, blockposition); this.a(blockposition.east(), block, blockposition); diff --git a/Spigot-Server-Patches/Fix-Furnace-cook-time-bug.patch b/Spigot-Server-Patches/Fix-Furnace-cook-time-bug.patch index 5e85298cc5..92f5292bb6 100644 --- a/Spigot-Server-Patches/Fix-Furnace-cook-time-bug.patch +++ b/Spigot-Server-Patches/Fix-Furnace-cook-time-bug.patch @@ -9,16 +9,16 @@ cook in the expected amount of time as the cook time was not decremented correct This patch ensures that furnaces cook to the correct wall time expectation. diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java -index 886a73e93..7a1428105 100644 +index 8f9a59693..3a587a766 100644 --- a/src/main/java/net/minecraft/server/TileEntityFurnace.java +++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java -@@ -0,0 +0,0 @@ public class TileEntityFurnace extends TileEntityContainer implements ITickable, - if (this.isBurning() && this.canBurn()) { +@@ -0,0 +0,0 @@ public class TileEntityFurnace extends TileEntityContainer implements IWorldInve + if (this.isBurning() && this.canBurn(irecipe)) { this.cookTime += elapsedTicks; if (this.cookTime >= this.cookTimeTotal) { - this.cookTime = 0; + this.cookTime -= this.cookTimeTotal; // Paper - this.cookTimeTotal = this.a((ItemStack) this.items.get(0)); - this.burn(); + this.cookTimeTotal = this.s(); + this.burn(irecipe); flag1 = true; -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Fix-cooked-fish-legacy-import.patch b/Spigot-Server-Patches/Fix-cooked-fish-legacy-import.patch deleted file mode 100644 index 27d13ecc3f..0000000000 --- a/Spigot-Server-Patches/Fix-cooked-fish-legacy-import.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jedediah Smith -Date: Tue, 1 Mar 2016 04:32:08 -0500 -Subject: [PATCH] Fix cooked fish legacy import - - -diff --git a/src/main/java/net/minecraft/server/DataConverterMaterialId.java b/src/main/java/net/minecraft/server/DataConverterMaterialId.java -index 87b82eb35..a7c71f406 100644 ---- a/src/main/java/net/minecraft/server/DataConverterMaterialId.java -+++ b/src/main/java/net/minecraft/server/DataConverterMaterialId.java -@@ -0,0 +0,0 @@ public class DataConverterMaterialId implements IDataConverter { - DataConverterMaterialId.a[347] = "minecraft:clock"; - DataConverterMaterialId.a[348] = "minecraft:glowstone_dust"; - DataConverterMaterialId.a[349] = "minecraft:fish"; -- DataConverterMaterialId.a[350] = "minecraft:cooked_fished"; -+ DataConverterMaterialId.a[350] = "minecraft:cooked_fish"; // Paper - cooked_fished -> cooked_fish - DataConverterMaterialId.a[351] = "minecraft:dye"; - DataConverterMaterialId.a[352] = "minecraft:bone"; - DataConverterMaterialId.a[353] = "minecraft:sugar"; --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Fix-lag-from-explosions-processing-dead-entities.patch b/Spigot-Server-Patches/Fix-lag-from-explosions-processing-dead-entities.patch index 3923d887e3..99691fc270 100644 --- a/Spigot-Server-Patches/Fix-lag-from-explosions-processing-dead-entities.patch +++ b/Spigot-Server-Patches/Fix-lag-from-explosions-processing-dead-entities.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix lag from explosions processing dead entities diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index 98c2bdcf7..a1ebcf858 100644 +index 37e6e5922..e30219258 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java @@ -0,0 +0,0 @@ public class Explosion { diff --git a/Spigot-Server-Patches/Fix-reducedDebugInfo-not-initialized-on-client.patch b/Spigot-Server-Patches/Fix-reducedDebugInfo-not-initialized-on-client.patch index 4860d2b6f3..c2c67ea960 100644 --- a/Spigot-Server-Patches/Fix-reducedDebugInfo-not-initialized-on-client.patch +++ b/Spigot-Server-Patches/Fix-reducedDebugInfo-not-initialized-on-client.patch @@ -5,15 +5,15 @@ Subject: [PATCH] Fix reducedDebugInfo not initialized on client diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index bf7aaebd6..baf288210 100644 +index 23cab725d..8e1edde31 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { - playerconnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked())); - playerconnection.sendPacket(new PacketPlayOutAbilities(entityplayer.abilities)); playerconnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex)); + playerconnection.sendPacket(new PacketPlayOutRecipeUpdate(this.server.getCraftingManager().b())); + playerconnection.sendPacket(new PacketPlayOutTags(this.server.getTagRegistry())); + playerconnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) (worldserver.getGameRules().getBoolean("reducedDebugInfo") ? 22 : 23))); // Paper - fix this rule not being initialized on the client this.f(entityplayer); entityplayer.getStatisticManager().c(); - entityplayer.F().a(entityplayer); + entityplayer.B().a(entityplayer); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Further-improve-server-tick-loop.patch b/Spigot-Server-Patches/Further-improve-server-tick-loop.patch index 039f0e13d6..af4c278714 100644 --- a/Spigot-Server-Patches/Further-improve-server-tick-loop.patch +++ b/Spigot-Server-Patches/Further-improve-server-tick-loop.patch @@ -12,10 +12,10 @@ Previous implementation did not calculate TPS correctly. Switch to a realistic rolling average and factor in std deviation as an extra reporting variable diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 92d480251..47fe9262a 100644 +index 4889a82a2..2e691b9f6 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati public org.bukkit.command.ConsoleCommandSender console; public org.bukkit.command.RemoteConsoleCommandSender remoteConsole; public ConsoleReader reader; @@ -24,6 +24,7 @@ index 92d480251..47fe9262a 100644 public final Thread primaryThread; public java.util.Queue processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; + public File bukkitDataPackFolder; // CraftBukkit end // Spigot start - public static final int TPS = 20; @@ -33,7 +34,7 @@ index 92d480251..47fe9262a 100644 public final SlackActivityAccountant slackActivityAccountant = new SlackActivityAccountant(); // Spigot end -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati this.isRunning = false; } @@ -93,7 +94,7 @@ index 92d480251..47fe9262a 100644 public void run() { try { -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati // Spigot start Arrays.fill( recentTps, 20 ); @@ -147,7 +148,7 @@ index 92d480251..47fe9262a 100644 } lastTick = curTime; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 33b40ffc2..bfddd1685 100644 +index 28f6cdf96..2055bf7de 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { diff --git a/Spigot-Server-Patches/Generator-Settings.patch b/Spigot-Server-Patches/Generator-Settings.patch deleted file mode 100644 index a2cd11b84e..0000000000 --- a/Spigot-Server-Patches/Generator-Settings.patch +++ /dev/null @@ -1,310 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Wed, 2 Mar 2016 02:17:54 -0600 -Subject: [PATCH] Generator Settings - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index db09711e4..7e5cd8042 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperWorldConfig { - disableEndCredits = getBoolean("game-mechanics.disable-end-credits", false); - log("End credits disabled: " + disableEndCredits); - } -+ -+ public boolean generateCanyon; -+ public boolean generateCaves; -+ public boolean generateDungeon; -+ public boolean generateFortress; -+ public boolean generateMineshaft; -+ public boolean generateMonument; -+ public boolean generateStronghold; -+ public boolean generateTemple; -+ public boolean generateVillage; -+ public boolean generateFlatBedrock; -+ public boolean disableExtremeHillsEmeralds; -+ public boolean disableExtremeHillsMonsterEggs; -+ public boolean disableMesaAdditionalGold; -+ -+ private void generatorSettings() { -+ generateCanyon = getBoolean("generator-settings.canyon", true); -+ generateCaves = getBoolean("generator-settings.caves", true); -+ generateDungeon = getBoolean("generator-settings.dungeon", true); -+ generateFortress = getBoolean("generator-settings.fortress", true); -+ generateMineshaft = getBoolean("generator-settings.mineshaft", true); -+ generateMonument = getBoolean("generator-settings.monument", true); -+ generateStronghold = getBoolean("generator-settings.stronghold", true); -+ generateTemple = getBoolean("generator-settings.temple", true); -+ generateVillage = getBoolean("generator-settings.village", true); -+ generateFlatBedrock = getBoolean("generator-settings.flat-bedrock", false); -+ disableExtremeHillsEmeralds = getBoolean("generator-settings.disable-extreme-hills-emeralds", false); -+ disableExtremeHillsMonsterEggs = getBoolean("generator-settings.disable-extreme-hills-monster-eggs", false); -+ disableMesaAdditionalGold = getBoolean("generator-settings.disable-mesa-additional-gold", false); -+ } - } -diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java -index 1b7599769..ab6db7468 100644 ---- a/src/main/java/net/minecraft/server/BiomeBase.java -+++ b/src/main/java/net/minecraft/server/BiomeBase.java -@@ -0,0 +0,0 @@ public abstract class BiomeBase { - BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); - - for (int l1 = 255; l1 >= 0; --l1) { -- if (l1 <= random.nextInt(5)) { -+ if (l1 <= (world.paperConfig.generateFlatBedrock ? 0 : random.nextInt(5))) { // Paper - Configurable flat bedrock - chunksnapshot.a(k1, l1, j1, BiomeBase.c); - } else { - IBlockData iblockdata2 = chunksnapshot.a(k1, l1, j1); -diff --git a/src/main/java/net/minecraft/server/BiomeBigHills.java b/src/main/java/net/minecraft/server/BiomeBigHills.java -index 9c39bf7af..61680ab50 100644 ---- a/src/main/java/net/minecraft/server/BiomeBigHills.java -+++ b/src/main/java/net/minecraft/server/BiomeBigHills.java -@@ -0,0 +0,0 @@ public class BiomeBigHills extends BiomeBase { - int k; - int l; - -+ // Paper start - Disable extreme hills emeralds -+ if (!world.paperConfig.disableExtremeHillsEmeralds) { -+ - for (j = 0; j < i; ++j) { - k = random.nextInt(16); - l = random.nextInt(28) + 4; -@@ -0,0 +0,0 @@ public class BiomeBigHills extends BiomeBase { - } - } - -+ } -+ // Paper end block -+ -+ // Paper start - Disable extreme hills monster eggs -+ if (!world.paperConfig.disableExtremeHillsMonsterEggs) { -+ - for (i = 0; i < 7; ++i) { - j = random.nextInt(16); - k = random.nextInt(64); -@@ -0,0 +0,0 @@ public class BiomeBigHills extends BiomeBase { - this.x.generate(world, random, blockposition.a(j, k, l)); - } - -+ } -+ // Paper end block -+ - } - - public void a(World world, Random random, ChunkSnapshot chunksnapshot, int i, int j, double d0) { -diff --git a/src/main/java/net/minecraft/server/BiomeMesa.java b/src/main/java/net/minecraft/server/BiomeMesa.java -index f2dd96a32..67f8ad8ed 100644 ---- a/src/main/java/net/minecraft/server/BiomeMesa.java -+++ b/src/main/java/net/minecraft/server/BiomeMesa.java -@@ -0,0 +0,0 @@ public class BiomeMesa extends BiomeBase { - chunksnapshot.a(l, i2, k, BiomeMesa.a); - } - -- if (i2 <= random.nextInt(5)) { -+ if (i2 <= (world.paperConfig.generateFlatBedrock ? 0 : random.nextInt(5))) { // Paper - Configurable flat bedrock - chunksnapshot.a(l, i2, k, BiomeMesa.c); - } else if (l1 < 15 || this.I) { - IBlockData iblockdata2 = chunksnapshot.a(l, i2, k); -@@ -0,0 +0,0 @@ public class BiomeMesa extends BiomeBase { - - protected void a(World world, Random random) { - super.a(world, random); -+ if (world.paperConfig.disableMesaAdditionalGold) return; // Paper - this.a(world, random, 20, this.n, 32, 80); - } - -diff --git a/src/main/java/net/minecraft/server/ChunkProviderFlat.java b/src/main/java/net/minecraft/server/ChunkProviderFlat.java -index 1452ff657..8b1b79380 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderFlat.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderFlat.java -@@ -0,0 +0,0 @@ public class ChunkProviderFlat implements ChunkGenerator { - if (flag) { - Map map = this.d.b(); - -- if (map.containsKey("village")) { -+ if (map.containsKey("village") && world.paperConfig.generateVillage) { // Paper - Map map1 = (Map) map.get("village"); - - if (!map1.containsKey("size")) { -@@ -0,0 +0,0 @@ public class ChunkProviderFlat implements ChunkGenerator { - this.e.put("Village", new WorldGenVillage(map1)); - } - -- if (map.containsKey("biome_1")) { -+ if (map.containsKey("biome_1") && world.paperConfig.generateTemple) { // Paper - this.e.put("Temple", new WorldGenLargeFeature((Map) map.get("biome_1"))); - } - -- if (map.containsKey("mineshaft")) { -+ if (map.containsKey("mineshaft") && world.paperConfig.generateMineshaft) { // Paper - this.e.put("Mineshaft", new WorldGenMineshaft((Map) map.get("mineshaft"))); - } - -- if (map.containsKey("stronghold")) { -+ if (map.containsKey("stronghold") && world.paperConfig.generateStronghold) { // Paper - this.e.put("Stronghold", new WorldGenStronghold((Map) map.get("stronghold"))); - } - -- if (map.containsKey("oceanmonument")) { -+ if (map.containsKey("oceanmonument") && world.paperConfig.generateMonument) { // Paper - this.e.put("Monument", new WorldGenMonument((Map) map.get("oceanmonument"))); - } - } -@@ -0,0 +0,0 @@ public class ChunkProviderFlat implements ChunkGenerator { - this.i = new WorldGenLakes(Blocks.LAVA); - } - -- this.g = this.d.b().containsKey("dungeon"); -+ this.g = world.paperConfig.generateDungeon && this.d.b().containsKey("dungeon"); // Paper - int j = 0; - int k = 0; - boolean flag1 = true; -diff --git a/src/main/java/net/minecraft/server/ChunkProviderGenerate.java b/src/main/java/net/minecraft/server/ChunkProviderGenerate.java -index 22a24a39f..ee9e00e64 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderGenerate.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderGenerate.java -@@ -0,0 +0,0 @@ public class ChunkProviderGenerate implements ChunkGenerator { - this.a(i, j, chunksnapshot); - this.D = this.n.getWorldChunkManager().getBiomeBlock(this.D, i * 16, j * 16, 16, 16); - this.a(i, j, chunksnapshot, this.D); -- if (this.s.r) { -+ if (this.s.r && this.n.paperConfig.generateCaves) { // Paper - this.v.a(this.n, i, j, chunksnapshot); - } - -- if (this.s.A) { -+ if (this.s.A && this.n.paperConfig.generateCanyon) { // Paper - this.A.a(this.n, i, j, chunksnapshot); - } - - if (this.o) { -- if (this.s.w) { -+ if (this.s.w && this.n.paperConfig.generateMineshaft) { // Paper - this.y.a(this.n, i, j, chunksnapshot); - } - -- if (this.s.v) { -+ if (this.s.v&& this.n.paperConfig.generateVillage) { // Paper - this.x.a(this.n, i, j, chunksnapshot); - } - -- if (this.s.u) { -+ if (this.s.u && this.n.paperConfig.generateStronghold) { // Paper - this.w.a(this.n, i, j, chunksnapshot); - } - -- if (this.s.x) { -+ if (this.s.x && this.n.paperConfig.generateTemple) { // Paper - this.z.a(this.n, i, j, chunksnapshot); - } - -- if (this.s.y) { -+ if (this.s.y && this.n.paperConfig.generateMonument) { // Paper - this.B.a(this.n, i, j, chunksnapshot); - } - -@@ -0,0 +0,0 @@ public class ChunkProviderGenerate implements ChunkGenerator { - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j); - - if (this.o) { -- if (this.s.w) { -+ if (this.s.w && this.n.paperConfig.generateMineshaft) { // Paper - this.y.a(this.n, this.i, chunkcoordintpair); - } - -- if (this.s.v) { -+ if (this.s.v && this.n.paperConfig.generateVillage) { // Paper - flag = this.x.a(this.n, this.i, chunkcoordintpair); - } - -- if (this.s.u) { -+ if (this.s.u && this.n.paperConfig.generateStronghold) { // Paper - this.w.a(this.n, this.i, chunkcoordintpair); - } - -- if (this.s.x) { -+ if (this.s.x && this.n.paperConfig.generateTemple) { // Paper - this.z.a(this.n, this.i, chunkcoordintpair); - } - -- if (this.s.y) { -+ if (this.s.y && this.n.paperConfig.generateMonument) { // Paper - this.B.a(this.n, this.i, chunkcoordintpair); - } - -@@ -0,0 +0,0 @@ public class ChunkProviderGenerate implements ChunkGenerator { - } - } - -- if (this.s.s) { -+ if (this.s.s && this.n.paperConfig.generateDungeon) { // Paper - for (k1 = 0; k1 < this.s.t; ++k1) { - l1 = this.i.nextInt(16) + 8; - i2 = this.i.nextInt(256); -@@ -0,0 +0,0 @@ public class ChunkProviderGenerate implements ChunkGenerator { - - public void recreateStructures(Chunk chunk, int i, int j) { - if (this.o) { -- if (this.s.w) { -+ if (this.s.w && this.n.paperConfig.generateMineshaft) { // Paper - this.y.a(this.n, i, j, (ChunkSnapshot) null); - } - -- if (this.s.v) { -+ if (this.s.v && this.n.paperConfig.generateVillage) { // Paper - this.x.a(this.n, i, j, (ChunkSnapshot) null); - } - -- if (this.s.u) { -+ if (this.s.u && this.n.paperConfig.generateStronghold) { // Paper - this.w.a(this.n, i, j, (ChunkSnapshot) null); - } - -- if (this.s.x) { -+ if (this.s.x && this.n.paperConfig.generateTemple) { // Paper - this.z.a(this.n, i, j, (ChunkSnapshot) null); - } - -- if (this.s.y) { -+ if (this.s.y && this.n.paperConfig.generateMonument) { // Paper - this.B.a(this.n, i, j, (ChunkSnapshot) null); - } - -diff --git a/src/main/java/net/minecraft/server/ChunkProviderHell.java b/src/main/java/net/minecraft/server/ChunkProviderHell.java -index 9f738749f..12bc10ff0 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderHell.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderHell.java -@@ -0,0 +0,0 @@ public class ChunkProviderHell implements ChunkGenerator { - IBlockData iblockdata1 = ChunkProviderHell.b; - - for (int l1 = 127; l1 >= 0; --l1) { -- if (l1 < 127 - this.p.nextInt(5) && l1 > this.p.nextInt(5)) { -+ // Paper start - Configurable flat bedrock worldgen -+ if (l1 < 127 - (n.paperConfig.generateFlatBedrock ? 0 : this.p.nextInt(5)) && -+ l1 > (n.paperConfig.generateFlatBedrock ? 0 : this.p.nextInt(5))) { -+ // Paper end - IBlockData iblockdata2 = chunksnapshot.a(i1, l1, l); - - if (iblockdata2.getBlock() != null && iblockdata2.getMaterial() != Material.AIR) { -@@ -0,0 +0,0 @@ public class ChunkProviderHell implements ChunkGenerator { - } - - public void recreateStructures(Chunk chunk, int i, int j) { -- this.I.a(this.n, i, j, (ChunkSnapshot) null); -+ if (this.n.paperConfig.generateFortress) this.I.a(this.n, i, j, (ChunkSnapshot) null); - } - } -diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java -index 66a80a776..34fd7edfe 100644 ---- a/src/main/java/net/minecraft/server/StructureGenerator.java -+++ b/src/main/java/net/minecraft/server/StructureGenerator.java -@@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase { - } - - public boolean a(World world, BlockPosition blockposition) { -+ if (this.g == null) return false; // Paper - this.a(world); - ObjectIterator objectiterator = this.c.values().iterator(); - --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Handle-Item-Meta-Inconsistencies.patch b/Spigot-Server-Patches/Handle-Item-Meta-Inconsistencies.patch index e2c0632dc4..b1cd18302a 100644 --- a/Spigot-Server-Patches/Handle-Item-Meta-Inconsistencies.patch +++ b/Spigot-Server-Patches/Handle-Item-Meta-Inconsistencies.patch @@ -18,40 +18,49 @@ For consistency, the old API methods now forward to use the ItemMeta API equivalents, and should deprecate the old API's. diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 82d72ea15..5047a57e9 100644 +index 7f249a975..70f2dcc9e 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java +@@ -0,0 +0,0 @@ import com.mojang.brigadier.StringReader; + import com.mojang.brigadier.exceptions.CommandSyntaxException; + import java.text.DecimalFormat; + import java.text.DecimalFormatSymbols; ++import java.util.Collections; ++import java.util.Comparator; + import java.util.Locale; + import java.util.Objects; + import java.util.Random; @@ -0,0 +0,0 @@ public final class ItemStack { + decimalformat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT)); + return decimalformat; } - - // CraftBukkit start + // Paper start -+ private static final java.util.Comparator enchantSorter = java.util.Comparator.comparingInt(o -> o.getShort("id")); ++ private static final java.util.Comparator enchantSorter = java.util.Comparator.comparing(o -> o.getString("id")); + private void processEnchantOrder(NBTTagCompound tag) { -+ if (tag == null || !tag.hasKeyOfType("ench", 9)) { ++ if (tag == null || !tag.hasKeyOfType("Enchantments", 9)) { + return; + } -+ NBTTagList list = tag.getList("ench", 10); ++ NBTTagList list = tag.getList("Enchantments", 10); + if (list.size() < 2) { + return; + } + try { -+ list.sort(enchantSorter); // Paper ++ //noinspection unchecked ++ list.sort((Comparator) enchantSorter); // Paper + } catch (Exception ignored) {} + } + // Paper end -+ - public ItemStack(Item item, int i, int j) { - this(item, i, j, true); - } + + public ItemStack(IMaterial imaterial) { + this(imaterial, 1); @@ -0,0 +0,0 @@ public final class ItemStack { if (nbttagcompound.hasKeyOfType("tag", 10)) { // CraftBukkit start - make defensive copy as this data may be coming from the save thread this.tag = (NBTTagCompound) nbttagcompound.getCompound("tag").clone(); + processEnchantOrder(this.tag); // Paper - if (this.item != null) { - this.item.a(this.tag); - // CraftBukkit end + this.getItem().a(this.tag); + // CraftBukkit end + } @@ -0,0 +0,0 @@ public final class ItemStack { // Paper end public void setTag(@Nullable NBTTagCompound nbttagcompound) { @@ -59,34 +68,17 @@ index 82d72ea15..5047a57e9 100644 + processEnchantOrder(this.tag); // Paper } - public String getName() { + public IChatBaseComponent getName() { @@ -0,0 +0,0 @@ public final class ItemStack { - nbttagcompound.setShort("id", (short) Enchantment.getId(enchantment)); + nbttagcompound.setString("id", String.valueOf(Enchantment.enchantments.b(enchantment))); nbttagcompound.setShort("lvl", (short) ((byte) i)); - nbttaglist.add(nbttagcompound); + nbttaglist.add((NBTBase) nbttagcompound); + processEnchantOrder(nbttagcompound); // Paper } public boolean hasEnchantments() { -diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java -index ca9eb2f3b..576c3b714 100644 ---- a/src/main/java/net/minecraft/server/NBTTagList.java -+++ b/src/main/java/net/minecraft/server/NBTTagList.java -@@ -0,0 +0,0 @@ public class NBTTagList extends NBTBase { - - private static final Logger b = LogManager.getLogger(); - public List list = Lists.newArrayList(); // Paper -+ // Paper start -+ public void sort(java.util.Comparator comparator) { -+ //noinspection unchecked -+ java.util.Collections.sort(list, (java.util.Comparator) comparator); -+ } -+ // Paper end - private byte type = 0; - - public NBTTagList() {} diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index fb1dc542d..cdf16e15a 100644 +index 4c4f04557..cb3b952e2 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -0,0 +0,0 @@ import static org.bukkit.craftbukkit.inventory.CraftMetaItem.ENCHANTMENTS; @@ -113,14 +105,14 @@ index fb1dc542d..cdf16e15a 100644 - - for (int i = 0; i < size; i++) { - NBTTagCompound tag = (NBTTagCompound) list.get(i); -- short id = tag.getShort(ENCHANTMENTS_ID.NBT); -- if (id == ench.getId()) { +- String id = tag.getString(ENCHANTMENTS_ID.NBT); +- if (id.equals(ench.getKey().toString())) { - tag.setShort(ENCHANTMENTS_LVL.NBT, (short) level); - return; - } - } - NBTTagCompound tag = new NBTTagCompound(); -- tag.setShort(ENCHANTMENTS_ID.NBT, (short) ench.getId()); +- tag.setString(ENCHANTMENTS_ID.NBT, ench.getKey().toString()); - tag.setShort(ENCHANTMENTS_LVL.NBT, (short) level); - list.add(tag); + // Paper start - Replace whole method @@ -146,13 +138,13 @@ index fb1dc542d..cdf16e15a 100644 - return 0; - } - return EnchantmentManager.getEnchantmentLevel(CraftEnchantment.getRaw(ench), handle); -+ return hasItemMeta() ? getItemMeta().getEnchantLevel(ench) : 0; // Pape - replace entire method with meta ++ return hasItemMeta() ? getItemMeta().getEnchantLevel(ench) : 0; // Paper - replace entire method with meta } @Override public int removeEnchantment(Enchantment ench) { Validate.notNull(ench, "Cannot remove null enchantment"); -- + - NBTTagList list = getEnchantmentList(handle), listCopy; - if (list == null) { - return 0; @@ -163,8 +155,8 @@ index fb1dc542d..cdf16e15a 100644 - - for (int i = 0; i < size; i++) { - NBTTagCompound enchantment = (NBTTagCompound) list.get(i); -- int id = 0xffff & enchantment.getShort(ENCHANTMENTS_ID.NBT); -- if (id == ench.getId()) { +- String id = enchantment.getString(ENCHANTMENTS_ID.NBT); +- if (id.equals(ench.getKey().toString())) { - index = i; - level = 0xffff & enchantment.getShort(ENCHANTMENTS_LVL.NBT); - break; @@ -212,53 +204,42 @@ index fb1dc542d..cdf16e15a 100644 static Map getEnchantments(net.minecraft.server.ItemStack item) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index c743ae066..0cdc8007a 100644 +index 3b73e52fa..e43a24989 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -0,0 +0,0 @@ import java.lang.annotation.RetentionPolicy; - import java.lang.annotation.Target; - import java.lang.reflect.Constructor; +@@ -0,0 +0,0 @@ import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; --import java.util.ArrayList; --import java.util.Collection; --import java.util.HashMap; --import java.util.List; --import java.util.Map; --import java.util.NoSuchElementException; + import java.util.ArrayList; + import java.util.Collection; ++import java.util.Comparator; + import java.util.HashMap; + import java.util.List; + import java.util.Map; + import java.util.NoSuchElementException; + import net.minecraft.server.IChatBaseComponent; +import com.google.common.collect.ImmutableSortedMap; import net.minecraft.server.NBTBase; import net.minecraft.server.NBTTagCompound; import net.minecraft.server.NBTTagList; -@@ -0,0 +0,0 @@ import com.google.common.collect.Sets; - import java.io.ByteArrayInputStream; - import java.io.ByteArrayOutputStream; - import java.io.IOException; -+import java.util.ArrayList; - import java.util.Arrays; -+import java.util.Collection; -+import java.util.Comparator; +@@ -0,0 +0,0 @@ import java.util.Arrays; import java.util.EnumSet; -+import java.util.HashMap; import java.util.HashSet; -+import java.util.List; -+import java.util.Map; -+import java.util.NoSuchElementException; import java.util.Set; +import java.util.TreeMap; import java.util.logging.Level; import java.util.logging.Logger; import net.minecraft.server.NBTCompressedStreamTools; -@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable { - private String displayName; - private String locName; +@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { + private IChatBaseComponent displayName; + private IChatBaseComponent locName; private List lore; - private Map enchantments; + private EnchantmentMap enchantments; // Paper private int repairCost; private int hideFlag; private boolean unbreakable; -@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable { +@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { private static final Set HANDLED_TAGS = Sets.newHashSet(); private NBTTagCompound internalTag; @@ -267,7 +248,7 @@ index c743ae066..0cdc8007a 100644 CraftMetaItem(CraftMetaItem meta) { if (meta == null) { -@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable { +@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { } if (meta.enchantments != null) { // Spigot @@ -276,7 +257,7 @@ index c743ae066..0cdc8007a 100644 } this.repairCost = meta.repairCost; -@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable { +@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { } } @@ -291,8 +272,8 @@ index c743ae066..0cdc8007a 100644 + EnchantmentMap enchantments = new EnchantmentMap(); // Paper for (int i = 0; i < ench.size(); i++) { - int id = 0xffff & ((NBTTagCompound) ench.get(i)).getShort(ENCHANTMENTS_ID.NBT); -@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable { + String id = ((NBTTagCompound) ench.get(i)).getString(ENCHANTMENTS_ID.NBT); +@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { void deserializeInternal(NBTTagCompound tag) { } @@ -308,7 +289,7 @@ index c743ae066..0cdc8007a 100644 for (Map.Entry entry : ench.entrySet()) { // Doctor older enchants String enchantKey = entry.getKey().toString(); -@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable { +@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { } public Map getEnchants() { @@ -324,7 +305,7 @@ index c743ae066..0cdc8007a 100644 } if (ignoreRestrictions || level >= ench.getStartLevel() && level <= ench.getMaxLevel()) { -@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable { +@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { clone.lore = new ArrayList(this.lore); } if (this.enchantments != null) { @@ -333,7 +314,7 @@ index c743ae066..0cdc8007a 100644 } clone.hideFlag = this.hideFlag; clone.unbreakable = this.unbreakable; -@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Repairable { +@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { } } @@ -345,7 +326,7 @@ index c743ae066..0cdc8007a 100644 + } + + private EnchantmentMap() { -+ super((o1, o2) -> ((Integer) o1.getId()).compareTo(o2.getId())); ++ super(Comparator.comparing(o -> o.getKey().toString())); + } + + public EnchantmentMap clone() { diff --git a/Spigot-Server-Patches/Implement-PlayerLocaleChangeEvent.patch b/Spigot-Server-Patches/Implement-PlayerLocaleChangeEvent.patch index 3f4da0ea6f..cd583db25a 100644 --- a/Spigot-Server-Patches/Implement-PlayerLocaleChangeEvent.patch +++ b/Spigot-Server-Patches/Implement-PlayerLocaleChangeEvent.patch @@ -5,15 +5,15 @@ Subject: [PATCH] Implement PlayerLocaleChangeEvent diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index ed3546ccc..4b6976b19 100644 +index 5ca0dec1f..8b5cfc78a 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -0,0 +0,0 @@ import org.bukkit.inventory.MainHand; - public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - private static final Logger bV = LogManager.getLogger(); + private static final Logger cc = LogManager.getLogger(); + private static final IChatBaseComponent cd = (new ChatMessage("multiplayer.message_not_delivered", new Object[0])).a(EnumChatFormat.RED); - public String locale = "en_us"; // CraftBukkit - lowercase -+ public String locale = null; // PAIL: private -> public // Paper - default to null ++ public String locale = null; // CraftBukkit - lowercase // Paper - default to null public PlayerConnection playerConnection; public final MinecraftServer server; public final PlayerInteractManager playerInteractManager; @@ -22,30 +22,24 @@ index ed3546ccc..4b6976b19 100644 this.server.server.getPluginManager().callEvent(event); } - if (!this.locale.equals(packetplayinsettings.a())) { -+ -+ // Paper start - add PlayerLocaleChangeEvent -+ // Since the field is initialized to null, this event should always fire the first time the packet is received -+ String oldLocale = this.locale; -+ this.locale = packetplayinsettings.a(); -+ if (!this.locale.equals(oldLocale)) { -+ new com.destroystokyo.paper.event.player.PlayerLocaleChangeEvent(this.getBukkitEntity(), oldLocale, this.locale).callEvent(); -+ } -+ -+ // Compat with Bukkit -+ oldLocale = oldLocale != null ? oldLocale : "en_us"; -+ // Paper end -+ -+ if (!oldLocale.equals(packetplayinsettings.a())) { - PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(getBukkitEntity(), packetplayinsettings.a()); ++ if (this.locale == null || !this.locale.equals(packetplayinsettings.b())) { // Paper - fix bug and check for null + PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(getBukkitEntity(), packetplayinsettings.b()); this.server.server.getPluginManager().callEvent(event); } // CraftBukkit end -- this.locale = packetplayinsettings.a(); - this.cl = packetplayinsettings.c(); - this.cm = packetplayinsettings.d(); - this.getDataWatcher().set(EntityPlayer.br, Byte.valueOf((byte) packetplayinsettings.e())); ++ // Paper start - add PlayerLocaleChangeEvent ++ // Since the field is initialized to null, this event should always fire the first time the packet is received ++ String oldLocale = this.locale; + this.locale = packetplayinsettings.b(); ++ if (!this.locale.equals(oldLocale)) { ++ new com.destroystokyo.paper.event.player.PlayerLocaleChangeEvent(this.getBukkitEntity(), oldLocale, this.locale).callEvent(); ++ } ++ // Paper end + this.ct = packetplayinsettings.d(); + this.cu = packetplayinsettings.e(); + this.getDataWatcher().set(EntityPlayer.bx, Byte.valueOf((byte) packetplayinsettings.f())); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 6e2773cbb..532b211c4 100644 +index 3871f3100..7d4355439 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -60,7 +54,7 @@ index 6e2773cbb..532b211c4 100644 + // Paper end } - public void setAffectsSpawning(boolean affects) { + // Paper start @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public String getLocale() diff --git a/Spigot-Server-Patches/Lighting-Queue.patch b/Spigot-Server-Patches/Lighting-Queue.patch index 3a51a3a24b..59480d2d6d 100644 --- a/Spigot-Server-Patches/Lighting-Queue.patch +++ b/Spigot-Server-Patches/Lighting-Queue.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Lighting Queue This provides option to queue lighting updates to ensure they do not cause the server lag diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java -index e0ad559b7..4eebd9fae 100644 +index 145cb274b..eff9dcf54 100644 --- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java +++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java @@ -0,0 +0,0 @@ public class WorldTimingsHandler { @@ -25,9 +25,10 @@ index e0ad559b7..4eebd9fae 100644 + + lightingQueueTimer = Timings.ofSafe(name + "Lighting Queue"); } - } + + public static Timing getTickList(WorldServer worldserver, String timingsType) { diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index bf7af475c..94a173045 100644 +index a340866f3..1e3405cc1 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -42,19 +43,19 @@ index bf7af475c..94a173045 100644 + } } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 50113c303..aaf253c89 100644 +index 36ea4ad47..e5567701e 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -0,0 +0,0 @@ public class Chunk { +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { return removed; } } + final PaperLightingQueue.LightingQueue lightingQueue = new PaperLightingQueue.LightingQueue(this); // Paper end - private boolean done; - private boolean lit; -@@ -0,0 +0,0 @@ public class Chunk { - private void h(boolean flag) { + public boolean areNeighborsLoaded(final int radius) { + switch (radius) { +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + private void g(boolean flag) { this.world.methodProfiler.a("recheckGaps"); if (this.world.areChunksLoaded(new BlockPosition(this.locX * 16 + 8, 0, this.locZ * 16 + 8), 16)) { + this.runOrQueueLightUpdate(() -> recheckGaps(flag)); // Paper - Queue light update @@ -66,25 +67,25 @@ index 50113c303..aaf253c89 100644 + // Paper end for (int i = 0; i < 16; ++i) { for (int j = 0; j < 16; ++j) { - if (this.i[i + j * 16]) { -@@ -0,0 +0,0 @@ public class Chunk { - if (flag) { + if (this.h[i + j * 16]) { +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + if (flag1) { this.initLighting(); } else { + this.runOrQueueLightUpdate(() -> { // Paper - Queue light update - int j1 = iblockdata.c(); - int k1 = iblockdata1.c(); + int i1 = iblockdata.b(this.world, blockposition); + int j1 = iblockdata1.b(this.world, blockposition); -@@ -0,0 +0,0 @@ public class Chunk { - if (j1 != k1 && (j1 < k1 || this.getBrightness(EnumSkyBlock.SKY, blockposition) > 0 || this.getBrightness(EnumSkyBlock.BLOCK, blockposition) > 0)) { - this.d(i, k); +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + if (i1 != j1 && (i1 < j1 || this.getBrightness(EnumSkyBlock.SKY, blockposition) > 0 || this.getBrightness(EnumSkyBlock.BLOCK, blockposition) > 0)) { + this.c(i, k); } + }); // Paper } TileEntity tileentity; -@@ -0,0 +0,0 @@ public class Chunk { - this.w = i; +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + return this.E == 8; } + // Paper start @@ -101,7 +102,7 @@ index 50113c303..aaf253c89 100644 IMMEDIATE, QUEUED, CHECK; diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index bd006ef74..2b320cbd1 100644 +index badfe86b2..51bc23daf 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider { @@ -113,24 +114,24 @@ index bd006ef74..2b320cbd1 100644 // Update neighbor counts for (int x = -2; x < 3; x++) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 47fe9262a..d63a243f3 100644 +index 2e691b9f6..4473c3b51 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs - protected void C() throws ExceptionWorldConflict { // CraftBukkit - added throws +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati + protected void v() { co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper this.slackActivityAccountant.tickStarted(); // Spigot -- long i = System.nanoTime(); -+ long i = System.nanoTime(); long startTime = i; // Paper +- long i = SystemUtils.c(); ++ long i = SystemUtils.c(); long startTime = i; // Paper ++this.ticks; - if (this.T) { -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs - this.methodProfiler.b(); - + if (this.S) { +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati + this.methodProfiler.e(); + this.methodProfiler.e(); org.spigotmc.WatchdogThread.tick(); // Spigot + PaperLightingQueue.processQueue(startTime); // Paper - this.slackActivityAccountant.tickEnded(tickNanos); // Spigot + this.slackActivityAccountant.tickEnded(l); // Spigot co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper } diff --git a/src/main/java/net/minecraft/server/PaperLightingQueue.java b/src/main/java/net/minecraft/server/PaperLightingQueue.java @@ -232,16 +233,16 @@ index 000000000..345cd5824 + } +} diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index fd5f8102a..77ed2d249 100644 +index c605d7e52..f57bd081b 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - } else { - if (iblockdata.c() != iblockdata1.c() || iblockdata.d() != iblockdata1.d()) { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose + + if (iblockdata2.b(this, blockposition) != iblockdata1.b(this, blockposition) || iblockdata2.e() != iblockdata1.e()) { this.methodProfiler.a("checkLight"); -- this.w(blockposition); -+ chunk.runOrQueueLightUpdate(() -> this.w(blockposition)); // Paper - Queue light update - this.methodProfiler.b(); +- this.r(blockposition); ++ chunk.runOrQueueLightUpdate(() -> this.r(blockposition)); // Paper - Queue light update + this.methodProfiler.e(); } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/MC-Dev-fixes.patch b/Spigot-Server-Patches/MC-Dev-fixes.patch index 0dcabebdb3..c4fed2a8c0 100644 --- a/Spigot-Server-Patches/MC-Dev-fixes.patch +++ b/Spigot-Server-Patches/MC-Dev-fixes.patch @@ -4,251 +4,14 @@ Date: Wed, 30 Mar 2016 19:36:20 -0400 Subject: [PATCH] MC Dev fixes -diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java -index d4f412742..d55e180d7 100644 ---- a/src/main/java/net/minecraft/server/BaseBlockPosition.java -+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java -@@ -0,0 +0,0 @@ public class BaseBlockPosition implements Comparable { - return MoreObjects.toStringHelper(this).add("x", this.getX()).add("y", this.getY()).add("z", this.getZ()).toString(); - } +diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java +index e8f7b7292..a0ebc1eaa 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java ++++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java +@@ -0,0 +0,0 @@ public class PaperCommand extends Command { -- public int compareTo(Object object) { -+ public int compareTo(BaseBlockPosition object) { // Paper - decompile fix - return this.l((BaseBlockPosition) object); + Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Paper config reload complete."); } ++ } -diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java -index 62a9c92f8..1b7599769 100644 ---- a/src/main/java/net/minecraft/server/BiomeBase.java -+++ b/src/main/java/net/minecraft/server/BiomeBase.java -@@ -0,0 +0,0 @@ public abstract class BiomeBase { - protected List w; - - public static int a(BiomeBase biomebase) { -- return BiomeBase.REGISTRY_ID.a((Object) biomebase); -+ return BiomeBase.REGISTRY_ID.a(biomebase); // Paper - decompile fix - } - - @Nullable -diff --git a/src/main/java/net/minecraft/server/CommandAbstract.java b/src/main/java/net/minecraft/server/CommandAbstract.java -index 76bf04f56..a99d0f870 100644 ---- a/src/main/java/net/minecraft/server/CommandAbstract.java -+++ b/src/main/java/net/minecraft/server/CommandAbstract.java -@@ -0,0 +0,0 @@ public abstract class CommandAbstract implements ICommand { - } - - if (object != null && oclass.isAssignableFrom(object.getClass())) { -- return (Entity) object; -+ return (T) object; // Paper - fix decompile error - } else { - throw new ExceptionEntityNotFound(s); - } -@@ -0,0 +0,0 @@ public abstract class CommandAbstract implements ICommand { - } - - private static > IBlockData a(IBlockData iblockdata, IBlockState iblockstate, Comparable comparable) { -- return iblockdata.set(iblockstate, comparable); -+ return iblockdata.set(iblockstate, (T) comparable); // Paper - fix decompiler error - } - - public static Predicate b(final Block block, String s) throws ExceptionInvalidBlockState { -@@ -0,0 +0,0 @@ public abstract class CommandAbstract implements ICommand { - - @Nullable - private static > T a(IBlockState iblockstate, String s) { -- return (Comparable) iblockstate.b(s).orNull(); -+ return iblockstate.b(s).orNull(); // Paper - fix decompiler error - } - - public static String a(Object[] aobject) { -@@ -0,0 +0,0 @@ public abstract class CommandAbstract implements ICommand { - return this.getCommand().compareTo(icommand.getCommand()); - } - -- public int compareTo(Object object) { -+ public int compareTo(ICommand object) { // Paper - fix decompile error - return this.a((ICommand) object); - } - -diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index 77b81a575..ba461ad48 100644 ---- a/src/main/java/net/minecraft/server/EntityTypes.java -+++ b/src/main/java/net/minecraft/server/EntityTypes.java -@@ -0,0 +0,0 @@ public class EntityTypes { - - @Nullable - public static String b(Entity entity) { -- int i = EntityTypes.b.a((Object) entity.getClass()); -+ int i = EntityTypes.b.a(entity.getClass()); // Paper - Decompile fix - - return i == -1 ? null : (String) EntityTypes.g.get(i); - } -@@ -0,0 +0,0 @@ public class EntityTypes { - EntityTypes.d.add(minecraftkey); - - while (EntityTypes.g.size() <= i) { -- EntityTypes.g.add((Object) null); -+ EntityTypes.g.add(null); // Paper - Decompile fix - } - - EntityTypes.g.set(i, s1); -diff --git a/src/main/java/net/minecraft/server/LotoSelectorEntry.java b/src/main/java/net/minecraft/server/LotoSelectorEntry.java -index a540167d6..b2860555d 100644 ---- a/src/main/java/net/minecraft/server/LotoSelectorEntry.java -+++ b/src/main/java/net/minecraft/server/LotoSelectorEntry.java -@@ -0,0 +0,0 @@ public abstract class LotoSelectorEntry { - return jsonobject; - } - -- public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) { -+ public JsonElement serialize(LotoSelectorEntry object, Type type, JsonSerializationContext jsonserializationcontext) { - return this.a((LotoSelectorEntry) object, type, jsonserializationcontext); - } - -- public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { -+ public LotoSelectorEntry deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { - return this.a(jsonelement, type, jsondeserializationcontext); - } - } -diff --git a/src/main/java/net/minecraft/server/RegistryBlockID.java b/src/main/java/net/minecraft/server/RegistryBlockID.java -index 58f47d0de..8860a0129 100644 ---- a/src/main/java/net/minecraft/server/RegistryBlockID.java -+++ b/src/main/java/net/minecraft/server/RegistryBlockID.java -@@ -0,0 +0,0 @@ import java.util.Iterator; - import java.util.List; - import javax.annotation.Nullable; - --public class RegistryBlockID implements Registry { -+public class RegistryBlockID implements Registry { // Paper - Fix decompile error - - private final IdentityHashMap a; - private final List b; -@@ -0,0 +0,0 @@ public class RegistryBlockID implements Registry { - this.a.put(t0, Integer.valueOf(i)); - - while (this.b.size() <= i) { -- this.b.add((Object) null); -+ this.b.add(null); // Paper - Fix decompile error - } - - this.b.set(i, t0); -diff --git a/src/main/java/net/minecraft/server/ServerPing.java b/src/main/java/net/minecraft/server/ServerPing.java -index 2179664a0..981582212 100644 ---- a/src/main/java/net/minecraft/server/ServerPing.java -+++ b/src/main/java/net/minecraft/server/ServerPing.java -@@ -0,0 +0,0 @@ public class ServerPing { - - public Serializer() {} - -- public ServerPing a(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { -+ // Paper - decompile fix -+ public ServerPing deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { - JsonObject jsonobject = ChatDeserializer.m(jsonelement, "status"); - ServerPing serverping = new ServerPing(); - -@@ -0,0 +0,0 @@ public class ServerPing { - return serverping; - } - -- public JsonElement a(ServerPing serverping, Type type, JsonSerializationContext jsonserializationcontext) { -+ // Paper - decompile fix -+ public JsonElement serialize(ServerPing serverping, Type type, JsonSerializationContext jsonserializationcontext) { - JsonObject jsonobject = new JsonObject(); - - if (serverping.a() != null) { -@@ -0,0 +0,0 @@ public class ServerPing { - - return jsonobject; - } -- -- public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) { -- return this.a((ServerPing) object, type, jsonserializationcontext); -- } -- -- public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { -- return this.a(jsonelement, type, jsondeserializationcontext); -- } - } - - public static class ServerData { -@@ -0,0 +0,0 @@ public class ServerPing { - - public Serializer() {} - -- public ServerPing.ServerData a(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { -+ // Paper - decompile fix -+ public ServerPing.ServerData deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { - JsonObject jsonobject = ChatDeserializer.m(jsonelement, "version"); - - return new ServerPing.ServerData(ChatDeserializer.h(jsonobject, "name"), ChatDeserializer.n(jsonobject, "protocol")); - } - -- public JsonElement a(ServerPing.ServerData serverping_serverdata, Type type, JsonSerializationContext jsonserializationcontext) { -+ // Paper - decompile fix -+ public JsonElement serialize(ServerPing.ServerData serverping_serverdata, Type type, JsonSerializationContext jsonserializationcontext) { - JsonObject jsonobject = new JsonObject(); - - jsonobject.addProperty("name", serverping_serverdata.a()); - jsonobject.addProperty("protocol", Integer.valueOf(serverping_serverdata.getProtocolVersion())); - return jsonobject; - } -- -- public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) { -- return this.a((ServerPing.ServerData) object, type, jsonserializationcontext); -- } -- -- public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { -- return this.a(jsonelement, type, jsondeserializationcontext); -- } - } - } - -@@ -0,0 +0,0 @@ public class ServerPing { - - public Serializer() {} - -- public ServerPing.ServerPingPlayerSample a(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { -+ // Paper - decompile fix -+ public ServerPing.ServerPingPlayerSample deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { - JsonObject jsonobject = ChatDeserializer.m(jsonelement, "players"); - ServerPing.ServerPingPlayerSample serverping_serverpingplayersample = new ServerPing.ServerPingPlayerSample(ChatDeserializer.n(jsonobject, "max"), ChatDeserializer.n(jsonobject, "online")); - -@@ -0,0 +0,0 @@ public class ServerPing { - return serverping_serverpingplayersample; - } - -- public JsonElement a(ServerPing.ServerPingPlayerSample serverping_serverpingplayersample, Type type, JsonSerializationContext jsonserializationcontext) { -+ // Paper - decompile fix -+ public JsonElement serialize(ServerPing.ServerPingPlayerSample serverping_serverpingplayersample, Type type, JsonSerializationContext jsonserializationcontext) { - JsonObject jsonobject = new JsonObject(); - - jsonobject.addProperty("max", Integer.valueOf(serverping_serverpingplayersample.a())); -@@ -0,0 +0,0 @@ public class ServerPing { - - return jsonobject; - } -- -- public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) { -- return this.a((ServerPing.ServerPingPlayerSample) object, type, jsonserializationcontext); -- } -- -- public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { -- return this.a(jsonelement, type, jsondeserializationcontext); -- } - } - } - } -diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemFactoryTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemFactoryTest.java -index f5bcbdbe1..3190cadfc 100644 ---- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemFactoryTest.java -+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemFactoryTest.java -@@ -0,0 +0,0 @@ public class ItemFactoryTest extends AbstractTestingBase { - - @Test - public void testKnownAttributes() throws Throwable { -- final ZipInputStream nmsZipStream = new ZipInputStream(CommandAbstract.class/* Magic class that isn't imported! */.getProtectionDomain().getCodeSource().getLocation().openStream()); -+ final ZipInputStream nmsZipStream = new ZipInputStream(net.minecraft.server.HttpUtilities.class/* Magic class that isn't imported! */.getProtectionDomain().getCodeSource().getLocation().openStream()); // Paper - final Collection names = new HashSet(); - for (ZipEntry clazzEntry; (clazzEntry = nmsZipStream.getNextEntry()) != null; ) { - final String entryName = clazzEntry.getName(); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/MC-Utils.patch b/Spigot-Server-Patches/MC-Utils.patch index 7eba5b46d4..1ea1b0eac6 100644 --- a/Spigot-Server-Patches/MC-Utils.patch +++ b/Spigot-Server-Patches/MC-Utils.patch @@ -5,20 +5,20 @@ Subject: [PATCH] MC Utils diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 952c96c0c..cbb1f2cae 100644 +index 0ae780c8e..3b97981bc 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -0,0 +0,0 @@ import org.bukkit.Server; // CraftBukkit - public class Chunk { +@@ -0,0 +0,0 @@ import com.google.common.collect.Lists; // CraftBukkit + public class Chunk implements IChunkAccess { private static final Logger e = LogManager.getLogger(); - public static final ChunkSection a = null; + public static final ChunkSection a = null; public static final ChunkSection EMPTY_CHUNK_SECTION = Chunk.a; // Paper - OBFHELPER private final ChunkSection[] sections; - private final byte[] g; - private final int[] h; -@@ -0,0 +0,0 @@ public class Chunk { - return !block.isTileEntity() ? null : ((ITileEntity) block).a(this.world, iblockdata.getBlock().toLegacyData(iblockdata)); + private final BiomeBase[] g; + private final boolean[] h; +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + return this.a(blockposition, Chunk.EnumTileEntityState.CHECK); } + @Nullable public final TileEntity getTileEntityImmediately(BlockPosition pos) { return this.a(pos, EnumTileEntityState.IMMEDIATE); } // Paper - OBFHELPER @@ -26,11 +26,11 @@ index 952c96c0c..cbb1f2cae 100644 public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) { // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -index 239440888..aafd23beb 100644 +index 00a530c51..2947d9ff6 100644 --- a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java +++ b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java @@ -0,0 +0,0 @@ public class ChunkCoordIntPair { - this.z = blockposition.getZ() >> 4; + return a(this.x, this.z); } + public static long asLong(final BlockPosition pos) { return a(pos.getX() >> 4, pos.getZ() >> 4); } // Paper - OBFHELPER @@ -38,46 +38,48 @@ index 239440888..aafd23beb 100644 public static long a(int i, int j) { return (long) i & 4294967295L | ((long) j & 4294967295L) << 32; } -diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index 1f2fe87b6..2cb462b8e 100644 ---- a/src/main/java/net/minecraft/server/DataPaletteBlock.java -+++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; - public class DataPaletteBlock implements DataPaletteExpandable { - - private static final DataPalette d = new DataPaletteGlobal(); -- protected static final IBlockData a = Blocks.AIR.getBlockData(); -+ protected static final IBlockData a = Blocks.AIR.getBlockData(); public static final IBlockData DEFAULT_BLOCK_DATA = DataPaletteBlock.a; // Paper - OBFHELPER - protected DataBits b; - protected DataPalette c; - private int e; diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index ba461ad48..2359b31f4 100644 +index 97cfd6695..05ed0abe7 100644 --- a/src/main/java/net/minecraft/server/EntityTypes.java +++ b/src/main/java/net/minecraft/server/EntityTypes.java -@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; +@@ -0,0 +0,0 @@ package net.minecraft.server; + import com.mojang.datafixers.DataFixUtils; + import com.mojang.datafixers.types.Type; - public class EntityTypes { ++import java.util.Map; + import java.util.Set; + import java.util.UUID; + import java.util.function.Function; +@@ -0,0 +0,0 @@ public class EntityTypes { + public static EntityTypes a(String s, EntityTypes.a entitytypes_a) { + EntityTypes entitytypes = entitytypes_a.a(s); -+ // Paper start +- EntityTypes.REGISTRY.a(new MinecraftKey(s), entitytypes); ++ // Paper start ++ MinecraftKey key = new MinecraftKey(s); ++ Class entityClass = entitytypes_a.getEntityClass(); ++ EntityTypes.REGISTRY.a(key, entitytypes); ++ clsToKeyMap.put(entityClass, key); ++ clsToTypeMap.put(entityClass, org.bukkit.entity.EntityType.fromName(s)); + return entitytypes; + } + public static Map, MinecraftKey> clsToKeyMap = new java.util.HashMap<>(); + public static Map, org.bukkit.entity.EntityType> clsToTypeMap = new java.util.HashMap<>(); + // Paper end -+ - public static final MinecraftKey a = new MinecraftKey("lightning_bolt"); - private static final MinecraftKey e = new MinecraftKey("player"); - private static final Logger f = LogManager.getLogger(); -@@ -0,0 +0,0 @@ public class EntityTypes { - EntityTypes.b.a(i, minecraftkey, oclass); - EntityTypes.d.add(minecraftkey); -+ clsToKeyMap.put(oclass, minecraftkey); // Paper -+ clsToTypeMap.put(oclass, org.bukkit.entity.EntityType.fromName(s)); // Paper + @Nullable + public static MinecraftKey getName(EntityTypes entitytypes) { +@@ -0,0 +0,0 @@ public class EntityTypes { - while (EntityTypes.g.size() <= i) { - EntityTypes.g.add(null); // Paper - Decompile fix + public static class a { + +- private final Class a; ++ private final Class a; public Class getEntityClass() { return a; } // Paper - OBFHELPER + private final Function b; + private boolean c = true; + private boolean d = true; diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 76bfbaa81..82d72ea15 100644 +index cc96294f4..7f249a975 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -0,0 +0,0 @@ import org.bukkit.Location; @@ -89,7 +91,7 @@ index 76bfbaa81..82d72ea15 100644 import org.bukkit.entity.Player; import org.bukkit.event.world.StructureGrowEvent; @@ -0,0 +0,0 @@ public final class ItemStack { - return this.tag != null ? this.tag.getList("ench", 10) : new NBTTagList(); + return this.tag != null ? this.tag.getList("Enchantments", 10) : new NBTTagList(); } + // Paper start - (this is just a good no conflict location) @@ -314,19 +316,19 @@ index 000000000..a4b0901cf + } +} diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java -index aa1ca6d91..e15c23367 100644 +index 7fc9b5ff3..e658816c2 100644 --- a/src/main/java/net/minecraft/server/NBTTagCompound.java +++ b/src/main/java/net/minecraft/server/NBTTagCompound.java -@@ -0,0 +0,0 @@ public class NBTTagCompound extends NBTBase { +@@ -0,0 +0,0 @@ public class NBTTagCompound implements NBTBase { - private static final Logger b = LogManager.getLogger(); - private static final Pattern c = Pattern.compile("[A-Za-z0-9._+-]+"); + private static final Logger f = LogManager.getLogger(); + private static final Pattern g = Pattern.compile("[A-Za-z0-9._+-]+"); - private final Map map = Maps.newHashMap(); + public final Map map = Maps.newHashMap(); // Paper public NBTTagCompound() {} -@@ -0,0 +0,0 @@ public class NBTTagCompound extends NBTBase { +@@ -0,0 +0,0 @@ public class NBTTagCompound implements NBTBase { this.map.put(s, new NBTTagLong(i)); } @@ -340,21 +342,51 @@ index aa1ca6d91..e15c23367 100644 @Nullable public UUID a(String s) { return new UUID(this.getLong(s + "Most"), this.getLong(s + "Least")); +@@ -0,0 +0,0 @@ public class NBTTagCompound implements NBTBase { + return chatcomponenttext; + } + } +- +- public NBTBase clone() { +- return this.clone(); +- } + } diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java -index e0cb6aa6e..bc6383669 100644 +index b3c944d70..e56d4836d 100644 --- a/src/main/java/net/minecraft/server/NBTTagList.java +++ b/src/main/java/net/minecraft/server/NBTTagList.java @@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; - public class NBTTagList extends NBTBase { + public class NBTTagList extends NBTList { - private static final Logger b = LogManager.getLogger(); + private static final Logger f = LogManager.getLogger(); - private List list = Lists.newArrayList(); + public List list = Lists.newArrayList(); // Paper private byte type = 0; public NBTTagList() {} +@@ -0,0 +0,0 @@ public class NBTTagList extends NBTList { + public NBTBase clone() { + return this.c(); + } +- +- public Object remove(int i) { +- return this.remove(i); +- } +- +- public Object set(int i, Object object) { +- return this.set(i, (NBTBase) object); +- } +- +- public Object get(int i) { +- return this.get(i); +- } +- +- public boolean add(Object object) { +- return this.add((NBTBase) object); +- } + } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 8cede938a..cd2d58bfb 100644 +index 3cb868299..227bc857e 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -370,12 +402,4 @@ index 8cede938a..cd2d58bfb 100644 // CraftBukkit start - multithreaded fields private volatile int chatThrottle; private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { - - } - -+ private long getCurrentMillis() { return d(); } // Paper - OBFHELPER - private long d() { - return System.nanoTime() / 1000000L; - } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Only-refresh-abilities-if-needed.patch b/Spigot-Server-Patches/Only-refresh-abilities-if-needed.patch index 1e6efaccda..0f2a54cb90 100644 --- a/Spigot-Server-Patches/Only-refresh-abilities-if-needed.patch +++ b/Spigot-Server-Patches/Only-refresh-abilities-if-needed.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Only refresh abilities if needed diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index a0c86d0e0..e3ad45aa8 100644 +index c67137a80..79223dfa6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/Spigot-Server-Patches/Optimize-Chunk-Access.patch b/Spigot-Server-Patches/Optimize-Chunk-Access.patch index b0b00c29e2..9ddcddad1f 100644 --- a/Spigot-Server-Patches/Optimize-Chunk-Access.patch +++ b/Spigot-Server-Patches/Optimize-Chunk-Access.patch @@ -8,37 +8,31 @@ getChunkAt is called for the same chunk multiple times in a row, often from getT Optimize this look up by using a Last Access cache. -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 4e7e8e5fd..1771a1794 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider { - public final Set unloadQueue = Sets.newHashSet(); - public final ChunkGenerator chunkGenerator; - private final IChunkLoader chunkLoader; -- public final Long2ObjectMap chunks = new Long2ObjectOpenHashMap(8192); -+ // Paper start -+ protected Chunk lastChunkByPos = null; -+ public Long2ObjectOpenHashMap chunks = new Long2ObjectOpenHashMap(8192) { -+ -+ @Override -+ public Chunk get(long key) { -+ if (lastChunkByPos != null && key == lastChunkByPos.chunkKey) { -+ return lastChunkByPos; -+ } -+ return lastChunkByPos = super.get(key); -+ } -+ -+ @Override -+ public Chunk remove(long key) { -+ if (lastChunkByPos != null && key == lastChunkByPos.chunkKey) { -+ lastChunkByPos = null; -+ } -+ return super.remove(key); -+ } -+ }; // CraftBukkit -+ // Paper end - public final WorldServer world; +diff --git a/src/main/java/net/minecraft/server/ChunkMap.java b/src/main/java/net/minecraft/server/ChunkMap.java +index 0c2386f5e..5757aa80f 100644 +--- a/src/main/java/net/minecraft/server/ChunkMap.java ++++ b/src/main/java/net/minecraft/server/ChunkMap.java +@@ -0,0 +0,0 @@ public class ChunkMap extends Long2ObjectOpenHashMap { + } + } - public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, ChunkGenerator chunkgenerator) { ++ // Paper start ++ if (lastChunkByPos != null && i == lastChunkByPos.chunkKey) { ++ lastChunkByPos = null; ++ } + return chunk; + } ++ private Chunk lastChunkByPos = null; // Paper ++ ++ @Override ++ public Chunk get(long l) { ++ if (lastChunkByPos != null && l == lastChunkByPos.chunkKey) { ++ return lastChunkByPos; ++ } ++ return super.get(l); ++ } ++ // Paper end + + public Chunk a(Object object) { + return this.a(((Long) object).longValue()); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Optimize-Pathfinding.patch b/Spigot-Server-Patches/Optimize-Pathfinding.patch index 13ca8f2a31..b367ef6077 100644 --- a/Spigot-Server-Patches/Optimize-Pathfinding.patch +++ b/Spigot-Server-Patches/Optimize-Pathfinding.patch @@ -7,7 +7,7 @@ Prevents pathfinding from spamming failures for things such as arrow attacks. diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -index bfc5769f7..cc44d30b5 100644 +index 9337b9397..1964684ac 100644 --- a/src/main/java/net/minecraft/server/NavigationAbstract.java +++ b/src/main/java/net/minecraft/server/NavigationAbstract.java @@ -0,0 +0,0 @@ public abstract class NavigationAbstract { @@ -41,7 +41,7 @@ index bfc5769f7..cc44d30b5 100644 @@ -0,0 +0,0 @@ public abstract class NavigationAbstract { } - public void p() { + public void r() { + this.pathfindFailures = 0; this.lastFailure = 0; // Paper - Pathfinding optimizations this.c = null; } diff --git a/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch b/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch index bb00159e8b..898662f3e5 100644 --- a/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch +++ b/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimize TileEntity Ticking diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java -index 3b5af473d..631304122 100644 +index de06bd59a..9b54cbfdc 100644 --- a/src/main/java/net/minecraft/server/TileEntityChest.java +++ b/src/main/java/net/minecraft/server/TileEntityChest.java @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity; @@ -16,108 +16,60 @@ index 3b5af473d..631304122 100644 +public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITickable private NonNullList items; - public boolean a; -- public TileEntityChest f; -- public TileEntityChest g; -- public TileEntityChest h; -- public TileEntityChest i; -- public float j; -+ public TileEntityChest f; // Paper - Adjacent Chest Z Neg -+ public TileEntityChest g; // Paper - Adjacent Chest X Pos -+ public TileEntityChest h; // Paper - Adjacent Chest X Neg -+ public TileEntityChest i; // Paper - Adjacent Chest Z Pos -+ public float j; // Paper - lid angle - public float k; -- public int l; -+ public int l; // Paper - Number of viewers - private int q; - private BlockChest.Type r; - + protected float a; @@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityLootable implements ITickable { - } + int k = this.position.getZ(); - public void e() { -+ // Paper - Disable all of this, just in case this does get ticked -+ /* - this.o(); - int i = this.position.getX(); - int j = this.position.getY(); + ++this.k; ++ // Paper start ++ } ++ private void doOpenLogic() { + float f; +- +- if (!this.world.isClientSide && this.f != 0 && (this.k + i + j + k) % 200 == 0) { ++ int i = this.position.getX(); ++ int j = this.position.getY(); ++ int k = this.position.getZ(); ++ if (!this.world.isClientSide && this.f != 0 /*&& (this.k + i + j + k) % 200 == 0*/) { // Paper - comment out tick rate limiter ++ // Paper end + this.f = 0; + f = 5.0F; + List list = this.world.a(EntityHuman.class, new AxisAlignedBB((double) ((float) i - 5.0F), (double) ((float) j - 5.0F), (double) ((float) k - 5.0F), (double) ((float) (i + 1) + 5.0F), (double) ((float) (j + 1) + 5.0F), (double) ((float) (k + 1) + 5.0F))); @@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityLootable implements ITickable { - this.j = 0.0F; } } -- -+ */ + +- this.e = this.a; +- f = 0.1F; + if (this.f > 0 && this.a == 0.0F) { + this.a(SoundEffects.BLOCK_CHEST_OPEN); + } ++ // Paper start ++ } ++ private void doCloseLogic() { ++ this.e = this.a; + // Paper end - } - public boolean c(int i, int j) { + if (this.f == 0 && this.a > 0.0F || this.f > 0 && this.a < 1.0F) { + float f1 = this.a; @@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityLootable implements ITickable { - int oldPower = Math.max(0, Math.min(15, this.l)); // CraftBukkit - Get power before new viewer is added - ++this.l; -+ -+ // Paper start - Move chest open sound out of the tick loop -+ this.o(); -+ -+ if (this.l > 0 && this.j == 0.0F && this.f == null && this.h == null) { -+ this.j = 0.7F; -+ -+ double d0 = (double) this.position.getZ() + 0.5D; -+ double d1 = (double) this.position.getX() + 0.5D; -+ -+ if (this.i != null) { -+ d0 += 0.5D; -+ } -+ -+ if (this.g != null) { -+ d1 += 0.5D; -+ } -+ -+ this.world.a((EntityHuman) null, d1, (double) this.position.getY() + 0.5D, d0, SoundEffects.ac, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); -+ } -+ // Paper end -+ + ++this.f; if (this.world == null) return; // CraftBukkit - this.world.playBlockAction(this.position, this.getBlock(), 1, this.l); ++ doOpenLogic(); // Paper + // CraftBukkit start - Call redstone event + if (this.getBlock() == Blocks.TRAPPED_CHEST) { @@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityLootable implements ITickable { - if (!entityhuman.isSpectator() && this.getBlock() instanceof BlockChest) { - int oldPower = Math.max(0, Math.min(15, this.l)); // CraftBukkit - Get power before new viewer is added - --this.l; -+ -+ // Paper start - Move chest close sound out of the tick loop -+ if (this.l == 0 && this.j > 0.0F || this.l > 0 && this.j < 1.0F) { -+ float f = 0.1F; -+ -+ if (this.l > 0) { -+ this.j += f; -+ } else { -+ this.j -= f; -+ } -+ -+ double d0 = (double) this.getPosition().getX() + 0.5D; -+ double d2 = (double) this.getPosition().getZ() + 0.5D; -+ int yLoc = this.position.getY(); -+ -+ if (this.i != null) { -+ d2 += 0.5D; -+ } -+ -+ if (this.g != null) { -+ d0 += 0.5D; -+ } -+ -+ this.world.a((EntityHuman) null, d0, (double) yLoc + 0.5D, d2, SoundEffects.aa, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); -+ this.j = 0.0F; -+ } -+ // Paper end -+ - this.world.playBlockAction(this.position, this.getBlock(), 1, this.l); - this.world.applyPhysics(this.position, this.getBlock(), false); + --this.f; + + // CraftBukkit start - Call redstone event ++ doCloseLogic(); // Paper + if (this.getBlock() == Blocks.TRAPPED_CHEST) { + int newPower = Math.max(0, Math.min(15, this.f)); diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java -index 31585757b..1c1741c56 100644 +index f275fd1c3..7d7628b04 100644 --- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java +++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java @@ -0,0 +0,0 @@ @@ -126,63 +78,60 @@ index 31585757b..1c1741c56 100644 -public class TileEntityEnderChest extends TileEntity implements ITickable { +public class TileEntityEnderChest extends TileEntity { // Paper - Remove ITickable -- public float a; -+ public float a; // Paper - lid angle - public float f; -- public int g; -+ public int g; // Paper - Number of viewers - private int h; + public float a; + public float e; +@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity implements ITickable { + } - public TileEntityEnderChest() {} - - public void e() { -+ // Paper start - Disable all of this, just in case this does get ticked + this.e = this.a; ++ // Paper start + /* - if (++this.h % 20 * 4 == 0) { - this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); - } -@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity implements ITickable { - this.a = 0.0F; - } - } + int i = this.position.getX(); + int j = this.position.getY(); + int k = this.position.getZ(); + float f = 0.1F; + double d0; +- + */ ++ // Paper start ++ } ++ private void doOpenLogic() { ++ int i = this.position.getX(); ++ int j = this.position.getY(); ++ int k = this.position.getZ(); ++ double d0; + // Paper end + if (this.f > 0 && this.a == 0.0F) { + double d1 = (double) i + 0.5D; - } + d0 = (double) k + 0.5D; + this.world.a((EntityHuman) null, d1, (double) j + 0.5D, d0, SoundEffects.BLOCK_ENDER_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); + } +- ++ // Paper start ++ } ++ private void doCloseLogic() { ++ int i = this.position.getX(); ++ int j = this.position.getY(); ++ int k = this.position.getZ(); ++ this.e = this.a; ++ double d0; ++ // Paper end + if (this.f == 0 && this.a > 0.0F || this.f > 0 && this.a < 1.0F) { + float f1 = this.a; @@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity implements ITickable { - - public void a() { - ++this.g; -+ -+ // Paper start - Move enderchest open sounds out of the tick loop -+ if (this.g > 0 && this.a == 0.0F) { -+ this.a = 0.7F; -+ -+ double d1 = (double) this.getPosition().getX() + 0.5D; -+ double d0 = (double) this.getPosition().getZ() + 0.5D; -+ -+ this.world.a((EntityHuman) null, d1, (double) this.getPosition().getY() + 0.5D, d0, SoundEffects.aT, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); -+ } -+ // Paper end -+ - this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); + public void c() { + ++this.f; + this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.f); ++ doOpenLogic(); // Paper } - public void f() { - --this.g; -+ -+ // Paper start - Move enderchest close sounds out of the tick loop -+ if (this.g == 0 && this.a > 0.0F || this.g > 0 && this.a < 1.0F) { -+ double d0 = (double) this.getPosition().getX() + 0.5D; -+ double d2 = (double) this.getPosition().getZ() + 0.5D; -+ -+ this.world.a((EntityHuman) null, d0, (double) this.getPosition().getY() + 0.5D, d2, SoundEffects.aS, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); -+ this.a = 0.0F; -+ } -+ // Paper end -+ - this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); + public void d() { + --this.f; + this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.f); ++ doCloseLogic(); // Paper } + public boolean a(EntityHuman entityhuman) { -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Optimize-explosions.patch b/Spigot-Server-Patches/Optimize-explosions.patch index 9a83ad3530..602a28512e 100644 --- a/Spigot-Server-Patches/Optimize-explosions.patch +++ b/Spigot-Server-Patches/Optimize-explosions.patch @@ -10,12 +10,12 @@ This patch adds a per-tick cache that is used for storing and retrieving an entity's exposure during an explosion. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 7e5cd8042..15675efbf 100644 +index dccccbf5b..3626aa717 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { - disableExtremeHillsMonsterEggs = getBoolean("generator-settings.disable-extreme-hills-monster-eggs", false); - disableMesaAdditionalGold = getBoolean("generator-settings.disable-mesa-additional-gold", false); + disableEndCredits = getBoolean("game-mechanics.disable-end-credits", false); + log("End credits disabled: " + disableEndCredits); } + + public boolean optimizeExplosions; @@ -25,7 +25,7 @@ index 7e5cd8042..15675efbf 100644 + } } diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index a1ebcf858..e7f0e84d4 100644 +index e30219258..ddbf667c4 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java @@ -0,0 +0,0 @@ public class Explosion { @@ -124,22 +124,22 @@ index a1ebcf858..e7f0e84d4 100644 + // Paper end } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d63a243f3..4e8ce79ff 100644 +index 4473c3b51..1027b0588 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati worldserver.getTracker().updatePlayers(); - this.methodProfiler.b(); - this.methodProfiler.b(); + this.methodProfiler.e(); + this.methodProfiler.e(); + worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions - // } // CraftBukkit + } - // this.i[i][this.ticks % 100] = System.nanoTime() - j; // CraftBukkit + // this.f[i][this.ticks % 100] = SystemUtils.c() - j; // CraftBukkit diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 77ed2d249..fc7315f7d 100644 +index f57bd081b..04493a1f9 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; +@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; // CraftBukkit start import com.google.common.collect.Maps; @@ -147,7 +147,7 @@ index 77ed2d249..fc7315f7d 100644 import java.util.Map; import org.bukkit.Bukkit; import org.bukkit.block.BlockState; -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose private org.spigotmc.TickLimiter entityLimiter; private org.spigotmc.TickLimiter tileLimiter; private int tileTickPosition; diff --git a/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch b/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch index 714491e814..57705d13bb 100644 --- a/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch +++ b/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch @@ -12,7 +12,7 @@ Replace all calls to the new place to the unnecessary forward. Optimize getType and getBlockData to manually inline and optimize the calls diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java -index d55e180d7..679d5504e 100644 +index c3e990bdf..d190144a1 100644 --- a/src/main/java/net/minecraft/server/BaseBlockPosition.java +++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java @@ -0,0 +0,0 @@ public class BaseBlockPosition implements Comparable { @@ -31,7 +31,7 @@ index d55e180d7..679d5504e 100644 public BaseBlockPosition(int i, int j, int k) { this.a = i; diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 67b476b22..008ed206d 100644 +index 002da2a19..0fddd916b 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java @@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition { @@ -52,20 +52,21 @@ index 67b476b22..008ed206d 100644 public MutableBlockPosition() { this(0, 0, 0); diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 57b23a018..bf3b64e37 100644 +index f376b3a34..75fcc693d 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -0,0 +0,0 @@ public class Chunk { - return this.a(i, j, k).c(); +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + return this.getBlockData(i, j, k).b(this.world, new BlockPosition(i, j, k)); } -- public IBlockData getBlockData(BlockPosition blockposition) { -- return this.a(blockposition.getX(), blockposition.getY(), blockposition.getZ()); +- public IBlockData getBlockData(BlockPosition blockposition) { return getType(blockposition); } // Paper + // Paper start - Optimize getBlockData to reduce instructions -+ public final IBlockData getBlockData(final BlockPosition pos) { -+ return getBlockData(pos.getX(), pos.getY(), pos.getZ()); -+ } -+ ++ public IBlockData getBlockData(BlockPosition pos) { return getBlockData(pos.getX(), pos.getY(), pos.getZ()); } // Paper + public IBlockData getType(BlockPosition blockposition) { + return this.getBlockData(blockposition.getX(), blockposition.getY(), blockposition.getZ()); + } + +- public IBlockData getBlockData(int i, int j, int k) { + public final IBlockData getBlockData(final int x, final int y, final int z) { + // Method body / logic copied from below + final int i = y >> 4; @@ -74,183 +75,126 @@ index 57b23a018..bf3b64e37 100644 + return this.sections[i].blockIds.a((y & 15) << 8 | (z & 15) << 4 | x & 15); + } + return Blocks.AIR.getBlockData(); - } - - public IBlockData a(final int i, final int j, final int k) { -+ return getBlockData(i, j, k); + } + -+ public IBlockData unused(final int i, final int j, final int k) { -+ // Paper end - if (this.world.N() == WorldType.DEBUG_ALL_BLOCK_STATES) { ++ public IBlockData getBlockData_unused(int i, int j, int k) { ++ // Paper end + if (this.world.R() == WorldType.DEBUG_ALL_BLOCK_STATES) { IBlockData iblockdata = null; diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 3d784d0dc..afdc4a779 100644 +index 7c6308dbe..880058a9e 100644 --- a/src/main/java/net/minecraft/server/ChunkSection.java +++ b/src/main/java/net/minecraft/server/ChunkSection.java @@ -0,0 +0,0 @@ public class ChunkSection { - private final int yPos; private int nonEmptyBlockCount; private int tickingBlockCount; -- private final DataPaletteBlock blockIds; -+ final DataPaletteBlock blockIds; // Paper - package + private int e; +- private final DataPaletteBlock blockIds; ++ final DataPaletteBlock blockIds; // Paper - package private NibbleArray emittedLight; private NibbleArray skyLight; diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index b8ae41704..8f0a306cc 100644 +index 1c939e523..9e56b046f 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - return this.getType(blockposition1); +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose } -- private boolean isValidLocation(BlockPosition blockposition) { -- return !this.E(blockposition) && blockposition.getX() >= -30000000 && blockposition.getZ() >= -30000000 && blockposition.getX() < 30000000 && blockposition.getZ() < 30000000; -+ private static boolean isValidLocation(BlockPosition blockposition) { // Paper - unused but incase reflection / future uses + public static boolean isValidLocation(BlockPosition blockposition) { +- return !k(blockposition) && blockposition.getX() >= -30000000 && blockposition.getZ() >= -30000000 && blockposition.getX() < 30000000 && blockposition.getZ() < 30000000; + return blockposition.isValidLocation(); // Paper } -- private boolean E(BlockPosition blockposition) { + public static boolean k(BlockPosition blockposition) { - return blockposition.getY() < 0 || blockposition.getY() >= 256; -+ private static boolean E(BlockPosition blockposition) { // Paper - unused but incase reflection / future uses + return blockposition.isInvalidYLocation(); // Paper } public boolean isEmpty(BlockPosition blockposition) { -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - return true; - } - // CraftBukkit end -- if (this.E(blockposition)) { -+ if (blockposition.isInvalidYLocation()) { // Paper - return false; - } else if (!this.isClientSide && this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) { - return false; -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - // Paper start - test if meets light level, return faster +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose + // test if meets light level, return faster // logic copied from below public boolean isLightLevel(BlockPosition blockposition, int level) { - if (isValidLocation(blockposition)) { + if (blockposition.isValidLocation()) { - if (this.getType(blockposition).f()) { - if (this.c(blockposition.up(), false) >= level) { - return true; -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - blockposition = new BlockPosition(blockposition.getX(), 0, blockposition.getZ()); - } - -- if (!this.isValidLocation(blockposition)) { -+ if (!blockposition.isValidLocation()) { // Paper - return enumskyblock.c; - } else if (!this.isLoaded(blockposition)) { - return enumskyblock.c; -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - } - - public void a(EnumSkyBlock enumskyblock, BlockPosition blockposition, int i) { -- if (this.isValidLocation(blockposition)) { -+ if (blockposition.isValidLocation()) { // Paper - if (this.isLoaded(blockposition)) { - Chunk chunk = this.getChunkAtWorldCoords(blockposition); - -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - // Paper start - reduces need to do isLoaded before getType - public IBlockData getTypeIfLoaded(BlockPosition blockposition) { - // CraftBukkit start - tree generation -+ final int x = blockposition.getX(); -+ final int y = blockposition.getY(); -+ final int z = blockposition.getZ(); - if (captureTreeGeneration) { -- Iterator it = capturedBlockStates.iterator(); -- while (it.hasNext()) { -- BlockState previous = it.next(); -- if (previous.getX() == blockposition.getX() && previous.getY() == blockposition.getY() && previous.getZ() == blockposition.getZ()) { -- return CraftMagicNumbers.getBlock(previous.getTypeId()).fromLegacyData(previous.getRawData()); -- } -+ final IBlockData previous = getCapturedBlockType(x, y, z); -+ if (previous != null) { -+ return previous; - } - } + if (this.getType(blockposition).c(this, blockposition)) { + int sky = getSkylightSubtracted(); + if (this.getLightLevel(blockposition.up(), sky) >= level) { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose // CraftBukkit end -- Chunk chunk = this.getChunkIfLoaded(blockposition); -+ Chunk chunk = ((ChunkProviderServer) this.chunkProvider).getChunkIfLoaded(x >> 4, z >> 4); + Chunk chunk = this.getChunkIfLoaded(blockposition); if (chunk != null) { -- return this.isValidLocation(blockposition) ? chunk.getBlockData(blockposition) : Blocks.AIR.getBlockData(); -+ return chunk.getBlockData(x, y, z); +- return isValidLocation(blockposition) ? chunk.getBlockData(blockposition) : Blocks.AIR.getBlockData(); ++ return blockposition.isValidLocation() ? chunk.getBlockData(blockposition) : Blocks.AIR.getBlockData(); // Paper } return null; } -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose + return true; + } + // CraftBukkit end +- if (k(blockposition)) { ++ if (blockposition.isInvalidYLocation()) { // Paper + return false; + } else if (!this.isClientSide && this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) { + return false; +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose + blockposition = new BlockPosition(blockposition.getX(), 0, blockposition.getZ()); + } - public IBlockData getType(BlockPosition blockposition) { - // CraftBukkit start - tree generation -+ // Paper start - optimize getType lookup to reduce instructions - getBlockData already enforces valid Y, move tree out -+ final int x = blockposition.getX(); -+ final int y = blockposition.getY(); -+ final int z = blockposition.getZ(); - if (captureTreeGeneration) { -- Iterator it = capturedBlockStates.iterator(); -- while (it.hasNext()) { -- BlockState previous = it.next(); -- if (previous.getX() == blockposition.getX() && previous.getY() == blockposition.getY() && previous.getZ() == blockposition.getZ()) { -- return CraftMagicNumbers.getBlock(previous.getTypeId()).fromLegacyData(previous.getRawData()); -- } -+ final IBlockData previous = getCapturedBlockType(x, y, z); -+ if (previous != null) { -+ return previous; +- return !isValidLocation(blockposition) ? enumskyblock.c : (!this.isLoaded(blockposition) ? enumskyblock.c : this.getChunkAtWorldCoords(blockposition).getBrightness(enumskyblock, blockposition)); ++ return !blockposition.isValidLocation() ? enumskyblock.c : (!this.isLoaded(blockposition) ? enumskyblock.c : this.getChunkAtWorldCoords(blockposition).getBrightness(enumskyblock, blockposition)); // Paper + } + + public void a(EnumSkyBlock enumskyblock, BlockPosition blockposition, int i) { +- if (isValidLocation(blockposition)) { ++ if (blockposition.isValidLocation()) { // Paper + if (this.isLoaded(blockposition)) { + this.getChunkAtWorldCoords(blockposition).a(enumskyblock, blockposition, i); + this.m(blockposition); +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose } } // CraftBukkit end -- if (this.E(blockposition)) { -- return Blocks.AIR.getBlockData(); -- } else { -- Chunk chunk = this.getChunkAtWorldCoords(blockposition); -+ return this.chunkProvider.getChunkAt(x >> 4, z >> 4).getBlockData(x, y, z); -+ // Paper end -+ } - -- return chunk.getBlockData(blockposition); -+ // Paper start -+ private IBlockData getCapturedBlockType(int x, int y, int z) { -+ Iterator it = capturedBlockStates.iterator(); -+ while (it.hasNext()) { -+ BlockState previous = it.next(); -+ if (previous.getX() == x && previous.getY() == y && previous.getZ() == z) { -+ return CraftMagicNumbers.getBlock(previous.getTypeId()).fromLegacyData(previous.getRawData()); -+ } - } -+ return null; +- if (k(blockposition)) { ++ if (blockposition.isInvalidYLocation()) { // Paper + return Blocks.VOID_AIR.getBlockData(); + } else { + Chunk chunk = this.getChunkAtWorldCoords(blockposition); +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose } -+ // Paper end - public boolean D() { - return this.L < 4; -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + public Fluid b(BlockPosition blockposition) { +- if (k(blockposition)) { ++ if (blockposition.isInvalidYLocation()) { // Paper + return FluidTypes.a.i(); + } else { + Chunk chunk = this.getChunkAtWorldCoords(blockposition); +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose public Map capturedTileEntities = Maps.newHashMap(); @Nullable public TileEntity getTileEntity(BlockPosition blockposition) { -- if (this.E(blockposition)) { +- if (k(blockposition)) { + if (blockposition.isInvalidYLocation()) { // Paper return null; } else { // CraftBukkit start -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose } public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) { -- if (!this.E(blockposition)) { -+ if (!blockposition.isInvalidYLocation()) { - if (tileentity != null && !tileentity.y()) { - // CraftBukkit start - if (captureBlockStates) { -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +- if (!k(blockposition)) { ++ if (!blockposition.isInvalidYLocation()) { // Paper + if (tileentity != null && !tileentity.x()) { + // CraftBukkit start + if (captureBlockStates) { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose } - public boolean d(BlockPosition blockposition, boolean flag) { -- if (this.E(blockposition)) { + public boolean p(BlockPosition blockposition) { +- if (k(blockposition)) { + if (blockposition.isInvalidYLocation()) { // Paper return false; } else { diff --git a/Spigot-Server-Patches/Optimized-Light-Level-Comparisons.patch b/Spigot-Server-Patches/Optimized-Light-Level-Comparisons.patch index 652ae6c82c..0a3a4efae5 100644 --- a/Spigot-Server-Patches/Optimized-Light-Level-Comparisons.patch +++ b/Spigot-Server-Patches/Optimized-Light-Level-Comparisons.patch @@ -8,117 +8,72 @@ Use an optimized method to test if a block position meets a desired light level. This method benefits from returning as soon as the desired light level matches. diff --git a/src/main/java/net/minecraft/server/BlockCrops.java b/src/main/java/net/minecraft/server/BlockCrops.java -index c0b88580c..55ed0c956 100644 +index e64b6dbda..8acfe9e66 100644 --- a/src/main/java/net/minecraft/server/BlockCrops.java +++ b/src/main/java/net/minecraft/server/BlockCrops.java @@ -0,0 +0,0 @@ public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement - public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { - super.b(world, blockposition, iblockdata, random); -- if (world.getLightLevel(blockposition.up()) >= 9) { + public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) { + super.a(iblockdata, world, blockposition, random); +- if (world.getLightLevel(blockposition.up(), 0) >= 9) { + if (world.isLightLevel(blockposition.up(), 9)) { // Paper - int i = this.y(iblockdata); + int i = this.j(iblockdata); - if (i < this.g()) { -diff --git a/src/main/java/net/minecraft/server/BlockGrass.java b/src/main/java/net/minecraft/server/BlockGrass.java -index fe55848be..8fc736d6a 100644 ---- a/src/main/java/net/minecraft/server/BlockGrass.java -+++ b/src/main/java/net/minecraft/server/BlockGrass.java -@@ -0,0 +0,0 @@ public class BlockGrass extends Block implements IBlockFragilePlantElement { - - public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { - if (!world.isClientSide) { -- if (world.getLightLevel(blockposition.up()) < 4 && world.getType(blockposition.up()).c() > 2) { -+ int lightLevel = -1; // Paper -+ if (world.getType(blockposition.up()).c() > 2 && (lightLevel = world.getLightLevel(blockposition.up())) < 4) { // Paper - move light check to end to avoid unneeded light lookups - // CraftBukkit start - // world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData()); - org.bukkit.World bworld = world.getWorld(); -@@ -0,0 +0,0 @@ public class BlockGrass extends Block implements IBlockFragilePlantElement { - } - // CraftBukkit end - } else { -- if (world.getLightLevel(blockposition.up()) >= 9) { -+ // Paper start -+ // If light was calculated above, reuse it, else grab it -+ if (lightLevel == -1) { -+ lightLevel = world.getLightLevel(blockposition.up()); -+ } -+ if (lightLevel >= 9) { -+ // Paper end - for (int i = 0; i < 4; ++i) { - BlockPosition blockposition1 = blockposition.a(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1); - -- if (blockposition1.getY() >= 0 && blockposition1.getY() < 256 && !world.isLoaded(blockposition1)) { -+ IBlockData iblockdata2 = world.getTypeIfLoaded(blockposition1); // Paper - moved up -+ if (iblockdata2 == null) { // Paper - return; - } - - IBlockData iblockdata1 = world.getType(blockposition1.up()); -- IBlockData iblockdata2 = world.getType(blockposition1); -+ //IBlockData iblockdata2 = world.getTypeIfLoaded(blockposition1); // Paper - moved up - -- if (iblockdata2.getBlock() == Blocks.DIRT && iblockdata2.get(BlockDirt.VARIANT) == BlockDirt.EnumDirtVariant.DIRT && world.getLightLevel(blockposition1.up()) >= 4 && iblockdata1.c() <= 2) { -+ if (iblockdata2.getBlock() == Blocks.DIRT && iblockdata2.get(BlockDirt.VARIANT) == BlockDirt.EnumDirtVariant.DIRT && iblockdata1.c() <= 2 && world.isLightLevel(blockposition1.up(), 4)) { // Paper - move last check before isLightLevel to avoid unneeded light checks - // CraftBukkit start - // world.setTypeUpdate(blockposition1, Blocks.GRASS.getBlockData()); - org.bukkit.World bworld = world.getWorld(); + if (i < this.d()) { diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java -index 6d0f4c156..3bbb123bc 100644 +index 723e5c9b4..e24fb1736 100644 --- a/src/main/java/net/minecraft/server/BlockSapling.java +++ b/src/main/java/net/minecraft/server/BlockSapling.java @@ -0,0 +0,0 @@ public class BlockSapling extends BlockPlant implements IBlockFragilePlantElemen - public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { - if (!world.isClientSide) { - super.b(world, blockposition, iblockdata, random); -- if (world.getLightLevel(blockposition.up()) >= 9 && random.nextInt(Math.max(2, (int) (((100.0F / world.spigotConfig.saplingModifier) * 7) + 0.5F))) == 0) { // Spigot -+ if (world.isLightLevel(blockposition.up(), 9) && random.nextInt(Math.max(2, (int) (((100.0F / world.spigotConfig.saplingModifier) * 7) + 0.5F))) == 0) { // Spigot // Paper - // CraftBukkit start - world.captureTreeGeneration = true; - // CraftBukkit end + + public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) { + super.a(iblockdata, world, blockposition, random); +- if (world.getLightLevel(blockposition.up()) >= 9 && random.nextInt(Math.max(2, (int) (((100.0F / world.spigotConfig.saplingModifier) * 7) + 0.5F))) == 0) { // Spigot ++ if (world.isLightLevel(blockposition.up(), 9) && random.nextInt(Math.max(2, (int) (((100.0F / world.spigotConfig.saplingModifier) * 7) + 0.5F))) == 0) { // Spigot // Paper + // CraftBukkit start + world.captureTreeGeneration = true; + // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/BlockStem.java b/src/main/java/net/minecraft/server/BlockStem.java -index f12987c84..5ae7bd9df 100644 +index 3959e0700..c4aff522b 100644 --- a/src/main/java/net/minecraft/server/BlockStem.java +++ b/src/main/java/net/minecraft/server/BlockStem.java @@ -0,0 +0,0 @@ public class BlockStem extends BlockPlant implements IBlockFragilePlantElement { - public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { - super.b(world, blockposition, iblockdata, random); -- if (world.getLightLevel(blockposition.up()) >= 9) { + public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) { + super.a(iblockdata, world, blockposition, random); +- if (world.getLightLevel(blockposition.up(), 0) >= 9) { + if (world.isLightLevel(blockposition.up(), 9)) { // Paper - float f = BlockCrops.a((Block) this, world, blockposition); + float f = BlockCrops.a((Block) this, (IBlockAccess) world, blockposition); if (random.nextInt((int) ((100.0F / (this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier)) * (25.0F / f)) + 1) == 0) { // Spigot diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java -index 0f55cf515..8782bce56 100644 +index bef146aa9..9c387365b 100644 --- a/src/main/java/net/minecraft/server/EntityMonster.java +++ b/src/main/java/net/minecraft/server/EntityMonster.java @@ -0,0 +0,0 @@ public abstract class EntityMonster extends EntityCreature implements IMonster { if (this.world.getBrightness(EnumSkyBlock.SKY, blockposition) > this.random.nextInt(32)) { return false; } else { -- int i = this.world.getLightLevel(blockposition); +- int i = this.world.X() ? this.world.d(blockposition, 10) : this.world.getLightLevel(blockposition); - -+ //int i = this.world.getLightLevel(blockposition); // Paper -+ boolean passes; // Paper - if (this.world.X()) { - int j = this.world.ah(); - - this.world.c(10); -- i = this.world.getLightLevel(blockposition); -+ passes = !world.isLightLevel(blockposition, this.random.nextInt(9)); // Paper - this.world.c(j); -- } -+ } else { passes = !world.isLightLevel(blockposition, this.random.nextInt(9)); } // Paper - - return i <= this.random.nextInt(8); -+ return passes; // Paper ++ // Paper start - optimized light check, returns faster ++ boolean passes; ++ if (this.world.X()) { ++ int orig = world.getSkylightSubtracted(); ++ world.setSkylightSubtracted(10); ++ passes = !this.world.isLightLevel(blockposition, this.random.nextInt(8)); ++ world.setSkylightSubtracted(orig); ++ } else { ++ passes = !this.world.isLightLevel(blockposition, this.random.nextInt(8)); ++ } ++ return passes; ++ // Paper end } } diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index 277f1414a..6111ca0b2 100644 +index 268e4d57b..24224efc6 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { @@ -128,6 +83,6 @@ index 277f1414a..6111ca0b2 100644 - if (this.world.getType(new BlockPosition(i1, j1 - 1, k1)).q() && this.world.getLightLevel(new BlockPosition(i1, j1, k1)) < 10) { + if (this.world.getType(new BlockPosition(i1, j1 - 1, k1)).q() && !this.world.isLightLevel(new BlockPosition(i1, j1, k1), 10)) { // Paper entityzombie.setPosition((double) i1, (double) j1, (double) k1); - if (!this.world.isPlayerNearby((double) i1, (double) j1, (double) k1, 7.0D) && this.world.a(entityzombie.getBoundingBox(), (Entity) entityzombie) && this.world.getCubes(entityzombie, entityzombie.getBoundingBox()).isEmpty() && !this.world.containsLiquid(entityzombie.getBoundingBox())) { + if (!this.world.isPlayerNearby((double) i1, (double) j1, (double) k1, 7.0D) && this.world.b((Entity) entityzombie, entityzombie.getBoundingBox()) && this.world.getCubes(entityzombie, entityzombie.getBoundingBox()) && !this.world.containsLiquid(entityzombie.getBoundingBox())) { this.world.addEntity(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Option-to-disable-BlockPhysicsEvent-for-Redstone.patch b/Spigot-Server-Patches/Option-to-disable-BlockPhysicsEvent-for-Redstone.patch index 719866b0dd..a509cb5bb2 100644 --- a/Spigot-Server-Patches/Option-to-disable-BlockPhysicsEvent-for-Redstone.patch +++ b/Spigot-Server-Patches/Option-to-disable-BlockPhysicsEvent-for-Redstone.patch @@ -11,7 +11,7 @@ Defaulting this to false will provide substantial performance improvement by saving millions of event calls on redstone heavy servers. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 38d664e00..e634c3afd 100644 +index 9f586774d..1c2209270 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -25,20 +25,20 @@ index 38d664e00..e634c3afd 100644 + } } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 8f0a306cc..74ae80646 100644 +index 9e56b046f..c9d0c22d5 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose try { // CraftBukkit start CraftWorld world = ((WorldServer) this).getWorld(); - if (world != null) { + if (world != null && !((WorldServer)this).stopPhysicsEvent) { // Paper - BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftMagicNumbers.getId(block)); + BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata)); this.getServer().getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 96792300c..ebe397116 100644 +index 88868b4c4..e3d62fc9c 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ import org.bukkit.event.weather.LightningStrikeEvent; @@ -50,20 +50,11 @@ index 96792300c..ebe397116 100644 public EntityTracker tracker; private final PlayerChunkMap manager; @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { + IBlockData iblockdata = this.getType(nextticklistentry.a); - if (iblockdata.getMaterial() != Material.AIR && Block.a(iblockdata.getBlock(), nextticklistentry.a())) { - try { -+ stopPhysicsEvent = !paperConfig.firePhysicsEventForRedstone && (iblockdata.getBlock() instanceof BlockDiodeAbstract || iblockdata.getBlock() instanceof BlockRedstoneTorch); // Paper - iblockdata.getBlock().b((World) this, nextticklistentry.a, iblockdata, this.random); - } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.a(throwable, "Exception while ticking a block"); -@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { + if (iblockdata.getBlock() == nextticklistentry.a()) { ++ stopPhysicsEvent = !paperConfig.firePhysicsEventForRedstone && (iblockdata.getBlock() instanceof BlockDiodeAbstract || iblockdata.getBlock() instanceof BlockRedstoneTorch); // Paper + iblockdata.a((World) this, nextticklistentry.a, this.random); + } - CrashReportSystemDetails.a(crashreportsystemdetails, nextticklistentry.a, iblockdata); - throw new ReportedException(crashreport); -- } -+ } finally { stopPhysicsEvent = false; } // Paper - } - timing.stopTiming(); // Paper - } else { -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch b/Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch index 3f6db273fb..53a7262a99 100644 --- a/Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch +++ b/Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Option to use vanilla per-world scoreboard coloring on names diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index abc1aabdd..6ea608ba9 100644 +index 6ac58e5ec..ff9929a05 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -19,19 +19,19 @@ index abc1aabdd..6ea608ba9 100644 + } } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index e2202ed0c..88faa4601 100644 +index c37c46e71..fecf29710 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke return this.getFlag(5); } + @Nullable public ScoreboardTeamBase getTeam() { return this.aY(); } // Paper - OBFHELPER @Nullable - public ScoreboardTeamBase aY() { + public ScoreboardTeamBase be() { if (!this.world.paperConfig.nonPlayerEntitiesOnScoreboards && !(this instanceof EntityHuman)) { return null; } // Paper diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index ba1cc267e..2b8162917 100644 +index 553011d88..d61ce6461 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { diff --git a/Spigot-Server-Patches/POM-Changes.patch b/Spigot-Server-Patches/POM-Changes.patch index ca5aa921c8..bbdcd0100a 100644 --- a/Spigot-Server-Patches/POM-Changes.patch +++ b/Spigot-Server-Patches/POM-Changes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] POM Changes diff --git a/pom.xml b/pom.xml -index 1278c628e..4abf8dde7 100644 +index 958eb763a..17bc80776 100644 --- a/pom.xml +++ b/pom.xml @@ -0,0 +0,0 @@ @@ -17,7 +17,7 @@ index 1278c628e..4abf8dde7 100644 + com.destroystokyo.paper + paper jar - 1.12.2-R0.1-SNAPSHOT + 1.13-pre7-R0.1-SNAPSHOT - Spigot - http://www.spigotmc.org + Paper @@ -36,9 +36,8 @@ index 1278c628e..4abf8dde7 100644 dev-SNAPSHOT ../pom.xml -@@ -0,0 +0,0 @@ - compile - + + - org.spigotmc - spigot-api @@ -95,7 +94,7 @@ index 1278c628e..4abf8dde7 100644 @@ -0,0 +0,0 @@ maven-jar-plugin - 3.0.2 + 2.4 + true diff --git a/Spigot-Server-Patches/Paper-Metrics.patch b/Spigot-Server-Patches/Paper-Metrics.patch index 02a6b142f3..821ba72184 100644 --- a/Spigot-Server-Patches/Paper-Metrics.patch +++ b/Spigot-Server-Patches/Paper-Metrics.patch @@ -671,7 +671,7 @@ index 3d8ee9ed3..5ab2cf6ee 100644 static void readConfig(Class clazz, Object instance) { diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 1b5158c0d..9ce3e1365 100644 +index ac36ea08e..09100408e 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -0,0 +0,0 @@ public class SpigotConfig diff --git a/Spigot-Server-Patches/Paper-config-files.patch b/Spigot-Server-Patches/Paper-config-files.patch index d9df18702a..ac1e7a0821 100644 --- a/Spigot-Server-Patches/Paper-config-files.patch +++ b/Spigot-Server-Patches/Paper-config-files.patch @@ -6,12 +6,15 @@ Subject: [PATCH] Paper config files diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java new file mode 100644 -index 00000000..ecd1c65a +index 000000000..e8f7b7292 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -0,0 +0,0 @@ +package com.destroystokyo.paper; + ++import com.google.common.base.Functions; ++import com.google.common.collect.Iterables; ++import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import net.minecraft.server.*; +import org.apache.commons.lang3.tuple.MutablePair; @@ -44,20 +47,61 @@ index 00000000..ecd1c65a + @Override + public List tabComplete(CommandSender sender, String alias, String[] args, Location location) throws IllegalArgumentException { + if (args.length <= 1) -+ return CommandAbstract.getListMatchingLast(args, "heap", "entity", "reload", "version"); ++ return getListMatchingLast(args, "heap", "entity", "reload", "version"); + + switch (args[0].toLowerCase(Locale.ENGLISH)) + { + case "entity": + if (args.length == 2) -+ return CommandAbstract.getListMatchingLast(args, "help", "list"); ++ return getListMatchingLast(args, "help", "list"); + if (args.length == 3) -+ return CommandAbstract.getListMatchingLast(args, EntityTypes.getEntityNameList().stream().map(MinecraftKey::toString).sorted().toArray(String[]::new)); ++ return getListMatchingLast(args, EntityTypes.getEntityNameList().stream().map(MinecraftKey::toString).sorted().toArray(String[]::new)); + break; + } + return Collections.emptyList(); + } + ++ // Code from Mojang - copyright them ++ public static List getListMatchingLast(String[] args, String... matches) { ++ return getListMatchingLast(args, (Collection) Arrays.asList(matches)); ++ } ++ ++ public static boolean matches(String s, String s1) { ++ return s1.regionMatches(true, 0, s, 0, s.length()); ++ } ++ ++ public static List getListMatchingLast(String[] strings, Collection collection) { ++ String last = strings[strings.length - 1]; ++ ArrayList results = Lists.newArrayList(); ++ ++ if (!collection.isEmpty()) { ++ Iterator iterator = Iterables.transform(collection, Functions.toStringFunction()).iterator(); ++ ++ while (iterator.hasNext()) { ++ String s1 = (String) iterator.next(); ++ ++ if (matches(last, s1)) { ++ results.add(s1); ++ } ++ } ++ ++ if (results.isEmpty()) { ++ iterator = collection.iterator(); ++ ++ while (iterator.hasNext()) { ++ Object object = iterator.next(); ++ ++ if (object instanceof MinecraftKey && matches(last, ((MinecraftKey) object).getKey())) { ++ results.add(String.valueOf(object)); ++ } ++ } ++ } ++ } ++ ++ return results; ++ } ++ // end copy stuff ++ + @Override + public boolean execute(CommandSender sender, String commandLabel, String[] args) { + if (!testPermission(sender)) return true; @@ -139,7 +183,7 @@ index 00000000..ecd1c65a + + List entities = world.entityList; + entities.forEach(e -> { -+ MinecraftKey key = EntityTypes.getKey(e); ++ MinecraftKey key = new MinecraftKey(""); // TODO: update in next patch + + MutablePair> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap())); + ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ()); @@ -205,7 +249,7 @@ index 00000000..ecd1c65a +} diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java new file mode 100644 -index 00000000..3d8ee9ed +index 000000000..3d8ee9ed3 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -0,0 +0,0 @@ @@ -384,7 +428,7 @@ index 00000000..3d8ee9ed +} diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java new file mode 100644 -index 00000000..621bf705 +index 000000000..621bf7051 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ @@ -454,20 +498,8 @@ index 00000000..621bf705 + return config.getString("world-settings." + worldName + "." + path, config.getString("world-settings.default." + path)); + } +} -diff --git a/src/main/java/net/minecraft/server/CommandAbstract.java b/src/main/java/net/minecraft/server/CommandAbstract.java -index 76501e29..76bf04f5 100644 ---- a/src/main/java/net/minecraft/server/CommandAbstract.java -+++ b/src/main/java/net/minecraft/server/CommandAbstract.java -@@ -0,0 +0,0 @@ public abstract class CommandAbstract implements ICommand { - return s1.regionMatches(true, 0, s, 0, s.length()); - } - -+ public static List getListMatchingLast(String[] args, String... matches) { return a(args, matches); } // Paper - OBFHELPER - public static List a(String[] astring, String... astring1) { - return a(astring, (Collection) Arrays.asList(astring1)); - } diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 8c5361d6..e1cb96a8 100644 +index 8563712d9..9155aa727 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer @@ -482,47 +514,51 @@ index 8c5361d6..e1cb96a8 100644 DedicatedServer.LOGGER.info("Generating keypair"); this.a(MinecraftEncryption.b()); diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index b944be5c..40f06c5b 100644 +index 015959b9f..f3f8b65be 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { - private static final DataWatcherObject aD = DataWatcher.a(Entity.class, DataWatcherRegistry.h); - private static final DataWatcherObject aE = DataWatcher.a(Entity.class, DataWatcherRegistry.h); - public boolean aa; -- public int ab; -- public int ac; -- public int ad; -+ public int ab; public int getChunkX() { return ab; } // Paper - OBFHELPER -+ public int ac; public int getChunkY() { return ac; } // Paper - OBFHELPER -+ public int ad; public int getChunkZ() { return ad; } // Paper - OBFHELPER - public boolean ah; +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener { + private static final DataWatcherObject aG = DataWatcher.a(Entity.class, DataWatcherRegistry.i); + private static final DataWatcherObject aH = DataWatcher.a(Entity.class, DataWatcherRegistry.i); + public boolean inChunk; +- public int ae; +- public int af; +- public int ag; ++ public int ae; public int getChunkX() { return ae; } // Paper - OBFHELPER ++ public int af; public int getChunkY() { return af; } // Paper - OBFHELPER ++ public int ag; public int getChunkZ() { return ag; } // Paper - OBFHELPER + public boolean ak; public boolean impulse; public int portalCooldown; diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index eb6a955e..77b81a57 100644 +index a0c701f35..557a3f97f 100644 --- a/src/main/java/net/minecraft/server/EntityTypes.java +++ b/src/main/java/net/minecraft/server/EntityTypes.java -@@ -0,0 +0,0 @@ public class EntityTypes { - public static final Set d = Sets.newHashSet(); - private static final List g = Lists.newArrayList(); +@@ -0,0 +0,0 @@ package net.minecraft.server; -+ @Nullable public static MinecraftKey getKey(Entity entity) { return a(entity); } // Paper - OBFHELPER - @Nullable - public static MinecraftKey a(Entity entity) { - return getName(entity.getClass()); -@@ -0,0 +0,0 @@ public class EntityTypes { - return entity; - } - -+ public static Set getEntityNameList() { return a(); } // Paper - OBFHELPER - public static Set a() { - return EntityTypes.d; + import com.mojang.datafixers.DataFixUtils; + import com.mojang.datafixers.types.Type; ++ ++import java.util.Set; + import java.util.UUID; + import java.util.function.Function; + import javax.annotation.Nullable; +@@ -0,0 +0,0 @@ public class EntityTypes { + return new EntityTypes(this.a, this.b, this.c, this.d, type); + } } ++ ++ // Paper start ++ public static Set getEntityNameList() { ++ return REGISTRY.keySet(); ++ } ++ // Paper end + } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 740633d9..843320ff 100644 +index c7f5cba2d..330ea4e72 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose private int tickPosition; public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot @@ -531,7 +567,7 @@ index 740633d9..843320ff 100644 public final SpigotTimings.WorldTimingsHandler timings; // Spigot private boolean guardEntityList; // Spigot public static boolean haveWeSilencedAPhysicsCrash; -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) { this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot @@ -540,7 +576,7 @@ index 740633d9..843320ff 100644 this.world = new CraftWorld((WorldServer) this, gen, env); this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 0d320baa..b2bbccb5 100644 +index 8b118e81e..dad2dc959 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { @@ -565,8 +601,8 @@ index 0d320baa..b2bbccb5 100644 org.spigotmc.SpigotConfig.registerCommands(); // Spigot + com.destroystokyo.paper.PaperConfig.registerCommands(); // Paper overrideAllCommandBlockCommands = commandsConfiguration.getStringList("command-block-overrides").contains("*"); + ignoreVanillaPermissions = commandsConfiguration.getBoolean("ignore-vanilla-permissions"); - int pollCount = 0; @@ -0,0 +0,0 @@ public final class CraftServer implements Server { { return spigot; @@ -595,7 +631,7 @@ index 0d320baa..b2bbccb5 100644 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index a151451d..0c5862a3 100644 +index c234b8749..5e49bca8a 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -0,0 +0,0 @@ public class Main { @@ -614,7 +650,7 @@ index a151451d..0c5862a3 100644 }; diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 01e73eb8..0b66f5e3 100644 +index 9128f7754..7b1a9a8a0 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -0,0 +0,0 @@ public class SpigotWorldConfig diff --git a/Spigot-Server-Patches/Pass-world-to-Village-creation.patch b/Spigot-Server-Patches/Pass-world-to-Village-creation.patch index f1d62c0e77..4f9b745e59 100644 --- a/Spigot-Server-Patches/Pass-world-to-Village-creation.patch +++ b/Spigot-Server-Patches/Pass-world-to-Village-creation.patch @@ -6,20 +6,20 @@ Subject: [PATCH] Pass world to Village creation fixes NPE bug #95 diff --git a/src/main/java/net/minecraft/server/PersistentVillage.java b/src/main/java/net/minecraft/server/PersistentVillage.java -index a5b79ecad..01f7cee38 100644 +index c09326636..3219ccca4 100644 --- a/src/main/java/net/minecraft/server/PersistentVillage.java +++ b/src/main/java/net/minecraft/server/PersistentVillage.java @@ -0,0 +0,0 @@ public class PersistentVillage extends PersistentBase { for (int i = 0; i < nbttaglist.size(); ++i) { - NBTTagCompound nbttagcompound1 = nbttaglist.get(i); + NBTTagCompound nbttagcompound1 = nbttaglist.getCompound(i); - Village village = new Village(); + Village village = new Village(world); // Paper village.a(nbttagcompound1); this.villages.add(village); diff --git a/src/main/java/net/minecraft/server/Village.java b/src/main/java/net/minecraft/server/Village.java -index fb52785b9..2eb33a986 100644 +index e742cbe12..dfcabb83a 100644 --- a/src/main/java/net/minecraft/server/Village.java +++ b/src/main/java/net/minecraft/server/Village.java @@ -0,0 +0,0 @@ public class Village { diff --git a/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch b/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch index a0686648bf..5abe8add16 100644 --- a/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch +++ b/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch @@ -40,7 +40,7 @@ index 0663b07ca..f5ef1ba31 100644 public void a(PacketListenerPlayOut packetlistenerplayout) { diff --git a/src/main/java/net/minecraft/server/PacketPlayOutTitle.java b/src/main/java/net/minecraft/server/PacketPlayOutTitle.java -index 7bcafa8bb..4f6c1c2e7 100644 +index 7b18c1640..900bd8357 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutTitle.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutTitle.java @@ -0,0 +0,0 @@ public class PacketPlayOutTitle implements Packet { @@ -78,7 +78,7 @@ index 7bcafa8bb..4f6c1c2e7 100644 if (this.a == PacketPlayOutTitle.EnumTitleAction.TIMES) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index b2b707305..c14100ac6 100644 +index bb3a48e57..18f68b925 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ diff --git a/Spigot-Server-Patches/Player-affects-spawning-API.patch b/Spigot-Server-Patches/Player-affects-spawning-API.patch index 8c7335cc86..22bcadc2e2 100644 --- a/Spigot-Server-Patches/Player-affects-spawning-API.patch +++ b/Spigot-Server-Patches/Player-affects-spawning-API.patch @@ -5,19 +5,21 @@ Subject: [PATCH] Player affects spawning API diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index c374efd79..467c5bf1a 100644 +index 40efd6c60..1aa32bf11 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { - private final ItemCooldown bW; + private final ItemCooldown ce; @Nullable public EntityFishingHook hookedFish; ++ // Paper start + public boolean affectsSpawning = true; ++ // Paper end // CraftBukkit start public boolean fauxSleeping; diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 94967e6b6..5ea9f3097 100644 +index c8c191667..d29364b01 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { @@ -30,21 +32,20 @@ index 94967e6b6..5ea9f3097 100644 double d1 = entityhuman.locY - this.locY; double d2 = entityhuman.locZ - this.locZ; diff --git a/src/main/java/net/minecraft/server/EntitySilverfish.java b/src/main/java/net/minecraft/server/EntitySilverfish.java -index 50bca48bf..57552c522 100644 +index 6cb4f889c..a1ebf5c68 100644 --- a/src/main/java/net/minecraft/server/EntitySilverfish.java +++ b/src/main/java/net/minecraft/server/EntitySilverfish.java @@ -0,0 +0,0 @@ public class EntitySilverfish extends EntityMonster { - public boolean P() { - if (super.P()) { - EntityHuman entityhuman = this.world.b(this, 5.0D); -- + if (super.a(generatoraccess)) { + EntityHuman entityhuman = generatoraccess.b(this, 5.0D); + - return entityhuman == null; + return !(entityhuman != null && !entityhuman.affectsSpawning) && entityhuman == null; // Paper - Affects Spawning API } else { return false; } diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index a599a043d..1c7c187c7 100644 +index 44fb75c6f..aec9cdae5 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java @@ -0,0 +0,0 @@ public final class SpawnerCreature { @@ -52,25 +53,33 @@ index a599a043d..1c7c187c7 100644 EntityHuman entityhuman = (EntityHuman) iterator.next(); - if (!entityhuman.isSpectator()) { -+ if (!entityhuman.isSpectator() && entityhuman.affectsSpawning) { ++ if (!entityhuman.isSpectator() && entityhuman.affectsSpawning) { // Paper int l = MathHelper.floor(entityhuman.locX / 16.0D); j = MathHelper.floor(entityhuman.locZ / 16.0D); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 759964b0f..26d4bd690 100644 +index 05d363171..fd64b75ed 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.block.data.CraftBlockData; + import org.bukkit.craftbukkit.event.CraftEventFactory; + import org.bukkit.craftbukkit.util.CraftMagicNumbers; + import org.bukkit.craftbukkit.util.LongHashSet; // Paper ++import org.bukkit.entity.Player; + import org.bukkit.event.block.BlockCanBuildEvent; + import org.bukkit.event.block.BlockPhysicsEvent; + import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose for (int i = 0; i < this.players.size(); ++i) { EntityHuman entityhuman = (EntityHuman) this.players.get(i); -- if (IEntitySelector.e.apply(entityhuman)) { -+ if (IEntitySelector.e.apply(entityhuman) && entityhuman.affectsSpawning) { // Paper - Affects Spawning API +- if (IEntitySelector.e.test(entityhuman)) { ++ if (IEntitySelector.e.test(entityhuman) && entityhuman.affectsSpawning) { // Paper - Affects Spawning API double d4 = entityhuman.d(d0, d1, d2); if (d3 < 0.0D || d4 < d3 * d3) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index cd99801ff..a0c86d0e0 100644 +index fad258f11..c67137a80 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -80,6 +89,7 @@ index cd99801ff..a0c86d0e0 100644 + + } + ++ // Paper start + public void setAffectsSpawning(boolean affects) { + this.getHandle().affectsSpawning = affects; + } @@ -88,6 +98,8 @@ index cd99801ff..a0c86d0e0 100644 + public boolean getAffectsSpawning() { + return this.getHandle().affectsSpawning; } ++ // Paper end // Spigot start + private final Player.Spigot spigot = new Player.Spigot() -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Prevent-Fire-from-loading-chunks.patch b/Spigot-Server-Patches/Prevent-Fire-from-loading-chunks.patch index b738d8cf00..dc8af97e21 100644 --- a/Spigot-Server-Patches/Prevent-Fire-from-loading-chunks.patch +++ b/Spigot-Server-Patches/Prevent-Fire-from-loading-chunks.patch @@ -7,25 +7,27 @@ This causes the nether to spam unload/reload chunks, plus overall bad behavior. diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java -index a3a5c853c..6832a19af 100644 +index b6caf4c8a..f3a278c0b 100644 --- a/src/main/java/net/minecraft/server/BlockFire.java +++ b/src/main/java/net/minecraft/server/BlockFire.java @@ -0,0 +0,0 @@ public class BlockFire extends Block { } - BlockPosition blockposition1 = blockposition.a(j, l, k); -+ if (!world.isLoaded(blockposition1)) continue; // Paper - int j1 = this.d(world, blockposition1); + blockposition_mutableblockposition.g(blockposition).d(l, j1, i1); ++ if (!world.isLoaded(blockposition_mutableblockposition)) continue; // Paper + int l1 = this.a((IWorldReader) world, (BlockPosition) blockposition_mutableblockposition); - if (j1 > 0) { + if (l1 > 0) { @@ -0,0 +0,0 @@ public class BlockFire extends Block { } private void a(World world, BlockPosition blockposition, int i, Random random, int j, BlockPosition sourceposition) { // CraftBukkit add sourceposition +- int k = this.f(world.getType(blockposition).getBlock()); + // Paper start + final IBlockData iblockdata = world.getTypeIfLoaded(blockposition); + if (iblockdata == null) return; - int k = this.e(world.getType(blockposition).getBlock()); ++ int k = this.f(iblockdata.getBlock()); ++ // Paper end if (random.nextInt(i) < k) { - IBlockData iblockdata = world.getType(blockposition); @@ -37,9 +39,13 @@ index a3a5c853c..6832a19af 100644 for (int k = 0; k < j; ++k) { EnumDirection enumdirection = aenumdirection[k]; -+ final IBlockData type = world.getTypeIfLoaded(blockposition.shift(enumdirection)); // Paper -+ if (type == null) continue; // Paper - i = Math.max(this.f(world.getType(blockposition.shift(enumdirection)).getBlock()), i); +- i = Math.max(this.g(iworldreader.getType(blockposition.shift(enumdirection)).getBlock()), i); ++ // Paper start ++ final IBlockData type = ((World)iworldreader).getTypeIfLoaded(blockposition.shift(enumdirection)); ++ if (type == null) continue; ++ i = Math.max(this.g(type.getBlock()), i); ++ // Paper end } + return i; -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Prevent-Waterflow-BlockFromToEvent-from-loading-chun.patch b/Spigot-Server-Patches/Prevent-Waterflow-BlockFromToEvent-from-loading-chun.patch deleted file mode 100644 index 8da118ba5c..0000000000 --- a/Spigot-Server-Patches/Prevent-Waterflow-BlockFromToEvent-from-loading-chun.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Mon, 28 Mar 2016 22:03:09 -0400 -Subject: [PATCH] Prevent Waterflow BlockFromToEvent from loading chunks - -Many protection plugins would unintentionally trigger chunk loads -by calling .getToBlock() on an unloaded chunk, killing performance. - -Simply skip the event call. as CraftBukkit blocks changing the block -of unloaded chunks anyways. - -This keeps behavior consistent, vs inconsistent flowing based on plugin triggered loads. - -diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java -index 739b9aac3..ff90e08eb 100644 ---- a/src/main/java/net/minecraft/server/BlockFlowing.java -+++ b/src/main/java/net/minecraft/server/BlockFlowing.java -@@ -0,0 +0,0 @@ public class BlockFlowing extends BlockFluids { - - if (this.h(world, blockposition.down(), iblockdata2)) { - // CraftBukkit start -+ if (!canFlowTo(world, source, BlockFace.DOWN)) { return; } // Paper - BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN); - world.getServer().getPluginManager().callEvent(event); - -@@ -0,0 +0,0 @@ public class BlockFlowing extends BlockFluids { - EnumDirection enumdirection1 = (EnumDirection) iterator1.next(); - - // CraftBukkit start -+ if (!canFlowTo(world, source, org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(enumdirection1))) { continue; } // Paper - BlockFromToEvent event = new BlockFromToEvent(source, org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(enumdirection1)); - world.getServer().getPluginManager().callEvent(event); - -@@ -0,0 +0,0 @@ public class BlockFlowing extends BlockFluids { - - } - -+ // Paper start -+ private boolean canFlowTo(World world, org.bukkit.block.Block source, BlockFace face) { -+ return source.getWorld().isChunkLoaded((source.getX() + face.getModX()) >> 4, (source.getZ() + face.getModZ()) >> 4); -+ } -+ // Paper end -+ - private void flow(World world, BlockPosition blockposition, IBlockData iblockdata, int i) { -- if (world.isLoaded(blockposition) && this.h(world, blockposition, iblockdata)) { // CraftBukkit - add isLoaded check -+ if (/*world.isLoaded(blockposition) &&*/ this.h(world, blockposition, iblockdata)) { // CraftBukkit - add isLoaded check // Paper - Already checked before we get here for isLoaded - if (iblockdata.getMaterial() != Material.AIR) { - if (this.material == Material.LAVA) { - this.fizz(world, blockposition); --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Prevent-tile-entity-and-entity-crashes.patch b/Spigot-Server-Patches/Prevent-tile-entity-and-entity-crashes.patch index 50b30e3402..76b8aa4df7 100644 --- a/Spigot-Server-Patches/Prevent-tile-entity-and-entity-crashes.patch +++ b/Spigot-Server-Patches/Prevent-tile-entity-and-entity-crashes.patch @@ -5,28 +5,28 @@ Subject: [PATCH] Prevent tile entity and entity crashes diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 15f18ba1d..33e245e4c 100644 +index 5b7f6ca84..8cab71c0e 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject { - } + return TileEntityTypes.a.b(this.C()) + " // " + this.getClass().getCanonicalName(); }); if (this.world != null) { -- CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.getBlock(), this.v()); +- CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.getBlock()); + // Paper start - Prevent TileEntity and Entity crashes -+ Block block = this.getBlock(); ++ IBlockData block = this.getBlock(); + if (block != null) { -+ CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.getBlock(), this.v()); ++ CrashReportSystemDetails.a(crashreportsystemdetails, this.position, block); + } + // Paper end - crashreportsystemdetails.a("Actual block type", new CrashReportCallable() { - public String a() throws Exception { - int i = Block.getId(TileEntity.this.world.getType(TileEntity.this.position).getBlock()); + CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.world.getType(this.position)); + } + } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 31b765dea..fd5f8102a 100644 +index 3f0b6ac26..c605d7e52 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose entity.tickTimer.stopTiming(); // Paper } catch (Throwable throwable1) { entity.tickTimer.stopTiming(); @@ -43,9 +43,9 @@ index 31b765dea..fd5f8102a 100644 } } -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - ((ITickable) tileentity).e(); - this.methodProfiler.b(); +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose + ((ITickable) tileentity).X_(); + this.methodProfiler.e(); } catch (Throwable throwable2) { - crashreport1 = CrashReport.a(throwable2, "Ticking block entity"); - crashreportsystemdetails1 = crashreport1.a("Block entity being ticked"); diff --git a/Spigot-Server-Patches/Reduce-IO-ops-opening-a-new-region-file.patch b/Spigot-Server-Patches/Reduce-IO-ops-opening-a-new-region-file.patch index ba3754eb43..0c968aabc0 100644 --- a/Spigot-Server-Patches/Reduce-IO-ops-opening-a-new-region-file.patch +++ b/Spigot-Server-Patches/Reduce-IO-ops-opening-a-new-region-file.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Reduce IO ops opening a new region file. diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 5bcbd718f..2bd85e2d1 100644 +index 3f9aa5923..4acb6df5d 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java @@ -0,0 +0,0 @@ import java.io.ByteArrayInputStream; diff --git a/Spigot-Server-Patches/Remove-Debug-checks-from-DataBits.patch b/Spigot-Server-Patches/Remove-Debug-checks-from-DataBits.patch index be49b431ac..431204b19c 100644 --- a/Spigot-Server-Patches/Remove-Debug-checks-from-DataBits.patch +++ b/Spigot-Server-Patches/Remove-Debug-checks-from-DataBits.patch @@ -9,18 +9,18 @@ Before: http://i.imgur.com/nQsMzAE.png After: http://i.imgur.com/nJ46crB.png diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java -index f3a6799a8..fa0fd8a9c 100644 +index d24ec3d53..0fb3162e6 100644 --- a/src/main/java/net/minecraft/server/DataBits.java +++ b/src/main/java/net/minecraft/server/DataBits.java @@ -0,0 +0,0 @@ public class DataBits { - private final int d; + } - public DataBits(int i, int j) { + public DataBits(int i, int j, long[] along) { - Validate.inclusiveBetween(1L, 32L, (long) i); + //Validate.inclusiveBetween(1L, 32L, (long) i); // Paper this.d = j; this.b = i; - this.c = (1L << i) - 1L; + this.a = along; @@ -0,0 +0,0 @@ public class DataBits { } diff --git a/Spigot-Server-Patches/Remove-Metadata-on-reload.patch b/Spigot-Server-Patches/Remove-Metadata-on-reload.patch index 0dbe94ab3c..f8b8b7211a 100644 --- a/Spigot-Server-Patches/Remove-Metadata-on-reload.patch +++ b/Spigot-Server-Patches/Remove-Metadata-on-reload.patch @@ -7,7 +7,7 @@ Metadata is not meant to persist reload as things break badly with non primitive This will remove metadata on reload so it does not crash everything if a plugin uses it. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index e53f8c58f..d3e949707 100644 +index 5ffb335f5..f98f355dd 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { diff --git a/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch b/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch index c74b9fb2e7..67bb8dc211 100644 --- a/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch +++ b/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Remove invalid mob spawner tile entities diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index ca5a42377..50113c303 100644 +index 3b97981bc..36ea4ad47 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -0,0 +0,0 @@ public class Chunk { - tileentity.A(); +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + tileentity.z(); this.tileEntities.put(blockposition, tileentity); // CraftBukkit start + // Paper start - Remove invalid mob spawner tile entities @@ -18,5 +18,5 @@ index ca5a42377..50113c303 100644 + // Paper end } else { System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ() - + " (" + org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getBlockData(blockposition).getBlock()) + ") where there was no entity tile!"); + + " (" + getType(blockposition) + ") where there was no entity tile!"); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Remove-unused-World-Tile-Entity-List.patch b/Spigot-Server-Patches/Remove-unused-World-Tile-Entity-List.patch index e99ff71f63..ee944492de 100644 --- a/Spigot-Server-Patches/Remove-unused-World-Tile-Entity-List.patch +++ b/Spigot-Server-Patches/Remove-unused-World-Tile-Entity-List.patch @@ -6,19 +6,19 @@ Subject: [PATCH] Remove unused World Tile Entity List Massive hit to performance and it is completely unnecessary. diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index ad422b24b..5f92355db 100644 +index 3bf2cb8d0..3b3cc69de 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose }; // Spigot end - protected final Set f = Sets.newHashSet(); // Paper + protected final Set g = Sets.newHashSet(); // Paper - public final List tileEntityList = Lists.newArrayList(); + //public final List tileEntityList = Lists.newArrayList(); // Paper - remove unused list public final List tileEntityListTick = Lists.newArrayList(); - private final List b = Lists.newArrayList(); + private final List c = Lists.newArrayList(); private final Set tileEntityListUnload = Sets.newHashSet(); // Paper -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose timings.tileEntityTick.startTiming(); // Spigot if (!this.tileEntityListUnload.isEmpty()) { this.tileEntityListTick.removeAll(this.tileEntityListUnload); @@ -27,8 +27,8 @@ index ad422b24b..5f92355db 100644 this.tileEntityListUnload.clear(); } -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - if (tileentity.y()) { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose + if (tileentity.x()) { tilesThisCycle--; this.tileEntityListTick.remove(tileTickPosition--); - this.tileEntityList.remove(tileentity); @@ -36,7 +36,7 @@ index ad422b24b..5f92355db 100644 if (this.isLoaded(tileentity.getPosition())) { this.getChunkAtWorldCoords(tileentity.getPosition()).d(tileentity.getPosition()); } -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3); // CraftBukkit start // From above, don't screw this up - SPIGOT-1746 @@ -45,8 +45,8 @@ index ad422b24b..5f92355db 100644 this.a(tileentity1); } // CraftBukkit end -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - protected void l() {} +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose + protected void p_() {} public boolean a(TileEntity tileentity) { - boolean flag = this.tileEntityList.add(tileentity); @@ -57,10 +57,10 @@ index ad422b24b..5f92355db 100644 this.tileEntityListTick.add(tileentity); } -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose } else { if (tileentity != null) { - this.b.remove(tileentity); + this.c.remove(tileentity); - this.tileEntityList.remove(tileentity); + //this.tileEntityList.remove(tileentity); // Paper - remove unused list this.tileEntityListTick.remove(tileentity); diff --git a/Spigot-Server-Patches/Sanitise-RegionFileCache-and-make-configurable.patch b/Spigot-Server-Patches/Sanitise-RegionFileCache-and-make-configurable.patch index 5d84e2b2b2..4d4f5624ac 100644 --- a/Spigot-Server-Patches/Sanitise-RegionFileCache-and-make-configurable.patch +++ b/Spigot-Server-Patches/Sanitise-RegionFileCache-and-make-configurable.patch @@ -25,13 +25,13 @@ index 2f6e169f5..ec4643384 100644 + } } diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index 5f9e9ddef..7e7565807 100644 +index 384628ccc..b335016fd 100644 --- a/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/src/main/java/net/minecraft/server/RegionFileCache.java -@@ -0,0 +0,0 @@ import java.io.File; - import java.io.IOException; +@@ -0,0 +0,0 @@ import java.io.IOException; import java.util.Iterator; import java.util.Map; + import javax.annotation.Nullable; +import com.destroystokyo.paper.PaperConfig; // Paper +import java.util.LinkedHashMap; // Paper diff --git a/Spigot-Server-Patches/Send-absolute-position-the-first-time-an-entity-is-s.patch b/Spigot-Server-Patches/Send-absolute-position-the-first-time-an-entity-is-s.patch index 3308ea76e1..7b30f06721 100644 --- a/Spigot-Server-Patches/Send-absolute-position-the-first-time-an-entity-is-s.patch +++ b/Spigot-Server-Patches/Send-absolute-position-the-first-time-an-entity-is-s.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Send absolute position the first time an entity is seen diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index d864c7745..4c6eb6ed1 100644 +index 0410f9cf3..6ae576a2e 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java @@ -0,0 +0,0 @@ public class EntityTrackerEntry { diff --git a/Spigot-Server-Patches/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch b/Spigot-Server-Patches/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index 7265a5fc13..f543aa09fa 100644 --- a/Spigot-Server-Patches/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch +++ b/Spigot-Server-Patches/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch @@ -6,24 +6,29 @@ Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang diff --git a/src/main/java/net/minecraft/server/EULA.java b/src/main/java/net/minecraft/server/EULA.java -index 8361888c2..3623751bf 100644 +index 220ca7bca..eb4b08be4 100644 --- a/src/main/java/net/minecraft/server/EULA.java +++ b/src/main/java/net/minecraft/server/EULA.java @@ -0,0 +0,0 @@ public class EULA { - fileoutputstream = new FileOutputStream(this.b); - properties.setProperty("eula", "false"); -- properties.store(fileoutputstream, "By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula)."); -+ properties.store(fileoutputstream, "By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula)." + -+ "\nand also agreeing that tacos are tasty."); // Paper - fix lag - } catch (Exception exception) { - EULA.a.warn("Failed to save {}", this.b, exception); - } finally { + fileoutputstream = new FileOutputStream(this.b); + properties.setProperty("eula", "false"); +- properties.store(fileoutputstream, "By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula)."); ++ properties.store(fileoutputstream, "By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula).\nYou also agree that tacos are tasty, and the best food in the world."); // Paper - fix lag); + } catch (Exception exception) { + EULA.a.warn("Failed to save {}", this.b, exception); + } finally { + IOUtils.closeQuietly(fileoutputstream); + } +- + } + } + } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 8d08b536a..92d480251 100644 +index 590eb507c..4889a82a2 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati } public String getServerModName() { @@ -33,7 +38,7 @@ index 8d08b536a..92d480251 100644 public CrashReport b(CrashReport crashreport) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 9042deed6..33b40ffc2 100644 +index 88ea651ba..28f6cdf96 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ import org.bukkit.event.server.TabCompleteEvent; @@ -41,16 +46,16 @@ index 9042deed6..33b40ffc2 100644 public final class CraftServer implements Server { - private final String serverName = "CraftBukkit"; -+ private final String serverName = "Paper"; ++ private final String serverName = "Paper"; // Paper private final String serverVersion; private final String bukkitVersion = Versioning.getBukkitVersion(); private final Logger logger = Logger.getLogger("Minecraft"); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 96585fb24..f95da9e26 100644 +index 5e49bca8a..d9059129d 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -0,0 +0,0 @@ public class Main { - deadline.add(Calendar.DAY_OF_YEAR, -14); + deadline.add(Calendar.DAY_OF_YEAR, -3); if (buildDate.before(deadline.getTime())) { System.err.println("*** Error, this build is outdated ***"); - System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/ ***"); diff --git a/Spigot-Server-Patches/Stop-updating-flowing-block-if-material-has-changed.patch b/Spigot-Server-Patches/Stop-updating-flowing-block-if-material-has-changed.patch deleted file mode 100644 index 22bfc8a876..0000000000 --- a/Spigot-Server-Patches/Stop-updating-flowing-block-if-material-has-changed.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Iceee -Date: Wed, 2 Mar 2016 12:03:23 -0600 -Subject: [PATCH] Stop updating flowing block if material has changed - - -diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java -index 62234a7c9..3b47253a4 100644 ---- a/src/main/java/net/minecraft/server/BlockFlowing.java -+++ b/src/main/java/net/minecraft/server/BlockFlowing.java -@@ -0,0 +0,0 @@ public class BlockFlowing extends BlockFluids { - this.f(world, blockposition, iblockdata); - } - -+ if (world.getType(blockposition).getBlock().getBlockData().getMaterial() != material) return; // Paper - Stop updating flowing block if material has changed - org.bukkit.block.Block source = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); // CraftBukkit - IBlockData iblockdata2 = world.getType(blockposition.down()); - --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Store-counts-for-each-Entity-Block-Entity-Type.patch b/Spigot-Server-Patches/Store-counts-for-each-Entity-Block-Entity-Type.patch index 49aca99605..e1dbf12fa5 100644 --- a/Spigot-Server-Patches/Store-counts-for-each-Entity-Block-Entity-Type.patch +++ b/Spigot-Server-Patches/Store-counts-for-each-Entity-Block-Entity-Type.patch @@ -6,12 +6,12 @@ Subject: [PATCH] Store counts for each Entity/Block Entity Type Opens door for future patches to optimize performance diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index b40e60942..952c96c0c 100644 +index 120e66c78..0ae780c8e 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -0,0 +0,0 @@ public class Chunk { - public final Map tileEntities; - public final List[] entitySlices; // Spigot +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + private int neighbors = 0x1 << 12; + public long chunkKey; // Paper start + public final co.aikar.util.Counter entityCounts = new co.aikar.util.Counter<>(); + public final co.aikar.util.Counter tileEntityCounts = new co.aikar.util.Counter<>(); @@ -29,7 +29,7 @@ index b40e60942..952c96c0c 100644 } return replaced; } -@@ -0,0 +0,0 @@ public class Chunk { +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { TileEntity removed = super.remove(key); if (removed != null) { removed.setCurrentChunk(null); @@ -37,20 +37,20 @@ index b40e60942..952c96c0c 100644 } return removed; } -@@ -0,0 +0,0 @@ public class Chunk { - } +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + this.entitySlices[k].add(entity); // Paper start entity.setCurrentChunk(this); + entityCounts.increment(entity.entityKeyString); // Paper end - // Spigot end } -@@ -0,0 +0,0 @@ public class Chunk { + +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + return; } - // Paper start entity.setCurrentChunk(null); + entityCounts.decrement(entity.entityKeyString); // Paper end - // Spigot end } + -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch b/Spigot-Server-Patches/Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch index 1e1cd29c03..b17c8155ec 100644 --- a/Spigot-Server-Patches/Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch +++ b/Spigot-Server-Patches/Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch @@ -8,22 +8,22 @@ This enables us a fast reference to the entities current chunk instead of having to look it up by hashmap lookups. diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 4bbebb25a..68008fe6a 100644 +index 9500c456d..120e66c78 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -0,0 +0,0 @@ public class Chunk { - private final byte[] g; - private final int[] h; - private final boolean[] i; +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + private final BiomeBase[] g; + private final boolean[] h; + private final Map i; - private boolean j; + private boolean j; public boolean isLoaded() { return j; } // Paper - OBFHELPER public final World world; - public final int[] heightMap; + public final Map heightMap; public final int locX; -@@ -0,0 +0,0 @@ public class Chunk { - private boolean m; - public final Map tileEntities; - public final List[] entitySlices; // Spigot +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + // CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking + private int neighbors = 0x1 << 12; + public long chunkKey; + // Paper start + private class TileEntityHashMap extends java.util.HashMap { + @Override @@ -37,7 +37,7 @@ index 4bbebb25a..68008fe6a 100644 + } + return replaced; + } -+ + + @Override + public TileEntity remove(Object key) { + TileEntity removed = super.remove(key); @@ -48,46 +48,52 @@ index 4bbebb25a..68008fe6a 100644 + } + } + // Paper end - private boolean done; - private boolean lit; - private boolean r; -@@ -0,0 +0,0 @@ public class Chunk { - this.g = new byte[256]; - this.h = new int[256]; - this.i = new boolean[256]; + public boolean areNeighborsLoaded(final int radius) { + switch (radius) { + case 2: +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + this.h = new boolean[256]; + this.i = Maps.newHashMap(); + this.heightMap = Maps.newHashMap(); - this.tileEntities = Maps.newHashMap(); + this.tileEntities = new TileEntityHashMap(); // Paper - this.x = 4096; - this.y = Queues.newConcurrentLinkedQueue(); - this.entitySlices = (List[]) (new List[16]); // Spigot -@@ -0,0 +0,0 @@ public class Chunk { - this.entityCount.adjustOrPutValue( creatureType.a(), 1, 1 ); - } - } + this.q = Maps.newHashMap(); + this.r = Maps.newHashMap(); + this.s = new ShortList[16]; +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + entity.af = k; + entity.ag = this.locZ; + this.entitySlices[k].add(entity); + // Paper start + entity.setCurrentChunk(this); + // Paper end - // Spigot end } -@@ -0,0 +0,0 @@ public class Chunk { - this.entityCount.adjustValue( creatureType.a(), -1 ); - } + public void a(HeightMap.Type heightmap_type, long[] along) { +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + if (i >= this.entitySlices.length) { + i = this.entitySlices.length - 1; } +- +- this.entitySlices[i].remove(entity); + // Paper start ++ if (!this.entitySlices[i].remove(entity)) { ++ return; ++ } + entity.setCurrentChunk(null); + // Paper end - // Spigot end } + public boolean c(BlockPosition blockposition) { diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 3a8902bf1..4af566b36 100644 +index 53fc37088..1ef52cc6d 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } // Paper start ++ + private java.lang.ref.WeakReference currentChunk = null; + + public void setCurrentChunk(Chunk chunk) { @@ -120,17 +126,19 @@ index 3a8902bf1..4af566b36 100644 + public Chunk getChunkAtLocation() { + return getCurrentChunkAt((int)Math.floor(locX) >> 4, (int)Math.floor(locZ) >> 4); + } - public final MinecraftKey entityKey = EntityTypes.getKey(this); - public final String entityKeyString = entityKey != null ? entityKey.toString() : null; ++ + public final MinecraftKey entityKey; + public final String entityKeyString; diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 672ba3134..d7132c3c0 100644 +index b09325097..b992360ac 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject { + public String getMinecraftKeyString() { + return tileEntityKeyString; } - - // Paper start ++ + private java.lang.ref.WeakReference currentChunk = null; + public Chunk getCurrentChunk() { + final Chunk chunk = currentChunk != null ? currentChunk.get() : world.getChunkIfLoaded(position.getX() >> 4, position.getZ() >> 4); @@ -139,11 +147,11 @@ index 672ba3134..d7132c3c0 100644 + public void setCurrentChunk(Chunk chunk) { + this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null; + } - public final MinecraftKey tileEntityKey = getKey(this.getClass()); - public final String tileEntityKeyString = tileEntityKey != null ? tileEntityKey.toString() : null; + // Paper end + @Nullable diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index c5a194ffe..833e3111d 100644 +index 70143c4d3..1e3675e4f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -0,0 +0,0 @@ import java.util.UUID; diff --git a/Spigot-Server-Patches/Support-offline-mode-in-whitelist-command-as-well.patch b/Spigot-Server-Patches/Support-offline-mode-in-whitelist-command-as-well.patch deleted file mode 100644 index 791bcbc1ee..0000000000 --- a/Spigot-Server-Patches/Support-offline-mode-in-whitelist-command-as-well.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Mon, 21 Mar 2016 00:19:18 -0500 -Subject: [PATCH] Support offline mode in whitelist command as well - - -diff --git a/src/main/java/net/minecraft/server/CommandWhitelist.java b/src/main/java/net/minecraft/server/CommandWhitelist.java -index c74d1d2be..0f4237db1 100644 ---- a/src/main/java/net/minecraft/server/CommandWhitelist.java -+++ b/src/main/java/net/minecraft/server/CommandWhitelist.java -@@ -0,0 +0,0 @@ public class CommandWhitelist extends CommandAbstract { - throw new ExceptionUsage("commands.whitelist.add.usage", new Object[0]); - } - -+ // Paper start - Handle offline mode as well -+ /* - gameprofile = minecraftserver.getUserCache().getProfile(astring[1]); - if (gameprofile == null) { - throw new CommandException("commands.whitelist.add.failed", new Object[] { astring[1]}); - } - - minecraftserver.getPlayerList().addWhitelist(gameprofile); -+ */ -+ this.whitelist(minecraftserver, astring[1], true); -+ // Paper end - a(icommandlistener, (ICommand) this, "commands.whitelist.add.success", new Object[] { astring[1]}); - } else if ("remove".equals(astring[0])) { - if (astring.length < 2) { - throw new ExceptionUsage("commands.whitelist.remove.usage", new Object[0]); - } - -+ // Paper start - Handle offline mode as well -+ /* - gameprofile = minecraftserver.getPlayerList().getWhitelist().a(astring[1]); - if (gameprofile == null) { - throw new CommandException("commands.whitelist.remove.failed", new Object[] { astring[1]}); - } - - minecraftserver.getPlayerList().removeWhitelist(gameprofile); -+ -+ */ -+ this.whitelist(minecraftserver, astring[1], false); -+ // Paper end - a(icommandlistener, (ICommand) this, "commands.whitelist.remove.success", new Object[] { astring[1]}); - } else if ("reload".equals(astring[0])) { - minecraftserver.getPlayerList().reloadWhitelist(); -@@ -0,0 +0,0 @@ public class CommandWhitelist extends CommandAbstract { - return Collections.emptyList(); - } - } -+ -+ // Paper start -+ /** -+ * Adds or removes a player from the game whitelist -+ * -+ * @param mcserver running instance of MinecraftServer -+ * @param playerName the player we're going to be whitelisting -+ * @param add whether we're adding or removing from the whitelist -+ */ -+ private void whitelist(MinecraftServer mcserver, String playerName, boolean add) throws CommandException { -+ if (mcserver.getOnlineMode()) { -+ // The reason we essentially copy/pasta NMS code here is because the NMS online-only version -+ // is capable of providing feedback to the person running the command based on whether or -+ // not the player is a real online-mode account -+ GameProfile gameprofile = mcserver.getUserCache().getProfile(playerName); -+ if (gameprofile == null) { -+ if (add) { -+ throw new CommandException("commands.whitelist.add.failed", new Object[] { playerName}); -+ } else { -+ throw new CommandException("commands.whitelist.remove.failed", new Object[] { playerName}); -+ } -+ } -+ -+ if (add) { -+ mcserver.getPlayerList().addWhitelist(gameprofile); -+ } else { -+ mcserver.getPlayerList().removeWhitelist(gameprofile); -+ } -+ } else { -+ // versus our offline version, which will always report success all of the time -+ org.bukkit.OfflinePlayer offlinePlayer = org.bukkit.Bukkit.getOfflinePlayer(playerName); -+ if (add) { -+ offlinePlayer.setWhitelisted(true); -+ } else { -+ offlinePlayer.setWhitelisted(false); -+ } -+ } -+ } -+ // Paper end - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Timings-v2.patch b/Spigot-Server-Patches/Timings-v2.patch index a750fa3947..2bcf4c279b 100644 --- a/Spigot-Server-Patches/Timings-v2.patch +++ b/Spigot-Server-Patches/Timings-v2.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Timings v2 diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java new file mode 100644 -index 000000000..1b33390de +index 000000000..4f624e39c --- /dev/null +++ b/src/main/java/co/aikar/timings/MinecraftTimings.java @@ -0,0 +0,0 @@ @@ -124,12 +124,12 @@ index 000000000..1b33390de + } + + public static Timing getBlockTiming(Block block) { -+ return Timings.ofSafe("## Scheduled Block: " + block.getName(), scheduledBlocksTimer); ++ return Timings.ofSafe("## Scheduled Block: " + block.toString(), scheduledBlocksTimer); + } -+ ++/* + public static Timing getStructureTiming(StructureGenerator structureGenerator) { + return Timings.ofSafe("Structure Generator - " + structureGenerator.getName(), structureGenerationTimer); -+ } ++ }*/ + + public static Timing getPacketTiming(Packet packet) { + return Timings.ofSafe("## Packet - " + packet.getClass().getSimpleName(), packetProcessTimer); @@ -274,13 +274,14 @@ index 000000000..089154f62 +} diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java new file mode 100644 -index 000000000..e0ad559b7 +index 000000000..145cb274b --- /dev/null +++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java @@ -0,0 +0,0 @@ +package co.aikar.timings; + +import net.minecraft.server.World; ++import net.minecraft.server.WorldServer; + +/** + * Set of timers per world, to track world specific timings. @@ -319,8 +320,8 @@ index 000000000..e0ad559b7 + public final Timing syncChunkLoadDataTimer; + public final Timing syncChunkLoadStructuresTimer; + public final Timing syncChunkLoadPostTimer; -+ public final Timing syncChunkLoadNBTTimer; -+ public final Timing syncChunkLoadPopulateNeighbors; ++ public final Timing syncChunkLoadPopulateTimer; ++ public final Timing chunkLoadLevelTimer; + public final Timing chunkGeneration; + public final Timing chunkIOStage1; + public final Timing chunkIOStage2; @@ -361,8 +362,8 @@ index 000000000..e0ad559b7 + syncChunkLoadDataTimer = Timings.ofSafe(name + "syncChunkLoad - Data"); + syncChunkLoadStructuresTimer = Timings.ofSafe(name + "chunkLoad - recreateStructures"); + syncChunkLoadPostTimer = Timings.ofSafe(name + "chunkLoad - Post"); -+ syncChunkLoadNBTTimer = Timings.ofSafe(name + "chunkLoad - NBT"); -+ syncChunkLoadPopulateNeighbors = Timings.ofSafe(name + "chunkLoad - Populate Neighbors"); ++ syncChunkLoadPopulateTimer = Timings.ofSafe(name + "chunkLoad - Populate"); ++ chunkLoadLevelTimer = Timings.ofSafe(name + "chunkLoad - Load Level"); + chunkGeneration = Timings.ofSafe(name + "chunkGeneration"); + chunkIOStage1 = Timings.ofSafe(name + "ChunkIO Stage 1 - DiskIO"); + chunkIOStage2 = Timings.ofSafe(name + "ChunkIO Stage 2 - Post Load"); @@ -376,6 +377,10 @@ index 000000000..e0ad559b7 + doTick = Timings.ofSafe(name + "doTick"); + tickEntities = Timings.ofSafe(name + "tickEntities"); + } ++ ++ public static Timing getTickList(WorldServer worldserver, String timingsType) { ++ return Timings.ofSafe(worldserver.getWorldData().getName() + " - Scheduled " + timingsType); ++ } +} diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java index 5ab2cf6ee..b5795b6d3 100644 @@ -422,14 +427,17 @@ index 5ab2cf6ee..b5795b6d3 100644 + } } diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index 2dca6dbcb..352310960 100644 +index ffb91b27b..ff110c8e9 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java -@@ -0,0 +0,0 @@ public class Block { - protected final BlockStateList blockStateList; +@@ -0,0 +0,0 @@ public class Block implements IMaterial { private IBlockData blockData; - private String name; -+ // Paper start + protected final boolean o; + private final boolean p; +- @Nullable +- private String name; ++ @Nullable // Paper start ++ public String name; + public co.aikar.timings.Timing timing; + public co.aikar.timings.Timing getTiming() { + if (timing == null) { @@ -438,117 +446,108 @@ index 2dca6dbcb..352310960 100644 + return timing; + } + // Paper end - - public static int getId(Block block) { - return Block.REGISTRY.a(block); // CraftBukkit - decompile error -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index f540b14a2..472b9c1c3 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -0,0 +0,0 @@ public class Chunk { - - // CraftBukkit start - public void loadNearby(IChunkProvider ichunkprovider, ChunkGenerator chunkgenerator, boolean newChunk) { -- world.timings.syncChunkLoadPostTimer.startTiming(); // Spigot -+ world.timings.syncChunkLoadPostTimer.startTiming(); // Paper - Server server = world.getServer(); - if (server != null) { - /* -@@ -0,0 +0,0 @@ public class Chunk { - } - } - // CraftBukkit end -- -+ world.timings.syncChunkLoadPostTimer.stopTiming(); // Paper -+ world.timings.syncChunkLoadPopulateNeighbors.startTiming(); // Paper - Chunk chunk = ichunkprovider.getLoadedChunkAt(this.locX, this.locZ - 1); - Chunk chunk1 = ichunkprovider.getLoadedChunkAt(this.locX + 1, this.locZ); - Chunk chunk2 = ichunkprovider.getLoadedChunkAt(this.locX, this.locZ + 1); -@@ -0,0 +0,0 @@ public class Chunk { - chunk4.a(chunkgenerator); - } - } -- world.timings.syncChunkLoadPostTimer.stopTiming(); // Spigot -+ world.timings.syncChunkLoadPopulateNeighbors.stopTiming(); // Paper - ++ + private static final ThreadLocal>> r = ThreadLocal.withInitial(() -> { + Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap = new Object2ByteLinkedOpenHashMap(200) { + protected void rehash(int i) {} +diff --git a/src/main/java/net/minecraft/server/ChunkMap.java b/src/main/java/net/minecraft/server/ChunkMap.java +index 5164e5c92..0c2386f5e 100644 +--- a/src/main/java/net/minecraft/server/ChunkMap.java ++++ b/src/main/java/net/minecraft/server/ChunkMap.java +@@ -0,0 +0,0 @@ public class ChunkMap extends Long2ObjectOpenHashMap { } -@@ -0,0 +0,0 @@ public class Chunk { - } + public Chunk a(long i, Chunk chunk) { ++ chunk.world.timings.syncChunkLoadPostTimer.startTiming(); // Paper + Chunk chunk1 = (Chunk) super.put(i, chunk); + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i); - public void o() { -+ world.timings.lightChunk.startTiming(); // Paper - this.done = true; - this.lit = true; - BlockPosition blockposition = new BlockPosition(this.locX << 4, 0, this.locZ << 4); -@@ -0,0 +0,0 @@ public class Chunk { +@@ -0,0 +0,0 @@ public class ChunkMap extends Long2ObjectOpenHashMap { + } } } ++ chunk.world.timings.syncChunkLoadPostTimer.stopTiming(); // Paper -+ world.timings.lightChunk.stopTiming(); // Paper - } + if (chunk.newChunk) { ++ chunk.world.timings.syncChunkLoadPopulateTimer.startTiming(); // Paper + BlockSand.instaFall = true; + java.util.Random random = new java.util.Random(); + random.setSeed(chunk.world.getSeed()); +@@ -0,0 +0,0 @@ public class ChunkMap extends Long2ObjectOpenHashMap { + } + BlockSand.instaFall = false; + chunk.world.getServer().getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(chunk.bukkitChunk)); ++ chunk.world.timings.syncChunkLoadPopulateTimer.stopTiming(); // Paper + } - private void z() { + return chunk1; diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 86973cb98..bd006ef74 100644 +index 0296d3ef0..badfe86b2 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider { } - public void saveChunk(Chunk chunk, boolean unloaded) { // Spigot + public void saveChunk(IChunkAccess ichunkaccess, boolean unloaded) { // Spigot - try { -+ try (co.aikar.timings.Timing timed = world.timings.chunkSaveData.startTiming()) { - chunk.setLastSaved(this.world.getTime()); - this.chunkLoader.saveChunk(this.world, chunk, unloaded); // Spigot ++ try (co.aikar.timings.Timing timed = world.timings.chunkSaveData.startTiming()) { // Paper - Timings + ichunkaccess.setLastSaved(this.world.getTime()); + this.chunkLoader.saveChunk(this.world, ichunkaccess, unloaded); // Spigot } catch (IOException ioexception) { diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 50ec3adb8..a401dec60 100644 +index 42050f06d..e26860516 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -0,0 +0,0 @@ + package net.minecraft.server; - public void loadEntities(Chunk chunk, NBTTagCompound nbttagcompound, World world) { - // CraftBukkit end ++import co.aikar.timings.Timings; + import com.google.common.collect.Maps; + import com.mojang.datafixers.DataFixTypes; + import com.mojang.datafixers.DataFixer; +@@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { + public void loadEntities(NBTTagCompound nbttagcompound, Chunk chunk) { + NBTTagList nbttaglist = nbttagcompound.getList("Entities", 10); + World world = chunk.getWorld(); - world.timings.syncChunkLoadEntitiesTimer.startTiming(); // Spigot -+ world.timings.syncChunkLoadNBTTimer.startTiming(); // Spigot - NBTTagList nbttaglist1 = nbttagcompound.getList("Entities", 10); ++ world.timings.chunkLoadLevelTimer.startTiming(); // Spigot - for (int l = 0; l < nbttaglist1.size(); ++l) { + for (int i = 0; i < nbttaglist.size(); ++i) { + NBTTagCompound nbttagcompound1 = nbttaglist.getCompound(i); @@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { - a(nbttagcompound2, world, chunk); - chunk.g(true); + chunk.f(true); } + - world.timings.syncChunkLoadEntitiesTimer.stopTiming(); // Spigot - world.timings.syncChunkLoadTileEntitiesTimer.startTiming(); // Spigot - NBTTagList nbttaglist2 = nbttagcompound.getList("TileEntities", 10); + NBTTagList nbttaglist1 = nbttagcompound.getList("TileEntities", 10); - for (int i1 = 0; i1 < nbttaglist2.size(); ++i1) { + for (int j = 0; j < nbttaglist1.size(); ++j) { @@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { - chunk.a(tileentity); + } } } - world.timings.syncChunkLoadTileEntitiesTimer.stopTiming(); // Spigot - world.timings.syncChunkLoadTileTicksTimer.startTiming(); // Spigot - if (nbttagcompound.hasKeyOfType("TileTicks", 9)) { - NBTTagList nbttaglist3 = nbttagcompound.getList("TileTicks", 10); + if (nbttagcompound.hasKeyOfType("TileTicks", 9) && world.I() instanceof TickListServer) { + ((TickListServer) world.I()).a(nbttagcompound.getList("TileTicks", 10)); @@ -0,0 +0,0 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { - world.b(new BlockPosition(nbttagcompound4.getInt("x"), nbttagcompound4.getInt("y"), nbttagcompound4.getInt("z")), block, nbttagcompound4.getInt("t"), nbttagcompound4.getInt("p")); - } + if (nbttagcompound.hasKeyOfType("LiquidTicks", 9) && world.H() instanceof TickListServer) { + ((TickListServer) world.H()).a(nbttagcompound.getList("LiquidTicks", 10)); } - world.timings.syncChunkLoadTileTicksTimer.stopTiming(); // Spigot -+ world.timings.syncChunkLoadNBTTimer.stopTiming(); // Spigot ++ world.timings.chunkLoadLevelTimer.stopTiming(); // Spigot - // return chunk; // CraftBukkit } + diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index e1cb96a88..8f2afcc32 100644 +index 9155aa727..a3d58b5ce 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -0,0 +0,0 @@ import java.io.PrintStream; - import org.apache.logging.log4j.Level; +@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Level; + import org.bukkit.command.CommandSender; import org.bukkit.craftbukkit.LoggerOutputStream; -import org.bukkit.craftbukkit.SpigotTimings; // Spigot +import co.aikar.timings.MinecraftTimings; // Paper @@ -558,7 +557,7 @@ index e1cb96a88..8f2afcc32 100644 @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } - public void aP() { + public void aW() { - SpigotTimings.serverCommandTimer.startTiming(); // Spigot + MinecraftTimings.serverCommandTimer.startTiming(); // Spigot while (!this.serverCommandQueue.isEmpty()) { @@ -572,7 +571,7 @@ index e1cb96a88..8f2afcc32 100644 + MinecraftTimings.serverCommandTimer.stopTiming(); // Spigot } - public boolean aa() { + public boolean S() { @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer return remoteControlCommandListener.getMessages(); } @@ -596,10 +595,10 @@ index e1cb96a88..8f2afcc32 100644 return waitable.get(); } catch (java.util.concurrent.ExecutionException e) { diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index f140d5e28..05aad7dd0 100644 +index 7a17a4ff9..2ed362791 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ import org.bukkit.block.BlockFace; +@@ -0,0 +0,0 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Hanging; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Vehicle; @@ -609,7 +608,7 @@ index f140d5e28..05aad7dd0 100644 import org.bukkit.event.entity.EntityCombustByEntityEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke public boolean valid; public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only public boolean forceExplosionKnockback; // SPIGOT-949 @@ -618,7 +617,7 @@ index f140d5e28..05aad7dd0 100644 // Spigot start public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } public void move(EnumMoveType enummovetype, double d0, double d1, double d2) { @@ -626,16 +625,16 @@ index f140d5e28..05aad7dd0 100644 if (this.noclip) { this.a(this.getBoundingBox().d(d0, d1, d2)); this.recalcPosition(); -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - this.world.methodProfiler.b(); + this.world.methodProfiler.e(); } - org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot } - public void recalcPosition() { + protected float ab() { diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 0026f29d5..d15cfdd76 100644 +index e630d6103..1ee54fa45 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityTeleportEvent; @@ -650,63 +649,68 @@ index 0026f29d5..d15cfdd76 100644 @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { } - public void B_() { + public void tick() { - SpigotTimings.timerEntityBaseTick.startTiming(); // Spigot - super.B_(); - this.cI(); - if (!this.world.isClientSide) { + super.tick(); + this.cU(); + this.o(); @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { } } - SpigotTimings.timerEntityBaseTick.stopTiming(); // Spigot - this.n(); + this.k(); - SpigotTimings.timerEntityTickRest.startTiming(); // Spigot double d0 = this.locX - this.lastX; double d1 = this.locZ - this.lastZ; float f = (float) (d0 * d0 + d1 * d1); @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { } else { - this.bq = 0; + this.bv = 0; } - - SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot } - protected float g(float f, float f1) { + protected float e(float f, float f1) { @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { } this.world.methodProfiler.a("ai"); - SpigotTimings.timerEntityAI.startTiming(); // Spigot if (this.isFrozen()) { - this.bd = false; - this.be = 0.0F; + this.bg = false; + this.bh = 0.0F; @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { this.doTick(); - this.world.methodProfiler.b(); + this.world.methodProfiler.e(); } - SpigotTimings.timerEntityAI.stopTiming(); // Spigot - this.world.methodProfiler.b(); + this.world.methodProfiler.e(); this.world.methodProfiler.a("jump"); @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - this.bg *= 0.98F; - this.bh *= 0.9F; - this.r(); + this.n(); + AxisAlignedBB axisalignedbb = this.getBoundingBox(); + - SpigotTimings.timerEntityAIMove.startTiming(); // Spigot - this.a(this.be, this.bf, this.bg); + this.a(this.bh, this.bi, this.bj); - SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot - this.world.methodProfiler.b(); + this.world.methodProfiler.e(); this.world.methodProfiler.a("push"); + if (this.bw > 0) { +@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { + this.a(axisalignedbb, this.getBoundingBox()); + } + - SpigotTimings.timerEntityAICollision.startTiming(); // Spigot - this.cB(); + this.cM(); - SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot - this.world.methodProfiler.b(); + this.world.methodProfiler.e(); } diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java -index ce0124020..a60f94608 100644 +index ae31935c4..70c9b1f50 100644 --- a/src/main/java/net/minecraft/server/EntityTracker.java +++ b/src/main/java/net/minecraft/server/EntityTracker.java @@ -0,0 +0,0 @@ public class EntityTracker { @@ -737,9 +741,16 @@ index ce0124020..a60f94608 100644 } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c1a8816b4..8d08b536a 100644 +index bcdd9e0fa..590eb507c 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -0,0 +0,0 @@ + package net.minecraft.server; + ++import co.aikar.timings.Timings; + import com.google.common.base.Stopwatch; + import com.google.common.collect.Lists; + import com.google.common.collect.Queues; @@ -0,0 +0,0 @@ import org.bukkit.Bukkit; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.Main; @@ -748,9 +759,9 @@ index c1a8816b4..8d08b536a 100644 import org.spigotmc.SlackActivityAccountant; // Spigot +import co.aikar.timings.MinecraftTimings; // Paper - public abstract class MinecraftServer implements ICommandListener, Runnable, IAsyncTaskHandler, IMojangStatistics { + public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStatistics, ICommandListener, Runnable { -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati } // CraftBukkit end MinecraftServer.LOGGER.info("Stopping server"); @@ -758,41 +769,41 @@ index c1a8816b4..8d08b536a 100644 // CraftBukkit start if (this.server != null) { this.server.disablePlugins(); -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs - public void B() {} +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati + public void u() {} - protected void C() throws ExceptionWorldConflict { // CraftBukkit - added throws + protected void v() { - SpigotTimings.serverTickTimer.startTiming(); // Spigot + co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper this.slackActivityAccountant.tickStarted(); // Spigot - long i = System.nanoTime(); + long i = SystemUtils.c(); -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati } if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit - SpigotTimings.worldSaveTimer.startTiming(); // Spigot this.methodProfiler.a("save"); - this.v.savePlayers(); + this.s.savePlayers(); // Spigot Start -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati // this.saveChunks(true); // Spigot End - this.methodProfiler.b(); + this.methodProfiler.e(); - SpigotTimings.worldSaveTimer.stopTiming(); // Spigot } - this.methodProfiler.a("tallying"); -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs - + this.methodProfiler.a("snooper"); +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati + this.methodProfiler.e(); org.spigotmc.WatchdogThread.tick(); // Spigot - this.slackActivityAccountant.tickEnded(tickNanos); // Spigot + this.slackActivityAccountant.tickEnded(l); // Spigot - SpigotTimings.serverTickTimer.stopTiming(); // Spigot - org.spigotmc.CustomTimingsHandler.tick(); // Spigot + co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper } - public void D() { + public void w() { - SpigotTimings.schedulerTimer.startTiming(); // Spigot + MinecraftTimings.bukkitSchedulerTimer.startTiming(); // Paper this.server.getScheduler().mainThreadHeartbeat(this.ticks); // CraftBukkit @@ -800,14 +811,20 @@ index c1a8816b4..8d08b536a 100644 + MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Paper + MinecraftTimings.minecraftSchedulerTimer.startTiming(); // Paper this.methodProfiler.a("jobs"); - Queue queue = this.j; -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs - SystemUtils.a(entry, MinecraftServer.LOGGER); - } - // Spigot end + FutureTask futuretask; +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati + while ((futuretask = (FutureTask) this.g.poll()) != null) { + SystemUtils.a(futuretask, MinecraftServer.LOGGER); + } + MinecraftTimings.minecraftSchedulerTimer.stopTiming(); // Paper + this.methodProfiler.c("commandFunctions"); +- SpigotTimings.commandFunctionsTimer.startTiming(); // Spigot ++ MinecraftTimings.commandFunctionsTimer.startTiming(); // Spigot + this.aD().X_(); +- SpigotTimings.commandFunctionsTimer.stopTiming(); // Spigot ++ MinecraftTimings.commandFunctionsTimer.stopTiming(); // Spigot this.methodProfiler.c("levels"); // CraftBukkit start @@ -831,7 +848,7 @@ index c1a8816b4..8d08b536a 100644 // Send time updates to everyone, it will get the right time from the world the player is in. if (this.ticks % 20 == 0) { for (int i = 0; i < this.getPlayerList().players.size(); ++i) { -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime(), entityplayer.world.getGameRules().getBoolean("doDaylightCycle"))); // Add support for per player time } } @@ -840,60 +857,54 @@ index c1a8816b4..8d08b536a 100644 int i; -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati - this.methodProfiler.b(); + this.methodProfiler.e(); this.methodProfiler.a("tracker"); - worldserver.timings.tracker.startTiming(); // Spigot worldserver.getTracker().updatePlayers(); - worldserver.timings.tracker.stopTiming(); // Spigot - this.methodProfiler.b(); - this.methodProfiler.b(); - // } // CraftBukkit -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs + this.methodProfiler.e(); + this.methodProfiler.e(); + } +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati } this.methodProfiler.c("connection"); - SpigotTimings.connectionTimer.startTiming(); // Spigot + MinecraftTimings.connectionTimer.startTiming(); // Spigot - this.an().c(); + this.getServerConnection().c(); - SpigotTimings.connectionTimer.stopTiming(); // Spigot + MinecraftTimings.connectionTimer.stopTiming(); // Spigot this.methodProfiler.c("players"); - SpigotTimings.playerListTimer.startTiming(); // Spigot + MinecraftTimings.playerListTimer.startTiming(); // Spigot - this.v.tick(); + this.s.tick(); - SpigotTimings.playerListTimer.stopTiming(); // Spigot + MinecraftTimings.playerListTimer.stopTiming(); // Spigot - this.methodProfiler.c("commandFunctions"); -- SpigotTimings.commandFunctionsTimer.startTiming(); // Spigot -+ MinecraftTimings.commandFunctionsTimer.startTiming(); // Spigot - this.aL().e(); -- SpigotTimings.commandFunctionsTimer.stopTiming();// Spigot -+ MinecraftTimings.commandFunctionsTimer.stopTiming(); // Spigot this.methodProfiler.c("tickables"); - +- - SpigotTimings.tickablesTimer.startTiming(); // Spigot + MinecraftTimings.tickablesTimer.startTiming(); // Spigot - for (i = 0; i < this.o.size(); ++i) { - ((ITickable) this.o.get(i)).e(); + for (i = 0; i < this.l.size(); ++i) { + ((ITickable) this.l.get(i)).X_(); } - SpigotTimings.tickablesTimer.stopTiming(); // Spigot + MinecraftTimings.tickablesTimer.stopTiming(); // Spigot - this.methodProfiler.b(); + this.methodProfiler.e(); } diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index eeac34998..e4ed2e991 100644 +index ac6d8cc6e..d975c2ccf 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -0,0 +0,0 @@ package net.minecraft.server; +import co.aikar.timings.Timing; - import com.google.common.base.Predicate; import com.google.common.collect.AbstractIterator; import com.google.common.collect.ComparisonChain; + import com.google.common.collect.Lists; @@ -0,0 +0,0 @@ public class PlayerChunkMap { PlayerChunk playerchunk; @@ -924,12 +935,9 @@ index eeac34998..e4ed2e991 100644 if (this.l && i % 4L == 0L) { this.l = false; + try (Timing ignored = world.timings.doChunkMapSortMissing.startTiming()) { // Paper - Collections.sort(this.h, new Comparator() { - public int a(PlayerChunk playerchunk, PlayerChunk playerchunk1) { - return ComparisonChain.start().compare(playerchunk.g(), playerchunk1.g()).result(); -@@ -0,0 +0,0 @@ public class PlayerChunkMap { - return this.a((PlayerChunk) object, (PlayerChunk) object1); - } + // CraftBukkit start + Collections.sort(this.h, (playerchunkx, playerchunk1x) -> { + return ComparisonChain.start().compare(playerchunkx.g(), playerchunk1x.g()).result(); }); + } // Paper timing } @@ -937,14 +945,11 @@ index eeac34998..e4ed2e991 100644 if (this.m && i % 4L == 2L) { this.m = false; + try (Timing ignored = world.timings.doChunkMapSortSendToPlayers.startTiming()) { // Paper - Collections.sort(this.g, new Comparator() { - public int a(PlayerChunk playerchunk, PlayerChunk playerchunk1) { - return ComparisonChain.start().compare(playerchunk.g(), playerchunk1.g()).result(); -@@ -0,0 +0,0 @@ public class PlayerChunkMap { - return this.a((PlayerChunk) object, (PlayerChunk) object1); - } + Collections.sort(this.g, (playerchunkx, playerchunk1x) -> { + return ComparisonChain.start().compare(playerchunkx.g(), playerchunk1x.g()).result(); }); + } // Paper timing + // CraftBukkit end } if (!this.h.isEmpty()) { @@ -976,7 +981,7 @@ index eeac34998..e4ed2e991 100644 + try (Timing ignored = world.timings.doChunkMapUnloadChunks.startTiming()) { // Paper WorldProvider worldprovider = this.world.worldProvider; - if (!worldprovider.e()) { + if (!worldprovider.p()) { this.world.getChunkProviderServer().b(); } + } // Paper timing @@ -984,7 +989,7 @@ index eeac34998..e4ed2e991 100644 } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index ec3e08336..dacf9261a 100644 +index 227bc857e..2adb21e55 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -0,0 +0,0 @@ import org.bukkit.inventory.CraftingInventory; @@ -1001,7 +1006,7 @@ index ec3e08336..dacf9261a 100644 private void handleCommand(String s) { - org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot + MinecraftTimings.playerCommandTimer.startTiming(); // Paper - // CraftBukkit start - whole method + // CraftBukkit start - whole method if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot this.LOGGER.info(this.player.getName() + " issued server command: " + s); @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -1013,26 +1018,17 @@ index ec3e08336..dacf9261a 100644 return; } - try { - if (this.server.dispatchCommand(event.getPlayer(), event.getMessage().substring(1))) { -- org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot -+ MinecraftTimings.playerCommandTimer.stopTiming(); // Paper - return; - } - } catch (org.bukkit.command.CommandException ex) { - player.sendMessage(org.bukkit.ChatColor.RED + "An internal error occurred while attempting to perform this command"); +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { java.util.logging.Logger.getLogger(PlayerConnection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + return; + } finally { - org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot + MinecraftTimings.playerCommandTimer.stopTiming(); // Paper - return; } -- org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot -+ MinecraftTimings.playerCommandTimer.stopTiming(); // Paper - // this.minecraftServer.getCommandHandler().a(this.player, s); + // this.minecraftServer.getCommandDispatcher().a(this.player.getCommandListener(), s); // CraftBukkit end - } diff --git a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java -index f74b06794..1fc632e0c 100644 +index 889b32287..69da194f5 100644 --- a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java +++ b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java @@ -0,0 +0,0 @@ @@ -1043,26 +1039,19 @@ index f74b06794..1fc632e0c 100644 + public class PlayerConnectionUtils { -- public static void ensureMainThread(final Packet packet, final T t0, IAsyncTaskHandler iasynctaskhandler) throws CancelledPacketHandleException { -+ // Paper start, fix decompile and add timings -+ public static void ensureMainThread(final Packet packet, final T listener, IAsyncTaskHandler iasynctaskhandler) throws CancelledPacketHandleException { +- public static void ensureMainThread(Packet packet, T t0, IAsyncTaskHandler iasynctaskhandler) throws CancelledPacketHandleException { ++ public static void ensureMainThread(Packet packet, T packetlistener, IAsyncTaskHandler iasynctaskhandler) throws CancelledPacketHandleException { // Paper fix name of param if (!iasynctaskhandler.isMainThread()) { -- iasynctaskhandler.postToMainThread(new Runnable() { -- public void run() { -- packet.a(packetlistener); -+ Timing timing = MinecraftTimings.getPacketTiming(packet); -+ iasynctaskhandler.postToMainThread(() -> { -+ try (Timing ignored = timing.startTiming()) { -+ packet.a(listener); - } ++ Timing timing = MinecraftTimings.getPacketTiming(packet); // Paper + iasynctaskhandler.postToMainThread(() -> { ++ try (Timing ignored = timing.startTiming()) { // Paper + packet.a(packetlistener); ++ } }); throw CancelledPacketHandleException.INSTANCE; } - } -+ // Paper end - } diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index d4acbed0c..1d9f3e3dd 100644 +index 0156175fb..1e3dd22e5 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ @@ -1084,51 +1073,63 @@ index d4acbed0c..1d9f3e3dd 100644 + MinecraftTimings.savePlayers.stopTiming(); // Paper } - public void addWhitelist(GameProfile gameprofile) { -diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java -index 74e3f42cd..66a80a776 100644 ---- a/src/main/java/net/minecraft/server/StructureGenerator.java -+++ b/src/main/java/net/minecraft/server/StructureGenerator.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; + public WhiteList getWhitelist() { +diff --git a/src/main/java/net/minecraft/server/TickListServer.java b/src/main/java/net/minecraft/server/TickListServer.java +index a07895935..ee5c2421b 100644 +--- a/src/main/java/net/minecraft/server/TickListServer.java ++++ b/src/main/java/net/minecraft/server/TickListServer.java +@@ -0,0 +0,0 @@ public class TickListServer implements TickList { + private final List> g = Lists.newArrayList(); + private final Consumer> h; -+import co.aikar.timings.MinecraftTimings; -+import co.aikar.timings.Timing; - import it.unimi.dsi.fastutil.longs.Long2ObjectMap; - import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; - import it.unimi.dsi.fastutil.objects.ObjectIterator; -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; - - public abstract class StructureGenerator extends WorldGenBase { - -+ private final Timing timing = MinecraftTimings.getStructureTiming(this); // Paper - private PersistentStructure a; - protected Long2ObjectMap c = new Long2ObjectOpenHashMap(1024); - - public StructureGenerator() {} - -+ public String getName() { return a(); } // Paper // OBFHELPER - public abstract String a(); - - protected final synchronized void a(World world, final int i, final int j, int k, int l, ChunkSnapshot chunksnapshot) { -@@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase { +- public TickListServer(WorldServer worldserver, Predicate predicate, Function function, Function function1, Consumer> consumer) { ++ public TickListServer(WorldServer worldserver, Predicate predicate, Function function, Function function1, Consumer> consumer, String timingsType) { // Paper + this.a = predicate; + this.b = function; + this.c = function1; + this.f = worldserver; + this.h = consumer; ++ // Paper start ++ timingCleanup = co.aikar.timings.WorldTimingsHandler.getTickList(worldserver, timingsType + " - Cleanup"); ++ timingTicking = co.aikar.timings.WorldTimingsHandler.getTickList(worldserver, timingsType + " - Ticking"); } ++ private final co.aikar.timings.Timing timingCleanup; // Paper ++ private final co.aikar.timings.Timing timingTicking; // Paper ++ // Paper end - public synchronized boolean a(World world, Random random, ChunkCoordIntPair chunkcoordintpair) { -+ timing.startTiming(); // Paper - this.a(world); - int i = (chunkcoordintpair.x << 4) + 8; - int j = (chunkcoordintpair.z << 4) + 8; -@@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase { - this.a(structurestart.e(), structurestart.f(), structurestart); + public void a() { + int i = this.nextTickList.size(); +@@ -0,0 +0,0 @@ public class TickListServer implements TickList { } - } -+ timing.stopTiming(); // Paper - return flag; + this.f.methodProfiler.a("cleaning"); +- ++ timingCleanup.startTiming(); // Paper + NextTickListEntry nextticklistentry; // CraftBukkit - decompile error + + for (int j = 0; j < i; ++j) { +@@ -0,0 +0,0 @@ public class TickListServer implements TickList { + // this.nextTickListHash.remove(nextticklistentry); // CraftBukkit - use nextTickList + this.g.add(nextticklistentry); + } ++ timingCleanup.stopTiming(); // Paper + + this.f.methodProfiler.e(); + this.f.methodProfiler.a("ticking"); ++ timingTicking.startTiming(); // Paper + Iterator iterator = this.g.iterator(); + + while (iterator.hasNext()) { +@@ -0,0 +0,0 @@ public class TickListServer implements TickList { + + this.f.methodProfiler.e(); + this.g.clear(); ++ timingTicking.stopTiming(); // Paper + } } + diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index d7132c3c0..15f18ba1d 100644 +index b992360ac..5b7f6ca84 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -0,0 +0,0 @@ import javax.annotation.Nullable; @@ -1145,12 +1146,19 @@ index d7132c3c0..15f18ba1d 100644 - public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot + public Timing tickTimer = MinecraftTimings.getTileEntityTimings(this); // Paper private static final Logger a = LogManager.getLogger(); - private static final RegistryMaterials> f = new RegistryMaterials(); + private final TileEntityTypes e; public TileEntityTypes getTileEntityType() { return e; } // Paper - OBFHELPER protected World world; diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 843320ffb..d902e2630 100644 +index 330ea4e72..e6b916a5d 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java +@@ -0,0 +0,0 @@ + package net.minecraft.server; + ++import co.aikar.timings.Timings; + import com.google.common.base.MoreObjects; + import com.google.common.collect.Lists; + import java.util.ArrayList; @@ -0,0 +0,0 @@ import com.google.common.collect.Maps; import java.util.Map; import org.bukkit.Bukkit; @@ -1158,13 +1166,15 @@ index 843320ffb..d902e2630 100644 -import org.bukkit.craftbukkit.SpigotTimings; // Spigot import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; + import org.bukkit.craftbukkit.block.CraftBlockState; + import org.bukkit.craftbukkit.block.data.CraftBlockData; import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.util.CraftMagicNumbers; +import org.bukkit.craftbukkit.util.LongHashSet; // Paper import org.bukkit.event.block.BlockCanBuildEvent; import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper @@ -1173,7 +1183,7 @@ index 843320ffb..d902e2630 100644 private boolean guardEntityList; // Spigot public static boolean haveWeSilencedAPhysicsCrash; public static String blockLocation; -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose }); this.getServer().addWorld(this.world); // CraftBukkit end @@ -1182,23 +1192,23 @@ index 843320ffb..d902e2630 100644 this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); } -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose } this.methodProfiler.c("remove"); + timings.entityRemoval.startTiming(); // Paper - this.entityList.removeAll(this.f); + this.entityList.removeAll(this.g); int j; -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose - this.f.clear(); - this.l(); + this.g.clear(); + this.p_(); + timings.entityRemoval.stopTiming(); // Paper this.methodProfiler.c("regular"); CrashReportSystemDetails crashreportsystemdetails1; -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose timings.entityTick.startTiming(); // Spigot guardEntityList = true; // Spigot // CraftBukkit start - Use field for loop variable @@ -1206,13 +1216,13 @@ index 843320ffb..d902e2630 100644 int entitiesThisCycle = 0; if (tickPosition < 0) tickPosition = 0; for (entityLimiter.initTick(); -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose this.methodProfiler.a("tick"); if (!entity.dead && !(entity instanceof EntityPlayer)) { try { - SpigotTimings.tickEntityTimer.startTiming(); // Spigot + entity.tickTimer.startTiming(); // Paper - this.h(entity); + this.g(entity); - SpigotTimings.tickEntityTimer.stopTiming(); // Spigot + entity.tickTimer.stopTiming(); // Paper } catch (Throwable throwable1) { @@ -1220,31 +1230,31 @@ index 843320ffb..d902e2630 100644 crashreport1 = CrashReport.a(throwable1, "Ticking entity"); crashreportsystemdetails1 = crashreport1.a("Entity being ticked"); entity.appendEntityCrashDetails(crashreportsystemdetails1); -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose } timings.tileEntityPending.stopTiming(); // Spigot + co.aikar.timings.TimingHistory.tileEntityTicks += this.tileEntityListTick.size(); // Paper - this.methodProfiler.b(); - this.methodProfiler.b(); + this.methodProfiler.e(); + this.methodProfiler.e(); } -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose } // CraftBukkit end - entity.tickTimer.startTiming(); // Spigot - entity.M = entity.locX; - entity.N = entity.locY; - entity.O = entity.locZ; -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + entity.N = entity.locX; + entity.O = entity.locY; + entity.P = entity.locZ; +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose entity.lastPitch = entity.pitch; - if (flag && entity.aa) { + if (flag && entity.inChunk) { ++entity.ticksLived; + ++co.aikar.timings.TimingHistory.activatedEntityTicks; // Paper if (entity.isPassenger()) { - entity.aE(); + entity.aH(); } else { -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose } } } @@ -1252,24 +1262,49 @@ index 843320ffb..d902e2630 100644 - } - public boolean b(AxisAlignedBB axisalignedbb) { + public boolean a(@Nullable Entity entity, VoxelShape voxelshape) { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index c891629bd..95964c550 100644 +index 784289c0d..d7f86bf76 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -0,0 +0,0 @@ + package net.minecraft.server; + ++import co.aikar.timings.Timings; + import com.google.common.collect.Lists; + import com.google.common.collect.Maps; + import com.google.common.util.concurrent.ListenableFuture; +@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { + RegistryBlocks registryblocks1 = Block.REGISTRY; // CraftBukkit - decompile error + + Block.REGISTRY.getClass(); +- this.nextTickListBlock = new TickListServer<>(this, predicate, function, registryblocks1::get, this::b); // CraftBukkit - decompile error ++ this.nextTickListBlock = new TickListServer<>(this, predicate, function, registryblocks1::get, this::b, "Blocks"); // CraftBukkit - decompile error // Paper - Timings v2 + Predicate predicate2 = (fluidtype) -> { + return fluidtype == null || fluidtype == FluidTypes.a; + }; +@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { + function = registryblocks::b; + RegistryBlocks registryblocks2 = FluidType.c; // CraftBukkit - decompile error + FluidType.c.getClass(); +- this.nextTickListFluid = new TickListServer<>(this, predicate2, function, registryblocks2::get, this::a); // CraftBukkit - decompile error ++ this.nextTickListFluid = new TickListServer<>(this, predicate2, function, registryblocks2::get, this::a, "Fluids"); // CraftBukkit - decompile error // Paper - Timings v2 + this.siegeManager = new VillageSiege(this); + this.d = new ObjectLinkedOpenHashSet(); + this.server = minecraftserver; @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { timings.doChunkUnload.stopTiming(); // Spigot this.methodProfiler.c("tickPending"); - timings.doTickPending.startTiming(); // Spigot + timings.scheduledBlocks.startTiming(); // Paper - this.a(false); + this.p(); - timings.doTickPending.stopTiming(); // Spigot + timings.scheduledBlocks.stopTiming(); // Paper this.methodProfiler.c("tickBlocks"); - timings.doTickTiles.startTiming(); // Spigot + timings.chunkTicks.startTiming(); // Paper - this.j(); + this.l(); - timings.doTickTiles.stopTiming(); // Spigot + timings.chunkTicks.stopTiming(); // Paper this.methodProfiler.c("chunkMap"); @@ -1291,56 +1326,13 @@ index c891629bd..95964c550 100644 + timings.chunkTicksBlocks.stopTiming(); // Paper } - this.methodProfiler.b(); -@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { - - this.methodProfiler.a("cleaning"); - -+ timings.scheduledBlocksCleanup.startTiming(); // Paper - NextTickListEntry nextticklistentry; - - for (int j = 0; j < i; ++j) { -@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { - // this.nextTickListHash.remove(nextticklistentry); - this.W.add(nextticklistentry); - } -+ timings.scheduledBlocksCleanup.stopTiming(); // Paper - - this.methodProfiler.b(); - this.methodProfiler.a("ticking"); - Iterator iterator = this.W.iterator(); -+ timings.scheduledBlocksTicking.startTiming(); // Paper - - while (iterator.hasNext()) { - nextticklistentry = (NextTickListEntry) iterator.next(); -@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { - - if (this.areChunksLoadedBetween(nextticklistentry.a.a(0, 0, 0), nextticklistentry.a.a(0, 0, 0))) { - IBlockData iblockdata = this.getType(nextticklistentry.a); -+ co.aikar.timings.Timing timing = iblockdata.getBlock().getTiming(); // Paper -+ timing.startTiming(); // Paper - - if (iblockdata.getMaterial() != Material.AIR && Block.a(iblockdata.getBlock(), nextticklistentry.a())) { - try { -@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { - throw new ReportedException(crashreport); - } - } -+ timing.stopTiming(); // Paper - } else { - this.a(nextticklistentry.a, nextticklistentry.a(), 0); - } - } -+ timings.scheduledBlocksTicking.stopTiming(); // Paper - - this.methodProfiler.b(); - this.W.clear(); + this.methodProfiler.e(); @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { gen = new org.bukkit.craftbukkit.generator.NormalChunkGenerator(this, this.getSeed()); } -- return new ChunkProviderServer(this, ichunkloader, gen); -+ return new ChunkProviderServer(this, ichunkloader, new co.aikar.timings.TimedChunkGenerator(this, gen)); // Paper +- return new ChunkProviderServer(this, ichunkloader, gen, this.server); ++ return new ChunkProviderServer(this, ichunkloader, new co.aikar.timings.TimedChunkGenerator(this, gen), this.server); // Paper // CraftBukkit end } @@ -1350,10 +1342,10 @@ index c891629bd..95964c550 100644 org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit + timings.worldSave.startTiming(); // Paper if (iprogressupdate != null) { - iprogressupdate.a("Saving level"); + iprogressupdate.a(new ChatMessage("menu.savingLevel", new Object[0])); } @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { - iprogressupdate.c("Saving chunks"); + iprogressupdate.c(new ChatMessage("menu.savingChunks", new Object[0])); } + timings.worldSaveChunks.startTiming(); // Paper @@ -1380,7 +1372,7 @@ index c891629bd..95964c550 100644 WorldServer[] aworldserver = this.server.worldServer; int i = aworldserver.length; @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { - this.worldData.e(this.getWorldBorder().i()); + this.worldData.c(this.server.aR().c()); this.dataManager.saveWorldData(this.worldData, this.server.getPlayerList().t()); this.worldMaps.a(); + timings.worldSaveLevel.stopTiming(); // Paper @@ -1388,7 +1380,7 @@ index c891629bd..95964c550 100644 // CraftBukkit start diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 14851a3a5..9042deed6 100644 +index dad2dc959..88ea651ba 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { @@ -1604,7 +1596,7 @@ index 4c8ab2bc9..000000000 - } -} diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java -index 3a95b4465..b5efb9c3f 100644 +index 413dd35f0..52a8c48fa 100644 --- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java +++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java @@ -0,0 +0,0 @@ @@ -1623,43 +1615,26 @@ index 3a95b4465..b5efb9c3f 100644 - try { + try (Timing ignored = queuedChunk.provider.world.timings.chunkIOStage1.startTimingIfSync()) { // Paper ChunkRegionLoader loader = queuedChunk.loader; - Object[] data = loader.loadChunk(queuedChunk.world, queuedChunk.x, queuedChunk.z); + Object[] data = loader.loadChunk(queuedChunk.world, queuedChunk.x, queuedChunk.z, (chunk) -> {}); @@ -0,0 +0,0 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider= level; } -@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke this.length = 1.8F; - this.ax = 1; - this.ay = 1.0F; + this.aA = 1.0F; + this.aB = 1.0F; - this.random = new Random(); + this.random = SHARED_RANDOM; // Paper this.fireTicks = -this.getMaxFireTicks(); diff --git a/Spigot-Server-Patches/Water-mobs-should-only-spawn-in-the-water.patch b/Spigot-Server-Patches/Water-mobs-should-only-spawn-in-the-water.patch deleted file mode 100644 index fcadc09d4b..0000000000 --- a/Spigot-Server-Patches/Water-mobs-should-only-spawn-in-the-water.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Thu, 14 Apr 2016 17:48:56 -0500 -Subject: [PATCH] Water mobs should only spawn in the water - - -diff --git a/src/main/java/net/minecraft/server/EntityWaterAnimal.java b/src/main/java/net/minecraft/server/EntityWaterAnimal.java -index f430bdeec..0597edad6 100644 ---- a/src/main/java/net/minecraft/server/EntityWaterAnimal.java -+++ b/src/main/java/net/minecraft/server/EntityWaterAnimal.java -@@ -0,0 +0,0 @@ public abstract class EntityWaterAnimal extends EntityInsentient implements IAni - } - - public boolean P() { -- return true; -+ // Paper start - Don't let water mobs spawn in non-water blocks -+ // Based around EntityAnimal's implementation -+ int i = MathHelper.floor(this.locX); -+ int j = MathHelper.floor(this.getBoundingBox().b); // minY of bounding box -+ int k = MathHelper.floor(this.locZ); -+ Block block = this.world.getType(new BlockPosition(i, j, k)).getBlock(); -+ -+ return block == Blocks.WATER || block == Blocks.FLOWING_WATER; -+ // Paper end - } - - public boolean canSpawn() { --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Workaround-for-setting-passengers-on-players.patch b/Spigot-Server-Patches/Workaround-for-setting-passengers-on-players.patch index 7c8d35e35f..f663255132 100644 --- a/Spigot-Server-Patches/Workaround-for-setting-passengers-on-players.patch +++ b/Spigot-Server-Patches/Workaround-for-setting-passengers-on-players.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Workaround for setting passengers on players SPIGOT-1915 & GH-114 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index e1d34d46d..6e2773cbb 100644 +index e71fc971d..3871f3100 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/Spigot-Server-Patches/handle-NaN-health-absorb-values-and-repair-bad-data.patch b/Spigot-Server-Patches/handle-NaN-health-absorb-values-and-repair-bad-data.patch index a9a1192b87..4670bbc9c8 100644 --- a/Spigot-Server-Patches/handle-NaN-health-absorb-values-and-repair-bad-data.patch +++ b/Spigot-Server-Patches/handle-NaN-health-absorb-values-and-repair-bad-data.patch @@ -5,7 +5,7 @@ Subject: [PATCH] handle NaN health/absorb values and repair bad data diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 7e2cc66d7..a92b89d7c 100644 +index a0af21301..acf0e0281 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -44,7 +44,7 @@ index 7e2cc66d7..a92b89d7c 100644 } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index ff4512060..e1d34d46d 100644 +index f6a7f08f9..e71fc971d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/pre/Bukkit-Patches/0001-POM-Changes.patch b/pre/Bukkit-Patches/0001-POM-Changes.patch deleted file mode 100644 index c7f5c64f5f..0000000000 --- a/pre/Bukkit-Patches/0001-POM-Changes.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 2 Jun 2013 10:36:24 +1000 -Subject: [PATCH] POM Changes - - -diff --git a/pom.xml b/pom.xml -index 2ed1e4de..88b109e0 100644 ---- a/pom.xml -+++ b/pom.xml -@@ -0,0 +0,0 @@ - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - 4.0.0 - -- org.bukkit -- bukkit -+ org.spigotmc -+ spigot-api - 1.13-pre5-R0.1-SNAPSHOT - jar - -- Bukkit -+ Spigot-API - https://www.spigotmc.org/ -- A plugin API for Minecraft servers. -+ An enhanced plugin API for Minecraft servers. - - - 1.8 --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0002-Skeleton-API-Implementations.patch b/pre/Bukkit-Patches/0002-Skeleton-API-Implementations.patch deleted file mode 100644 index 8650ec95d8..0000000000 --- a/pre/Bukkit-Patches/0002-Skeleton-API-Implementations.patch +++ /dev/null @@ -1,187 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Mon, 15 May 2017 15:16:15 +1000 -Subject: [PATCH] Skeleton API Implementations - - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index a3eafe70..3ffce71b 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -0,0 +0,0 @@ public final class Bukkit { - public static UnsafeValues getUnsafe() { - return server.getUnsafe(); - } -+ -+ public static Server.Spigot spigot() -+ { -+ return server.spigot(); -+ } - } -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index dc2e1018..61d8077a 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { - */ - @Deprecated - UnsafeValues getUnsafe(); -+ -+ // Spigot start -+ public class Spigot -+ { -+ -+ } -+ -+ Spigot spigot(); -+ // Spigot end - } -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 4883d182..ab6b1e3a 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable { - */ - public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data); - -+ // Spigot start -+ public class Spigot -+ { -+ -+ } -+ -+ Spigot spigot(); -+ // Spigot end - - /** - * Represents various map environment types that a world may be -diff --git a/src/main/java/org/bukkit/command/CommandSender.java b/src/main/java/org/bukkit/command/CommandSender.java -index 148756b9..5dcd2218 100644 ---- a/src/main/java/org/bukkit/command/CommandSender.java -+++ b/src/main/java/org/bukkit/command/CommandSender.java -@@ -0,0 +0,0 @@ public interface CommandSender extends Permissible { - * @return Name of the sender - */ - public String getName(); -+ -+ // Spigot start -+ public class Spigot -+ { -+ -+ } -+ -+ Spigot spigot(); -+ // Spigot end - } -diff --git a/src/main/java/org/bukkit/entity/Arrow.java b/src/main/java/org/bukkit/entity/Arrow.java -index 752eeb5e..c77f3a4f 100644 ---- a/src/main/java/org/bukkit/entity/Arrow.java -+++ b/src/main/java/org/bukkit/entity/Arrow.java -@@ -0,0 +0,0 @@ public interface Arrow extends Projectile { - */ - CREATIVE_ONLY - } -+ -+ // Spigot start -+ public class Spigot extends Entity.Spigot -+ { -+ -+ } -+ -+ @Override -+ Spigot spigot(); -+ // Spigot end - } -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 9d96976d..294eb7f7 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -0,0 +0,0 @@ public interface Entity extends Metadatable, CommandSender, Nameable { - * @return reaction - */ - PistonMoveReaction getPistonMoveReaction(); -+ -+ // Spigot start -+ public class Spigot extends CommandSender.Spigot -+ { -+ -+ } -+ -+ @Override -+ Spigot spigot(); -+ // Spigot end - } -diff --git a/src/main/java/org/bukkit/entity/LightningStrike.java b/src/main/java/org/bukkit/entity/LightningStrike.java -index c8b5154e..ee2218c1 100644 ---- a/src/main/java/org/bukkit/entity/LightningStrike.java -+++ b/src/main/java/org/bukkit/entity/LightningStrike.java -@@ -0,0 +0,0 @@ public interface LightningStrike extends Weather { - */ - public boolean isEffect(); - -+ // Spigot start -+ public class Spigot extends Entity.Spigot -+ { -+ -+ } -+ -+ @Override -+ Spigot spigot(); -+ // Spigot end - } -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index b862d7b6..92825490 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - * @return the player's locale - */ - public String getLocale(); -+ -+ // Spigot start -+ public class Spigot extends Entity.Spigot -+ { -+ -+ } -+ -+ @Override -+ Spigot spigot(); -+ // Spigot end - } -diff --git a/src/main/java/org/bukkit/inventory/meta/BookMeta.java b/src/main/java/org/bukkit/inventory/meta/BookMeta.java -index d66e3f59..3b6bf419 100644 ---- a/src/main/java/org/bukkit/inventory/meta/BookMeta.java -+++ b/src/main/java/org/bukkit/inventory/meta/BookMeta.java -@@ -0,0 +0,0 @@ public interface BookMeta extends ItemMeta { - int getPageCount(); - - BookMeta clone(); -+ -+ // Spigot start -+ public class Spigot extends ItemMeta.Spigot { -+ -+ } -+ -+ @Override -+ Spigot spigot(); -+ // Spigot end - } -diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -index 76d43266..e48616d2 100644 ---- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -@@ -0,0 +0,0 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable { - - @SuppressWarnings("javadoc") - ItemMeta clone(); -+ -+ // Spigot start -+ public class Spigot -+ { -+ -+ } -+ -+ Spigot spigot(); -+ // Spigot end - } --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0003-Spigot-Timings.patch b/pre/Bukkit-Patches/0003-Spigot-Timings.patch deleted file mode 100644 index 61ac99e498..0000000000 --- a/pre/Bukkit-Patches/0003-Spigot-Timings.patch +++ /dev/null @@ -1,483 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 2 Jun 2013 10:42:57 +1000 -Subject: [PATCH] Spigot Timings - -Adds performance tracking timings all around the Minecraft Server, and improves the usability of the /timings command - -Plugins can track their own timings with CustomTimingsHandler - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 3ffce71b..27c69e96 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -0,0 +0,0 @@ public final class Bukkit { - */ - public static void reload() { - server.reload(); -+ org.spigotmc.CustomTimingsHandler.reload(); // Spigot - } - - /** -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 61d8077a..c9ef86e4 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { - public class Spigot - { - -+ public org.bukkit.configuration.file.YamlConfiguration getConfig() -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } - } - - Spigot spigot(); -diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java -index d00bad28..7ca5be84 100644 ---- a/src/main/java/org/bukkit/command/Command.java -+++ b/src/main/java/org/bukkit/command/Command.java -@@ -0,0 +0,0 @@ public abstract class Command { - protected String usageMessage; - private String permission; - private String permissionMessage; -+ public org.spigotmc.CustomTimingsHandler timings; // Spigot - - protected Command(String name) { - this(name, "", "/" + name, new ArrayList()); -@@ -0,0 +0,0 @@ public abstract class Command { - this.usageMessage = usageMessage; - this.aliases = aliases; - this.activeAliases = new ArrayList(aliases); -+ this.timings = new org.spigotmc.CustomTimingsHandler("** Command: " + name); // Spigot - } - - /** -@@ -0,0 +0,0 @@ public abstract class Command { - public boolean setLabel(String name) { - this.nextLabel = name; - if (!isRegistered()) { -+ this.timings = new org.spigotmc.CustomTimingsHandler("** Command: " + name); // Spigot - this.label = name; - return true; - } -diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java -index f81ae85d..1b5b37bf 100644 ---- a/src/main/java/org/bukkit/command/SimpleCommandMap.java -+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java -@@ -0,0 +0,0 @@ public class SimpleCommandMap implements CommandMap { - } - - try { -+ target.timings.startTiming(); // Spigot - // Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false) - target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length)); -+ target.timings.stopTiming(); // Spigot - } catch (CommandException ex) { -+ target.timings.stopTiming(); // Spigot - throw ex; - } catch (Throwable ex) { -+ target.timings.stopTiming(); // Spigot - throw new CommandException("Unhandled exception executing '" + commandLine + "' in " + target, ex); - } - -diff --git a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java -index 66ea6345..bba914d7 100644 ---- a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java -+++ b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java -@@ -0,0 +0,0 @@ import org.bukkit.util.StringUtil; - - import com.google.common.collect.ImmutableList; - -+// Spigot start -+import java.io.ByteArrayOutputStream; -+import java.io.OutputStream; -+import java.net.HttpURLConnection; -+import java.net.URL; -+import java.net.URLEncoder; -+import java.util.logging.Level; -+ -+import org.bukkit.command.RemoteConsoleCommandSender; -+import org.bukkit.plugin.SimplePluginManager; -+import org.spigotmc.CustomTimingsHandler; -+// Spigot end -+ - public class TimingsCommand extends BukkitCommand { -- private static final List TIMINGS_SUBCOMMANDS = ImmutableList.of("merged", "reset", "separate"); -+ private static final List TIMINGS_SUBCOMMANDS = ImmutableList.of("report", "reset", "on", "off", "paste"); // Spigot -+ public static long timingStart = 0; // Spigot - - public TimingsCommand(String name) { - super(name); -- this.description = "Records timings for all plugin events"; -- this.usageMessage = "/timings "; -+ this.description = "Manages Spigot Timings data to see performance of the server."; // Spigot -+ this.usageMessage = "/timings "; // Spigot - this.setPermission("bukkit.command.timings"); - } - -+ // Spigot start - redesigned Timings Command -+ public void executeSpigotTimings(CommandSender sender, String[] args) { -+ if ( "on".equals( args[0] ) ) -+ { -+ ( (SimplePluginManager) Bukkit.getPluginManager() ).useTimings( true ); -+ CustomTimingsHandler.reload(); -+ sender.sendMessage( "Enabled Timings & Reset" ); -+ return; -+ } else if ( "off".equals( args[0] ) ) -+ { -+ ( (SimplePluginManager) Bukkit.getPluginManager() ).useTimings( false ); -+ sender.sendMessage( "Disabled Timings" ); -+ return; -+ } -+ -+ if ( !Bukkit.getPluginManager().useTimings() ) -+ { -+ sender.sendMessage( "Please enable timings by typing /timings on" ); -+ return; -+ } -+ -+ boolean paste = "paste".equals( args[0] ); -+ if ("reset".equals(args[0])) { -+ CustomTimingsHandler.reload(); -+ sender.sendMessage("Timings reset"); -+ } else if ("merged".equals(args[0]) || "report".equals(args[0]) || paste) { -+ long sampleTime = System.nanoTime() - timingStart; -+ int index = 0; -+ File timingFolder = new File("timings"); -+ timingFolder.mkdirs(); -+ File timings = new File(timingFolder, "timings.txt"); -+ ByteArrayOutputStream bout = ( paste ) ? new ByteArrayOutputStream() : null; -+ while (timings.exists()) timings = new File(timingFolder, "timings" + (++index) + ".txt"); -+ PrintStream fileTimings = null; -+ try { -+ fileTimings = ( paste ) ? new PrintStream( bout ) : new PrintStream( timings ); -+ -+ CustomTimingsHandler.printTimings(fileTimings); -+ fileTimings.println( "Sample time " + sampleTime + " (" + sampleTime / 1E9 + "s)" ); -+ -+ fileTimings.println( "" ); -+ fileTimings.println( Bukkit.spigot().getConfig().saveToString() ); -+ fileTimings.println( "" ); -+ -+ if ( paste ) -+ { -+ new PasteThread( sender, bout ).start(); -+ return; -+ } -+ -+ sender.sendMessage("Timings written to " + timings.getPath()); -+ sender.sendMessage( "Paste contents of file into form at http://www.spigotmc.org/go/timings to read results." ); -+ -+ } catch (IOException e) { -+ } finally { -+ if (fileTimings != null) { -+ fileTimings.close(); -+ } -+ } -+ } -+ } -+ // Spigot end -+ - @Override - public boolean execute(CommandSender sender, String currentAlias, String[] args) { - if (!testPermission(sender)) return true; -- if (args.length != 1) { -+ if (args.length < 1) { // Spigot - sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage); - return false; - } -+ if (true) { executeSpigotTimings(sender, args); return true; } // Spigot - if (!sender.getServer().getPluginManager().useTimings()) { - sender.sendMessage("Please enable timings by setting \"settings.plugin-profiling\" to true in bukkit.yml"); - return true; -@@ -0,0 +0,0 @@ public class TimingsCommand extends BukkitCommand { - } - return ImmutableList.of(); - } -+ -+ // Spigot start -+ private static class PasteThread extends Thread -+ { -+ -+ private final CommandSender sender; -+ private final ByteArrayOutputStream bout; -+ -+ public PasteThread(CommandSender sender, ByteArrayOutputStream bout) -+ { -+ super( "Timings paste thread" ); -+ this.sender = sender; -+ this.bout = bout; -+ } -+ -+ @Override -+ public synchronized void start() { -+ if (sender instanceof RemoteConsoleCommandSender) { -+ run(); -+ } else { -+ super.start(); -+ } -+ } -+ -+ @Override -+ public void run() -+ { -+ try -+ { -+ HttpURLConnection con = (HttpURLConnection) new URL( "https://timings.spigotmc.org/paste" ).openConnection(); -+ con.setDoOutput( true ); -+ con.setRequestMethod( "POST" ); -+ con.setInstanceFollowRedirects( false ); -+ -+ OutputStream out = con.getOutputStream(); -+ out.write( bout.toByteArray() ); -+ out.close(); -+ -+ com.google.gson.JsonObject location = new com.google.gson.Gson().fromJson(new java.io.InputStreamReader(con.getInputStream()), com.google.gson.JsonObject.class); -+ con.getInputStream().close(); -+ -+ String pasteID = location.get( "key" ).getAsString(); -+ sender.sendMessage( ChatColor.GREEN + "Timings results can be viewed at https://www.spigotmc.org/go/timings?url=" + pasteID ); -+ } catch ( IOException ex ) -+ { -+ sender.sendMessage( ChatColor.RED + "Error pasting timings, check your console for more information" ); -+ Bukkit.getServer().getLogger().log( Level.WARNING, "Could not paste timings", ex ); -+ } -+ } -+ } -+ // Spigot end - } -diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index 60b23995..8b130abb 100644 ---- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java -+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager { - } - } - -+ org.bukkit.command.defaults.TimingsCommand.timingStart = System.nanoTime(); // Spigot - return result.toArray(new Plugin[result.size()]); - } - -diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index df613b0c..73372534 100644 ---- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -@@ -0,0 +0,0 @@ import org.bukkit.plugin.PluginLoader; - import org.bukkit.plugin.RegisteredListener; - import org.bukkit.plugin.TimedRegisteredListener; - import org.bukkit.plugin.UnknownDependencyException; -+import org.spigotmc.CustomTimingsHandler; // Spigot - import org.yaml.snakeyaml.error.YAMLException; - - /** -@@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader { - private final Pattern[] fileFilters = new Pattern[] { Pattern.compile("\\.jar$"), }; - private final Map> classes = new HashMap>(); - private final List loaders = new CopyOnWriteArrayList(); -+ public static final CustomTimingsHandler pluginParentTimer = new CustomTimingsHandler("** Plugins"); // Spigot - - /** - * This class was not meant to be constructed explicitly -@@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader { - } - } - -+ final CustomTimingsHandler timings = new CustomTimingsHandler("Plugin: " + plugin.getDescription().getFullName() + " Event: " + listener.getClass().getName() + "::" + method.getName()+"("+eventClass.getSimpleName()+")", pluginParentTimer); // Spigot - EventExecutor executor = new EventExecutor() { - public void execute(Listener listener, Event event) throws EventException { - try { - if (!eventClass.isAssignableFrom(event.getClass())) { - return; - } -+ // Spigot start -+ boolean isAsync = event.isAsynchronous(); -+ if (!isAsync) timings.startTiming(); - method.invoke(listener, event); -+ if (!isAsync) timings.stopTiming(); -+ // Spigot end - } catch (InvocationTargetException ex) { - throw new EventException(ex.getCause()); - } catch (Throwable t) { -@@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader { - } - } - }; -- if (useTimings) { -+ if (false) { // Spigot - RL handles useTimings check now - eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); - } else { - eventSet.add(new RegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); -diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java -new file mode 100644 -index 00000000..8d982974 ---- /dev/null -+++ b/src/main/java/org/spigotmc/CustomTimingsHandler.java -@@ -0,0 +0,0 @@ -+package org.spigotmc; -+ -+import org.bukkit.command.defaults.TimingsCommand; -+import org.bukkit.event.HandlerList; -+import org.bukkit.plugin.Plugin; -+import org.bukkit.plugin.RegisteredListener; -+import org.bukkit.plugin.TimedRegisteredListener; -+import java.io.PrintStream; -+import java.util.Collection; -+import java.util.HashSet; -+import java.util.List; -+import java.util.Queue; -+import java.util.concurrent.ConcurrentLinkedQueue; -+ -+import org.bukkit.Bukkit; -+import org.bukkit.World; -+ -+/** -+ * Provides custom timing sections for /timings merged. -+ */ -+public class CustomTimingsHandler -+{ -+ -+ private static Queue HANDLERS = new ConcurrentLinkedQueue(); -+ /*========================================================================*/ -+ private final String name; -+ private final CustomTimingsHandler parent; -+ private long count = 0; -+ private long start = 0; -+ private long timingDepth = 0; -+ private long totalTime = 0; -+ private long curTickTotal = 0; -+ private long violations = 0; -+ -+ public CustomTimingsHandler(String name) -+ { -+ this( name, null ); -+ } -+ -+ public CustomTimingsHandler(String name, CustomTimingsHandler parent) -+ { -+ this.name = name; -+ this.parent = parent; -+ HANDLERS.add( this ); -+ } -+ -+ /** -+ * Prints the timings and extra data to the given stream. -+ * -+ * @param printStream -+ */ -+ public static void printTimings(PrintStream printStream) -+ { -+ printStream.println( "Minecraft" ); -+ for ( CustomTimingsHandler timings : HANDLERS ) -+ { -+ long time = timings.totalTime; -+ long count = timings.count; -+ if ( count == 0 ) -+ { -+ continue; -+ } -+ long avg = time / count; -+ -+ printStream.println( " " + timings.name + " Time: " + time + " Count: " + count + " Avg: " + avg + " Violations: " + timings.violations ); -+ } -+ printStream.println( "# Version " + Bukkit.getVersion() ); -+ int entities = 0; -+ int livingEntities = 0; -+ for ( World world : Bukkit.getWorlds() ) -+ { -+ entities += world.getEntities().size(); -+ livingEntities += world.getLivingEntities().size(); -+ } -+ printStream.println( "# Entities " + entities ); -+ printStream.println( "# LivingEntities " + livingEntities ); -+ } -+ -+ /** -+ * Resets all timings. -+ */ -+ public static void reload() -+ { -+ if ( Bukkit.getPluginManager().useTimings() ) -+ { -+ for ( CustomTimingsHandler timings : HANDLERS ) -+ { -+ timings.reset(); -+ } -+ } -+ TimingsCommand.timingStart = System.nanoTime(); -+ } -+ -+ /** -+ * Ticked every tick by CraftBukkit to count the number of times a timer -+ * caused TPS loss. -+ */ -+ public static void tick() -+ { -+ if ( Bukkit.getPluginManager().useTimings() ) -+ { -+ for ( CustomTimingsHandler timings : HANDLERS ) -+ { -+ if ( timings.curTickTotal > 50000000 ) -+ { -+ timings.violations += Math.ceil( timings.curTickTotal / 50000000 ); -+ } -+ timings.curTickTotal = 0; -+ timings.timingDepth = 0; // incase reset messes this up -+ } -+ } -+ } -+ -+ /** -+ * Starts timing to track a section of code. -+ */ -+ public void startTiming() -+ { -+ // If second condtion fails we are already timing -+ if ( Bukkit.getPluginManager().useTimings() && ++timingDepth == 1 ) -+ { -+ start = System.nanoTime(); -+ if ( parent != null && ++parent.timingDepth == 1 ) -+ { -+ parent.start = start; -+ } -+ } -+ } -+ -+ /** -+ * Stops timing a section of code. -+ */ -+ public void stopTiming() -+ { -+ if ( Bukkit.getPluginManager().useTimings() ) -+ { -+ if ( --timingDepth != 0 || start == 0 ) -+ { -+ return; -+ } -+ long diff = System.nanoTime() - start; -+ totalTime += diff; -+ curTickTotal += diff; -+ count++; -+ start = 0; -+ if ( parent != null ) -+ { -+ parent.stopTiming(); -+ } -+ } -+ } -+ -+ /** -+ * Reset this timer, setting all values to zero. -+ */ -+ public void reset() -+ { -+ count = 0; -+ violations = 0; -+ curTickTotal = 0; -+ totalTime = 0; -+ start = 0; -+ timingDepth = 0; -+ } -+} --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0004-Add-PlayerItemDamageEvent.patch b/pre/Bukkit-Patches/0004-Add-PlayerItemDamageEvent.patch deleted file mode 100644 index f05276e606..0000000000 --- a/pre/Bukkit-Patches/0004-Add-PlayerItemDamageEvent.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Mon, 4 Mar 2013 18:31:20 +1100 -Subject: [PATCH] Add PlayerItemDamageEvent - - -diff --git a/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java b/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java -new file mode 100644 -index 00000000..38a72ab8 ---- /dev/null -+++ b/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java -@@ -0,0 +0,0 @@ -+package org.bukkit.event.player; -+ -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.inventory.ItemStack; -+ -+public class PlayerItemDamageEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList handlers = new HandlerList(); -+ private final ItemStack item; -+ private int damage; -+ private boolean cancelled = false; -+ -+ public PlayerItemDamageEvent(Player player, ItemStack what, int damage) { -+ super(player); -+ this.item = what; -+ this.damage = damage; -+ } -+ -+ public ItemStack getItem() { -+ return item; -+ } -+ -+ /** -+ * Gets the amount of durability damage this item will be taking. -+ * -+ * @return durability change -+ */ -+ public int getDamage() { -+ return damage; -+ } -+ -+ public void setDamage(int damage) { -+ this.damage = damage; -+ } -+ -+ public boolean isCancelled() { -+ return cancelled; -+ } -+ -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return handlers; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return handlers; -+ } -+} --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0005-BungeeCord-Support.patch b/pre/Bukkit-Patches/0005-BungeeCord-Support.patch deleted file mode 100644 index 1290d2f41a..0000000000 --- a/pre/Bukkit-Patches/0005-BungeeCord-Support.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 2 Jun 2013 15:20:49 +1000 -Subject: [PATCH] BungeeCord Support - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 92825490..0215e0d0 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - public class Spigot extends Entity.Spigot - { - -+ /** -+ * Gets the connection address of this player, regardless of whether it -+ * has been spoofed or not. -+ * -+ * @return the player's connection address -+ */ -+ public InetSocketAddress getRawAddress() -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } - } - - @Override -diff --git a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java -index 8b012ea9..de4fb37f 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java -@@ -0,0 +0,0 @@ public class PlayerLoginEvent extends PlayerEvent { - private final String hostname; - private Result result = Result.ALLOWED; - private String message = ""; -+ private final InetAddress realAddress; // Spigot - - /** - * This constructor defaults message to an empty string, and result to -@@ -0,0 +0,0 @@ public class PlayerLoginEvent extends PlayerEvent { - * @param address The address the player used to connect, provided for - * timing issues - */ -- public PlayerLoginEvent(final Player player, final String hostname, final InetAddress address) { -+ public PlayerLoginEvent(final Player player, final String hostname, final InetAddress address, final InetAddress realAddress) { // Spigot - super(player); - this.hostname = hostname; - this.address = address; -+ // Spigot start -+ this.realAddress = realAddress; -+ } -+ -+ public PlayerLoginEvent(final Player player, final String hostname, final InetAddress address) { -+ this(player, hostname, address, address); -+ // Spigot end - } - - /** -@@ -0,0 +0,0 @@ public class PlayerLoginEvent extends PlayerEvent { - * @param result The result status for this event - * @param message The message to be displayed if result denies login - */ -- public PlayerLoginEvent(final Player player, String hostname, final InetAddress address, final Result result, final String message) { -- this(player, hostname, address); -+ public PlayerLoginEvent(final Player player, String hostname, final InetAddress address, final Result result, final String message, final InetAddress realAddress) { // Spigot -+ this(player, hostname, address, realAddress); // Spigot - this.result = result; - this.message = message; - } - -+ // Spigot start -+ /** -+ * Gets the connection address of this player, regardless of whether it has been spoofed or not. -+ * -+ * @return the player's connection address -+ */ -+ public InetAddress getRealAddress() { -+ return realAddress; -+ } -+ // Spigot end -+ - /** - * Gets the current result of the login, as an enum - * --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0006-Add-Arrow-API.patch b/pre/Bukkit-Patches/0006-Add-Arrow-API.patch deleted file mode 100644 index 00d9be707a..0000000000 --- a/pre/Bukkit-Patches/0006-Add-Arrow-API.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 2 Jun 2013 15:08:24 +1000 -Subject: [PATCH] Add Arrow API - - -diff --git a/src/main/java/org/bukkit/entity/Arrow.java b/src/main/java/org/bukkit/entity/Arrow.java -index c77f3a4f..99814eee 100644 ---- a/src/main/java/org/bukkit/entity/Arrow.java -+++ b/src/main/java/org/bukkit/entity/Arrow.java -@@ -0,0 +0,0 @@ public interface Arrow extends Projectile { - public class Spigot extends Entity.Spigot - { - -+ public double getDamage() -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } -+ -+ public void setDamage(double damage) -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } - } - - @Override --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0007-Add-Particle-API.patch b/pre/Bukkit-Patches/0007-Add-Particle-API.patch deleted file mode 100644 index 7801d03370..0000000000 --- a/pre/Bukkit-Patches/0007-Add-Particle-API.patch +++ /dev/null @@ -1,436 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 2 Jun 2013 15:57:09 +1000 -Subject: [PATCH] Add Particle API - - -diff --git a/src/main/java/org/bukkit/Effect.java b/src/main/java/org/bukkit/Effect.java -index 21f7db58..eeb25812 100644 ---- a/src/main/java/org/bukkit/Effect.java -+++ b/src/main/java/org/bukkit/Effect.java -@@ -0,0 +0,0 @@ import java.util.Map; - import com.google.common.collect.Maps; - - import org.bukkit.block.BlockFace; -+import org.bukkit.material.MaterialData; - import org.bukkit.potion.Potion; - - /** -@@ -0,0 +0,0 @@ public enum Effect { - * The sound of an enderdragon growling - */ - ENDERDRAGON_GROWL(3001, Type.SOUND), -+ /** -+ * The spark that comes off a fireworks -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ FIREWORKS_SPARK("fireworksSpark", Type.PARTICLE), -+ /** -+ * Critical hit particles -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ CRIT("crit", Type.PARTICLE), -+ /** -+ * Blue critical hit particles -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ MAGIC_CRIT("magicCrit", Type.PARTICLE), -+ /** -+ * Multicolored potion effect particles -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ POTION_SWIRL("mobSpell", Type.PARTICLE), -+ /** -+ * Multicolored potion effect particles that are slightly transparent -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ POTION_SWIRL_TRANSPARENT("mobSpellAmbient", Type.PARTICLE), -+ /** -+ * A puff of white potion swirls -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ SPELL("spell", Type.PARTICLE), -+ /** -+ * A puff of white stars -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ INSTANT_SPELL("instantSpell", Type.PARTICLE), -+ /** -+ * A puff of purple particles -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ WITCH_MAGIC("witchMagic", Type.PARTICLE), -+ /** -+ * The note that appears above note blocks -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ NOTE("note", Type.PARTICLE), -+ /** -+ * The particles shown at nether portals -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ PORTAL("portal", Type.PARTICLE), -+ /** -+ * The symbols that fly towards the enchantment table -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ FLYING_GLYPH("enchantmenttable", Type.PARTICLE), -+ /** -+ * Fire particles -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ FLAME("flame", Type.PARTICLE), -+ /** -+ * The particles that pop out of lava -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ LAVA_POP("lava", Type.PARTICLE), -+ /** -+ * A small gray square -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ FOOTSTEP("footstep", Type.PARTICLE), -+ /** -+ * Water particles -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ SPLASH("splash", Type.PARTICLE), -+ /** -+ * Smoke particles -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ PARTICLE_SMOKE("smoke", Type.PARTICLE), -+ /** -+ * The biggest explosion particle effect -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ EXPLOSION_HUGE("hugeexplosion", Type.PARTICLE), -+ /** -+ * A larger version of the explode particle -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ EXPLOSION_LARGE("largeexplode", Type.PARTICLE), -+ /** -+ * Explosion particles -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ EXPLOSION("explode", Type.PARTICLE), -+ /** -+ * Small gray particles -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ VOID_FOG("depthsuspend", Type.PARTICLE), -+ /** -+ * Small gray particles -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ SMALL_SMOKE("townaura", Type.PARTICLE), -+ /** -+ * A puff of white smoke -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ CLOUD("cloud", Type.PARTICLE), -+ /** -+ * Multicolored dust particles -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ COLOURED_DUST("reddust", Type.PARTICLE), -+ /** -+ * Snowball breaking -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ SNOWBALL_BREAK("snowballpoof", Type.PARTICLE), -+ /** -+ * The water drip particle that appears on blocks under water -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ WATERDRIP("dripWater", Type.PARTICLE), -+ /** -+ * The lava drip particle that appears on blocks under lava -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ LAVADRIP("dripLava", Type.PARTICLE), -+ /** -+ * White particles -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ SNOW_SHOVEL("snowshovel", Type.PARTICLE), -+ /** -+ * The particle shown when a slime jumps -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ SLIME("slime", Type.PARTICLE), -+ /** -+ * The particle that appears when breading animals -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ HEART("heart", Type.PARTICLE), -+ /** -+ * The particle that appears when hitting a villager -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ VILLAGER_THUNDERCLOUD("angryVillager", Type.PARTICLE), -+ /** -+ * The particle that appears when trading with a villager -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ HAPPY_VILLAGER("happyVillager", Type.PARTICLE), -+ /** -+ * The smoke particles that appears on blazes, minecarts -+ * with furnaces and fire -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ LARGE_SMOKE("largesmoke", Type.PARTICLE), -+ /** -+ * The particles generated when a tool breaks. -+ * This particle requires a Material so that the client can select the correct texture. -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ ITEM_BREAK("iconcrack", Type.PARTICLE, Material.class), -+ /** -+ * The particles generated while breaking a block. -+ * This particle requires a Material and data value so that the client can select the correct texture. -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ TILE_BREAK("blockcrack", Type.PARTICLE, MaterialData.class), -+ /** -+ * The particles generated while sprinting a block -+ * This particle requires a Material and data value so that the client can select the correct texture. -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ TILE_DUST("blockdust", Type.PARTICLE, MaterialData.class) - ; - - private final int id; - private final Type type; - private final Class data; - private static final Map BY_ID = Maps.newHashMap(); -+ private static final Map BY_NAME = Maps.newHashMap(); -+ private final String particleName; - -- Effect(int id, Type type) { -+ private Effect(int id, Type type) { - this(id, type, null); - } - -- Effect(int id, Type type, Class data) { -+ private Effect(int id, Type type, Class data) { - this.id = id; - this.type = type; - this.data = data; -+ particleName = null; -+ } -+ -+ private Effect(String particleName, Type type, Class data) { -+ this.particleName = particleName; -+ this.type = type; -+ id = 0; -+ this.data = data; -+ } -+ -+ private Effect(String particleName, Type type) { -+ this.particleName = particleName; -+ this.type = type; -+ id = 0; -+ this.data = null; - } - - /** - * Gets the ID for this effect. - * -- * @return ID of this effect -+ * @return if this Effect isn't of type PARTICLE it returns ID of this effect - * @deprecated Magic value - */ - @Deprecated -@@ -0,0 +0,0 @@ public enum Effect { - return this.id; - } - -+ /** -+ * Returns the effect's name. This returns null if the effect is not a particle -+ * -+ * @return The effect's name -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ public String getName() { -+ return particleName; -+ } -+ - /** - * @return The type of the effect. - */ -@@ -0,0 +0,0 @@ public enum Effect { - } - - /** -- * @return The class which represents data for this effect, or null if -- * none -+ * @return if this Effect isn't of type PARTICLE it returns the class which represents data for this effect, or null if none - */ - public Class getData() { - return this.data; -@@ -0,0 +0,0 @@ public enum Effect { - - static { - for (Effect effect : values()) { -- BY_ID.put(effect.id, effect); -+ if (effect.type != Type.PARTICLE) { -+ BY_ID.put(effect.id, effect); -+ } -+ } -+ } -+ -+ /** -+ * Gets the Effect associated with the given name. -+ * -+ * @param name name of the Effect to return -+ * @return Effect with the given name -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ public static Effect getByName(String name) { -+ return BY_NAME.get(name); -+ } -+ -+ static { -+ for (Effect effect : values()) { -+ if (effect.type == Type.PARTICLE) { -+ BY_NAME.put(effect.particleName, effect); -+ } - } - } - - /** - * Represents the type of an effect. - */ -- public enum Type {SOUND, VISUAL} -+ public enum Type {SOUND, VISUAL, PARTICLE} - } -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index ab6b1e3a..89db7303 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable { - public class Spigot - { - -+ /** -+ * Plays an effect to all players within a default radius around a given -+ * location. -+ * -+ * @param location the {@link Location} around which players must be to -+ * see the effect -+ * @param effect the {@link Effect} -+ * @throws IllegalArgumentException if the location or effect is null. -+ * It also throws when the effect requires a material or a material data -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ public void playEffect(Location location, Effect effect) -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } -+ -+ /** -+ * Plays an effect to all players within a default radius around a given -+ * location. The effect will use the provided material (and material -+ * data if required). The particle's position on the client will be the -+ * given location, adjusted on each axis by a normal distribution with -+ * mean 0 and standard deviation given in the offset parameters, each -+ * particle has independently calculated offsets. The effect will have -+ * the given speed and particle count if the effect is a particle. Some -+ * effect will create multiple particles. -+ * -+ * @param location the {@link Location} around which players must be to -+ * see the effect -+ * @param effect effect the {@link Effect} -+ * @param id the item/block/data id for the effect -+ * @param data the data value of the block/item for the effect -+ * @param offsetX the amount to be randomly offset by in the X axis -+ * @param offsetY the amount to be randomly offset by in the Y axis -+ * @param offsetZ the amount to be randomly offset by in the Z axis -+ * @param speed the speed of the particles -+ * @param particleCount the number of particles -+ * @param radius the radius around the location -+ * @deprecated Spigot specific API, use {@link Particle}. -+ */ -+ @Deprecated -+ public void playEffect(Location location, Effect effect, int id, int data, float offsetX, float offsetY, float offsetZ, float speed, int particleCount, int radius) -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } - } - - Spigot spigot(); -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 0215e0d0..7e6b5963 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - { - throw new UnsupportedOperationException( "Not supported yet." ); - } -+ -+ @Deprecated -+ public void playEffect(Location location, Effect effect, int id, int data, float offsetX, float offsetY, float offsetZ, float speed, int particleCount, int radius) -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } - } - - @Override -diff --git a/src/test/java/org/bukkit/EffectTest.java b/src/test/java/org/bukkit/EffectTest.java -index 08aa71d3..5217aecb 100644 ---- a/src/test/java/org/bukkit/EffectTest.java -+++ b/src/test/java/org/bukkit/EffectTest.java -@@ -0,0 +0,0 @@ public class EffectTest { - @Test - public void getById() { - for (Effect effect : Effect.values()) { -- assertThat(Effect.getById(effect.getId()), is(effect)); -+ if (effect.getType() != Effect.Type.PARTICLE) { -+ assertThat(Effect.getById(effect.getId()), is(effect)); -+ } else { -+ assertThat(Effect.getByName(effect.getName()), is(effect)); -+ } - } - } - } --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0008-Define-EntitySpawnEvent-and-SpawnerSpawnEvent.patch b/pre/Bukkit-Patches/0008-Define-EntitySpawnEvent-and-SpawnerSpawnEvent.patch deleted file mode 100644 index 07559d49a0..0000000000 --- a/pre/Bukkit-Patches/0008-Define-EntitySpawnEvent-and-SpawnerSpawnEvent.patch +++ /dev/null @@ -1,217 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Andy Shulman -Date: Mon, 15 Apr 2013 20:06:01 -0500 -Subject: [PATCH] Define EntitySpawnEvent and SpawnerSpawnEvent - -Defines EntitySpawnEvent and SpawnerSpawnEvent. Adds BUKKIT-267 and BUKKIT-1559 - -diff --git a/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java b/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java -index 4a8f2e18..70212ea5 100644 ---- a/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java -+++ b/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java -@@ -0,0 +0,0 @@ package org.bukkit.event.entity; - import org.bukkit.Location; - import org.bukkit.entity.Entity; - import org.bukkit.entity.LivingEntity; --import org.bukkit.event.Cancellable; --import org.bukkit.event.HandlerList; - - /** - * Called when a creature is spawned into a world. - *

- * If a Creature Spawn event is cancelled, the creature will not spawn. - */ --public class CreatureSpawnEvent extends EntityEvent implements Cancellable { -- private static final HandlerList handlers = new HandlerList(); -- private boolean canceled; -+public class CreatureSpawnEvent extends EntitySpawnEvent { - private final SpawnReason spawnReason; - - public CreatureSpawnEvent(final LivingEntity spawnee, final SpawnReason spawnReason) { -@@ -0,0 +0,0 @@ public class CreatureSpawnEvent extends EntityEvent implements Cancellable { - this.spawnReason = spawnReason; - } - -- public boolean isCancelled() { -- return canceled; -- } -- -- public void setCancelled(boolean cancel) { -- canceled = cancel; -- } -- - @Override - public LivingEntity getEntity() { - return (LivingEntity) entity; - } - -- /** -- * Gets the location at which the creature is spawning. -- * -- * @return The location at which the creature is spawning -- */ -- public Location getLocation() { -- return getEntity().getLocation(); -- } -- - /** - * Gets the reason for why the creature is being spawned. - * -@@ -0,0 +0,0 @@ public class CreatureSpawnEvent extends EntityEvent implements Cancellable { - return spawnReason; - } - -- @Override -- public HandlerList getHandlers() { -- return handlers; -- } -- -- public static HandlerList getHandlerList() { -- return handlers; -- } -- - /** - * An enum to specify the type of spawning - */ -diff --git a/src/main/java/org/bukkit/event/entity/EntitySpawnEvent.java b/src/main/java/org/bukkit/event/entity/EntitySpawnEvent.java -new file mode 100644 -index 00000000..5dcf98f3 ---- /dev/null -+++ b/src/main/java/org/bukkit/event/entity/EntitySpawnEvent.java -@@ -0,0 +0,0 @@ -+package org.bukkit.event.entity; -+ -+import org.bukkit.Location; -+import org.bukkit.entity.Entity; -+import org.bukkit.event.HandlerList; -+ -+/** -+ * Called when an entity is spawned into a world. -+ *

-+ * If an Entity Spawn event is cancelled, the entity will not spawn. -+ */ -+public class EntitySpawnEvent extends EntityEvent implements org.bukkit.event.Cancellable { -+ private static final HandlerList handlers = new HandlerList(); -+ private boolean canceled; -+ -+ public EntitySpawnEvent(final Entity spawnee) { -+ super(spawnee); -+ } -+ -+ public boolean isCancelled() { -+ return canceled; -+ } -+ -+ public void setCancelled(boolean cancel) { -+ canceled = cancel; -+ } -+ -+ /** -+ * Gets the location at which the entity is spawning. -+ * -+ * @return The location at which the entity is spawning -+ */ -+ public Location getLocation() { -+ return getEntity().getLocation(); -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return handlers; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return handlers; -+ } -+} -diff --git a/src/main/java/org/bukkit/event/entity/ItemSpawnEvent.java b/src/main/java/org/bukkit/event/entity/ItemSpawnEvent.java -index bafd934a..776f8e72 100644 ---- a/src/main/java/org/bukkit/event/entity/ItemSpawnEvent.java -+++ b/src/main/java/org/bukkit/event/entity/ItemSpawnEvent.java -@@ -0,0 +0,0 @@ - package org.bukkit.event.entity; - --import org.bukkit.entity.Item; - import org.bukkit.Location; --import org.bukkit.event.Cancellable; --import org.bukkit.event.HandlerList; -+import org.bukkit.entity.Item; - - /** - * Called when an item is spawned into a world - */ --public class ItemSpawnEvent extends EntityEvent implements Cancellable { -- private static final HandlerList handlers = new HandlerList(); -- private final Location location; -- private boolean canceled; -- -- public ItemSpawnEvent(final Item spawnee, final Location loc) { -+public class ItemSpawnEvent extends EntitySpawnEvent { -+ public ItemSpawnEvent(final Item spawnee) { - super(spawnee); -- this.location = loc; - } - -- public boolean isCancelled() { -- return canceled; -- } -- -- public void setCancelled(boolean cancel) { -- canceled = cancel; -+ @Deprecated -+ public ItemSpawnEvent(final Item spawnee, final Location loc) { -+ this(spawnee); - } - - @Override - public Item getEntity() { - return (Item) entity; - } -- -- /** -- * Gets the location at which the item is spawning. -- * -- * @return The location at which the item is spawning -- */ -- public Location getLocation() { -- return location; -- } -- -- @Override -- public HandlerList getHandlers() { -- return handlers; -- } -- -- public static HandlerList getHandlerList() { -- return handlers; -- } - } -diff --git a/src/main/java/org/bukkit/event/entity/SpawnerSpawnEvent.java b/src/main/java/org/bukkit/event/entity/SpawnerSpawnEvent.java -new file mode 100644 -index 00000000..1acb3c40 ---- /dev/null -+++ b/src/main/java/org/bukkit/event/entity/SpawnerSpawnEvent.java -@@ -0,0 +0,0 @@ -+package org.bukkit.event.entity; -+ -+import org.bukkit.block.CreatureSpawner; -+import org.bukkit.entity.Entity; -+ -+/** -+ * Called when an entity is spawned into a world by a spawner. -+ *

-+ * If a Spawner Spawn event is cancelled, the entity will not spawn. -+ */ -+public class SpawnerSpawnEvent extends EntitySpawnEvent { -+ private final CreatureSpawner spawner; -+ -+ public SpawnerSpawnEvent(final Entity spawnee, final CreatureSpawner spawner) { -+ super(spawnee); -+ this.spawner = spawner; -+ } -+ -+ public CreatureSpawner getSpawner() { -+ return spawner; -+ } -+} --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0009-Entity-Mount-and-Dismount-Events.patch b/pre/Bukkit-Patches/0009-Entity-Mount-and-Dismount-Events.patch deleted file mode 100644 index 3a86a41833..0000000000 --- a/pre/Bukkit-Patches/0009-Entity-Mount-and-Dismount-Events.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Tue, 2 Jul 2013 20:32:53 +1000 -Subject: [PATCH] Entity Mount and Dismount Events - - -diff --git a/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java b/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java -new file mode 100644 -index 00000000..24d4942a ---- /dev/null -+++ b/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java -@@ -0,0 +0,0 @@ -+package org.spigotmc.event.entity; -+ -+import org.bukkit.entity.Entity; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+ -+/** -+ * Called when an entity stops riding another entity. -+ * -+ */ -+public class EntityDismountEvent extends EntityEvent -+{ -+ -+ private static final HandlerList handlers = new HandlerList(); -+ private boolean cancelled; -+ private final Entity dismounted; -+ -+ public EntityDismountEvent(Entity what, Entity dismounted) -+ { -+ super( what ); -+ this.dismounted = dismounted; -+ } -+ -+ public Entity getDismounted() -+ { -+ return dismounted; -+ } -+ -+ @Override -+ public HandlerList getHandlers() -+ { -+ return handlers; -+ } -+ -+ public static HandlerList getHandlerList() -+ { -+ return handlers; -+ } -+} -diff --git a/src/main/java/org/spigotmc/event/entity/EntityMountEvent.java b/src/main/java/org/spigotmc/event/entity/EntityMountEvent.java -new file mode 100644 -index 00000000..16aa2a7e ---- /dev/null -+++ b/src/main/java/org/spigotmc/event/entity/EntityMountEvent.java -@@ -0,0 +0,0 @@ -+package org.spigotmc.event.entity; -+ -+import org.bukkit.entity.Entity; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+ -+/** -+ * Called when an entity attempts to ride another entity. -+ * -+ */ -+public class EntityMountEvent extends EntityEvent implements Cancellable -+{ -+ -+ private static final HandlerList handlers = new HandlerList(); -+ private boolean cancelled; -+ private final Entity mount; -+ -+ public EntityMountEvent(Entity what, Entity mount) -+ { -+ super( what ); -+ this.mount = mount; -+ } -+ -+ public Entity getMount() -+ { -+ return mount; -+ } -+ -+ @Override -+ public boolean isCancelled() -+ { -+ return cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) -+ { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public HandlerList getHandlers() -+ { -+ return handlers; -+ } -+ -+ public static HandlerList getHandlerList() -+ { -+ return handlers; -+ } -+} --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0010-InventoryClickEvent-getClickedInventory.patch b/pre/Bukkit-Patches/0010-InventoryClickEvent-getClickedInventory.patch deleted file mode 100644 index fe5bdda166..0000000000 --- a/pre/Bukkit-Patches/0010-InventoryClickEvent-getClickedInventory.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 7 Jul 2013 10:32:05 -0400 -Subject: [PATCH] InventoryClickEvent getClickedInventory - -Add InventoryClickEvent.getClickedInventory. Adds BUKKIT-4495 -Plugins currently have to do the logic themselves on the raw slot ID -in order to determine the inventory clicked. This provides the logic for plugins to -readily identify which inventory was clicked. - -diff --git a/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java b/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java -index 55527652..60feaf3b 100644 ---- a/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java -+++ b/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java -@@ -0,0 +0,0 @@ public class InventoryClickEvent extends InventoryInteractEvent { - private static final HandlerList handlers = new HandlerList(); - private final ClickType click; - private final InventoryAction action; -+ private final Inventory clickedInventory; - private SlotType slot_type; - private int whichSlot; - private int rawSlot; -@@ -0,0 +0,0 @@ public class InventoryClickEvent extends InventoryInteractEvent { - super(view); - this.slot_type = type; - this.rawSlot = slot; -+ if (slot < 0) { -+ this.clickedInventory = null; -+ } else if (view.getTopInventory() != null && slot < view.getTopInventory().getSize()) { -+ this.clickedInventory = view.getTopInventory(); -+ } else { -+ this.clickedInventory = view.getBottomInventory(); -+ } - this.whichSlot = view.convertSlot(slot); - this.click = click; - this.action = action; -@@ -0,0 +0,0 @@ public class InventoryClickEvent extends InventoryInteractEvent { - this.hotbarKey = key; - } - -+ /** -+ * Gets the inventory that was clicked, or null if outside of window -+ * @return The clicked inventory -+ */ -+ public Inventory getClickedInventory() { -+ return clickedInventory; -+ } -+ - /** - * Gets the type of slot that was clicked. - * --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0011-Added-getAllSessionData-to-the-Conversation-API.patch b/pre/Bukkit-Patches/0011-Added-getAllSessionData-to-the-Conversation-API.patch deleted file mode 100644 index 6f6c3418c8..0000000000 --- a/pre/Bukkit-Patches/0011-Added-getAllSessionData-to-the-Conversation-API.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alex Bennett -Date: Thu, 11 Jul 2013 15:31:32 -0500 -Subject: [PATCH] Added getAllSessionData() to the Conversation API. - - -diff --git a/src/main/java/org/bukkit/conversations/ConversationContext.java b/src/main/java/org/bukkit/conversations/ConversationContext.java -index 4f33ff46..7390a771 100644 ---- a/src/main/java/org/bukkit/conversations/ConversationContext.java -+++ b/src/main/java/org/bukkit/conversations/ConversationContext.java -@@ -0,0 +0,0 @@ public class ConversationContext { - return forWhom; - } - -+ /** -+ * Gets the entire sessionData map. -+ * @return The full sessionData map. -+ */ -+ public Map getAllSessionData() { -+ return sessionData; -+ } -+ - /** - * Gets session data shared between all {@link Prompt} invocations. Use - * this as a way to pass data through each Prompt as the conversation --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0012-Player-Collision-API.patch b/pre/Bukkit-Patches/0012-Player-Collision-API.patch deleted file mode 100644 index 3c460fbf3c..0000000000 --- a/pre/Bukkit-Patches/0012-Player-Collision-API.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 3 Aug 2013 19:20:50 +1000 -Subject: [PATCH] Player Collision API - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 7e6b5963..2bb9dffa 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - { - throw new UnsupportedOperationException( "Not supported yet." ); - } -+ -+ /** -+ * Gets whether the player collides with entities -+ * -+ * @return the player's collision toggle state -+ * @deprecated see {@link LivingEntity#isCollidable()} -+ */ -+ @Deprecated -+ public boolean getCollidesWithEntities() -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } -+ -+ /** -+ * Sets whether the player collides with entities -+ * -+ * @param collides whether the player should collide with entities or -+ * not. -+ * @deprecated {@link LivingEntity#setCollidable(boolean)} -+ */ -+ @Deprecated -+ public void setCollidesWithEntities(boolean collides) -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } - } - - @Override --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0013-Expand-Boolean-Prompt-Values.patch b/pre/Bukkit-Patches/0013-Expand-Boolean-Prompt-Values.patch deleted file mode 100644 index a6543fad2f..0000000000 --- a/pre/Bukkit-Patches/0013-Expand-Boolean-Prompt-Values.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 3 Aug 2013 19:42:16 +1000 -Subject: [PATCH] Expand Boolean Prompt Values - - -diff --git a/src/main/java/org/bukkit/conversations/BooleanPrompt.java b/src/main/java/org/bukkit/conversations/BooleanPrompt.java -index c37d1596..6701c175 100644 ---- a/src/main/java/org/bukkit/conversations/BooleanPrompt.java -+++ b/src/main/java/org/bukkit/conversations/BooleanPrompt.java -@@ -0,0 +0,0 @@ public abstract class BooleanPrompt extends ValidatingPrompt { - - @Override - protected boolean isInputValid(ConversationContext context, String input) { -- String[] accepted = {"true", "false", "on", "off", "yes", "no"}; -+ String[] accepted = {"true", "false", "on", "off", "yes", "no" /* Spigot: */, "y", "n", "1", "0", "right", "wrong", "correct", "incorrect", "valid", "invalid"}; // Spigot - return ArrayUtils.contains(accepted, input.toLowerCase()); - } - - @Override - protected Prompt acceptValidatedInput(ConversationContext context, String input) { -+ if (input.equalsIgnoreCase("y") || input.equals("1") || input.equalsIgnoreCase("right") || input.equalsIgnoreCase("correct") || input.equalsIgnoreCase("valid")) input = "true"; // Spigot - return acceptValidatedInput(context, BooleanUtils.toBoolean(input)); - } - --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0014-Add-Getter-for-Entity-Invulnerability.patch b/pre/Bukkit-Patches/0014-Add-Getter-for-Entity-Invulnerability.patch deleted file mode 100644 index 83c1ffebfe..0000000000 --- a/pre/Bukkit-Patches/0014-Add-Getter-for-Entity-Invulnerability.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 3 Aug 2013 19:49:36 +1000 -Subject: [PATCH] Add Getter for Entity Invulnerability - - -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 294eb7f7..28b169d2 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -0,0 +0,0 @@ public interface Entity extends Metadatable, CommandSender, Nameable { - public class Spigot extends CommandSender.Spigot - { - -+ /** -+ * Returns whether this entity is invulnerable. -+ * -+ * @return True if the entity is invulnerable. -+ */ -+ public boolean isInvulnerable() -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } - } - - @Override --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0015-Add-respawn-API.patch b/pre/Bukkit-Patches/0015-Add-respawn-API.patch deleted file mode 100644 index 1479276e16..0000000000 --- a/pre/Bukkit-Patches/0015-Add-respawn-API.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: ninja- -Date: Tue, 8 Oct 2013 14:35:58 +0200 -Subject: [PATCH] Add respawn API. - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 2bb9dffa..226aa6b6 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - { - throw new UnsupportedOperationException( "Not supported yet." ); - } -+ -+ /** -+ * Respawns the player if dead. -+ */ -+ public void respawn() -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } - } - - @Override --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0016-Implement-Locale-Getter-for-Players.patch b/pre/Bukkit-Patches/0016-Implement-Locale-Getter-for-Players.patch deleted file mode 100644 index 30928a12b7..0000000000 --- a/pre/Bukkit-Patches/0016-Implement-Locale-Getter-for-Players.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Smove -Date: Sat, 1 Feb 2014 18:10:49 +1100 -Subject: [PATCH] Implement Locale Getter for Players - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 226aa6b6..e021495e 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - { - throw new UnsupportedOperationException( "Not supported yet." ); - } -+ -+ /** -+ * Gets player locale language. -+ * -+ * @return the player's client language settings -+ * @deprecated Use {@link Player#getLocale()} -+ */ -+ @Deprecated -+ public String getLocale() -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } - } - - @Override --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0017-Add-support-for-fetching-hidden-players.patch b/pre/Bukkit-Patches/0017-Add-support-for-fetching-hidden-players.patch deleted file mode 100644 index b287dc97fb..0000000000 --- a/pre/Bukkit-Patches/0017-Add-support-for-fetching-hidden-players.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Tux -Date: Sun, 9 Feb 2014 14:02:11 -0500 -Subject: [PATCH] Add support for fetching hidden players - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index e021495e..5c55c2e2 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - { - throw new UnsupportedOperationException( "Not supported yet." ); - } -+ -+ /** -+ * Gets all players hidden with {@link #hidePlayer(org.bukkit.entity.Player)}. -+ * -+ * @return a Set with all hidden players -+ */ -+ public java.util.Set getHiddenPlayers() -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } - } - - @Override --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0018-Silenceable-Lightning-API.patch b/pre/Bukkit-Patches/0018-Silenceable-Lightning-API.patch deleted file mode 100644 index 60a35a6f9c..0000000000 --- a/pre/Bukkit-Patches/0018-Silenceable-Lightning-API.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: drXor -Date: Sun, 23 Feb 2014 16:16:29 -0400 -Subject: [PATCH] Silenceable Lightning API - - -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 89db7303..33b14a07 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable { - { - throw new UnsupportedOperationException( "Not supported yet." ); - } -+ -+ /** -+ * Strikes lightning at the given {@link Location} and possibly without sound -+ * -+ * @param loc The location to strike lightning -+ * @param isSilent Whether this strike makes no sound -+ * @return The lightning entity. -+ */ -+ public LightningStrike strikeLightning(Location loc, boolean isSilent) -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } -+ -+ /** -+ * Strikes lightning at the given {@link Location} without doing damage and possibly without sound -+ * -+ * @param loc The location to strike lightning -+ * @param isSilent Whether this strike makes no sound -+ * @return The lightning entity. -+ */ -+ public LightningStrike strikeLightningEffect(Location loc, boolean isSilent) -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } - } - - Spigot spigot(); -diff --git a/src/main/java/org/bukkit/entity/LightningStrike.java b/src/main/java/org/bukkit/entity/LightningStrike.java -index ee2218c1..aa809392 100644 ---- a/src/main/java/org/bukkit/entity/LightningStrike.java -+++ b/src/main/java/org/bukkit/entity/LightningStrike.java -@@ -0,0 +0,0 @@ public interface LightningStrike extends Weather { - public class Spigot extends Entity.Spigot - { - -+ /* -+ * Returns whether the strike is silent. -+ * -+ * @return whether the strike is silent. -+ */ -+ public boolean isSilent() -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } - } - - @Override --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0019-Remove-deprecation-on-some-player-lookup-methods.patch b/pre/Bukkit-Patches/0019-Remove-deprecation-on-some-player-lookup-methods.patch deleted file mode 100644 index e368f551bc..0000000000 --- a/pre/Bukkit-Patches/0019-Remove-deprecation-on-some-player-lookup-methods.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sun, 30 Mar 2014 15:58:22 +1100 -Subject: [PATCH] Remove deprecation on some player lookup methods - -Most of these methods still have plenty of use given that only one player with each name can exist at a time. Deprecating these methods renders even basic functionality such as /msg impossible without causing compiler warnings. We will maintain this API and it should be considered safe and appropriate for most use cases. - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 27c69e96..0f42a66a 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -0,0 +0,0 @@ public final class Bukkit { - *

- * This method may not return objects for offline players. - * -- * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer -- * guaranteed to be unique - * @param name the name to look up - * @return a player if one was found, null otherwise - */ -- @Deprecated - public static Player getPlayer(String name) { - return server.getPlayer(name); - } -@@ -0,0 +0,0 @@ public final class Bukkit { - /** - * Gets the player with the exact given name, case insensitive. - * -- * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer -- * guaranteed to be unique - * @param name Exact name of the player to retrieve - * @return a player object if one was found, null otherwise - */ -- @Deprecated - public static Player getPlayerExact(String name) { - return server.getPlayerExact(name); - } -@@ -0,0 +0,0 @@ public final class Bukkit { - * This list is not sorted in any particular order. If an exact match is - * found, the returned list will only contain a single result. - * -- * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer -- * guaranteed to be unique - * @param name the (partial) name to match - * @return list of all possible players - */ -- @Deprecated - public static List matchPlayer(String name) { - return server.matchPlayer(name); - } -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index c9ef86e4..65ad9aa0 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { - *

- * This method may not return objects for offline players. - * -- * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer -- * guaranteed to be unique - * @param name the name to look up - * @return a player if one was found, null otherwise - */ -- @Deprecated - public Player getPlayer(String name); - - /** - * Gets the player with the exact given name, case insensitive. - * -- * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer -- * guaranteed to be unique - * @param name Exact name of the player to retrieve - * @return a player object if one was found, null otherwise - */ -- @Deprecated - public Player getPlayerExact(String name); - - /** -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { - * This list is not sorted in any particular order. If an exact match is - * found, the returned list will only contain a single result. - * -- * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer -- * guaranteed to be unique - * @param name the (partial) name to match - * @return list of all possible players - */ -- @Deprecated - public List matchPlayer(String name); - - /** --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0020-Add-PlayerSpawnLocationEvent.patch b/pre/Bukkit-Patches/0020-Add-PlayerSpawnLocationEvent.patch deleted file mode 100644 index 531e0177c7..0000000000 --- a/pre/Bukkit-Patches/0020-Add-PlayerSpawnLocationEvent.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: ninja -Date: Tue, 8 Apr 2014 14:01:32 +0200 -Subject: [PATCH] Add PlayerSpawnLocationEvent. - - -diff --git a/src/main/java/org/spigotmc/event/player/PlayerSpawnLocationEvent.java b/src/main/java/org/spigotmc/event/player/PlayerSpawnLocationEvent.java -new file mode 100644 -index 00000000..dd3f58ca ---- /dev/null -+++ b/src/main/java/org/spigotmc/event/player/PlayerSpawnLocationEvent.java -@@ -0,0 +0,0 @@ -+package org.spigotmc.event.player; -+ -+import org.bukkit.Location; -+import org.bukkit.entity.Entity; -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+ -+/** -+ * Called when player is about to spawn in a world after joining the server. -+ */ -+public class PlayerSpawnLocationEvent extends PlayerEvent { -+ private static final HandlerList handlers = new HandlerList(); -+ private Location spawnLocation; -+ -+ public PlayerSpawnLocationEvent(final Player who, Location spawnLocation) { -+ super(who); -+ this.spawnLocation = spawnLocation; -+ } -+ -+ -+ /** -+ * Gets player's spawn location. -+ * If the player {@link Player#hasPlayedBefore()}, it's going to default to the location inside player.dat file. -+ * For new players, the default spawn location is spawn of the main Bukkit world. -+ * -+ * @return the spawn location -+ */ -+ public Location getSpawnLocation() { -+ return spawnLocation; -+ } -+ -+ /** -+ * Sets player's spawn location. -+ * -+ * @param location the spawn location -+ */ -+ public void setSpawnLocation(Location location) { -+ this.spawnLocation = location; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return handlers; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return handlers; -+ } -+} --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0021-Ease-ClassLoader-Deadlocks-Where-Possible.patch b/pre/Bukkit-Patches/0021-Ease-ClassLoader-Deadlocks-Where-Possible.patch deleted file mode 100644 index 164f022ade..0000000000 --- a/pre/Bukkit-Patches/0021-Ease-ClassLoader-Deadlocks-Where-Possible.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Wed, 16 Jul 2014 17:24:21 +1000 -Subject: [PATCH] Ease ClassLoader Deadlocks Where Possible - -When on Java 7 we can register the classloader as parallel capable to prevent deadlocks caused by certain scenarios. Due to the nature of PluginClassLoader this isn't completely safe, but we can make it safer by switching to concurrency focused collections. Either way this is far better than crashing the server. - -diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 73372534..80c6a72e 100644 ---- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -@@ -0,0 +0,0 @@ import org.yaml.snakeyaml.error.YAMLException; - public final class JavaPluginLoader implements PluginLoader { - final Server server; - private final Pattern[] fileFilters = new Pattern[] { Pattern.compile("\\.jar$"), }; -- private final Map> classes = new HashMap>(); -+ private final Map> classes = new java.util.concurrent.ConcurrentHashMap>(); // Spigot - private final List loaders = new CopyOnWriteArrayList(); - public static final CustomTimingsHandler pluginParentTimer = new CustomTimingsHandler("** Plugins"); // Spigot - -diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -index 5eb42df3..a9fc08e0 100644 ---- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -@@ -0,0 +0,0 @@ import org.bukkit.plugin.PluginDescriptionFile; - */ - final class PluginClassLoader extends URLClassLoader { - private final JavaPluginLoader loader; -- private final Map> classes = new HashMap>(); -+ private final Map> classes = new java.util.concurrent.ConcurrentHashMap>(); // Spigot - private final PluginDescriptionFile description; - private final File dataFolder; - private final File file; -@@ -0,0 +0,0 @@ final class PluginClassLoader extends URLClassLoader { - private JavaPlugin pluginInit; - private IllegalStateException pluginState; - -+ // Spigot Start -+ static -+ { -+ try -+ { -+ java.lang.reflect.Method method = ClassLoader.class.getDeclaredMethod( "registerAsParallelCapable" ); -+ if ( method != null ) -+ { -+ boolean oldAccessible = method.isAccessible(); -+ method.setAccessible( true ); -+ method.invoke( null ); -+ method.setAccessible( oldAccessible ); -+ org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.INFO, "Set PluginClassLoader as parallel capable" ); -+ } -+ } catch ( NoSuchMethodException ex ) -+ { -+ // Ignore -+ } catch ( Exception ex ) -+ { -+ org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.WARNING, "Error setting PluginClassLoader as parallel capable", ex ); -+ } -+ } -+ // Spigot End -+ - PluginClassLoader(final JavaPluginLoader loader, final ClassLoader parent, final PluginDescriptionFile description, final File dataFolder, final File file) throws IOException, InvalidPluginException, MalformedURLException { - super(new URL[] {file.toURI().toURL()}, parent); - Validate.notNull(loader, "Loader cannot be null"); --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0022-Undeprecate-Player-updateInventory-V.patch b/pre/Bukkit-Patches/0022-Undeprecate-Player-updateInventory-V.patch deleted file mode 100644 index 3d683b5ef3..0000000000 --- a/pre/Bukkit-Patches/0022-Undeprecate-Player-updateInventory-V.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: drXor -Date: Wed, 23 Jul 2014 15:50:36 -0400 -Subject: [PATCH] Undeprecate Player#updateInventory()V - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 5c55c2e2..f59c2c19 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - /** - * Forces an update of the player's entire inventory. - * -- * @deprecated This method should not be relied upon as it is a temporary -- * work-around for a larger, more complicated issue. - */ -- @Deprecated -+ //@Deprecated // Spigot - undeprecate - public void updateInventory(); - - /** --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0023-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch b/pre/Bukkit-Patches/0023-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch deleted file mode 100644 index 64e3caace0..0000000000 --- a/pre/Bukkit-Patches/0023-Added-isUnbreakable-and-setUnbreakable-to-ItemMeta.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: libraryaddict -Date: Fri, 22 Aug 2014 05:31:04 -0400 -Subject: [PATCH] Added isUnbreakable and setUnbreakable to ItemMeta - - -diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -index e48616d2..62ddbbba 100644 ---- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -@@ -0,0 +0,0 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable { - public class Spigot - { - -+ /** -+ * Sets the unbreakable tag -+ * -+ * @param unbreakable true if set unbreakable -+ * @deprecated see {@link ItemMeta#setUnbreakable(boolean)} -+ */ -+ @Deprecated -+ public void setUnbreakable(boolean unbreakable) -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } -+ -+ /** -+ * Return if the unbreakable tag is true -+ * -+ * @return true if the unbreakable tag is true -+ * @deprecated see {@link ItemMeta#isUnbreakable()} -+ */ -+ @Deprecated -+ public boolean isUnbreakable() -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } - } - - Spigot spigot(); --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0024-BungeeCord-Chat-API.patch b/pre/Bukkit-Patches/0024-BungeeCord-Chat-API.patch deleted file mode 100644 index 54491b8434..0000000000 --- a/pre/Bukkit-Patches/0024-BungeeCord-Chat-API.patch +++ /dev/null @@ -1,449 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Sat, 13 Dec 2014 02:59:14 +0100 -Subject: [PATCH] BungeeCord Chat API - - -diff --git a/pom.xml b/pom.xml -index 88b109e0..99ff13b3 100644 ---- a/pom.xml -+++ b/pom.xml -@@ -0,0 +0,0 @@ - 1.21 - compile - -+ -+ net.md-5 -+ bungeecord-chat -+ 1.12-SNAPSHOT -+ jar -+ compile -+ -+ - - - junit -diff --git a/src/main/java/org/bukkit/ChatColor.java b/src/main/java/org/bukkit/ChatColor.java -index b8872b41..adbae51a 100644 ---- a/src/main/java/org/bukkit/ChatColor.java -+++ b/src/main/java/org/bukkit/ChatColor.java -@@ -0,0 +0,0 @@ import com.google.common.collect.Maps; - /** - * All supported color values for chat - */ --public enum ChatColor { -+public enum ChatColor{ - /** - * Represents black - */ -- BLACK('0', 0x00), -+ BLACK('0', 0x00) { -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.BLACK; -+ } -+ }, - /** - * Represents dark blue - */ -- DARK_BLUE('1', 0x1), -+ DARK_BLUE('1', 0x1){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.DARK_BLUE; -+ } -+ }, - /** - * Represents dark green - */ -- DARK_GREEN('2', 0x2), -+ DARK_GREEN('2', 0x2){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.DARK_GREEN; -+ } -+ }, - /** - * Represents dark blue (aqua) - */ -- DARK_AQUA('3', 0x3), -+ DARK_AQUA('3', 0x3){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.DARK_AQUA; -+ } -+ }, - /** - * Represents dark red - */ -- DARK_RED('4', 0x4), -+ DARK_RED('4', 0x4){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.DARK_RED; -+ } -+ }, - /** - * Represents dark purple - */ -- DARK_PURPLE('5', 0x5), -+ DARK_PURPLE('5', 0x5){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.DARK_PURPLE; -+ } -+ }, - /** - * Represents gold - */ -- GOLD('6', 0x6), -+ GOLD('6', 0x6){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.GOLD; -+ } -+ }, - /** - * Represents gray - */ -- GRAY('7', 0x7), -+ GRAY('7', 0x7){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.GRAY; -+ } -+ }, - /** - * Represents dark gray - */ -- DARK_GRAY('8', 0x8), -+ DARK_GRAY('8', 0x8){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.DARK_GRAY; -+ } -+ }, - /** - * Represents blue - */ -- BLUE('9', 0x9), -+ BLUE('9', 0x9){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.BLUE; -+ } -+ }, - /** - * Represents green - */ -- GREEN('a', 0xA), -+ GREEN('a', 0xA){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.GREEN; -+ } -+ }, - /** - * Represents aqua - */ -- AQUA('b', 0xB), -+ AQUA('b', 0xB){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.AQUA; -+ } -+ }, - /** - * Represents red - */ -- RED('c', 0xC), -+ RED('c', 0xC){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.RED; -+ } -+ }, - /** - * Represents light purple - */ -- LIGHT_PURPLE('d', 0xD), -+ LIGHT_PURPLE('d', 0xD){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.LIGHT_PURPLE; -+ } -+ }, - /** - * Represents yellow - */ -- YELLOW('e', 0xE), -+ YELLOW('e', 0xE){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.YELLOW; -+ } -+ }, - /** - * Represents white - */ -- WHITE('f', 0xF), -+ WHITE('f', 0xF){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.WHITE; -+ } -+ }, - /** - * Represents magical characters that change around randomly - */ -- MAGIC('k', 0x10, true), -+ MAGIC('k', 0x10, true){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.MAGIC; -+ } -+ }, - /** - * Makes the text bold. - */ -- BOLD('l', 0x11, true), -+ BOLD('l', 0x11, true){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.BOLD; -+ } -+ }, - /** - * Makes a line appear through the text. - */ -- STRIKETHROUGH('m', 0x12, true), -+ STRIKETHROUGH('m', 0x12, true){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.STRIKETHROUGH; -+ } -+ }, - /** - * Makes the text appear underlined. - */ -- UNDERLINE('n', 0x13, true), -+ UNDERLINE('n', 0x13, true){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.UNDERLINE; -+ } -+ }, - /** - * Makes the text italic. - */ -- ITALIC('o', 0x14, true), -+ ITALIC('o', 0x14, true){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.ITALIC; -+ } -+ }, - /** - * Resets all previous chat colors or formats. - */ -- RESET('r', 0x15); -+ RESET('r', 0x15){ -+ @Override -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.RESET; -+ } -+ }; - - /** - * The special character which prefixes all chat colour codes. Use this if -@@ -0,0 +0,0 @@ public enum ChatColor { - this.toString = new String(new char[] {COLOR_CHAR, code}); - } - -+ public net.md_5.bungee.api.ChatColor asBungee() { -+ return net.md_5.bungee.api.ChatColor.RESET; -+ }; -+ - /** - * Gets the char value associated with this color - * -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 65ad9aa0..2b8f039f 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { - { - throw new UnsupportedOperationException( "Not supported yet." ); - } -+ -+ /** -+ * Sends the component to the player -+ * -+ * @param component the components to send -+ */ -+ public void broadcast(net.md_5.bungee.api.chat.BaseComponent component) { -+ throw new UnsupportedOperationException("Not supported yet."); -+ } -+ -+ /** -+ * Sends an array of components as a single message to the player -+ * -+ * @param components the components to send -+ */ -+ public void broadcast(net.md_5.bungee.api.chat.BaseComponent... components) { -+ throw new UnsupportedOperationException("Not supported yet."); -+ } - } - - Spigot spigot(); -diff --git a/src/main/java/org/bukkit/command/CommandSender.java b/src/main/java/org/bukkit/command/CommandSender.java -index 5dcd2218..abf68a2c 100644 ---- a/src/main/java/org/bukkit/command/CommandSender.java -+++ b/src/main/java/org/bukkit/command/CommandSender.java -@@ -0,0 +0,0 @@ public interface CommandSender extends Permissible { - public class Spigot - { - -+ /** -+ * Sends this sender a chat component. -+ * -+ * @param component the components to send -+ */ -+ public void sendMessage(net.md_5.bungee.api.chat.BaseComponent component) { -+ throw new UnsupportedOperationException("Not supported yet."); -+ } -+ -+ /** -+ * Sends an array of components as a single message to the sender. -+ * -+ * @param components the components to send -+ */ -+ public void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components) { -+ throw new UnsupportedOperationException("Not supported yet."); -+ } - } - - Spigot spigot(); -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index f59c2c19..86eca9e1 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - { - throw new UnsupportedOperationException( "Not supported yet." ); - } -+ -+ @Override -+ public void sendMessage(net.md_5.bungee.api.chat.BaseComponent component) { -+ throw new UnsupportedOperationException("Not supported yet."); -+ } -+ -+ @Override -+ public void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components) { -+ throw new UnsupportedOperationException("Not supported yet."); -+ } -+ -+ /** -+ * Sends the component to the specified screen position of this player -+ * -+ * @param position the screen position -+ * @param component the components to send -+ */ -+ public void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent component) { -+ throw new UnsupportedOperationException("Not supported yet."); -+ } -+ -+ /** -+ * Sends an array of components as a single message to the specified screen position of this player -+ * -+ * @param position the screen position -+ * @param components the components to send -+ */ -+ public void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) { -+ throw new UnsupportedOperationException("Not supported yet."); -+ } - } - - @Override -diff --git a/src/main/java/org/bukkit/inventory/meta/BookMeta.java b/src/main/java/org/bukkit/inventory/meta/BookMeta.java -index 3b6bf419..75b03ac3 100644 ---- a/src/main/java/org/bukkit/inventory/meta/BookMeta.java -+++ b/src/main/java/org/bukkit/inventory/meta/BookMeta.java -@@ -0,0 +0,0 @@ - package org.bukkit.inventory.meta; - - import java.util.List; -+import net.md_5.bungee.api.chat.BaseComponent; - - import org.bukkit.Material; - -@@ -0,0 +0,0 @@ public interface BookMeta extends ItemMeta { - // Spigot start - public class Spigot extends ItemMeta.Spigot { - -+ /** -+ * Gets the specified page in the book. The given page must exist. -+ * -+ * @param page the page number to get -+ * @return the page from the book -+ */ -+ public BaseComponent[] getPage(int page) { -+ throw new UnsupportedOperationException("Not supported yet."); -+ } -+ -+ /** -+ * Sets the specified page in the book. Pages of the book must be -+ * contiguous. -+ *

-+ * The data can be up to 256 characters in length, additional characters -+ * are truncated. -+ * -+ * @param page the page number to set -+ * @param data the data to set for that page -+ */ -+ public void setPage(int page, BaseComponent... data) { -+ throw new UnsupportedOperationException("Not supported yet."); -+ } -+ -+ /** -+ * Gets all the pages in the book. -+ * -+ * @return list of all the pages in the book -+ */ -+ public List getPages() { -+ throw new UnsupportedOperationException("Not supported yet."); -+ } -+ -+ /** -+ * Clears the existing book pages, and sets the book to use the provided -+ * pages. Maximum 50 pages with 256 characters per page. -+ * -+ * @param pages A list of pages to set the book to use -+ */ -+ public void setPages(List pages) { -+ throw new UnsupportedOperationException("Not supported yet."); -+ } -+ -+ /** -+ * Clears the existing book pages, and sets the book to use the provided -+ * pages. Maximum 50 pages with 256 characters per page. -+ * -+ * @param pages A list of component arrays, each being a page -+ */ -+ public void setPages(BaseComponent[]... pages) { -+ throw new UnsupportedOperationException("Not supported yet."); -+ } -+ -+ /** -+ * Adds new pages to the end of the book. Up to a maximum of 50 pages -+ * with 256 characters per page. -+ * -+ * @param pages A list of component arrays, each being a page -+ */ -+ public void addPage(BaseComponent[]... pages) { -+ throw new UnsupportedOperationException("Not supported yet."); -+ } - } - - @Override --- \ No newline at end of file diff --git a/pre/Bukkit-Patches/0025-Add-restart-API.patch b/pre/Bukkit-Patches/0025-Add-restart-API.patch deleted file mode 100644 index 6249686c83..0000000000 --- a/pre/Bukkit-Patches/0025-Add-restart-API.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: md_5 -Date: Mon, 13 Jul 2015 19:10:15 +1000 -Subject: [PATCH] Add restart API. - - -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 2b8f039f..9c3eeaa9 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { - public void broadcast(net.md_5.bungee.api.chat.BaseComponent... components) { - throw new UnsupportedOperationException("Not supported yet."); - } -+ -+ /** -+ * Restart the server. If the server administrator has not configured restarting, the server will stop. -+ */ -+ public void restart() { -+ throw new UnsupportedOperationException("Not supported yet."); -+ } - } - - Spigot spigot(); --- \ No newline at end of file diff --git a/scripts/applyPatches.sh b/scripts/applyPatches.sh index 100db69839..ac4062c8dd 100755 --- a/scripts/applyPatches.sh +++ b/scripts/applyPatches.sh @@ -37,10 +37,7 @@ function applyPatch { echo " Applying patches to $target..." $gitcmd am --abort >/dev/null 2>&1 - #TODO: remove - if [ "$what_name" == "Bukkit" ]; then - what_name="../../pre/Bukkit"; - fi + # Special case Windows handling because of ARG_MAX constraint if [[ $windows == "true" ]]; then echo " Using workaround for Windows ARG_MAX constraint" @@ -72,13 +69,11 @@ function applyPatch { # Move into spigot dir cd "$workdir/Spigot" - basedir=$(pwd) # Apply Spigot ( -#TODO: remove ../pre/ and reset to HEAD - applyPatch ../Bukkit Spigot-API origin/preview # && - #applyPatch ../CraftBukkit Spigot-Server patched + applyPatch ../Bukkit Spigot-API HEAD && + applyPatch ../CraftBukkit Spigot-Server patched ) || ( echo "Failed to apply Spigot Patches" exit 1 @@ -89,15 +84,13 @@ cd "$basedir" echo "Importing MC Dev" -# TODO: Remove comment -# ./scripts/importmcdev.sh "$basedir" >/dev/null 2>&1 +./scripts/importmcdev.sh "$basedir" || exit 1 # Apply paper cd "$basedir" ( -#TODO remove comment - applyPatch "work/Spigot/Spigot-API" Paper-API HEAD # && - # applyPatch "work/Spigot/Spigot-Server" Paper-Server HEAD + applyPatch "work/Spigot/Spigot-API" Paper-API HEAD && + applyPatch "work/Spigot/Spigot-Server" Paper-Server HEAD ) || ( echo "Failed to apply Paper Patches" exit 1 diff --git a/scripts/importmcdev.sh b/scripts/importmcdev.sh index 9e16057186..3c54ffbbd3 100755 --- a/scripts/importmcdev.sh +++ b/scripts/importmcdev.sh @@ -6,6 +6,7 @@ nms="net/minecraft/server" export MODLOG="" PS1="$" basedir="$(cd "$1" && pwd -P)" +source "$basedir/scripts/functions.sh" gitcmd="git -c commit.gpgsign=false" workdir="$basedir/work" @@ -21,8 +22,8 @@ function import { if [[ ! -f "$target" ]]; then export MODLOG="$MODLOG Imported $file from mc-dev\n"; - echo "Copying $base to $target" - cp "$base" "$target" + #echo "Copying $base to $target" + cp "$base" "$target" || exit 1 else echo "UN-NEEDED IMPORT: $file" fi @@ -36,85 +37,42 @@ function import { fi ) -import AxisAlignedBB -import BaseBlockPosition -import BiomeBase -import BlockBed -import BiomeBigHills -import BiomeJungle -import BiomeMesa -import BlockBeacon -import BlockChest -import BlockFalling -import BlockFurnace -import BlockIceFrost -import BlockPosition -import BlockSnowBlock -import BlockStateEnum -import ChunkCache -import ChunkCoordIntPair -import ChunkProviderFlat -import ChunkProviderGenerate -import ChunkProviderHell -import CommandAbstract -import CommandScoreboard -import CommandWhitelist -import ControllerJump -import DataBits -import DataConverterMaterialId -import DataInspectorBlockEntity -import DataPalette -import DefinedStructure -import DragonControllerLandedFlame -import EnchantmentManager -import Enchantments -import EnderDragonBattle -import EntityIllagerIllusioner -import EntityLlama -import EntitySquid -import EntityTypes -import EntityWaterAnimal -import EntityWitch -import EnumItemSlot -import EULA -import FileIOThread -import IHopper -import ItemBlock -import ItemFireworks -import ItemMonsterEgg -import IRangedEntity -import LegacyPingHandler -import LotoSelectorEntry -import NavigationAbstract -import NBTTagCompound -import NBTTagList -import PacketPlayInUseEntity -import PacketPlayOutMapChunk -import PacketPlayOutPlayerListHeaderFooter -import PacketPlayOutScoreboardTeam -import PacketPlayOutTitle -import PacketPlayOutUpdateTime -import PathfinderAbstract -import PathfinderGoal -import PathfinderGoalFloat -import PathfinderGoalGotoTarget -import PathfinderWater -import PersistentScoreboard -import PersistentVillage -import PlayerConnectionUtils -import RegionFile -import RegistryBlockID -import RemoteControlListener -import RecipeBookServer -import ServerPing -import StructureBoundingBox -import StructurePiece -import StructureStart -import TileEntityEnderChest -import TileEntityLootable -import WorldGenStronghold -import WorldProvider + +files=$(cat "$basedir/Spigot-Server-Patches/"* | grep "+++ b/src/main/java/net/minecraft/server/" | sort | uniq | sed 's/\+\+\+ b\/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g') + +nonnms=$(cat "$basedir/Spigot-Server-Patches/"* | grep "create mode " | grep -Po "src/main/java/net/minecraft/server/(.*?).java" | sort | uniq | sed 's/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g' ; + # TODO: Fix non nms to work for Paper, hard code these for now + echo "KeyedObject" ; + echo "MCUtil" ; + echo "PaperLightingQueue" +) + +function containsElement { + local e + for e in "${@:2}"; do + [[ "$e" == "$1" ]] && return 0; + done + return 1 +} +set +e +for f in $files; do + containsElement "$f" ${nonnms[@]} + if [ "$?" == "1" ]; then + if [ ! -f "$workdir/Spigot/Spigot-Server/src/main/java/net/minecraft/server/$f.java" ]; then + if [ ! -f "$decompiledir/$nms/$f.java" ]; then + echo "$(color 1 31) ERROR!!! Missing NMS$(color 1 34) $f $(colorend)"; + else + import $f + fi + fi + fi +done + +import NBTList +import TileEntityTypes + +set -e cd "$workdir/Spigot/Spigot-Server/" rm -rf nms-patches applyPatches.sh makePatches.sh >/dev/null 2>&1 $gitcmd add . -A >/dev/null 2>&1 diff --git a/scripts/rebuildPatches.sh b/scripts/rebuildPatches.sh index e0f6af26f9..ef64ea8182 100755 --- a/scripts/rebuildPatches.sh +++ b/scripts/rebuildPatches.sh @@ -39,10 +39,11 @@ function savePatches { echo "REBASE DETECTED - PARTIAL SAVE" last=$(cat "$basedir/$target/.git/rebase-apply/last") next=$(cat "$basedir/$target/.git/rebase-apply/next") + orderedfiles=$(find . -name "*.patch" | sort) for i in $(seq -f "%04g" 1 1 $last) do if [ $i -lt $next ]; then - rm ${i}-*.patch + rm $(echo "$orderedfiles{@}" | sed -n "${i}p") fi done else diff --git a/scripts/remap.sh b/scripts/remap.sh index c64bcca87f..b19d564af4 100755 --- a/scripts/remap.sh +++ b/scripts/remap.sh @@ -6,6 +6,7 @@ PS1="$" basedir="$(cd "$1" && pwd -P)" workdir="$basedir/work" minecraftversion=$(cat "${workdir}/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4) +minecraftserverurl=$(cat "${workdir}/BuildData/info.json" | grep serverUrl | cut -d '"' -f 4) minecrafthash=$(cat "${workdir}/BuildData/info.json" | grep minecraftHash | cut -d '"' -f 4) accesstransforms="$workdir/BuildData/mappings/"$(cat "${workdir}/BuildData/info.json" | grep accessTransforms | cut -d '"' -f 4) classmappings="$workdir/BuildData/mappings/"$(cat "${workdir}/BuildData/info.json" | grep classMappings | cut -d '"' -f 4) @@ -16,7 +17,7 @@ jarpath="$workdir/Minecraft/$minecraftversion/$minecraftversion" echo "Downloading unmapped vanilla jar..." if [ ! -f "$jarpath.jar" ]; then mkdir -p "$workdir/Minecraft/$minecraftversion" - curl -s -o "$jarpath.jar" "https://s3.amazonaws.com/Minecraft.Download/versions/$minecraftversion/minecraft_server.$minecraftversion.jar" + curl -s -o "$jarpath.jar" "$minecraftserverurl" if [ "$?" != "0" ]; then echo "Failed to download the vanilla server jar. Check connectivity or try again later." exit 1 diff --git a/scripts/testServer.sh b/scripts/testServer.sh index 0a7cfbf25e..585768fa38 100755 --- a/scripts/testServer.sh +++ b/scripts/testServer.sh @@ -11,7 +11,7 @@ gitcmd="git -c commit.gpgsign=false" # # FUNCTIONS # -. $basedir/scripts/functions.sh +source $basedir/scripts/functions.sh updateTest() { paperstash diff --git a/work/BuildData b/work/BuildData index be360cc298..a5effc6142 160000 --- a/work/BuildData +++ b/work/BuildData @@ -1 +1 @@ -Subproject commit be360cc298a06b5355ecd057f5b1feb894a73f0f +Subproject commit a5effc614208d06202688a775f25d7b820b36d47 diff --git a/work/Bukkit b/work/Bukkit index bdd0eda71f..55a3379d9b 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit bdd0eda71f87cb8ca3b1842bd9bbd43bba5a08bd +Subproject commit 55a3379d9bcd38efb5c4f4d0db8bcee39db853df diff --git a/work/CraftBukkit b/work/CraftBukkit index 57ab4cfc6f..8fbc72b714 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 57ab4cfc6f4ff526d44319d9b8c79f6848db2de7 +Subproject commit 8fbc72b714a5051c6df8f05ac97528d747f1bdeb diff --git a/work/Spigot b/work/Spigot index 642f6d2288..6505f06b35 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit 642f6d2288b830f41347e8c0a162fbc0584e1579 +Subproject commit 6505f06b355d5f1ea0fff2d0e8edbd60b2f75354