even more wooooooooooooooooooooooooork uwu
This commit is contained in:
parent
8125b3f1be
commit
79da8f0eca
|
@ -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 0cfad6f84eda6f7bfa1fae041341ccb1021b157d..e89c8079625525667f496c06207da655fe43d749 100644
|
||||
index d4c69573f250309adc442c7cf67ea6fc2f2e3ace..969a6cf404d99c186e73321659240195b8650ffc 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -269,6 +269,16 @@ public interface Block extends Metadatable {
|
|
@ -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 21bed0d8075335538374fadfdf1cb868e4eebe80..9d1ad67b7d220ab425ac9bf6b1c8d8fb8d5f416c 100644
|
||||
index a32c4bd276de797f518771460083050fcddc4c5b..9a262d412b2762a33a60b1e8762a7d9c9c3f933d 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -892,12 +892,33 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
|
@ -2,7 +2,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 29 Nov 2017 22:18:54 -0500
|
||||
Subject: [PATCH] Avoid NPE in PathfinderGoalTempt
|
||||
|
||||
Not needed anymore
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/TemptGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/TemptGoal.java
|
||||
index 186025458e923d153e9e47c2be147a9bb53db517..11ca6a752bac4ba4bc683bef844d204b739fab63 100644
|
|
@ -2,7 +2,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 19 Dec 2017 22:57:26 -0500
|
||||
Subject: [PATCH] ExperienceOrbMergeEvent
|
||||
|
||||
Has to be reimplemented at one point maybe
|
||||
Fired when the server is about to merge 2 experience orbs
|
||||
Plugins can cancel this if they want to ensure experience orbs do not lose important
|
||||
metadata such as spawn reason, or conditionally move data from source to target.
|
|
@ -2,7 +2,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 14 Jan 2018 17:01:31 -0500
|
||||
Subject: [PATCH] PreCreatureSpawnEvent
|
||||
|
||||
1.17: Has to be looked into more
|
||||
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.
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 19 Dec 2017 22:02:53 -0500
|
||||
Subject: [PATCH] PlayerPickupExperienceEvent
|
||||
|
||||
Allows plugins to cancel a player picking up an experience orb
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
||||
index 3ddb0a9f15c920c9a2080f76edfda0504c1e287a..885c5a920204a31b24c7d360390eaf4177c30698 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
||||
@@ -5,6 +5,7 @@ import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.game.ClientboundAddExperienceOrbPacket;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.tags.Tag;
|
||||
@@ -231,7 +232,7 @@ public class ExperienceOrb extends Entity {
|
||||
@Override
|
||||
public void playerTouch(Player player) {
|
||||
if (!this.level.isClientSide) {
|
||||
- if (this.throwTime == 0 && player.takeXpDelay == 0) {
|
||||
+ if (this.throwTime == 0 && player.takeXpDelay == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((ServerPlayer) player).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper
|
||||
player.takeXpDelay = 2;
|
||||
player.take(this, 1);
|
||||
Entry<EquipmentSlot, ItemStack> entry = EnchantmentHelper.getRandomItemWith(Enchantments.MENDING, (LivingEntity) player, ItemStack::isDamaged);
|
|
@ -5,11 +5,11 @@ Subject: [PATCH] Add PlayerArmorChangeEvent
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EquipmentSlot.java b/src/main/java/net/minecraft/world/entity/EquipmentSlot.java
|
||||
index b686b7a2faa4fbce37dcc3598b3c956661b91aaa..17cd5f525a45058ce34c66c87f9c133033bb8f4b 100644
|
||||
index c82bb38b5b1c9204daef21455723d21509ad1c44..135a62fcdbd801c9997bc28c071743e8ff8c64c2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EquipmentSlot.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EquipmentSlot.java
|
||||
@@ -16,6 +16,7 @@ public enum EquipmentSlot {
|
||||
this.name = s;
|
||||
@@ -20,6 +20,7 @@ public enum EquipmentSlot {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
+ public EquipmentSlot.Type getType() { return this.getType(); } // Paper - OBFHELPER
|
||||
|
@ -17,7 +17,7 @@ index b686b7a2faa4fbce37dcc3598b3c956661b91aaa..17cd5f525a45058ce34c66c87f9c1330
|
|||
return this.type;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index d6b4fabd232958ae1fd5405c7129551951cd7765..8b0d1f4fbc43a6f37a5f9c453b5dd142a4f69745 100644
|
||||
index 89913edf98d65f08f379d0d201f9963c23573478..28de49c8b5771491b168bba26e6033669c48e3c9 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1,5 +1,6 @@
|
||||
|
@ -27,7 +27,7 @@ index d6b4fabd232958ae1fd5405c7129551951cd7765..8b0d1f4fbc43a6f37a5f9c453b5dd142
|
|||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@@ -2643,6 +2644,13 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -2937,6 +2938,13 @@ public abstract class LivingEntity extends Entity {
|
||||
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
|
||||
|
||||
if (!ItemStack.matches(itemstack1, itemstack)) {
|
|
@ -6,10 +6,10 @@ Subject: [PATCH] Prevent logins from being processed when the player has
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
index 4b91699ddfa2ee298af5ba25447a85751facf4a4..ff83fb15d0d0adb62c630fc7aafc134972bf15fc 100644
|
||||
index 700ab378f43b3841c82b7aadc1c3818dc0621a58..7923078a4235a6169eb94b7c0ce85e4cd51eb593 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -73,7 +73,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
|
||||
@@ -76,7 +76,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
|
||||
}
|
||||
// Paper end
|
||||
if (this.state == ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT) {
|
|
@ -18,10 +18,10 @@ the blockstate that will be valid for restoration, as opposed to dropping
|
|||
information on restoration when the event is cancelled.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 81713c97f35263f4ab8d14f8b707aac3d6afea11..b4248d46ccb1a95e21601bca1198512287edcabf 100644
|
||||
index a86b5272c0ac4dd64f796f7fd025c7a34a5d2f8d..8859b0483ca71e1a36c164f7d386684540f0bf18 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -124,7 +124,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -140,7 +140,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
|
||||
public boolean captureBlockStates = false;
|
||||
public boolean captureTreeGeneration = false;
|
||||
|
@ -30,16 +30,16 @@ index 81713c97f35263f4ab8d14f8b707aac3d6afea11..b4248d46ccb1a95e21601bca11985122
|
|||
public Map<BlockPos, BlockEntity> capturedTileEntities = new HashMap<>();
|
||||
public List<ItemEntity> captureDrops;
|
||||
public long ticksPerAnimalSpawns;
|
||||
@@ -346,7 +346,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -358,7 +358,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
|
||||
// CraftBukkit start - tree generation
|
||||
if (this.captureTreeGeneration) {
|
||||
- CapturedBlockState blockstate = capturedBlockStates.get(pos);
|
||||
+ CraftBlockState blockstate = capturedBlockStates.get(pos);
|
||||
- CapturedBlockState blockstate = this.capturedBlockStates.get(pos);
|
||||
+ CraftBlockState blockstate = this.capturedBlockStates.get(pos);
|
||||
if (blockstate == null) {
|
||||
blockstate = CapturedBlockState.getTreeBlockState(this, pos, flags);
|
||||
this.capturedBlockStates.put(pos.immutable(), blockstate);
|
||||
@@ -366,7 +366,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -378,7 +378,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
// CraftBukkit start - capture blockstates
|
||||
boolean captured = false;
|
||||
if (this.captureBlockStates && !this.capturedBlockStates.containsKey(pos)) {
|
||||
|
@ -49,12 +49,12 @@ index 81713c97f35263f4ab8d14f8b707aac3d6afea11..b4248d46ccb1a95e21601bca11985122
|
|||
this.capturedBlockStates.put(pos.immutable(), blockstate);
|
||||
captured = true;
|
||||
}
|
||||
@@ -624,7 +625,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -644,7 +645,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public BlockState getBlockState(BlockPos pos) {
|
||||
// CraftBukkit start - tree generation
|
||||
if (captureTreeGeneration) {
|
||||
- CapturedBlockState previous = capturedBlockStates.get(pos);
|
||||
+ CraftBlockState previous = capturedBlockStates.get(pos); // Paper
|
||||
if (this.captureTreeGeneration) {
|
||||
- CapturedBlockState previous = this.capturedBlockStates.get(pos);
|
||||
+ CraftBlockState previous = this.capturedBlockStates.get(pos); // Paper
|
||||
if (previous != null) {
|
||||
return previous.getHandle();
|
||||
}
|
|
@ -13,40 +13,51 @@ also Avoid NPE during CraftBlockEntityState load if could not get TE
|
|||
If Tile Entity was null, correct Sign to return empty lines instead of null
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
index d08ed44884726ca2ba4578226b8aa6244778f4c7..84012c2d12817e657b046bc168cc8eddebcd3831 100644
|
||||
index 9d777fce673c8f6b3ee2d69f5a6360a8a5ad8e84..c3706b87ad36332a837caffb58bd4575cbc0172a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
@@ -47,6 +47,7 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject {
|
||||
public BlockEntity(BlockEntityType<?> type) {
|
||||
this.worldPosition = BlockPos.ZERO;
|
||||
@@ -31,7 +31,7 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject {
|
||||
// CraftBukkit end
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
public boolean isLoadingStructure = false; // Paper
|
||||
- private final BlockEntityType<?> type; public BlockEntityType getTileEntityType() { return type; } // Paper - OBFHELPER
|
||||
+ private final BlockEntityType<?> type;
|
||||
@Nullable
|
||||
protected Level level;
|
||||
protected final BlockPos worldPosition;
|
||||
@@ -42,6 +42,7 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject {
|
||||
this.type = type;
|
||||
this.worldPosition = pos.immutable();
|
||||
this.blockState = state;
|
||||
+ persistentDataContainer = new CraftPersistentDataContainer(DATA_TYPE_REGISTRY); // Paper - always init
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@@ -95,7 +96,7 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject {
|
||||
public void load(BlockState state, CompoundTag tag) {
|
||||
this.worldPosition = new BlockPos(tag.getInt("x"), tag.getInt("y"), tag.getInt("z"));
|
||||
// CraftBukkit start - read container
|
||||
- this.persistentDataContainer = new CraftPersistentDataContainer(DATA_TYPE_REGISTRY);
|
||||
+ this.persistentDataContainer.clear(); // Paper - clear instead of reinit
|
||||
@@ -79,7 +80,7 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject {
|
||||
|
||||
net.minecraft.nbt.Tag persistentDataTag = tag.get("PublicBukkitValues");
|
||||
// CraftBukkit start - read container
|
||||
public void load(CompoundTag nbt) {
|
||||
- this.persistentDataContainer = new CraftPersistentDataContainer(BlockEntity.DATA_TYPE_REGISTRY);
|
||||
+ this.persistentDataContainer.clear();
|
||||
|
||||
net.minecraft.nbt.Tag persistentDataTag = nbt.get("PublicBukkitValues");
|
||||
if (persistentDataTag instanceof CompoundTag) {
|
||||
@@ -245,7 +246,12 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject {
|
||||
@@ -221,8 +222,13 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject {
|
||||
}
|
||||
|
||||
// CraftBukkit start - add method
|
||||
+ // Paper start
|
||||
public InventoryHolder getOwner() {
|
||||
- if (this.level == null) return null;
|
||||
+ return getOwner(true);
|
||||
+ }
|
||||
+ public InventoryHolder getOwner(boolean useSnapshot) {
|
||||
+ // Paper end
|
||||
if (level == null) return null;
|
||||
+ if (level == null) return null;
|
||||
// Spigot start
|
||||
org.bukkit.block.Block block = level.getWorld().getBlockAt(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ());
|
||||
@@ -254,7 +260,7 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject {
|
||||
org.bukkit.block.Block block = this.level.getWorld().getBlockAt(this.worldPosition.getX(), this.worldPosition.getY(), this.worldPosition.getZ());
|
||||
if (block == null) {
|
||||
@@ -230,7 +236,7 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject {
|
||||
return null;
|
||||
}
|
||||
// Spigot end
|
||||
|
@ -56,13 +67,14 @@ index d08ed44884726ca2ba4578226b8aa6244778f4c7..84012c2d12817e657b046bc168cc8edd
|
|||
return null;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
index 9d5b3801205e2800b0bcf238c5656321e3654f03..d73086970db19531db66c2e8af52da91d0b1ea28 100644
|
||||
index 6128eb5a793365822d9b00a86629ad4d86c61da9..ca03ed4b1581df2b7db272d6f330174a9d277153 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -313,6 +313,20 @@ public class CraftBlock implements Block {
|
||||
@@ -313,7 +313,21 @@ public class CraftBlock implements Block {
|
||||
|
||||
@Override
|
||||
public BlockState getState() {
|
||||
- Material material = this.getType();
|
||||
+ // Paper start - allow disabling the use of snapshots
|
||||
+ return getState(true);
|
||||
+ }
|
||||
|
@ -77,11 +89,12 @@ index 9d5b3801205e2800b0bcf238c5656321e3654f03..d73086970db19531db66c2e8af52da91
|
|||
+ }
|
||||
+ public BlockState getState0() {
|
||||
+ // Paper end
|
||||
Material material = getType();
|
||||
+ Material material = getType();
|
||||
|
||||
switch (material) {
|
||||
case ACACIA_SIGN:
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
|
||||
index e89a93082fe07fdb14df8ffef5beca5bd52d7866..730fda7f0bf02400d349959e9cc2aafaed000b21 100644
|
||||
index d57b32090cebfc952ac0a71b8aada85f49275241..9a30770a2f68e1253afe3ca8ecdae19c988248f9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
|
||||
@@ -26,20 +26,40 @@ public class CraftBlockEntityState<T extends BlockEntity> extends CraftBlockStat
|
||||
|
@ -131,12 +144,12 @@ index e89a93082fe07fdb14df8ffef5beca5bd52d7866..730fda7f0bf02400d349959e9cc2aafa
|
|||
|
||||
private T createSnapshot(T tileEntity) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
|
||||
index e3664110bef9315cfde5b61dde98dce77016600e..10ba8b810c1759adc439f753d36108e30cf70140 100644
|
||||
index ddd7b63f0452042baa3fca04bb9fbdb42fcecbfd..b638351581fa09c488425a2318b782a5812140ce 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
|
||||
@@ -155,4 +155,10 @@ public final class CraftPersistentDataContainer implements PersistentDataContain
|
||||
public Map<String, Object> serialize() {
|
||||
return (Map<String, Object>) CraftNBTTagConfigSerializer.serialize(toTagCompound());
|
||||
return (Map<String, Object>) CraftNBTTagConfigSerializer.serialize(this.toTagCompound());
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
|
@ -14,23 +14,23 @@ completion, such as offline players.
|
|||
Also adds isCommand and getLocation to the sync TabCompleteEvent
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 525728268f56470fdc24c4fd2f19d66943447778..8d0c44b6c2c99d5161c5d4b79209b79ff6db75e4 100644
|
||||
index b2bbd25e5572f59add71579b676d5a4c719be239..737296e90e3547505a012fc516a4fc39a565343e 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -711,10 +711,10 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
||||
@@ -703,10 +703,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
|
||||
@Override
|
||||
public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) {
|
||||
- PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||
+ // PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async
|
||||
// CraftBukkit start
|
||||
if (chatSpamField.addAndGet(this, 1) > 500 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) {
|
||||
if (this.chatSpamTickCount.addAndGet(1) > 500 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) {
|
||||
- this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]));
|
||||
+ server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]))); // Paper
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -724,12 +724,35 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
||||
@@ -716,12 +716,35 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
stringreader.skip();
|
||||
}
|
||||
|
||||
|
@ -72,20 +72,20 @@ index 525728268f56470fdc24c4fd2f19d66943447778..8d0c44b6c2c99d5161c5d4b79209b79f
|
|||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index df68599520189e2699c8521d6c6ab7235612af33..10addb128a357e7719854bf4f9d75f5def32b27d 100644
|
||||
index 0be8b1727ce57ec0905315922e1d83104a936cd0..cb09b6170a74984628f2c3dbacad2ddc9fe56faf 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1850,7 +1850,7 @@ public final class CraftServer implements Server {
|
||||
offers = tabCompleteChat(player, message);
|
||||
@@ -1849,7 +1849,7 @@ public final class CraftServer implements Server {
|
||||
offers = this.tabCompleteChat(player, message);
|
||||
}
|
||||
|
||||
- TabCompleteEvent tabEvent = new TabCompleteEvent(player, message, offers);
|
||||
+ TabCompleteEvent tabEvent = new TabCompleteEvent(player, message, offers, message.startsWith("/") || forceCommand, pos != null ? net.minecraft.server.MCUtil.toLocation(((CraftWorld) player.getWorld()).getHandle(), new BlockPos(pos)) : null); // Paper
|
||||
getPluginManager().callEvent(tabEvent);
|
||||
this.getPluginManager().callEvent(tabEvent);
|
||||
|
||||
return tabEvent.isCancelled() ? Collections.EMPTY_LIST : tabEvent.getCompletions();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
|
||||
index a957695457cf3252848ce6ef37069692841b8e28..c5e00bd9e2790992202aadf8eec2002fc88c78f1 100644
|
||||
index b996fde481cebbbcce80a6c267591136db7cc0bc..e5af155d75f717d33c23e22ff8b96bb3ff87844d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
|
||||
@@ -28,6 +28,39 @@ public class ConsoleCommandCompleter implements Completer {
|
|
@ -0,0 +1,20 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 19 Dec 2017 22:02:53 -0500
|
||||
Subject: [PATCH] PlayerPickupExperienceEvent
|
||||
|
||||
Allows plugins to cancel a player picking up an experience orb
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
||||
index 337e861a8b1a89b73560601b704c18dcf446a144..8203c93dcb56646df2614f2233aaf3a36f745d1c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
||||
@@ -303,7 +303,7 @@ public class ExperienceOrb extends Entity {
|
||||
@Override
|
||||
public void playerTouch(Player player) {
|
||||
if (!this.level.isClientSide) {
|
||||
- if (player.takeXpDelay == 0) {
|
||||
+ if (player.takeXpDelay == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((net.minecraft.server.level.ServerPlayer) player).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper
|
||||
player.takeXpDelay = 2;
|
||||
player.take(this, 1);
|
||||
int i = this.repairPlayerItems(player, this.value);
|
|
@ -10,10 +10,10 @@ 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/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
||||
index 885c5a920204a31b24c7d360390eaf4177c30698..52b90ef3a145325209d3d903a2b7c9a44c332cbe 100644
|
||||
index 8203c93dcb56646df2614f2233aaf3a36f745d1c..71fb831ed3359e7986e279c987211f39c581ab23 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
||||
@@ -264,10 +264,12 @@ public class ExperienceOrb extends Entity {
|
||||
@@ -344,10 +344,12 @@ public class ExperienceOrb extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,10 +27,10 @@ index 885c5a920204a31b24c7d360390eaf4177c30698..52b90ef3a145325209d3d903a2b7c9a4
|
|||
return experienceAmount * 2;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/enchantment/EnchantmentHelper.java b/src/main/java/net/minecraft/world/item/enchantment/EnchantmentHelper.java
|
||||
index 045f937f0b7acd73469b65897bea2ca9036acf22..c82e1b6e3ec98530099fd6452fdaaefebfd99b33 100644
|
||||
index 27cdfbeb6cb2159075b35dd4f9e9557ec0eac7c2..d2d7b303e66bbba489e2003cc130dcd53e2a9854 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/enchantment/EnchantmentHelper.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/enchantment/EnchantmentHelper.java
|
||||
@@ -269,8 +269,8 @@ public class EnchantmentHelper {
|
||||
@@ -246,8 +246,8 @@ public class EnchantmentHelper {
|
||||
return getItemEnchantmentLevel(Enchantments.CHANNELING, stack) > 0;
|
||||
}
|
||||
|
||||
|
@ -38,14 +38,14 @@ index 045f937f0b7acd73469b65897bea2ca9036acf22..c82e1b6e3ec98530099fd6452fdaaefe
|
|||
- public static Entry<EquipmentSlot, ItemStack> getRandomItemWith(Enchantment enchantment, LivingEntity entity) {
|
||||
+ public static @javax.annotation.Nonnull ItemStack getRandomEquippedItemWithEnchant(Enchantment enchantment, LivingEntity entityliving) { Entry<EquipmentSlot, ItemStack> entry = getRandomItemWith(enchantment, entityliving); return entry != null ? entry.getValue() : ItemStack.NULL_ITEM; } // Paper - OBFHELPER
|
||||
+ @Nullable public static Entry<EquipmentSlot, ItemStack> getRandomItemWith(Enchantment enchantment, LivingEntity entity) {
|
||||
return getRandomItemWith(enchantment, entity, (itemstack) -> {
|
||||
return getRandomItemWith(enchantment, entity, (stack) -> {
|
||||
return true;
|
||||
});
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 8a5bf0b83c1e65f07e14da0e053a64c34976b91a..efdcb8dac8db15c4bbaed84a7861ce98339e516a 100644
|
||||
index ed1c57f22adc8b96012eca426ed1e7b409e7d663..b1778f53de7974e03c7b56b0df69e31cdae8dd62 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -58,11 +58,14 @@ import net.minecraft.server.level.ServerPlayer;
|
||||
@@ -61,11 +61,14 @@ import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||
import net.minecraft.server.players.UserWhiteListEntry;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
|
@ -58,15 +58,14 @@ index 8a5bf0b83c1e65f07e14da0e053a64c34976b91a..efdcb8dac8db15c4bbaed84a7861ce98
|
|||
+import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
+import net.minecraft.world.item.enchantment.Enchantments;
|
||||
import net.minecraft.world.level.GameType;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.entity.SignBlockEntity;
|
||||
import net.minecraft.world.level.saveddata.maps.MapDecoration;
|
||||
@@ -1176,8 +1179,37 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
return GameMode.getByValue(getHandle().gameMode.getGameModeForPlayer().getId());
|
||||
@@ -1189,8 +1192,37 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
return GameMode.getByValue(this.getHandle().gameMode.getGameModeForPlayer().getId());
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
@Override
|
||||
- public void giveExp(int exp) {
|
||||
+ @Override
|
||||
+ public int applyMending(int amount) {
|
||||
+ ServerPlayer handle = getHandle();
|
||||
+ // Logic copied from EntityExperienceOrb and remapped to unobfuscated methods/properties
|
||||
|
@ -90,12 +89,13 @@ index 8a5bf0b83c1e65f07e14da0e053a64c34976b91a..efdcb8dac8db15c4bbaed84a7861ce98
|
|||
+ return amount;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@Override
|
||||
- public void giveExp(int exp) {
|
||||
+ public void giveExp(int exp, boolean applyMending) {
|
||||
+ if (applyMending) {
|
||||
+ exp = this.applyMending(exp);
|
||||
+ }
|
||||
+ // Paper end
|
||||
getHandle().giveExperiencePoints(exp);
|
||||
this.getHandle().giveExperiencePoints(exp);
|
||||
}
|
||||
|
|
@ -7,12 +7,12 @@ I don't know why upstream made only the minimum height configurable but
|
|||
whatever
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 6c692e58cde22003ecbf6dc5695799147c39905a..3c39f1bb3d88baaaed4dd43c51faeef89bb5c6c2 100644
|
||||
index 90ca51dfdbb3045dd528450225cba96f5834166e..3577100f850975020b74f077d688f59dbca78962 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -348,4 +348,9 @@ public class PaperWorldConfig {
|
||||
expMergeMaxValue = getInt("experience-merge-max-value", -1);
|
||||
log("Experience Merge Max Value: " + expMergeMaxValue);
|
||||
@@ -342,4 +342,9 @@ public class PaperWorldConfig {
|
||||
disableCreeperLingeringEffect = getBoolean("disable-creeper-lingering-effect", false);
|
||||
log("Creeper lingering effect: " + disableCreeperLingeringEffect);
|
||||
}
|
||||
+
|
||||
+ public double squidMaxSpawnHeight;
|
||||
|
@ -21,16 +21,16 @@ index 6c692e58cde22003ecbf6dc5695799147c39905a..3c39f1bb3d88baaaed4dd43c51faeef8
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
||||
index 0b782c77f6d93002c35b123044b5a3eb03e63672..5a7582fd4f8e883d2f08a0227932c17d7576b957 100644
|
||||
index 5faa9e05e041a8bdcac88f3c3af7620353c10c3a..714e521ee96612bbc479e497f0520097b548472b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
||||
@@ -196,7 +196,8 @@ public class Squid extends WaterAnimal {
|
||||
@@ -211,7 +211,8 @@ public class Squid extends WaterAnimal {
|
||||
}
|
||||
|
||||
public static boolean checkSquidSpawnRules(EntityType<Squid> type, LevelAccessor world, MobSpawnType spawnReason, BlockPos pos, Random random) {
|
||||
- return pos.getY() > world.getLevel().spigotConfig.squidSpawnRangeMin && pos.getY() < world.getSeaLevel(); // Spigot
|
||||
+ final double maxHeight = world.getLevel().paperConfig.squidMaxSpawnHeight > 0 ? world.getLevel().paperConfig.squidMaxSpawnHeight : world.getSeaLevel(); // Paper
|
||||
+ return pos.getY() > world.getLevel().spigotConfig.squidSpawnRangeMin && pos.getY() < maxHeight; // Spigot // Paper
|
||||
- return pos.getY() > world.getMinecraftWorld().spigotConfig.squidSpawnRangeMin && pos.getY() < world.getSeaLevel(); // Spigot
|
||||
+ final double maxHeight = world.getMinecraftWorld().paperConfig.squidMaxSpawnHeight > 0 ? world.getMinecraftWorld().paperConfig.squidMaxSpawnHeight : world.getSeaLevel(); // Paper
|
||||
+ return pos.getY() > world.getMinecraftWorld().spigotConfig.squidSpawnRangeMin && pos.getY() < maxHeight; // Spigot // Paper
|
||||
}
|
||||
|
||||
public void setMovementVector(float x, float y, float z) {
|
||||
@Override
|
|
@ -9,10 +9,10 @@ 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/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 3b6f35b695117bd2b0c71b994efc55fa1084eddc..97d5437df10a6d0124e944404e88650547b7d8a8 100644
|
||||
index 5a80ea6bee72921454fbbd6ee202dc114c481ea1..4b349960daaacd87c042b055adf36c0a66748f7f 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -964,12 +964,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -974,11 +974,21 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
chunkRange = (chunkRange > level.spigotConfig.viewDistance) ? (byte) level.spigotConfig.viewDistance : chunkRange;
|
||||
chunkRange = (chunkRange > 8) ? 8 : chunkRange;
|
||||
|
||||
|
@ -22,9 +22,8 @@ index 3b6f35b695117bd2b0c71b994efc55fa1084eddc..97d5437df10a6d0124e944404e886505
|
|||
// Spigot end
|
||||
long i = chunkcoordintpair.toLong();
|
||||
|
||||
return !this.distanceManager.hasPlayersNearby(i) ? true : this.playerMap.a(i).noneMatch((entityplayer) -> {
|
||||
- return !entityplayer.isSpectator() && a(chunkcoordintpair, (Entity) entityplayer) < blockRange; // Spigot
|
||||
+ // Paper start -
|
||||
return !this.distanceManager.hasPlayersNearby(i) ? true : this.playerMap.getPlayers(i).noneMatch((entityplayer) -> {
|
||||
+ // Paper start - add PlayerNaturallySpawnCreaturesEvent
|
||||
+ com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent event;
|
||||
+ double blockRange = 16384.0D;
|
||||
+ if (reducedRange) {
|
||||
|
@ -32,17 +31,15 @@ index 3b6f35b695117bd2b0c71b994efc55fa1084eddc..97d5437df10a6d0124e944404e886505
|
|||
+ if (event == null || event.isCancelled()) return false;
|
||||
+ blockRange = (double) ((event.getSpawnRadius() << 4) * (event.getSpawnRadius() << 4));
|
||||
+ }
|
||||
+
|
||||
+ return (!entityplayer.isSpectator() && a(chunkcoordintpair, (Entity) entityplayer) < blockRange); // Spigot
|
||||
+ // Paper end
|
||||
return !entityplayer.isSpectator() && ChunkMap.euclideanDistanceSquared(chunkcoordintpair, (Entity) entityplayer) < blockRange; // Spigot
|
||||
});
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index d0b0fdaf5451bcc7f7ac7dab28aa59ef77e6dd97..a7122a0411f4a8656efd4facde3403c8093bc8a6 100644
|
||||
index 2cea8b1e8c414c8715ce61d61168dfb9d5c2200c..4a343fa19566f468aca17228379f4d75f3f56f28 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -612,6 +612,15 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -632,6 +632,15 @@ public class ServerChunkCache extends ChunkSource {
|
||||
this.level.getProfiler().pop();
|
||||
//List<PlayerChunk> list = Lists.newArrayList(this.playerChunkMap.f()); // Paper
|
||||
//Collections.shuffle(list); // Paper
|
||||
|
@ -59,7 +56,7 @@ index d0b0fdaf5451bcc7f7ac7dab28aa59ef77e6dd97..a7122a0411f4a8656efd4facde3403c8
|
|||
this.chunkMap.getChunks().forEach((playerchunk) -> { // Paper - no... just no...
|
||||
Optional<LevelChunk> optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left();
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 4ff66138fa43cf932b95d6d3dc050a9cd7b28ad4..0fa977a31cf945b74f3a046b6be302b10f494ad1 100644
|
||||
index 1c4f3a1cfe808d59333e45c170caf0d760a709c9..7159a433e9a264d2151dddc84a74689d0bc7635b 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1,5 +1,6 @@
|
||||
|
@ -69,7 +66,7 @@ index 4ff66138fa43cf932b95d6d3dc050a9cd7b28ad4..0fa977a31cf945b74f3a046b6be302b1
|
|||
import com.google.common.collect.Lists;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.datafixers.util.Either;
|
||||
@@ -225,6 +226,7 @@ public class ServerPlayer extends Player implements ContainerListener {
|
||||
@@ -232,6 +233,7 @@ public class ServerPlayer extends Player {
|
||||
public boolean sentListPacket = false;
|
||||
public Integer clientViewDistance;
|
||||
// CraftBukkit end
|
Loading…
Reference in New Issue