Archiviert
13
0

More 1.14 patches

Dieser Commit ist enthalten in:
Spottedleaf 2019-04-28 10:59:47 -07:00
Ursprung 799f6af357
Commit 4296582054
23 geänderte Dateien mit 281 neuen und 316 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,102 @@
From da358531a943040a325275a457afe2a94571e7b1 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 14 Jan 2018 17:01:31 -0500
Subject: [PATCH] PreCreatureSpawnEvent
Adds an event to fire before an Entity is created, so that plugins that need to cancel
CreatureSpawnEvent can do so from this event instead.
Cancelling CreatureSpawnEvent rapidly causes a lot of garbage collection and CPU waste
as it's done after the Entity object has been fully created.
Mob Limiting plugins and blanket "ban this type of monster" plugins should use this event
instead and save a lot of server resources.
See: https://github.com/PaperMC/Paper/issues/917
diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java
index 9aed0d6b8..dce9e2fc1 100644
--- a/src/main/java/net/minecraft/server/EntityTypes.java
+++ b/src/main/java/net/minecraft/server/EntityTypes.java
@@ -271,6 +271,7 @@ public class EntityTypes<T extends Entity> {
return this.bf;
}
+ public final MinecraftKey getKey() { return this.g(); } // Paper - OBFHELPER
public MinecraftKey g() {
if (this.bg == null) {
MinecraftKey minecraftkey = IRegistry.ENTITY_TYPE.getKey(this);
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index d8ae336e9..bca0e3a2e 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -103,6 +103,27 @@ public abstract class MobSpawnerAbstract {
double d4 = j >= 2 ? nbttaglist.h(1) : (double) (blockposition.getY() + world.random.nextInt(3) - 1);
double d5 = j >= 3 ? nbttaglist.h(2) : (double) blockposition.getZ() + (world.random.nextDouble() - world.random.nextDouble()) * (double) this.spawnRange + 0.5D;
+ // Paper start
+ EntityTypes entityType = optional.get();
+ String key = entityType.getKey().getKey();
+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key);
+ if (type != null) {
+ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event;
+ event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
+ MCUtil.toLocation(world, d3, d4, d5),
+ type,
+ org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER
+ );
+ if (!event.callEvent()) {
+ flag = true;
+ if (event.shouldAbortSpawn()) {
+ break;
+ }
+ continue;
+ }
+ }
+ // Paper end
+
if (world.c(((EntityTypes) optional.get()).a(d3, d4, d5))) {
Entity entity = EntityTypes.a(nbttagcompound, world, (entity1) -> {
entity1.setPositionRotation(d3, d4, d5, entity1.yaw, entity1.pitch);
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 7e58e4714..e5695c760 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -38,7 +38,7 @@ public final class SpawnerCreature {
BiomeBase.BiomeMeta biomebase_biomemeta = null;
GroupDataEntity groupdataentity = null;
int l1 = MathHelper.f(Math.random() * 4.0D);
- int i2 = 0;
+ int i2 = 0; // Paper - force diff on name change
int j2 = 0;
while (true) {
@@ -74,6 +74,25 @@ public final class SpawnerCreature {
if (entitypositiontypes_surface != null && a(entitypositiontypes_surface, (IWorldReader) world, (BlockPosition) blockposition_mutableblockposition, entitytypes) && world.c(entitytypes.a((double) f, (double) k, (double) f1))) {
EntityInsentient entityinsentient;
+ // Paper start
+ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event;
+ EntityTypes<?> cls = biomebase_biomemeta.b;
+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(cls.getKey().getKey());
+ if (type != null) {
+ event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
+ MCUtil.toLocation(world, blockposition_mutableblockposition),
+ type, SpawnReason.NATURAL
+ );
+ if (!event.callEvent()) {
+ if (event.shouldAbortSpawn()) {
+ return;
+ }
+ ++i2;
+ continue;
+ }
+ }
+ // Paper end
+
try {
Entity entity = entitytypes.a(world);
--
2.21.0

Datei anzeigen

@ -0,0 +1,36 @@
From 3755330b8b9222b50364f326b08619837d0865d2 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 14 Jan 2018 17:36:02 -0500
Subject: [PATCH] PlayerNaturallySpawnCreaturesEvent
This event can be used for when you want to exclude a certain player
from triggering monster spawns on a server.
Also a highly more effecient way to blanket block spawns in a world
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 89a00ff8d..3fab45aa9 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -735,11 +735,16 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
int chunkRange = world.spigotConfig.mobSpawnRange;
chunkRange = (chunkRange > world.spigotConfig.viewDistance) ? (byte) world.spigotConfig.viewDistance : chunkRange;
chunkRange = (chunkRange > 8) ? 8 : chunkRange;
-
- double blockRange = Math.pow(chunkRange << 4, 2);
+ final int finalChunkRange = chunkRange; // Paper for lambda below
+ //double blockRange = Math.pow(chunkRange << 4, 2); // Paper - use the range from the event
// Spigot end
return this.y.a(chunkcoordintpair.pair()).noneMatch((entityplayer) -> {
+ // Paper start -
+ com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent event // TODO deal with int->byte on review (as well as the mess that this code is)
+ = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(entityplayer.getBukkitEntity(), (byte)finalChunkRange);
+ final double blockRange = (double)((event.getSpawnRadius() << 4) * (event.getSpawnRadius() << 4));
+ // Paper end
return !entityplayer.isSpectator() && a(chunkcoordintpair, (Entity) entityplayer) < blockRange; // Spigot
});
}
--
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 4391ebacd07855f754c975a03878cd52421ba6af Mon Sep 17 00:00:00 2001
From 07ae0176d0b9c8fe33856a95e62d95d92412a2fd Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 19 Jan 2018 00:36:25 -0500
Subject: [PATCH] Add setPlayerProfile API for Skulls
@ -7,7 +7,7 @@ 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/craftbukkit/block/CraftSkull.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java
index 110e04597b..c260af11cd 100644
index a4bc7f970..2dd2f476f 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java
@@ -1,5 +1,7 @@
@ -18,7 +18,7 @@ index 110e04597b..c260af11cd 100644
import com.google.common.base.Preconditions;
import com.mojang.authlib.GameProfile;
import net.minecraft.server.MinecraftServer;
@@ -16,6 +18,7 @@ import org.bukkit.block.data.BlockData;
@@ -15,6 +17,7 @@ import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional;
import org.bukkit.block.data.Rotatable;
import org.bukkit.craftbukkit.entity.CraftPlayer;
@ -26,7 +26,7 @@ index 110e04597b..c260af11cd 100644
public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implements Skull {
@@ -106,6 +109,20 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
@@ -105,6 +108,20 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
}
}
@ -48,28 +48,27 @@ index 110e04597b..c260af11cd 100644
public BlockFace getRotation() {
BlockData blockData = getBlockData();
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
index 2ad3acf43b..87e51cf8ad 100644
index f27053276..5c8e16c00 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
@@ -2,6 +2,8 @@ package org.bukkit.craftbukkit.inventory;
@@ -3,6 +3,8 @@ package org.bukkit.craftbukkit.inventory;
import com.google.common.collect.ImmutableMap.Builder;
import com.mojang.authlib.GameProfile;
import java.util.Map;
+import com.destroystokyo.paper.profile.CraftPlayerProfile;
+import com.destroystokyo.paper.profile.PlayerProfile;
import net.minecraft.server.GameProfileSerializer;
import net.minecraft.server.NBTBase;
import net.minecraft.server.NBTTagCompound;
@@ -20,6 +22,8 @@ import org.bukkit.inventory.meta.SkullMeta;
import com.google.common.collect.ImmutableMap.Builder;
import com.mojang.authlib.GameProfile;
@@ -16,6 +18,7 @@ import org.bukkit.craftbukkit.inventory.CraftMetaItem.SerializableMeta;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.inventory.meta.SkullMeta;
+import javax.annotation.Nullable;
+
@DelegateDeserialization(SerializableMeta.class)
class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
@@ -133,6 +137,19 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
@@ -129,6 +132,19 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
return hasOwner() ? profile.getName() : null;
}

Datei anzeigen

@ -1,4 +1,4 @@
From e0ef1c07627248d2d678a1f2e78bd60b763dc9e6 Mon Sep 17 00:00:00 2001
From 175fd070689b73c0be2c7d7048120abf4c50719f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 2 Jan 2018 00:31:26 -0500
Subject: [PATCH] Fill Profile Property Events
@ -11,7 +11,7 @@ If Mojang API does need to be hit, event fire so you can get the results.
This is useful for implementing a ProfileCache for Player Skulls
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
index 4b2a67423f..61cfdf73c8 100644
index 4b2a67423..61cfdf73c 100644
--- a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
@@ -1,5 +1,7 @@

Datei anzeigen

@ -1,14 +1,14 @@
From 94c0804a6d6ad37906d49bd91e7313a06729d90a Mon Sep 17 00:00:00 2001
From 9545982da8ce414d8e40563962799a070cdc2c27 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 19 Jan 2018 08:15:29 -0600
Subject: [PATCH] PlayerAdvancementCriterionGrantEvent
diff --git a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java
index 519bccdad0..c7ad71c5f3 100644
index 71158ea8b..ddee2c030 100644
--- a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java
+++ b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java
@@ -228,6 +228,12 @@ public class AdvancementDataPlayer {
@@ -276,6 +276,12 @@ public class AdvancementDataPlayer {
boolean flag1 = advancementprogress.isDone();
if (advancementprogress.a(s)) {

Datei anzeigen

@ -1,4 +1,4 @@
From 3bc7ef8b18050eb0254ac54927d8e0c3bd2ccd20 Mon Sep 17 00:00:00 2001
From 3d8dc5bfef162c4777544c8d604a491225c3d81c Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 27 Jan 2018 17:04:14 -0500
Subject: [PATCH] Add ArmorStand Item Meta
@ -13,7 +13,7 @@ starting point for future additions in this area.
Fixes GH-559
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index 3a6e6f687d..6a86cb7eb4 100644
index dd02fb95a..7c2c4ecc5 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -191,6 +191,8 @@ public final class CraftItemFactory implements ItemFactory {
@ -26,10 +26,10 @@ index 3a6e6f687d..6a86cb7eb4 100644
case CHEST:
case TRAPPED_CHEST:
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index eeb2c5689e..69faeb9c09 100644
index 6c00ca737..4d8013685 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -404,6 +404,8 @@ public final class CraftItemStack extends ItemStack {
@@ -395,6 +395,8 @@ public final class CraftItemStack extends ItemStack {
return new CraftMetaSpawnEgg(item.getTag());
case KNOWLEDGE_BOOK:
return new CraftMetaKnowledgeBook(item.getTag());
@ -40,7 +40,7 @@ index eeb2c5689e..69faeb9c09 100644
case TRAPPED_CHEST:
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java
new file mode 100644
index 0000000000..c00b89c8d4
index 000000000..c00b89c8d
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java
@@ -0,0 +1,311 @@
@ -356,10 +356,10 @@ index 0000000000..c00b89c8d4
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 2508cfcfa2..570f695d82 100644
index b3f8249b0..9435136cc 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -156,6 +156,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -157,6 +157,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
.put(CraftMetaCharge.class, "FIREWORK_EFFECT")
.put(CraftMetaKnowledgeBook.class, "KNOWLEDGE_BOOK")
.put(CraftMetaTropicalFishBucket.class, "TROPICAL_FISH_BUCKET")
@ -367,7 +367,7 @@ index 2508cfcfa2..570f695d82 100644
.put(CraftMetaItem.class, "UNSPECIFIC")
.build();
@@ -1291,7 +1292,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
@@ -1391,7 +1392,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
CraftMetaCharge.EXPLOSION.NBT,
CraftMetaBlockState.BLOCK_ENTITY_TAG.NBT,
CraftMetaKnowledgeBook.BOOK_RECIPES.NBT,
@ -385,18 +385,18 @@ index 2508cfcfa2..570f695d82 100644
}
return HANDLED_TAGS;
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
index 5a2de14fa5..d4f4508cce 100644
index 176b8f528..93c4e1239 100644
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
@@ -8,6 +8,7 @@ import java.util.Arrays;
@@ -6,6 +6,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
+import com.destroystokyo.paper.inventory.meta.ArmorStandMeta; // Paper
import net.minecraft.server.Block;
import net.minecraft.server.IRegistry;
import net.minecraft.server.ITileEntity;
@@ -339,7 +340,18 @@ public class ItemMetaTest extends AbstractTestingBase {
@@ -335,7 +336,18 @@ public class ItemMetaTest extends AbstractTestingBase {
cleanStack.setItemMeta(meta);
return cleanStack;
}

Datei anzeigen

@ -1,4 +1,4 @@
From b023a389347d6f1fdffb80d751e7b4cd82acc382 Mon Sep 17 00:00:00 2001
From c378827bab648bc642354104b0277b765275ce6f Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 11 Feb 2018 10:43:46 +0000
Subject: [PATCH] Extend Player Interact cancellation
@ -13,7 +13,7 @@ Update adjacent blocks of doors, double plants, pistons and beds
when cancelling interaction.
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
index 6ae6afa339..07f9b8d2f7 100644
index a7411c75a..f692da609 100644
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
@@ -111,6 +111,11 @@ public class PlayerInteractManager {
@ -28,7 +28,7 @@ index 6ae6afa339..07f9b8d2f7 100644
// Update any tile entity data for this block
TileEntity tileentity = this.world.getTileEntity(blockposition);
if (tileentity != null) {
@@ -466,7 +471,25 @@ public class PlayerInteractManager {
@@ -443,7 +448,25 @@ public class PlayerInteractManager {
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, bottom ? blockposition.up() : blockposition.down()));
} else if (iblockdata.getBlock() instanceof BlockCake) {
((EntityPlayer) entityhuman).getBukkitEntity().sendHealthUpdate(); // SPIGOT-1341 - reset health for cake

Datei anzeigen

@ -1,4 +1,4 @@
From 4493c2e352b6568517bae5413d36b6c8c06531c5 Mon Sep 17 00:00:00 2001
From fbe1d515b22f27d9a619256afd81899fa198f1aa Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 24 Feb 2018 01:14:55 -0500
Subject: [PATCH] Tameable#getOwnerUniqueId API
@ -7,7 +7,7 @@ This is faster if all you need is the UUID, as .getOwner() will cause
an OfflinePlayer to be loaded from disk.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
index e56bef3340..cc9d432e7f 100644
index e56bef334..cc9d432e7 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
@@ -83,6 +83,9 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac
@ -21,10 +21,10 @@ index e56bef3340..cc9d432e7f 100644
return getHandle().getOwnerUUID();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java
index eaaebeab83..2e959321b5 100644
index 2498fba31..0869cb091 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java
@@ -18,6 +18,9 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat
@@ -17,6 +17,9 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat
return (EntityTameableAnimal)super.getHandle();
}

Datei anzeigen

@ -1,14 +1,14 @@
From 0bef2f366cef39dcaf0a10707d705746496694b2 Mon Sep 17 00:00:00 2001
From 083c75803c43b7f597b8f1b1b25b6f762535b908 Mon Sep 17 00:00:00 2001
From: MiniDigger <admin@minidigger.me>
Date: Sat, 10 Mar 2018 00:50:24 +0100
Subject: [PATCH] Toggleable player crits, helps mitigate hacked clients.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 07a8ef697f..f68b8a4b05 100644
index c3e61bdfe..32bfe0e46 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -191,6 +191,11 @@ public class PaperWorldConfig {
@@ -182,6 +182,11 @@ public class PaperWorldConfig {
disableChestCatDetection = getBoolean("game-mechanics.disable-chest-cat-detection", false);
}
@ -21,12 +21,12 @@ index 07a8ef697f..f68b8a4b05 100644
private void allChunksAreSlimeChunks() {
allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false);
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 259f73f66e..1640098c35 100644
index a30d88af8..58e2601ef 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -1029,6 +1029,7 @@ public abstract class EntityHuman extends EntityLiving {
@@ -981,6 +981,7 @@ public abstract class EntityHuman extends EntityLiving {
boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.z_() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && entity instanceof EntityLiving;
boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.isClimbing() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && entity instanceof EntityLiving;
+ flag2 = flag2 && !world.paperConfig.disablePlayerCrits; // Paper
flag2 = flag2 && !this.isSprinting();

Datei anzeigen

@ -1,4 +1,4 @@
From 85d587cafd70f53179e5748723089d875afe28c6 Mon Sep 17 00:00:00 2001
From 59a62d526fd2db7cfe0976fa63bc0e2be2cd90d9 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sat, 10 Mar 2018 13:03:49 +0000
Subject: [PATCH] Fix NPE when getting location from InventoryEnderChest opened
@ -6,7 +6,7 @@ Subject: [PATCH] Fix NPE when getting location from InventoryEnderChest opened
diff --git a/src/main/java/net/minecraft/server/InventoryEnderChest.java b/src/main/java/net/minecraft/server/InventoryEnderChest.java
index ac81d3f86b..f50bae0123 100644
index 343670b20..6960ad433 100644
--- a/src/main/java/net/minecraft/server/InventoryEnderChest.java
+++ b/src/main/java/net/minecraft/server/InventoryEnderChest.java
@@ -5,7 +5,7 @@ import org.bukkit.inventory.InventoryHolder;

Datei anzeigen

@ -1,14 +1,14 @@
From 4a099bffa3eb608b42cf27f5796a192910a17811 Mon Sep 17 00:00:00 2001
From 4e2293389a9c1d4a8a4b6b9f082c383a33282a9d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 10 Mar 2018 16:33:15 -0500
Subject: [PATCH] Prevent Frosted Ice from loading/holding chunks
diff --git a/src/main/java/net/minecraft/server/BlockIceFrost.java b/src/main/java/net/minecraft/server/BlockIceFrost.java
index 2c881be1ed..2c4bbc7890 100644
index 39c3bbc9c..881dfb123 100644
--- a/src/main/java/net/minecraft/server/BlockIceFrost.java
+++ b/src/main/java/net/minecraft/server/BlockIceFrost.java
@@ -25,7 +25,8 @@ public class BlockIceFrost extends BlockIce {
@@ -26,7 +26,8 @@ public class BlockIceFrost extends BlockIce {
EnumDirection enumdirection = aenumdirection[j];
blockposition_pooledblockposition.g(blockposition).c(enumdirection);
@ -16,9 +16,9 @@ index 2c881be1ed..2c4bbc7890 100644
+ IBlockData iblockdata1 = world.getTypeIfLoaded(blockposition_pooledblockposition); // Paper - don't load chunks
+ if (iblockdata1 == null) continue; // Paper
if (iblockdata1.getBlock() == this && !this.c(iblockdata1, world, blockposition_pooledblockposition)) {
if (iblockdata1.getBlock() == this && !this.e(iblockdata1, world, blockposition_pooledblockposition)) {
world.getBlockTickList().a(blockposition_pooledblockposition, this, MathHelper.nextInt(random, world.paperConfig.frostedIceDelayMin, world.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay
@@ -87,7 +88,7 @@ public class BlockIceFrost extends BlockIce {
@@ -89,7 +90,7 @@ public class BlockIceFrost extends BlockIce {
EnumDirection enumdirection = aenumdirection[l];
blockposition_pooledblockposition.g(blockposition).c(enumdirection);

Datei anzeigen

@ -1,4 +1,4 @@
From 1105176f71d6e381da53db34eb762f4b38fcf0b5 Mon Sep 17 00:00:00 2001
From 6038b08ae7ea24cae5b4453e5e2401f06fe3763f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 11 Mar 2018 14:13:33 -0400
Subject: [PATCH] Disable Explicit Network Manager Flushing
@ -12,7 +12,7 @@ flushing on the netty event loop, so it won't do the flush on the main thread.
Renable flushing by passing -Dpaper.explicit-flush=true
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 2ff2549d0e..4a50aab512 100644
index 5d5e23c18..6c5544807 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -65,6 +65,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@ -23,7 +23,7 @@ index 2ff2549d0e..4a50aab512 100644
// Paper end
public NetworkManager(EnumProtocolDirection enumprotocoldirection) {
@@ -237,7 +238,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@@ -241,7 +242,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
if (this.channel != null) {

Datei anzeigen

@ -1,4 +1,4 @@
From 57a34945bc749450dd4d4d4c80ffca262cc59ee3 Mon Sep 17 00:00:00 2001
From 20af9903243aa2a49973b413011de18e113a4f92 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Wed, 11 Oct 2017 15:56:26 +0200
Subject: [PATCH] Implement extended PaperServerListPingEvent
@ -6,7 +6,7 @@ Subject: [PATCH] Implement extended PaperServerListPingEvent
diff --git a/src/main/java/com/destroystokyo/paper/network/PaperServerListPingEventImpl.java b/src/main/java/com/destroystokyo/paper/network/PaperServerListPingEventImpl.java
new file mode 100644
index 0000000000..c1a8e295b6
index 000000000..c1a8e295b
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/network/PaperServerListPingEventImpl.java
@@ -0,0 +1,31 @@
@ -43,7 +43,7 @@ index 0000000000..c1a8e295b6
+}
diff --git a/src/main/java/com/destroystokyo/paper/network/PaperStatusClient.java b/src/main/java/com/destroystokyo/paper/network/PaperStatusClient.java
new file mode 100644
index 0000000000..a2a409e635
index 000000000..a2a409e63
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/network/PaperStatusClient.java
@@ -0,0 +1,11 @@
@ -60,7 +60,7 @@ index 0000000000..a2a409e635
+}
diff --git a/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java
new file mode 100644
index 0000000000..a85466bc7e
index 000000000..a85466bc7
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java
@@ -0,0 +1,112 @@
@ -177,7 +177,7 @@ index 0000000000..a85466bc7e
+
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 5517c5fe81..476a729ddf 100644
index 27d0d818b..359ce72fc 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1,6 +1,7 @@
@ -188,20 +188,20 @@ index 5517c5fe81..476a729ddf 100644
import com.google.common.base.Stopwatch;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
@@ -939,7 +940,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
if (i - this.Y >= 5000000000L) {
this.Y = i;
this.m.setPlayerSample(new ServerPing.ServerPingPlayerSample(this.getMaxPlayers(), this.getPlayerCount()));
@@ -1037,7 +1038,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
if (i - this.Z >= 5000000000L) {
this.Z = i;
this.serverPing.setPlayerSample(new ServerPing.ServerPingPlayerSample(this.getMaxPlayers(), this.getPlayerCount()));
- GameProfile[] agameprofile = new GameProfile[Math.min(this.getPlayerCount(), 12)];
+ GameProfile[] agameprofile = new GameProfile[Math.min(this.getPlayerCount(), org.spigotmc.SpigotConfig.playerSample)]; // Paper
int j = MathHelper.nextInt(this.n, 0, this.getPlayerCount() - agameprofile.length);
int j = MathHelper.nextInt(this.q, 0, this.getPlayerCount() - agameprofile.length);
for (int k = 0; k < agameprofile.length; ++k) {
diff --git a/src/main/java/net/minecraft/server/PacketStatusListener.java b/src/main/java/net/minecraft/server/PacketStatusListener.java
index c9edd289ac..8aa121e2f7 100644
index b247a18b9..ba1c76c1a 100644
--- a/src/main/java/net/minecraft/server/PacketStatusListener.java
+++ b/src/main/java/net/minecraft/server/PacketStatusListener.java
@@ -30,6 +30,8 @@ public class PacketStatusListener implements PacketStatusInListener {
@@ -32,6 +32,8 @@ public class PacketStatusListener implements PacketStatusInListener {
this.networkManager.close(PacketStatusListener.a);
} else {
this.d = true;
@ -210,7 +210,7 @@ index c9edd289ac..8aa121e2f7 100644
// CraftBukkit start
// this.networkManager.sendPacket(new PacketStatusOutServerInfo(this.minecraftServer.getServerPing()));
final Object[] players = minecraftServer.getPlayerList().players.toArray();
@@ -125,6 +127,9 @@ public class PacketStatusListener implements PacketStatusInListener {
@@ -127,6 +129,9 @@ public class PacketStatusListener implements PacketStatusInListener {
ping.setServerInfo(new ServerPing.ServerData(minecraftServer.getServerModName() + " " + minecraftServer.getVersion(), version));
this.networkManager.sendPacket(new PacketStatusOutServerInfo(ping));
@ -221,7 +221,7 @@ index c9edd289ac..8aa121e2f7 100644
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/ServerPing.java b/src/main/java/net/minecraft/server/ServerPing.java
index aa125a52dc..ea52e89bd9 100644
index aa125a52d..ea52e89bd 100644
--- a/src/main/java/net/minecraft/server/ServerPing.java
+++ b/src/main/java/net/minecraft/server/ServerPing.java
@@ -29,6 +29,7 @@ public class ServerPing {
@ -246,7 +246,7 @@ index aa125a52dc..ea52e89bd9 100644
this.c = agameprofile;
}
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 56f135f244..9c442dee24 100644
index 0d827815c..062a24c3c 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -290,7 +290,7 @@ public class SpigotConfig

Datei anzeigen

@ -1,4 +1,4 @@
From 4d4337136116ff55f4f1f7cc6af8234d7bcdd382 Mon Sep 17 00:00:00 2001
From c8cbb14ffc51c91d0746aa18089280993e7b0a0b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 16 Mar 2018 22:59:43 -0400
Subject: [PATCH] Improved Async Task Scheduler
@ -32,7 +32,7 @@ operations are decoupled from the sync tasks queue.
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java
new file mode 100644
index 0000000000..3c1992e212
index 000000000..3c1992e21
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java
@@ -0,0 +1,122 @@
@ -159,18 +159,10 @@ index 0000000000..3c1992e212
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 3ef79e3e94..3acfc07666 100644
index 36eecb670..15f165d9b 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -17,7 +17,6 @@ import java.util.function.Consumer;
import java.util.logging.Level;
import co.aikar.timings.MinecraftTimings; // Paper
-import com.destroystokyo.paper.ServerSchedulerReportingWrapper;
import com.destroystokyo.paper.event.server.ServerExceptionEvent;
import com.destroystokyo.paper.exception.ServerSchedulerException;
import org.apache.commons.lang.Validate;
@@ -63,7 +62,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -62,7 +62,7 @@ public class CraftScheduler implements BukkitScheduler {
/**
* Main thread logic only
*/
@ -179,7 +171,7 @@ index 3ef79e3e94..3acfc07666 100644
new Comparator<CraftTask>() {
public int compare(final CraftTask o1, final CraftTask o2) {
int value = Long.compare(o1.getNextRun(), o2.getNextRun());
@@ -79,21 +78,38 @@ public class CraftScheduler implements BukkitScheduler {
@@ -78,21 +78,38 @@ public class CraftScheduler implements BukkitScheduler {
/**
* These are tasks that are currently active. It's provided for 'viewing' the current state.
*/
@ -223,7 +215,7 @@ index 3ef79e3e94..3acfc07666 100644
@Override
public int scheduleSyncDelayedTask(final Plugin plugin, final Runnable task) {
return this.scheduleSyncDelayedTask(plugin, task, 0L);
@@ -210,7 +226,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -209,7 +226,7 @@ public class CraftScheduler implements BukkitScheduler {
} else if (period < CraftTask.NO_REPEATING) {
period = CraftTask.NO_REPEATING;
}
@ -232,7 +224,7 @@ index 3ef79e3e94..3acfc07666 100644
}
@Override
@@ -226,6 +242,11 @@ public class CraftScheduler implements BukkitScheduler {
@@ -225,6 +242,11 @@ public class CraftScheduler implements BukkitScheduler {
if (taskId <= 0) {
return;
}
@ -244,7 +236,7 @@ index 3ef79e3e94..3acfc07666 100644
CraftTask task = runners.get(taskId);
if (task != null) {
task.cancel0();
@@ -266,6 +287,11 @@ public class CraftScheduler implements BukkitScheduler {
@@ -265,6 +287,11 @@ public class CraftScheduler implements BukkitScheduler {
@Override
public void cancelTasks(final Plugin plugin) {
Validate.notNull(plugin, "Cannot cancel tasks of null plugin");
@ -256,7 +248,7 @@ index 3ef79e3e94..3acfc07666 100644
final CraftTask task = new CraftTask(
new Runnable() {
public void run() {
@@ -304,6 +330,13 @@ public class CraftScheduler implements BukkitScheduler {
@@ -303,6 +330,13 @@ public class CraftScheduler implements BukkitScheduler {
@Override
public boolean isCurrentlyRunning(final int taskId) {
@ -270,7 +262,7 @@ index 3ef79e3e94..3acfc07666 100644
final CraftTask task = runners.get(taskId);
if (task == null) {
return false;
@@ -322,6 +355,11 @@ public class CraftScheduler implements BukkitScheduler {
@@ -321,6 +355,11 @@ public class CraftScheduler implements BukkitScheduler {
if (taskId <= 0) {
return false;
}
@ -282,7 +274,7 @@ index 3ef79e3e94..3acfc07666 100644
for (CraftTask task = head.getNext(); task != null; task = task.getNext()) {
if (task.getTaskId() == taskId) {
return task.getPeriod() >= CraftTask.NO_REPEATING; // The task will run
@@ -333,6 +371,12 @@ public class CraftScheduler implements BukkitScheduler {
@@ -332,6 +371,12 @@ public class CraftScheduler implements BukkitScheduler {
@Override
public List<BukkitWorker> getActiveWorkers() {
@ -295,7 +287,7 @@ index 3ef79e3e94..3acfc07666 100644
final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>();
for (final CraftTask taskObj : runners.values()) {
// Iterator will be a best-effort (may fail to grab very new values) if called from an async thread
@@ -370,6 +414,11 @@ public class CraftScheduler implements BukkitScheduler {
@@ -369,6 +414,11 @@ public class CraftScheduler implements BukkitScheduler {
pending.add(task);
}
}
@ -307,7 +299,7 @@ index 3ef79e3e94..3acfc07666 100644
return pending;
}
@@ -377,6 +426,11 @@ public class CraftScheduler implements BukkitScheduler {
@@ -376,6 +426,11 @@ public class CraftScheduler implements BukkitScheduler {
* This method is designed to never block or wait for locks; an immediate execution of all current tasks.
*/
public void mainThreadHeartbeat(final int currentTick) {
@ -319,7 +311,7 @@ index 3ef79e3e94..3acfc07666 100644
this.currentTick = currentTick;
final List<CraftTask> temp = this.temp;
parsePending();
@@ -413,7 +467,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -412,7 +467,7 @@ public class CraftScheduler implements BukkitScheduler {
parsePending();
} else {
//debugTail = debugTail.setNext(new CraftAsyncDebugger(currentTick + RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper
@ -328,7 +320,7 @@ index 3ef79e3e94..3acfc07666 100644
// We don't need to parse pending
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
}
@@ -432,7 +486,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -431,7 +486,7 @@ public class CraftScheduler implements BukkitScheduler {
//debugHead = debugHead.getNextHead(currentTick); // Paper
}
@ -337,7 +329,7 @@ index 3ef79e3e94..3acfc07666 100644
final AtomicReference<CraftTask> tail = this.tail;
CraftTask tailTask = tail.get();
while (!tail.compareAndSet(tailTask, task)) {
@@ -441,7 +495,13 @@ public class CraftScheduler implements BukkitScheduler {
@@ -440,7 +495,13 @@ public class CraftScheduler implements BukkitScheduler {
tailTask.setNext(task);
}
@ -352,7 +344,7 @@ index 3ef79e3e94..3acfc07666 100644
task.setNextRun(currentTick + delay);
addTask(task);
return task;
@@ -460,8 +520,8 @@ public class CraftScheduler implements BukkitScheduler {
@@ -459,8 +520,8 @@ public class CraftScheduler implements BukkitScheduler {
return ids.incrementAndGet();
}
@ -363,7 +355,7 @@ index 3ef79e3e94..3acfc07666 100644
CraftTask head = this.head;
CraftTask task = head.getNext();
CraftTask lastTask = head;
@@ -480,7 +540,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -479,7 +540,7 @@ public class CraftScheduler implements BukkitScheduler {
task.setNext(null);
}
this.head = lastTask;

Datei anzeigen

@ -1,4 +1,4 @@
From 86ea214e8c2c466d1c03fd9460031139d4747478 Mon Sep 17 00:00:00 2001
From 45679906356d36c89d2031de68f3fb5a3bfb84dc Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 18 Mar 2018 11:45:57 -0400
Subject: [PATCH] Ability to change PlayerProfile in AsyncPreLoginEvent
@ -6,7 +6,7 @@ Subject: [PATCH] Ability to change PlayerProfile in AsyncPreLoginEvent
This will allow you to change the players name or skin on login.
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
index 15c01333e7..da5a7b3e92 100644
index fe912e0eb..7c3b9c0b9 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -1,5 +1,7 @@
@ -25,7 +25,7 @@ index 15c01333e7..da5a7b3e92 100644
import org.bukkit.craftbukkit.util.Waitable;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
import org.bukkit.event.player.PlayerPreLoginEvent;
@@ -279,8 +282,16 @@ public class LoginListener implements PacketLoginInListener, ITickable {
@@ -282,8 +285,16 @@ public class LoginListener implements PacketLoginInListener {
java.util.UUID uniqueId = i.getId();
final org.bukkit.craftbukkit.CraftServer server = LoginListener.this.server.server;

Datei anzeigen

@ -1,48 +1,14 @@
From 37d51ffa6650f719bef1b2c76e3d612788df1d6f Mon Sep 17 00:00:00 2001
From 3875cf67129d1cceb03e3c6500121465ad92985c Mon Sep 17 00:00:00 2001
From: MiniDigger <admin@minidigger.me>
Date: Sun, 18 Mar 2018 15:44:44 +0100
Subject: [PATCH] Call PortalCreateEvent for exit portals
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
index aca4071420..a24bd02d5b 100644
index e7ca777c1..7807f7c41 100644
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
@@ -48,6 +48,9 @@ public class PortalTravelAgent {
byte b0 = 1;
byte b1 = 0;
+ java.util.Collection<org.bukkit.block.Block> bukkitBlocks = new java.util.HashSet<>(); // Paper
+ java.util.Map<BlockPosition, IBlockData> nmsBlocks = new java.util.LinkedHashMap<>(); // Paper
+
for (int l = -2; l <= 2; ++l) {
for (int i1 = -2; i1 <= 2; ++i1) {
for (int j1 = -1; j1 < 3; ++j1) {
@@ -56,11 +59,22 @@ public class PortalTravelAgent {
int i2 = k + i1 * 0 - l * 1;
boolean flag2 = j1 < 0;
- this.world.setTypeUpdate(new BlockPosition(k1, l1, i2), flag2 ? Blocks.OBSIDIAN.getBlockData() : Blocks.AIR.getBlockData());
+ // Paper start
+ BlockPosition pos = new BlockPosition(k1, l1, i2);
+ nmsBlocks.put(pos, flag2 ? Blocks.OBSIDIAN.getBlockData() : Blocks.AIR.getBlockData());
+ bukkitBlocks.add(this.world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()));
+ // Paper end
}
}
}
+ // Paper start
+ org.bukkit.event.world.PortalCreateEvent event = new org.bukkit.event.world.PortalCreateEvent(bukkitBlocks, this.world.getWorld(), org.bukkit.event.world.PortalCreateEvent.CreateReason.OBC_DESTINATION);
+ if (event.callEvent()) {
+ nmsBlocks.forEach(this.world::setTypeUpdate);
+ }
+ // Paper end
+
// CraftBukkit start
return new BlockPosition(i, k, k);
}
@@ -404,6 +418,9 @@ public class PortalTravelAgent {
@@ -259,6 +259,9 @@ public class PortalTravelAgent {
l5 = -l5;
}
@ -50,13 +16,13 @@ index aca4071420..a24bd02d5b 100644
+ java.util.Map<BlockPosition, IBlockData> nmsBlocks = new java.util.LinkedHashMap<>(); // Paper
+
if (d0 < 0.0D) {
i1 = MathHelper.clamp(i1, 70, this.world.ab() - 10);
i1 = MathHelper.clamp(i1, 70, this.world.getHeight() - 10);
j5 = i1;
@@ -416,8 +433,11 @@ public class PortalTravelAgent {
@@ -271,8 +274,11 @@ public class PortalTravelAgent {
i4 = j2 + (i3 - 1) * l5 - k2 * k5;
boolean flag1 = l2 < 0;
- blockposition_mutableblockposition.c(j3, l3, i4);
- blockposition_mutableblockposition.d(j3, l3, i4);
- this.world.setTypeUpdate(blockposition_mutableblockposition, flag1 ? Blocks.OBSIDIAN.getBlockData() : Blocks.AIR.getBlockData());
+ // Paper start
+ BlockPosition pos = new BlockPosition(j3, l3, i4);
@ -66,10 +32,10 @@ index aca4071420..a24bd02d5b 100644
}
}
}
@@ -427,7 +447,11 @@ public class PortalTravelAgent {
@@ -282,7 +288,11 @@ public class PortalTravelAgent {
for (i3 = -1; i3 < 4; ++i3) {
if (k2 == -1 || k2 == 2 || i3 == -1 || i3 == 3) {
blockposition_mutableblockposition.c(i5 + k2 * k5, j5 + i3, j2 + k2 * l5);
blockposition_mutableblockposition.d(i5 + k2 * k5, j5 + i3, j2 + k2 * l5);
- this.world.setTypeAndData(blockposition_mutableblockposition, Blocks.OBSIDIAN.getBlockData(), 3);
+ // Paper start
+ BlockPosition pos = new BlockPosition(blockposition_mutableblockposition.getX(), blockposition_mutableblockposition.getY(), blockposition_mutableblockposition.getZ());
@ -79,10 +45,10 @@ index aca4071420..a24bd02d5b 100644
}
}
}
@@ -437,10 +461,22 @@ public class PortalTravelAgent {
@@ -292,10 +302,22 @@ public class PortalTravelAgent {
for (i3 = 0; i3 < 2; ++i3) {
for (l2 = 0; l2 < 3; ++l2) {
blockposition_mutableblockposition.c(i5 + i3 * k5, j5 + l2, j2 + i3 * l5);
blockposition_mutableblockposition.d(i5 + i3 * k5, j5 + l2, j2 + i3 * l5);
- this.world.setTypeAndData(blockposition_mutableblockposition, iblockdata, 18);
+
+ // Paper start

Datei anzeigen

@ -1,4 +1,4 @@
From f4337f8ced9dcb58c32aec67ca2980286cdaa99c Mon Sep 17 00:00:00 2001
From d8553987531b1251d0d2cc0d7746653a7611d19b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 18 Mar 2018 12:29:48 -0400
Subject: [PATCH] Player.setPlayerProfile API
@ -6,32 +6,32 @@ 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/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 1640098c35..7f29d12771 100644
index 58e2601ef..1df83d13a 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -63,7 +63,7 @@ public abstract class EntityHuman extends EntityLiving {
protected int bZ;
protected float ca = 0.02F;
private int g;
- private final GameProfile h;
+ private GameProfile h; public void setProfile(GameProfile profile) { this.h = profile; } // Paper - OBFHELPER
private ItemStack cd;
private final ItemCooldown ce;
@@ -65,7 +65,7 @@ public abstract class EntityHuman extends EntityLiving {
protected int bR;
protected final float bS = 0.02F;
private int bU;
- private final GameProfile bV;
+ private GameProfile bV; public final void setProfile(final GameProfile profile) { this.bV = profile; } // Paper - OBFHELPER
private ItemStack bX;
private final ItemCooldown bY;
@Nullable
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
index da5a7b3e92..c5801122dd 100644
index 7c3b9c0b9..d4d752ddb 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -37,7 +37,7 @@ public class LoginListener implements PacketLoginInListener, ITickable {
@@ -37,7 +37,7 @@ public class LoginListener implements PacketLoginInListener {
public final NetworkManager networkManager;
private LoginListener.EnumProtocolState g;
private int h;
- private GameProfile i;
+ private GameProfile i; private void setGameProfile(GameProfile profile) { i = profile; } private GameProfile getGameProfile() { return i; } // Paper - OBFHELPER
+ private GameProfile i; private void setGameProfile(final GameProfile profile) { this.i = profile; } private GameProfile getGameProfile() { return this.i; } // Paper - OBFHELPER
private final String j;
private SecretKey loginKey;
private EntityPlayer l;
@@ -283,12 +283,12 @@ public class LoginListener implements PacketLoginInListener, ITickable {
@@ -286,12 +286,12 @@ public class LoginListener implements PacketLoginInListener {
final org.bukkit.craftbukkit.CraftServer server = LoginListener.this.server.server;
// Paper start
@ -48,7 +48,7 @@ index da5a7b3e92..c5801122dd 100644
uniqueId = i.getId();
// 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 e6dadde80f..66873e98fe 100644
index bea3ddf31..1aff6cab9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1,6 +1,8 @@
@ -60,38 +60,37 @@ index e6dadde80f..66873e98fe 100644
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
import com.google.common.io.BaseEncoding;
@@ -1166,8 +1168,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1192,8 +1194,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
hiddenPlayers.put(player.getUniqueId(), hidingPlugins);
// Remove this player from the hidden player's EntityTrackerEntry
- EntityTracker tracker = ((WorldServer) entity.world).tracker;
EntityPlayer other = ((CraftPlayer) player).getHandle();
- PlayerChunkMap tracker = ((WorldServer) entity.world).getChunkProvider().playerChunkMap;
+ // Paper start
EntityPlayer other = ((CraftPlayer) player).getHandle();
+ unregisterPlayer(other);
+ }
+ private void unregisterPlayer(EntityPlayer other) {
+ EntityTracker tracker = ((WorldServer) entity.world).tracker;
+ PlayerChunkMap tracker = ((WorldServer) entity.world).getChunkProvider().playerChunkMap;
+ // Paper end
+
EntityTrackerEntry entry = tracker.trackedEntities.get(other.getId());
PlayerChunkMap.EntityTracker entry = tracker.trackedEntities.get(other.getId());
if (entry != null) {
entry.clear(getHandle());
@@ -1208,8 +1216,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1234,8 +1241,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
hiddenPlayers.remove(player.getUniqueId());
- EntityTracker tracker = ((WorldServer) entity.world).tracker;
- PlayerChunkMap tracker = ((WorldServer) entity.world).getChunkProvider().playerChunkMap;
+ // Paper start
EntityPlayer other = ((CraftPlayer) player).getHandle();
+ registerPlayer(other);
+ }
+ private void registerPlayer(EntityPlayer other) {
+ EntityTracker tracker = ((WorldServer) entity.world).tracker;
+ PlayerChunkMap tracker = ((WorldServer) entity.world).getChunkProvider().playerChunkMap;
+ // Paper end
getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, other));
@@ -1218,6 +1231,46 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1244,6 +1256,46 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
entry.updatePlayer(getHandle());
}
}
@ -124,7 +123,7 @@ index e6dadde80f..66873e98fe 100644
+ reregisterPlayer(handle);
+
+ //Respawn the player then update their position and selected slot
+ connection.sendPacket(new net.minecraft.server.PacketPlayOutRespawn(handle.dimension, handle.world.getDifficulty(), handle.world.getWorldData().getType(), handle.playerInteractManager.getGameMode()));
+ connection.sendPacket(new net.minecraft.server.PacketPlayOutRespawn(handle.dimension, handle.world.getWorldData().getType(), handle.playerInteractManager.getGameMode()));
+ handle.updateAbilities();
+ connection.sendPacket(new net.minecraft.server.PacketPlayOutPosition(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), new HashSet<>(), 0));
+ net.minecraft.server.MinecraftServer.getServer().getPlayerList().updateClient(handle);

Datei anzeigen

@ -1,4 +1,4 @@
From dae72772a85c9b8252ab9d61ad0996e5b53dd994 Mon Sep 17 00:00:00 2001
From ffe8cbd067c4fe4f42307a5356a6effdf74d2b94 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 21 Mar 2018 20:52:07 -0400
Subject: [PATCH] Fix Dragon Server Crashes
@ -7,17 +7,17 @@ If the dragon tries to find "ground" and hits a hole, or off edge,
it will infinitely keep looking for non air and eventually crash.
diff --git a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java
index 1180e7bc11..1906bcfc96 100644
index cfe84f4d4..4ab310cd6 100644
--- a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java
+++ b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java
@@ -51,7 +51,7 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded
double d2 = this.a.bD.locY + (double) (this.a.bD.length / 2.0F);
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(MathHelper.floor(d0), MathHelper.floor(d2), MathHelper.floor(d1));
@@ -53,7 +53,7 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded
double d2 = this.a.bA.locY + (double) (this.a.bA.getHeight() / 2.0F);
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(d0, d2, d1);
- while (this.a.world.isEmpty(blockposition_mutableblockposition)) {
+ while (this.a.world.isEmpty(blockposition_mutableblockposition ) && d2 > 0) { // Paper
--d2;
blockposition_mutableblockposition.c(MathHelper.floor(d0), MathHelper.floor(d2), MathHelper.floor(d1));
blockposition_mutableblockposition.c(d0, d2, d1);
}
--
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From a15ff921d068b1fd91c7153fb56cf872852d38cf Mon Sep 17 00:00:00 2001
From 50f2f6e9b61b949b54283000b425ec12b2398ab1 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 22 Mar 2018 01:40:24 -0400
Subject: [PATCH] getPlayerUniqueId API
@ -9,10 +9,10 @@ In Offline Mode, will return an Offline UUID
This is a more performant way to obtain a UUID for a name than loading an OfflinePlayer
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 8315f63775..268653acd1 100644
index 2173f34fe..01ed56a2a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1417,6 +1417,26 @@ public final class CraftServer implements Server {
@@ -1351,6 +1351,26 @@ public final class CraftServer implements Server {
return recipients.size();
}

Datei anzeigen

@ -1,14 +1,14 @@
From 7400a595ae1c233ace959e015b466b112895ecd1 Mon Sep 17 00:00:00 2001
From d3058492827153f44ddc06e920ba3b6424d59159 Mon Sep 17 00:00:00 2001
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
Date: Mon, 26 Mar 2018 18:30:53 +0300
Subject: [PATCH] Make player data saving configurable
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 2b5dde6d99..b85cd10437 100644
index a9cf1b8e8..7fba61a6d 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -291,4 +291,13 @@ public class PaperConfig {
@@ -267,4 +267,13 @@ public class PaperConfig {
private static void authenticationServersDownKickMessage() {
authenticationServersDownKickMessage = Strings.emptyToNull(getString("messages.kick.authentication-servers-down", authenticationServersDownKickMessage));
}
@ -23,17 +23,17 @@ index 2b5dde6d99..b85cd10437 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java
index c4173c0aad..d5e21cc33c 100644
index a0254d8e5..e60e10c57 100644
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
@@ -141,6 +141,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
}
@@ -138,6 +138,7 @@ public class WorldNBTStorage implements IPlayerFileData {
@Override
public void save(EntityHuman entityhuman) {
+ if(!com.destroystokyo.paper.PaperConfig.savePlayerData) return; // Paper - Make player data saving configurable
try {
NBTTagCompound nbttagcompound = entityhuman.save(new NBTTagCompound());
File file = new File(this.playerDir, entityhuman.bu() + ".dat.tmp");
File file = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat.tmp");
--
2.21.0

Datei anzeigen

@ -1,4 +1,4 @@
From 7c84ab3fa1f74dec63abd7d7af1163e1d98f2d73 Mon Sep 17 00:00:00 2001
From 2d7542f78a2a2e686c4777b782f5ef15576a4ac5 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Wed, 11 Oct 2017 18:22:50 +0200
Subject: [PATCH] Make legacy ping handler more reliable
@ -28,12 +28,12 @@ respond to the request.
[2]: https://netty.io/wiki/user-guide-for-4.x.html#wiki-h4-13
diff --git a/src/main/java/net/minecraft/server/LegacyPingHandler.java b/src/main/java/net/minecraft/server/LegacyPingHandler.java
index 204aa82298..2a99f34df6 100644
index c8c5df7f9..9bc1cce3f 100644
--- a/src/main/java/net/minecraft/server/LegacyPingHandler.java
+++ b/src/main/java/net/minecraft/server/LegacyPingHandler.java
@@ -14,6 +14,7 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter {
private static final Logger a = LogManager.getLogger();
private static final Logger LOGGER = LogManager.getLogger();
private final ServerConnection b;
+ private ByteBuf buf; // Paper

Datei anzeigen

@ -1,96 +0,0 @@
From 4393dd1c81c81419675b7914dbd37b92a34352c0 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 14 Jan 2018 17:01:31 -0500
Subject: [PATCH] PreCreatureSpawnEvent
Adds an event to fire before an Entity is created, so that plugins that need to cancel
CreatureSpawnEvent can do so from this event instead.
Cancelling CreatureSpawnEvent rapidly causes a lot of garbage collection and CPU waste
as it's done after the Entity object has been fully created.
Mob Limiting plugins and blanket "ban this type of monster" plugins should use this event
instead and save a lot of server resources.
See: https://github.com/PaperMC/Paper/issues/917
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index 027ba71918..eca3f85ad2 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -1,6 +1,7 @@
package net.minecraft.server;
import com.google.common.collect.Lists;
+
import java.util.Iterator;
import java.util.List;
import javax.annotation.Nullable;
@@ -94,6 +95,28 @@ public abstract class MobSpawnerAbstract {
double d3 = j >= 1 ? nbttaglist.k(0) : (double) blockposition.getX() + (world.random.nextDouble() - world.random.nextDouble()) * (double) this.spawnRange + 0.5D;
double d4 = j >= 2 ? nbttaglist.k(1) : (double) (blockposition.getY() + world.random.nextInt(3) - 1);
double d5 = j >= 3 ? nbttaglist.k(2) : (double) blockposition.getZ() + (world.random.nextDouble() - world.random.nextDouble()) * (double) this.spawnRange + 0.5D;
+ // Paper start
+ if (this.getMobName() == null) {
+ return;
+ }
+ String key = this.getMobName().getKey();
+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key);
+ if (type != null) {
+ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event;
+ event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
+ MCUtil.toLocation(world, d3, d4, d5),
+ type,
+ org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER
+ );
+ if (!event.callEvent()) {
+ flag = true;
+ if (event.shouldAbortSpawn()) {
+ break;
+ }
+ continue;
+ }
+ }
+ // Paper end
Entity entity = ChunkRegionLoader.a(nbttagcompound, world, d3, d4, d5, false);
if (entity == null) {
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 2aa0db5c22..b57616960e 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -164,10 +164,30 @@ public final class SpawnerCreature {
if (worldserver.a(enumcreaturetype, biomebase_biomemeta, (BlockPosition) blockposition_mutableblockposition)) {
EntityPositionTypes.Surface entitypositiontypes_surface = EntityPositionTypes.a(biomebase_biomemeta.b);
-
if (entitypositiontypes_surface != null && a(entitypositiontypes_surface, worldserver, blockposition_mutableblockposition, biomebase_biomemeta.b)) {
EntityInsentient entityinsentient;
+ // Paper start
+ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event;
+ EntityTypes<? extends EntityInsentient> cls = biomebase_biomemeta.b;
+ org.bukkit.entity.EntityType type = EntityTypes.clsToTypeMap.get(cls);
+ if (type != null) {
+ event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
+ MCUtil.toLocation(worldserver, blockposition_mutableblockposition),
+ type, SpawnReason.NATURAL
+ );
+ if (!event.callEvent()) {
+ if (event.shouldAbortSpawn()) {
+ continue label137; // right above the iterator for c (Chunk Pos Set)
+ }
+ j1 += l2;
+ ++j4;
+ continue;
+ }
+ }
+ // Paper end
+
+
try {
entityinsentient = (EntityInsentient) biomebase_biomemeta.b.a((World) worldserver);
} catch (Exception exception) {
--
2.21.0

Datei anzeigen

@ -1,33 +0,0 @@
From 078b33cbd82794119f8708f500185e745e38c5ba Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 14 Jan 2018 17:36:02 -0500
Subject: [PATCH] PlayerNaturallySpawnCreaturesEvent
This event can be used for when you want to exclude a certain player
from triggering monster spawns on a server.
Also a highly more effecient way to blanket block spawns in a world
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index b57616960e..e626165520 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -47,6 +47,15 @@ public final class SpawnerCreature {
byte b0 = worldserver.spigotConfig.mobSpawnRange;
b0 = ( b0 > entityhuman.getViewDistance() ) ? (byte) entityhuman.getViewDistance() : b0; // Paper - Use player view distance API
b0 = ( b0 > 8 ) ? 8 : b0;
+ // Paper start
+ com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent event;
+ event = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(
+ (org.bukkit.entity.Player) entityhuman.getBukkitEntity(), b0);
+ if (!event.callEvent()) {
+ continue;
+ }
+ b0 = event.getSpawnRadius();
+ // Paperr end
for (int i1 = -b0; i1 <= b0; ++i1) {
for (k = -b0; k <= b0; ++k) {
--
2.21.0