mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-15 14:13:56 +01:00
Fix more compile issues
This commit is contained in:
parent
9206b1ea14
commit
bcdf841f2d
25 changed files with 206 additions and 265 deletions
|
@ -14,21 +14,80 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the modifier with the corresponding key.
|
||||
+ *
|
||||
+ * @param key the jey of the modifier
|
||||
+ * @return the modifier, if it exists
|
||||
+ */
|
||||
+ @org.jetbrains.annotations.Nullable AttributeModifier getModifier(@NotNull net.kyori.adventure.key.Key key);
|
||||
+
|
||||
+ /**
|
||||
+ * Remove a modifier with the corresponding key from this instance.
|
||||
+ *
|
||||
+ * @param key the key of the modifier
|
||||
+ */
|
||||
+ void removeModifier(@NotNull net.kyori.adventure.key.Key key);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the modifier with the corresponding UUID.
|
||||
+ *
|
||||
+ * @param uuid the UUID of the modifier
|
||||
+ * @return the modifier, if it exists
|
||||
+ * @deprecated use {@link #getModifier(net.kyori.adventure.key.Key)}, modifiers are no longer stored by UUID
|
||||
+ */
|
||||
+ @Deprecated(forRemoval = true, since = "1.21")
|
||||
+ @org.jetbrains.annotations.Nullable AttributeModifier getModifier(@NotNull java.util.UUID uuid);
|
||||
+
|
||||
+ /**
|
||||
+ * Remove a modifier with the corresponding UUID from this instance.
|
||||
+ *
|
||||
+ * @param uuid the UUID of the modifier
|
||||
+ * @deprecated use {@link #removeModifier(net.kyori.adventure.key.Key)}, modifiers are no longer stored by UUID
|
||||
+ */
|
||||
+ @Deprecated(forRemoval = true, since = "1.21")
|
||||
+ void removeModifier(@NotNull java.util.UUID uuid);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Add a modifier to this instance.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/attribute/AttributeModifier.java b/src/main/java/org/bukkit/attribute/AttributeModifier.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/attribute/AttributeModifier.java
|
||||
+++ b/src/main/java/org/bukkit/attribute/AttributeModifier.java
|
||||
@@ -0,0 +0,0 @@ public class AttributeModifier implements ConfigurationSerializable, Keyed {
|
||||
private final Operation operation;
|
||||
private final EquipmentSlotGroup slot;
|
||||
|
||||
- @Deprecated
|
||||
+ @Deprecated(forRemoval = true, since = "1.21")
|
||||
public AttributeModifier(@NotNull String name, double amount, @NotNull Operation operation) {
|
||||
this(UUID.randomUUID(), name, amount, operation);
|
||||
}
|
||||
|
||||
- @Deprecated
|
||||
+ @Deprecated(forRemoval = true, since = "1.21")
|
||||
public AttributeModifier(@NotNull UUID uuid, @NotNull String name, double amount, @NotNull Operation operation) {
|
||||
this(uuid, name, amount, operation, (EquipmentSlot) null);
|
||||
}
|
||||
|
||||
- @Deprecated
|
||||
+ @Deprecated(forRemoval = true, since = "1.21")
|
||||
public AttributeModifier(@NotNull UUID uuid, @NotNull String name, double amount, @NotNull Operation operation, @Nullable EquipmentSlot slot) {
|
||||
this(uuid, name, amount, operation, (slot) == null ? EquipmentSlotGroup.ANY : slot.getGroup());
|
||||
}
|
||||
|
||||
- @Deprecated
|
||||
+ @Deprecated(forRemoval = true, since = "1.21")
|
||||
public AttributeModifier(@NotNull UUID uuid, @NotNull String name, double amount, @NotNull Operation operation, @NotNull EquipmentSlotGroup slot) {
|
||||
this(NamespacedKey.fromString(uuid.toString()), amount, operation, slot);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class AttributeModifier implements ConfigurationSerializable, Keyed {
|
||||
* @deprecated attributes are now identified by keys
|
||||
*/
|
||||
@NotNull
|
||||
- @Deprecated
|
||||
+ @Deprecated(forRemoval = true, since = "1.21")
|
||||
public UUID getUniqueId() {
|
||||
return UUID.fromString(getKey().toString());
|
||||
}
|
||||
|
|
|
@ -1,89 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MiniDigger | Martin <admin@minidigger.dev>
|
||||
Date: Wed, 29 Apr 2020 02:09:17 +0200
|
||||
Subject: [PATCH] Allow delegation to vanilla chunk gen
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -0,0 +0,0 @@ public final class Bukkit {
|
||||
return server.createChunkData(world);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Create a ChunkData for use in a generator, that is populated by the vanilla generator for that world
|
||||
+ *
|
||||
+ * @param world the world to create the ChunkData for
|
||||
+ * @param x the x coordinate of the chunk
|
||||
+ * @param z the z coordinate of the chunk
|
||||
+ * @return a new ChunkData for the world
|
||||
+ * @deprecated The new multi-stage worldgen API allows a similar effect by overriding all of the "shouldGenerate..." methods to
|
||||
+ * return true, and then modifying the chunkdata in a later stage such as surface or bedrock generation.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Deprecated(forRemoval = true)
|
||||
+ public static ChunkGenerator.ChunkData createVanillaChunkData(@NotNull World world, int x, int z) {
|
||||
+ return server.createVanillaChunkData(world, x, z);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Creates a boss bar instance to display to players. The progress
|
||||
* defaults to 1.0
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@NotNull
|
||||
public ChunkGenerator.ChunkData createChunkData(@NotNull World world);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Create a ChunkData for use in a generator, that is populated by the vanilla generator for that world.
|
||||
+ *
|
||||
+ * @param world the world to create the ChunkData for
|
||||
+ * @param x the x coordinate of the chunk
|
||||
+ * @param z the z coordinate of the chunk
|
||||
+ * @return a new ChunkData for the world
|
||||
+ * @deprecated The new multi-stage worldgen API allows a similar effect by overriding all of the "shouldGenerate..." methods to
|
||||
+ * return true, and then modifying the chunkdata in a later stage such as surface or bedrock generation.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Deprecated(forRemoval = true)
|
||||
+ ChunkGenerator.ChunkData createVanillaChunkData(@NotNull World world, int x, int z);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Creates a boss bar instance to display to players. The progress
|
||||
* defaults to 1.0
|
||||
diff --git a/src/main/java/org/bukkit/generator/ChunkGenerator.java b/src/main/java/org/bukkit/generator/ChunkGenerator.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/generator/ChunkGenerator.java
|
||||
+++ b/src/main/java/org/bukkit/generator/ChunkGenerator.java
|
||||
@@ -0,0 +0,0 @@ public abstract class ChunkGenerator {
|
||||
return false;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Create a ChunkData for use in a generator, that is populated by the vanilla generator for that world
|
||||
+ *
|
||||
+ * @param world the world to create the ChunkData for
|
||||
+ * @param x the x coordinate of the chunk
|
||||
+ * @param z the z coordinate of the chunk
|
||||
+ * @return a new ChunkData for the world
|
||||
+ *
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ChunkData createVanillaChunkData(@NotNull World world, int x, int z) {
|
||||
+ return Bukkit.getServer().createVanillaChunkData(world, x, z);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets if the server should generate Vanilla structures after this
|
||||
* ChunkGenerator.
|
|
@ -9,28 +9,20 @@ diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/o
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.Translatable;
|
||||
import org.bukkit.Utility;
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.material.MaterialData;
|
||||
@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
public String getI18NDisplayName() {
|
||||
return Bukkit.getServer().getItemFactory().getI18NDisplayName(this);
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * @deprecated use {@link #getMaxItemUseDuration(LivingEntity)}; crossbows, later possibly more items require an entity parameter
|
||||
+ * @deprecated use {@link #getMaxItemUseDuration(org.bukkit.entity.LivingEntity)}; crossbows, later possibly more items require an entity parameter
|
||||
+ */
|
||||
+ @Deprecated(forRemoval = true)
|
||||
+ public int getMaxItemUseDuration() {
|
||||
+ return getMaxItemUseDuration(null);
|
||||
+ }
|
||||
+
|
||||
+ public int getMaxItemUseDuration(@NotNull final LivingEntity entity) {
|
||||
+ public int getMaxItemUseDuration(@NotNull final org.bukkit.entity.LivingEntity entity) {
|
||||
+ if (type == null || type == Material.AIR || !type.isItem()) {
|
||||
+ return 0;
|
||||
+ }
|
||||
|
|
|
@ -26,9 +26,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ public int applyMending(int amount) {
|
||||
+ ServerPlayer handle = this.getHandle();
|
||||
+ // Logic copied from EntityExperienceOrb and remapped to unobfuscated methods/properties
|
||||
+ final var stackEntry = net.minecraft.world.item.enchantment.EnchantmentHelper
|
||||
+ .getRandomItemWith(net.minecraft.world.item.enchantment.Enchantments.MENDING, handle, net.minecraft.world.item.ItemStack::isDamaged);
|
||||
+ final net.minecraft.world.item.ItemStack itemstack = stackEntry != null ? stackEntry.getValue() : net.minecraft.world.item.ItemStack.EMPTY;
|
||||
+
|
||||
+ final Optional<net.minecraft.world.item.enchantment.EnchantedItemInUse> stackEntry = net.minecraft.world.item.enchantment.EnchantmentHelper
|
||||
+ .getRandomItemWith(net.minecraft.world.item.enchantment.EnchantmentEffectComponents.REPAIR_WITH_XP, handle, net.minecraft.world.item.ItemStack::isDamaged);
|
||||
+ final net.minecraft.world.item.ItemStack itemstack = stackEntry.map(net.minecraft.world.item.enchantment.EnchantedItemInUse::itemStack).orElse(net.minecraft.world.item.ItemStack.EMPTY);
|
||||
+ if (!itemstack.isEmpty() && itemstack.getItem().components().has(net.minecraft.core.component.DataComponents.MAX_DAMAGE)) {
|
||||
+ net.minecraft.world.entity.ExperienceOrb orb = net.minecraft.world.entity.EntityType.EXPERIENCE_ORB.create(handle.level());
|
||||
+ orb.value = amount;
|
||||
|
|
|
@ -8,6 +8,14 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.jav
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.core.HolderSet;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.core.component.DataComponentPatch;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tags.EnchantmentTags;
|
||||
import net.minecraft.util.RandomSource;
|
||||
@@ -0,0 +0,0 @@ public final class CraftItemFactory implements ItemFactory {
|
||||
new net.md_5.bungee.api.chat.TextComponent(customName));
|
||||
}
|
||||
|
@ -21,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ return null;
|
||||
+ }
|
||||
+ String typeId = type.getKey().toString();
|
||||
+ net.minecraft.resources.ResourceLocation typeKey = new net.minecraft.resources.ResourceLocation(typeId);
|
||||
+ net.minecraft.resources.ResourceLocation typeKey = ResourceLocation.parse(typeId);
|
||||
+ net.minecraft.world.entity.EntityType<?> nmsType = net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(typeKey);
|
||||
+ net.minecraft.world.item.SpawnEggItem eggItem = net.minecraft.world.item.SpawnEggItem.byId(nmsType);
|
||||
+ return eggItem == null ? null : new net.minecraft.world.item.ItemStack(eggItem).asBukkitMirror();
|
||||
|
|
|
@ -8,6 +8,14 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/mai
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.CraftLootTable;
|
||||
@@ -0,0 +0,0 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
|
||||
this.getHandle().setAggressive(aggressive);
|
||||
}
|
||||
|
@ -16,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper start
|
||||
+ @Override
|
||||
+ public int getPossibleExperienceReward() {
|
||||
+ return getHandle().getExperienceReward();
|
||||
+ return getHandle().getExperienceReward((ServerLevel) this.getHandle().level(), null);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
|
|
@ -279,8 +279,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
// Paper start - validate pick item position
|
||||
if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.getInventory().items.size())) {
|
||||
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
|
||||
- this.disconnect("Invalid hotbar selection (Hacking?)");
|
||||
+ this.disconnect("Invalid hotbar selection (Hacking?)", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause
|
||||
- this.disconnect(Component.literal("Invalid hotbar selection (Hacking?)"));
|
||||
+ this.disconnect(Component.literal("Invalid hotbar selection (Hacking?)"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause
|
||||
return;
|
||||
}
|
||||
this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed
|
||||
|
@ -288,8 +288,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
|
||||
if (byteLength > 256 * 4) {
|
||||
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!");
|
||||
- server.scheduleOnMain(() -> this.disconnect("Book too large!"));
|
||||
+ server.scheduleOnMain(() -> this.disconnect("Book too large!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause
|
||||
- server.scheduleOnMain(() -> this.disconnect(Component.literal("Book too large!")));
|
||||
+ server.scheduleOnMain(() -> this.disconnect(Component.literal("Book too large!"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause
|
||||
return;
|
||||
}
|
||||
byteTotal += byteLength;
|
||||
|
@ -297,8 +297,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
if (byteTotal > byteAllowed) {
|
||||
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size());
|
||||
- server.scheduleOnMain(() -> this.disconnect("Book too large!"));
|
||||
+ server.scheduleOnMain(() -> this.disconnect("Book too large!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause
|
||||
- server.scheduleOnMain(() -> this.disconnect(Component.literal("Book too large!")));
|
||||
+ server.scheduleOnMain(() -> this.disconnect(Component.literal("Book too large!"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
this.disconnect("Invalid hotbar selection (Hacking?)", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause
|
||||
this.disconnect(Component.literal("Invalid hotbar selection (Hacking?)"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause
|
||||
return;
|
||||
}
|
||||
- this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed
|
||||
|
|
|
@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ recipeName = CraftNamespacedKey.toMinecraft(((org.bukkit.Keyed) event.getRecipe()).getKey());
|
||||
+ makeAll = event.isShiftClick();
|
||||
+ }
|
||||
+ if (!(this.player.containerMenu instanceof RecipeBookMenu<?> recipeBookMenu)) {
|
||||
+ if (!(this.player.containerMenu instanceof RecipeBookMenu<?, ?> recipeBookMenu)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end - Add PlayerRecipeBookClickEvent
|
||||
|
|
|
@ -28,6 +28,80 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@Override
|
||||
public void addModifier(AttributeModifier modifier) {
|
||||
throw new UnsupportedOperationException("Cannot modify default attributes");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/AttributeMappings.java b/src/main/java/org/bukkit/craftbukkit/attribute/AttributeMappings.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/attribute/AttributeMappings.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package org.bukkit.craftbukkit.attribute;
|
||||
+
|
||||
+import java.util.HashMap;
|
||||
+import java.util.Map;
|
||||
+import java.util.UUID;
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+final class AttributeMappings {
|
||||
+ private static final Map<UUID, NamespacedKey> ATTRIBUTE_MODIFIER_IDS = new HashMap<>();
|
||||
+
|
||||
+ static {
|
||||
+ add(-4483571535397864886L, -5989644940537681742L, "armor.body");
|
||||
+ add(8144722948526719024L, -7778190119041365872L, "effect.slowness");
|
||||
+ add(6967552254039378640L, -9116175396973475259L, "enchantment.aqua_affinity");
|
||||
+ add(5279725409867744698L, -5150363631200102632L, "attacking");
|
||||
+ add(148071211714102867L, -7685811609035173472L, "attacking");
|
||||
+ add(6196088217904236654L, -7493791321850887290L, "effect.minining_fatigue");
|
||||
+ add(-5084161844451524480L, -8859020046251006329L, "enchantment.soul_speed");
|
||||
+ add(-7907339078496465106L, -8112074600724210224L, "enchantment.swift_sneak");
|
||||
+ add(6688265815086220243L, -6545541163342161890L, "drinking");
|
||||
+ add(8315164243412860989L, -6631520853640075966L, "creative_mode_block_range");
|
||||
+ add(4389663563256579765L, -4827163546944004714L, "enchantment.efficiency");
|
||||
+ add(6732612758648800940L, -5145707699103688244L, "effect.health_boost");
|
||||
+ add(9079981369298536661L, -6728494925450710401L, "covered");
|
||||
+ add(-1521481167610687786L, -8630419745734927691L, "effect.absorption");
|
||||
+ add(-7473408062188862076L, -5872005994337939597L, "creative_mode_entity_range");
|
||||
+ add(-3721396875562958315L, -5317020504214661337L, "effect.unluck");
|
||||
+ add(-2861585646493481178L, -6113244764726669811L, "armor.leggings");
|
||||
+ add(6718535547217657911L, -5386630269401489641L, "enchantment.sweeping_edge");
|
||||
+ add(-7949229004988660584L, -7828611303000832459L, "effect.speed");
|
||||
+ add(-8650171790042118250L, -5749650997644763080L, "enchantment.soul_speed");
|
||||
+ add(551224288813600377L, -8734740027710371860L, "enchantment.respiration");
|
||||
+ add(-7046399332347654691L, -6723081531683397260L, "suffocating");
|
||||
+ add(7361814797886573596L, -8641397326606817395L, "sprinting");
|
||||
+ add(-6972338111383059132L, -8978659762232839026L, "armor.chestplate");
|
||||
+ add(-5371971015925809039L, -6062243582569928137L, "enchantment.fire_protection");
|
||||
+ add(7245570952092733273L, -8449101711440750679L, "effect.strength");
|
||||
+ add(-422425648963762075L, -5756800103171642205L, "base_attack_speed");
|
||||
+ add(-4607081316629330256L, -7008565754814018370L, "effect.jump_boost");
|
||||
+ add(271280981090454338L, -8746077033958322898L, "effect.luck");
|
||||
+ add(2211131075215181206L, -5513857709499300658L, "powder_snow");
|
||||
+ add(-8908768238899017377L, -8313820693701227669L, "armor.boots");
|
||||
+ add(-5797418877589107702L, -6181652684028920077L, "effect.haste");
|
||||
+ add(3086076556416732775L, -5150312587563650736L, "armor.helmet");
|
||||
+ add(-5082757096938257406L, -4891139119377885130L, "baby");
|
||||
+ add(2478452629826324956L, -7247530463494186011L, "effect.weakness");
|
||||
+ add(4659420831966187055L, -5191473055587376048L, "enchantment.blast_protection");
|
||||
+ add(7301951777949303281L, -6753860660653972126L, "evil");
|
||||
+ add(8533189226688352746L, -8254757081029716377L, "baby");
|
||||
+ add(1286946037536540352L, -5768092872487507967L, "enchantment.depth_strider");
|
||||
+ add(-3801225194067177672L, -6586624321849018929L, "base_attack_damage");
|
||||
+ }
|
||||
+
|
||||
+ public static @NotNull NamespacedKey uuidToKey(final UUID uuid) {
|
||||
+ final NamespacedKey key = ATTRIBUTE_MODIFIER_IDS.get(uuid);
|
||||
+ if (key != null) {
|
||||
+ return key;
|
||||
+ } else {
|
||||
+ return NamespacedKey.minecraft(uuid.toString());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void add(final long msb, final long lsb, final String id) {
|
||||
+ final UUID uuid = new UUID(msb, lsb);
|
||||
+ ATTRIBUTE_MODIFIER_IDS.put(uuid, NamespacedKey.minecraft(id));
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java
|
||||
|
@ -38,16 +112,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public AttributeModifier getModifier(final net.kyori.adventure.key.Key key) {
|
||||
+ Preconditions.checkArgument(key != null, "Key cannot be null");
|
||||
+ net.minecraft.world.entity.ai.attributes.AttributeModifier modifier = this.handle.getModifier(io.papermc.paper.adventure.PaperAdventure.asVanilla(key));
|
||||
+ return modifier == null ? null : CraftAttributeInstance.convert(modifier);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void removeModifier(final net.kyori.adventure.key.Key key) {
|
||||
+ Preconditions.checkArgument(key != null, "Key cannot be null");
|
||||
+ this.handle.removeModifier(io.papermc.paper.adventure.PaperAdventure.asVanilla(key));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public AttributeModifier getModifier(java.util.UUID uuid) {
|
||||
+ Preconditions.checkArgument(uuid != null, "UUID cannot be null");
|
||||
+ net.minecraft.world.entity.ai.attributes.AttributeModifier modifier = this.handle.getModifier(uuid);
|
||||
+ return modifier == null ? null : CraftAttributeInstance.convert(modifier);
|
||||
+ return this.getModifier(AttributeMappings.uuidToKey(uuid));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void removeModifier(java.util.UUID uuid) {
|
||||
+ Preconditions.checkArgument(uuid != null, "UUID cannot be null");
|
||||
+ this.handle.removeModifier(uuid);
|
||||
+ this.removeModifier(AttributeMappings.uuidToKey(uuid));
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
|
|
|
@ -146,7 +146,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
// Paper start - Prevent block entity and entity crashes
|
||||
final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
|
||||
net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable);
|
||||
+ net.minecraft.world.level.chunk.LevelChunk.this.level.getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new ServerInternalException(msg, throwable))); // Paper - ServerExceptionEvent
|
||||
+ net.minecraft.world.level.chunk.LevelChunk.this.level.getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, throwable))); // Paper - ServerExceptionEvent
|
||||
LevelChunk.this.removeBlockEntity(this.getPos());
|
||||
// Paper end - Prevent block entity and entity crashes
|
||||
// Spigot start
|
||||
|
|
|
@ -4531,7 +4531,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ @Override
|
||||
+ public void playSound(final net.kyori.adventure.sound.Sound sound) {
|
||||
+ final Vec3 pos = this.getHandle().position();
|
||||
+ final net.minecraft.world.phys.Vec3 pos = this.getHandle().position();
|
||||
+ this.playSound(sound, pos.x, pos.y, pos.z);
|
||||
+ }
|
||||
+
|
||||
|
|
|
@ -1,129 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MiniDigger | Martin <admin@minidigger.dev>
|
||||
Date: Wed, 29 Apr 2020 02:10:32 +0200
|
||||
Subject: [PATCH] Allow delegation to vanilla chunk gen
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
return new OldCraftChunkData(world.getMinHeight(), world.getMaxHeight(), handle.registryAccess().registryOrThrow(Registries.BIOME));
|
||||
}
|
||||
|
||||
+ // Paper start - Allow delegation to vanilla chunk gen
|
||||
+ private static final List<net.minecraft.world.level.chunk.status.ChunkStatus> VANILLA_GEN_STATUSES = List.of(
|
||||
+ net.minecraft.world.level.chunk.status.ChunkStatus.EMPTY,
|
||||
+ net.minecraft.world.level.chunk.status.ChunkStatus.STRUCTURE_STARTS,
|
||||
+ net.minecraft.world.level.chunk.status.ChunkStatus.STRUCTURE_REFERENCES,
|
||||
+ net.minecraft.world.level.chunk.status.ChunkStatus.BIOMES,
|
||||
+ net.minecraft.world.level.chunk.status.ChunkStatus.NOISE,
|
||||
+ net.minecraft.world.level.chunk.status.ChunkStatus.SURFACE,
|
||||
+ net.minecraft.world.level.chunk.status.ChunkStatus.CARVERS,
|
||||
+ net.minecraft.world.level.chunk.status.ChunkStatus.FEATURES,
|
||||
+ net.minecraft.world.level.chunk.status.ChunkStatus.INITIALIZE_LIGHT,
|
||||
+ net.minecraft.world.level.chunk.status.ChunkStatus.LIGHT
|
||||
+ );
|
||||
+
|
||||
+ @Override
|
||||
+ @Deprecated(forRemoval = true)
|
||||
+ public ChunkGenerator.ChunkData createVanillaChunkData(World world, int x, int z) {
|
||||
+ // do bunch of vanilla shit
|
||||
+ final net.minecraft.server.level.ServerLevel serverLevel = ((CraftWorld) world).getHandle();
|
||||
+ final net.minecraft.core.Registry<net.minecraft.world.level.biome.Biome> biomeRegistry = serverLevel.getServer().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME);
|
||||
+ final net.minecraft.world.level.chunk.ProtoChunk protoChunk = new net.minecraft.world.level.chunk.ProtoChunk(
|
||||
+ new net.minecraft.world.level.ChunkPos(x, z),
|
||||
+ net.minecraft.world.level.chunk.UpgradeData.EMPTY,
|
||||
+ serverLevel,
|
||||
+ biomeRegistry,
|
||||
+ null
|
||||
+ );
|
||||
+
|
||||
+ final net.minecraft.world.level.chunk.ChunkGenerator chunkGenerator;
|
||||
+ if (serverLevel.chunkSource.getGenerator() instanceof org.bukkit.craftbukkit.generator.CustomChunkGenerator bukkit) {
|
||||
+ chunkGenerator = bukkit.getDelegate();
|
||||
+ } else {
|
||||
+ chunkGenerator = serverLevel.chunkSource.getGenerator();
|
||||
+ }
|
||||
+
|
||||
+ final net.minecraft.world.level.ChunkPos chunkPos = new net.minecraft.world.level.ChunkPos(x, z);
|
||||
+ final net.minecraft.util.thread.ProcessorMailbox<Runnable> mailbox = net.minecraft.util.thread.ProcessorMailbox.create(
|
||||
+ net.minecraft.Util.backgroundExecutor(),
|
||||
+ "CraftServer#createVanillaChunkData(worldName='" + world.getName() + "', x='" + x + "', z='" + z + "')"
|
||||
+ );
|
||||
+ for (final net.minecraft.world.level.chunk.status.ChunkStatus chunkStatus : VANILLA_GEN_STATUSES) {
|
||||
+ final List<net.minecraft.world.level.chunk.ChunkAccess> chunks = Lists.newArrayList();
|
||||
+ final int statusRange = Math.max(1, chunkStatus.getRange());
|
||||
+
|
||||
+ for (int zz = chunkPos.z - statusRange; zz <= chunkPos.z + statusRange; ++zz) {
|
||||
+ for (int xx = chunkPos.x - statusRange; xx <= chunkPos.x + statusRange; ++xx) {
|
||||
+ if (xx == chunkPos.x && zz == chunkPos.z) {
|
||||
+ chunks.add(protoChunk);
|
||||
+ } else {
|
||||
+ final net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biomeHolder = serverLevel.registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME).getHolderOrThrow(net.minecraft.world.level.biome.Biomes.PLAINS);
|
||||
+ final net.minecraft.world.level.chunk.ChunkAccess chunk = new net.minecraft.world.level.chunk.EmptyLevelChunk(serverLevel, new net.minecraft.world.level.ChunkPos(xx, zz), biomeHolder);
|
||||
+ chunks.add(chunk);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ chunkStatus.generate(
|
||||
+ new net.minecraft.world.level.chunk.status.WorldGenContext(
|
||||
+ serverLevel,
|
||||
+ chunkGenerator,
|
||||
+ serverLevel.getStructureManager(),
|
||||
+ serverLevel.chunkSource.getLightEngine()
|
||||
+ ),
|
||||
+ mailbox::tell,
|
||||
+ chunk -> {
|
||||
+ throw new UnsupportedOperationException("Not creating full chunks here");
|
||||
+ },
|
||||
+ chunks
|
||||
+ ).thenAccept(chunk -> {
|
||||
+ if (chunk != null && chunkStatus == net.minecraft.world.level.chunk.status.ChunkStatus.NOISE) {
|
||||
+ net.minecraft.world.level.levelgen.Heightmap.primeHeightmaps(chunk, net.minecraft.world.level.chunk.status.ChunkStatus.POST_FEATURES);
|
||||
+ }
|
||||
+ }).join();
|
||||
+ }
|
||||
+
|
||||
+ // get empty object
|
||||
+ OldCraftChunkData data = (OldCraftChunkData) this.createChunkData(world);
|
||||
+ // copy over generated sections
|
||||
+ data.setRawChunkData(protoChunk.getSections());
|
||||
+ // hooray!
|
||||
+ return data;
|
||||
+ }
|
||||
+ // Paper end - Allow delegation to vanilla chunk gen
|
||||
+
|
||||
@Override
|
||||
public BossBar createBossBar(String title, BarColor color, BarStyle style, BarFlag... flags) {
|
||||
return new CraftBossBar(title, color, style, flags);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.material.MaterialData;
|
||||
public final class OldCraftChunkData implements ChunkGenerator.ChunkData {
|
||||
private final int minHeight;
|
||||
private final int maxHeight;
|
||||
- private final LevelChunkSection[] sections;
|
||||
+ private LevelChunkSection[] sections; // Paper - Allow delegation to vanilla chunk gen
|
||||
private final Registry<net.minecraft.world.level.biome.Biome> biomes;
|
||||
private Set<BlockPos> tiles;
|
||||
private final Set<BlockPos> lights = new HashSet<>();
|
||||
@@ -0,0 +0,0 @@ public final class OldCraftChunkData implements ChunkGenerator.ChunkData {
|
||||
return this.tiles;
|
||||
}
|
||||
|
||||
- Set<BlockPos> getLights() {
|
||||
+ public Set<BlockPos> getLights() { // Paper - Allow delegation to vanilla chunk gen
|
||||
return this.lights;
|
||||
}
|
||||
+
|
||||
+ // Paper start - Allow delegation to vanilla chunk gen
|
||||
+ public void setRawChunkData(LevelChunkSection[] sections) {
|
||||
+ this.sections = sections;
|
||||
+ }
|
||||
+ // Paper end - Allow delegation to vanilla chunk gen
|
||||
}
|
|
@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
|
||||
+ if (byteLength > 256 * 4) {
|
||||
+ ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!");
|
||||
+ server.scheduleOnMain(() -> this.disconnect("Book too large!"));
|
||||
+ server.scheduleOnMain(() -> this.disconnect(Component.literal("Book too large!")));
|
||||
+ return;
|
||||
+ }
|
||||
+ byteTotal += byteLength;
|
||||
|
@ -47,7 +47,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ if (byteTotal > byteAllowed) {
|
||||
+ ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size());
|
||||
+ server.scheduleOnMain(() -> this.disconnect("Book too large!"));
|
||||
+ server.scheduleOnMain(() -> this.disconnect(Component.literal("Book too large!")));
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
|
|
|
@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper start - do not accept invalid information
|
||||
+ if (packet.information().viewDistance() < 0) {
|
||||
+ LOGGER.warn("Disconnecting " + this.player.getScoreboardName() + " for invalid view distance: " + packet.information().viewDistance());
|
||||
+ this.disconnect("Invalid client settings", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION);
|
||||
+ this.disconnect(Component.literal("Invalid client settings"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION);
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end - do not accept invalid information
|
||||
|
|
|
@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
+ if (!this.mob.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items
|
||||
+ if (!this.mob.level().getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_MOBGRIEFING) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items
|
||||
Raid raid = this.mob.getCurrentRaid();
|
||||
|
||||
if (this.mob.hasActiveRaid() && !this.mob.getCurrentRaid().isOver() && this.mob.canBeLeader() && !ItemStack.matches(this.mob.getItemBySlot(EquipmentSlot.HEAD), Raid.getLeaderBannerInstance(this.mob.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN)))) {
|
||||
|
|
|
@ -38,14 +38,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
- this.player.kickLeaveMessage = event.getLeaveMessage(); // CraftBukkit - SPIGOT-3034: Forward leave message to PlayerQuitEvent
|
||||
// Send the possibly modified leave message
|
||||
this.disconnect0(new DisconnectionDetails(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()), disconnectionInfo.report(), disconnectionInfo.bugReportLink())); // Paper - Adventure
|
||||
- this.disconnect0(new DisconnectionDetails(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()), disconnectionInfo.report(), disconnectionInfo.bugReportLink())); // Paper - Adventure
|
||||
+ this.disconnect0(new DisconnectionDetails(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()), disconnectionInfo.report(), disconnectionInfo.bugReportLink()), event.leaveMessage()); // Paper - Adventure & use kick event leave message
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
|
||||
- private void disconnect0(DisconnectionDetails disconnectiondetails) {
|
||||
+ private void disconnect0(DisconnectionDetails disconnectiondetails, @Nullable net.kyori.adventure.text.Component leaveMessage) { // Paper - use kick event leave message
|
||||
// CraftBukkit end
|
||||
this.player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.KICKED; // Paper - Add API for quit reason
|
||||
this.connection.send(new ClientboundDisconnectPacket(disconnectiondetails.reason()), PacketSendListener.thenRun(() -> {
|
||||
this.connection.disconnect(disconnectiondetails);
|
||||
}));
|
||||
- this.onDisconnect(disconnectiondetails); // CraftBukkit - fire quit instantly
|
||||
+ this.onDisconnect(disconnectiondetails, event.leaveMessage()); // CraftBukkit - fire quit instantly // Paper - use kick event leave message
|
||||
+ this.onDisconnect(disconnectiondetails, leaveMessage); // CraftBukkit - fire quit instantly // Paper - use kick event leave message
|
||||
this.connection.setReadOnly();
|
||||
MinecraftServer minecraftserver = this.server;
|
||||
Connection networkmanager = this.connection;
|
||||
|
|
|
@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ @Override
|
||||
+ public void setActiveItemRemainingTime(final int ticks) {
|
||||
+ Preconditions.checkArgument(ticks >= 0, "ticks must be >= 0");
|
||||
+ Preconditions.checkArgument(ticks <= this.getHandle().getUseItem().getUseDuration(), "ticks must be <= item use duration");
|
||||
+ Preconditions.checkArgument(ticks <= this.getHandle().getUseItem().getUseDuration(this.getHandle()), "ticks must be <= item use duration");
|
||||
+ this.getHandle().useItemRemaining = ticks;
|
||||
+ }
|
||||
+
|
||||
|
|
|
@ -145,7 +145,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ @Override
|
||||
+ public void lookAt(double x, double y, double z, @NotNull io.papermc.paper.entity.LookAnchor playerAnchor) {
|
||||
+ this.getHandle().lookAt(toNmsAnchor(playerAnchor), new Vec3(x, y, z));
|
||||
+ this.getHandle().lookAt(toNmsAnchor(playerAnchor), new net.minecraft.world.phys.Vec3(x, y, z));
|
||||
+ }
|
||||
+
|
||||
+ public static net.minecraft.commands.arguments.EntityAnchorArgument.Anchor toNmsAnchor(io.papermc.paper.entity.LookAnchor nmsAnchor) {
|
||||
|
|
|
@ -164,7 +164,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ private static final Logger LOGGER = LogUtils.getClassLogger();
|
||||
+ public static final String WORLD_DEFAULTS = "__world_defaults__";
|
||||
+ public static final ResourceLocation WORLD_DEFAULTS_KEY = new ResourceLocation("configurations", WORLD_DEFAULTS);
|
||||
+ public static final ResourceLocation WORLD_DEFAULTS_KEY = ResourceLocation.fromNamespaceAndPath("configurations", WORLD_DEFAULTS);
|
||||
+ protected final Path globalFolder;
|
||||
+ protected final Class<G> globalConfigClass;
|
||||
+ protected final Class<W> worldConfigClass;
|
||||
|
|
|
@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
public void ackBlockChangesUpTo(int sequence) {
|
||||
if (sequence < 0) {
|
||||
+ this.disconnect("Expected packet sequence nr >= 0", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - Treat sequence violations like they should be
|
||||
+ this.disconnect(Component.literal("Expected packet sequence nr >= 0"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - Treat sequence violations like they should be
|
||||
throw new IllegalArgumentException("Expected packet sequence nr >= 0");
|
||||
} else {
|
||||
this.ackBlockChangesUpTo = Math.max(sequence, this.ackBlockChangesUpTo);
|
||||
|
|
|
@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper start - validate pick item position
|
||||
+ if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.getInventory().items.size())) {
|
||||
+ ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
|
||||
+ this.disconnect("Invalid hotbar selection (Hacking?)");
|
||||
+ this.disconnect(Component.literal("Invalid hotbar selection (Hacking?)"));
|
||||
+ return;
|
||||
+ }
|
||||
+ this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed
|
||||
|
|
|
@ -47,13 +47,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
net.minecraft.world.level.chunk.LevelChunk chunk = this.world.getChunkSource().getChunkAtIfLoadedImmediately(x, z);
|
||||
if (chunk == null) {
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@Override
|
||||
public boolean regenerateChunk(int x, int z) {
|
||||
org.spigotmc.AsyncCatcher.catchOp("chunk regenerate"); // Spigot
|
||||
if (!unloadChunk0(x, z, false)) {
|
||||
return false;
|
||||
}
|
||||
+ warnUnsafeChunk("regenerating a faraway chunk", x, z); // Paper
|
||||
// Paper start - implement regenerateChunk method
|
||||
final ServerLevel serverLevel = this.world;
|
||||
final net.minecraft.server.level.ServerChunkCache serverChunkCache = serverLevel.getChunkSource();
|
||||
|
||||
final long chunkKey = ChunkCoordIntPair.pair(x, z);
|
||||
world.getChunkProvider().unloadQueue.remove(chunkKey);
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@Override
|
||||
public boolean loadChunk(int x, int z, boolean generate) {
|
||||
|
|
|
@ -87,7 +87,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
public void onDisconnect(DisconnectionDetails info) {
|
||||
+ // Paper start - Debugging
|
||||
+ if (net.minecraft.server.MinecraftServer.getServer().isDebugging()) {
|
||||
+ ServerConfigurationPacketListenerImpl.LOGGER.info("{} lost connection: {}, while in configuration phase {}", this.gameProfile, reason.getString(), currentTask != null ? currentTask.type().id() : "null");
|
||||
+ ServerConfigurationPacketListenerImpl.LOGGER.info("{} lost connection: {}, while in configuration phase {}", this.gameProfile, info.reason().getString(), currentTask != null ? currentTask.type().id() : "null");
|
||||
+ } else // Paper end
|
||||
ServerConfigurationPacketListenerImpl.LOGGER.info("{} lost connection: {}", this.gameProfile, info.reason().getString());
|
||||
super.onDisconnect(info);
|
||||
|
|
Loading…
Reference in a new issue