mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#11102)
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 3a3bea52 SPIGOT-7829: Increase maximum outgoing plugin message size to match Vanilla intention 5cd1c8cb SPIGOT-7831: Add CreatureSpawnEvent.SpawnReason#POTION_EFFECT a8e278f0 SPIGOT-7827: Sync EntityPortalEvent with PlayerPortalEvent since non-players can now create portals 53729d12 Remove spurious ApiStatus.Internal annotation b9f57486 SPIGOT-7799, PR-1039: Expose explosion world interaction in EntityExplodeEvent and BlockExplodeEvent 7983b966 PR-1029: Trial changing a small number of inner enums to classes/interfaces to better support custom values CraftBukkit Changes: 403accd56 SPIGOT-7831: Add CreatureSpawnEvent.SpawnReason#POTION_EFFECT 812761660 Increase outdated build delay bed1e3ff6 SPIGOT-7827: Sync EntityPortalEvent with PlayerPortalEvent since non-players can now create portals 2444c8b23 SPIGOT-7823: Suspicious sand and gravel material are not marked as having gravity correctly aceddcd0b SPIGOT-7820: Enum changes - duplicate method name a0d2d6a84 SPIGOT-7813: Material#isInteractable() always returns false 8fd64b091 SPIGOT-7806: Handle both loot and inventory item drop behaviour in PlayerDeathEvent a4ee40b74 SPIGOT-7799, PR-1436: Expose explosion world interaction in EntityExplodeEvent and BlockExplodeEvent 082aa51c5 PR-1424: Trial changing a small number of inner enums to classes/interfaces to better support custom values 66e78a96b SPIGOT-7815: Consider EntityDamageEvent status for Wolf armor damage Spigot Changes: 5bbef5ad SPIGOT-7834: Modify max value for generic.max_absorption
This commit is contained in:
parent
a507e91bb3
commit
30285e7121
26 changed files with 255 additions and 93 deletions
|
@ -219,6 +219,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
* Custom boss bars.
|
||||
*
|
||||
@@ -0,0 +0,0 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||
*
|
||||
* @see Cat.Type
|
||||
*/
|
||||
- Registry<Cat.Type> CAT_VARIANT = Objects.requireNonNull(Bukkit.getRegistry(Cat.Type.class), "No registry present for Cat Type. This is a bug.");
|
||||
+ Registry<Cat.Type> CAT_VARIANT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.CAT_VARIANT); // Paper
|
||||
/**
|
||||
* Server enchantments.
|
||||
*
|
||||
* @see Enchantment
|
||||
|
@ -317,7 +323,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
/**
|
||||
* Villager profession.
|
||||
*
|
||||
* @see Villager.Profession
|
||||
*/
|
||||
- Registry<Villager.Profession> VILLAGER_PROFESSION = Objects.requireNonNull(Bukkit.getRegistry(Villager.Profession.class), "No registry present for Villager Profession. This is a bug.");
|
||||
+ Registry<Villager.Profession> VILLAGER_PROFESSION = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.VILLAGER_PROFESSION); // Paper
|
||||
/**
|
||||
* Villager type.
|
||||
*
|
||||
* @see Villager.Type
|
||||
*/
|
||||
- Registry<Villager.Type> VILLAGER_TYPE = Objects.requireNonNull(Bukkit.getRegistry(Villager.Type.class), "No registry present for Villager Type. This is a bug.");
|
||||
+ Registry<Villager.Type> VILLAGER_TYPE = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.VILLAGER_TYPE); // Paper
|
||||
/**
|
||||
* Memory Keys.
|
||||
*
|
||||
@@ -0,0 +0,0 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||
*
|
||||
* @see Frog.Variant
|
||||
*/
|
||||
- Registry<Frog.Variant> FROG_VARIANT = Objects.requireNonNull(Bukkit.getRegistry(Frog.Variant.class), "No registry present for Frog Variant. This is a bug.");
|
||||
+ Registry<Frog.Variant> FROG_VARIANT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.FROG_VARIANT); // Paper
|
||||
/**
|
||||
* Wolf variants.
|
||||
*
|
||||
* @see Wolf.Variant
|
||||
|
@ -329,7 +355,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
/**
|
||||
* Map cursor types.
|
||||
*
|
||||
@@ -0,0 +0,0 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||
* @see MapCursor.Type
|
||||
*/
|
||||
- Registry<MapCursor.Type> MAP_DECORATION_TYPE = Objects.requireNonNull(Bukkit.getRegistry(MapCursor.Type.class), "No registry present for MapCursor Type. This is a bug.");
|
||||
+ Registry<MapCursor.Type> MAP_DECORATION_TYPE = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.MAP_DECORATION_TYPE); // Paper
|
||||
/**
|
||||
* Game events.
|
||||
*
|
||||
* @see GameEvent
|
||||
*/
|
||||
|
|
|
@ -427,20 +427,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
* Represents the various different Villager professions there may be.
|
||||
* Villagers have different trading options depending on their profession,
|
||||
*/
|
||||
- public enum Profession implements Keyed {
|
||||
+ public enum Profession implements Keyed, net.kyori.adventure.translation.Translatable { // Paper
|
||||
NONE,
|
||||
- interface Profession extends OldEnum<Profession>, Keyed {
|
||||
+ interface Profession extends OldEnum<Profession>, Keyed, net.kyori.adventure.translation.Translatable {
|
||||
|
||||
Profession NONE = getProfession("none");
|
||||
/**
|
||||
* Armorer profession. Wears a black apron. Armorers primarily trade for
|
||||
@@ -0,0 +0,0 @@ public interface Villager extends AbstractVillager {
|
||||
public NamespacedKey getKey() {
|
||||
return key;
|
||||
static Profession[] values() {
|
||||
return Lists.newArrayList(Registry.VILLAGER_PROFESSION).toArray(new Profession[0]);
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public @NotNull String translationKey() {
|
||||
+ return "entity.minecraft.villager." + this.key.getKey();
|
||||
+ default @NotNull String translationKey() {
|
||||
+ return "entity.minecraft.villager." + this.getKey().getKey();
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
|
|
@ -113,9 +113,9 @@ diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/b
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Villager.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Villager.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
@@ -0,0 +0,0 @@ package org.bukkit.entity;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.Locale;
|
||||
+import java.util.Map; // Paper
|
||||
+import java.util.UUID; // Paper
|
||||
|
@ -123,7 +123,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
import org.bukkit.Location;
|
||||
import org.bukkit.NamespacedKey;
|
||||
@@ -0,0 +0,0 @@ public interface Villager extends AbstractVillager {
|
||||
return key;
|
||||
return Lists.newArrayList(Registry.VILLAGER_PROFESSION).toArray(new Profession[0]);
|
||||
}
|
||||
}
|
||||
+
|
||||
|
|
|
@ -200,29 +200,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/map/MapCursor.java
|
||||
+++ b/src/main/java/org/bukkit/map/MapCursor.java
|
||||
@@ -0,0 +0,0 @@ public final class MapCursor {
|
||||
BANNER_RED(24, "banner_red"),
|
||||
BANNER_BLACK(25, "banner_black"),
|
||||
RED_X(26, "red_x"),
|
||||
Type BANNER_RED = getType("banner_red");
|
||||
Type BANNER_BLACK = getType("banner_black");
|
||||
Type RED_X = getType("red_x");
|
||||
+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation
|
||||
+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation
|
||||
VILLAGE_DESERT(27, "village_desert"),
|
||||
Type VILLAGE_DESERT = getType("village_desert");
|
||||
+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation
|
||||
+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation
|
||||
VILLAGE_PLAINS(28, "village_plains"),
|
||||
Type VILLAGE_PLAINS = getType("village_plains");
|
||||
+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation
|
||||
+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation
|
||||
VILLAGE_SAVANNA(29, "village_savanna"),
|
||||
Type VILLAGE_SAVANNA = getType("village_savanna");
|
||||
+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation
|
||||
+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation
|
||||
VILLAGE_SNOWY(30, "village_snowy"),
|
||||
Type VILLAGE_SNOWY = getType("village_snowy");
|
||||
+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation
|
||||
+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation
|
||||
VILLAGE_TAIGA(31, "village_taiga"),
|
||||
Type VILLAGE_TAIGA = getType("village_taiga");
|
||||
+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation
|
||||
+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation
|
||||
JUNGLE_TEMPLE(32, "jungle_temple"),
|
||||
Type JUNGLE_TEMPLE = getType("jungle_temple");
|
||||
+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.TRADE_REBALANCE) // Paper - add missing annotation
|
||||
+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation
|
||||
SWAMP_HUT(33, "swamp_hut"),
|
||||
TRIAL_CHAMBERS(34, "trial_chambers")
|
||||
;
|
||||
Type SWAMP_HUT = getType("swamp_hut");
|
||||
Type TRIAL_CHAMBERS = getType("trial_chambers");
|
||||
|
||||
|
|
|
@ -1836,7 +1836,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- @Deprecated
|
||||
+ @org.jetbrains.annotations.ApiStatus.Internal // Paper
|
||||
public byte getRawType() {
|
||||
return type.value;
|
||||
return type.getValue();
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public final class MapCursor {
|
||||
* Set the type of this cursor.
|
||||
|
@ -1859,9 +1859,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
*/
|
||||
- @Deprecated
|
||||
+ @org.jetbrains.annotations.ApiStatus.Internal // Paper
|
||||
public byte getValue() {
|
||||
return value;
|
||||
}
|
||||
byte getValue();
|
||||
|
||||
/**
|
||||
@@ -0,0 +0,0 @@ public final class MapCursor {
|
||||
*
|
||||
* @param value the value
|
||||
|
@ -1872,7 +1872,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- @Deprecated
|
||||
+ @org.jetbrains.annotations.ApiStatus.Internal // Paper
|
||||
@Nullable
|
||||
public static Type byValue(byte value) {
|
||||
static Type byValue(byte value) {
|
||||
for (Type t : values()) {
|
||||
diff --git a/src/main/java/org/bukkit/map/MapPalette.java b/src/main/java/org/bukkit/map/MapPalette.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
|
|
|
@ -612,13 +612,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+++ b/src/main/java/org/bukkit/entity/Villager.java
|
||||
@@ -0,0 +0,0 @@ public interface Villager extends AbstractVillager {
|
||||
*/
|
||||
NITWIT,
|
||||
Profession NITWIT = getProfession("nitwit");
|
||||
/**
|
||||
- * Sheperd profession. Wears a brown robe. Shepherds primarily trade for
|
||||
+ * Shepherd profession. Wears a brown robe. Shepherds primarily trade for
|
||||
* wool items, and shears.
|
||||
*/
|
||||
SHEPHERD,
|
||||
Profession SHEPHERD = getProfession("shepherd");
|
||||
diff --git a/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java b/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java
|
||||
|
@ -660,14 +660,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
*/
|
||||
public class BlockExplodeEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@@ -0,0 +0,0 @@ public class BlockExplodeEvent extends BlockEvent implements Cancellable {
|
||||
this.cancel = false;
|
||||
}
|
||||
|
||||
+ @io.papermc.paper.annotation.DoNotUse // Paper
|
||||
@Deprecated(forRemoval = true)
|
||||
public BlockExplodeEvent(@NotNull final Block what, @NotNull final List<Block> blocks, final float yield) {
|
||||
this(what, what.getState(), blocks, yield);
|
||||
diff --git a/src/main/java/org/bukkit/event/block/BlockPistonRetractEvent.java b/src/main/java/org/bukkit/event/block/BlockPistonRetractEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/block/BlockPistonRetractEvent.java
|
||||
|
|
|
@ -44,5 +44,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ OMINOUS_ITEM_SPAWNER,
|
||||
+ // Paper end - Fixes and additions to the SpawnReason API
|
||||
/**
|
||||
* When a creature is spawned by plugins
|
||||
*/
|
||||
* When a creature is spawned by a potion effect, for example:
|
||||
* {@link org.bukkit.potion.PotionType#OOZING}, {@link org.bukkit.potion.PotionType#INFESTED}
|
||||
|
|
|
@ -87,10 +87,18 @@ diff --git a/src/main/java/org/bukkit/event/entity/EntityPortalEvent.java b/src/
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityPortalEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityPortalEvent.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class EntityPortalEvent extends EntityTeleportEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@@ -0,0 +0,0 @@ package org.bukkit.event.entity;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -0,0 +0,0 @@ public class EntityPortalEvent extends EntityTeleportEvent {
|
||||
private int searchRadius = 128;
|
||||
private boolean canCreatePortal = true;
|
||||
private int creationRadius = 16;
|
||||
+ private final org.bukkit.PortalType type; // Paper
|
||||
|
||||
public EntityPortalEvent(@NotNull final Entity entity, @NotNull final Location from, @Nullable final Location to) {
|
||||
|
@ -102,15 +110,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
super(entity, from, to);
|
||||
this.searchRadius = searchRadius;
|
||||
+ this.type = org.bukkit.PortalType.CUSTOM; // Paper
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
public EntityPortalEvent(@NotNull Entity entity, @NotNull Location from, @Nullable Location to, int searchRadius, boolean canCreatePortal, int creationRadius) {
|
||||
+ // Paper start
|
||||
+ public EntityPortalEvent(@NotNull Entity entity, @NotNull Location from, @Nullable Location to, int searchRadius, final @NotNull org.bukkit.PortalType portalType) {
|
||||
+ super(entity, from, to);
|
||||
+ this.searchRadius = searchRadius;
|
||||
+ this.type = portalType;
|
||||
+ this(entity, from, to, searchRadius, canCreatePortal, creationRadius, org.bukkit.PortalType.CUSTOM);
|
||||
+ }
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityPortalEvent(@NotNull Entity entity, @NotNull Location from, @Nullable Location to, int searchRadius, boolean canCreatePortal, int creationRadius, final @NotNull org.bukkit.PortalType portalType) {
|
||||
super(entity, from, to);
|
||||
+ this.type = portalType;
|
||||
+ // Paper end
|
||||
this.searchRadius = searchRadius;
|
||||
this.canCreatePortal = canCreatePortal;
|
||||
this.creationRadius = creationRadius;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Get the portal type relating to this event.
|
||||
+ *
|
||||
|
@ -142,11 +159,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ @Override
|
||||
+ public void setTo(@Nullable final Location to) {
|
||||
+ super.setTo(to);
|
||||
}
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
+
|
||||
/**
|
||||
* Set the Block radius to search in for available portals.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java b/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java
|
||||
|
|
|
@ -262,7 +262,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/entity/Cat.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Cat.java
|
||||
@@ -0,0 +0,0 @@ public interface Cat extends Tameable, Sittable {
|
||||
return key;
|
||||
return Lists.newArrayList(Registry.CAT_VARIANT).toArray(new Type[0]);
|
||||
}
|
||||
}
|
||||
+
|
||||
|
|
|
@ -41,6 +41,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import org.bukkit.craftbukkit.block.CraftBlockType;
|
||||
+import org.bukkit.craftbukkit.damage.CraftDamageType;
|
||||
+import org.bukkit.craftbukkit.enchantments.CraftEnchantment;
|
||||
+import org.bukkit.craftbukkit.entity.CraftCat;
|
||||
+import org.bukkit.craftbukkit.entity.CraftFrog;
|
||||
+import org.bukkit.craftbukkit.entity.CraftVillager;
|
||||
+import org.bukkit.craftbukkit.entity.CraftWolf;
|
||||
+import org.bukkit.craftbukkit.generator.structure.CraftStructure;
|
||||
+import org.bukkit.craftbukkit.generator.structure.CraftStructureType;
|
||||
|
@ -48,15 +51,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import org.bukkit.craftbukkit.inventory.trim.CraftTrimMaterial;
|
||||
+import org.bukkit.craftbukkit.inventory.trim.CraftTrimPattern;
|
||||
+import org.bukkit.craftbukkit.legacy.FieldRename;
|
||||
+import org.bukkit.craftbukkit.map.CraftMapCursor;
|
||||
+import org.bukkit.craftbukkit.potion.CraftPotionEffectType;
|
||||
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
+import org.bukkit.damage.DamageType;
|
||||
+import org.bukkit.entity.Cat;
|
||||
+import org.bukkit.entity.Frog;
|
||||
+import org.bukkit.entity.Villager;
|
||||
+import org.bukkit.entity.Wolf;
|
||||
+import org.bukkit.entity.memory.MemoryKey;
|
||||
+import org.bukkit.generator.structure.StructureType;
|
||||
+import org.bukkit.inventory.ItemType;
|
||||
+import org.bukkit.inventory.meta.trim.TrimMaterial;
|
||||
+import org.bukkit.inventory.meta.trim.TrimPattern;
|
||||
+import org.bukkit.map.MapCursor;
|
||||
+import org.bukkit.potion.PotionEffectType;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
@ -80,6 +88,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ entry(Registries.STRUCTURE_TYPE, RegistryKey.STRUCTURE_TYPE, StructureType.class, CraftStructureType::new),
|
||||
+ entry(Registries.BLOCK, RegistryKey.BLOCK, BlockType.class, CraftBlockType::new),
|
||||
+ entry(Registries.ITEM, RegistryKey.ITEM, ItemType.class, CraftItemType::new),
|
||||
+ entry(Registries.CAT_VARIANT, RegistryKey.CAT_VARIANT, Cat.Type.class, CraftCat.CraftType::new),
|
||||
+ entry(Registries.FROG_VARIANT, RegistryKey.FROG_VARIANT, Frog.Variant.class, CraftFrog.CraftVariant::new),
|
||||
+ entry(Registries.VILLAGER_PROFESSION, RegistryKey.VILLAGER_PROFESSION, Villager.Profession.class, CraftVillager.CraftProfession::new),
|
||||
+ entry(Registries.VILLAGER_TYPE, RegistryKey.VILLAGER_TYPE, Villager.Type.class, CraftVillager.CraftType::new),
|
||||
+ entry(Registries.MAP_DECORATION_TYPE, RegistryKey.MAP_DECORATION_TYPE, MapCursor.Type.class, CraftMapCursor.CraftType::new),
|
||||
+
|
||||
+ // data-drivens
|
||||
+ entry(Registries.STRUCTURE, RegistryKey.STRUCTURE, Structure.class, CraftStructure::new).delayed(),
|
||||
|
@ -95,17 +108,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ apiOnly(Registries.PAINTING_VARIANT, RegistryKey.PAINTING_VARIANT, () -> org.bukkit.Registry.ART),
|
||||
+ apiOnly(Registries.ATTRIBUTE, RegistryKey.ATTRIBUTE, () -> org.bukkit.Registry.ATTRIBUTE),
|
||||
+ apiOnly(Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN, () -> org.bukkit.Registry.BANNER_PATTERN),
|
||||
+ apiOnly(Registries.CAT_VARIANT, RegistryKey.CAT_VARIANT, () -> org.bukkit.Registry.CAT_VARIANT),
|
||||
+ apiOnly(Registries.ENTITY_TYPE, RegistryKey.ENTITY_TYPE, () -> org.bukkit.Registry.ENTITY_TYPE),
|
||||
+ apiOnly(Registries.PARTICLE_TYPE, RegistryKey.PARTICLE_TYPE, () -> org.bukkit.Registry.PARTICLE_TYPE),
|
||||
+ apiOnly(Registries.POTION, RegistryKey.POTION, () -> org.bukkit.Registry.POTION),
|
||||
+ apiOnly(Registries.SOUND_EVENT, RegistryKey.SOUND_EVENT, () -> org.bukkit.Registry.SOUNDS),
|
||||
+ apiOnly(Registries.VILLAGER_PROFESSION, RegistryKey.VILLAGER_PROFESSION, () -> org.bukkit.Registry.VILLAGER_PROFESSION),
|
||||
+ apiOnly(Registries.VILLAGER_TYPE, RegistryKey.VILLAGER_TYPE, () -> org.bukkit.Registry.VILLAGER_TYPE),
|
||||
+ apiOnly(Registries.MEMORY_MODULE_TYPE, RegistryKey.MEMORY_MODULE_TYPE, () -> (org.bukkit.Registry<MemoryKey<?>>) (org.bukkit.Registry) org.bukkit.Registry.MEMORY_MODULE_TYPE),
|
||||
+ apiOnly(Registries.FLUID, RegistryKey.FLUID, () -> org.bukkit.Registry.FLUID),
|
||||
+ apiOnly(Registries.FROG_VARIANT, RegistryKey.FROG_VARIANT, () -> org.bukkit.Registry.FROG_VARIANT),
|
||||
+ apiOnly(Registries.MAP_DECORATION_TYPE, RegistryKey.MAP_DECORATION_TYPE, () -> org.bukkit.Registry.MAP_DECORATION_TYPE)
|
||||
+ apiOnly(Registries.FLUID, RegistryKey.FLUID, () -> org.bukkit.Registry.FLUID)
|
||||
+ );
|
||||
+ final Map<RegistryKey<?>, RegistryEntry<?, ?>> byRegistryKey = new IdentityHashMap<>(REGISTRY_ENTRIES.size());
|
||||
+ final Map<ResourceKey<?>, RegistryEntry<?, ?>> byResourceKey = new IdentityHashMap<>(REGISTRY_ENTRIES.size());
|
||||
|
@ -750,7 +758,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- return new CraftRegistry<>(Structure.class, registryHolder.registryOrThrow(Registries.STRUCTURE), CraftStructure::new, FieldRename.NONE);
|
||||
- }
|
||||
- if (bukkitClass == StructureType.class) {
|
||||
- return new CraftRegistry<>(StructureType.class, BuiltInRegistries.STRUCTURE_TYPE, CraftStructureType::new, FieldRename.NONE);
|
||||
- return new CraftRegistry<>(StructureType.class, registryHolder.registryOrThrow(Registries.STRUCTURE_TYPE), CraftStructureType::new, FieldRename.NONE);
|
||||
- }
|
||||
- if (bukkitClass == Villager.Type.class) {
|
||||
- return new CraftRegistry<>(Villager.Type.class, registryHolder.registryOrThrow(Registries.VILLAGER_TYPE), CraftVillager.CraftType::new, FieldRename.NONE);
|
||||
- }
|
||||
- if (bukkitClass == Villager.Profession.class) {
|
||||
- return new CraftRegistry<>(Villager.Profession.class, registryHolder.registryOrThrow(Registries.VILLAGER_PROFESSION), CraftVillager.CraftProfession::new, FieldRename.NONE);
|
||||
- }
|
||||
- if (bukkitClass == TrimMaterial.class) {
|
||||
- return new CraftRegistry<>(TrimMaterial.class, registryHolder.registryOrThrow(Registries.TRIM_MATERIAL), CraftTrimMaterial::new, FieldRename.NONE);
|
||||
|
@ -773,6 +787,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- if (bukkitClass == ItemType.class) {
|
||||
- return new CraftRegistry<>(ItemType.class, registryHolder.registryOrThrow(Registries.ITEM), CraftItemType::new, FieldRename.NONE);
|
||||
- }
|
||||
- if (bukkitClass == Frog.Variant.class) {
|
||||
- return new CraftRegistry<>(Frog.Variant.class, registryHolder.registryOrThrow(Registries.FROG_VARIANT), CraftFrog.CraftVariant::new, FieldRename.NONE);
|
||||
- }
|
||||
- if (bukkitClass == Cat.Type.class) {
|
||||
- return new CraftRegistry<>(Cat.Type.class, registryHolder.registryOrThrow(Registries.CAT_VARIANT), CraftCat.CraftType::new, FieldRename.NONE);
|
||||
- }
|
||||
- if (bukkitClass == MapCursor.Type.class) {
|
||||
- return new CraftRegistry<>(MapCursor.Type.class, registryHolder.registryOrThrow(Registries.MAP_DECORATION_TYPE), CraftMapCursor.CraftType::new, FieldRename.NONE);
|
||||
- }
|
||||
-
|
||||
- return null;
|
||||
- }
|
||||
|
@ -829,6 +852,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
private YamlConfiguration commandsConfiguration;
|
||||
private final Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions()));
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
private void loadCompatibilities() {
|
||||
+ if (true) return; // Paper - Big nope
|
||||
ConfigurationSection compatibilities = this.configuration.getConfigurationSection("settings.compatibility");
|
||||
if (compatibilities == null) {
|
||||
this.activeCompatibilities = Collections.emptySet();
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public <T extends Keyed> Registry<T> getRegistry(Class<T> aClass) {
|
||||
|
@ -842,7 +873,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java
|
||||
@@ -0,0 +0,0 @@ public class FieldRename {
|
||||
return Enum.valueOf(enumClass, FieldRename.rename(apiVersion, enumClass.getName().replace('.', '/'), name));
|
||||
};
|
||||
}
|
||||
|
||||
- @RequireCompatibility("allow-old-keys-in-registry")
|
||||
|
@ -852,15 +883,56 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- }
|
||||
+ // Paper start - absolutely not, having this as an expectation for plugin developers opens a huge
|
||||
+ // can of worms in the future, especially if mojang comes back and reuses some old key
|
||||
+ // @RequireCompatibility("allow-old-keys-in-registry")
|
||||
+ // public static <T extends Keyed> T get(Registry<T> registry, NamespacedKey namespacedKey) {
|
||||
+ //@RequireCompatibility("allow-old-keys-in-registry")
|
||||
+ //public static <T extends Keyed> T get(Registry<T> registry, NamespacedKey namespacedKey) {
|
||||
+ // // We don't have version-specific changes, so just use current, and don't inject a version
|
||||
+ // return CraftRegistry.get(registry, namespacedKey, ApiVersion.CURRENT);
|
||||
+ // }
|
||||
+ //}
|
||||
+ // Paper end
|
||||
|
||||
// PatternType
|
||||
private static final FieldRenameData PATTERN_TYPE_DATA = FieldRenameData.Builder.newBuilder()
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
@@ -0,0 +0,0 @@ public class Commodore {
|
||||
|
||||
public static byte[] convert(byte[] b, final String pluginName, final ApiVersion pluginVersion, final Set<String> activeCompatibilities) {
|
||||
final boolean modern = pluginVersion.isNewerThanOrSameAs(ApiVersion.FLATTENING);
|
||||
- final boolean enumCompatibility = pluginVersion.isOlderThanOrSameAs(ApiVersion.getOrCreateVersion("1.20.6")) && activeCompatibilities.contains("enum-compatibility-mode");
|
||||
ClassReader cr = new ClassReader(b);
|
||||
ClassWriter cw = new ClassWriter(0); // TODO 2024-06-22: Open PR to ASM to included interface in handle hash
|
||||
|
||||
- List<String> methodEnumSignatures = Commodore.getMethodSignatures(b);
|
||||
- Multimap<String, String> enumLessToEnum = HashMultimap.create();
|
||||
- for (String method : methodEnumSignatures) {
|
||||
- enumLessToEnum.put(method.replace("Ljava/lang/Enum;", "Ljava/lang/Object;"), method);
|
||||
- }
|
||||
-
|
||||
ClassVisitor visitor = cw;
|
||||
- if (enumCompatibility) {
|
||||
- visitor = new LimitedClassRemapper(cw, new SimpleRemapper(Commodore.ENUM_RENAMES));
|
||||
- }
|
||||
|
||||
cr.accept(new ClassRemapper(new ClassVisitor(Opcodes.ASM9, io.papermc.paper.pluginremap.reflect.ReflectionRemapper.visitor(visitor)) { // Paper
|
||||
final Set<RerouteMethodData> rerouteMethodData = new HashSet<>();
|
||||
@@ -0,0 +0,0 @@ public class Commodore {
|
||||
|
||||
@Override
|
||||
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
|
||||
- if (enumCompatibility && (access & Opcodes.ACC_SYNTHETIC) != 0 && (access & Opcodes.ACC_BRIDGE) != 0 && desc.contains("Ljava/lang/Object;")) {
|
||||
- // SPIGOT-7820: Do not use object method if enum method is present
|
||||
- // The object method does only redirect to the enum method
|
||||
- Collection<String> result = enumLessToEnum.get(desc.replace("Ljava/lang/Enum;", "Ljava/lang/Object;") + " " + name);
|
||||
- if (result.size() == 2) {
|
||||
- name = name + "_BUKKIT_UNUSED";
|
||||
- }
|
||||
- }
|
||||
-
|
||||
return new MethodVisitor(this.api, super.visitMethod(access, name, desc, signature, exceptions)) {
|
||||
// Paper start - Plugin rewrites
|
||||
@Override
|
||||
diff --git a/src/main/resources/META-INF/services/io.papermc.paper.registry.RegistryAccess b/src/main/resources/META-INF/services/io.papermc.paper.registry.RegistryAccess
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
|
@ -878,6 +950,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
use-map-color-cache: true
|
||||
- compatibility:
|
||||
- allow-old-keys-in-registry: false
|
||||
- enum-compatibility-mode: false
|
||||
spawn-limits:
|
||||
monsters: 70
|
||||
animals: 10
|
||||
|
@ -1106,6 +1179,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- register(PotionEffectType.class, Registries.MOB_EFFECT, CraftPotionEffectType.class, MobEffect.class);
|
||||
- register(Structure.class, Registries.STRUCTURE, CraftStructure.class, net.minecraft.world.level.levelgen.structure.Structure.class);
|
||||
- register(StructureType.class, Registries.STRUCTURE_TYPE, CraftStructureType.class, net.minecraft.world.level.levelgen.structure.StructureType.class);
|
||||
- register(Villager.Type.class, Registries.VILLAGER_TYPE, CraftVillager.CraftType.class, VillagerType.class);
|
||||
- register(Villager.Profession.class, Registries.VILLAGER_PROFESSION, CraftVillager.CraftProfession.class, VillagerProfession.class);
|
||||
- register(TrimMaterial.class, Registries.TRIM_MATERIAL, CraftTrimMaterial.class, net.minecraft.world.item.armortrim.TrimMaterial.class);
|
||||
- register(TrimPattern.class, Registries.TRIM_PATTERN, CraftTrimPattern.class, net.minecraft.world.item.armortrim.TrimPattern.class);
|
||||
- register(DamageType.class, Registries.DAMAGE_TYPE, CraftDamageType.class, net.minecraft.world.damagesource.DamageType.class);
|
||||
|
@ -1113,6 +1188,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- register(Wolf.Variant.class, Registries.WOLF_VARIANT, CraftWolf.CraftVariant.class, WolfVariant.class);
|
||||
- register(ItemType.class, Registries.ITEM, CraftItemType.class, net.minecraft.world.item.Item.class, true);
|
||||
- register(BlockType.class, Registries.BLOCK, CraftBlockType.class, net.minecraft.world.level.block.Block.class, true);
|
||||
- register(Frog.Variant.class, Registries.FROG_VARIANT, CraftFrog.CraftVariant.class, FrogVariant.class);
|
||||
- register(Cat.Type.class, Registries.CAT_VARIANT, CraftCat.CraftType.class, CatVariant.class);
|
||||
- register(MapCursor.Type.class, Registries.MAP_DECORATION_TYPE, CraftMapCursor.CraftType.class, MapDecorationType.class);
|
||||
+ // Order: RegistryKey, Bukkit class, Minecraft Registry key, CraftBukkit class, Minecraft class
|
||||
+ register(RegistryKey.ENCHANTMENT, Enchantment.class, Registries.ENCHANTMENT, CraftEnchantment.class, net.minecraft.world.item.enchantment.Enchantment.class);
|
||||
+ register(RegistryKey.GAME_EVENT, GameEvent.class, Registries.GAME_EVENT, CraftGameEvent.class, net.minecraft.world.level.gameevent.GameEvent.class);
|
||||
|
@ -1120,6 +1198,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ register(RegistryKey.MOB_EFFECT, PotionEffectType.class, Registries.MOB_EFFECT, CraftPotionEffectType.class, MobEffect.class);
|
||||
+ register(RegistryKey.STRUCTURE, Structure.class, Registries.STRUCTURE, CraftStructure.class, net.minecraft.world.level.levelgen.structure.Structure.class);
|
||||
+ register(RegistryKey.STRUCTURE_TYPE, StructureType.class, Registries.STRUCTURE_TYPE, CraftStructureType.class, net.minecraft.world.level.levelgen.structure.StructureType.class);
|
||||
+ register(RegistryKey.VILLAGER_TYPE, Villager.Type.class, Registries.VILLAGER_TYPE, CraftVillager.CraftType.class, VillagerType.class);
|
||||
+ register(RegistryKey.VILLAGER_PROFESSION, Villager.Profession.class, Registries.VILLAGER_PROFESSION, CraftVillager.CraftProfession.class, VillagerProfession.class);
|
||||
+ register(RegistryKey.TRIM_MATERIAL, TrimMaterial.class, Registries.TRIM_MATERIAL, CraftTrimMaterial.class, net.minecraft.world.item.armortrim.TrimMaterial.class);
|
||||
+ register(RegistryKey.TRIM_PATTERN, TrimPattern.class, Registries.TRIM_PATTERN, CraftTrimPattern.class, net.minecraft.world.item.armortrim.TrimPattern.class);
|
||||
+ register(RegistryKey.DAMAGE_TYPE, DamageType.class, Registries.DAMAGE_TYPE, CraftDamageType.class, net.minecraft.world.damagesource.DamageType.class);
|
||||
|
@ -1127,6 +1207,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ register(RegistryKey.WOLF_VARIANT, Wolf.Variant.class, Registries.WOLF_VARIANT, CraftWolf.CraftVariant.class, WolfVariant.class);
|
||||
+ register(RegistryKey.ITEM, ItemType.class, Registries.ITEM, CraftItemType.class, net.minecraft.world.item.Item.class, true);
|
||||
+ register(RegistryKey.BLOCK, BlockType.class, Registries.BLOCK, CraftBlockType.class, net.minecraft.world.level.block.Block.class, true);
|
||||
+ register(RegistryKey.FROG_VARIANT, Frog.Variant.class, Registries.FROG_VARIANT, CraftFrog.CraftVariant.class, FrogVariant.class);
|
||||
+ register(RegistryKey.CAT_VARIANT, Cat.Type.class, Registries.CAT_VARIANT, CraftCat.CraftType.class, CatVariant.class);
|
||||
+ register(RegistryKey.MAP_DECORATION_TYPE, MapCursor.Type.class, Registries.MAP_DECORATION_TYPE, CraftMapCursor.CraftType.class, MapDecorationType.class);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
case "org/bukkit/enchantments/Enchantment" -> FieldRename.convertEnchantmentName(apiVersion, from);
|
||||
case "org/bukkit/block/Biome" -> FieldRename.convertBiomeName(apiVersion, from);
|
||||
@@ -0,0 +0,0 @@ public class FieldRename {
|
||||
// }
|
||||
//}
|
||||
// Paper end
|
||||
|
||||
+ // Paper start - DisplaySlot
|
||||
|
|
|
@ -75,7 +75,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
public CraftVillager(CraftServer server, net.minecraft.world.entity.npc.Villager entity) {
|
||||
@@ -0,0 +0,0 @@ public class CraftVillager extends CraftAbstractVillager implements Villager {
|
||||
.getOptional(CraftNamespacedKey.toMinecraft(bukkit.getKey())).orElseThrow();
|
||||
return this.getKey().hashCode();
|
||||
}
|
||||
}
|
||||
+
|
||||
|
|
|
@ -116,7 +116,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ if (isInternal(methodNode.invisibleAnnotations)) continue;
|
||||
+ // Paper end - filter out more methods from rerouting test
|
||||
|
||||
if (!Commodore.rerouteMethods(Collections.emptySet(), MaterialReroutingTest.MATERIAL_METHOD_REROUTE, (methodNode.access & Opcodes.ACC_STATIC) != 0, classNode.name, methodNode.name, methodNode.desc, a -> { })) {
|
||||
if (!Commodore.rerouteMethods(Collections.emptySet(), ApiVersion.CURRENT, MaterialReroutingTest.MATERIAL_METHOD_REROUTE, (methodNode.access & Opcodes.ACC_STATIC) != 0, classNode.name, methodNode.name, methodNode.desc, a -> { })) {
|
||||
missingReroute.add(methodNode.name + " " + methodNode.desc + " " + methodNode.signature);
|
||||
@@ -0,0 +0,0 @@ public class MaterialReroutingTest extends AbstractTestingBase {
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ Date buildDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(Main.class.getPackage().getImplementationVendor()); // Paper
|
||||
|
||||
Calendar deadline = Calendar.getInstance();
|
||||
deadline.add(Calendar.DAY_OF_YEAR, -7);
|
||||
deadline.add(Calendar.DAY_OF_YEAR, -14);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
|
|
|
@ -610,7 +610,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
public static boolean useConsole = true;
|
||||
|
||||
@@ -0,0 +0,0 @@ public class Main {
|
||||
deadline.add(Calendar.DAY_OF_YEAR, -7);
|
||||
deadline.add(Calendar.DAY_OF_YEAR, -14);
|
||||
if (buildDate.before(deadline.getTime())) {
|
||||
System.err.println("*** Error, this build is outdated ***");
|
||||
- System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***");
|
||||
|
|
|
@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -0,0 +0,0 @@ public class Main {
|
||||
Calendar deadline = Calendar.getInstance();
|
||||
deadline.add(Calendar.DAY_OF_YEAR, -7);
|
||||
deadline.add(Calendar.DAY_OF_YEAR, -14);
|
||||
if (buildDate.before(deadline.getTime())) {
|
||||
- System.err.println("*** Error, this build is outdated ***");
|
||||
+ // Paper start - This is some stupid bullshit
|
||||
|
|
|
@ -11,8 +11,8 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
@@ -0,0 +0,0 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -0,0 +0,0 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
+import java.util.HashMap;
|
||||
|
@ -28,8 +28,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
import joptsimple.OptionSet;
|
||||
import joptsimple.OptionSpec;
|
||||
@@ -0,0 +0,0 @@ public class Commodore {
|
||||
private static final Map<String, RerouteMethodData> MATERIAL_METHOD_REROUTE = Commodore.createReroutes(MaterialRerouting.class);
|
||||
private static final Map<String, RerouteMethodData> METHOD_REROUTE = Commodore.createReroutes(MethodRerouting.class);
|
||||
private static final Map<String, RerouteMethodData> ENUM_METHOD_REROUTE = Commodore.createReroutes(EnumEvil.class);
|
||||
|
||||
+ // Paper start - Plugin rewrites
|
||||
+ private static final Map<String, String> SEARCH_AND_REMOVE = initReplacementsMap();
|
||||
|
@ -69,8 +69,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
OptionParser parser = new OptionParser();
|
||||
OptionSpec<File> inputFlag = parser.acceptsAll(Arrays.asList("i", "input")).withRequiredArg().ofType(File.class).required();
|
||||
@@ -0,0 +0,0 @@ public class Commodore {
|
||||
@Override
|
||||
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
|
||||
}
|
||||
|
||||
return new MethodVisitor(this.api, super.visitMethod(access, name, desc, signature, exceptions)) {
|
||||
+ // Paper start - Plugin rewrites
|
||||
+ @Override
|
||||
|
|
|
@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity();
|
||||
Location enter = bukkitEntity.getLocation();
|
||||
|
||||
- EntityPortalEvent event = new EntityPortalEvent(bukkitEntity, enter, exit, searchRadius);
|
||||
- EntityPortalEvent event = new EntityPortalEvent(bukkitEntity, enter, exit, searchRadius, true, creationRadius);
|
||||
+ // Paper start
|
||||
+ final org.bukkit.PortalType portalType = switch (cause) {
|
||||
+ case END_PORTAL -> org.bukkit.PortalType.ENDER;
|
||||
|
@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ case END_GATEWAY -> org.bukkit.PortalType.END_GATEWAY; // not actually used yet
|
||||
+ default -> org.bukkit.PortalType.CUSTOM;
|
||||
+ };
|
||||
+ EntityPortalEvent event = new EntityPortalEvent(bukkitEntity, enter, exit, searchRadius, portalType);
|
||||
+ EntityPortalEvent event = new EntityPortalEvent(bukkitEntity, enter, exit, searchRadius, true, creationRadius, portalType);
|
||||
+ // Paper end
|
||||
event.getEntity().getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled() || event.getTo() == null || event.getTo().getWorld() == null || !entity.isAlive()) {
|
||||
|
|
|
@ -6168,7 +6168,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.material.MaterialData;
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
@DelegateDeserialization(ItemStack.class)
|
||||
public final class CraftItemStack extends ItemStack {
|
||||
|
||||
|
|
|
@ -522,7 +522,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
|
||||
@@ -0,0 +0,0 @@ public class CraftCat extends CraftTameableAnimal implements Cat {
|
||||
+ ", this can happen if a plugin creates its own cat variant with out properly registering it.");
|
||||
return this.getKey().hashCode();
|
||||
}
|
||||
}
|
||||
+
|
||||
|
|
|
@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.material.MaterialData;
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
@DelegateDeserialization(ItemStack.class)
|
||||
public final class CraftItemStack extends ItemStack {
|
||||
|
||||
|
|
|
@ -653,7 +653,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
@@ -0,0 +0,0 @@ public class Commodore {
|
||||
private static final Map<String, RerouteMethodData> METHOD_REROUTE = Commodore.createReroutes(MethodRerouting.class);
|
||||
private static final Map<String, RerouteMethodData> ENUM_METHOD_REROUTE = Commodore.createReroutes(EnumEvil.class);
|
||||
|
||||
// Paper start - Plugin rewrites
|
||||
- private static final Map<String, String> SEARCH_AND_REMOVE = initReplacementsMap();
|
||||
|
@ -701,11 +701,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
// Paper end - Plugin rewrites
|
||||
|
||||
@@ -0,0 +0,0 @@ public class Commodore {
|
||||
ClassReader cr = new ClassReader(b);
|
||||
ClassWriter cw = new ClassWriter(cr, 0);
|
||||
visitor = new LimitedClassRemapper(cw, new SimpleRemapper(Commodore.ENUM_RENAMES));
|
||||
}
|
||||
|
||||
- cr.accept(new ClassRemapper(new ClassVisitor(Opcodes.ASM9, cw) {
|
||||
+ cr.accept(new ClassRemapper(new ClassVisitor(Opcodes.ASM9, io.papermc.paper.pluginremap.reflect.ReflectionRemapper.visitor(cw)) { // Paper
|
||||
- cr.accept(new ClassRemapper(new ClassVisitor(Opcodes.ASM9, visitor) {
|
||||
+ cr.accept(new ClassRemapper(new ClassVisitor(Opcodes.ASM9, io.papermc.paper.pluginremap.reflect.ReflectionRemapper.visitor(visitor)) { // Paper
|
||||
final Set<RerouteMethodData> rerouteMethodData = new HashSet<>();
|
||||
String className;
|
||||
boolean isInterface;
|
||||
|
|
|
@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
if (!keepInventory) {
|
||||
for (ItemStack item : this.getInventory().getContents()) {
|
||||
if (!item.isEmpty() && !EnchantmentHelper.has(item, EnchantmentEffectComponents.PREVENT_EQUIPMENT_DROP)) {
|
||||
- loot.add(CraftItemStack.asCraftMirror(item));
|
||||
- loot.add(CraftItemStack.asCraftMirror(item).markForInventoryDrop());
|
||||
+ loot.add(new DefaultDrop(item, stack -> this.drop(stack, true, false, false))); // Paper - Restore vanilla drops behavior; drop function taken from Inventory#dropAll (don't fire drop event)
|
||||
}
|
||||
}
|
||||
|
@ -225,8 +225,46 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper end - Restore vanilla drops behavior
|
||||
if (stack == null || stack.getType() == Material.AIR) continue;
|
||||
|
||||
- victim.drop(CraftItemStack.asNMSCopy(stack), true, false, false); // SPIGOT-7800, SPIGOT-7801: Vanilla Behaviour for dropped items
|
||||
- if (stack instanceof CraftItemStack craftItemStack && craftItemStack.isForInventoryDrop()) {
|
||||
- victim.drop(CraftItemStack.asNMSCopy(stack), true, false, false); // SPIGOT-7800, SPIGOT-7801: Vanilla Behaviour for Player Inventory dropped items
|
||||
- } else {
|
||||
- victim.forceDrops = true;
|
||||
- victim.spawnAtLocation(CraftItemStack.asNMSCopy(stack)); // SPIGOT-7806: Vanilla Behaviour for items not related to Player Inventory dropped items
|
||||
- victim.forceDrops = false;
|
||||
- }
|
||||
+ drop.runConsumer(entity.getWorld(), entity.getLocation()); // Paper - Restore vanilla drops behavior
|
||||
}
|
||||
|
||||
return event;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftItemStack extends ItemStack {
|
||||
this.setItemMeta(itemMeta);
|
||||
}
|
||||
|
||||
- /**
|
||||
- * Gets if the item is marked as an inventory drop in death events.
|
||||
- *
|
||||
- * @return true if the item is marked as an inventory drop
|
||||
- */
|
||||
- @ApiStatus.Internal
|
||||
- public boolean isForInventoryDrop() {
|
||||
- return this.isForInventoryDrop;
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Marks this item as an inventory drop in death events.
|
||||
- *
|
||||
- * @return the ItemStack marked as an inventory drop
|
||||
- */
|
||||
- @ApiStatus.Internal
|
||||
- public ItemStack markForInventoryDrop() {
|
||||
- this.isForInventoryDrop = true;
|
||||
- return this;
|
||||
- }
|
||||
-
|
||||
@Override
|
||||
public MaterialData getData() {
|
||||
return this.handle != null ? CraftMagicNumbers.getMaterialData(this.handle.getItem()) : super.getData();
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e86f4dc4bb897d2ad627763e46c9ed08b090f0f3
|
||||
Subproject commit 3a3bea52057e094e4060239ad8a5ce16cf4c8dcb
|
|
@ -1 +1 @@
|
|||
Subproject commit c3ceeb6f79b4258d3c966f34aeafb7ca6d72e41a
|
||||
Subproject commit 403accd56333f091f4ef8b5f870591785e26cdfe
|
|
@ -1 +1 @@
|
|||
Subproject commit 491f36750240694ded097bb893aa03d5f7bb81d8
|
||||
Subproject commit 5bbef5ad33ea0f6a5f743ce123b385d3d22ff3f9
|
Loading…
Reference in a new issue