Merge pull request 'Update to 1.21.1' (#15) from 1.21.1 into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #15
Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Lixfel 2024-08-27 19:21:31 +02:00
Commit 9505258ec4
774 geänderte Dateien mit 3312 neuen und 2939 gelöschten Zeilen

Datei anzeigen

@ -24,7 +24,12 @@ jobs:
java: [21] java: [21]
fail-fast: true fail-fast: true
steps: steps:
- uses: actions/checkout@v4 - if: ${{ github.event_name == 'push' }}
uses: actions/checkout@v4
- if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: JDK ${{ matrix.java }} - name: JDK ${{ matrix.java }}
uses: actions/setup-java@v4 uses: actions/setup-java@v4
with: with:

Datei anzeigen

@ -40,7 +40,7 @@ How To (Plugin Developers)
<dependency> <dependency>
<groupId>io.papermc.paper</groupId> <groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId> <artifactId>paper-api</artifactId>
<version>1.21-R0.1-SNAPSHOT</version> <version>1.21.1-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
``` ```
@ -53,7 +53,7 @@ repositories {
} }
dependencies { dependencies {
compileOnly("io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT") compileOnly("io.papermc.paper:paper-api:1.21.1-R0.1-SNAPSHOT")
} }
java { java {

Datei anzeigen

@ -67,7 +67,7 @@ repositories {
} }
dependencies { dependencies {
paramMappings("net.fabricmc:yarn:1.21+build.1:mergedv2") paramMappings("net.fabricmc:yarn:1.21.1+build.3:mergedv2")
remapper("net.fabricmc:tiny-remapper:0.10.3:fat") remapper("net.fabricmc:tiny-remapper:0.10.3:fat")
decompiler("org.vineflower:vineflower:1.10.1") decompiler("org.vineflower:vineflower:1.10.1")
spigotDecompiler("io.papermc:patched-spigot-fernflower:0.1+build.13") spigotDecompiler("io.papermc:patched-spigot-fernflower:0.1+build.13")

Datei anzeigen

@ -1,6 +1,6 @@
group=io.papermc.paper group=io.papermc.paper
version=1.21-R0.1-SNAPSHOT version=1.21.1-R0.1-SNAPSHOT
mcVersion=1.21 mcVersion=1.21.1
# Set to true while updating Minecraft version # Set to true while updating Minecraft version
updatingMinecraft=false updatingMinecraft=false

Datei anzeigen

@ -51,7 +51,7 @@ import org.bukkit.entity.WanderingTrader;
import org.bukkit.entity.Wither; import org.bukkit.entity.Wither;
import org.bukkit.entity.Wolf; import org.bukkit.entity.Wolf;
import org.bukkit.entity.Zombie; import org.bukkit.entity.Zombie;
import org.jetbrains.annotations.NotNull; import org.checkerframework.checker.nullness.qual.NonNull;
/** /**
* Vanilla keys for Mob Goals. * Vanilla keys for Mob Goals.
@ -66,7 +66,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21") @GeneratedFrom("1.21.1")
public interface VanillaGoal<T extends Mob> extends Goal<T> { public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<AbstractHorse> RANDOM_STAND = create("random_stand", AbstractHorse.class); GoalKey<AbstractHorse> RANDOM_STAND = create("random_stand", AbstractHorse.class);
@ -436,8 +436,8 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<Zombie> ZOMBIE_ATTACK_TURTLE_EGG = create("zombie_attack_turtle_egg", Zombie.class); GoalKey<Zombie> ZOMBIE_ATTACK_TURTLE_EGG = create("zombie_attack_turtle_egg", Zombie.class);
private static <T extends Mob> @NotNull GoalKey<T> create(final @NotNull String key, private static <T extends Mob> @NonNull GoalKey<T> create(final @NonNull String key,
final @NotNull Class<T> type) { final @NonNull Class<T> type) {
return GoalKey.of(type, NamespacedKey.minecraft(key)); return GoalKey.of(type, NamespacedKey.minecraft(key));
} }
} }

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/** /**
* Vanilla keys for {@link RegistryKey#BIOME}. * Vanilla keys for {@link RegistryKey#BIOME}.
@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class BiomeKeys { public final class BiomeKeys {
/** /**
@ -478,13 +478,13 @@ public final class BiomeKeys {
} }
/** /**
* Creates a key for {@link Biome} in a registry. * Creates a key for {@link Biome} in the registry {@code minecraft:worldgen/biome}.
* *
* @param key the value's key in the registry * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental @ApiStatus.Experimental
public static @NotNull TypedKey<Biome> create(final @NotNull Key key) { public static @NonNull TypedKey<Biome> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.BIOME, key); return TypedKey.create(RegistryKey.BIOME, key);
} }
} }

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.damage.DamageType; import org.bukkit.damage.DamageType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/** /**
* Vanilla keys for {@link RegistryKey#DAMAGE_TYPE}. * Vanilla keys for {@link RegistryKey#DAMAGE_TYPE}.
@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class DamageTypeKeys { public final class DamageTypeKeys {
/** /**
@ -359,13 +359,13 @@ public final class DamageTypeKeys {
} }
/** /**
* Creates a key for {@link DamageType} in a registry. * Creates a key for {@link DamageType} in the registry {@code minecraft:damage_type}.
* *
* @param key the value's key in the registry * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental @ApiStatus.Experimental
public static @NotNull TypedKey<DamageType> create(final @NotNull Key key) { public static @NonNull TypedKey<DamageType> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.DAMAGE_TYPE, key); return TypedKey.create(RegistryKey.DAMAGE_TYPE, key);
} }
} }

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/** /**
* Vanilla keys for {@link RegistryKey#ENCHANTMENT}. * Vanilla keys for {@link RegistryKey#ENCHANTMENT}.
@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class EnchantmentKeys { public final class EnchantmentKeys {
/** /**
@ -323,7 +323,7 @@ public final class EnchantmentKeys {
private EnchantmentKeys() { private EnchantmentKeys() {
} }
private static @NotNull TypedKey<Enchantment> create(final @NotNull Key key) { private static @NonNull TypedKey<Enchantment> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.ENCHANTMENT, key); return TypedKey.create(RegistryKey.ENCHANTMENT, key);
} }
} }

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.GameEvent; import org.bukkit.GameEvent;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/** /**
* Vanilla keys for {@link RegistryKey#GAME_EVENT}. * Vanilla keys for {@link RegistryKey#GAME_EVENT}.
@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class GameEventKeys { public final class GameEventKeys {
/** /**
@ -449,7 +449,7 @@ public final class GameEventKeys {
private GameEventKeys() { private GameEventKeys() {
} }
private static @NotNull TypedKey<GameEvent> create(final @NotNull Key key) { private static @NonNull TypedKey<GameEvent> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.GAME_EVENT, key); return TypedKey.create(RegistryKey.GAME_EVENT, key);
} }
} }

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.MusicInstrument; import org.bukkit.MusicInstrument;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/** /**
* Vanilla keys for {@link RegistryKey#INSTRUMENT}. * Vanilla keys for {@link RegistryKey#INSTRUMENT}.
@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class InstrumentKeys { public final class InstrumentKeys {
/** /**
@ -85,7 +85,7 @@ public final class InstrumentKeys {
private InstrumentKeys() { private InstrumentKeys() {
} }
private static @NotNull TypedKey<MusicInstrument> create(final @NotNull Key key) { private static @NonNull TypedKey<MusicInstrument> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.INSTRUMENT, key); return TypedKey.create(RegistryKey.INSTRUMENT, key);
} }
} }

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.inventory.ItemType; import org.bukkit.inventory.ItemType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/** /**
* Vanilla keys for {@link RegistryKey#ITEM}. * Vanilla keys for {@link RegistryKey#ITEM}.
@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class ItemTypeKeys { public final class ItemTypeKeys {
/** /**
@ -9360,7 +9360,7 @@ public final class ItemTypeKeys {
private ItemTypeKeys() { private ItemTypeKeys() {
} }
private static @NotNull TypedKey<ItemType> create(final @NotNull Key key) { private static @NonNull TypedKey<ItemType> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.ITEM, key); return TypedKey.create(RegistryKey.ITEM, key);
} }
} }

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/** /**
* Vanilla keys for {@link RegistryKey#MOB_EFFECT}. * Vanilla keys for {@link RegistryKey#MOB_EFFECT}.
@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class MobEffectKeys { public final class MobEffectKeys {
/** /**
@ -302,7 +302,7 @@ public final class MobEffectKeys {
private MobEffectKeys() { private MobEffectKeys() {
} }
private static @NotNull TypedKey<PotionEffectType> create(final @NotNull Key key) { private static @NonNull TypedKey<PotionEffectType> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.MOB_EFFECT, key); return TypedKey.create(RegistryKey.MOB_EFFECT, key);
} }
} }

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.generator.structure.Structure; import org.bukkit.generator.structure.Structure;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/** /**
* Vanilla keys for {@link RegistryKey#STRUCTURE}. * Vanilla keys for {@link RegistryKey#STRUCTURE}.
@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class StructureKeys { public final class StructureKeys {
/** /**
@ -268,13 +268,13 @@ public final class StructureKeys {
} }
/** /**
* Creates a key for {@link Structure} in a registry. * Creates a key for {@link Structure} in the registry {@code minecraft:worldgen/structure}.
* *
* @param key the value's key in the registry * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental @ApiStatus.Experimental
public static @NotNull TypedKey<Structure> create(final @NotNull Key key) { public static @NonNull TypedKey<Structure> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.STRUCTURE, key); return TypedKey.create(RegistryKey.STRUCTURE, key);
} }
} }

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.generator.structure.StructureType; import org.bukkit.generator.structure.StructureType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/** /**
* Vanilla keys for {@link RegistryKey#STRUCTURE_TYPE}. * Vanilla keys for {@link RegistryKey#STRUCTURE_TYPE}.
@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class StructureTypeKeys { public final class StructureTypeKeys {
/** /**
@ -141,7 +141,7 @@ public final class StructureTypeKeys {
private StructureTypeKeys() { private StructureTypeKeys() {
} }
private static @NotNull TypedKey<StructureType> create(final @NotNull Key key) { private static @NonNull TypedKey<StructureType> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.STRUCTURE_TYPE, key); return TypedKey.create(RegistryKey.STRUCTURE_TYPE, key);
} }
} }

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.inventory.meta.trim.TrimMaterial; import org.bukkit.inventory.meta.trim.TrimMaterial;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/** /**
* Vanilla keys for {@link RegistryKey#TRIM_MATERIAL}. * Vanilla keys for {@link RegistryKey#TRIM_MATERIAL}.
@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class TrimMaterialKeys { public final class TrimMaterialKeys {
/** /**
@ -100,13 +100,13 @@ public final class TrimMaterialKeys {
} }
/** /**
* Creates a key for {@link TrimMaterial} in a registry. * Creates a key for {@link TrimMaterial} in the registry {@code minecraft:trim_material}.
* *
* @param key the value's key in the registry * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental @ApiStatus.Experimental
public static @NotNull TypedKey<TrimMaterial> create(final @NotNull Key key) { public static @NonNull TypedKey<TrimMaterial> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.TRIM_MATERIAL, key); return TypedKey.create(RegistryKey.TRIM_MATERIAL, key);
} }
} }

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.inventory.meta.trim.TrimPattern; import org.bukkit.inventory.meta.trim.TrimPattern;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/** /**
* Vanilla keys for {@link RegistryKey#TRIM_PATTERN}. * Vanilla keys for {@link RegistryKey#TRIM_PATTERN}.
@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class TrimPatternKeys { public final class TrimPatternKeys {
/** /**
@ -156,13 +156,13 @@ public final class TrimPatternKeys {
} }
/** /**
* Creates a key for {@link TrimPattern} in a registry. * Creates a key for {@link TrimPattern} in the registry {@code minecraft:trim_pattern}.
* *
* @param key the value's key in the registry * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental @ApiStatus.Experimental
public static @NotNull TypedKey<TrimPattern> create(final @NotNull Key key) { public static @NonNull TypedKey<TrimPattern> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.TRIM_PATTERN, key); return TypedKey.create(RegistryKey.TRIM_PATTERN, key);
} }
} }

Datei anzeigen

@ -7,8 +7,8 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey; import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.entity.Wolf; import org.bukkit.entity.Wolf;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/** /**
* Vanilla keys for {@link RegistryKey#WOLF_VARIANT}. * Vanilla keys for {@link RegistryKey#WOLF_VARIANT}.
@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class WolfVariantKeys { public final class WolfVariantKeys {
/** /**
@ -93,13 +93,13 @@ public final class WolfVariantKeys {
} }
/** /**
* Creates a key for {@link Wolf.Variant} in a registry. * Creates a key for {@link Wolf.Variant} in the registry {@code minecraft:wolf_variant}.
* *
* @param key the value's key in the registry * @param key the value's key in the registry
* @return a new typed key * @return a new typed key
*/ */
@ApiStatus.Experimental @ApiStatus.Experimental
public static @NotNull TypedKey<Wolf.Variant> create(final @NotNull Key key) { public static @NonNull TypedKey<Wolf.Variant> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.WOLF_VARIANT, key); return TypedKey.create(RegistryKey.WOLF_VARIANT, key);
} }
} }

Datei anzeigen

@ -8,8 +8,8 @@ import io.papermc.paper.registry.tag.TagKey;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.bukkit.MinecraftExperimental; import org.bukkit.MinecraftExperimental;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/** /**
* Vanilla keys for {@link RegistryKey#ENCHANTMENT}. * Vanilla keys for {@link RegistryKey#ENCHANTMENT}.
@ -24,66 +24,9 @@ import org.jetbrains.annotations.NotNull;
"unused", "unused",
"SpellCheckingInspection" "SpellCheckingInspection"
}) })
@GeneratedFrom("1.21") @GeneratedFrom("1.21.1")
@ApiStatus.Experimental @ApiStatus.Experimental
public final class EnchantmentTagKeys { public final class EnchantmentTagKeys {
/**
* {@code #minecraft:trades/swamp_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_SWAMP_SPECIAL = create(key("trades/swamp_special"));
/**
* {@code #minecraft:trades/plains_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_PLAINS_SPECIAL = create(key("trades/plains_special"));
/**
* {@code #minecraft:on_traded_equipment}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> ON_TRADED_EQUIPMENT = create(key("on_traded_equipment"));
/**
* {@code #minecraft:trades/desert_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_DESERT_SPECIAL = create(key("trades/desert_special"));
/**
* {@code #minecraft:prevents_ice_melting}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> PREVENTS_ICE_MELTING = create(key("prevents_ice_melting"));
/**
* {@code #minecraft:trades/taiga_common}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_TAIGA_COMMON = create(key("trades/taiga_common"));
/**
* {@code #minecraft:tradeable}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> TRADEABLE = create(key("tradeable"));
/** /**
* {@code #minecraft:curse} * {@code #minecraft:curse}
* *
@ -91,36 +34,6 @@ public final class EnchantmentTagKeys {
*/ */
public static final TagKey<Enchantment> CURSE = create(key("curse")); public static final TagKey<Enchantment> CURSE = create(key("curse"));
/**
* {@code #minecraft:treasure}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> TREASURE = create(key("treasure"));
/**
* {@code #minecraft:prevents_infested_spawns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> PREVENTS_INFESTED_SPAWNS = create(key("prevents_infested_spawns"));
/**
* {@code #minecraft:trades/savanna_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_SAVANNA_SPECIAL = create(key("trades/savanna_special"));
/**
* {@code #minecraft:exclusive_set/riptide}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_RIPTIDE = create(key("exclusive_set/riptide"));
/** /**
* {@code #minecraft:double_trade_price} * {@code #minecraft:double_trade_price}
* *
@ -129,20 +42,11 @@ public final class EnchantmentTagKeys {
public static final TagKey<Enchantment> DOUBLE_TRADE_PRICE = create(key("double_trade_price")); public static final TagKey<Enchantment> DOUBLE_TRADE_PRICE = create(key("double_trade_price"));
/** /**
* {@code #minecraft:trades/taiga_special} * {@code #minecraft:exclusive_set/armor}
* *
* @apiNote This field is version-dependant and may be removed in future Minecraft versions * @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/ */
@ApiStatus.Experimental public static final TagKey<Enchantment> EXCLUSIVE_SET_ARMOR = create(key("exclusive_set/armor"));
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_TAIGA_SPECIAL = create(key("trades/taiga_special"));
/**
* {@code #minecraft:smelts_loot}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> SMELTS_LOOT = create(key("smelts_loot"));
/** /**
* {@code #minecraft:exclusive_set/boots} * {@code #minecraft:exclusive_set/boots}
@ -152,13 +56,53 @@ public final class EnchantmentTagKeys {
public static final TagKey<Enchantment> EXCLUSIVE_SET_BOOTS = create(key("exclusive_set/boots")); public static final TagKey<Enchantment> EXCLUSIVE_SET_BOOTS = create(key("exclusive_set/boots"));
/** /**
* {@code #minecraft:trades/plains_common} * {@code #minecraft:exclusive_set/bow}
* *
* @apiNote This field is version-dependant and may be removed in future Minecraft versions * @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/ */
@ApiStatus.Experimental public static final TagKey<Enchantment> EXCLUSIVE_SET_BOW = create(key("exclusive_set/bow"));
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_PLAINS_COMMON = create(key("trades/plains_common")); /**
* {@code #minecraft:exclusive_set/crossbow}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_CROSSBOW = create(key("exclusive_set/crossbow"));
/**
* {@code #minecraft:exclusive_set/damage}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_DAMAGE = create(key("exclusive_set/damage"));
/**
* {@code #minecraft:exclusive_set/mining}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_MINING = create(key("exclusive_set/mining"));
/**
* {@code #minecraft:exclusive_set/riptide}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_RIPTIDE = create(key("exclusive_set/riptide"));
/**
* {@code #minecraft:in_enchanting_table}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> IN_ENCHANTING_TABLE = create(key("in_enchanting_table"));
/**
* {@code #minecraft:non_treasure}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> NON_TREASURE = create(key("non_treasure"));
/** /**
* {@code #minecraft:on_mob_spawn_equipment} * {@code #minecraft:on_mob_spawn_equipment}
@ -167,6 +111,69 @@ public final class EnchantmentTagKeys {
*/ */
public static final TagKey<Enchantment> ON_MOB_SPAWN_EQUIPMENT = create(key("on_mob_spawn_equipment")); public static final TagKey<Enchantment> ON_MOB_SPAWN_EQUIPMENT = create(key("on_mob_spawn_equipment"));
/**
* {@code #minecraft:on_random_loot}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> ON_RANDOM_LOOT = create(key("on_random_loot"));
/**
* {@code #minecraft:on_traded_equipment}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> ON_TRADED_EQUIPMENT = create(key("on_traded_equipment"));
/**
* {@code #minecraft:prevents_bee_spawns_when_mining}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> PREVENTS_BEE_SPAWNS_WHEN_MINING = create(key("prevents_bee_spawns_when_mining"));
/**
* {@code #minecraft:prevents_decorated_pot_shattering}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> PREVENTS_DECORATED_POT_SHATTERING = create(key("prevents_decorated_pot_shattering"));
/**
* {@code #minecraft:prevents_ice_melting}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> PREVENTS_ICE_MELTING = create(key("prevents_ice_melting"));
/**
* {@code #minecraft:prevents_infested_spawns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> PREVENTS_INFESTED_SPAWNS = create(key("prevents_infested_spawns"));
/**
* {@code #minecraft:smelts_loot}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> SMELTS_LOOT = create(key("smelts_loot"));
/**
* {@code #minecraft:tooltip_order}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> TOOLTIP_ORDER = create(key("tooltip_order"));
/**
* {@code #minecraft:tradeable}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> TRADEABLE = create(key("tradeable"));
/** /**
* {@code #minecraft:trades/desert_common} * {@code #minecraft:trades/desert_common}
* *
@ -177,46 +184,13 @@ public final class EnchantmentTagKeys {
public static final TagKey<Enchantment> TRADES_DESERT_COMMON = create(key("trades/desert_common")); public static final TagKey<Enchantment> TRADES_DESERT_COMMON = create(key("trades/desert_common"));
/** /**
* {@code #minecraft:exclusive_set/mining} * {@code #minecraft:trades/desert_special}
* *
* @apiNote This field is version-dependant and may be removed in future Minecraft versions * @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/ */
public static final TagKey<Enchantment> EXCLUSIVE_SET_MINING = create(key("exclusive_set/mining")); @ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
/** public static final TagKey<Enchantment> TRADES_DESERT_SPECIAL = create(key("trades/desert_special"));
* {@code #minecraft:tooltip_order}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> TOOLTIP_ORDER = create(key("tooltip_order"));
/**
* {@code #minecraft:prevents_decorated_pot_shattering}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> PREVENTS_DECORATED_POT_SHATTERING = create(key("prevents_decorated_pot_shattering"));
/**
* {@code #minecraft:exclusive_set/bow}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_BOW = create(key("exclusive_set/bow"));
/**
* {@code #minecraft:on_random_loot}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> ON_RANDOM_LOOT = create(key("on_random_loot"));
/**
* {@code #minecraft:exclusive_set/armor}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_ARMOR = create(key("exclusive_set/armor"));
/** /**
* {@code #minecraft:trades/jungle_common} * {@code #minecraft:trades/jungle_common}
@ -227,38 +201,6 @@ public final class EnchantmentTagKeys {
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE) @MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_JUNGLE_COMMON = create(key("trades/jungle_common")); public static final TagKey<Enchantment> TRADES_JUNGLE_COMMON = create(key("trades/jungle_common"));
/**
* {@code #minecraft:in_enchanting_table}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> IN_ENCHANTING_TABLE = create(key("in_enchanting_table"));
/**
* {@code #minecraft:trades/swamp_common}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_SWAMP_COMMON = create(key("trades/swamp_common"));
/**
* {@code #minecraft:trades/snow_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_SNOW_SPECIAL = create(key("trades/snow_special"));
/**
* {@code #minecraft:non_treasure}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> NON_TREASURE = create(key("non_treasure"));
/** /**
* {@code #minecraft:trades/jungle_special} * {@code #minecraft:trades/jungle_special}
* *
@ -269,18 +211,22 @@ public final class EnchantmentTagKeys {
public static final TagKey<Enchantment> TRADES_JUNGLE_SPECIAL = create(key("trades/jungle_special")); public static final TagKey<Enchantment> TRADES_JUNGLE_SPECIAL = create(key("trades/jungle_special"));
/** /**
* {@code #minecraft:prevents_bee_spawns_when_mining} * {@code #minecraft:trades/plains_common}
* *
* @apiNote This field is version-dependant and may be removed in future Minecraft versions * @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/ */
public static final TagKey<Enchantment> PREVENTS_BEE_SPAWNS_WHEN_MINING = create(key("prevents_bee_spawns_when_mining")); @ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_PLAINS_COMMON = create(key("trades/plains_common"));
/** /**
* {@code #minecraft:exclusive_set/damage} * {@code #minecraft:trades/plains_special}
* *
* @apiNote This field is version-dependant and may be removed in future Minecraft versions * @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/ */
public static final TagKey<Enchantment> EXCLUSIVE_SET_DAMAGE = create(key("exclusive_set/damage")); @ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_PLAINS_SPECIAL = create(key("trades/plains_special"));
/** /**
* {@code #minecraft:trades/savanna_common} * {@code #minecraft:trades/savanna_common}
@ -291,6 +237,15 @@ public final class EnchantmentTagKeys {
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE) @MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_SAVANNA_COMMON = create(key("trades/savanna_common")); public static final TagKey<Enchantment> TRADES_SAVANNA_COMMON = create(key("trades/savanna_common"));
/**
* {@code #minecraft:trades/savanna_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_SAVANNA_SPECIAL = create(key("trades/savanna_special"));
/** /**
* {@code #minecraft:trades/snow_common} * {@code #minecraft:trades/snow_common}
* *
@ -301,23 +256,68 @@ public final class EnchantmentTagKeys {
public static final TagKey<Enchantment> TRADES_SNOW_COMMON = create(key("trades/snow_common")); public static final TagKey<Enchantment> TRADES_SNOW_COMMON = create(key("trades/snow_common"));
/** /**
* {@code #minecraft:exclusive_set/crossbow} * {@code #minecraft:trades/snow_special}
* *
* @apiNote This field is version-dependant and may be removed in future Minecraft versions * @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/ */
public static final TagKey<Enchantment> EXCLUSIVE_SET_CROSSBOW = create(key("exclusive_set/crossbow")); @ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_SNOW_SPECIAL = create(key("trades/snow_special"));
/**
* {@code #minecraft:trades/swamp_common}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_SWAMP_COMMON = create(key("trades/swamp_common"));
/**
* {@code #minecraft:trades/swamp_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_SWAMP_SPECIAL = create(key("trades/swamp_special"));
/**
* {@code #minecraft:trades/taiga_common}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_TAIGA_COMMON = create(key("trades/taiga_common"));
/**
* {@code #minecraft:trades/taiga_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_TAIGA_SPECIAL = create(key("trades/taiga_special"));
/**
* {@code #minecraft:treasure}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> TREASURE = create(key("treasure"));
private EnchantmentTagKeys() { private EnchantmentTagKeys() {
} }
/** /**
* Creates a tag key for {@link Enchantment} in the registry {@code minecraft:root}. * Creates a tag key for {@link Enchantment} in the registry {@code minecraft:enchantment}.
* *
* @param key the tag key's key * @param key the tag key's key
* @return a new tag key * @return a new tag key
*/ */
@ApiStatus.Experimental @ApiStatus.Experimental
public static @NotNull TagKey<Enchantment> create(final @NotNull Key key) { public static @NonNull TagKey<Enchantment> create(final @NonNull Key key) {
return TagKey.create(RegistryKey.ENCHANTMENT, key); return TagKey.create(RegistryKey.ENCHANTMENT, key);
} }
} }

Datei anzeigen

@ -31,8 +31,6 @@ import net.minecraft.core.RegistrySetBuilder;
import net.minecraft.data.registries.VanillaRegistries; import net.minecraft.data.registries.VanillaRegistries;
import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceKey;
import net.minecraft.world.flag.FeatureElement; import net.minecraft.world.flag.FeatureElement;
import net.minecraft.world.flag.FeatureFlags;
import org.bukkit.MinecraftExperimental;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.framework.qual.DefaultQualifier; import org.checkerframework.framework.qual.DefaultQualifier;
@ -72,7 +70,7 @@ public class GeneratedKeyType<T, A> extends SimpleGenerator {
} }
private static final String CREATE_JAVADOC = """ private static final String CREATE_JAVADOC = """
Creates a key for {@link $T} in a registry. Creates a key for {@link $T} in the registry {@code $L}.
@param key the value's key in the registry @param key the value's key in the registry
@return a new typed key @return a new typed key
@ -102,7 +100,7 @@ public class GeneratedKeyType<T, A> extends SimpleGenerator {
.returns(returnType.annotated(NOT_NULL)); .returns(returnType.annotated(NOT_NULL));
if (this.publicCreateKeyMethod) { if (this.publicCreateKeyMethod) {
create.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO remove once not experimental create.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO remove once not experimental
create.addJavadoc(CREATE_JAVADOC, this.apiType); create.addJavadoc(CREATE_JAVADOC, this.apiType, this.registryKey.location().toString());
} }
return create; return create;
} }
@ -190,8 +188,6 @@ public class GeneratedKeyType<T, A> extends SimpleGenerator {
@Override @Override
protected JavaFile.Builder file(final JavaFile.Builder builder) { protected JavaFile.Builder file(final JavaFile.Builder builder) {
return builder return builder
.skipJavaLangImports(true) .addStaticImport(Key.class, "key");
.addStaticImport(Key.class, "key")
.indent(" ");
} }
} }

Datei anzeigen

@ -15,15 +15,11 @@ import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.tag.TagKey; import io.papermc.paper.registry.tag.TagKey;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.core.RegistrySetBuilder;
import net.minecraft.data.registries.VanillaRegistries;
import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceKey;
import org.bukkit.MinecraftExperimental; import org.bukkit.MinecraftExperimental;
@ -39,11 +35,6 @@ import static javax.lang.model.element.Modifier.STATIC;
public class GeneratedTagKeyType<T, A> extends SimpleGenerator { public class GeneratedTagKeyType<T, A> extends SimpleGenerator {
private static final Map<ResourceKey<? extends Registry<?>>, RegistrySetBuilder.RegistryBootstrap<?>> VANILLA_REGISTRY_ENTRIES = VanillaRegistries.BUILDER.entries.stream()
.collect(Collectors.toMap(RegistrySetBuilder.RegistryStub::key, RegistrySetBuilder.RegistryStub::bootstrap));
private static final Map<ResourceKey<? extends Registry<?>>, RegistrySetBuilder.RegistryBootstrap<?>> EXPERIMENTAL_REGISTRY_ENTRIES = Collections.emptyMap(); // Update for Experimental API
private static final Map<RegistryKey<?>, String> REGISTRY_KEY_FIELD_NAMES; private static final Map<RegistryKey<?>, String> REGISTRY_KEY_FIELD_NAMES;
static { static {
final Map<RegistryKey<?>, String> map = new HashMap<>(); final Map<RegistryKey<?>, String> map = new HashMap<>();
@ -91,7 +82,7 @@ public class GeneratedTagKeyType<T, A> extends SimpleGenerator {
.returns(returnType.annotated(NOT_NULL)); .returns(returnType.annotated(NOT_NULL));
if (this.publicCreateKeyMethod) { if (this.publicCreateKeyMethod) {
create.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO remove once not experimental create.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO remove once not experimental
create.addJavadoc(CREATE_JAVADOC, this.apiType, this.registryKey.registry().toString()); create.addJavadoc(CREATE_JAVADOC, this.apiType, this.registryKey.location().toString());
} }
return create; return create;
} }
@ -102,8 +93,8 @@ public class GeneratedTagKeyType<T, A> extends SimpleGenerator {
.addJavadoc(Javadocs.getVersionDependentClassHeader("{@link $T#$L}"), RegistryKey.class, REGISTRY_KEY_FIELD_NAMES.get(this.apiRegistryKey)) .addJavadoc(Javadocs.getVersionDependentClassHeader("{@link $T#$L}"), RegistryKey.class, REGISTRY_KEY_FIELD_NAMES.get(this.apiRegistryKey))
.addAnnotations(Annotations.CLASS_HEADER) .addAnnotations(Annotations.CLASS_HEADER)
.addMethod(MethodSpec.constructorBuilder() .addMethod(MethodSpec.constructorBuilder()
.addModifiers(PRIVATE) .addModifiers(PRIVATE)
.build() .build()
); );
} }
@ -117,8 +108,7 @@ public class GeneratedTagKeyType<T, A> extends SimpleGenerator {
final Registry<T> registry = Main.REGISTRY_ACCESS.registryOrThrow(this.registryKey); final Registry<T> registry = Main.REGISTRY_ACCESS.registryOrThrow(this.registryKey);
final AtomicBoolean allExperimental = new AtomicBoolean(true); final AtomicBoolean allExperimental = new AtomicBoolean(true);
registry.getTags().forEach(pair -> { registry.getTagNames().sorted(Formatting.alphabeticKeyOrder(nmsTagKey -> nmsTagKey.location().getPath())).forEach(nmsTagKey -> {
final net.minecraft.tags.TagKey<T> nmsTagKey = pair.getFirst();
final String fieldName = Formatting.formatKeyAsField(nmsTagKey.location().getPath()); final String fieldName = Formatting.formatKeyAsField(nmsTagKey.location().getPath());
final FieldSpec.Builder fieldBuilder = FieldSpec.builder(tagKey, fieldName, PUBLIC, STATIC, FINAL) final FieldSpec.Builder fieldBuilder = FieldSpec.builder(tagKey, fieldName, PUBLIC, STATIC, FINAL)
.initializer("$N(key($S))", createMethod.build(), nmsTagKey.location().getPath()) .initializer("$N(key($S))", createMethod.build(), nmsTagKey.location().getPath())
@ -142,8 +132,6 @@ public class GeneratedTagKeyType<T, A> extends SimpleGenerator {
@Override @Override
protected JavaFile.Builder file(final JavaFile.Builder builder) { protected JavaFile.Builder file(final JavaFile.Builder builder) {
return builder return builder
.skipJavaLangImports(true) .addStaticImport(Key.class, "key");
.addStaticImport(Key.class, "key")
.indent(" ");
} }
} }

Datei anzeigen

@ -132,8 +132,7 @@ public class MobGoalGenerator extends SimpleGenerator {
@Override @Override
protected JavaFile.Builder file(JavaFile.Builder builder) { protected JavaFile.Builder file(JavaFile.Builder builder) {
return builder return builder;
.skipJavaLangImports(true);
} }
record DeprecatedEntry(Class<?> entity, String entryName, @Nullable String removalVersion, record DeprecatedEntry(Class<?> entity, String entryName, @Nullable String removalVersion,

Datei anzeigen

@ -7,8 +7,8 @@ import java.util.List;
import io.papermc.paper.generated.GeneratedFrom; import io.papermc.paper.generated.GeneratedFrom;
import net.minecraft.SharedConstants; import net.minecraft.SharedConstants;
import org.bukkit.MinecraftExperimental; import org.bukkit.MinecraftExperimental;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
public final class Annotations { public final class Annotations {
@ -26,10 +26,10 @@ public final class Annotations {
return annotationSpecs; return annotationSpecs;
} }
public static AnnotationSpec deprecatedVersioned(final @Nullable String version, boolean forRemoval) { public static AnnotationSpec deprecatedVersioned(final @Nullable String version, final boolean forRemoval) {
AnnotationSpec.Builder annotationSpec = AnnotationSpec.builder(Deprecated.class); final AnnotationSpec.Builder annotationSpec = AnnotationSpec.builder(Deprecated.class);
if (forRemoval) { if (forRemoval) {
annotationSpec.addMember("forRemoval", "$L", forRemoval); annotationSpec.addMember("forRemoval", "$L", true);
} }
if (version != null) { if (version != null) {
annotationSpec.addMember("since", "$S", version); annotationSpec.addMember("since", "$S", version);
@ -46,7 +46,7 @@ public final class Annotations {
@ApiStatus.Experimental @ApiStatus.Experimental
public static final AnnotationSpec EXPERIMENTAL_API_ANNOTATION = AnnotationSpec.builder(ApiStatus.Experimental.class).build(); public static final AnnotationSpec EXPERIMENTAL_API_ANNOTATION = AnnotationSpec.builder(ApiStatus.Experimental.class).build();
public static final AnnotationSpec NOT_NULL = AnnotationSpec.builder(NotNull.class).build(); public static final AnnotationSpec NOT_NULL = AnnotationSpec.builder(NonNull.class).build();
private static final AnnotationSpec SUPPRESS_WARNINGS = AnnotationSpec.builder(SuppressWarnings.class) private static final AnnotationSpec SUPPRESS_WARNINGS = AnnotationSpec.builder(SuppressWarnings.class)
.addMember("value", "$S", "unused") .addMember("value", "$S", "unused")
.addMember("value", "$S", "SpellCheckingInspection") .addMember("value", "$S", "SpellCheckingInspection")

Datei anzeigen

@ -2,7 +2,6 @@ package io.papermc.generator.utils;
import com.mojang.serialization.Lifecycle; import com.mojang.serialization.Lifecycle;
import io.papermc.generator.Main; import io.papermc.generator.Main;
import java.util.List;
import java.util.Set; import java.util.Set;
import net.minecraft.core.Holder; import net.minecraft.core.Holder;
import net.minecraft.core.HolderGetter; import net.minecraft.core.HolderGetter;

Datei anzeigen

@ -4,7 +4,6 @@ import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import com.mojang.logging.LogUtils; import com.mojang.logging.LogUtils;
import io.papermc.generator.Main; import io.papermc.generator.Main;
import io.papermc.generator.utils.Formatting;
import java.util.Collections; import java.util.Collections;
import java.util.IdentityHashMap; import java.util.IdentityHashMap;
import java.util.Map; import java.util.Map;
@ -19,7 +18,6 @@ import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.repository.BuiltInPackSource; import net.minecraft.server.packs.repository.BuiltInPackSource;
import net.minecraft.server.packs.resources.MultiPackResourceManager; import net.minecraft.server.packs.resources.MultiPackResourceManager;
import net.minecraft.tags.TagKey; import net.minecraft.tags.TagKey;
import net.minecraft.tags.TagManager;
import org.slf4j.Logger; import org.slf4j.Logger;
// collect all the tags by grabbing the json from the data-packs // collect all the tags by grabbing the json from the data-packs
@ -50,9 +48,9 @@ public final class TagCollector {
} }
result.put(entry.value().getTagNames() result.put(entry.value().getTagNames()
.filter(tagKey -> tagKey.location().getPath().equals(path)) .filter(tagKey -> tagKey.location().getPath().equals(path))
.findFirst() .findFirst()
.orElseThrow(), packId); .orElseThrow(), packId);
}); });
}); });
return Collections.unmodifiableMap(result); return Collections.unmodifiableMap(result);

Datei anzeigen

@ -124,7 +124,7 @@ index 0000000000000000000000000000000000000000..6271e2bad0ed937c2c46a8c8fdf186c4
+} +}
diff --git a/pom.xml b/pom.xml diff --git a/pom.xml b/pom.xml
deleted file mode 100644 deleted file mode 100644
index 86628114c1d111f6d256186ca739ba8a44b3412a..0000000000000000000000000000000000000000 index 2c5ac393cffbe61330c5aa95115e7e906c0775d3..0000000000000000000000000000000000000000
--- a/pom.xml --- a/pom.xml
+++ /dev/null +++ /dev/null
@@ -1,267 +0,0 @@ @@ -1,267 +0,0 @@
@ -135,7 +135,7 @@ index 86628114c1d111f6d256186ca739ba8a44b3412a..00000000000000000000000000000000
- -
- <groupId>org.spigotmc</groupId> - <groupId>org.spigotmc</groupId>
- <artifactId>spigot-api</artifactId> - <artifactId>spigot-api</artifactId>
- <version>1.21-R0.1-SNAPSHOT</version> - <version>1.21.1-R0.1-SNAPSHOT</version>
- <packaging>jar</packaging> - <packaging>jar</packaging>
- -
- <name>Spigot-API</name> - <name>Spigot-API</name>

Datei anzeigen

@ -4327,10 +4327,10 @@ index 5adbe0514129abf3cfbc4b29a213f522359fe2e1..72ebc29db42d08d1d0361dba462fc8a5
/** /**
diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/java/org/bukkit/inventory/InventoryView.java diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/java/org/bukkit/inventory/InventoryView.java
index 5b479ff2abe8cdd5e889803c73a713bc9855bc0b..5954dff2134654bb0ccc3b4c3b51a8e1ca77f6c9 100644 index 278259e211b926283ee6dfef6f96e11ddbcbf275..ebc14022c9ef9b0b3331ee53e96a32667e4762e0 100644
--- a/src/main/java/org/bukkit/inventory/InventoryView.java --- a/src/main/java/org/bukkit/inventory/InventoryView.java
+++ b/src/main/java/org/bukkit/inventory/InventoryView.java +++ b/src/main/java/org/bukkit/inventory/InventoryView.java
@@ -267,12 +267,26 @@ public interface InventoryView { @@ -269,12 +269,26 @@ public interface InventoryView {
*/ */
public boolean setProperty(@NotNull Property prop, int value); public boolean setProperty(@NotNull Property prop, int value);

Datei anzeigen

@ -416,7 +416,7 @@ index 4e1fb0974d061d5bb64899cac576318d2e6f8bf6..539b3527d0c66611e21712f29b90fba9
public int getEntityId(); public int getEntityId();
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
index 274f3ccbc39d4d6ff0665abf334d526317275dd0..a7bfaa874cbd3fc8d24fffe2f7f14594b37fa18c 100644 index 8fdfa1d79daf464f8e364fd9e19d1de3a2a6848c..195a7fa0ea8e056cbde7b9152cc014d2c94353ff 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java --- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -22,6 +22,11 @@ import org.jetbrains.annotations.Nullable; @@ -22,6 +22,11 @@ import org.jetbrains.annotations.Nullable;
@ -687,7 +687,7 @@ index be0a2d1f234d8265d98e54e518a994957b1f3ab7..4e3c406ba883aae553e8d69b6b719b87
* than BLOCK_CANBUILD, as this refers to a player, not universe-physics * than BLOCK_CANBUILD, as this refers to a player, not universe-physics
* rule like cactus on dirt. * rule like cactus on dirt.
diff --git a/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java b/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java diff --git a/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java b/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java
index fc2120e03737f5882d6ae916db93fdcf4939b2ba..f2edd4a9357832e9dec3fb0aafa006335d7b289b 100644 index 035c647f4d4e3c34f171bb7d7fa6b2b7b3442669..7ae338bcecff2ce25939035181457ced505b3a49 100644
--- a/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java --- a/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java
+++ b/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java +++ b/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java
@@ -81,7 +81,7 @@ public class PrepareItemEnchantEvent extends InventoryEvent implements Cancellab @@ -81,7 +81,7 @@ public class PrepareItemEnchantEvent extends InventoryEvent implements Cancellab
@ -999,7 +999,7 @@ index 9013d043503d175004ad276799e5935b7fa59dc4..ceae092eb782698803c6c3df41267dde
public class InventoryOpenEvent extends InventoryEvent implements Cancellable { public class InventoryOpenEvent extends InventoryEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
diff --git a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java diff --git a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java
index 6782024735a885ba0b1b4dba4a576740c1410366..8977f7609431c3c46324a82de84d4a32f4b71c57 100644 index 08a7c564fe5d3d232998d1789d4d4723a59c1430..8a5be3f0322ac19aeac3f00df54add0e73bc87ed 100644
--- a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java --- a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java
+++ b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java +++ b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java
@@ -24,6 +24,20 @@ public class PrepareAnvilEvent extends PrepareInventoryResultEvent { @@ -24,6 +24,20 @@ public class PrepareAnvilEvent extends PrepareInventoryResultEvent {
@ -1022,7 +1022,7 @@ index 6782024735a885ba0b1b4dba4a576740c1410366..8977f7609431c3c46324a82de84d4a32
+ +
@NotNull @NotNull
@Override @Override
public HandlerList getHandlers() { public AnvilView getView() {
diff --git a/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java b/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java diff --git a/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java b/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java
index e4c32b21ab013703a6a1b07a1ad564d914ebe83f..e58fecf0fe54db06e0e944027923a352fd8005d8 100644 index e4c32b21ab013703a6a1b07a1ad564d914ebe83f..e58fecf0fe54db06e0e944027923a352fd8005d8 100644
--- a/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java --- a/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java
@ -1430,7 +1430,7 @@ index f1918027c3a8735b31566856218611656b56db20..476fe14faa39f02444cab8ad95d44010
* @return the currently held item * @return the currently held item
* @see #getItemInMainHand() * @see #getItemInMainHand()
diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
index a601bc38e322e5810cf883708541e2d199f09ebb..d89068a37de1dcad0b82dee09cc7829109921a05 100644 index 16c10d75dd28f6bbe843935e8bc91f2bccbd360a..c414ccf03572d48f5c096516fc60a59bb1e8efd7 100644
--- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java --- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java +++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
@@ -24,8 +24,6 @@ public class ShapedRecipe extends CraftingRecipe { @@ -24,8 +24,6 @@ public class ShapedRecipe extends CraftingRecipe {
@ -1442,8 +1442,8 @@ index a601bc38e322e5810cf883708541e2d199f09ebb..d89068a37de1dcad0b82dee09cc78291
* @see ShapedRecipe#setIngredient(char, RecipeChoice) * @see ShapedRecipe#setIngredient(char, RecipeChoice)
* @deprecated Recipes must have keys. Use {@link #ShapedRecipe(NamespacedKey, ItemStack)} * @deprecated Recipes must have keys. Use {@link #ShapedRecipe(NamespacedKey, ItemStack)}
* instead. * instead.
@@ -44,8 +42,6 @@ public class ShapedRecipe extends CraftingRecipe { @@ -45,8 +43,6 @@ public class ShapedRecipe extends CraftingRecipe {
* @param result The item you want the recipe to create. * @exception IllegalArgumentException if the {@code result} is an empty item (AIR)
* @see ShapedRecipe#shape(String...) * @see ShapedRecipe#shape(String...)
* @see ShapedRecipe#setIngredient(char, Material) * @see ShapedRecipe#setIngredient(char, Material)
- * @see ShapedRecipe#setIngredient(char, Material, int) - * @see ShapedRecipe#setIngredient(char, Material, int)
@ -1452,12 +1452,12 @@ index a601bc38e322e5810cf883708541e2d199f09ebb..d89068a37de1dcad0b82dee09cc78291
*/ */
public ShapedRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result) { public ShapedRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result) {
diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
index 3d50775da447175b2a94ed9056ef36aa1e69c2eb..03839302c94adc3175d0a88065cd230257ffd20d 100644 index bc924ae23fa10d87537aebbfd126aa44f199b65c..b7f46a048633945dc71e8efec9a7ebeed5832fd7 100644
--- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java --- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java +++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
@@ -30,11 +30,8 @@ public class ShapelessRecipe extends CraftingRecipe { @@ -31,11 +31,8 @@ public class ShapelessRecipe extends CraftingRecipe {
* @param key the unique recipe key
* @param result The item you want the recipe to create. * @param result The item you want the recipe to create.
* @exception IllegalArgumentException if the {@code result} is an empty item (AIR)
* @see ShapelessRecipe#addIngredient(Material) * @see ShapelessRecipe#addIngredient(Material)
- * @see ShapelessRecipe#addIngredient(MaterialData) - * @see ShapelessRecipe#addIngredient(MaterialData)
- * @see ShapelessRecipe#addIngredient(Material,int) - * @see ShapelessRecipe#addIngredient(Material,int)
@ -1467,8 +1467,8 @@ index 3d50775da447175b2a94ed9056ef36aa1e69c2eb..03839302c94adc3175d0a88065cd2302
+ * @see ShapelessRecipe#addIngredient(RecipeChoice) + * @see ShapelessRecipe#addIngredient(RecipeChoice)
*/ */
public ShapelessRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result) { public ShapelessRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result) {
super(key, result); super(key, checkResult(result));
@@ -174,7 +171,7 @@ public class ShapelessRecipe extends CraftingRecipe { @@ -175,7 +172,7 @@ public class ShapelessRecipe extends CraftingRecipe {
/** /**
* Removes multiple instances of an ingredient from the list. If there are * Removes multiple instances of an ingredient from the list. If there are

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Shoulder Entities Release API
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
index a7bfaa874cbd3fc8d24fffe2f7f14594b37fa18c..8cc6f8547380d567aef7910ef309193bd79ced09 100644 index 195a7fa0ea8e056cbde7b9152cc014d2c94353ff..85eec2e57b03c11f4737addb0fa88b7bf29dc9e5 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java --- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -335,6 +335,26 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder @@ -337,6 +337,26 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
*/ */
public int getExpToLevel(); public int getExpToLevel();

Datei anzeigen

@ -10,25 +10,25 @@ on the players login.
Plugin authors need to define a key to keep it consistent between server restarts. Plugin authors need to define a key to keep it consistent between server restarts.
diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
index 9f9c67e935940833bbfe58e6bfa398e6c86980d5..71e494177473c62449aafda1699b26a0c4c81a68 100644 index c414ccf03572d48f5c096516fc60a59bb1e8efd7..e9bac744c5b173e6767e2de8480a6697969fdbb0 100644
--- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java --- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java +++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
@@ -31,6 +31,7 @@ public class ShapedRecipe extends CraftingRecipe { @@ -31,6 +31,7 @@ public class ShapedRecipe extends CraftingRecipe {
@Deprecated @Deprecated
public ShapedRecipe(@NotNull ItemStack result) { public ShapedRecipe(@NotNull ItemStack result) {
super(NamespacedKey.randomKey(), result); this(NamespacedKey.randomKey(), result);
+ new Throwable("Warning: A plugin is creating a recipe using a Deprecated method. This will cause you to receive warnings stating 'Tried to load unrecognized recipe: bukkit:<ID>'. Please ask the author to give their recipe a static key using NamespacedKey.").printStackTrace(); // Paper + new Throwable("Warning: A plugin is creating a recipe using a Deprecated method. This will cause you to receive warnings stating 'Tried to load unrecognized recipe: bukkit:<ID>'. Please ask the author to give their recipe a static key using NamespacedKey.").printStackTrace(); // Paper
} }
/** /**
diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
index 03839302c94adc3175d0a88065cd230257ffd20d..d6e38c7ccfe3b6e85eafb611da20b1a29fb74d97 100644 index b7f46a048633945dc71e8efec9a7ebeed5832fd7..a7513c1aa09b88e3f99e7db40661fd83e682de96 100644
--- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java --- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java +++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
@@ -20,6 +20,7 @@ public class ShapelessRecipe extends CraftingRecipe { @@ -20,6 +20,7 @@ public class ShapelessRecipe extends CraftingRecipe {
@Deprecated @Deprecated
public ShapelessRecipe(@NotNull ItemStack result) { public ShapelessRecipe(@NotNull ItemStack result) {
super(NamespacedKey.randomKey(), result); this(NamespacedKey.randomKey(), result);
+ new Throwable("Warning: A plugin is creating a recipe using a Deprecated method. This will cause you to receive warnings stating 'Tried to load unrecognized recipe: bukkit:<ID>'. Please ask the author to give their recipe a static key using NamespacedKey.").printStackTrace(); // Paper + new Throwable("Warning: A plugin is creating a recipe using a Deprecated method. This will cause you to receive warnings stating 'Tried to load unrecognized recipe: bukkit:<ID>'. Please ask the author to give their recipe a static key using NamespacedKey.").printStackTrace(); // Paper
} }

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add openSign method to HumanEntity
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
index 8cc6f8547380d567aef7910ef309193bd79ced09..48bb08cc7c0af6ebb905d1e175ada0fd7944ca48 100644 index 85eec2e57b03c11f4737addb0fa88b7bf29dc9e5..58dbe34ab1b603c2cd53af1625c1f82f8890da01 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java --- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -496,6 +496,26 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder @@ -498,6 +498,26 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
*/ */
@Deprecated @Deprecated
public void setShoulderEntityRight(@Nullable Entity entity); public void setShoulderEntityRight(@Nullable Entity entity);

Datei anzeigen

@ -9,10 +9,10 @@ such as a bow or eating food.
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
index 48bb08cc7c0af6ebb905d1e175ada0fd7944ca48..ee3086661e11d3d8faec30590be7131648d3b82a 100644 index 58dbe34ab1b603c2cd53af1625c1f82f8890da01..9cbb9093e7d8cd21eef6a23c265d68d7d0ee97b8 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java --- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -325,7 +325,9 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder @@ -327,7 +327,9 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
* blocking). * blocking).
* *
* @return Whether their hand is raised * @return Whether their hand is raised

Datei anzeigen

@ -7,10 +7,10 @@ Allows you to determine why an inventory was closed, enabling plugin developers
to "confirm" things based on if it was player triggered close or not. to "confirm" things based on if it was player triggered close or not.
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
index ee3086661e11d3d8faec30590be7131648d3b82a..25cd03f2f3dc0aaa67173c0f3ebfe56402489e24 100644 index 9cbb9093e7d8cd21eef6a23c265d68d7d0ee97b8..3985798654a3085c128144e46f7113b7744b8d14 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java --- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -185,6 +185,15 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder @@ -187,6 +187,15 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
*/ */
public void closeInventory(); public void closeInventory();

Datei anzeigen

@ -22,10 +22,10 @@ index a98fc2ffdae1a2f8f3a312bed95268e105f7f791..91bfeffcdbe47208c7d0ddbe013cd0f1
public static class ExactChoice implements RecipeChoice { public static class ExactChoice implements RecipeChoice {
diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
index 1ef513d4d03ce677ee9c77b91e2cc5553ab91e0b..1012656948e9bf2aa18867cc2409616f3f21501e 100644 index e9bac744c5b173e6767e2de8480a6697969fdbb0..fa03cf187db29896f5af046b311f67881aee0ff4 100644
--- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java --- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java +++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
@@ -179,6 +179,13 @@ public class ShapedRecipe extends CraftingRecipe { @@ -180,6 +180,13 @@ public class ShapedRecipe extends CraftingRecipe {
return this; return this;
} }
@ -40,10 +40,10 @@ index 1ef513d4d03ce677ee9c77b91e2cc5553ab91e0b..1012656948e9bf2aa18867cc2409616f
* Get a copy of the ingredients map. * Get a copy of the ingredients map.
* *
diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
index d6e38c7ccfe3b6e85eafb611da20b1a29fb74d97..b8ac602cd2718d615ec243ce648951a1a46c26ec 100644 index a7513c1aa09b88e3f99e7db40661fd83e682de96..63a233cc819d8d6995d14b9dbfabc14d89af54cc 100644
--- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java --- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java +++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
@@ -131,6 +131,40 @@ public class ShapelessRecipe extends CraftingRecipe { @@ -132,6 +132,40 @@ public class ShapelessRecipe extends CraftingRecipe {
return this; return this;
} }
@ -84,7 +84,7 @@ index d6e38c7ccfe3b6e85eafb611da20b1a29fb74d97..b8ac602cd2718d615ec243ce648951a1
/** /**
* Removes an ingredient from the list. * Removes an ingredient from the list.
* *
@@ -154,7 +188,7 @@ public class ShapelessRecipe extends CraftingRecipe { @@ -155,7 +189,7 @@ public class ShapelessRecipe extends CraftingRecipe {
*/ */
@NotNull @NotNull
public ShapelessRecipe removeIngredient(@NotNull Material ingredient) { public ShapelessRecipe removeIngredient(@NotNull Material ingredient) {
@ -93,7 +93,7 @@ index d6e38c7ccfe3b6e85eafb611da20b1a29fb74d97..b8ac602cd2718d615ec243ce648951a1
} }
/** /**
@@ -181,7 +215,7 @@ public class ShapelessRecipe extends CraftingRecipe { @@ -182,7 +216,7 @@ public class ShapelessRecipe extends CraftingRecipe {
*/ */
@NotNull @NotNull
public ShapelessRecipe removeIngredient(int count, @NotNull Material ingredient) { public ShapelessRecipe removeIngredient(int count, @NotNull Material ingredient) {

Datei anzeigen

@ -453,7 +453,7 @@ index 48aecc9421c500137bbef1dfe3bec8de277c3ff9..aff858346776386f1288b648b221404f
return note; return note;
} }
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index 3bd96bbd35b657a6030d744e86622e616c2c3b08..5529e227781cd2411de9c6581a1cb1255ce9bb20 100644 index d1906d150a7d4c4852e085d6fd480aec317c22e4..e9edc8c17cbd29cfdad31df13acb15bab2304735 100644
--- a/src/main/java/org/bukkit/Registry.java --- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java +++ b/src/main/java/org/bukkit/Registry.java
@@ -220,14 +220,12 @@ public interface Registry<T extends Keyed> extends Iterable<T> { @@ -220,14 +220,12 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
@ -1067,16 +1067,28 @@ index 53119742beda00a38111063243665bb995ae2188..2d084214e991fecc51f8e18e3d733e43
public class CampfireStartEvent extends InventoryBlockStartEvent { public class CampfireStartEvent extends InventoryBlockStartEvent {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
diff --git a/src/main/java/org/bukkit/event/block/CrafterCraftEvent.java b/src/main/java/org/bukkit/event/block/CrafterCraftEvent.java
index f4efb2190ae4b1fa1823d5c97ad518c6d34f0a1a..3d6c0ecc70a748b8508b55513f9d5fa6b4bd6353 100644
--- a/src/main/java/org/bukkit/event/block/CrafterCraftEvent.java
+++ b/src/main/java/org/bukkit/event/block/CrafterCraftEvent.java
@@ -17,6 +17,7 @@ public class CrafterCraftEvent extends BlockEvent implements Cancellable {
private ItemStack result;
private boolean cancelled;
+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - fix upstream annotation mistakes
public CrafterCraftEvent(@NotNull Block theBlock, @NotNull CraftingRecipe recipe, @NotNull ItemStack result) {
super(theBlock);
this.result = result;
diff --git a/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java b/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java diff --git a/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java b/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java
index f2edd4a9357832e9dec3fb0aafa006335d7b289b..f05ce4fd6c4bbd79edc5f65e7edd1e4a63e93fb8 100644 index 7ae338bcecff2ce25939035181457ced505b3a49..27564727edbd9f093e3a021ce6f30e1146a8ddbb 100644
--- a/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java --- a/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java
+++ b/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java +++ b/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java
@@ -23,7 +23,7 @@ public class PrepareItemEnchantEvent extends InventoryEvent implements Cancellab @@ -23,7 +23,7 @@ public class PrepareItemEnchantEvent extends InventoryEvent implements Cancellab
private boolean cancelled; private boolean cancelled;
private final Player enchanter; private final Player enchanter;
- public PrepareItemEnchantEvent(@NotNull final Player enchanter, @NotNull InventoryView view, @NotNull final Block table, @NotNull final ItemStack item, @NotNull final EnchantmentOffer[] offers, final int bonus) { - public PrepareItemEnchantEvent(@NotNull final Player enchanter, @NotNull EnchantmentView view, @NotNull final Block table, @NotNull final ItemStack item, @NotNull final EnchantmentOffer[] offers, final int bonus) {
+ public PrepareItemEnchantEvent(@NotNull final Player enchanter, @NotNull InventoryView view, @NotNull final Block table, @NotNull final ItemStack item, @org.jetbrains.annotations.Nullable final EnchantmentOffer @NotNull [] offers, final int bonus) { // Paper - offers can contain null values + public PrepareItemEnchantEvent(@NotNull final Player enchanter, @NotNull EnchantmentView view, @NotNull final Block table, @NotNull final ItemStack item, @org.jetbrains.annotations.Nullable final EnchantmentOffer @NotNull [] offers, final int bonus) { // Paper - offers can contain null values
super(view); super(view);
this.enchanter = enchanter; this.enchanter = enchanter;
this.table = table; this.table = table;
@ -1497,10 +1509,10 @@ index f1a48eab1a357ae64545e1f1dc941c383cff8707..466d1bd7089b76f48f953e1a51c611ec
/** /**
* Checks if the inventory contains any ItemStacks with the given * Checks if the inventory contains any ItemStacks with the given
diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/java/org/bukkit/inventory/InventoryView.java diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/java/org/bukkit/inventory/InventoryView.java
index 5954dff2134654bb0ccc3b4c3b51a8e1ca77f6c9..72f93377b60a3b6a08b8c8264ee7313e89c15da0 100644 index ebc14022c9ef9b0b3331ee53e96a32667e4762e0..2b2c5faabce1628bd2e82a840dc97fe79bb57856 100644
--- a/src/main/java/org/bukkit/inventory/InventoryView.java --- a/src/main/java/org/bukkit/inventory/InventoryView.java
+++ b/src/main/java/org/bukkit/inventory/InventoryView.java +++ b/src/main/java/org/bukkit/inventory/InventoryView.java
@@ -121,9 +121,9 @@ public interface InventoryView { @@ -123,9 +123,9 @@ public interface InventoryView {
* Gets the id of this view. * Gets the id of this view.
* *
* @return the id of this view * @return the id of this view
@ -1512,7 +1524,7 @@ index 5954dff2134654bb0ccc3b4c3b51a8e1ca77f6c9..72f93377b60a3b6a08b8c8264ee7313e
public int getId() { public int getId() {
return id; return id;
} }
@@ -193,10 +193,10 @@ public interface InventoryView { @@ -195,10 +195,10 @@ public interface InventoryView {
/** /**
* Get the item on the cursor of one of the viewing players. * Get the item on the cursor of one of the viewing players.
* *
@ -1627,10 +1639,10 @@ index 476fe14faa39f02444cab8ad95d4401033dc6938..2c54660dc1fbc7c1232096797a23cae1
/** /**
diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
index 1012656948e9bf2aa18867cc2409616f3f21501e..aa3b3070126f1c492f004ec7599eeb379b58f207 100644 index fa03cf187db29896f5af046b311f67881aee0ff4..295d82dd73b600e9436d2bbec0e11dbeaf78bbf4 100644
--- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java --- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java +++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
@@ -106,8 +106,10 @@ public class ShapedRecipe extends CraftingRecipe { @@ -107,8 +107,10 @@ public class ShapedRecipe extends CraftingRecipe {
* @return The changed recipe, so you can chain calls. * @return The changed recipe, so you can chain calls.
* @throws IllegalArgumentException if the {@code key} is a space character * @throws IllegalArgumentException if the {@code key} is a space character
* @throws IllegalArgumentException if the {@code key} does not appear in the shape. * @throws IllegalArgumentException if the {@code key} does not appear in the shape.
@ -1641,7 +1653,7 @@ index 1012656948e9bf2aa18867cc2409616f3f21501e..aa3b3070126f1c492f004ec7599eeb37
public ShapedRecipe setIngredient(char key, @NotNull MaterialData ingredient) { public ShapedRecipe setIngredient(char key, @NotNull MaterialData ingredient) {
return setIngredient(key, ingredient.getItemType(), ingredient.getData()); return setIngredient(key, ingredient.getItemType(), ingredient.getData());
} }
@@ -190,7 +192,9 @@ public class ShapedRecipe extends CraftingRecipe { @@ -191,7 +193,9 @@ public class ShapedRecipe extends CraftingRecipe {
* Get a copy of the ingredients map. * Get a copy of the ingredients map.
* *
* @return The mapping of character to ingredients. * @return The mapping of character to ingredients.
@ -1652,10 +1664,10 @@ index 1012656948e9bf2aa18867cc2409616f3f21501e..aa3b3070126f1c492f004ec7599eeb37
public Map<Character, ItemStack> getIngredientMap() { public Map<Character, ItemStack> getIngredientMap() {
HashMap<Character, ItemStack> result = new HashMap<Character, ItemStack>(); HashMap<Character, ItemStack> result = new HashMap<Character, ItemStack>();
diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
index b8ac602cd2718d615ec243ce648951a1a46c26ec..beb798482479c58a8628c314b510ab6349576ce8 100644 index 63a233cc819d8d6995d14b9dbfabc14d89af54cc..3bf5064cd6ceb05ea98b18993da46c67be140115 100644
--- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java --- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java +++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
@@ -43,8 +43,10 @@ public class ShapelessRecipe extends CraftingRecipe { @@ -44,8 +44,10 @@ public class ShapelessRecipe extends CraftingRecipe {
* *
* @param ingredient The ingredient to add. * @param ingredient The ingredient to add.
* @return The changed recipe, so you can chain calls. * @return The changed recipe, so you can chain calls.
@ -1666,7 +1678,7 @@ index b8ac602cd2718d615ec243ce648951a1a46c26ec..beb798482479c58a8628c314b510ab63
public ShapelessRecipe addIngredient(@NotNull MaterialData ingredient) { public ShapelessRecipe addIngredient(@NotNull MaterialData ingredient) {
return addIngredient(1, ingredient); return addIngredient(1, ingredient);
} }
@@ -80,8 +82,10 @@ public class ShapelessRecipe extends CraftingRecipe { @@ -81,8 +83,10 @@ public class ShapelessRecipe extends CraftingRecipe {
* @param count How many to add (can't be more than 9!) * @param count How many to add (can't be more than 9!)
* @param ingredient The ingredient to add. * @param ingredient The ingredient to add.
* @return The changed recipe, so you can chain calls. * @return The changed recipe, so you can chain calls.
@ -1677,7 +1689,7 @@ index b8ac602cd2718d615ec243ce648951a1a46c26ec..beb798482479c58a8628c314b510ab63
public ShapelessRecipe addIngredient(int count, @NotNull MaterialData ingredient) { public ShapelessRecipe addIngredient(int count, @NotNull MaterialData ingredient) {
return addIngredient(count, ingredient.getItemType(), ingredient.getData()); return addIngredient(count, ingredient.getItemType(), ingredient.getData());
} }
@@ -198,8 +202,10 @@ public class ShapelessRecipe extends CraftingRecipe { @@ -199,8 +203,10 @@ public class ShapelessRecipe extends CraftingRecipe {
* *
* @param ingredient The ingredient to remove * @param ingredient The ingredient to remove
* @return The changed recipe. * @return The changed recipe.
@ -1688,7 +1700,7 @@ index b8ac602cd2718d615ec243ce648951a1a46c26ec..beb798482479c58a8628c314b510ab63
public ShapelessRecipe removeIngredient(@NotNull MaterialData ingredient) { public ShapelessRecipe removeIngredient(@NotNull MaterialData ingredient) {
return removeIngredient(ingredient.getItemType(), ingredient.getData()); return removeIngredient(ingredient.getItemType(), ingredient.getData());
} }
@@ -226,8 +232,10 @@ public class ShapelessRecipe extends CraftingRecipe { @@ -227,8 +233,10 @@ public class ShapelessRecipe extends CraftingRecipe {
* @param count The number of copies to remove. * @param count The number of copies to remove.
* @param ingredient The ingredient to remove. * @param ingredient The ingredient to remove.
* @return The changed recipe. * @return The changed recipe.
@ -1699,7 +1711,7 @@ index b8ac602cd2718d615ec243ce648951a1a46c26ec..beb798482479c58a8628c314b510ab63
public ShapelessRecipe removeIngredient(int count, @NotNull MaterialData ingredient) { public ShapelessRecipe removeIngredient(int count, @NotNull MaterialData ingredient) {
return removeIngredient(count, ingredient.getItemType(), ingredient.getData()); return removeIngredient(count, ingredient.getItemType(), ingredient.getData());
} }
@@ -277,7 +285,9 @@ public class ShapelessRecipe extends CraftingRecipe { @@ -278,7 +286,9 @@ public class ShapelessRecipe extends CraftingRecipe {
* Get the list of ingredients used for this recipe. * Get the list of ingredients used for this recipe.
* *
* @return The input list * @return The input list

Datei anzeigen

@ -6,12 +6,12 @@ Subject: [PATCH] Add item slot convenience methods
Co-authored-by: Janet Blackquill <uhhadd@gmail.com> Co-authored-by: Janet Blackquill <uhhadd@gmail.com>
diff --git a/src/main/java/org/bukkit/inventory/AnvilInventory.java b/src/main/java/org/bukkit/inventory/AnvilInventory.java diff --git a/src/main/java/org/bukkit/inventory/AnvilInventory.java b/src/main/java/org/bukkit/inventory/AnvilInventory.java
index 52519cd877017704b53d36088d4d4c28f8f27397..c60be4fd24c7fdf65251dd6169e5e1ac3b588d95 100644 index 4f484df010dabf03ac4712996a0fd4d8f3649b59..f1f97a85ec713c05c882d7588f4a3e4a017f4795 100644
--- a/src/main/java/org/bukkit/inventory/AnvilInventory.java --- a/src/main/java/org/bukkit/inventory/AnvilInventory.java
+++ b/src/main/java/org/bukkit/inventory/AnvilInventory.java +++ b/src/main/java/org/bukkit/inventory/AnvilInventory.java
@@ -63,4 +63,64 @@ public interface AnvilInventory extends Inventory { @@ -78,4 +78,64 @@ public interface AnvilInventory extends Inventory {
* @param levels the maximum experience cost
*/ */
@Deprecated(forRemoval = true, since = "1.21")
void setMaximumRepairCost(int levels); void setMaximumRepairCost(int levels);
+ +
+ // Paper start + // Paper start

Datei anzeigen

@ -8,10 +8,10 @@ Adds a new method to fetch the location of a player's bed without generating any
getPotentialBedLocation - Gets the last known location of a player's bed. This does not preform any check if the bed is still valid and does not load any chunks. getPotentialBedLocation - Gets the last known location of a player's bed. This does not preform any check if the bed is still valid and does not load any chunks.
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
index 25cd03f2f3dc0aaa67173c0f3ebfe56402489e24..ccaaf2b6f6424ec7c7d298ceabdc3e60a7917705 100644 index 3985798654a3085c128144e46f7113b7744b8d14..11c5846848a6631a9376934622caeadd448b0391 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java --- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -275,6 +275,19 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder @@ -277,6 +277,19 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
*/ */
public int getSleepTicks(); public int getSleepTicks();

Datei anzeigen

@ -93,7 +93,7 @@ index 0000000000000000000000000000000000000000..c305c606bef93866993095cec5f50e19
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java diff --git a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java
index 8977f7609431c3c46324a82de84d4a32f4b71c57..d884ecf40af964e718168ac055dd6c672d108eb1 100644 index 8a5be3f0322ac19aeac3f00df54add0e73bc87ed..d2b4b2e9385e7c1e0e1e42886481b99ecc8dcf8e 100644
--- a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java --- a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java
+++ b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java +++ b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java
@@ -10,9 +10,9 @@ import org.jetbrains.annotations.Nullable; @@ -10,9 +10,9 @@ import org.jetbrains.annotations.Nullable;
@ -106,10 +106,10 @@ index 8977f7609431c3c46324a82de84d4a32f4b71c57..d884ecf40af964e718168ac055dd6c67
- private static final HandlerList handlers = new HandlerList(); - private static final HandlerList handlers = new HandlerList();
+ // Paper - move HandlerList to PrepareInventoryResultEvent + // Paper - move HandlerList to PrepareInventoryResultEvent
public PrepareAnvilEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) { public PrepareAnvilEvent(@NotNull AnvilView inventory, @Nullable ItemStack result) {
super(inventory, result); super(inventory, result);
@@ -38,14 +38,5 @@ public class PrepareAnvilEvent extends PrepareInventoryResultEvent { @@ -44,14 +44,5 @@ public class PrepareAnvilEvent extends PrepareInventoryResultEvent {
super.setResult(result); return (AnvilView) super.getView();
} }
- @NotNull - @NotNull

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add additional open container api to HumanEntity
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
index ccaaf2b6f6424ec7c7d298ceabdc3e60a7917705..b980d55b68ed9da78c5cd19f369bb00dccbf08e1 100644 index 11c5846848a6631a9376934622caeadd448b0391..f20b0a439c4d5cd2c6caa70a46b1b49f8ab23425 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java --- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -180,6 +180,92 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder @@ -182,6 +182,92 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
@Nullable @Nullable
public InventoryView openMerchant(@NotNull Merchant merchant, boolean force); public InventoryView openMerchant(@NotNull Merchant merchant, boolean force);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Expose LivingEntity hurt direction
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
index b980d55b68ed9da78c5cd19f369bb00dccbf08e1..4d6ceca22d98a3e46aa26ef26176c5417a5ccf35 100644 index f20b0a439c4d5cd2c6caa70a46b1b49f8ab23425..937c136f2499bd1660989d14c0f50a7ef9a1a2b6 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java --- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -354,6 +354,16 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder @@ -356,6 +356,16 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
*/ */
public void setCooldown(@NotNull Material material, int ticks); public void setCooldown(@NotNull Material material, int ticks);

Datei anzeigen

@ -206,10 +206,22 @@ index e0f652117e585882693736de8165ae9c689e1d68..fbe14c327ee9c1ac07893853ca7c699e
return server.getRegistry(tClass); return server.getRegistry(tClass);
} }
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index 5529e227781cd2411de9c6581a1cb1255ce9bb20..f99e68f160deba42e2833fa0f81df4c17bf68ec7 100644 index e9edc8c17cbd29cfdad31df13acb15bab2304735..d855e703339e6f6e50fcb19e8954a9434e718b2f 100644
--- a/src/main/java/org/bukkit/Registry.java --- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java +++ b/src/main/java/org/bukkit/Registry.java
@@ -102,7 +102,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> { @@ -87,8 +87,10 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* Server banner patterns.
*
* @see PatternType
+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#BANNER_PATTERN}
*/
- Registry<PatternType> BANNER_PATTERN = Objects.requireNonNull(Bukkit.getRegistry(PatternType.class), "No registry present for Pattern Type. This is a bug.");
+ @Deprecated(since = "1.21") // Paper
+ Registry<PatternType> BANNER_PATTERN = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(PatternType.class), "No registry present for PatternType. This is a bug."); // Paper
/**
* Server biomes.
*
@@ -102,7 +104,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* @apiNote BlockType is not ready for public usage yet * @apiNote BlockType is not ready for public usage yet
*/ */
@ApiStatus.Internal @ApiStatus.Internal
@ -218,7 +230,7 @@ index 5529e227781cd2411de9c6581a1cb1255ce9bb20..f99e68f160deba42e2833fa0f81df4c1
/** /**
* Custom boss bars. * Custom boss bars.
* *
@@ -134,13 +134,15 @@ public interface Registry<T extends Keyed> extends Iterable<T> { @@ -134,13 +136,15 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* *
* @see Cat.Type * @see Cat.Type
*/ */
@ -236,7 +248,7 @@ index 5529e227781cd2411de9c6581a1cb1255ce9bb20..f99e68f160deba42e2833fa0f81df4c1
/** /**
* Server entity types. * Server entity types.
* *
@@ -152,7 +154,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> { @@ -152,7 +156,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* *
* @see MusicInstrument * @see MusicInstrument
*/ */
@ -245,7 +257,7 @@ index 5529e227781cd2411de9c6581a1cb1255ce9bb20..f99e68f160deba42e2833fa0f81df4c1
/** /**
* Server item types. * Server item types.
* *
@@ -160,7 +162,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> { @@ -160,7 +164,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* @apiNote ItemType is not ready for public usage yet * @apiNote ItemType is not ready for public usage yet
*/ */
@ApiStatus.Internal @ApiStatus.Internal
@ -254,7 +266,7 @@ index 5529e227781cd2411de9c6581a1cb1255ce9bb20..f99e68f160deba42e2833fa0f81df4c1
/** /**
* Default server loot tables. * Default server loot tables.
* *
@@ -178,7 +180,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> { @@ -178,7 +182,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* *
* @see PotionEffectType * @see PotionEffectType
*/ */
@ -263,7 +275,7 @@ index 5529e227781cd2411de9c6581a1cb1255ce9bb20..f99e68f160deba42e2833fa0f81df4c1
/** /**
* Server particles. * Server particles.
* *
@@ -201,14 +203,16 @@ public interface Registry<T extends Keyed> extends Iterable<T> { @@ -201,14 +205,16 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* Server structures. * Server structures.
* *
* @see Structure * @see Structure
@ -282,7 +294,7 @@ index 5529e227781cd2411de9c6581a1cb1255ce9bb20..f99e68f160deba42e2833fa0f81df4c1
/** /**
* Sound keys. * Sound keys.
* *
@@ -219,40 +223,47 @@ public interface Registry<T extends Keyed> extends Iterable<T> { @@ -219,40 +225,47 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* Trim materials. * Trim materials.
* *
* @see TrimMaterial * @see TrimMaterial
@ -337,7 +349,7 @@ index 5529e227781cd2411de9c6581a1cb1255ce9bb20..f99e68f160deba42e2833fa0f81df4c1
/** /**
* Memory Keys. * Memory Keys.
* *
@@ -289,25 +300,27 @@ public interface Registry<T extends Keyed> extends Iterable<T> { @@ -289,25 +302,27 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* *
* @see Frog.Variant * @see Frog.Variant
*/ */

Datei anzeigen

@ -6,21 +6,44 @@ Subject: [PATCH] Add missing effects
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/org/bukkit/Effect.java b/src/main/java/org/bukkit/Effect.java diff --git a/src/main/java/org/bukkit/Effect.java b/src/main/java/org/bukkit/Effect.java
index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..f0e595c754afbbf2729ff093262459ac8010ce85 100644 index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..8a346d7a4ce07e0a73d7a1d1370321d4fb538547 100644
--- a/src/main/java/org/bukkit/Effect.java --- a/src/main/java/org/bukkit/Effect.java
+++ b/src/main/java/org/bukkit/Effect.java +++ b/src/main/java/org/bukkit/Effect.java
@@ -131,9 +131,9 @@ public enum Effect { @@ -97,7 +97,7 @@ public enum Effect {
*/
EXTINGUISH(1009, Type.SOUND),
/** /**
* Sound of a block breaking. Needs block ID as additional info. - * A song from a record. Needs the record item ID as additional info
+ * A song from a record. Needs the record {@link Material} as additional info.
*/
RECORD_PLAY(1010, Type.SOUND, Material.class),
/**
@@ -125,20 +125,20 @@ public enum Effect {
*/
ZOMBIE_DESTROY_DOOR(1021, Type.SOUND),
/**
- * A visual smoke effect. Needs direction as additional info.
+ * A visual smoke effect. Needs a {@link BlockFace} direction as additional info.
*/
SMOKE(2000, Type.VISUAL, BlockFace.class),
/**
- * Sound of a block breaking. Needs block ID as additional info.
+ * Sound of a block breaking. Needs {@link org.bukkit.block.data.BlockData} as additional info.
*/ */
- STEP_SOUND(2001, Type.SOUND, Material.class), - STEP_SOUND(2001, Type.SOUND, Material.class),
+ STEP_SOUND(2001, Type.SOUND, org.bukkit.block.data.BlockData.class, Material.class), // Paper - block data is more correct, but the impl of the mtehods will still work with Material + STEP_SOUND(2001, Type.SOUND, org.bukkit.block.data.BlockData.class, Material.class), // Paper - block data is more correct, but the impl of the mtehods will still work with Material
/** /**
- * Visual effect of a splash potion breaking. Needs potion data value as - * Visual effect of a splash potion breaking. Needs potion data value as
+ * Visual effect of a splash potion breaking. Needs color data value as + * Visual effect of a splash potion breaking. Needs {@link Color} data value as
* additional info. * additional info.
*/ */
POTION_BREAK(2002, Type.VISUAL, Color.class), POTION_BREAK(2002, Type.VISUAL, Color.class),
/**
- * Visual effect of an instant splash potion breaking. Needs color data
+ * Visual effect of an instant splash potion breaking. Needs {@link Color} data
* value as additional info.
*/
INSTANT_POTION_BREAK(2007, Type.VISUAL, Color.class),
@@ -168,7 +168,9 @@ public enum Effect { @@ -168,7 +168,9 @@ public enum Effect {
PORTAL_TRAVEL(1032, Type.SOUND), PORTAL_TRAVEL(1032, Type.SOUND),
/** /**
@ -41,7 +64,16 @@ index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..f0e595c754afbbf2729ff093262459ac
VILLAGER_PLANT_GROW(2005, Type.VISUAL, Integer.class), VILLAGER_PLANT_GROW(2005, Type.VISUAL, Integer.class),
/** /**
* The sound/particles used by the enderdragon's breath * The sound/particles used by the enderdragon's breath
@@ -336,21 +340,121 @@ public enum Effect { @@ -319,7 +323,7 @@ public enum Effect {
* The particles shown when a lightning hits a lightning rod or oxidized
* copper.
*
- * Data is the axis at which the particle should be shown. If no data is
+ * Data is the {@link Axis} at which the particle should be shown. If no data is
* provided it will show the particles at the block faces.
*/
ELECTRIC_SPARK(3002, Type.VISUAL, Axis.class),
@@ -336,21 +340,124 @@ public enum Effect {
* block. * block.
*/ */
OXIDISED_COPPER_SCRAPE(3005, Type.VISUAL), OXIDISED_COPPER_SCRAPE(3005, Type.VISUAL),
@ -89,6 +121,9 @@ index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..f0e595c754afbbf2729ff093262459ac
+ +
+ PARTICLES_SCULK_SHRIEK(3007, Type.SOUND), + PARTICLES_SCULK_SHRIEK(3007, Type.SOUND),
+ +
+ /**
+ * Requires a {@link org.bukkit.block.data.BlockData} param
+ */
+ PARTICLES_AND_SOUND_BRUSH_BLOCK_COMPLETE(3008, Type.VISUAL, org.bukkit.block.data.BlockData.class), + PARTICLES_AND_SOUND_BRUSH_BLOCK_COMPLETE(3008, Type.VISUAL, org.bukkit.block.data.BlockData.class),
+ +
+ PARTICLES_EGG_CRACK(3009, Type.VISUAL), + PARTICLES_EGG_CRACK(3009, Type.VISUAL),
@ -167,7 +202,7 @@ index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..f0e595c754afbbf2729ff093262459ac
} }
/** /**
@@ -366,8 +470,10 @@ public enum Effect { @@ -366,8 +473,10 @@ public enum Effect {
/** /**
* @return The type of the effect. * @return The type of the effect.
@ -178,7 +213,7 @@ index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..f0e595c754afbbf2729ff093262459ac
public Type getType() { public Type getType() {
return this.type; return this.type;
} }
@@ -378,8 +484,15 @@ public enum Effect { @@ -378,8 +487,15 @@ public enum Effect {
*/ */
@Nullable @Nullable
public Class<?> getData() { public Class<?> getData() {
@ -195,7 +230,7 @@ index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..f0e595c754afbbf2729ff093262459ac
/** /**
* Gets the Effect associated with the given ID. * Gets the Effect associated with the given ID.
@@ -396,12 +509,26 @@ public enum Effect { @@ -396,12 +512,26 @@ public enum Effect {
static { static {
for (Effect effect : values()) { for (Effect effect : values()) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] add isDeeplySleeping to HumanEntity
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
index 4d6ceca22d98a3e46aa26ef26176c5417a5ccf35..58c842a1fd946d94ae29c7d2439aaf77e47f69b4 100644 index 937c136f2499bd1660989d14c0f50a7ef9a1a2b6..b1b18886fc63a4854c2858ff9869da70e92dae26 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java --- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -364,6 +364,15 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder @@ -366,6 +366,15 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
void setHurtDirection(float hurtDirection); void setHurtDirection(float hurtDirection);
// Paper end // Paper end

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] More PotionEffectType API
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index a583d26883c8b7012203e128cd64113df94307c1..4d3e0b90579b33ff93fc565e8ee99a01b690c62b 100644 index 5dbbc4eb764650395c6ebaaf5fdf0466ca107439..0ee9a8728035217bb95c7fba917b45a5ef2ea533 100644
--- a/src/main/java/org/bukkit/Registry.java --- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java +++ b/src/main/java/org/bukkit/Registry.java
@@ -321,6 +321,33 @@ public interface Registry<T extends Keyed> extends Iterable<T> { @@ -323,6 +323,33 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* @see GameEvent * @see GameEvent
*/ */
Registry<GameEvent> GAME_EVENT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.GAME_EVENT); // Paper Registry<GameEvent> GAME_EVENT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.GAME_EVENT); // Paper

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add Player#getFishHook
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
index 58c842a1fd946d94ae29c7d2439aaf77e47f69b4..294de2c073167e7186fbf1d6885fe5951351cc9c 100644 index b1b18886fc63a4854c2858ff9869da70e92dae26..773651350c17cae9058346a590eda758071b7447 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java --- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -392,6 +392,13 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder @@ -394,6 +394,13 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
@Nullable @Nullable
public Location getPotentialBedLocation(); public Location getPotentialBedLocation();
// Paper end // Paper end

Datei anzeigen

@ -54,15 +54,15 @@ index 0000000000000000000000000000000000000000..0d5793790ab6a47525ad330335173612
+ boolean readyToBeSheared(); + boolean readyToBeSheared();
+} +}
diff --git a/src/main/java/org/bukkit/entity/Bogged.java b/src/main/java/org/bukkit/entity/Bogged.java diff --git a/src/main/java/org/bukkit/entity/Bogged.java b/src/main/java/org/bukkit/entity/Bogged.java
index a89f104aa2b2244c075a72c698a9b616c57eaf7c..a36bb84c17120bc578ab01d45f6f12fb1faf9548 100644 index 8b75a505a55a96a5795ac31a2d37307add12cd9e..6296a6f3f3e794677fd3a626376f357c740ec356 100644
--- a/src/main/java/org/bukkit/entity/Bogged.java --- a/src/main/java/org/bukkit/entity/Bogged.java
+++ b/src/main/java/org/bukkit/entity/Bogged.java +++ b/src/main/java/org/bukkit/entity/Bogged.java
@@ -6,5 +6,5 @@ import org.jetbrains.annotations.ApiStatus; @@ -6,5 +6,5 @@ import org.jetbrains.annotations.ApiStatus;
* Represents a Bogged Skeleton. * Represents a Bogged Skeleton.
*/ */
@ApiStatus.Experimental @ApiStatus.Experimental
-public interface Bogged extends AbstractSkeleton { -public interface Bogged extends AbstractSkeleton, Shearable {
+public interface Bogged extends AbstractSkeleton, io.papermc.paper.entity.Shearable { // Paper - Shear API +public interface Bogged extends AbstractSkeleton, Shearable, io.papermc.paper.entity.Shearable { // Paper - Shear API
} }
diff --git a/src/main/java/org/bukkit/entity/MushroomCow.java b/src/main/java/org/bukkit/entity/MushroomCow.java diff --git a/src/main/java/org/bukkit/entity/MushroomCow.java b/src/main/java/org/bukkit/entity/MushroomCow.java
index cef1700834643fe28ed5737578d91ecefbe99e2f..86c0043ef4e1288b6fe2f68a9b6d01c3de2c3454 100644 index cef1700834643fe28ed5737578d91ecefbe99e2f..86c0043ef4e1288b6fe2f68a9b6d01c3de2c3454 100644
@ -77,19 +77,52 @@ index cef1700834643fe28ed5737578d91ecefbe99e2f..86c0043ef4e1288b6fe2f68a9b6d01c3
/** /**
* Checks for the presence of custom potion effects to be applied to the * Checks for the presence of custom potion effects to be applied to the
diff --git a/src/main/java/org/bukkit/entity/Shearable.java b/src/main/java/org/bukkit/entity/Shearable.java
index 0215d20f81bfbef080f86ce46147a38f71310f65..9967c8a52ddd2c7e10db49a3f166731373f1ba45 100644
--- a/src/main/java/org/bukkit/entity/Shearable.java
+++ b/src/main/java/org/bukkit/entity/Shearable.java
@@ -2,20 +2,30 @@ package org.bukkit.entity;
/**
* Represents an entity which can be shorn with shears.
+ * @deprecated Spigots shearable API miserably fails at capturing all entities that may be sheared by a player, like
+ * mushroom cows which, once sheared, convert into normal cows. For such entities, methods like
+ * {@link #setSheared(boolean)} or {@link #isSheared()} make no sense, making this API and interface dead API from
+ * the get-go.
*/
+@Deprecated(forRemoval = true, since = "1.21")
public interface Shearable {
/**
* Gets whether the entity is in its sheared state.
*
* @return Whether the entity is sheared.
+ * @deprecated Use {@link io.papermc.paper.entity.Shearable#readyToBeSheared()} instead.
*/
+ @Deprecated(forRemoval = true, since = "1.21")
boolean isSheared();
/**
* Sets whether the entity is in its sheared state.
*
* @param flag Whether to shear the entity
+ * @deprecated Use {@link io.papermc.paper.entity.Shearable#shear()} instead if applicable.
+ * Some entities cannot be "unsheared".
*/
+ @Deprecated(forRemoval = true, since = "1.21")
void setSheared(boolean flag);
}
diff --git a/src/main/java/org/bukkit/entity/Sheep.java b/src/main/java/org/bukkit/entity/Sheep.java diff --git a/src/main/java/org/bukkit/entity/Sheep.java b/src/main/java/org/bukkit/entity/Sheep.java
index f4ce312ccd927a8b64f4266b35a0a53b85e591f3..97388d46cee225dedc0b61a12e7b60b3424732c8 100644 index 46bc1a0ed9ee320c68a38362c1fa1f31319f01d8..01a0e5b1bb18d7a28d68329c2e2ab78a8df45f8e 100644
--- a/src/main/java/org/bukkit/entity/Sheep.java --- a/src/main/java/org/bukkit/entity/Sheep.java
+++ b/src/main/java/org/bukkit/entity/Sheep.java +++ b/src/main/java/org/bukkit/entity/Sheep.java
@@ -5,7 +5,7 @@ import org.bukkit.material.Colorable; @@ -5,5 +5,5 @@ import org.bukkit.material.Colorable;
/** /**
* Represents a Sheep. * Represents a Sheep.
*/ */
-public interface Sheep extends Animals, Colorable { -public interface Sheep extends Animals, Colorable, Shearable {
+public interface Sheep extends Animals, Colorable, io.papermc.paper.entity.Shearable { // Paper - Shear API +public interface Sheep extends Animals, Colorable, Shearable, io.papermc.paper.entity.Shearable { // Paper - Shear API
}
/**
* @return Whether the sheep is sheared.
diff --git a/src/main/java/org/bukkit/entity/Snowman.java b/src/main/java/org/bukkit/entity/Snowman.java diff --git a/src/main/java/org/bukkit/entity/Snowman.java b/src/main/java/org/bukkit/entity/Snowman.java
index 10f8f6d45ae9280651c3ebddd1f90acbd7d6ff29..7fbfdb07585c7b28acea1f0c1f58ada0cc744441 100644 index 10f8f6d45ae9280651c3ebddd1f90acbd7d6ff29..7fbfdb07585c7b28acea1f0c1f58ada0cc744441 100644
--- a/src/main/java/org/bukkit/entity/Snowman.java --- a/src/main/java/org/bukkit/entity/Snowman.java

Datei anzeigen

@ -104,7 +104,7 @@ index 60fbacee263e55f91ac977f020e390d46024723a..ecff691c3a0878659fb051926ef769ce
/** /**
diff --git a/src/main/java/org/bukkit/entity/Bogged.java b/src/main/java/org/bukkit/entity/Bogged.java diff --git a/src/main/java/org/bukkit/entity/Bogged.java b/src/main/java/org/bukkit/entity/Bogged.java
index a36bb84c17120bc578ab01d45f6f12fb1faf9548..719bccf8638f8ad358d37fa7eeccbc4c08d32868 100644 index 6296a6f3f3e794677fd3a626376f357c740ec356..7d993f8bd18ec1d3260d12f0ff8078a86ee4867d 100644
--- a/src/main/java/org/bukkit/entity/Bogged.java --- a/src/main/java/org/bukkit/entity/Bogged.java
+++ b/src/main/java/org/bukkit/entity/Bogged.java +++ b/src/main/java/org/bukkit/entity/Bogged.java
@@ -5,6 +5,5 @@ import org.jetbrains.annotations.ApiStatus; @@ -5,6 +5,5 @@ import org.jetbrains.annotations.ApiStatus;
@ -112,7 +112,7 @@ index a36bb84c17120bc578ab01d45f6f12fb1faf9548..719bccf8638f8ad358d37fa7eeccbc4c
* Represents a Bogged Skeleton. * Represents a Bogged Skeleton.
*/ */
-@ApiStatus.Experimental -@ApiStatus.Experimental
public interface Bogged extends AbstractSkeleton, io.papermc.paper.entity.Shearable { // Paper - Shear API public interface Bogged extends AbstractSkeleton, Shearable, io.papermc.paper.entity.Shearable { // Paper - Shear API
} }
diff --git a/src/main/java/org/bukkit/entity/Breeze.java b/src/main/java/org/bukkit/entity/Breeze.java diff --git a/src/main/java/org/bukkit/entity/Breeze.java b/src/main/java/org/bukkit/entity/Breeze.java
index a75e725805c193a408683885cba83ca168347165..254bc6e18961a72f471334cc0535e3c7a9d70012 100644 index a75e725805c193a408683885cba83ca168347165..254bc6e18961a72f471334cc0535e3c7a9d70012 100644

Datei anzeigen

@ -31,10 +31,10 @@ index 62d2b3f950860dee0898d77b0a29635c3f9a7e23..704dba92f9246ef398ed8d162ebee3cf
@Override @Override
public @NotNull String translationKey() { public @NotNull String translationKey() {
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index 4d3e0b90579b33ff93fc565e8ee99a01b690c62b..36a8f6082f111a1cbb25e0ff3c968a89f02611a0 100644 index 0ee9a8728035217bb95c7fba917b45a5ef2ea533..cd1e38debbec745dd13cd895327f544dcf42594d 100644
--- a/src/main/java/org/bukkit/Registry.java --- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java +++ b/src/main/java/org/bukkit/Registry.java
@@ -357,6 +357,79 @@ public interface Registry<T extends Keyed> extends Iterable<T> { @@ -359,6 +359,79 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
@Nullable @Nullable
T get(@NotNull NamespacedKey key); T get(@NotNull NamespacedKey key);
@ -114,7 +114,7 @@ index 4d3e0b90579b33ff93fc565e8ee99a01b690c62b..36a8f6082f111a1cbb25e0ff3c968a89
/** /**
* Returns a new stream, which contains all registry items, which are registered to the registry. * Returns a new stream, which contains all registry items, which are registered to the registry.
* *
@@ -431,5 +504,12 @@ public interface Registry<T extends Keyed> extends Iterable<T> { @@ -433,5 +506,12 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
public Class<T> getType() { public Class<T> getType() {
return this.type; return this.type;
} }
@ -128,12 +128,12 @@ index 4d3e0b90579b33ff93fc565e8ee99a01b690c62b..36a8f6082f111a1cbb25e0ff3c968a89
} }
} }
diff --git a/src/main/java/org/bukkit/block/banner/PatternType.java b/src/main/java/org/bukkit/block/banner/PatternType.java diff --git a/src/main/java/org/bukkit/block/banner/PatternType.java b/src/main/java/org/bukkit/block/banner/PatternType.java
index 6a6be0287255cf38a735bfc83ec91644dc96b903..1883183157c875d87656fdc86a589e9b95dc4895 100644 index 9e90572745909538e942b7fbe788b5286c6cc9a3..100f93358e0a1fa8507775a2afd29314ff353a87 100644
--- a/src/main/java/org/bukkit/block/banner/PatternType.java --- a/src/main/java/org/bukkit/block/banner/PatternType.java
+++ b/src/main/java/org/bukkit/block/banner/PatternType.java +++ b/src/main/java/org/bukkit/block/banner/PatternType.java
@@ -69,6 +69,13 @@ public enum PatternType implements Keyed { @@ -56,6 +56,13 @@ public interface PatternType extends OldEnum<PatternType>, Keyed {
this.key = NamespacedKey.minecraft(key); PatternType FLOW = getType("flow");
} PatternType GUSTER = getType("guster");
+ // Paper start - deprecate getKey + // Paper start - deprecate getKey
+ /** + /**
@ -144,7 +144,7 @@ index 6a6be0287255cf38a735bfc83ec91644dc96b903..1883183157c875d87656fdc86a589e9b
+ // Paper end - deprecate getKey + // Paper end - deprecate getKey
@Override @Override
@NotNull @NotNull
public NamespacedKey getKey() { public NamespacedKey getKey();
diff --git a/src/main/java/org/bukkit/generator/structure/Structure.java b/src/main/java/org/bukkit/generator/structure/Structure.java diff --git a/src/main/java/org/bukkit/generator/structure/Structure.java b/src/main/java/org/bukkit/generator/structure/Structure.java
index 1a766e68713d4014783b3224b9395644116784fa..978054ee364f9a3330525b9b50da5325ebb6ef57 100644 index 1a766e68713d4014783b3224b9395644116784fa..978054ee364f9a3330525b9b50da5325ebb6ef57 100644
--- a/src/main/java/org/bukkit/generator/structure/Structure.java --- a/src/main/java/org/bukkit/generator/structure/Structure.java

Datei anzeigen

@ -87,7 +87,7 @@ index 0000000000000000000000000000000000000000..39ac768b3c5148544cb1aaf2c817e661
+} +}
diff --git a/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContextImpl.java b/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContextImpl.java diff --git a/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContextImpl.java b/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContextImpl.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..1d9bed6691f581529c53b577b26f1d0f902ccb0d index 0000000000000000000000000000000000000000..c9c0ce750f93ae55e0b2d322a738919474d2d5dd
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContextImpl.java +++ b/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContextImpl.java
@@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
@ -95,16 +95,16 @@ index 0000000000000000000000000000000000000000..1d9bed6691f581529c53b577b26f1d0f
+ +
+import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.NotNull;
+ +
+record TooltipContextImpl(boolean isCreative, boolean isAdvanced) implements TooltipContext { +record TooltipContextImpl(boolean isAdvanced, boolean isCreative) implements TooltipContext {
+ +
+ @Override + @Override
+ public @NotNull TooltipContext asCreative() { + public @NotNull TooltipContext asCreative() {
+ return new TooltipContextImpl(true, this.isAdvanced); + return new TooltipContextImpl(this.isAdvanced, true);
+ } + }
+ +
+ @Override + @Override
+ public @NotNull TooltipContext asAdvanced() { + public @NotNull TooltipContext asAdvanced() {
+ return new TooltipContextImpl(this.isCreative, true); + return new TooltipContextImpl(true, this.isCreative);
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java

Datei anzeigen

@ -40,18 +40,18 @@ index f7fa79393aef40027446b78bac8e9490cfafd8bc..07906ca1a9b39fcc6774870daa498402
} }
diff --git a/src/main/java/org/bukkit/inventory/CraftingRecipe.java b/src/main/java/org/bukkit/inventory/CraftingRecipe.java diff --git a/src/main/java/org/bukkit/inventory/CraftingRecipe.java b/src/main/java/org/bukkit/inventory/CraftingRecipe.java
index e4bf772f7e06f38215bee68f089b15a4fcb12817..37024b4736dd3897490ca51d08cf07901b01d59f 100644 index 1b7b07715067014bf3d35002ae1655793248b426..5bf55b40fbf6ec708f37d90bd0853fe7dd8fffd9 100644
--- a/src/main/java/org/bukkit/inventory/CraftingRecipe.java --- a/src/main/java/org/bukkit/inventory/CraftingRecipe.java
+++ b/src/main/java/org/bukkit/inventory/CraftingRecipe.java +++ b/src/main/java/org/bukkit/inventory/CraftingRecipe.java
@@ -18,7 +18,7 @@ public abstract class CraftingRecipe implements Recipe, Keyed { @@ -99,7 +99,7 @@ public abstract class CraftingRecipe implements Recipe, Keyed {
@ApiStatus.Internal
protected CraftingRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result) { @NotNull
Preconditions.checkArgument(key != null, "key cannot be null"); protected static ItemStack checkResult(@NotNull ItemStack result) {
- Preconditions.checkArgument(result.getType() != Material.AIR, "Recipe must have non-AIR result."); - Preconditions.checkArgument(result.getType() != Material.AIR, "Recipe must have non-AIR result.");
+ Preconditions.checkArgument(!result.isEmpty(), "Recipe cannot have an empty result."); // Paper + Preconditions.checkArgument(!result.isEmpty(), "Recipe cannot have an empty result."); // Paper
this.key = key; return result;
this.output = new ItemStack(result);
} }
}
diff --git a/src/main/java/org/bukkit/inventory/EmptyRecipeChoice.java b/src/main/java/org/bukkit/inventory/EmptyRecipeChoice.java diff --git a/src/main/java/org/bukkit/inventory/EmptyRecipeChoice.java b/src/main/java/org/bukkit/inventory/EmptyRecipeChoice.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..ed0ab6163f47ec843ba4f7ea4a98bb2fa315eaa1 index 0000000000000000000000000000000000000000..ed0ab6163f47ec843ba4f7ea4a98bb2fa315eaa1
@ -211,10 +211,10 @@ index 91bfeffcdbe47208c7d0ddbe013cd0f11fddfa32..e7796054f3f65f5bea7f93c75320195f
} }
} }
diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
index aa3b3070126f1c492f004ec7599eeb379b58f207..1815de38654dd134abde3dd9bd0b018b91247bd5 100644 index 295d82dd73b600e9436d2bbec0e11dbeaf78bbf4..c0105d716985acef497d60b5c631a56b4ca5847b 100644
--- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java --- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java +++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
@@ -177,14 +177,15 @@ public class ShapedRecipe extends CraftingRecipe { @@ -178,14 +178,15 @@ public class ShapedRecipe extends CraftingRecipe {
Preconditions.checkArgument(key != ' ', "Space in recipe shape must represent no ingredient"); Preconditions.checkArgument(key != ' ', "Space in recipe shape must represent no ingredient");
Preconditions.checkArgument(ingredients.containsKey(key), "Symbol does not appear in the shape:", key); Preconditions.checkArgument(ingredients.containsKey(key), "Symbol does not appear in the shape:", key);
@ -233,10 +233,10 @@ index aa3b3070126f1c492f004ec7599eeb379b58f207..1815de38654dd134abde3dd9bd0b018b
// Paper end // Paper end
diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
index beb798482479c58a8628c314b510ab6349576ce8..8251170314ab25c26270208e453b4e3909435754 100644 index 3bf5064cd6ceb05ea98b18993da46c67be140115..79db6dbc0367de2eaa397674624c765d5aeb8fa5 100644
--- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java --- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java +++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
@@ -131,7 +131,7 @@ public class ShapelessRecipe extends CraftingRecipe { @@ -132,7 +132,7 @@ public class ShapelessRecipe extends CraftingRecipe {
public ShapelessRecipe addIngredient(@NotNull RecipeChoice ingredient) { public ShapelessRecipe addIngredient(@NotNull RecipeChoice ingredient) {
Preconditions.checkArgument(ingredients.size() + 1 <= 9, "Shapeless recipes cannot have more than 9 ingredients"); Preconditions.checkArgument(ingredients.size() + 1 <= 9, "Shapeless recipes cannot have more than 9 ingredients");
@ -245,7 +245,7 @@ index beb798482479c58a8628c314b510ab6349576ce8..8251170314ab25c26270208e453b4e39
return this; return this;
} }
@@ -144,6 +144,8 @@ public class ShapelessRecipe extends CraftingRecipe { @@ -145,6 +145,8 @@ public class ShapelessRecipe extends CraftingRecipe {
@NotNull @NotNull
public ShapelessRecipe addIngredient(int count, @NotNull ItemStack item) { public ShapelessRecipe addIngredient(int count, @NotNull ItemStack item) {
Preconditions.checkArgument(ingredients.size() + count <= 9, "Shapeless recipes cannot have more than 9 ingredients"); Preconditions.checkArgument(ingredients.size() + count <= 9, "Shapeless recipes cannot have more than 9 ingredients");

Datei anzeigen

@ -19,6 +19,27 @@ index 637fa73d4366c2d88e2716e5c8d3465706d788a7..0f03c546ecdd6383fb36a362d18d6fb5
this.flicker = flicker; this.flicker = flicker;
this.trail = trail; this.trail = trail;
this.colors = colors; this.colors = colors;
diff --git a/src/main/java/org/bukkit/inventory/ItemType.java b/src/main/java/org/bukkit/inventory/ItemType.java
index a6d1dde422de98f178c0c9add99e01203a35e5cb..01ec84248a681180088fb1d7d22b80f8572b0305 100644
--- a/src/main/java/org/bukkit/inventory/ItemType.java
+++ b/src/main/java/org/bukkit/inventory/ItemType.java
@@ -31,6 +31,7 @@ import org.bukkit.inventory.meta.MapMeta;
import org.bukkit.inventory.meta.MusicInstrumentMeta;
import org.bukkit.inventory.meta.OminousBottleMeta;
import org.bukkit.inventory.meta.PotionMeta;
+import org.bukkit.inventory.meta.ShieldMeta;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.inventory.meta.SpawnEggMeta;
import org.bukkit.inventory.meta.SuspiciousStewMeta;
@@ -1893,7 +1894,7 @@ public interface ItemType extends Keyed, Translatable, net.kyori.adventure.trans
/**
* ItemMeta: {@link BlockStateMeta}
*/
- ItemType.Typed<BlockStateMeta> SHIELD = getItemType("shield");
+ ItemType.Typed<ShieldMeta> SHIELD = getItemType("shield"); // Paper - update shield to its new meta
ItemType.Typed<ItemMeta> TOTEM_OF_UNDYING = getItemType("totem_of_undying");
ItemType.Typed<ItemMeta> SHULKER_SHELL = getItemType("shulker_shell");
ItemType.Typed<ItemMeta> IRON_NUGGET = getItemType("iron_nugget");
diff --git a/src/main/java/org/bukkit/inventory/meta/Damageable.java b/src/main/java/org/bukkit/inventory/meta/Damageable.java diff --git a/src/main/java/org/bukkit/inventory/meta/Damageable.java b/src/main/java/org/bukkit/inventory/meta/Damageable.java
index ff6818b6d9e0207eafdd749928f33aeac3f27191..992f39da07bafe9769effaa7dc6adc018c89329d 100644 index ff6818b6d9e0207eafdd749928f33aeac3f27191..992f39da07bafe9769effaa7dc6adc018c89329d 100644
--- a/src/main/java/org/bukkit/inventory/meta/Damageable.java --- a/src/main/java/org/bukkit/inventory/meta/Damageable.java

Datei anzeigen

@ -790,10 +790,10 @@ index 0000000000000000000000000000000000000000..11d19e339c7c62f2eb4467277552c27e
+record TagKeyImpl<T>(RegistryKey<T> registryKey, Key key) implements TagKey<T> { +record TagKeyImpl<T>(RegistryKey<T> registryKey, Key key) implements TagKey<T> {
+} +}
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index fcc9664fd1fe081c9c70bcd7e511c60d987b44f9..8e306d05e372855929d30456ed2d27a04d55ac42 100644 index cd1e38debbec745dd13cd895327f544dcf42594d..c0428edee6ecbbd646c0e58da39a7ca476914fd1 100644
--- a/src/main/java/org/bukkit/Registry.java --- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java +++ b/src/main/java/org/bukkit/Registry.java
@@ -356,6 +356,27 @@ public interface Registry<T extends Keyed> extends Iterable<T> { @@ -358,6 +358,27 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
*/ */
@Nullable @Nullable
T get(@NotNull NamespacedKey key); T get(@NotNull NamespacedKey key);
@ -821,7 +821,7 @@ index fcc9664fd1fe081c9c70bcd7e511c60d987b44f9..8e306d05e372855929d30456ed2d27a0
// Paper start - improve Registry // Paper start - improve Registry
/** /**
@@ -430,6 +451,34 @@ public interface Registry<T extends Keyed> extends Iterable<T> { @@ -432,6 +453,34 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
} }
// Paper end - improve Registry // Paper end - improve Registry
@ -856,7 +856,7 @@ index fcc9664fd1fe081c9c70bcd7e511c60d987b44f9..8e306d05e372855929d30456ed2d27a0
/** /**
* Returns a new stream, which contains all registry items, which are registered to the registry. * Returns a new stream, which contains all registry items, which are registered to the registry.
* *
@@ -511,5 +560,23 @@ public interface Registry<T extends Keyed> extends Iterable<T> { @@ -513,5 +562,23 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
return value.getKey(); return value.getKey();
} }
// Paper end - improve Registry // Paper end - improve Registry

Datei anzeigen

@ -480,10 +480,10 @@ index 6c9689baca1763e2ef79495d38618d587e792434..4583092c2d1ffe95be2831c5d5f0e904
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/inventory/ItemType.java b/src/main/java/org/bukkit/inventory/ItemType.java diff --git a/src/main/java/org/bukkit/inventory/ItemType.java b/src/main/java/org/bukkit/inventory/ItemType.java
index 94587a97fcea81a43b160b01d2c81cef2b7f4413..6bc1853ada3ea38bc36cb31fbb5ce246347fe5d4 100644 index 01ec84248a681180088fb1d7d22b80f8572b0305..0168f0a14a3e899e84c5e36963ff79950ab580fb 100644
--- a/src/main/java/org/bukkit/inventory/ItemType.java --- a/src/main/java/org/bukkit/inventory/ItemType.java
+++ b/src/main/java/org/bukkit/inventory/ItemType.java +++ b/src/main/java/org/bukkit/inventory/ItemType.java
@@ -46,7 +46,7 @@ import org.jetbrains.annotations.Nullable; @@ -47,7 +47,7 @@ import org.jetbrains.annotations.Nullable;
* official replacement for the aforementioned enum. Entirely incompatible * official replacement for the aforementioned enum. Entirely incompatible
* changes may occur. Do not use this API in plugins. * changes may occur. Do not use this API in plugins.
*/ */

Datei anzeigen

@ -1,27 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Bjarne Koll <lynxplay101@gmail.com>
Date: Fri, 19 Jul 2024 19:09:21 +0200
Subject: [PATCH] Move CraftComplexRecipe to extend CraftingRecipe
A craft complex recipe wraps a CustomRecipe, which itself is a
CraftingRecipe.
As such, this complex recipe should also be a crafting recipe.
diff --git a/src/main/java/org/bukkit/inventory/CraftingRecipe.java b/src/main/java/org/bukkit/inventory/CraftingRecipe.java
index 37024b4736dd3897490ca51d08cf07901b01d59f..afa3de9ab78d01c448d450d8afbc7b1e7e62754c 100644
--- a/src/main/java/org/bukkit/inventory/CraftingRecipe.java
+++ b/src/main/java/org/bukkit/inventory/CraftingRecipe.java
@@ -11,8 +11,11 @@ import org.jetbrains.annotations.NotNull;
* Represents a shaped or shapeless crafting recipe.
*/
public abstract class CraftingRecipe implements Recipe, Keyed {
- private final NamespacedKey key;
- private final ItemStack output;
+ // Paper - make CraftComplexRecipe extend CraftingRecipe - start
+ protected NamespacedKey key;
+ protected ItemStack output;
+ protected CraftingRecipe() {}
+ // Paper - make CraftComplexRecipe extend CraftingRecipe - end
private String group = "";
private CraftingBookCategory category = CraftingBookCategory.MISC;

Datei anzeigen

@ -1,97 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: ploppyperson <nathat890@outlook.com>
Date: Thu, 18 Jul 2024 16:37:58 +0200
Subject: [PATCH] Add CrafterCraftEvent
Ports the currently proposed CrafterCraftEvent
from upstream.
The type is experimental to account for spigot
potentially changing some api contracts, however
the event is required for a stable release and
waiting on spigot's PR queue is not an option.
See: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/pull-requests/1044/overview
diff --git a/src/main/java/org/bukkit/event/block/CrafterCraftEvent.java b/src/main/java/org/bukkit/event/block/CrafterCraftEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..8dec6d16aa3c3579eadd77f637c9afa54ee9a90f
--- /dev/null
+++ b/src/main/java/org/bukkit/event/block/CrafterCraftEvent.java
@@ -0,0 +1,77 @@
+package org.bukkit.event.block;
+
+import org.bukkit.block.Block;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.inventory.CraftingRecipe;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Event called when a Crafter is about to craft an item
+ * @apiNote Currently still experimental as it is ported from an open, not merged, spigot PR.
+ * The event was pulled to allow protection plugins and the likes to properly manage crafters.
+ * The type remains experimental as upstream *may* change the event before pulling it, resulting in a breaking change.
+ */
+@org.jetbrains.annotations.ApiStatus.Experimental
+public class CrafterCraftEvent extends BlockEvent implements Cancellable {
+
+ private static final HandlerList handlers = new HandlerList();
+ private boolean cancelled;
+ private ItemStack result;
+ private final CraftingRecipe recipe;
+
+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - internal constructor.
+ public CrafterCraftEvent(@NotNull Block theBlock, @NotNull CraftingRecipe recipe, @NotNull ItemStack result) {
+ super(theBlock);
+ this.result = result;
+ this.recipe = recipe;
+ }
+
+ /**
+ * Gets the result for the craft
+ * @return the result for the craft
+ */
+ @NotNull
+ public ItemStack getResult() {
+ return result.clone();
+ }
+
+ /**
+ * Sets the result of the craft
+ * @param result the result of the craft
+ */
+ public void setResult(@NotNull ItemStack result) {
+ this.result = result.clone();
+ }
+
+ /**
+ * The recipe that was used to craft this item
+ * @return the recipe that was used to craft this item
+ */
+ @NotNull
+ public CraftingRecipe getRecipe() {
+ return recipe;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancelled = cancel;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}

Datei anzeigen

@ -0,0 +1,332 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
Date: Wed, 12 Sep 2018 18:53:35 +0300
Subject: [PATCH] Add an API for CanPlaceOn and CanDestroy NBT values
diff --git a/src/main/java/com/destroystokyo/paper/Namespaced.java b/src/main/java/com/destroystokyo/paper/Namespaced.java
new file mode 100644
index 0000000000000000000000000000000000000000..e708cc48f480e91a60834897e447e4a2fc1244d4
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/Namespaced.java
@@ -0,0 +1,41 @@
+package com.destroystokyo.paper;
+
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Represents a namespaced resource, see {@link org.bukkit.NamespacedKey} for single elements
+ * or {@link com.destroystokyo.paper.NamespacedTag} for a collection of elements
+ *
+ * Namespaces may only contain lowercase alphanumeric characters, periods,
+ * underscores, and hyphens.
+ * <p>
+ * Keys may only contain lowercase alphanumeric characters, periods,
+ * underscores, hyphens, and forward slashes.
+ * <p>
+ * You should not be implementing this interface yourself, use {@link org.bukkit.NamespacedKey}
+ * or {@link com.destroystokyo.paper.NamespacedTag} as needed instead.
+ */
+@Deprecated(forRemoval = true, since = "1.20.6")
+public interface Namespaced {
+ /**
+ * Gets the namespace this resource is a part of
+ * <p>
+ * This is contractually obligated to only contain lowercase alphanumeric characters,
+ * periods, underscores, and hyphens.
+ *
+ * @return resource namespace
+ */
+ @NotNull
+ String getNamespace();
+
+ /**
+ * Gets the key corresponding to this resource
+ * <p>
+ * This is contractually obligated to only contain lowercase alphanumeric characters,
+ * periods, underscores, hyphens, and forward slashes.
+ *
+ * @return resource key
+ */
+ @NotNull
+ String getKey();
+}
diff --git a/src/main/java/com/destroystokyo/paper/NamespacedTag.java b/src/main/java/com/destroystokyo/paper/NamespacedTag.java
new file mode 100644
index 0000000000000000000000000000000000000000..c976995a0fceaf0cbddd399906a866747b12a202
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/NamespacedTag.java
@@ -0,0 +1,143 @@
+package com.destroystokyo.paper;
+
+import com.google.common.base.Preconditions;
+import java.util.Locale;
+import java.util.UUID;
+import java.util.regex.Pattern;
+import org.bukkit.plugin.Plugin;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Represents a String based key pertaining to a tagged entry. Consists of two components - a namespace
+ * and a key.
+ * <p>
+ * Namespaces may only contain lowercase alphanumeric characters, periods,
+ * underscores, and hyphens.
+ * <p>
+ * Keys may only contain lowercase alphanumeric characters, periods,
+ * underscores, hyphens, and forward slashes.
+ *
+ */
+// Paper - entire class, based on org.bukkit.NamespacedKey
+@Deprecated(forRemoval = true, since = "1.20.6")
+public final class NamespacedTag implements com.destroystokyo.paper.Namespaced {
+
+ /**
+ * The namespace representing all inbuilt keys.
+ */
+ public static final String MINECRAFT = "minecraft";
+ /**
+ * The namespace representing all keys generated by Bukkit for backwards
+ * compatibility measures.
+ */
+ public static final String BUKKIT = "bukkit";
+ //
+ private static final Pattern VALID_NAMESPACE = Pattern.compile("[a-z0-9._-]+");
+ private static final Pattern VALID_KEY = Pattern.compile("[a-z0-9/._-]+");
+ //
+ private final String namespace;
+ private final String key;
+
+ /**
+ * Create a key in a specific namespace.
+ *
+ * @param namespace String representing a grouping of keys
+ * @param key Name for this specific key
+ * @deprecated should never be used by plugins, for internal use only!!
+ */
+ @Deprecated
+ public NamespacedTag(@NotNull String namespace, @NotNull String key) {
+ Preconditions.checkArgument(namespace != null && VALID_NAMESPACE.matcher(namespace).matches(), "Invalid namespace. Must be [a-z0-9._-]: %s", namespace);
+ Preconditions.checkArgument(key != null && VALID_KEY.matcher(key).matches(), "Invalid key. Must be [a-z0-9/._-]: %s", key);
+
+ this.namespace = namespace;
+ this.key = key;
+
+ String string = toString();
+ Preconditions.checkArgument(string.length() < 256, "NamespacedTag must be less than 256 characters", string);
+ }
+
+ /**
+ * Create a key in the plugin's namespace.
+ * <p>
+ * Namespaces may only contain lowercase alphanumeric characters, periods,
+ * underscores, and hyphens.
+ * <p>
+ * Keys may only contain lowercase alphanumeric characters, periods,
+ * underscores, hyphens, and forward slashes.
+ *
+ * @param plugin the plugin to use for the namespace
+ * @param key the key to create
+ */
+ public NamespacedTag(@NotNull Plugin plugin, @NotNull String key) {
+ Preconditions.checkArgument(plugin != null, "Plugin cannot be null");
+ Preconditions.checkArgument(key != null, "Key cannot be null");
+
+ this.namespace = plugin.getName().toLowerCase(Locale.ROOT);
+ this.key = key.toLowerCase().toLowerCase(Locale.ROOT);
+
+ // Check validity after normalization
+ Preconditions.checkArgument(VALID_NAMESPACE.matcher(this.namespace).matches(), "Invalid namespace. Must be [a-z0-9._-]: %s", this.namespace);
+ Preconditions.checkArgument(VALID_KEY.matcher(this.key).matches(), "Invalid key. Must be [a-z0-9/._-]: %s", this.key);
+
+ String string = toString();
+ Preconditions.checkArgument(string.length() < 256, "NamespacedTag must be less than 256 characters (%s)", string);
+ }
+
+ @NotNull
+ public String getNamespace() {
+ return namespace;
+ }
+
+ @NotNull
+ public String getKey() {
+ return key;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 7;
+ hash = 47 * hash + this.namespace.hashCode();
+ hash = 47 * hash + this.key.hashCode();
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final NamespacedTag other = (NamespacedTag) obj;
+ return this.namespace.equals(other.namespace) && this.key.equals(other.key);
+ }
+
+ @Override
+ public String toString() {
+ return "#" + this.namespace + ":" + this.key;
+ }
+
+ /**
+ * Return a new random key in the {@link #BUKKIT} namespace.
+ *
+ * @return new key
+ * @deprecated should never be used by plugins, for internal use only!!
+ */
+ @Deprecated
+ public static NamespacedTag randomKey() {
+ return new NamespacedTag(BUKKIT, UUID.randomUUID().toString());
+ }
+
+ /**
+ * Get a key in the Minecraft namespace.
+ *
+ * @param key the key to use
+ * @return new key in the Minecraft namespace
+ */
+ @NotNull
+ public static NamespacedTag minecraft(@NotNull String key) {
+ return new NamespacedTag(MINECRAFT, key);
+ }
+}
diff --git a/src/main/java/org/bukkit/NamespacedKey.java b/src/main/java/org/bukkit/NamespacedKey.java
index 7ff6d60deb129e23b2a4d772aee123eb6c0b6433..52a2763773b234c581b2dcc6f0584f8d8b0fbc60 100644
--- a/src/main/java/org/bukkit/NamespacedKey.java
+++ b/src/main/java/org/bukkit/NamespacedKey.java
@@ -19,7 +19,7 @@ import org.jetbrains.annotations.Nullable;
* underscores, hyphens, and forward slashes.
*
*/
-public final class NamespacedKey implements net.kyori.adventure.key.Key { // Paper - implement Key
+public final class NamespacedKey implements net.kyori.adventure.key.Key, com.destroystokyo.paper.Namespaced { // Paper - implement Key and Namespaced
/**
* The namespace representing all inbuilt keys.
@@ -121,11 +121,13 @@ public final class NamespacedKey implements net.kyori.adventure.key.Key { // Pap
}
@NotNull
+ @Override // Paper
public String getNamespace() {
return namespace;
}
@NotNull
+ @Override // Paper
public String getKey() {
return key;
}
diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
index 5d5fcb2720b62e47d47f441032c4de02574b051a..f5541454ba5e508a72c83989c6feaef5406e2535 100644
--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
@@ -806,4 +806,98 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@SuppressWarnings("javadoc")
@NotNull
ItemMeta clone();
+
+ // Paper start - Add an API for can-place-on/can-break adventure mode predicates
+ /**
+ * Gets set of materials what given item can destroy in {@link org.bukkit.GameMode#ADVENTURE}
+ *
+ * @return Set of materials
+ * @deprecated this API is unsupported and will be replaced, its usage may result in data loss related to place/destroy predicates.
+ */
+ @Deprecated(forRemoval = true, since = "1.14")
+ Set<org.bukkit.Material> getCanDestroy();
+
+ /**
+ * Sets set of materials what given item can destroy in {@link org.bukkit.GameMode#ADVENTURE}
+ *
+ * @param canDestroy Set of materials
+ * @deprecated this API is unsupported and will be replaced, its usage may result in data loss related to place/destroy predicates.
+ */
+ @Deprecated(forRemoval = true, since = "1.14")
+ void setCanDestroy(Set<org.bukkit.Material> canDestroy);
+
+ /**
+ * Gets set of materials where given item can be placed on in {@link org.bukkit.GameMode#ADVENTURE}
+ *
+ * @return Set of materials
+ * @deprecated this API is unsupported and will be replaced, its usage may result in data loss related to place/destroy predicates.
+ */
+ @Deprecated(forRemoval = true, since = "1.14")
+ Set<org.bukkit.Material> getCanPlaceOn();
+
+ /**
+ * Sets set of materials where given item can be placed on in {@link org.bukkit.GameMode#ADVENTURE}
+ *
+ * @param canPlaceOn Set of materials
+ * @deprecated this API is unsupported and will be replaced, its usage may result in data loss related to place/destroy predicates.
+ */
+ @Deprecated(forRemoval = true, since = "1.14")
+ void setCanPlaceOn(Set<org.bukkit.Material> canPlaceOn);
+
+ /**
+ * Gets the collection of namespaced keys that the item can destroy in {@link org.bukkit.GameMode#ADVENTURE}
+ *
+ * @return Set of {@link com.destroystokyo.paper.Namespaced}
+ * @deprecated this API is unsupported and will be replaced, its usage may result in data loss related to place/destroy predicates.
+ */
+ @Deprecated(forRemoval = true, since = "1.20.6")
+ @NotNull
+ Set<com.destroystokyo.paper.Namespaced> getDestroyableKeys();
+
+ /**
+ * Sets the collection of namespaced keys that the item can destroy in {@link org.bukkit.GameMode#ADVENTURE}
+ *
+ * @param canDestroy Collection of {@link com.destroystokyo.paper.Namespaced}
+ * @deprecated this API is unsupported and will be replaced, its usage may result in data loss related to place/destroy predicates.
+ */
+ @Deprecated(forRemoval = true, since = "1.20.6")
+ void setDestroyableKeys(@NotNull Collection<com.destroystokyo.paper.Namespaced> canDestroy);
+
+ /**
+ * Gets the collection of namespaced keys that the item can be placed on in {@link org.bukkit.GameMode#ADVENTURE}
+ *
+ * @return Set of {@link com.destroystokyo.paper.Namespaced}
+ * @deprecated this API is unsupported and will be replaced, its usage may result in data loss related to place/destroy predicates.
+ */
+ @NotNull
+ @Deprecated(forRemoval = true, since = "1.20.6")
+ Set<com.destroystokyo.paper.Namespaced> getPlaceableKeys();
+
+ /**
+ * Sets the set of namespaced keys that the item can be placed on in {@link org.bukkit.GameMode#ADVENTURE}
+ *
+ * @param canPlaceOn Collection of {@link com.destroystokyo.paper.Namespaced}
+ * @deprecated this API is unsupported and will be replaced, its usage may result in data loss related to place/destroy predicates.
+ */
+ @Deprecated(forRemoval = true, since = "1.20.6")
+ void setPlaceableKeys(@NotNull Collection<com.destroystokyo.paper.Namespaced> canPlaceOn);
+
+ /**
+ * Checks for the existence of any keys that the item can be placed on
+ *
+ * @return true if this item has placeable keys
+ * @deprecated this API is unsupported and will be replaced
+ */
+ @Deprecated(forRemoval = true, since = "1.20.6")
+ boolean hasPlaceableKeys();
+
+ /**
+ * Checks for the existence of any keys that the item can destroy
+ *
+ * @return true if this item has destroyable keys
+ * @deprecated this API is unsupported and will be replaced
+ */
+ @Deprecated(forRemoval = true, since = "1.20.6")
+ boolean hasDestroyableKeys();
+ // Paper end - Add an API for can-place-on/can-break adventure mode predicates
}

Datei anzeigen

@ -0,0 +1,56 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Mon, 12 Aug 2024 18:38:19 +0200
Subject: [PATCH] Improve StandardMessenger exception messages
diff --git a/src/main/java/org/bukkit/plugin/messaging/ChannelNameTooLongException.java b/src/main/java/org/bukkit/plugin/messaging/ChannelNameTooLongException.java
index 80ef8a2a342ff9dc16c98b5254cadd539f6ea0d9..ea73d9cd9d9d84731c083089d0b9913b4b1f92b6 100644
--- a/src/main/java/org/bukkit/plugin/messaging/ChannelNameTooLongException.java
+++ b/src/main/java/org/bukkit/plugin/messaging/ChannelNameTooLongException.java
@@ -9,7 +9,9 @@ public class ChannelNameTooLongException extends RuntimeException {
super("Attempted to send a Plugin Message to a channel that was too large. The maximum length a channel may be is " + Messenger.MAX_CHANNEL_SIZE + " chars.");
}
- public ChannelNameTooLongException(String channel) {
- super("Attempted to send a Plugin Message to a channel that was too large. The maximum length a channel may be is " + Messenger.MAX_CHANNEL_SIZE + " chars (attempted " + channel.length() + " - '" + channel + ".");
+ // Paper start
+ public ChannelNameTooLongException(int length, String shortenedChannel) {
+ super("Attempted to send a Plugin Message to a channel that was too large. The maximum length a channel may be is " + Messenger.MAX_CHANNEL_SIZE + " chars (attempted " + length + " - '" + shortenedChannel + ".");
+ // Paper end
}
}
diff --git a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java
index 6fda7f3aa68e76af64362e9afed70fc6a5e92986..230ecf9f9752b0369da3ba7aa6ce68b34a0814c5 100644
--- a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java
+++ b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java
@@ -496,19 +496,26 @@ public class StandardMessenger implements Messenger {
if (channel.equals("bungeecord:main")) {
return "BungeeCord";
}
+ // Paper start - improve error message
if (channel.length() > Messenger.MAX_CHANNEL_SIZE) {
- throw new ChannelNameTooLongException(channel);
+ throw new ChannelNameTooLongException(channel.length(), shortened(channel));
}
if (channel.indexOf(':') == -1) {
- throw new IllegalArgumentException("Channel must contain : separator (attempted to use " + channel + ")");
+ throw new IllegalArgumentException("Channel must contain : separator (attempted to use " + shortened(channel) + ")");
}
if (!channel.toLowerCase(Locale.ROOT).equals(channel)) {
// TODO: use NamespacedKey validation here
- throw new IllegalArgumentException("Channel must be entirely lowercase (attempted to use " + channel + ")");
+ throw new IllegalArgumentException("Channel must be entirely lowercase (attempted to use " + shortened(channel) + ")");
}
return channel;
}
+ private static String shortened(String channel) {
+ channel = org.apache.commons.lang3.StringUtils.normalizeSpace(channel);
+ return channel.length() > 32 ? channel.substring(0, 32) + "..." : channel;
+ }
+ // Paper end - improve error message
+
/**
* Validates the input of a Plugin Message, ensuring the arguments are all
* valid.

Datei anzeigen

@ -1,397 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
Date: Wed, 12 Sep 2018 18:53:55 +0300
Subject: [PATCH] Add API for CanPlaceOn and CanDestroy NBT values
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 1920cf7ad846f57cd278cb9a72dce03f3d014fbb..7cf1153ae532a9d53ee85b05f77ed74b94cf5fbc 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -85,6 +85,12 @@ import org.bukkit.persistence.PersistentDataContainer;
import static org.spigotmc.ValidateUtils.*;
// Spigot end
+// Paper start
+import com.destroystokyo.paper.Namespaced;
+import com.destroystokyo.paper.NamespacedTag;
+import java.util.Collections;
+// Paper end
+
/**
* Children must include the following:
*
@@ -273,6 +279,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@Specific(Specific.To.NBT)
static final ItemMetaKey BLOCK_DATA = new ItemMetaKey("BlockStateTag");
static final ItemMetaKey BUKKIT_CUSTOM_TAG = new ItemMetaKey("PublicBukkitValues");
+ // Paper start - Add API for CanPlaceOn and CanDestroy NBT values
+ static final ItemMetaKey CAN_DESTROY = new ItemMetaKey("CanDestroy");
+ static final ItemMetaKey CAN_PLACE_ON = new ItemMetaKey("CanPlaceOn");
+ // Paper end - Add API for CanPlaceOn and CanDestroy NBT values
// We store the raw original JSON representation of all text data. See SPIGOT-5063, SPIGOT-5656, SPIGOT-5304
private String displayName;
@@ -286,6 +296,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
private int hideFlag;
private boolean unbreakable;
private int damage;
+ // Paper start - Add API for CanPlaceOn and CanDestroy NBT values
+ private Set<Namespaced> placeableKeys = Sets.newHashSet();
+ private Set<Namespaced> destroyableKeys = Sets.newHashSet();
+ // Paper end - Add API for CanPlaceOn and CanDestroy NBT values
private static final Set<String> HANDLED_TAGS = Sets.newHashSet();
private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
@@ -323,6 +337,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
this.hideFlag = meta.hideFlag;
this.unbreakable = meta.unbreakable;
this.damage = meta.damage;
+ // Paper start - Add API for CanPlaceOn and CanDestroy NBT values
+ if (meta.hasPlaceableKeys()) {
+ this.placeableKeys = new java.util.HashSet<>(meta.placeableKeys);
+ }
+
+ if (meta.hasDestroyableKeys()) {
+ this.destroyableKeys = new java.util.HashSet<>(meta.destroyableKeys);
+ }
+ // Paper end - Add API for CanPlaceOn and CanDestroy NBT values
this.unhandledTags.putAll(meta.unhandledTags);
this.persistentDataContainer.putAll(meta.persistentDataContainer.getRaw());
@@ -386,6 +409,31 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
this.persistentDataContainer.put(key, compound.get(key).copy());
}
}
+ // Paper start - Add API for CanPlaceOn and CanDestroy NBT values
+ if (tag.contains(CAN_DESTROY.NBT)) {
+ ListTag list = tag.getList(CAN_DESTROY.NBT, CraftMagicNumbers.NBT.TAG_STRING);
+ for (int i = 0; i < list.size(); i++) {
+ Namespaced namespaced = this.blockKeyFromString(list.getString(i));
+ if (namespaced == null) {
+ continue;
+ }
+
+ this.destroyableKeys.add(namespaced);
+ }
+ }
+
+ if (tag.contains(CAN_PLACE_ON.NBT)) {
+ ListTag list = tag.getList(CAN_PLACE_ON.NBT, CraftMagicNumbers.NBT.TAG_STRING);
+ for (int i = 0; i < list.size(); i++) {
+ Namespaced namespaced = this.blockKeyFromString(list.getString(i));
+ if (namespaced == null) {
+ continue;
+ }
+
+ this.placeableKeys.add(namespaced);
+ }
+ }
+ // Paper end - Add API for CanPlaceOn and CanDestroy NBT values
Set<String> keys = tag.getAllKeys();
for (String key : keys) {
@@ -524,6 +572,34 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
this.setDamage(damage);
}
+ // Paper start - Add API for CanPlaceOn and CanDestroy NBT values
+ Iterable<?> canPlaceOnSerialized = SerializableMeta.getObject(Iterable.class, map, CAN_PLACE_ON.BUKKIT, true);
+ if (canPlaceOnSerialized != null) {
+ for (Object canPlaceOnElement : canPlaceOnSerialized) {
+ String canPlaceOnRaw = (String) canPlaceOnElement;
+ Namespaced value = this.blockKeyFromString(canPlaceOnRaw);
+ if (value == null) {
+ continue;
+ }
+
+ this.placeableKeys.add(value);
+ }
+ }
+
+ Iterable<?> canDestroySerialized = SerializableMeta.getObject(Iterable.class, map, CAN_DESTROY.BUKKIT, true);
+ if (canDestroySerialized != null) {
+ for (Object canDestroyElement : canDestroySerialized) {
+ String canDestroyRaw = (String) canDestroyElement;
+ Namespaced value = this.blockKeyFromString(canDestroyRaw);
+ if (value == null) {
+ continue;
+ }
+
+ this.destroyableKeys.add(value);
+ }
+ }
+ // Paper end - Add API for CanPlaceOn and CanDestroy NBT values
+
String internal = SerializableMeta.getString(map, "internal", true);
if (internal != null) {
ByteArrayInputStream buf = new ByteArrayInputStream(Base64.getDecoder().decode(internal));
@@ -652,6 +728,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
if (this.hasDamage()) {
itemTag.putInt(CraftMetaItem.DAMAGE.NBT, this.damage);
}
+ // Paper start - Add API for CanPlaceOn and CanDestroy NBT values
+ if (hasPlaceableKeys()) {
+ List<String> items = this.placeableKeys.stream()
+ .map(this::serializeNamespaced)
+ .collect(java.util.stream.Collectors.toList());
+
+ itemTag.put(CAN_PLACE_ON.NBT, createNonComponentStringList(items));
+ }
+
+ if (hasDestroyableKeys()) {
+ List<String> items = this.destroyableKeys.stream()
+ .map(this::serializeNamespaced)
+ .collect(java.util.stream.Collectors.toList());
+
+ itemTag.put(CAN_DESTROY.NBT, createNonComponentStringList(items));
+ }
+ // Paper end - Add API for CanPlaceOn and CanDestroy NBT values
for (Map.Entry<String, Tag> e : this.unhandledTags.entrySet()) {
itemTag.put(e.getKey(), e.getValue());
@@ -668,6 +761,21 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
}
}
+ // Paper start - Add API for CanPlaceOn and CanDestroy NBT values
+ static ListTag createNonComponentStringList(List<String> list) {
+ if (list == null || list.isEmpty()) {
+ return null;
+ }
+
+ ListTag tagList = new ListTag();
+ for (String value : list) {
+ tagList.add(StringTag.valueOf(value)); // Paper - NBTTagString.of(String str)
+ }
+
+ return tagList;
+ }
+ // Paper end - Add API for CanPlaceOn and CanDestroy NBT values
+
ListTag createStringList(List<String> list) {
if (list == null) {
return null;
@@ -751,7 +859,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@Overridden
boolean isEmpty() {
- return !(this.hasDisplayName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isUnbreakable() || this.hasDamage() || this.hasAttributeModifiers());
+ return !(this.hasDisplayName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isUnbreakable() || this.hasDamage() || this.hasAttributeModifiers() || this.hasPlaceableKeys() || this.hasDestroyableKeys()); // Paper - Implement an API for CanPlaceOn and CanDestroy NBT values
}
// Paper start
@@ -1223,7 +1331,11 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
&& (this.hideFlag == that.hideFlag)
&& (this.isUnbreakable() == that.isUnbreakable())
&& (this.hasDamage() ? that.hasDamage() && this.damage == that.damage : !that.hasDamage())
- && (this.version == that.version);
+ && (this.version == that.version)
+ // Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values
+ && (this.hasPlaceableKeys() ? that.hasPlaceableKeys() && this.placeableKeys.equals(that.placeableKeys) : !that.hasPlaceableKeys())
+ && (this.hasDestroyableKeys() ? that.hasDestroyableKeys() && this.destroyableKeys.equals(that.destroyableKeys) : !that.hasDestroyableKeys());
+ // Paper end
}
/**
@@ -1258,6 +1370,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
hash = 61 * hash + (this.hasDamage() ? this.damage : 0);
hash = 61 * hash + (this.hasAttributeModifiers() ? this.attributeModifiers.hashCode() : 0);
hash = 61 * hash + this.version;
+ // Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values
+ hash = 61 * hash + (this.hasPlaceableKeys() ? this.placeableKeys.hashCode() : 0);
+ hash = 61 * hash + (this.hasDestroyableKeys() ? this.destroyableKeys.hashCode() : 0);
+ // Paper end
return hash;
}
@@ -1282,6 +1398,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
clone.unbreakable = this.unbreakable;
clone.damage = this.damage;
clone.version = this.version;
+ // Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values
+ if (this.placeableKeys != null) {
+ clone.placeableKeys = Sets.newHashSet(this.placeableKeys);
+ }
+ if (this.destroyableKeys != null) {
+ clone.destroyableKeys = Sets.newHashSet(this.destroyableKeys);
+ }
+ // Paper end
return clone;
} catch (CloneNotSupportedException e) {
throw new Error(e);
@@ -1339,6 +1463,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
builder.put(CraftMetaItem.DAMAGE.BUKKIT, this.damage);
}
+ // Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values
+ if (this.hasPlaceableKeys()) {
+ List<String> cerealPlaceable = this.placeableKeys.stream()
+ .map(this::serializeNamespaced)
+ .collect(java.util.stream.Collectors.toList());
+
+ builder.put(CAN_PLACE_ON.BUKKIT, cerealPlaceable);
+ }
+
+ if (this.hasDestroyableKeys()) {
+ List<String> cerealDestroyable = this.destroyableKeys.stream()
+ .map(this::serializeNamespaced)
+ .collect(java.util.stream.Collectors.toList());
+
+ builder.put(CAN_DESTROY.BUKKIT, cerealDestroyable);
+ }
+ // Paper end
final Map<String, Tag> internalTags = new HashMap<String, Tag>(this.unhandledTags);
this.serializeInternal(internalTags);
if (!internalTags.isEmpty()) {
@@ -1516,6 +1657,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
CraftMetaArmorStand.SHOW_ARMS.NBT,
CraftMetaArmorStand.SMALL.NBT,
CraftMetaArmorStand.MARKER.NBT,
+ CAN_DESTROY.NBT,
+ CAN_PLACE_ON.NBT,
// Paper end
CraftMetaCompass.LODESTONE_DIMENSION.NBT,
CraftMetaCompass.LODESTONE_POS.NBT,
@@ -1545,4 +1688,141 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
}
// Paper end
+ // Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values
+ @Override
+ @SuppressWarnings("deprecation")
+ public Set<Material> getCanDestroy() {
+ return !hasDestroyableKeys() ? Collections.emptySet() : legacyGetMatsFromKeys(this.destroyableKeys);
+ }
+
+ @Override
+ @SuppressWarnings("deprecation")
+ public void setCanDestroy(Set<Material> canDestroy) {
+ Preconditions.checkArgument(canDestroy != null, "Cannot replace with null set!");
+ legacyClearAndReplaceKeys(this.destroyableKeys, canDestroy);
+ }
+
+ @Override
+ @SuppressWarnings("deprecation")
+ public Set<Material> getCanPlaceOn() {
+ return !hasPlaceableKeys() ? Collections.emptySet() : legacyGetMatsFromKeys(this.placeableKeys);
+ }
+
+ @Override
+ @SuppressWarnings("deprecation")
+ public void setCanPlaceOn(Set<Material> canPlaceOn) {
+ Preconditions.checkArgument(canPlaceOn != null, "Cannot replace with null set!");
+ legacyClearAndReplaceKeys(this.placeableKeys, canPlaceOn);
+ }
+
+ @Override
+ public Set<Namespaced> getDestroyableKeys() {
+ return !hasDestroyableKeys() ? Collections.emptySet() : Sets.newHashSet(this.destroyableKeys);
+ }
+
+ @Override
+ public void setDestroyableKeys(Collection<Namespaced> canDestroy) {
+ Preconditions.checkArgument(canDestroy != null, "Cannot replace with null collection!");
+ Preconditions.checkArgument(ofAcceptableType(canDestroy), "Can only use NamespacedKey or NamespacedTag objects!");
+ this.destroyableKeys.clear();
+ this.destroyableKeys.addAll(canDestroy);
+ }
+
+ @Override
+ public Set<Namespaced> getPlaceableKeys() {
+ return !hasPlaceableKeys() ? Collections.emptySet() : Sets.newHashSet(this.placeableKeys);
+ }
+
+ @Override
+ public void setPlaceableKeys(Collection<Namespaced> canPlaceOn) {
+ Preconditions.checkArgument(canPlaceOn != null, "Cannot replace with null collection!");
+ Preconditions.checkArgument(ofAcceptableType(canPlaceOn), "Can only use NamespacedKey or NamespacedTag objects!");
+ this.placeableKeys.clear();
+ this.placeableKeys.addAll(canPlaceOn);
+ }
+
+ @Override
+ public boolean hasPlaceableKeys() {
+ return this.placeableKeys != null && !this.placeableKeys.isEmpty();
+ }
+
+ @Override
+ public boolean hasDestroyableKeys() {
+ return this.destroyableKeys != null && !this.destroyableKeys.isEmpty();
+ }
+
+ @Deprecated
+ private void legacyClearAndReplaceKeys(Collection<Namespaced> toUpdate, Collection<Material> beingSet) {
+ if (beingSet.stream().anyMatch(Material::isLegacy)) {
+ throw new IllegalArgumentException("Set must not contain any legacy materials!");
+ }
+
+ toUpdate.clear();
+ toUpdate.addAll(beingSet.stream().map(Material::getKey).collect(java.util.stream.Collectors.toSet()));
+ }
+
+ @Deprecated
+ private Set<Material> legacyGetMatsFromKeys(Collection<Namespaced> names) {
+ Set<Material> mats = Sets.newHashSet();
+ for (Namespaced key : names) {
+ if (!(key instanceof org.bukkit.NamespacedKey)) {
+ continue;
+ }
+
+ Material material = Material.matchMaterial(key.toString(), false);
+ if (material != null) {
+ mats.add(material);
+ }
+ }
+
+ return mats;
+ }
+
+ private @Nullable Namespaced blockKeyFromString(String raw) {
+ boolean isTag = !raw.isEmpty() && raw.codePointAt(0) == '#';
+ com.mojang.datafixers.util.Either<net.minecraft.commands.arguments.blocks.BlockStateParser.BlockResult, net.minecraft.commands.arguments.blocks.BlockStateParser.TagResult> result;
+ try {
+ result = net.minecraft.commands.arguments.blocks.BlockStateParser.parseForTesting(net.minecraft.core.registries.BuiltInRegistries.BLOCK.asLookup(), raw, false);
+ } catch (com.mojang.brigadier.exceptions.CommandSyntaxException e) {
+ return null;
+ }
+
+ net.minecraft.resources.ResourceLocation key = null;
+ if (isTag && result.right().isPresent() && result.right().get().tag() instanceof net.minecraft.core.HolderSet.Named<net.minecraft.world.level.block.Block> namedSet) {
+ key = namedSet.key().location();
+ } else if (result.left().isPresent()) {
+ key = net.minecraft.core.registries.BuiltInRegistries.BLOCK.getKey(result.left().get().blockState().getBlock());
+ }
+
+ if (key == null) {
+ return null;
+ }
+
+ try {
+ if (isTag) {
+ return new NamespacedTag(key.getNamespace(), key.getPath());
+
+ }
+ return CraftNamespacedKey.fromMinecraft(key);
+ } catch (IllegalArgumentException ignored) {
+ return null;
+ }
+ }
+
+ private @Nonnull String serializeNamespaced(Namespaced resource) {
+ return resource.toString();
+ }
+
+ // not a fan of this
+ private boolean ofAcceptableType(Collection<Namespaced> namespacedResources) {
+
+ for (Namespaced resource : namespacedResources) {
+ if (!(resource instanceof org.bukkit.NamespacedKey || resource instanceof com.destroystokyo.paper.NamespacedTag)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+ // Paper end
}

Datei anzeigen

@ -160,7 +160,7 @@ index 0000000000000000000000000000000000000000..9ea079d14a92367629dc8fb30d1be043
+} +}
diff --git a/pom.xml b/pom.xml diff --git a/pom.xml b/pom.xml
deleted file mode 100644 deleted file mode 100644
index e6f88c20b3a3ba28b917bea9a671b2709d32b3cd..0000000000000000000000000000000000000000 index 5abcca1894a0d7795d394834f56c189c0bbeb82f..0000000000000000000000000000000000000000
--- a/pom.xml --- a/pom.xml
+++ /dev/null +++ /dev/null
@@ -1,604 +0,0 @@ @@ -1,604 +0,0 @@
@ -170,7 +170,7 @@ index e6f88c20b3a3ba28b917bea9a671b2709d32b3cd..00000000000000000000000000000000
- <groupId>org.spigotmc</groupId> - <groupId>org.spigotmc</groupId>
- <artifactId>spigot</artifactId> - <artifactId>spigot</artifactId>
- <packaging>jar</packaging> - <packaging>jar</packaging>
- <version>1.21-R0.1-SNAPSHOT</version> - <version>1.21.1-R0.1-SNAPSHOT</version>
- <name>Spigot</name> - <name>Spigot</name>
- <url>https://www.spigotmc.org/</url> - <url>https://www.spigotmc.org/</url>
- -

Datei anzeigen

@ -131,10 +131,10 @@ index feca36209fd2405fab70f564f63e627b8b78ac18..396ec10a76bdadbf5be2f0e15e88eed4
public static PackRepository createPackRepository(Path dataPacksPath, DirectoryValidator symlinkFinder) { public static PackRepository createPackRepository(Path dataPacksPath, DirectoryValidator symlinkFinder) {
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 82b8485a4781105bce874485119110576d1e2d63..a07e26caf48acf9ef193a74497a201166bfbe098 100644 index 9bae4835882a7c1b5a623d57330c36cc61b9b6d1..273a6658deacbf00f6cc498cf3fcd20d144bd9e4 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -210,7 +210,7 @@ public class Main { @@ -199,7 +199,7 @@ public class Main {
} }
if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {

Datei anzeigen

@ -351,6 +351,22 @@ index ebcb65cb74acdb9d1bcf2b4b3551a2dc6d809bc9..7d9dbed7281099b78d7f898885b37cdc
} }
@Test @Test
diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java
index 544307fe34cbcfa286a7d7b30900ebea127d189e..5bda0bc976920f224586f2c0e083b771c676e307 100644
--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java
+++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java
@@ -53,6 +53,11 @@ public abstract class AbstractTestingBase {
MultiPackResourceManager resourceManager = new MultiPackResourceManager(PackType.SERVER_DATA, resourceRepository.getAvailablePacks().stream().map(Pack::open).toList());
// add tags and loot tables for unit tests
LayeredRegistryAccess<RegistryLayer> layers = RegistryLayer.createRegistryAccess();
+ // Paper start - load registry here to ensure bukkit object registry are correctly delayed if needed
+ try {
+ Class.forName("org.bukkit.Registry");
+ } catch (ClassNotFoundException ignored) {}
+ // Paper end - load registry here to ensure bukkit object registry are correctly delayed if needed
layers = WorldLoader.loadAndReplaceLayer(resourceManager, layers, RegistryLayer.WORLDGEN, RegistryDataLoader.WORLDGEN_REGISTRIES);
REGISTRY_CUSTOM = layers.compositeAccess().freeze();
// Register vanilla pack
diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java
index 1acdf5bc439c073c1777c2c4f5743ae082f4a621..183d30e3d3d413b05c762f374a964498d6ffdec4 100644 index 1acdf5bc439c073c1777c2c4f5743ae082f4a621..183d30e3d3d413b05c762f374a964498d6ffdec4 100644
--- a/src/test/java/org/bukkit/support/DummyServer.java --- a/src/test/java/org/bukkit/support/DummyServer.java

Datei anzeigen

@ -1414,10 +1414,10 @@ index 0000000000000000000000000000000000000000..990d1bb46e0f9719f4e9af928d80ac6f
+} +}
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..7509b17414f836e8b53fc62b02b386ba4e8c5ca9 index 0000000000000000000000000000000000000000..4bcf27f98765abf693e535cfc1756c27a10cb316
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
@@ -0,0 +1,551 @@ @@ -0,0 +1,554 @@
+package io.papermc.paper.configuration; +package io.papermc.paper.configuration;
+ +
+import com.google.common.collect.HashBasedTable; +import com.google.common.collect.HashBasedTable;
@ -1474,6 +1474,7 @@ index 0000000000000000000000000000000000000000..7509b17414f836e8b53fc62b02b386ba
+import org.slf4j.Logger; +import org.slf4j.Logger;
+import org.spigotmc.SpigotWorldConfig; +import org.spigotmc.SpigotWorldConfig;
+import org.spongepowered.configurate.objectmapping.ConfigSerializable; +import org.spongepowered.configurate.objectmapping.ConfigSerializable;
+import org.spongepowered.configurate.objectmapping.meta.Comment;
+import org.spongepowered.configurate.objectmapping.meta.PostProcess; +import org.spongepowered.configurate.objectmapping.meta.PostProcess;
+import org.spongepowered.configurate.objectmapping.meta.Required; +import org.spongepowered.configurate.objectmapping.meta.Required;
+import org.spongepowered.configurate.objectmapping.meta.Setting; +import org.spongepowered.configurate.objectmapping.meta.Setting;
@ -1710,6 +1711,8 @@ index 0000000000000000000000000000000000000000..7509b17414f836e8b53fc62b02b386ba
+ +
+ public boolean disablePlayerCrits = false; + public boolean disablePlayerCrits = false;
+ public boolean nerfPigmenFromNetherPortals = false; + public boolean nerfPigmenFromNetherPortals = false;
+ @Comment("Prevents merging items that are not on the same y level, preventing potential visual artifacts.")
+ public boolean onlyMergeItemsHorizontally = false;
+ public PillagerPatrols pillagerPatrols; + public PillagerPatrols pillagerPatrols;
+ +
+ public class PillagerPatrols extends ConfigurationPart { + public class PillagerPatrols extends ConfigurationPart {
@ -5053,7 +5056,7 @@ index e433037a03ffafabb952887ae3980e1d51411d4c..c061813d275fbc48d7629cc59d90dbb4
this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env); this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index e8fac2863c5feb875cf0c78f062b4b87acbcb49b..751900e0c2a946ba4291174c81b2bdbdbe994e94 100644 index 3c0691ef65c8db1002b76984f4ddfe2072d793c9..b3c4cdd9cfff6857f3007fbd91a280bcc53ab072 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -962,6 +962,7 @@ public final class CraftServer implements Server { @@ -962,6 +962,7 @@ public final class CraftServer implements Server {
@ -5065,7 +5068,7 @@ index e8fac2863c5feb875cf0c78f062b4b87acbcb49b..751900e0c2a946ba4291174c81b2bdbd
world.serverLevelData.setDifficulty(config.difficulty); world.serverLevelData.setDifficulty(config.difficulty);
world.setSpawnSettings(config.spawnMonsters, config.spawnAnimals); world.setSpawnSettings(config.spawnMonsters, config.spawnAnimals);
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index a07e26caf48acf9ef193a74497a201166bfbe098..dbcde37cfdeb6141c3f5c4f8b95d60fca91c7977 100644 index 273a6658deacbf00f6cc498cf3fcd20d144bd9e4..cf06abf508fab734f5945e1d292c01512a50749e 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -142,6 +142,19 @@ public class Main { @@ -142,6 +142,19 @@ public class Main {
@ -5190,10 +5193,10 @@ index 0000000000000000000000000000000000000000..0396589795da1f83ddf62426236dde9a
+ } + }
+} +}
diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java
index 544307fe34cbcfa286a7d7b30900ebea127d189e..1b1d51a68c0abe7d8f0aa1172064192c71ae645e 100644 index 5bda0bc976920f224586f2c0e083b771c676e307..4e9612600822bc1b52b8528dff2783d43385ec73 100644
--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java --- a/src/test/java/org/bukkit/support/AbstractTestingBase.java
+++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java +++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java
@@ -63,6 +63,7 @@ public abstract class AbstractTestingBase { @@ -68,6 +68,7 @@ public abstract class AbstractTestingBase {
BIOMES = REGISTRY_CUSTOM.registryOrThrow(Registries.BIOME); BIOMES = REGISTRY_CUSTOM.registryOrThrow(Registries.BIOME);
DummyServer.setup(); DummyServer.setup();

Datei anzeigen

@ -5064,7 +5064,7 @@ index 12db4c5db3d7951df984db03d09d14d808e58699..44d4aee059d74676bffb8b6bc6f6ad4d
@Override @Override
public float getBukkitYaw() { public float getBukkitYaw() {
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 15f0b0977fe7b41e29346df9d49120f14f02ea43..b6cb1de08e955dfc99a0cb736b2ed456c99fde5c 100644 index d7a3f704cce228c50d26f1ecd98e819eca561bfc..3457e1c9791b294b5e4dab478d90cdd1a1cf7fef 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java --- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -953,6 +953,25 @@ public final class ItemStack implements DataComponentHolder { @@ -953,6 +953,25 @@ public final class ItemStack implements DataComponentHolder {
@ -5351,10 +5351,10 @@ index 497792978bdf0e6a53d772304770e8df3e7416ea..c5454b92ca2565461c799d7340160f9f
public WorldBorder getWorldBorder() { public WorldBorder getWorldBorder() {
return this.level.getWorldBorder(); return this.level.getWorldBorder();
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index 9569d9d1c8f809420e08038e5bc38c2c7887ff90..d5d638d955dbcc1034bc79aace77d43e20db5995 100644 index e0594a1c381487b43bfc55212044e1b3122cee66..59fcaca90b67c03e1a6799e58061dbae3b1f1ceb 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -834,12 +834,14 @@ public abstract class BlockBehaviour implements FeatureElement { @@ -841,12 +841,14 @@ public abstract class BlockBehaviour implements FeatureElement {
} }
} }
@ -5369,7 +5369,7 @@ index 9569d9d1c8f809420e08038e5bc38c2c7887ff90..d5d638d955dbcc1034bc79aace77d43e
this.legacySolid = this.calculateSolid(); this.legacySolid = this.calculateSolid();
} }
@@ -886,8 +888,8 @@ public abstract class BlockBehaviour implements FeatureElement { @@ -893,8 +895,8 @@ public abstract class BlockBehaviour implements FeatureElement {
return this.getBlock().getOcclusionShape(this.asState(), world, pos); return this.getBlock().getOcclusionShape(this.asState(), world, pos);
} }
@ -5421,7 +5421,7 @@ index a52077f0d93c94b0ea644bc14b9b28e84fd1b154..dcc0acd259920463a4464213b9a5e793
@Nullable @Nullable
@Override @Override
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index b537e7a079497db428db405edfccde74f32f4208..c664021dbfffcf0db3247041270ce9a1ee6940de 100644 index 5b73fcfe278f57de249f3a96da58dc08eda7aff6..25380a44e5cc94f3924cfee6a03c3091fea04ae2 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -116,6 +116,10 @@ public class LevelChunk extends ChunkAccess { @@ -116,6 +116,10 @@ public class LevelChunk extends ChunkAccess {
@ -5480,7 +5480,7 @@ index b537e7a079497db428db405edfccde74f32f4208..c664021dbfffcf0db3247041270ce9a1
@Override @Override
public FluidState getFluidState(BlockPos pos) { public FluidState getFluidState(BlockPos pos) {
return this.getFluidState(pos.getX(), pos.getY(), pos.getZ()); return this.getFluidState(pos.getX(), pos.getY(), pos.getZ());
@@ -549,7 +582,11 @@ public class LevelChunk extends ChunkAccess { @@ -554,7 +587,11 @@ public class LevelChunk extends ChunkAccess {
// CraftBukkit start // CraftBukkit start
public void loadCallback() { public void loadCallback() {
@ -5492,7 +5492,7 @@ index b537e7a079497db428db405edfccde74f32f4208..c664021dbfffcf0db3247041270ce9a1
if (server != null) { if (server != null) {
/* /*
* If it's a new world, the first few chunks are generated inside * If it's a new world, the first few chunks are generated inside
@@ -590,6 +627,10 @@ public class LevelChunk extends ChunkAccess { @@ -595,6 +632,10 @@ public class LevelChunk extends ChunkAccess {
server.getPluginManager().callEvent(unloadEvent); server.getPluginManager().callEvent(unloadEvent);
// note: saving can be prevented, but not forced if no saving is actually required // note: saving can be prevented, but not forced if no saving is actually required
this.mustNotSave = !unloadEvent.isSaveChunk(); this.mustNotSave = !unloadEvent.isSaveChunk();
@ -5563,7 +5563,7 @@ index 34933c5324126f9afdc5cba9dea997ace8f01806..1cfc906317f07a44f06a4adf021c44e3
return false; return false;
} else { } else {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index f04c0f8b3905b488aac221fedde335a54ad1ff58..7f8864da8a6f9c2410191851add1ba566b8c171c 100644 index a094eb1348509fea0c3d253cddfe409998dcbf23..2ea3ad9ab43dec0555d6716bebefbc3bb6553f1a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2601,4 +2601,9 @@ public final class CraftServer implements Server { @@ -2601,4 +2601,9 @@ public final class CraftServer implements Server {

Datei anzeigen

@ -2191,10 +2191,10 @@ index f30cdfa5fd294479e35680b2f758b3295f659b74..ec34e402104d7a696ea95e0b11ee7018
public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity) { public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity) {
this(output, pos, rot, world, level, name, displayName, server, entity, false, CommandResultCallback.EMPTY, EntityAnchorArgument.Anchor.FEET, CommandSigningContext.ANONYMOUS, TaskChainer.immediate(server)); this(output, pos, rot, world, level, name, displayName, server, entity, false, CommandResultCallback.EMPTY, EntityAnchorArgument.Anchor.FEET, CommandSigningContext.ANONYMOUS, TaskChainer.immediate(server));
diff --git a/src/main/java/net/minecraft/commands/arguments/MessageArgument.java b/src/main/java/net/minecraft/commands/arguments/MessageArgument.java diff --git a/src/main/java/net/minecraft/commands/arguments/MessageArgument.java b/src/main/java/net/minecraft/commands/arguments/MessageArgument.java
index 0047fd758ad43cc7b13355b60c410a9bcc37bec0..982b2bab27e3d55d0ba07060862c0c3183ad91b0 100644 index 8f03eed020a99b96189f4f5d42d806d06f4d6b5e..55484826fc5ddd04ae024e25a0251796d7fa9c28 100644
--- a/src/main/java/net/minecraft/commands/arguments/MessageArgument.java --- a/src/main/java/net/minecraft/commands/arguments/MessageArgument.java
+++ b/src/main/java/net/minecraft/commands/arguments/MessageArgument.java +++ b/src/main/java/net/minecraft/commands/arguments/MessageArgument.java
@@ -53,17 +53,21 @@ public class MessageArgument implements SignedArgument<MessageArgument.Message> @@ -54,17 +54,21 @@ public class MessageArgument implements SignedArgument<MessageArgument.Message>
private static void resolveSignedMessage(Consumer<PlayerChatMessage> callback, CommandSourceStack source, PlayerChatMessage message) { private static void resolveSignedMessage(Consumer<PlayerChatMessage> callback, CommandSourceStack source, PlayerChatMessage message) {
MinecraftServer minecraftServer = source.getServer(); MinecraftServer minecraftServer = source.getServer();
CompletableFuture<FilteredText> completableFuture = filterPlainText(source, message); CompletableFuture<FilteredText> completableFuture = filterPlainText(source, message);
@ -2584,10 +2584,10 @@ index c5ba5e30cd74ca2cfc3f952c7b992df239a53a34..fdb75db02603ef97b624219211a0db22
@Override @Override
public PacketType<ClientboundSystemChatPacket> type() { public PacketType<ClientboundSystemChatPacket> type() {
diff --git a/src/main/java/net/minecraft/network/protocol/login/ClientboundLoginDisconnectPacket.java b/src/main/java/net/minecraft/network/protocol/login/ClientboundLoginDisconnectPacket.java diff --git a/src/main/java/net/minecraft/network/protocol/login/ClientboundLoginDisconnectPacket.java b/src/main/java/net/minecraft/network/protocol/login/ClientboundLoginDisconnectPacket.java
index bb97fdb9aa6167083442a928276ebe4225a586ef..5d1758086ed4fce5b36a5b31df44ccea42abc590 100644 index bb97fdb9aa6167083442a928276ebe4225a586ef..eeaa40e8121643c6c1d951e76e7361e29210ba48 100644
--- a/src/main/java/net/minecraft/network/protocol/login/ClientboundLoginDisconnectPacket.java --- a/src/main/java/net/minecraft/network/protocol/login/ClientboundLoginDisconnectPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/login/ClientboundLoginDisconnectPacket.java +++ b/src/main/java/net/minecraft/network/protocol/login/ClientboundLoginDisconnectPacket.java
@@ -18,11 +18,15 @@ public class ClientboundLoginDisconnectPacket implements Packet<ClientLoginPacke @@ -18,11 +18,16 @@ public class ClientboundLoginDisconnectPacket implements Packet<ClientLoginPacke
} }
private ClientboundLoginDisconnectPacket(FriendlyByteBuf buf) { private ClientboundLoginDisconnectPacket(FriendlyByteBuf buf) {
@ -2599,8 +2599,9 @@ index bb97fdb9aa6167083442a928276ebe4225a586ef..5d1758086ed4fce5b36a5b31df44ccea
- buf.writeUtf(Component.Serializer.toJson(this.reason, RegistryAccess.EMPTY)); - buf.writeUtf(Component.Serializer.toJson(this.reason, RegistryAccess.EMPTY));
+ // Paper start - Adventure + // Paper start - Adventure
+ // buf.writeUtf(Component.Serializer.toJson(this.reason, RegistryAccess.EMPTY)); + // buf.writeUtf(Component.Serializer.toJson(this.reason, RegistryAccess.EMPTY));
+ // In the login phase, buf.adventure$locale field is always null + // In the login phase, buf.adventure$locale field is most likely null, but plugins may use internals to set it via the channel attribute
+ buf.writeJsonWithCodec(net.minecraft.network.chat.ComponentSerialization.localizedCodec(java.util.Locale.US), this.reason, FriendlyByteBuf.MAX_COMPONENT_STRING_LENGTH); + java.util.Locale bufLocale = buf.adventure$locale;
+ buf.writeJsonWithCodec(net.minecraft.network.chat.ComponentSerialization.localizedCodec(bufLocale == null ? java.util.Locale.US : bufLocale), this.reason, FriendlyByteBuf.MAX_COMPONENT_STRING_LENGTH);
+ // Paper end - Adventure + // Paper end - Adventure
} }
@ -3241,7 +3242,7 @@ index ed54c81a3269360acce674aa4e1d54ccb2461841..c9c849534c3998cfcab7ddcb12a71ccb
} }
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index b6cb1de08e955dfc99a0cb736b2ed456c99fde5c..abf502b8395bb0a8a32c1fdcd62532790deb1c6e 100644 index 3457e1c9791b294b5e4dab478d90cdd1a1cf7fef..1138d238caa18171b6562cc748c92cec03bfbb97 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java --- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -183,7 +183,15 @@ public final class ItemStack implements DataComponentHolder { @@ -183,7 +183,15 @@ public final class ItemStack implements DataComponentHolder {
@ -3326,7 +3327,7 @@ index 49c037e961c5ca5ba8d6a870cb32ffe8719adc91..2772c19f58a35713d61aab24f6f0d6f5
} }
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 7f8864da8a6f9c2410191851add1ba566b8c171c..bec1fdabbc3727c1f7297b2d23914a5179f4adcb 100644 index 2ea3ad9ab43dec0555d6716bebefbc3bb6553f1a..be068650a568fc1d0d3b9c5acd040adafb2344e1 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -644,8 +644,10 @@ public final class CraftServer implements Server { @@ -644,8 +644,10 @@ public final class CraftServer implements Server {
@ -3627,7 +3628,7 @@ index 69c62699e3412f2730e3db65f196099d77698980..4878a1b085a83dd4a8ffdc86250b8fb4
// Paper end // Paper end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 2122d7316f55ab5bec7058fe1b8ee3ceb42deea7..43790f555743e9945c1b82cf8f2f4719feedc165 100644 index 42a1a0588e2b506082499ac9791d039089a64631..9c1fab8db74757e1fb57d4f47099ba6e1536cd6d 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -20,6 +20,12 @@ public class Main { @@ -20,6 +20,12 @@ public class Main {
@ -4676,10 +4677,10 @@ index 5725b0281ac53a2354b233223259d6784353bc6e..9ef939b76d06874b856e0c850addb364
@Override @Override
public int getLineWidth() { public int getLineWidth() {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 39aad2d00227d94aa1d24c27a10d916b7d64888d..63e20db8ad84b332a4962d5cea83f1064b7c1a3d 100644 index 938a7ee49a727d5929d1d049c61d2881cf24ff9c..78f4bb474c85e32448a385e108707d92082bfe02 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -911,7 +911,7 @@ public class CraftEventFactory { @@ -915,7 +915,7 @@ public class CraftEventFactory {
return event; return event;
} }
@ -4688,7 +4689,7 @@ index 39aad2d00227d94aa1d24c27a10d916b7d64888d..63e20db8ad84b332a4962d5cea83f106
CraftPlayer entity = victim.getBukkitEntity(); CraftPlayer entity = victim.getBukkitEntity();
CraftDamageSource bukkitDamageSource = new CraftDamageSource(damageSource); CraftDamageSource bukkitDamageSource = new CraftDamageSource(damageSource);
PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(damageSource.getEntity()), 0, deathMessage); PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(damageSource.getEntity()), 0, deathMessage);
@@ -944,7 +944,7 @@ public class CraftEventFactory { @@ -948,7 +948,7 @@ public class CraftEventFactory {
* Server methods * Server methods
*/ */
public static ServerListPingEvent callServerListPingEvent(SocketAddress address, String motd, int numPlayers, int maxPlayers) { public static ServerListPingEvent callServerListPingEvent(SocketAddress address, String motd, int numPlayers, int maxPlayers) {
@ -4802,10 +4803,10 @@ index c9cc23757a9fcc58d30b2915d4c5cfbc7d1c767a..fc0e1212022d1aa3506699b60ef33819
return this.title; return this.title;
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java
index 6871fbde3498f18274029638e0cd27d1a78bb1d7..5888a44d7f1f06e6308b068e57c295de366061cd 100644 index 07d406de7123593dc470af2723f2a9a2dc2157b0..01fbd8a55866af3e371c8a2eef23ef6e9ca3226d 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java
@@ -73,6 +73,13 @@ public class CraftInventoryView extends CraftAbstractInventoryView { @@ -73,6 +73,13 @@ public class CraftInventoryView<T extends AbstractContainerMenu> extends CraftAb
return CraftItemStack.asCraftMirror(this.container.getSlot(slot).getItem()); return CraftItemStack.asCraftMirror(this.container.getSlot(slot).getItem());
} }
@ -5164,10 +5165,10 @@ index c71a4971f127fdfc753306019313ce1a31201120..fd3b12477c30d1eabdbe57ea77902793
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index e56e6d07f297491c8f92598b8105bfebead7a0a1..86a5e4f7b2a0d50d0a58d88e10a277cfbd09bf9d 100644 index 1c5d63fb6a9ed5cc40d735793cf5889e189feadf..568d6fab743039b20715d8181555f52baa05f0f3 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -952,6 +952,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -959,6 +959,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.removedTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasTool() || this.hasDamage() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null); return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.removedTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasTool() || this.hasDamage() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null);
} }
@ -5186,7 +5187,7 @@ index e56e6d07f297491c8f92598b8105bfebead7a0a1..86a5e4f7b2a0d50d0a58d88e10a277cf
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CraftChatMessage.fromComponent(this.displayName); return CraftChatMessage.fromComponent(this.displayName);
@@ -982,6 +994,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -989,6 +1001,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
return this.itemName != null; return this.itemName != null;
} }
@ -5205,7 +5206,7 @@ index e56e6d07f297491c8f92598b8105bfebead7a0a1..86a5e4f7b2a0d50d0a58d88e10a277cf
@Override @Override
public String getLocalizedName() { public String getLocalizedName() {
return this.getDisplayName(); return this.getDisplayName();
@@ -1001,6 +1025,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -1008,6 +1032,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
return this.lore != null && !this.lore.isEmpty(); return this.lore != null && !this.lore.isEmpty();
} }
@ -5588,7 +5589,7 @@ index ff040613083c015d9c52c0995591b64305fd5018..1b552b3f05ac7fc44450de4b1ec78907
boolean hadFormat = false; boolean hadFormat = false;
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index aa6a9dcd5528df38dddc0c661334c35658a19cee..5a89b9ca6a62f0bfb5fe01ed4097870788cf5d83 100644 index eeffc4be4ae7168c9f69edbbff6642fd4c214b3d..b64be3f292d88fa60746a3fe542740ef8ad2b41c 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -77,6 +77,43 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -77,6 +77,43 @@ public final class CraftMagicNumbers implements UnsafeValues {

Datei anzeigen

@ -423,7 +423,7 @@ index bec1fdabbc3727c1f7297b2d23914a5179f4adcb..17df1085e29429b202a6f9003343b15b
@Override @Override
public PluginCommand getPluginCommand(String name) { public PluginCommand getPluginCommand(String name) {
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 43790f555743e9945c1b82cf8f2f4719feedc165..26dfb02286e836cad0242c71f743265d55d9d032 100644 index 9c1fab8db74757e1fb57d4f47099ba6e1536cd6d..3eecea2e6df217ccf2c432d02022c53443a37014 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -13,7 +13,6 @@ import java.util.logging.Logger; @@ -13,7 +13,6 @@ import java.util.logging.Logger;
@ -434,7 +434,7 @@ index 43790f555743e9945c1b82cf8f2f4719feedc165..26dfb02286e836cad0242c71f743265d
public class Main { public class Main {
public static boolean useJline = true; public static boolean useJline = true;
@@ -207,6 +206,8 @@ public class Main { @@ -196,6 +195,8 @@ public class Main {
} }
try { try {
@ -443,7 +443,7 @@ index 43790f555743e9945c1b82cf8f2f4719feedc165..26dfb02286e836cad0242c71f743265d
// This trick bypasses Maven Shade's clever rewriting of our getProperty call when using String literals // This trick bypasses Maven Shade's clever rewriting of our getProperty call when using String literals
String jline_UnsupportedTerminal = new String(new char[]{'j', 'l', 'i', 'n', 'e', '.', 'U', 'n', 's', 'u', 'p', 'p', 'o', 'r', 't', 'e', 'd', 'T', 'e', 'r', 'm', 'i', 'n', 'a', 'l'}); String jline_UnsupportedTerminal = new String(new char[]{'j', 'l', 'i', 'n', 'e', '.', 'U', 'n', 's', 'u', 'p', 'p', 'o', 'r', 't', 'e', 'd', 'T', 'e', 'r', 'm', 'i', 'n', 'a', 'l'});
String jline_terminal = new String(new char[]{'j', 'l', 'i', 'n', 'e', '.', 't', 'e', 'r', 'm', 'i', 'n', 'a', 'l'}); String jline_terminal = new String(new char[]{'j', 'l', 'i', 'n', 'e', '.', 't', 'e', 'r', 'm', 'i', 'n', 'a', 'l'});
@@ -224,9 +225,18 @@ public class Main { @@ -213,9 +214,18 @@ public class Main {
// This ensures the terminal literal will always match the jline implementation // This ensures the terminal literal will always match the jline implementation
System.setProperty(jline.TerminalFactory.JLINE_TERMINAL, jline.UnsupportedTerminal.class.getName()); System.setProperty(jline.TerminalFactory.JLINE_TERMINAL, jline.UnsupportedTerminal.class.getName());
} }
@ -462,7 +462,7 @@ index 43790f555743e9945c1b82cf8f2f4719feedc165..26dfb02286e836cad0242c71f743265d
} }
if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
@@ -242,6 +252,7 @@ public class Main { @@ -231,6 +241,7 @@ public class Main {
} }
} }

Datei anzeigen

@ -8,7 +8,7 @@ our own relocation. Also lets us rewrite NMS calls for when we're
debugging in an IDE pre-relocate. debugging in an IDE pre-relocate.
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index 4afaab8978d4c4d9b0e9339f1bea9a9a9963d20d..421ddf6ca955215dff77655a7eda62eb9d90aa92 100644 index f80625a2b1dc266131ba3bfda9a918c72a592d82..ebc160fd4c8aed95087130bb6fddc1d4f83c6f87 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java --- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java +++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -11,6 +11,7 @@ import java.util.Arrays; @@ -11,6 +11,7 @@ import java.util.Arrays;
@ -27,7 +27,7 @@ index 4afaab8978d4c4d9b0e9339f1bea9a9a9963d20d..421ddf6ca955215dff77655a7eda62eb
import joptsimple.OptionParser; import joptsimple.OptionParser;
import joptsimple.OptionSet; import joptsimple.OptionSet;
import joptsimple.OptionSpec; import joptsimple.OptionSpec;
@@ -99,6 +101,40 @@ public class Commodore { @@ -100,6 +102,40 @@ public class Commodore {
private static final Map<String, RerouteMethodData> METHOD_REROUTE = Commodore.createReroutes(MethodRerouting.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); private static final Map<String, RerouteMethodData> ENUM_METHOD_REROUTE = Commodore.createReroutes(EnumEvil.class);
@ -68,7 +68,7 @@ index 4afaab8978d4c4d9b0e9339f1bea9a9a9963d20d..421ddf6ca955215dff77655a7eda62eb
public static void main(String[] args) { public static void main(String[] args) {
OptionParser parser = new OptionParser(); OptionParser parser = new OptionParser();
OptionSpec<File> inputFlag = parser.acceptsAll(Arrays.asList("i", "input")).withRequiredArg().ofType(File.class).required(); OptionSpec<File> inputFlag = parser.acceptsAll(Arrays.asList("i", "input")).withRequiredArg().ofType(File.class).required();
@@ -252,9 +288,49 @@ public class Commodore { @@ -253,9 +289,49 @@ public class Commodore {
} }
return new MethodVisitor(this.api, super.visitMethod(access, name, desc, signature, exceptions)) { return new MethodVisitor(this.api, super.visitMethod(access, name, desc, signature, exceptions)) {
@ -118,7 +118,7 @@ index 4afaab8978d4c4d9b0e9339f1bea9a9a9963d20d..421ddf6ca955215dff77655a7eda62eb
name = FieldRename.rename(pluginVersion, owner, name); name = FieldRename.rename(pluginVersion, owner, name);
if (modern) { if (modern) {
@@ -374,6 +450,13 @@ public class Commodore { @@ -375,6 +451,13 @@ public class Commodore {
return; return;
} }
@ -132,7 +132,7 @@ index 4afaab8978d4c4d9b0e9339f1bea9a9a9963d20d..421ddf6ca955215dff77655a7eda62eb
if (modern) { if (modern) {
if (owner.equals("org/bukkit/Material") || (instantiatedMethodType != null && instantiatedMethodType.getDescriptor().startsWith("(Lorg/bukkit/Material;)"))) { if (owner.equals("org/bukkit/Material") || (instantiatedMethodType != null && instantiatedMethodType.getDescriptor().startsWith("(Lorg/bukkit/Material;)"))) {
switch (name) { switch (name) {
@@ -470,6 +553,13 @@ public class Commodore { @@ -471,6 +554,13 @@ public class Commodore {
@Override @Override
public void visitLdcInsn(Object value) { public void visitLdcInsn(Object value) {
@ -146,7 +146,7 @@ index 4afaab8978d4c4d9b0e9339f1bea9a9a9963d20d..421ddf6ca955215dff77655a7eda62eb
if (value instanceof String && ((String) value).equals("com.mysql.jdbc.Driver")) { if (value instanceof String && ((String) value).equals("com.mysql.jdbc.Driver")) {
super.visitLdcInsn("com.mysql.cj.jdbc.Driver"); super.visitLdcInsn("com.mysql.cj.jdbc.Driver");
return; return;
@@ -480,6 +570,14 @@ public class Commodore { @@ -481,6 +571,14 @@ public class Commodore {
@Override @Override
public void visitInvokeDynamicInsn(String name, String descriptor, Handle bootstrapMethodHandle, Object... bootstrapMethodArguments) { public void visitInvokeDynamicInsn(String name, String descriptor, Handle bootstrapMethodHandle, Object... bootstrapMethodArguments) {
@ -161,7 +161,7 @@ index 4afaab8978d4c4d9b0e9339f1bea9a9a9963d20d..421ddf6ca955215dff77655a7eda62eb
if (bootstrapMethodHandle.getOwner().equals("java/lang/invoke/LambdaMetafactory") if (bootstrapMethodHandle.getOwner().equals("java/lang/invoke/LambdaMetafactory")
&& bootstrapMethodHandle.getName().equals("metafactory") && bootstrapMethodArguments.length == 3) { && bootstrapMethodHandle.getName().equals("metafactory") && bootstrapMethodArguments.length == 3) {
Type samMethodType = (Type) bootstrapMethodArguments[0]; Type samMethodType = (Type) bootstrapMethodArguments[0];
@@ -496,7 +594,7 @@ public class Commodore { @@ -497,7 +595,7 @@ public class Commodore {
methodArgs.add(new Handle(newOpcode, newOwner, newName, newDescription, newItf)); methodArgs.add(new Handle(newOpcode, newOwner, newName, newDescription, newItf));
methodArgs.add(newInstantiated); methodArgs.add(newInstantiated);
@ -170,7 +170,7 @@ index 4afaab8978d4c4d9b0e9339f1bea9a9a9963d20d..421ddf6ca955215dff77655a7eda62eb
}, implMethod.getTag(), implMethod.getOwner(), implMethod.getName(), implMethod.getDesc(), implMethod.isInterface(), samMethodType, instantiatedMethodType); }, implMethod.getTag(), implMethod.getOwner(), implMethod.getName(), implMethod.getDesc(), implMethod.isInterface(), samMethodType, instantiatedMethodType);
return; return;
} }
@@ -547,6 +645,12 @@ public class Commodore { @@ -548,6 +646,12 @@ public class Commodore {
@Override @Override
public FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value) { public FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value) {

Datei anzeigen

@ -645,10 +645,10 @@ index 242811578a786e3807a1a7019d472d5a68f87116..0b65fdf53124f3dd042b2363b1b8df8e
return traceElements; return traceElements;
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index 421ddf6ca955215dff77655a7eda62eb9d90aa92..8a1570ceb4755a1872911751943c84b8f06eb4c2 100644 index ebc160fd4c8aed95087130bb6fddc1d4f83c6f87..65f64de05a88844e62b5a0dd1e2f53edfb4e0c1f 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java --- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java +++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -102,36 +102,26 @@ public class Commodore { @@ -103,36 +103,26 @@ public class Commodore {
private static final Map<String, RerouteMethodData> ENUM_METHOD_REROUTE = Commodore.createReroutes(EnumEvil.class); private static final Map<String, RerouteMethodData> ENUM_METHOD_REROUTE = Commodore.createReroutes(EnumEvil.class);
// Paper start - Plugin rewrites // Paper start - Plugin rewrites
@ -696,7 +696,7 @@ index 421ddf6ca955215dff77655a7eda62eb9d90aa92..8a1570ceb4755a1872911751943c84b8
} }
// Paper end - Plugin rewrites // Paper end - Plugin rewrites
@@ -214,6 +204,7 @@ public class Commodore { @@ -215,6 +205,7 @@ public class Commodore {
visitor = new LimitedClassRemapper(cw, new SimpleRemapper(Commodore.ENUM_RENAMES)); visitor = new LimitedClassRemapper(cw, new SimpleRemapper(Commodore.ENUM_RENAMES));
} }

Datei anzeigen

@ -1526,7 +1526,7 @@ index d1cfcc8a36964f006f1af6764c52b5ca458b478d..def3e28edc206e0ba41111e26332db46
private String descriptionId; private String descriptionId;
@Nullable @Nullable
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
index e6c586eb85c6c477a3c130e1e1a37b41f17c30c8..6e35709f2a7c32050908e7e5af5529c9f342b787 100644 index 6a4e5bfa70b31311a9076eb314c0a0146d5b08a5..17cda4c8b61efd99c1a43f921ed604827bb064f3 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -34,10 +34,12 @@ import org.bukkit.inventory.InventoryHolder; @@ -34,10 +34,12 @@ import org.bukkit.inventory.InventoryHolder;
@ -1544,10 +1544,10 @@ index e6c586eb85c6c477a3c130e1e1a37b41f17c30c8..6e35709f2a7c32050908e7e5af5529c9
private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
public CraftPersistentDataContainer persistentDataContainer; public CraftPersistentDataContainer persistentDataContainer;
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index c664021dbfffcf0db3247041270ce9a1ee6940de..332351b78fa22cd354b916c4a29bea5b4b223e40 100644 index 25380a44e5cc94f3924cfee6a03c3091fea04ae2..418ba374886d93f69afd614e4be05f6561e1f897 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -597,6 +597,7 @@ public class LevelChunk extends ChunkAccess { @@ -602,6 +602,7 @@ public class LevelChunk extends ChunkAccess {
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(bukkitChunk, this.needsDecoration)); server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(bukkitChunk, this.needsDecoration));
if (this.needsDecoration) { if (this.needsDecoration) {
@ -1555,7 +1555,7 @@ index c664021dbfffcf0db3247041270ce9a1ee6940de..332351b78fa22cd354b916c4a29bea5b
this.needsDecoration = false; this.needsDecoration = false;
java.util.Random random = new java.util.Random(); java.util.Random random = new java.util.Random();
random.setSeed(this.level.getSeed()); random.setSeed(this.level.getSeed());
@@ -616,6 +617,7 @@ public class LevelChunk extends ChunkAccess { @@ -621,6 +622,7 @@ public class LevelChunk extends ChunkAccess {
} }
} }
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(bukkitChunk)); server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(bukkitChunk));
@ -1590,7 +1590,7 @@ index 46a090123e205394791cdbde2af84c58ce55f7e1..47f5f3d58bb3bf85cf35f9baae77df7f
}; };
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 7839e34cbd42e1b77c533b0dede42e0a19daf2a4..f2355612b497079f1de84e953c36720794da51d8 100644 index ee63b8134b8b3187a65d2b99962cfacbee18ff9f..29bb34e9207bd6c49cfbe58d4b598dcd35b7a65c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -376,7 +376,7 @@ public final class CraftServer implements Server { @@ -376,7 +376,7 @@ public final class CraftServer implements Server {
@ -1985,7 +1985,7 @@ index f97eccb6a17c7876e1e002d798eb67bbe80571a0..76effc345d362047e64d064eb64a5222
+ } // Paper + } // Paper
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index fa2e43020fafc283a9c063d10a82280158c7f93d..9576cabff99d154ef77595b074082adf9212698d 100644 index 6aa5b1e05893bcf61a91cb4de578d8996ca0a868..9383bf47404fca8d008d5c401ed37ddaa7bef4f7 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -197,6 +197,12 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -197,6 +197,12 @@ public final class CraftMagicNumbers implements UnsafeValues {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Support components in ItemMeta
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 86a5e4f7b2a0d50d0a58d88e10a277cfbd09bf9d..46e1fabf85cc0d92f79a7adf24e5724dc1dc08a9 100644 index 568d6fab743039b20715d8181555f52baa05f0f3..7ae3cdb80335cbeb0ff695eb719a170651586722 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -969,11 +969,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -976,11 +976,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
return CraftChatMessage.fromComponent(this.displayName); return CraftChatMessage.fromComponent(this.displayName);
} }
@ -32,7 +32,7 @@ index 86a5e4f7b2a0d50d0a58d88e10a277cfbd09bf9d..46e1fabf85cc0d92f79a7adf24e5724d
@Override @Override
public boolean hasDisplayName() { public boolean hasDisplayName() {
return this.displayName != null; return this.displayName != null;
@@ -1147,6 +1159,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -1154,6 +1166,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
return this.lore == null ? null : new ArrayList<String>(Lists.transform(this.lore, CraftChatMessage::fromComponent)); return this.lore == null ? null : new ArrayList<String>(Lists.transform(this.lore, CraftChatMessage::fromComponent));
} }
@ -47,7 +47,7 @@ index 86a5e4f7b2a0d50d0a58d88e10a277cfbd09bf9d..46e1fabf85cc0d92f79a7adf24e5724d
@Override @Override
public void setLore(List<String> lore) { public void setLore(List<String> lore) {
if (lore == null || lore.isEmpty()) { if (lore == null || lore.isEmpty()) {
@@ -1161,6 +1181,21 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -1168,6 +1188,21 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
} }
} }
@ -69,7 +69,7 @@ index 86a5e4f7b2a0d50d0a58d88e10a277cfbd09bf9d..46e1fabf85cc0d92f79a7adf24e5724d
@Override @Override
public boolean hasCustomModelData() { public boolean hasCustomModelData() {
return this.customModelData != null; return this.customModelData != null;
@@ -1873,6 +1908,11 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -1880,6 +1915,11 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
} }
for (Object object : addFrom) { for (Object object : addFrom) {

Datei anzeigen

@ -659,7 +659,7 @@ index acab477a4a026799319054c2eb4d0f2c99ab3d83..2a36e562967ec6174efe456e489c50ca
public List<CraftPlayer> getOnlinePlayers() { public List<CraftPlayer> getOnlinePlayers() {
return this.playerView; return this.playerView;
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 1c8049bbc08be77673d375205bd42a346ff951b8..1aa75b11ee3297e379baa111cf53e1cfcd8b016e 100644 index 8da38624b5867ce88bdb3036e1ed6d99fc626f31..2097be352dc585b805dc73194cec095627f311bc 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -15,6 +15,7 @@ import joptsimple.OptionSet; @@ -15,6 +15,7 @@ import joptsimple.OptionSet;
@ -670,7 +670,7 @@ index 1c8049bbc08be77673d375205bd42a346ff951b8..1aa75b11ee3297e379baa111cf53e1cf
public static boolean useJline = true; public static boolean useJline = true;
public static boolean useConsole = true; public static boolean useConsole = true;
@@ -252,15 +253,17 @@ public class Main { @@ -241,15 +242,17 @@ public class Main {
deadline.add(Calendar.DAY_OF_YEAR, -14); deadline.add(Calendar.DAY_OF_YEAR, -14);
if (buildDate.before(deadline.getTime())) { if (buildDate.before(deadline.getTime())) {
System.err.println("*** Error, this build is outdated ***"); System.err.println("*** Error, this build is outdated ***");

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Prevent block entity and entity crashes
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 1702cd6aa8b4fc29b8f2539604f6e203bf95d020..e19ee11905417918c7ec142fd2016ab3f000e4e2 100644 index 79d5423be919dfe4db75ad7dd0ce403ad0214462..e8b8475dd6fd7b89651f744da2cb9696c73ddc3e 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -731,11 +731,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -731,11 +731,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -26,12 +26,12 @@ index 1702cd6aa8b4fc29b8f2539604f6e203bf95d020..e19ee11905417918c7ec142fd2016ab3
} }
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
index 6e35709f2a7c32050908e7e5af5529c9f342b787..d20f71a2098b327423cbdbbc096aa9e358cb809d 100644 index 17cda4c8b61efd99c1a43f921ed604827bb064f3..d6ad310d3b472c40c128cfb459171d9f48e50915 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -263,7 +263,12 @@ public abstract class BlockEntity { @@ -272,7 +272,12 @@ public abstract class BlockEntity {
return s + " // " + this.getClass().getCanonicalName(); public void fillCrashReportCategory(CrashReportCategory crashReportSection) {
}); crashReportSection.setDetail("Name", this::getNameForReporting);
if (this.level != null) { if (this.level != null) {
- CrashReportCategory.populateBlockDetails(crashReportSection, this.level, this.worldPosition, this.getBlockState()); - CrashReportCategory.populateBlockDetails(crashReportSection, this.level, this.worldPosition, this.getBlockState());
+ // Paper start - Prevent block entity and entity crashes + // Paper start - Prevent block entity and entity crashes
@ -44,10 +44,10 @@ index 6e35709f2a7c32050908e7e5af5529c9f342b787..d20f71a2098b327423cbdbbc096aa9e3
} }
} }
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 332351b78fa22cd354b916c4a29bea5b4b223e40..7bfe757b605f4e5a16b28214ac3b497e738b45b5 100644 index 418ba374886d93f69afd614e4be05f6561e1f897..6889991885cc2075e0936b2c480befeef30d308c 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -948,11 +948,11 @@ public class LevelChunk extends ChunkAccess { @@ -953,11 +953,11 @@ public class LevelChunk extends ChunkAccess {
gameprofilerfiller.pop(); gameprofilerfiller.pop();
} catch (Throwable throwable) { } catch (Throwable throwable) {

Datei anzeigen

@ -4,15 +4,15 @@ Date: Wed, 16 Mar 2016 02:21:39 -0500
Subject: [PATCH] Configurable end credits Subject: [PATCH] Configurable end credits
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
index ee5188f3aa2ff71306f5af8046e8ddf919c8601b..decd0dd48d8b77126b184ee21ceaf6c387085946 100644 index e2d6693da4abe6204c0ecb5e924a3903fa80ab7d..a9c7a74b38a57c118c1ad67a77ba6f2e5c05d91e 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
@@ -1162,6 +1162,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -71,6 +71,7 @@ public class EndPortalBlock extends BaseEntityBlock implements Portal {
this.unRide(); if (!world.isClientSide && world.dimension() == Level.END && entity instanceof ServerPlayer) {
this.serverLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); ServerPlayer entityplayer = (ServerPlayer) entity;
if (!this.wonGame) {
+ if (this.level().paperConfig().misc.disableEndCredits) this.seenCredits = true; // Paper - Option to disable end credits + if (world.paperConfig().misc.disableEndCredits) entityplayer.seenCredits = true; // Paper - Option to disable end credits
this.wonGame = true; if (!entityplayer.seenCredits) {
this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.WIN_GAME, 0.0F)); entityplayer.showEndCredits();
this.seenCredits = true; return;

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Use null Locale by default
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index decd0dd48d8b77126b184ee21ceaf6c387085946..e61460a06708429738e0ed5f903a4226158aa334 100644 index ee5188f3aa2ff71306f5af8046e8ddf919c8601b..13a069483db22f25008bf4081d4aa2b36a75bc68 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -237,7 +237,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -237,7 +237,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@ -26,7 +26,7 @@ index decd0dd48d8b77126b184ee21ceaf6c387085946..e61460a06708429738e0ed5f903a4226
this.lastSectionPos = SectionPos.of(0, 0, 0); this.lastSectionPos = SectionPos.of(0, 0, 0);
this.chunkTrackingView = ChunkTrackingView.EMPTY; this.chunkTrackingView = ChunkTrackingView.EMPTY;
this.respawnDimension = Level.OVERWORLD; this.respawnDimension = Level.OVERWORLD;
@@ -2052,7 +2052,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -2051,7 +2051,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), this.getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT); PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), this.getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT);
this.server.server.getPluginManager().callEvent(event); this.server.server.getPluginManager().callEvent(event);
} }

Datei anzeigen

@ -123,10 +123,10 @@ index 6a80479554f0c860a8dd6baa1a6506858fca83e3..6324689f52363f19501143c1649f0885
} }
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 7bfe757b605f4e5a16b28214ac3b497e738b45b5..fb953b2172c322e8abf5aa50060adbc00fe92832 100644 index 6889991885cc2075e0936b2c480befeef30d308c..4495c5051b0c7a04d433c39d91f74cb7924d3ff2 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -466,8 +466,13 @@ public class LevelChunk extends ChunkAccess { @@ -471,8 +471,13 @@ public class LevelChunk extends ChunkAccess {
BlockState iblockdata = this.getBlockState(blockposition); BlockState iblockdata = this.getBlockState(blockposition);
if (!iblockdata.hasBlockEntity()) { if (!iblockdata.hasBlockEntity()) {
@ -142,7 +142,7 @@ index 7bfe757b605f4e5a16b28214ac3b497e738b45b5..fb953b2172c322e8abf5aa50060adbc0
} else { } else {
BlockState iblockdata1 = blockEntity.getBlockState(); BlockState iblockdata1 = blockEntity.getBlockState();
@@ -951,6 +956,7 @@ public class LevelChunk extends ChunkAccess { @@ -956,6 +961,7 @@ public class LevelChunk extends ChunkAccess {
// Paper start - Prevent block entity and entity crashes // 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()); 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.server.MinecraftServer.LOGGER.error(msg, throwable);

Datei anzeigen

@ -149,7 +149,7 @@ index 17fa2d3db112762bcb8b941b69b8ddcc53f47224..6c76aeddb34239a5acc204a17b2aa2d8
static Map<Enchantment, Integer> getEnchantments(net.minecraft.world.item.ItemStack item) { static Map<Enchantment, Integer> getEnchantments(net.minecraft.world.item.ItemStack item) {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 46e1fabf85cc0d92f79a7adf24e5724dc1dc08a9..69be26f8f47854f39cfed0559d944ef4f983c0f3 100644 index 7ae3cdb80335cbeb0ff695eb719a170651586722..97c40582bca095532fff9a81515f38ea4ac527e0 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -6,6 +6,7 @@ import com.google.common.collect.ImmutableList; @@ -6,6 +6,7 @@ import com.google.common.collect.ImmutableList;
@ -197,7 +197,7 @@ index 46e1fabf85cc0d92f79a7adf24e5724dc1dc08a9..69be26f8f47854f39cfed0559d944ef4
tag.entrySet().forEach((entry) -> { tag.entrySet().forEach((entry) -> {
Holder<net.minecraft.world.item.enchantment.Enchantment> id = entry.getKey(); Holder<net.minecraft.world.item.enchantment.Enchantment> id = entry.getKey();
@@ -729,13 +731,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -736,13 +738,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
return modifiers; return modifiers;
} }
@ -213,7 +213,7 @@ index 46e1fabf85cc0d92f79a7adf24e5724dc1dc08a9..69be26f8f47854f39cfed0559d944ef4
for (Map.Entry<?, ?> entry : ench.entrySet()) { for (Map.Entry<?, ?> entry : ench.entrySet()) {
Enchantment enchantment = CraftEnchantment.stringToBukkit(entry.getKey().toString()); Enchantment enchantment = CraftEnchantment.stringToBukkit(entry.getKey().toString());
if ((enchantment != null) && (entry.getValue() instanceof Integer)) { if ((enchantment != null) && (entry.getValue() instanceof Integer)) {
@@ -1072,14 +1074,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -1079,14 +1081,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@Override @Override
public Map<Enchantment, Integer> getEnchants() { public Map<Enchantment, Integer> getEnchants() {
@ -230,7 +230,7 @@ index 46e1fabf85cc0d92f79a7adf24e5724dc1dc08a9..69be26f8f47854f39cfed0559d944ef4
} }
if (ignoreRestrictions || level >= ench.getStartLevel() && level <= ench.getMaxLevel()) { if (ignoreRestrictions || level >= ench.getStartLevel() && level <= ench.getMaxLevel()) {
@@ -1679,7 +1681,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -1686,7 +1688,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
clone.customModelData = this.customModelData; clone.customModelData = this.customModelData;
clone.blockData = this.blockData; clone.blockData = this.blockData;
if (this.enchantments != null) { if (this.enchantments != null) {
@ -239,7 +239,7 @@ index 46e1fabf85cc0d92f79a7adf24e5724dc1dc08a9..69be26f8f47854f39cfed0559d944ef4
} }
if (this.hasAttributeModifiers()) { if (this.hasAttributeModifiers()) {
clone.attributeModifiers = LinkedHashMultimap.create(this.attributeModifiers); clone.attributeModifiers = LinkedHashMultimap.create(this.attributeModifiers);
@@ -2028,4 +2030,22 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -2036,4 +2038,22 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
return (result != null) ? result : Optional.empty(); return (result != null) ? result : Optional.empty();
} }

Datei anzeigen

@ -59,10 +59,10 @@ index 64db7e017b41bffcaac202ee4ecfd7df46d69331..14a821bfc6b20475889d3138b8da9e6b
@Override @Override
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 63e20db8ad84b332a4962d5cea83f1064b7c1a3d..bb296f649afd143adad47595479532cfdd778b71 100644 index 78f4bb474c85e32448a385e108707d92082bfe02..b68068c783f782258f86e5ecf54664916f069e38 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1901,4 +1901,13 @@ public class CraftEventFactory { @@ -1915,4 +1915,13 @@ public class CraftEventFactory {
Bukkit.getPluginManager().callEvent(new EntityRemoveEvent(entity.getBukkitEntity(), cause)); Bukkit.getPluginManager().callEvent(new EntityRemoveEvent(entity.getBukkitEntity(), cause));
} }

Datei anzeigen

@ -28,10 +28,10 @@ index 63c10be6eacd7108b8b4795d76bf624e0614440a..243eb1e54293c763a06febff551c0513
entitywitch.finalizeSpawn(world, world.getCurrentDifficultyAt(entitywitch.blockPosition()), MobSpawnType.CONVERSION, (SpawnGroupData) null); entitywitch.finalizeSpawn(world, world.getCurrentDifficultyAt(entitywitch.blockPosition()), MobSpawnType.CONVERSION, (SpawnGroupData) null);
entitywitch.setNoAi(this.isNoAi()); entitywitch.setNoAi(this.isNoAi());
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index bb296f649afd143adad47595479532cfdd778b71..5cf1b15160647b6e8e42a167502643882a231c55 100644 index b68068c783f782258f86e5ecf54664916f069e38..44c416f812867f19a26aeefc5710a7aef9dfdf64 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1211,6 +1211,14 @@ public class CraftEventFactory { @@ -1215,6 +1215,14 @@ public class CraftEventFactory {
return !event.isCancelled(); return !event.isCancelled();
} }

Datei anzeigen

@ -18,10 +18,10 @@ index 56402312e44d12c859e2c4b39902d31b7cfd1573..25a45e680f9fdea90f43d59de87a3a50
--this.count; --this.count;
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 5cf1b15160647b6e8e42a167502643882a231c55..6ffc5b9eb2fa084c7cf397d944e6fc1d8d770dbb 100644 index 44c416f812867f19a26aeefc5710a7aef9dfdf64..a83b7f350bf20f944de92df76e112aaa49dc608d 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1164,6 +1164,17 @@ public class CraftEventFactory { @@ -1168,6 +1168,17 @@ public class CraftEventFactory {
return event; return event;
} }

Datei anzeigen

@ -6,13 +6,13 @@ Subject: [PATCH] Add ProjectileCollideEvent
Deprecated now and replaced with ProjectileHitEvent Deprecated now and replaced with ProjectileHitEvent
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 6ffc5b9eb2fa084c7cf397d944e6fc1d8d770dbb..50a4e657508e21717a61900660d85203d9373e19 100644 index a83b7f350bf20f944de92df76e112aaa49dc608d..b5b237c56575e8ceb3e6471deec1e7712891a8e0 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1308,6 +1308,17 @@ public class CraftEventFactory { @@ -1321,6 +1321,16 @@ public class CraftEventFactory {
return CraftItemStack.asNMSCopy(bitem); Bukkit.getPluginManager().callEvent(crafterCraftEvent);
return crafterCraftEvent;
} }
+ // Paper start + // Paper start
+ @Deprecated + @Deprecated
+ public static com.destroystokyo.paper.event.entity.ProjectileCollideEvent callProjectileCollideEvent(Entity entity, EntityHitResult position) { + public static com.destroystokyo.paper.event.entity.ProjectileCollideEvent callProjectileCollideEvent(Entity entity, EntityHitResult position) {
@ -23,11 +23,10 @@ index 6ffc5b9eb2fa084c7cf397d944e6fc1d8d770dbb..50a4e657508e21717a61900660d85203
+ return event; + return event;
+ } + }
+ // Paper end + // Paper end
+
public static ProjectileLaunchEvent callProjectileLaunchEvent(Entity entity) { public static ProjectileLaunchEvent callProjectileLaunchEvent(Entity entity) {
Projectile bukkitEntity = (Projectile) entity.getBukkitEntity(); Projectile bukkitEntity = (Projectile) entity.getBukkitEntity();
ProjectileLaunchEvent event = new ProjectileLaunchEvent(bukkitEntity); @@ -1346,8 +1356,15 @@ public class CraftEventFactory {
@@ -1332,8 +1343,15 @@ public class CraftEventFactory {
if (position.getType() == HitResult.Type.ENTITY) { if (position.getType() == HitResult.Type.ENTITY) {
hitEntity = ((EntityHitResult) position).getEntity().getBukkitEntity(); hitEntity = ((EntityHitResult) position).getEntity().getBukkitEntity();
} }

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Properly fix item duplication bug
Credit to prplz for figuring out the real issue Credit to prplz for figuring out the real issue
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index ed920ed90569b7b8886a09a1c3772fd7147d44f9..9b2861b7894a634ce60a2675ee25c949d6e63ea0 100644 index 984dc7f7f7315b8a8cdb9744ef8454a330888ba7..f067b10e13f01e751fc4ebf088740c7d40afcb99 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2628,7 +2628,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -2627,7 +2627,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@Override @Override
public boolean isImmobile() { public boolean isImmobile() {

Datei anzeigen

@ -7,10 +7,10 @@ Allows you to access the Gateway being used in a teleport event
Fix the offset used for player teleportation Fix the offset used for player teleportation
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 9b2861b7894a634ce60a2675ee25c949d6e63ea0..a049a54ee70839706787f8de661ca6e6b1f54071 100644 index f067b10e13f01e751fc4ebf088740c7d40afcb99..e13692373d0efba9402c35ae5cce615dce0a5e1e 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1193,11 +1193,22 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -1192,11 +1192,22 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
ResourceKey<LevelStem> resourcekey = worldserver1.getTypeKey(); ResourceKey<LevelStem> resourcekey = worldserver1.getTypeKey();
if (worldserver != null && worldserver.dimension() == worldserver1.dimension()) { // CraftBukkit if (worldserver != null && worldserver.dimension() == worldserver1.dimension()) { // CraftBukkit

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Entity#fromMobSpawner()
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 46a21ed2408a42aafd16647e17e556730e799cbd..946f289e0e681524c6fde696921965dbdedda372 100644 index 85d8c4865b65792b99f812b579d7c23823d76e52..0e800e3aeeec84f5f7ed0a391c9b66ae5689bd40 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -402,6 +402,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -402,6 +402,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@ -48,6 +48,18 @@ index aa54237205989f619ac6a3faa2e4285427b9e31d..43d399e1a0ba2fb0541f851a28032fa6
// CraftBukkit start // CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) { if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) {
continue; continue;
diff --git a/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java b/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java
index 571756dacfa16f6755b67457e17969c35104f971..52d71a03cd5b2af56704f265ce5b5f14d3236ebb 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java
@@ -225,6 +225,7 @@ public final class TrialSpawner {
optional1.ifPresent(entityinsentient::equip);
}
+ entity.spawnedViaMobSpawner = true; // Paper
// CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callTrialSpawnerSpawnEvent(entity, pos).isCancelled()) {
return Optional.empty();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index df6da730134da754d0ff23bd1b57c82486b9ab73..69b5946625a53a1351ffc4bdf61c6874949bbeae 100644 index df6da730134da754d0ff23bd1b57c82486b9ab73..69b5946625a53a1351ffc4bdf61c6874949bbeae 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java

Datei anzeigen

@ -31,10 +31,10 @@ index 8f1992188f7fd9e735569e099b36a7eafed47aae..061c89b985dafc79c808dd5f0e296b9f
Bootstrap.isBootstrapped = true; Bootstrap.isBootstrapped = true;
Instant instant = Instant.now(); Instant instant = Instant.now();
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index fcc7cdd0adfcaa135d08ea36746dca980590d6eb..4c8d98598b5cdcdbe4a778f1ec142e3a7ab33196 100644 index 837db57c19df3d5c986a52edf3d9d8105cc87cde..446403f73fb1b5687d587889e6f32dce464d05a6 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -260,10 +260,12 @@ public class Main { @@ -249,10 +249,12 @@ public class Main {
Calendar deadline = Calendar.getInstance(); Calendar deadline = Calendar.getInstance();
deadline.add(Calendar.DAY_OF_YEAR, -14); deadline.add(Calendar.DAY_OF_YEAR, -14);
if (buildDate.before(deadline.getTime())) { if (buildDate.before(deadline.getTime())) {

Datei anzeigen

@ -13,18 +13,18 @@ also Avoid NPE during CraftBlockEntityState load if could not get TE
If Tile Entity was null, correct Sign to return empty lines instead of null If Tile Entity was null, correct Sign to return empty lines instead of null
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
index d20f71a2098b327423cbdbbc096aa9e358cb809d..7147484eefad44ba67db03b6ef2090a596e278de 100644 index d6ad310d3b472c40c128cfb459171d9f48e50915..48bee70ba4188a4a55beb6584224b0f23784dd88 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -58,6 +58,7 @@ public abstract class BlockEntity { @@ -59,6 +59,7 @@ public abstract class BlockEntity {
this.type = type;
this.worldPosition = pos.immutable(); this.worldPosition = pos.immutable();
this.validateBlockState(state);
this.blockState = state; this.blockState = state;
+ this.persistentDataContainer = new CraftPersistentDataContainer(DATA_TYPE_REGISTRY); // Paper - always init + this.persistentDataContainer = new CraftPersistentDataContainer(DATA_TYPE_REGISTRY); // Paper - always init
} }
public static BlockPos getPosFromTag(CompoundTag nbt) { private void validateBlockState(BlockState state) {
@@ -79,7 +80,7 @@ public abstract class BlockEntity { @@ -92,7 +93,7 @@ public abstract class BlockEntity {
// CraftBukkit start - read container // CraftBukkit start - read container
protected void loadAdditional(CompoundTag nbt, HolderLookup.Provider registryLookup) { protected void loadAdditional(CompoundTag nbt, HolderLookup.Provider registryLookup) {
@ -33,7 +33,7 @@ index d20f71a2098b327423cbdbbc096aa9e358cb809d..7147484eefad44ba67db03b6ef2090a5
net.minecraft.nbt.Tag persistentDataTag = nbt.get("PublicBukkitValues"); net.minecraft.nbt.Tag persistentDataTag = nbt.get("PublicBukkitValues");
if (persistentDataTag instanceof CompoundTag) { if (persistentDataTag instanceof CompoundTag) {
@@ -363,8 +364,15 @@ public abstract class BlockEntity { @@ -379,8 +380,15 @@ public abstract class BlockEntity {
// CraftBukkit start - add method // CraftBukkit start - add method
public InventoryHolder getOwner() { public InventoryHolder getOwner() {

Datei anzeigen

@ -13,7 +13,7 @@ starting point for future additions in this area.
Fixes GH-559 Fixes GH-559
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemMetas.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemMetas.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemMetas.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemMetas.java
index 85aab880fdb2f23d09096f8f2b1ede4f068fa023..4ae9930c2d74e5b1e3ad0c2ecf6556dc59cbf23c 100644 index eef3517833ff5c0cf41b89973ebc972b8ed31e0f..c9fbc01be0b0e7fd1cafb091d06496f4ba1e7c2c 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemMetas.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemMetas.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemMetas.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemMetas.java
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
@ -22,8 +22,8 @@ index 85aab880fdb2f23d09096f8f2b1ede4f068fa023..4ae9930c2d74e5b1e3ad0c2ecf6556dc
+import com.destroystokyo.paper.inventory.meta.ArmorStandMeta; +import com.destroystokyo.paper.inventory.meta.ArmorStandMeta;
import java.util.function.BiFunction; import java.util.function.BiFunction;
import java.util.function.Function; import java.util.function.Function;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.BannerItem;
@@ -95,7 +96,7 @@ public final class CraftItemMetas { @@ -102,7 +103,7 @@ public final class CraftItemMetas {
item -> new CraftMetaSpawnEgg(item.getComponentsPatch()), item -> new CraftMetaSpawnEgg(item.getComponentsPatch()),
(type, meta) -> meta instanceof CraftMetaSpawnEgg spawnEgg ? spawnEgg : new CraftMetaSpawnEgg(meta)); (type, meta) -> meta instanceof CraftMetaSpawnEgg spawnEgg ? spawnEgg : new CraftMetaSpawnEgg(meta));
@ -272,7 +272,7 @@ index c4f12f96e39cb6189799a796b4cb2cb4f0b92392..59bdac414e8205ed608f79ef0d1502ac
+ // Paper end + // Paper end
} }
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
index 99a555ca72cd95d760d68072242203deeddd0ce1..a1d8da4e0de3f84194f28d7d18fa795d53714590 100644 index b46032190dbb0d47ee3c1a11959f6278ddf5eb5a..0715f43f3f8235d28a12b9d49d78c765a946c53f 100644
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
@@ -364,6 +364,7 @@ public class ItemMetaTest extends AbstractTestingBase { @@ -364,6 +364,7 @@ public class ItemMetaTest extends AbstractTestingBase {

Datei anzeigen

@ -220,10 +220,10 @@ index 4602c3d0be94f0146a2b205268f70aaf85410f20..422c25577a0d95b31b5528fad8fc9b3a
public void onEntityRemove(Entity entity) { public void onEntityRemove(Entity entity) {
this.invertedVisibilityEntities.remove(entity.getUUID()); this.invertedVisibilityEntities.remove(entity.getUUID());
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index 8a1570ceb4755a1872911751943c84b8f06eb4c2..38339b8b1b3b70bbbf0259d7095b02ee8c22b609 100644 index 65f64de05a88844e62b5a0dd1e2f53edfb4e0c1f..e1b86308f737b957b6d00bc902b91856694b7cbf 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java --- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java +++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -448,6 +448,13 @@ public class Commodore { @@ -449,6 +449,13 @@ public class Commodore {
} }
// Paper end - Rewrite plugins // Paper end - Rewrite plugins

Datei anzeigen

@ -9,7 +9,7 @@ e.g. servers which allow and support the usage of mod packs.
provide an optional flag to disable this check, at your own risk. provide an optional flag to disable this check, at your own risk.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 19f644442eb7ae352d655d5e62f47f261b7b1b0a..db79201906e231b13c6f237193c3e8597bce9106 100644 index 422c25577a0d95b31b5528fad8fc9b3ae97fa7f0..4e5dba1da323f12d77a36635c9227b1239856254 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -209,6 +209,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -209,6 +209,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -25,7 +25,7 @@ index 19f644442eb7ae352d655d5e62f47f261b7b1b0a..db79201906e231b13c6f237193c3e859
public void addChannel(String channel) { public void addChannel(String channel) {
- Preconditions.checkState(this.channels.size() < 128, "Cannot register channel '%s'. Too many channels registered!", channel); - Preconditions.checkState(this.channels.size() < 128, "Cannot register channel '%s'. Too many channels registered!", channel);
+ Preconditions.checkState(DISABLE_CHANNEL_LIMIT || this.channels.size() < 128, "Cannot register channel '%s'. Too many channels registered!", channel); // Paper - flag to disable channel limit + Preconditions.checkState(DISABLE_CHANNEL_LIMIT || this.channels.size() < 128, "Cannot register channel. Too many channels registered!"); // Paper - flag to disable channel limit
channel = StandardMessenger.validateAndCorrectChannel(channel); channel = StandardMessenger.validateAndCorrectChannel(channel);
if (this.channels.add(channel)) { if (this.channels.add(channel)) {
this.server.getPluginManager().callEvent(new PlayerRegisterChannelEvent(this, channel)); this.server.getPluginManager().callEvent(new PlayerRegisterChannelEvent(this, channel));

Datei anzeigen

@ -22,10 +22,10 @@ index a14e00d55930628333cc63b18727ea56dbdc4ee3..f6d01d21745391595d61b191832be4c2
this.setUsingItem(true); this.setUsingItem(true);
if (!this.isSilent()) { if (!this.isSilent()) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 50a4e657508e21717a61900660d85203d9373e19..1c53b872b30bcd8535b8686015935025a4c9837f 100644 index b5b237c56575e8ceb3e6471deec1e7712891a8e0..cfdabb93c2d30845af9108552ed9bee9929250ce 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1947,4 +1947,14 @@ public class CraftEventFactory { @@ -1960,4 +1960,14 @@ public class CraftEventFactory {
).callEvent(); ).callEvent();
} }
// Paper end - PlayerUseUnknownEntityEvent // Paper end - PlayerUseUnknownEntityEvent

Datei anzeigen

@ -38,7 +38,7 @@ index fd49b9d739b1bbab8cf110659cb83bad03b56102..a2b727dea997ed0d7b1ef677a94b5957
} }
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index cccc60602360f25f0aeddbd16dad2bb63a1728a8..bf1b8ee85551ff1989369268edf8012758b86fd7 100644 index cccc60602360f25f0aeddbd16dad2bb63a1728a8..ada79af49d1cafe25ca6c1fb456e1c4c3a42cb73 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1528,7 +1528,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -1528,7 +1528,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -80,7 +80,7 @@ index cccc60602360f25f0aeddbd16dad2bb63a1728a8..bf1b8ee85551ff1989369268edf80127
+ // Paper start - knockback events + // Paper start - knockback events
+ Vec3 finalVelocity = new Vec3(vec3d.x / 2.0D - vec3d1.x, this.onGround() ? Math.min(0.4D, vec3d.y / 2.0D + d0) : vec3d.y, vec3d.z / 2.0D - vec3d1.z); + Vec3 finalVelocity = new Vec3(vec3d.x / 2.0D - vec3d1.x, this.onGround() ? Math.min(0.4D, vec3d.y / 2.0D + d0) : vec3d.y, vec3d.z / 2.0D - vec3d1.z);
+ Vec3 diff = finalVelocity.subtract(vec3d); + Vec3 diff = finalVelocity.subtract(vec3d);
+ io.papermc.paper.event.entity.EntityKnockbackEvent event = CraftEventFactory.callEntityKnockbackEvent((org.bukkit.craftbukkit.entity.CraftLivingEntity) this.getBukkitEntity(), attacker, cause, d0, diff); + io.papermc.paper.event.entity.EntityKnockbackEvent event = CraftEventFactory.callEntityKnockbackEvent((org.bukkit.craftbukkit.entity.CraftLivingEntity) this.getBukkitEntity(), attacker, attacker, cause, d0, diff);
+ // Paper end - knockback events + // Paper end - knockback events
if (event.isCancelled()) { if (event.isCancelled()) {
return; return;
@ -251,7 +251,7 @@ index de2bc78415ab4efb651030be6560d9c9778a1d17..1e00df3fa3c3b61daa3d59ee1173269a
public abstract void explode(Vec3 pos); public abstract void explode(Vec3 pos);
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 6476c644d3da824c5ee4190cb45cde678ff1188f..a5f4ecb96c508b94a92a43c864c075f6c61e296e 100644 index 6476c644d3da824c5ee4190cb45cde678ff1188f..b216140a8be65e210250358af8daf49344850f20 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java --- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -297,13 +297,10 @@ public class Explosion { @@ -297,13 +297,10 @@ public class Explosion {
@ -266,49 +266,49 @@ index 6476c644d3da824c5ee4190cb45cde678ff1188f..a5f4ecb96c508b94a92a43c864c075f6
- // want the vector to be the relative velocity will the event provides the absolute velocity - // want the vector to be the relative velocity will the event provides the absolute velocity
- vec3d1 = (event.isCancelled()) ? Vec3.ZERO : new Vec3(event.getFinalKnockback().getX(), event.getFinalKnockback().getY(), event.getFinalKnockback().getZ()).subtract(entity.getDeltaMovement()); - vec3d1 = (event.isCancelled()) ? Vec3.ZERO : new Vec3(event.getFinalKnockback().getX(), event.getFinalKnockback().getY(), event.getFinalKnockback().getZ()).subtract(entity.getDeltaMovement());
+ // Paper start - knockback events + // Paper start - knockback events
+ io.papermc.paper.event.entity.EntityKnockbackEvent event = CraftEventFactory.callEntityKnockbackEvent((org.bukkit.craftbukkit.entity.CraftLivingEntity) entity.getBukkitEntity(), this.damageSource.getEntity() != null ? this.damageSource.getEntity() : this.source, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.EXPLOSION, d13, vec3d1); + io.papermc.paper.event.entity.EntityKnockbackEvent event = CraftEventFactory.callEntityKnockbackEvent((org.bukkit.craftbukkit.entity.CraftLivingEntity) entity.getBukkitEntity(), this.source, this.damageSource.getEntity() != null ? this.damageSource.getEntity() : this.source, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.EXPLOSION, d13, vec3d1);
+ vec3d1 = event.isCancelled() ? Vec3.ZERO : org.bukkit.craftbukkit.util.CraftVector.toNMS(event.getKnockback()); + vec3d1 = event.isCancelled() ? Vec3.ZERO : org.bukkit.craftbukkit.util.CraftVector.toNMS(event.getKnockback());
+ // Paper end - knockback events + // Paper end - knockback events
} }
// CraftBukkit end // CraftBukkit end
entity.setDeltaMovement(entity.getDeltaMovement().add(vec3d1)); entity.setDeltaMovement(entity.getDeltaMovement().add(vec3d1));
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 1c53b872b30bcd8535b8686015935025a4c9837f..0888692736ef62e741aa41d3a72b9b8c3075dfcd 100644 index cfdabb93c2d30845af9108552ed9bee9929250ce..e1b7bd5c23ba79b84ad257b7fb45e251da3978e5 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1909,19 +1909,33 @@ public class CraftEventFactory { @@ -1922,19 +1922,33 @@ public class CraftEventFactory {
return event; return event;
} }
- public static EntityKnockbackEvent callEntityKnockbackEvent(CraftLivingEntity entity, Entity attacker, EntityKnockbackEvent.KnockbackCause cause, double force, Vec3 raw, double x, double y, double z) { - public static EntityKnockbackEvent callEntityKnockbackEvent(CraftLivingEntity entity, Entity attacker, EntityKnockbackEvent.KnockbackCause cause, double force, Vec3 raw, double x, double y, double z) {
- Vector bukkitRaw = new Vector(-raw.x, raw.y, -raw.z); // Due to how the knockback calculation works, we need to invert x and z. - Vector bukkitRaw = new Vector(-raw.x, raw.y, -raw.z); // Due to how the knockback calculation works, we need to invert x and z.
-
- EntityKnockbackEvent event;
+ // Paper start - replace knockback events + // Paper start - replace knockback events
+ public static io.papermc.paper.event.entity.EntityKnockbackEvent callEntityKnockbackEvent(CraftLivingEntity entity, Entity attacker, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause cause, double force, Vec3 knockback) { + public static io.papermc.paper.event.entity.EntityKnockbackEvent callEntityKnockbackEvent(CraftLivingEntity entity, Entity pusher, Entity attacker, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause cause, double force, Vec3 knockback) {
+ Vector apiKnockback = CraftVector.toBukkit(knockback); + Vector apiKnockback = CraftVector.toBukkit(knockback);
+ +
+ final Vector currentVelocity = entity.getVelocity(); + final Vector currentVelocity = entity.getVelocity();
+ final Vector legacyFinalKnockback = currentVelocity.clone().add(apiKnockback); + final Vector legacyFinalKnockback = currentVelocity.clone().add(apiKnockback);
+ final org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause legacyCause = org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.valueOf(cause.name()); + final org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause legacyCause = org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.valueOf(cause.name());
+ EntityKnockbackEvent legacyEvent; + EntityKnockbackEvent legacyEvent;
if (attacker != null) { + if (pusher != null) {
- event = new EntityKnockbackByEntityEvent(entity, attacker.getBukkitEntity(), cause, force, new Vector(-raw.x, raw.y, -raw.z), new Vector(x, y, z)); + legacyEvent = new EntityKnockbackByEntityEvent(entity, pusher.getBukkitEntity(), legacyCause, force, apiKnockback, legacyFinalKnockback);
+ legacyEvent = new EntityKnockbackByEntityEvent(entity, attacker.getBukkitEntity(), legacyCause, force, apiKnockback, legacyFinalKnockback); + } else {
} else {
- event = new EntityKnockbackEvent(entity, cause, force, new Vector(-raw.x, raw.y, -raw.z), new Vector(x, y, z));
+ legacyEvent = new EntityKnockbackEvent(entity, legacyCause, force, apiKnockback, legacyFinalKnockback); + legacyEvent = new EntityKnockbackEvent(entity, legacyCause, force, apiKnockback, legacyFinalKnockback);
} + }
+ legacyEvent.callEvent(); + legacyEvent.callEvent();
- Bukkit.getPluginManager().callEvent(event); - EntityKnockbackEvent event;
+ final io.papermc.paper.event.entity.EntityKnockbackEvent event; + final io.papermc.paper.event.entity.EntityKnockbackEvent event;
+ apiKnockback = legacyEvent.getFinalKnockback().subtract(currentVelocity); + apiKnockback = legacyEvent.getFinalKnockback().subtract(currentVelocity);
+ if (attacker != null) { if (attacker != null) {
- event = new EntityKnockbackByEntityEvent(entity, attacker.getBukkitEntity(), cause, force, new Vector(-raw.x, raw.y, -raw.z), new Vector(x, y, z));
+ event = new com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent(entity, attacker.getBukkitEntity(), cause, (float) force, apiKnockback); + event = new com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent(entity, attacker.getBukkitEntity(), cause, (float) force, apiKnockback);
+ } else { } else {
- event = new EntityKnockbackEvent(entity, cause, force, new Vector(-raw.x, raw.y, -raw.z), new Vector(x, y, z));
+ event = new io.papermc.paper.event.entity.EntityKnockbackEvent(entity, cause, apiKnockback); + event = new io.papermc.paper.event.entity.EntityKnockbackEvent(entity, cause, apiKnockback);
+ } }
-
- Bukkit.getPluginManager().callEvent(event);
+ event.setCancelled(legacyEvent.isCancelled()); + event.setCancelled(legacyEvent.isCancelled());
+ event.callEvent(); + event.callEvent();
return event; return event;

Datei anzeigen

@ -29,7 +29,7 @@ index 1fac100819e59d00f50e530d3a4157b56d966dba..4f777c9d8c3052f68bc0465c8a7386b8
} }
// Spigot End // Spigot End
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index db72318d822b876eb937f0f0f7f2b2139fb77df7..a3a1450949703851625bbb257e92b3be4d79a06a 100644 index fb5130b6378554ccb23fb7992e408497ca093ff3..0dee94f1dd27a0d7e709367450c5ef7956e27217 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -705,7 +705,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -705,7 +705,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@ -50,7 +50,7 @@ index db72318d822b876eb937f0f0f7f2b2139fb77df7..a3a1450949703851625bbb257e92b3be
} }
net.kyori.adventure.text.Component deathMessage = event.deathMessage() != null ? event.deathMessage() : net.kyori.adventure.text.Component.empty(); // Paper - Adventure net.kyori.adventure.text.Component deathMessage = event.deathMessage() != null ? event.deathMessage() : net.kyori.adventure.text.Component.empty(); // Paper - Adventure
@@ -1592,7 +1592,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -1591,7 +1591,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
} }
// CraftBukkit end // CraftBukkit end
if (this.containerMenu != this.inventoryMenu) { if (this.containerMenu != this.inventoryMenu) {
@ -59,7 +59,7 @@ index db72318d822b876eb937f0f0f7f2b2139fb77df7..a3a1450949703851625bbb257e92b3be
} }
// this.nextContainerCounter(); // CraftBukkit - moved up // this.nextContainerCounter(); // CraftBukkit - moved up
@@ -1622,7 +1622,13 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -1621,7 +1621,13 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@Override @Override
public void closeContainer() { public void closeContainer() {
@ -96,7 +96,7 @@ index 72edfb965aca81c2d2442b794b42baa04ec713b3..a954d3b0ff0917d857002dba70c54b3f
this.player.doCloseContainer(); this.player.doCloseContainer();
} }
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 9019e25f61d4fdb7c5d12ea7630b0bc23827ab6e..38cf3cf1cc7ebae4b6ca8a89dc026b5b4f0b4c2b 100644 index 26cee48ea3650aaf87fd2ba9c70d4ca9a88e2d87..25dee4848c8b2cff74075c6d26d384e71f706627 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -510,7 +510,7 @@ public abstract class PlayerList { @@ -510,7 +510,7 @@ public abstract class PlayerList {
@ -165,7 +165,7 @@ index 2e02fc22a889c9c8010ae8bff1b59a13219ae014..703bb1bb42b1668c04824489fd2f3490
@Override @Override
public boolean isBlocking() { public boolean isBlocking() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 326f36726c124385145c469566c2089439b5dd0f..0b4c5a2604f61a34b5666a9a83a2e644449997fd 100644 index 4e5dba1da323f12d77a36635c9227b1239856254..12c61db6d4b1284765f9bed3ae26131a118b318e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1273,7 +1273,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1273,7 +1273,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -178,10 +178,10 @@ index 326f36726c124385145c469566c2089439b5dd0f..0b4c5a2604f61a34b5666a9a83a2e644
// Check if the fromWorld and toWorld are the same. // Check if the fromWorld and toWorld are the same.
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 0888692736ef62e741aa41d3a72b9b8c3075dfcd..7fa68654c2e0c87dd779a1354fc103be4d7d7a46 100644 index 9225746382bcecb0bab655a8232fecc09169225d..bf3995795295c3224db97e4d6809c0f5da6ce55c 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1277,7 +1277,7 @@ public class CraftEventFactory { @@ -1281,7 +1281,7 @@ public class CraftEventFactory {
public static AbstractContainerMenu callInventoryOpenEvent(ServerPlayer player, AbstractContainerMenu container, boolean cancelled) { public static AbstractContainerMenu callInventoryOpenEvent(ServerPlayer player, AbstractContainerMenu container, boolean cancelled) {
if (player.containerMenu != player.inventoryMenu) { // fire INVENTORY_CLOSE if one already open if (player.containerMenu != player.inventoryMenu) { // fire INVENTORY_CLOSE if one already open
@ -190,7 +190,7 @@ index 0888692736ef62e741aa41d3a72b9b8c3075dfcd..7fa68654c2e0c87dd779a1354fc103be
} }
CraftServer server = player.level().getCraftServer(); CraftServer server = player.level().getCraftServer();
@@ -1464,8 +1464,18 @@ public class CraftEventFactory { @@ -1477,8 +1477,18 @@ public class CraftEventFactory {
return event; return event;
} }

Datei anzeigen

@ -89,10 +89,10 @@ index a9227581ec78a56e96dc3a342006e4a649906326..5929b450a26e7c3cf63de3dc1d0e67cb
public boolean isClientSide() { public boolean isClientSide() {
return this.isClientSide; return this.isClientSide;
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 7fa68654c2e0c87dd779a1354fc103be4d7d7a46..a221ae7ec1a7db9c38037fa71ea35b5309b99973 100644 index ad271871b207b425ef8d599fe74a67d065d66686..d1b473ef83df0ed4ae7cd9dd0525dac5e8a41223 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1314,6 +1314,14 @@ public class CraftEventFactory { @@ -1327,6 +1327,14 @@ public class CraftEventFactory {
Projectile projectile = (Projectile) entity.getBukkitEntity(); Projectile projectile = (Projectile) entity.getBukkitEntity();
org.bukkit.entity.Entity collided = position.getEntity().getBukkitEntity(); org.bukkit.entity.Entity collided = position.getEntity().getBukkitEntity();
com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = new com.destroystokyo.paper.event.entity.ProjectileCollideEvent(projectile, collided); com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = new com.destroystokyo.paper.event.entity.ProjectileCollideEvent(projectile, collided);

Datei anzeigen

@ -7,10 +7,10 @@ Avoids a hashmap lookup by cacheing a reference to the CraftBlockData
and cloning it when one is needed. and cloning it when one is needed.
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index 4ac248f9f5f4f7aa95ddd6e3c3dab1ce94e73d66..d02f7a547dbe8943f82c07103b1fff203e4533c2 100644 index 59fcaca90b67c03e1a6799e58061dbae3b1f1ceb..46dd499c2023ec482ae7204d2894fb4100d9233b 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -813,6 +813,14 @@ public abstract class BlockBehaviour implements FeatureElement { @@ -820,6 +820,14 @@ public abstract class BlockBehaviour implements FeatureElement {
this.instrument = blockbase_info.instrument; this.instrument = blockbase_info.instrument;
this.replaceable = blockbase_info.replaceable; this.replaceable = blockbase_info.replaceable;
} }

Datei anzeigen

@ -443,10 +443,10 @@ index 92f9502a2d5721ebb1757a069a0f138db66628d7..6c5bd88777ff79c7408cf5ffed0f099a
public void injectScaledMaxHealth(Collection<AttributeInstance> collection, boolean force) { public void injectScaledMaxHealth(Collection<AttributeInstance> collection, boolean force) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index a221ae7ec1a7db9c38037fa71ea35b5309b99973..d3baf38cf45d13eeffedcc697468842e3ac117d3 100644 index d1b473ef83df0ed4ae7cd9dd0525dac5e8a41223..a9a2b35378d6654ba00a48737f596553445214aa 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -897,9 +897,16 @@ public class CraftEventFactory { @@ -901,9 +901,16 @@ public class CraftEventFactory {
CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity(); CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity();
CraftDamageSource bukkitDamageSource = new CraftDamageSource(damageSource); CraftDamageSource bukkitDamageSource = new CraftDamageSource(damageSource);
EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(damageSource.getEntity())); EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(damageSource.getEntity()));
@ -463,7 +463,7 @@ index a221ae7ec1a7db9c38037fa71ea35b5309b99973..d3baf38cf45d13eeffedcc697468842e
victim.expToDrop = event.getDroppedExp(); victim.expToDrop = event.getDroppedExp();
for (org.bukkit.inventory.ItemStack stack : event.getDrops()) { for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
@@ -917,7 +924,14 @@ public class CraftEventFactory { @@ -921,7 +928,14 @@ public class CraftEventFactory {
PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(damageSource.getEntity()), 0, deathMessage); PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(damageSource.getEntity()), 0, deathMessage);
event.setKeepInventory(keepInventory); event.setKeepInventory(keepInventory);
event.setKeepLevel(victim.keepLevel); // SPIGOT-2222: pre-set keepLevel event.setKeepLevel(victim.keepLevel); // SPIGOT-2222: pre-set keepLevel
@ -478,7 +478,7 @@ index a221ae7ec1a7db9c38037fa71ea35b5309b99973..d3baf38cf45d13eeffedcc697468842e
victim.keepLevel = event.getKeepLevel(); victim.keepLevel = event.getKeepLevel();
victim.newLevel = event.getNewLevel(); victim.newLevel = event.getNewLevel();
@@ -940,6 +954,31 @@ public class CraftEventFactory { @@ -944,6 +958,31 @@ public class CraftEventFactory {
return event; return event;
} }

Datei anzeigen

@ -19,10 +19,10 @@ spectate the target entity.
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com> Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index ff3f70b8c266dc3b2ab374ffd6905ecbfe8510be..29dc317d43532399651719d45ca05b086043ae6b 100644 index fa8640f961b93dc811296131dfda58faa1908add..15328d344a26f5c40011ee6ba0bc54dd5ab0b87b 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2183,6 +2183,21 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -2182,6 +2182,21 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
this.camera = (Entity) (entity == null ? this : entity); this.camera = (Entity) (entity == null ? this : entity);
if (entity1 != this.camera) { if (entity1 != this.camera) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Reset players airTicks on respawn
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 29dc317d43532399651719d45ca05b086043ae6b..1108fa6c7ac28304d104d4e5df2bdf4e9a6bd929 100644 index 15328d344a26f5c40011ee6ba0bc54dd5ab0b87b..7cca5c778f9d20cfa6cb543c9afcf74779aaa355 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2704,6 +2704,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -2703,6 +2703,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
this.setHealth(this.getMaxHealth()); this.setHealth(this.getMaxHealth());
this.stopUsingItem(); // CraftBukkit - SPIGOT-6682: Clear active item on reset this.stopUsingItem(); // CraftBukkit - SPIGOT-6682: Clear active item on reset

Datei anzeigen

@ -20,10 +20,10 @@ this is going to be the best soultion all around.
Improvements/suggestions welcome! Improvements/suggestions welcome!
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 1108fa6c7ac28304d104d4e5df2bdf4e9a6bd929..b4947ee9615b1b2108046b9ab87b65b53dbb23f6 100644 index 7cca5c778f9d20cfa6cb543c9afcf74779aaa355..c2571855ca6a8ecd144b8fbb97d601d1808e8d61 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2523,9 +2523,15 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -2522,9 +2522,15 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@Override @Override
public void stopRiding() { public void stopRiding() {
@ -106,7 +106,7 @@ index 7fd1a75ba0068ee3ca6c29a550a9a1b33c5cacc5..f330ddca00ed11bf76ae825820423b94
if (this.valid) { if (this.valid) {
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 43eddcd8496ff2f089119f6632acfe1b56466c3d..e047911c7faa3cdcd3df8899857fcadf3eec3d89 100644 index 689aaf4ceedc598fe71db726215cceae6cc97296..fad0445628499ac14cd9d8ab7f618c490885e798 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3619,9 +3619,15 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3619,9 +3619,15 @@ public abstract class LivingEntity extends Entity implements Attackable {

Datei anzeigen

@ -1,15 +1,15 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Fri, 16 Nov 2018 23:08:50 -0500 Date: Fri, 16 Nov 2018 23:08:50 -0500
Subject: [PATCH] Book Size Limits Subject: [PATCH] Book size limits
Puts some limits on the size of books. Puts some limits on the size of books.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 2e35c6cfdf0cded5adc9f512612faaa68876961c..abab7c6ce2079a0101c59c130fd65db7b2a73498 100644 index 2e35c6cfdf0cded5adc9f512612faaa68876961c..d69b678b2611f3d1b1ef64541863256868969671 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1043,6 +1043,45 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1043,6 +1043,40 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override @Override
public void handleEditBook(ServerboundEditBookPacket packet) { public void handleEditBook(ServerboundEditBookPacket packet) {
@ -18,15 +18,10 @@ index 2e35c6cfdf0cded5adc9f512612faaa68876961c..abab7c6ce2079a0101c59c130fd65db7
+ List<String> pageList = packet.pages(); + List<String> pageList = packet.pages();
+ long byteTotal = 0; + long byteTotal = 0;
+ int maxBookPageSize = io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.pageMax; + int maxBookPageSize = io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.pageMax;
+ double multiplier = Math.max(0.3D, Math.min(1D, io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.totalMultiplier)); + double multiplier = Math.clamp(io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.totalMultiplier, 0.3D, 1D);
+ long byteAllowed = maxBookPageSize; + long byteAllowed = maxBookPageSize;
+ for (String testString : pageList) { + for (String testString : pageList) {
+ int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length; + 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!");
+ this.disconnect(Component.literal("Book too large!"));
+ return;
+ }
+ byteTotal += byteLength; + byteTotal += byteLength;
+ int length = testString.length(); + int length = testString.length();
+ int multibytes = 0; + int multibytes = 0;
@ -37,7 +32,7 @@ index 2e35c6cfdf0cded5adc9f512612faaa68876961c..abab7c6ce2079a0101c59c130fd65db7
+ } + }
+ } + }
+ } + }
+ byteAllowed += (maxBookPageSize * Math.min(1, Math.max(0.1D, (double) length / 255D))) * multiplier; + byteAllowed += maxBookPageSize * Math.clamp((double) length / 255D, 0.1D, 1) * multiplier;
+ +
+ if (multibytes > 1) { + if (multibytes > 1) {
+ // penalize MB + // penalize MB
@ -46,7 +41,7 @@ index 2e35c6cfdf0cded5adc9f512612faaa68876961c..abab7c6ce2079a0101c59c130fd65db7
+ } + }
+ +
+ if (byteTotal > byteAllowed) { + 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()); + ServerGamePacketListenerImpl.LOGGER.warn("{} tried to send a book too large. Book size: {} - Allowed: {} - Pages: {}", this.player.getScoreboardName(), byteTotal, byteAllowed, pageList.size());
+ this.disconnect(Component.literal("Book too large!")); + this.disconnect(Component.literal("Book too large!"));
+ return; + return;
+ } + }

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Workaround for vehicle tracking issue on disconnect
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index dbdc6b4065acc363c128580fdffe9049259386c2..afed961e6714abc1a1709d12973cbfae40b950fa 100644 index bd130d3a4d0cfe431be627c3f4d85bb394fe099b..ad2b8ea068469f2b0597c0e0436ad3c94dcb62ea 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1834,6 +1834,13 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -1833,6 +1833,13 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
public void disconnect() { public void disconnect() {
this.disconnected = true; this.disconnected = true;
this.ejectPassengers(); this.ejectPassengers();

Datei anzeigen

@ -22,7 +22,7 @@ it only impacts data sent from the client.
Set -DPaper.maxSignLength=XX to change limit or -1 to disable Set -DPaper.maxSignLength=XX to change limit or -1 to disable
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 29678ddb0cb53fae9ae497614690f9d855f9eb86..86cb92b7cf18272ee4b46c292ed4a7192119ce1a 100644 index 1c91e1812e536bb59dbb37aec47afca1d59ffa8d..e78a6234d6699e7f14c5ac7faa7d1ee60e46d7f9 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -299,6 +299,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -299,6 +299,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -33,7 +33,7 @@ index 29678ddb0cb53fae9ae497614690f9d855f9eb86..86cb92b7cf18272ee4b46c292ed4a719
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player, CommonListenerCookie clientData) { public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player, CommonListenerCookie clientData) {
super(server, connection, clientData, player); // CraftBukkit super(server, connection, clientData, player); // CraftBukkit
@@ -3151,7 +3152,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3146,7 +3147,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override @Override
public void handleSignUpdate(ServerboundSignUpdatePacket packet) { public void handleSignUpdate(ServerboundSignUpdatePacket packet) {

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen