more patches (#5807)

This commit is contained in:
Jake Potrebic 2021-06-12 09:56:13 -07:00
parent 264337e396
commit 3aae52d6f5
29 changed files with 120 additions and 338 deletions

View file

@ -1,31 +0,0 @@
From 0000000000000000000000000000000000000000 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/world/level/block/FrostedIceBlock.java b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java
@@ -0,0 +0,0 @@ public class FrostedIceBlock extends IceBlock {
Direction enumdirection = aenumdirection[j];
blockposition_mutableblockposition.setWithOffset((Vec3i) pos, enumdirection);
- BlockState iblockdata1 = world.getBlockState(blockposition_mutableblockposition);
+ BlockState iblockdata1 = world.getTypeIfLoaded(blockposition_mutableblockposition); // Paper
+ if (iblockdata1 == null) { continue; } // Paper
if (iblockdata1.is((Block) this) && !this.slightlyMelt(iblockdata1, (Level) world, blockposition_mutableblockposition)) {
world.getBlockTicks().scheduleTick(blockposition_mutableblockposition, this, Mth.nextInt(random, world.paperConfig.frostedIceDelayMin, world.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay
@@ -0,0 +0,0 @@ public class FrostedIceBlock extends IceBlock {
Direction enumdirection = aenumdirection[l];
blockposition_mutableblockposition.setWithOffset((Vec3i) pos, enumdirection);
- if (world.getBlockState(blockposition_mutableblockposition).is((Block) this)) {
+ // Paper start
+ BlockState type = world.getTypeIfLoaded(blockposition_mutableblockposition);
+ if (type != null && type.is((Block) this)) { // Paper end
++j;
if (j >= maxNeighbors) {
return false;

View file

@ -16,15 +16,6 @@ diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.ja
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject { @@ -0,0 +0,0 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject {
this.type = type; this.type = type;
this.worldPosition = pos.immutable(); this.worldPosition = pos.immutable();

View file

@ -36,7 +36,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- @Nullable - @Nullable
- public static Entry<EquipmentSlot, ItemStack> getRandomItemWith(Enchantment enchantment, LivingEntity entity) { - 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 + public static @javax.annotation.Nonnull ItemStack getRandomEquippedItemWithEnchant(Enchantment enchantment, LivingEntity entityliving) {
+ Entry<EquipmentSlot, ItemStack> entry = getRandomItemWith(enchantment, entityliving);
+ return entry != null ? entry.getValue() : ItemStack.EMPTY;
+ } // Paper - OBFHELPER
+ @Nullable public static Entry<EquipmentSlot, ItemStack> getRandomItemWith(Enchantment enchantment, LivingEntity entity) { + @Nullable public static Entry<EquipmentSlot, ItemStack> getRandomItemWith(Enchantment enchantment, LivingEntity entity) {
return getRandomItemWith(enchantment, entity, (stack) -> { return getRandomItemWith(enchantment, entity, (stack) -> {
return true; return true;
@ -80,7 +83,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ int i = Math.min(orb.xpToDur(amount), itemstack.getDamageValue()); + int i = Math.min(orb.xpToDur(amount), itemstack.getDamageValue());
+ org.bukkit.event.player.PlayerItemMendEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemMendEvent(handle, orb, itemstack, i); + org.bukkit.event.player.PlayerItemMendEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemMendEvent(handle, orb, itemstack, i);
+ i = event.getRepairAmount(); + i = event.getRepairAmount();
+ orb.removed = true; + orb.discard();
+ if (!event.isCancelled()) { + if (!event.isCancelled()) {
+ amount -= orb.durToXp(i); + amount -= orb.durToXp(i);
+ itemstack.setDamageValue(itemstack.getDamageValue() - i); + itemstack.setDamageValue(itemstack.getDamageValue() - i);

View file

@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
import org.bukkit.event.player.PlayerPreLoginEvent; import org.bukkit.event.player.PlayerPreLoginEvent;
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener @@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
java.util.UUID uniqueId = gameProfile.getId(); java.util.UUID uniqueId = ServerLoginPacketListenerImpl.this.gameProfile.getId();
final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server; final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server;
- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId); - AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);

View file

@ -57,7 +57,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class CraftMetaArmorStand extends CraftMetaItem { @@ -0,0 +0,0 @@ public class CraftMetaArmorStand extends CraftMetaItem {
if (tag.contains(ENTITY_TAG.NBT)) { if (tag.contains(ENTITY_TAG.NBT)) {
entityTag = tag.getCompound(ENTITY_TAG.NBT); this.entityTag = tag.getCompound(ENTITY_TAG.NBT);
+ +
+ // Paper start + // Paper start
+ if (entityTag.contains(INVISIBLE.NBT)) { + if (entityTag.contains(INVISIBLE.NBT)) {
@ -85,19 +85,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
CraftMetaArmorStand(Map<String, Object> map) { CraftMetaArmorStand(Map<String, Object> map) {
super(map); super(map);
+
+ // Paper start + // Paper start
+ boolean invis = SerializableMeta.getBoolean(map, INVISIBLE.BUKKIT); + this.invisible = SerializableMeta.getBoolean(map, INVISIBLE.BUKKIT);
+ boolean noBase = SerializableMeta.getBoolean(map, NO_BASE_PLATE.BUKKIT); + this.noBasePlate = SerializableMeta.getBoolean(map, NO_BASE_PLATE.BUKKIT);
+ boolean showArms = SerializableMeta.getBoolean(map, SHOW_ARMS.BUKKIT); + this.showArms = SerializableMeta.getBoolean(map, SHOW_ARMS.BUKKIT);
+ boolean small = SerializableMeta.getBoolean(map, SMALL.BUKKIT); + this.small = SerializableMeta.getBoolean(map, SMALL.BUKKIT);
+ boolean marker = SerializableMeta.getBoolean(map, MARKER.BUKKIT); + this.marker = SerializableMeta.getBoolean(map, MARKER.BUKKIT);
+
+ this.invisible = invis;
+ this.noBasePlate = noBase;
+ this.showArms = showArms;
+ this.small = small;
+ this.marker = marker;
+ // Paper end + // Paper end
} }
@ -107,40 +100,39 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
super.applyToItem(tag); super.applyToItem(tag);
+ // Paper start + // Paper start
+ if (!isArmorStandEmpty() && entityTag == null) { + if (!isArmorStandEmpty() && this.entityTag == null) {
+ entityTag = new CompoundTag(); + this.entityTag = new CompoundTag();
+ } + }
+ +
+ if (isInvisible()) { + if (isInvisible()) {
+ entityTag.putBoolean(INVISIBLE.NBT, invisible); + this.entityTag.putBoolean(INVISIBLE.NBT, this.invisible);
+ } + }
+ +
+ if (hasNoBasePlate()) { + if (hasNoBasePlate()) {
+ entityTag.putBoolean(NO_BASE_PLATE.NBT, noBasePlate); + this.entityTag.putBoolean(NO_BASE_PLATE.NBT, this.noBasePlate);
+ } + }
+ +
+ if (shouldShowArms()) { + if (shouldShowArms()) {
+ entityTag.putBoolean(SHOW_ARMS.NBT, showArms); + this.entityTag.putBoolean(SHOW_ARMS.NBT, this.showArms);
+ } + }
+ +
+ if (isSmall()) { + if (isSmall()) {
+ entityTag.putBoolean(SMALL.NBT, small); + this.entityTag.putBoolean(SMALL.NBT, this.small);
+ } + }
+ +
+ if (isMarker()) { + if (isMarker()) {
+ entityTag.putBoolean(MARKER.NBT, marker); + this.entityTag.putBoolean(MARKER.NBT, this.marker);
+ } + }
+ // Paper end + // Paper end
+ if (this.entityTag != null) {
if (entityTag != null) {
tag.put(ENTITY_TAG.NBT, entityTag); tag.put(ENTITY_TAG.NBT, entityTag);
} }
@@ -0,0 +0,0 @@ public class CraftMetaArmorStand extends CraftMetaItem { @@ -0,0 +0,0 @@ public class CraftMetaArmorStand extends CraftMetaItem {
} }
boolean isArmorStandEmpty() { boolean isArmorStandEmpty() {
- return !(entityTag != null); - return !(this.entityTag != null);
+ return !(isInvisible() || hasNoBasePlate() || shouldShowArms() || isSmall() || isMarker() || entityTag != null); + return !(this.isInvisible() || this.hasNoBasePlate() || this.shouldShowArms() || this.isSmall() || this.isMarker() || this.entityTag != null);
} }
@Override @Override
@ -148,13 +140,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (meta instanceof CraftMetaArmorStand) { if (meta instanceof CraftMetaArmorStand) {
CraftMetaArmorStand that = (CraftMetaArmorStand) meta; CraftMetaArmorStand that = (CraftMetaArmorStand) meta;
- return entityTag != null ? that.entityTag != null && this.entityTag.equals(that.entityTag) : entityTag == null; - return this.entityTag != null ? that.entityTag != null && this.entityTag.equals(that.entityTag) : this.entityTag == null;
+ // Paper start + // Paper start
+ return invisible == that.invisible && + return this.invisible == that.invisible &&
+ noBasePlate == that.noBasePlate && + this.noBasePlate == that.noBasePlate &&
+ showArms == that.showArms && + this.showArms == that.showArms &&
+ small == that.small && + this.small == that.small &&
+ marker == that.marker; + this.marker == that.marker;
+ // Paper end + // Paper end
} }
return true; return true;
@ -163,16 +155,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
final int original; final int original;
int hash = original = super.applyHash(); int hash = original = super.applyHash();
- if (entityTag != null) { - if (this.entityTag != null) {
- hash = 73 * hash + entityTag.hashCode(); - hash = 73 * hash + this.entityTag.hashCode();
- } - }
+ // Paper start + // Paper start
+ hash += entityTag != null ? 73 * hash + entityTag.hashCode() : 0; + hash += this.entityTag != null ? 73 * hash + this.entityTag.hashCode() : 0;
+ hash += isInvisible() ? 61 * hash + 1231 : 0; + hash += this.isInvisible() ? 61 * hash + 1231 : 0;
+ hash += hasNoBasePlate() ? 61 * hash + 1231 : 0; + hash += this.hasNoBasePlate() ? 61 * hash + 1231 : 0;
+ hash += shouldShowArms() ? 61 * hash + 1231 : 0; + hash += this.shouldShowArms() ? 61 * hash + 1231 : 0;
+ hash += isSmall() ? 61 * hash + 1231 : 0; + hash += this.isSmall() ? 61 * hash + 1231 : 0;
+ hash += isMarker() ? 61 * hash + 1231 : 0; + hash += this.isMarker() ? 61 * hash + 1231 : 0;
+ // Paper end + // Paper end
return original != hash ? CraftMetaArmorStand.class.hashCode() ^ hash : hash; return original != hash ? CraftMetaArmorStand.class.hashCode() ^ hash : hash;
@ -182,23 +174,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
super.serialize(builder); super.serialize(builder);
+ // Paper start + // Paper start
+ if (isInvisible()) { + if (this.isInvisible()) {
+ builder.put(INVISIBLE.BUKKIT, invisible); + builder.put(INVISIBLE.BUKKIT, invisible);
+ } + }
+ +
+ if (hasNoBasePlate()) { + if (this.hasNoBasePlate()) {
+ builder.put(NO_BASE_PLATE.BUKKIT, noBasePlate); + builder.put(NO_BASE_PLATE.BUKKIT, noBasePlate);
+ } + }
+ +
+ if (shouldShowArms()) { + if (this.shouldShowArms()) {
+ builder.put(SHOW_ARMS.BUKKIT, showArms); + builder.put(SHOW_ARMS.BUKKIT, showArms);
+ } + }
+ +
+ if (isSmall()) { + if (this.isSmall()) {
+ builder.put(SMALL.BUKKIT, small); + builder.put(SMALL.BUKKIT, small);
+ } + }
+ +
+ if (isMarker()) { + if (this.isMarker()) {
+ builder.put(MARKER.BUKKIT, marker); + builder.put(MARKER.BUKKIT, marker);
+ } + }
+ // Paper end + // Paper end
@ -281,15 +273,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
CraftMetaCompass.LODESTONE_DIMENSION.NBT, CraftMetaCompass.LODESTONE_DIMENSION.NBT,
CraftMetaCompass.LODESTONE_POS.NBT, CraftMetaCompass.LODESTONE_POS.NBT,
CraftMetaCompass.LODESTONE_TRACKED.NBT CraftMetaCompass.LODESTONE_TRACKED.NBT,
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
@@ -0,0 +0,0 @@ public class ItemMetaTest extends AbstractTestingBase { @@ -0,0 +0,0 @@ public class ItemMetaTest extends AbstractTestingBase {
final CraftMetaArmorStand meta = (CraftMetaArmorStand) cleanStack.getItemMeta(); final CraftMetaArmorStand meta = (CraftMetaArmorStand) cleanStack.getItemMeta();
meta.entityTag = new NBTTagCompound(); meta.entityTag = new CompoundTag();
meta.entityTag.setBoolean("Small", true); meta.entityTag.putBoolean("Small", true);
+ meta.setInvisible(true); // Paper + meta.setInvisible(true); // Paper
cleanStack.setItemMeta(meta); cleanStack.setItemMeta(meta);
return cleanStack; return cleanStack;

View file

@ -107,15 +107,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot
// CraftBukkit start - data containers // CraftBukkit start - data containers
@@ -0,0 +0,0 @@ public abstract class BlockEntity {
public CraftPersistentDataContainer persistentDataContainer;
// CraftBukkit end
private static final Logger LOGGER = LogManager.getLogger();
- private final BlockEntityType<?> type;
+ private final BlockEntityType<?> type; public BlockEntityType getTileEntityType() { return type; } // Paper - OBFHELPER
@Nullable
protected Level level;
protected final BlockPos worldPosition;
@@ -0,0 +0,0 @@ public abstract class BlockEntity { @@ -0,0 +0,0 @@ public abstract class BlockEntity {
this.blockState = state; this.blockState = state;
} }
@ -127,7 +118,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Override + @Override
+ public ResourceLocation getMinecraftKey() { + public ResourceLocation getMinecraftKey() {
+ if (tileEntityKey == null) { + if (tileEntityKey == null) {
+ tileEntityKey = BlockEntityType.getKey(this.getTileEntityType()); + tileEntityKey = BlockEntityType.getKey(this.type);
+ tileEntityKeyString = tileEntityKey != null ? tileEntityKey.toString() : null; + tileEntityKeyString = tileEntityKey != null ? tileEntityKey.toString() : null;
+ } + }
+ return tileEntityKey; + return tileEntityKey;

View file

@ -4,18 +4,6 @@ Date: Fri, 10 Nov 2017 23:46:34 -0500
Subject: [PATCH] Add PlayerArmorChangeEvent 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/EquipmentSlot.java
+++ b/src/main/java/net/minecraft/world/entity/EquipmentSlot.java
@@ -0,0 +0,0 @@ public enum EquipmentSlot {
this.name = name;
}
+ public EquipmentSlot.Type getType() { return this.getType(); } // Paper - OBFHELPER
public EquipmentSlot.Type getType() {
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 diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java

View file

@ -18,14 +18,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
@@ -0,0 +0,0 @@ import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional;
import org.bukkit.block.data.Rotatable;
import org.bukkit.craftbukkit.entity.CraftPlayer;
+import javax.annotation.Nullable;
public class CraftSkull extends CraftBlockEntityState<SkullBlockEntity> implements Skull {
@@ -0,0 +0,0 @@ public class CraftSkull extends CraftBlockEntityState<SkullBlockEntity> implemen @@ -0,0 +0,0 @@ public class CraftSkull extends CraftBlockEntityState<SkullBlockEntity> implemen
} }
} }
@ -37,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.profile = CraftPlayerProfile.asAuthlibCopy(profile); + this.profile = CraftPlayerProfile.asAuthlibCopy(profile);
+ } + }
+ +
+ @Nullable + @javax.annotation.Nullable
+ @Override + @Override
+ public PlayerProfile getPlayerProfile() { + public PlayerProfile getPlayerProfile() {
+ return profile != null ? CraftPlayerProfile.asBukkitCopy(profile) : null; + return profile != null ? CraftPlayerProfile.asBukkitCopy(profile) : null;
@ -77,7 +69,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
class CraftMetaSkull extends CraftMetaItem implements SkullMeta { class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
@@ -0,0 +0,0 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { @@ -0,0 +0,0 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
return hasOwner() ? profile.getName() : null; return this.hasOwner() ? this.profile.getName() : null;
} }
+ // Paper start + // Paper start
@ -95,15 +87,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
@Override @Override
public OfflinePlayer getOwningPlayer() { public OfflinePlayer getOwningPlayer() {
if (hasOwner()) { if (this.hasOwner()) {
@@ -0,0 +0,0 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
} else {
// Paper start - Use Online Players Skull
GameProfile newProfile = null;
- net.minecraft.server.EntityPlayer player = net.minecraft.server.MinecraftServer.getServer().getPlayerList().getPlayerByName(name);
- if (player != null) newProfile = player.getProfile();
+ net.minecraft.server.level.ServerPlayer player = net.minecraft.server.MinecraftServer.getServer().getPlayerList().getPlayerByName(name);
+ if (player != null) newProfile = player.getGameProfile();
if (newProfile == null) newProfile = new GameProfile(null, name);
setProfile(newProfile);
// Paper end

View file

@ -39,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ com.destroystokyo.paper.event.server.AsyncTabCompleteEvent event; + com.destroystokyo.paper.event.server.AsyncTabCompleteEvent event;
+ java.util.List<String> completions = new java.util.ArrayList<>(); + java.util.List<String> completions = new java.util.ArrayList<>();
+ String buffer = packet.getCommand(); + String buffer = packet.getCommand();
+ event = new com.destroystokyo.paper.event.server.AsyncTabCompleteEvent(this.getPlayer(), completions, + event = new com.destroystokyo.paper.event.server.AsyncTabCompleteEvent(this.getCraftPlayer(), completions,
+ buffer, true, null); + buffer, true, null);
+ event.callEvent(); + event.callEvent();
+ completions = event.isCancelled() ? com.google.common.collect.ImmutableList.of() : event.getCompletions(); + completions = event.isCancelled() ? com.google.common.collect.ImmutableList.of() : event.getCompletions();

View file

@ -16,16 +16,8 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -0,0 +0,0 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.protocol.game.ClientboundBlockBreakAckPacket;
import net.minecraft.network.protocol.game.ClientboundBlockUpdatePacket;
+import net.minecraft.network.protocol.game.ClientboundContainerClosePacket;
import net.minecraft.network.protocol.game.ClientboundPlayerInfoPacket;
import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket;
import net.minecraft.server.MinecraftServer;
@@ -0,0 +0,0 @@ public class ServerPlayerGameMode { @@ -0,0 +0,0 @@ public class ServerPlayerGameMode {
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, pos, direction, this.player.inventory.getSelected(), InteractionHand.MAIN_HAND); PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, pos, direction, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND);
if (event.isCancelled()) { if (event.isCancelled()) {
// Let the client know the block still exists // Let the client know the block still exists
+ // Paper start - brute force neighbor blocks for any attached blocks + // Paper start - brute force neighbor blocks for any attached blocks
@ -37,22 +29,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Update any tile entity data for this block // Update any tile entity data for this block
BlockEntity tileentity = this.level.getBlockEntity(pos); BlockEntity tileentity = this.level.getBlockEntity(pos);
@@ -0,0 +0,0 @@ public class ServerPlayerGameMode { @@ -0,0 +0,0 @@ public class ServerPlayerGameMode {
interactItemStack = stack.copy();
if (event.useInteractedBlock() == Event.Result.DENY) {
+
// If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
if (iblockdata.getBlock() instanceof DoorBlock) {
boolean bottom = iblockdata.getValue(DoorBlock.HALF) == DoubleBlockHalf.LOWER;
@@ -0,0 +0,0 @@ public class ServerPlayerGameMode {
// send a correcting update to the client for the block above as well, this because of replaceable blocks (such as grass, sea grass etc) // send a correcting update to the client for the block above as well, this because of replaceable blocks (such as grass, sea grass etc)
player.connection.send(new ClientboundBlockUpdatePacket(world, blockposition.above())); player.connection.send(new ClientboundBlockUpdatePacket(world, blockposition.above()));
+ // Paper start - extend Player Interact cancellation // TODO: consider merging this into the extracted method + // Paper start - extend Player Interact cancellation // TODO: consider merging this into the extracted method
+ } else if (iblockdata.getBlock() instanceof StructureBlock) { + } else if (iblockdata.getBlock() instanceof net.minecraft.world.level.block.StructureBlock) {
+ player.connection.send(new ClientboundContainerClosePacket()); + player.connection.send(new net.minecraft.network.protocol.game.ClientboundContainerClosePacket(this.player.containerMenu.containerId));
+ } else if (iblockdata.getBlock() instanceof CommandBlock) { + } else if (iblockdata.getBlock() instanceof net.minecraft.world.level.block.CommandBlock) {
+ player.connection.send(new ClientboundContainerClosePacket()); + player.connection.send(new net.minecraft.network.protocol.game.ClientboundContainerClosePacket(this.player.containerMenu.containerId));
} }
+ // Paper end - extend Player Interact cancellation + // Paper end - extend Player Interact cancellation
player.getBukkitEntity().updateInventory(); // SPIGOT-2867 player.getBukkitEntity().updateInventory(); // SPIGOT-2867

View file

@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit end // CraftBukkit end
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOGGER = LogManager.getLogger();
+ public boolean isLoadingStructure = false; // Paper + public boolean isLoadingStructure = false; // Paper
private final BlockEntityType<?> type; public BlockEntityType getTileEntityType() { return type; } // Paper - OBFHELPER private final BlockEntityType<?> type;
@Nullable @Nullable
protected Level level; protected Level level;
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java

View file

@ -178,50 +178,17 @@ diff --git a/src/main/java/net/minecraft/network/protocol/status/ClientboundStat
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/protocol/status/ClientboundStatusResponsePacket.java --- a/src/main/java/net/minecraft/network/protocol/status/ClientboundStatusResponsePacket.java
+++ b/src/main/java/net/minecraft/network/protocol/status/ClientboundStatusResponsePacket.java +++ b/src/main/java/net/minecraft/network/protocol/status/ClientboundStatusResponsePacket.java
@@ -0,0 +0,0 @@ package net.minecraft.network.protocol.status; @@ -0,0 +0,0 @@ import net.minecraft.util.GsonHelper;
import net.minecraft.util.LowerCaseEnumTypeAdapterFactory;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
+import io.papermc.paper.adventure.AdventureComponent; // Paper
import java.io.IOException;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component;
@@ -0,0 +0,0 @@ import net.minecraft.util.LowerCaseEnumTypeAdapterFactory;
public class ClientboundStatusResponsePacket implements Packet<ClientStatusPacketListener> { public class ClientboundStatusResponsePacket implements Packet<ClientStatusPacketListener> {
- private static final Gson GSON = (new GsonBuilder()).registerTypeAdapter(ServerStatus.Version.class, new ServerStatus.Version.Serializer()).registerTypeAdapter(ServerStatus.Players.class, new ServerStatus.Players.Serializer()).registerTypeAdapter(ServerStatus.class, new ServerStatus.Serializer()).registerTypeHierarchyAdapter(Component.class, new Component.Serializer()).registerTypeHierarchyAdapter(Style.class, new Style.Serializer()).registerTypeAdapterFactory(new LowerCaseEnumTypeAdapterFactory()).create(); - private static final Gson GSON = (new GsonBuilder()).registerTypeAdapter(ServerStatus.Version.class, new ServerStatus.Version.Serializer()).registerTypeAdapter(ServerStatus.Players.class, new ServerStatus.Players.Serializer()).registerTypeAdapter(ServerStatus.class, new ServerStatus.Serializer()).registerTypeHierarchyAdapter(Component.class, new Component.Serializer()).registerTypeHierarchyAdapter(Style.class, new Style.Serializer()).registerTypeAdapterFactory(new LowerCaseEnumTypeAdapterFactory()).create();
+ private static final Gson GSON = (new GsonBuilder()).registerTypeAdapter(ServerStatus.Version.class, new ServerStatus.Version.Serializer()).registerTypeAdapter(ServerStatus.Players.class, new ServerStatus.Players.Serializer()).registerTypeAdapter(ServerStatus.class, new ServerStatus.Serializer()).registerTypeHierarchyAdapter(Component.class, new Component.Serializer()).registerTypeHierarchyAdapter(Style.class, new Style.Serializer()).registerTypeAdapterFactory(new LowerCaseEnumTypeAdapterFactory()) + private static final Gson GSON = (new GsonBuilder()).registerTypeAdapter(ServerStatus.Version.class, new ServerStatus.Version.Serializer()).registerTypeAdapter(ServerStatus.Players.class, new ServerStatus.Players.Serializer()).registerTypeAdapter(ServerStatus.class, new ServerStatus.Serializer()).registerTypeHierarchyAdapter(Component.class, new Component.Serializer()).registerTypeHierarchyAdapter(Style.class, new Style.Serializer()).registerTypeAdapterFactory(new LowerCaseEnumTypeAdapterFactory())
+ .registerTypeAdapter(AdventureComponent.class, new AdventureComponent.Serializer()) + .registerTypeAdapter(io.papermc.paper.adventure.AdventureComponent.class, new io.papermc.paper.adventure.AdventureComponent.Serializer())
+ .create(); + .create();
private ServerStatus status; private final ServerStatus status;
public ClientboundStatusResponsePacket() {} public ClientboundStatusResponsePacket(ServerStatus metadata) {
diff --git a/src/main/java/net/minecraft/network/protocol/status/ServerStatus.java b/src/main/java/net/minecraft/network/protocol/status/ServerStatus.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/protocol/status/ServerStatus.java
+++ b/src/main/java/net/minecraft/network/protocol/status/ServerStatus.java
@@ -0,0 +0,0 @@ public class ServerStatus {
this.description = description;
}
+ public Players getPlayers() { return getPlayers(); } // Paper - OBFHELPER
public ServerStatus.Players getPlayers() {
return this.players;
}
@@ -0,0 +0,0 @@ public class ServerStatus {
return this.numPlayers;
}
+ public GameProfile[] getSample() { return getSample(); } // Paper - OBFHELPER
public GameProfile[] getSample() {
return this.sample;
}
+ public void setSample(GameProfile[] sample) { setSample(sample); } // Paper - OBFHELPER
public void setSample(GameProfile[] sample) {
this.sample = sample;
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
@ -249,24 +216,6 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerStatusPacketListen
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
@@ -0,0 +0,0 @@
package net.minecraft.server.network;
import net.minecraft.server.MinecraftServer;
-import net.minecraft.server.level.ServerPlayer;
+
// CraftBukkit start
import com.mojang.authlib.GameProfile;
import java.net.InetSocketAddress;
@@ -0,0 +0,0 @@ import net.minecraft.network.Connection;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.network.protocol.status.ClientboundPongResponsePacket;
-import net.minecraft.network.protocol.status.ClientboundStatusResponsePacket;
-import net.minecraft.network.protocol.status.ServerStatus;
import net.minecraft.network.protocol.status.ServerStatusPacketListener;
import net.minecraft.network.protocol.status.ServerboundPingRequestPacket;
import net.minecraft.network.protocol.status.ServerboundStatusRequestPacket;
@@ -0,0 +0,0 @@ public class ServerStatusPacketListenerImpl implements ServerStatusPacketListene @@ -0,0 +0,0 @@ public class ServerStatusPacketListenerImpl implements ServerStatusPacketListene
this.connection.disconnect(ServerStatusPacketListenerImpl.DISCONNECT_REASON); this.connection.disconnect(ServerStatusPacketListenerImpl.DISCONNECT_REASON);
} else { } else {
@ -275,88 +224,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /* + /*
// CraftBukkit start // CraftBukkit start
// this.networkManager.sendPacket(new PacketStatusOutServerInfo(this.minecraftServer.getServerPing())); // this.networkManager.sendPacket(new PacketStatusOutServerInfo(this.minecraftServer.getServerPing()));
- final Object[] players = server.getPlayerList().players.toArray(); final Object[] players = this.server.getPlayerList().players.toArray();
+ final Object[] players = minecraftServer.getPlayerList().players.toArray();
class ServerListPingEvent extends org.bukkit.event.server.ServerListPingEvent {
- CraftIconCache icon = server.server.getServerIcon();
+ CraftIconCache icon = minecraftServer.server.getServerIcon();
ServerListPingEvent() {
- super(((InetSocketAddress) connection.getRemoteAddress()).getAddress(), server.server.motd(), server.getPlayerList().getMaxPlayers()); // Paper - Adventure
+ super(((InetSocketAddress) networkManager.getSocketAddress()).getAddress(), minecraftServer.server.motd(), minecraftServer.getPlayerList().getMaxPlayers()); // Paper - Adventure
}
@Override
@@ -0,0 +0,0 @@ public class ServerStatusPacketListenerImpl implements ServerStatusPacketListene @@ -0,0 +0,0 @@ public class ServerStatusPacketListenerImpl implements ServerStatusPacketListene
return new Iterator<Player>() { ping.setVersion(new ServerStatus.Version(this.server.getServerModName() + " " + this.server.getServerVersion(), version));
int i;
int ret = Integer.MIN_VALUE;
- ServerPlayer player;
+ EntityPlayer player;
@Override this.connection.send(new ClientboundStatusResponsePacket(ping));
public boolean hasNext() {
@@ -0,0 +0,0 @@ public class ServerStatusPacketListenerImpl implements ServerStatusPacketListene
}
final Object[] currentPlayers = players;
for (int length = currentPlayers.length, i = this.i; i < length; i++) {
- final ServerPlayer player = (ServerPlayer) currentPlayers[i];
+ final EntityPlayer player = (EntityPlayer) currentPlayers[i];
if (player != null) {
this.i = i + 1;
this.player = player;
@@ -0,0 +0,0 @@ public class ServerStatusPacketListenerImpl implements ServerStatusPacketListene
if (!hasNext()) {
throw new java.util.NoSuchElementException();
}
- final ServerPlayer player = this.player;
+ final EntityPlayer player = this.player;
this.player = null;
this.ret = this.i - 1;
return player.getBukkitEntity();
@@ -0,0 +0,0 @@ public class ServerStatusPacketListenerImpl implements ServerStatusPacketListene
}
ServerListPingEvent event = new ServerListPingEvent();
- this.server.server.getPluginManager().callEvent(event);
+ this.minecraftServer.server.getPluginManager().callEvent(event);
java.util.List<GameProfile> profiles = new java.util.ArrayList<GameProfile>(players.length);
for (Object player : players) {
if (player != null) {
- profiles.add(((ServerPlayer) player).getGameProfile());
+ profiles.add(((EntityPlayer) player).getProfile());
}
}
- ServerStatus.Players playerSample = new ServerStatus.Players(event.getMaxPlayers(), profiles.size());
+ ServerPing.ServerPingPlayerSample playerSample = new ServerPing.ServerPingPlayerSample(event.getMaxPlayers(), profiles.size());
// Spigot Start
if ( !profiles.isEmpty() )
{
@@ -0,0 +0,0 @@ public class ServerStatusPacketListenerImpl implements ServerStatusPacketListene
profiles = profiles.subList( 0, Math.min( profiles.size(), org.spigotmc.SpigotConfig.playerSample ) ); // Cap the sample to n (or less) displayed players, ie: Vanilla behaviour
}
// Spigot End
- playerSample.setSample(profiles.toArray(new GameProfile[profiles.size()]));
+ playerSample.a(profiles.toArray(new GameProfile[profiles.size()]));
- ServerStatus ping = new ServerStatus();
+ ServerPing ping = new ServerPing();
ping.setFavicon(event.icon.value);
- ping.setDescription(CraftChatMessage.fromString(event.getMotd(), true)[0]);
- ping.setPlayers(playerSample);
- int version = SharedConstants.getCurrentVersion().getProtocolVersion();
- ping.setVersion(new ServerStatus.Version(server.getServerModName() + " " + server.getServerVersion(), version));
-
- this.connection.send(new ClientboundStatusResponsePacket(ping));
+ ping.setMOTD(CraftChatMessage.fromString(event.getMotd(), true)[0]);
+ ping.setPlayerSample(playerSample);
+ int version = SharedConstants.getGameVersion().getProtocolVersion();
+ ping.setServerInfo(new ServerPing.ServerData(minecraftServer.getServerModName() + " " + minecraftServer.getVersion(), version));
+
+ this.networkManager.sendPacket(new PacketStatusOutServerInfo(ping));
+ */ + */
+ com.destroystokyo.paper.network.StandardPaperServerListPingEventImpl.processRequest(this.server, this.connection); + com.destroystokyo.paper.network.StandardPaperServerListPingEventImpl.processRequest(this.server, this.connection);
+ // Paper end + // Paper end
@ -371,8 +243,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public static int playerSample; public static int playerSample;
private static void playerSample() private static void playerSample()
{ {
- playerSample = getInt( "settings.sample-count", 12 ); - SpigotConfig.playerSample = SpigotConfig.getInt( "settings.sample-count", 12 );
+ playerSample = Math.max( getInt( "settings.sample-count", 12 ), 0 ); // Paper - Avoid negative counts + SpigotConfig.playerSample = Math.max( SpigotConfig.getInt( "settings.sample-count", 12 ), 0 ); // Paper - Avoid negative counts
Bukkit.getLogger().log( Level.INFO, "Server Ping Player Sample Count: {0}", playerSample ); // Paper - Use logger Bukkit.getLogger().log( Level.INFO, "Server Ping Player Sample Count: {0}", playerSample ); // Paper - Use logger
} }

View file

@ -190,7 +190,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler { @@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler {
} }
}; };
private CraftAsyncDebugger debugTail = debugHead; private CraftAsyncDebugger debugTail = this.debugHead;
+ +
+ */ // Paper end + */ // Paper end
private static final int RECENT_TICKS; private static final int RECENT_TICKS;
@ -223,8 +223,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} else if (period < CraftTask.NO_REPEATING) { } else if (period < CraftTask.NO_REPEATING) {
period = CraftTask.NO_REPEATING; period = CraftTask.NO_REPEATING;
} }
- return handle(new CraftAsyncTask(runners, plugin, runnable, nextId(), period), delay); - return this.handle(new CraftAsyncTask(this.runners, plugin, runnable, this.nextId(), period), delay);
+ return handle(new CraftAsyncTask(this.asyncScheduler.runners, plugin, runnable, nextId(), period), delay); // Paper + return this.handle(new CraftAsyncTask(this.asyncScheduler.runners, plugin, runnable, this.nextId(), period), delay); // Paper
} }
@Override @Override
@ -237,7 +237,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.asyncScheduler.cancelTask(taskId); + this.asyncScheduler.cancelTask(taskId);
+ } + }
+ // Paper end + // Paper end
CraftTask task = runners.get(taskId); CraftTask task = this.runners.get(taskId);
if (task != null) { if (task != null) {
task.cancel0(); task.cancel0();
@@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler { @@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler {
@ -257,13 +257,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override @Override
public boolean isCurrentlyRunning(final int taskId) { public boolean isCurrentlyRunning(final int taskId) {
+ // Paper start + // Paper start
+ if (!isAsyncScheduler) { + if (!this.isAsyncScheduler) {
+ if (this.asyncScheduler.isCurrentlyRunning(taskId)) { + if (this.asyncScheduler.isCurrentlyRunning(taskId)) {
+ return true; + return true;
+ } + }
+ } + }
+ // Paper end + // Paper end
final CraftTask task = runners.get(taskId); final CraftTask task = this.runners.get(taskId);
if (task == null) { if (task == null) {
return false; return false;
@@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler { @@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler {
@ -275,7 +275,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return true; + return true;
+ } + }
+ // Paper end + // Paper end
for (CraftTask task = head.getNext(); task != null; task = task.getNext()) { for (CraftTask task = this.head.getNext(); task != null; task = task.getNext()) {
if (task.getTaskId() == taskId) { if (task.getTaskId() == taskId) {
return task.getPeriod() >= CraftTask.NO_REPEATING; // The task will run return task.getPeriod() >= CraftTask.NO_REPEATING; // The task will run
@@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler { @@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler {
@ -289,7 +289,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Paper end + // Paper end
final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>(); final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>();
for (final CraftTask taskObj : runners.values()) { for (final CraftTask taskObj : this.runners.values()) {
// Iterator will be a best-effort (may fail to grab very new values) if called from an async thread // Iterator will be a best-effort (may fail to grab very new values) if called from an async thread
@@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler { @@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler {
pending.add(task); pending.add(task);
@ -314,18 +314,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
this.currentTick = currentTick; this.currentTick = currentTick;
final List<CraftTask> temp = this.temp; final List<CraftTask> temp = this.temp;
parsePending(); this.parsePending();
@@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler { @@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler {
parsePending(); this.parsePending();
} else { } else {
//debugTail = debugTail.setNext(new CraftAsyncDebugger(currentTick + RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper //this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper
- executor.execute(new ServerSchedulerReportingWrapper(task)); // Paper - this.executor.execute(new ServerSchedulerReportingWrapper(task)); // Paper
+ task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Paper"); // Paper + task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Paper"); // Paper
// We don't need to parse pending // 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) // (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
} }
@@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler { @@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler {
//debugHead = debugHead.getNextHead(currentTick); // Paper //this.debugHead = this.debugHead.getNextHead(currentTick); // Paper
} }
- private void addTask(final CraftTask task) { - private void addTask(final CraftTask task) {
@ -345,11 +345,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return task; + return task;
+ } + }
+ // Paper end + // Paper end
task.setNextRun(currentTick + delay); task.setNextRun(this.currentTick + delay);
addTask(task); this.addTask(task);
return task; return task;
@@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler { @@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler {
return ids.incrementAndGet(); return this.ids.incrementAndGet();
} }
- private void parsePending() { - private void parsePending() {

View file

@ -3518,6 +3518,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public long[] getRaw() { public long[] getRaw() {
return this.data; return this.data;
} }
diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
+++ b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
@@ -0,0 +0,0 @@ public abstract class BlockableEventLoop<R extends Runnable> implements Profiler
}
}
+ // Paper start
+ public void scheduleOnMain(Runnable r0) {
+ // postToMainThread does not work the same as older versions of mc
+ // This method is actually used to create a TickTask, which can then be posted onto main
+ this.tell(this.wrapRunnable(r0));
+ }
+ // Paper end
@Override
public void tell(R runnable) {
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java --- a/src/main/java/net/minecraft/world/entity/EntityType.java

View file

@ -9,28 +9,19 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListene
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
public final Connection connection;
private ServerLoginPacketListenerImpl.State state;
private int tick;
- private GameProfile gameProfile;
+ private GameProfile gameProfile; private void setGameProfile(final GameProfile profile) { this.gameProfile = profile; } private GameProfile getGameProfile() { return this.gameProfile; } // Paper - OBFHELPER
private final String serverId;
private SecretKey secretKey;
private ServerPlayer delayedAcceptPlayer;
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener @@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server; final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server;
// Paper start // Paper start
- PlayerProfile profile = Bukkit.createProfile(uniqueId, playerName); - PlayerProfile profile = Bukkit.createProfile(uniqueId, playerName);
+ PlayerProfile profile = CraftPlayerProfile.asBukkitMirror(getGameProfile()); + PlayerProfile profile = CraftPlayerProfile.asBukkitMirror(ServerLoginPacketListenerImpl.this.gameProfile);
AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId, profile); AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId, profile);
server.getPluginManager().callEvent(asyncEvent); server.getPluginManager().callEvent(asyncEvent);
profile = asyncEvent.getPlayerProfile(); profile = asyncEvent.getPlayerProfile();
- profile.complete(); - profile.complete();
- gameProfile = CraftPlayerProfile.asAuthlibCopy(profile); - gameProfile = CraftPlayerProfile.asAuthlibCopy(profile);
+ profile.complete(true); + profile.complete(true);
+ setGameProfile(CraftPlayerProfile.asAuthlib(profile)); + ServerLoginPacketListenerImpl.this.gameProfile = CraftPlayerProfile.asAuthlib(profile);
playerName = gameProfile.getName(); playerName = gameProfile.getName();
uniqueId = gameProfile.getId(); uniqueId = gameProfile.getId();
// Paper end // Paper end
@ -43,24 +34,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
protected final float defaultFlySpeed = 0.02F; protected final float defaultFlySpeed = 0.02F;
private int lastLevelUpTime; private int lastLevelUpTime;
- private final GameProfile gameProfile; - private final GameProfile gameProfile;
+ private GameProfile gameProfile; public final void setProfile(final GameProfile profile) { this.gameProfile = profile; } // Paper - OBFHELPER + public GameProfile gameProfile; // Paper - private->public
private boolean reducedDebugInfo;
private ItemStack lastItemInMainHand; private ItemStack lastItemInMainHand;
private final ItemCooldowns cooldowns; private final ItemCooldowns cooldowns;
@Nullable
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ import net.minecraft.world.inventory.AbstractContainerMenu; @@ -0,0 +0,0 @@ import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.GameType; import net.minecraft.world.level.GameType;
import net.minecraft.world.level.block.Blocks;
+import net.minecraft.world.level.biome.BiomeManager; +import net.minecraft.world.level.biome.BiomeManager;
import net.minecraft.world.level.block.entity.SignBlockEntity; import net.minecraft.world.level.block.entity.SignBlockEntity;
import net.minecraft.world.level.saveddata.maps.MapDecoration; import net.minecraft.world.level.saveddata.maps.MapDecoration;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
hiddenPlayers.put(player.getUniqueId(), hidingPlugins); this.hiddenPlayers.put(player.getUniqueId(), hidingPlugins);
// Remove this player from the hidden player's EntityTrackerEntry // Remove this player from the hidden player's EntityTrackerEntry
- ChunkMap tracker = ((ServerLevel) entity.level).getChunkSource().chunkMap; - ChunkMap tracker = ((ServerLevel) entity.level).getChunkSource().chunkMap;
@ -73,10 +64,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
ChunkMap.TrackedEntity entry = tracker.entityMap.get(other.getId()); ChunkMap.TrackedEntity entry = tracker.entityMap.get(other.getId());
if (entry != null) { if (entry != null) {
entry.removePlayer(getHandle()); entry.removePlayer(this.getHandle());
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
hiddenPlayers.remove(player.getUniqueId()); this.hiddenPlayers.remove(player.getUniqueId());
- ChunkMap tracker = ((ServerLevel) entity.level).getChunkSource().chunkMap; - ChunkMap tracker = ((ServerLevel) entity.level).getChunkSource().chunkMap;
+ // Paper start + // Paper start
@ -87,10 +78,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ ChunkMap tracker = ((ServerLevel) entity.level).getChunkSource().chunkMap; + ChunkMap tracker = ((ServerLevel) entity.level).getChunkSource().chunkMap;
+ // Paper end + // Paper end
getHandle().connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, other)); this.getHandle().connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, other));
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
entry.updatePlayer(getHandle()); entry.updatePlayer(this.getHandle());
} }
} }
+ // Paper start + // Paper start
@ -102,7 +93,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ public void setPlayerProfile(com.destroystokyo.paper.profile.PlayerProfile profile) { + public void setPlayerProfile(com.destroystokyo.paper.profile.PlayerProfile profile) {
+ ServerPlayer self = getHandle(); + ServerPlayer self = getHandle();
+ self.setProfile(com.destroystokyo.paper.profile.CraftPlayerProfile.asAuthlibCopy(profile)); + self.gameProfile = com.destroystokyo.paper.profile.CraftPlayerProfile.asAuthlibCopy(profile);
+ if (!self.sentListPacket) { + if (!self.sentListPacket) {
+ return; + return;
+ } + }
@ -128,7 +119,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ ServerLevel worldserver = handle.getLevel(); + ServerLevel worldserver = handle.getLevel();
+ connection.send(new net.minecraft.network.protocol.game.ClientboundRespawnPacket(worldserver.dimensionType(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), handle.gameMode.getGameModeForPlayer(), handle.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), true)); + connection.send(new net.minecraft.network.protocol.game.ClientboundRespawnPacket(worldserver.dimensionType(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), handle.gameMode.getGameModeForPlayer(), handle.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), true));
+ handle.onUpdateAbilities(); + handle.onUpdateAbilities();
+ connection.send(new net.minecraft.network.protocol.game.ClientboundPlayerPositionPacket(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), new HashSet<>(), 0)); + connection.send(new net.minecraft.network.protocol.game.ClientboundPlayerPositionPacket(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), java.util.Collections.emptySet(), 0, false));
+ net.minecraft.server.MinecraftServer.getServer().getPlayerList().sendAllPlayerInfo(handle); + net.minecraft.server.MinecraftServer.getServer().getPlayerList().sendAllPlayerInfo(handle);
+ +
+ if (this.isOp()) { + if (this.isOp()) {
@ -139,4 +130,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
public void removeDisconnectingPlayer(Player player) { public void removeDisconnectingPlayer(Player player) {
hiddenPlayers.remove(player.getUniqueId()); this.hiddenPlayers.remove(player.getUniqueId());

View file

@ -11,10 +11,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class PlayerAdvancements { @@ -0,0 +0,0 @@ public class PlayerAdvancements {
boolean flag1 = advancementprogress.isDone(); boolean flag1 = advancementprogress.isDone();
if (advancementprogress.a(criterionName)) { if (advancementprogress.grantProgress(criterionName)) {
+ // Paper start + // Paper start
+ if (!new com.destroystokyo.paper.event.player.PlayerAdvancementCriterionGrantEvent(this.player.getBukkitEntity(), advancement.bukkit, criterionName).callEvent()) { + if (!new com.destroystokyo.paper.event.player.PlayerAdvancementCriterionGrantEvent(this.player.getBukkitEntity(), advancement.bukkit, criterionName).callEvent()) {
+ advancementprogress.b(criterionName); + advancementprogress.revokeProgress(criterionName);
+ return false; + return false;
+ } + }
+ // Paper end + // Paper end

View file

@ -14,11 +14,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
} }
+ @Override
+ public UUID getOwnerUniqueId() { + public UUID getOwnerUniqueId() {
+ return getOwnerUUID(); + return getOwnerUUID();
+ } + }
public UUID getOwnerUUID() { public UUID getOwnerUUID() {
return getHandle().getOwnerUUID(); return this.getHandle().getOwnerUUID();
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -28,9 +29,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return (TamableAnimal) super.getHandle(); return (TamableAnimal) super.getHandle();
} }
+ @Override
+ public UUID getOwnerUniqueId() { + public UUID getOwnerUniqueId() {
+ return getOwnerUUID(); + return getOwnerUUID();
+ } + }
public UUID getOwnerUUID() { public UUID getOwnerUUID() {
try { try {
return getHandle().getOwnerUUID(); return this.getHandle().getOwnerUUID();