Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59f43ad200 | ||
|
|
6cc87f8fc0 |
No files matched your search
+12
-17
@@ -1,44 +1,39 @@
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
charset=utf-8
|
||||
end_of_line=lf
|
||||
insert_final_newline=true
|
||||
indent_style=space
|
||||
indent_size=4
|
||||
ij_any_block_comment_add_space = false
|
||||
ij_any_block_comment_at_first_column = false
|
||||
ij_any_line_comment_at_first_column = false
|
||||
ij_any_line_comment_add_space = true
|
||||
|
||||
[*.tiny]
|
||||
indent_style = tab
|
||||
indent_style=tab
|
||||
|
||||
[*.bat]
|
||||
end_of_line = crlf
|
||||
end_of_line=crlf
|
||||
|
||||
[*.yml]
|
||||
indent_size = 2
|
||||
indent_size=2
|
||||
|
||||
[*.patch]
|
||||
trim_trailing_whitespace = false
|
||||
trim_trailing_whitespace=false
|
||||
|
||||
[*.java]
|
||||
ij_continuation_indent_size = 4
|
||||
ij_java_class_count_to_use_import_on_demand = 999999
|
||||
ij_java_insert_inner_class_imports = false
|
||||
ij_java_names_count_to_use_import_on_demand = 999999
|
||||
ij_java_imports_layout = *, |, $*
|
||||
ij_java_imports_layout = *,|,$*
|
||||
ij_java_generate_final_locals = true
|
||||
ij_java_generate_final_parameters = true
|
||||
ij_java_method_parameters_new_line_after_left_paren = true
|
||||
ij_java_method_parameters_right_paren_on_new_line = true
|
||||
ij_java_use_fq_class_names = false
|
||||
ij_java_class_names_in_javadoc = 1
|
||||
|
||||
[paper-server/src/minecraft/java/**/*.java]
|
||||
ij_java_use_fq_class_names = true
|
||||
|
||||
[paper-server/src/minecraft/resources/data/**/*.json]
|
||||
indent_size = 2
|
||||
|
||||
[paper-api/src/generated/java/**/*.java]
|
||||
ij_java_imports_layout = $*, |, *
|
||||
[paper-api-generator/generated/**/*.java]
|
||||
ij_java_imports_layout = $*,|,*
|
||||
@@ -5,4 +5,3 @@ gradlew text eol=lf
|
||||
*.bat text eol=crlf
|
||||
|
||||
*.jar binary
|
||||
.gitea/CODEOWNERS linguist-detectable=false
|
||||
@@ -1,3 +0,0 @@
|
||||
# Pull requests request review from the eligible staff team(s).
|
||||
# One approval from either an Admin or Developer satisfies branch protection.
|
||||
* @trueog/Admins @trueog/Developers
|
||||
@@ -16,17 +16,8 @@ on:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# The goal of the build workflow is split into multiple requirements.
|
||||
# 1. Run on pushes to same repo.
|
||||
# 2. Run on PR open/reopen/syncs from repos that are not the same (PRs from the same repo are covered by 1)
|
||||
# 3. Run on labeled PRs that have the build-pr-jar flag.
|
||||
if: >
|
||||
(
|
||||
(github.event_name == 'push')
|
||||
|| (github.event_name == 'pull_request' && github.repository != github.event.pull_request.head.repo.full_name && contains(fromJSON('["opened", "reopened", "synchronize"]'), github.event.action))
|
||||
|| (github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'build-pr-jar')
|
||||
)
|
||||
|
||||
# Run on all label events (won't be duplicated) or all push events or on PR syncs not from the same repo
|
||||
if: (github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'build-pr-jar') || github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
|
||||
+1
-2
@@ -208,8 +208,7 @@ required.
|
||||
with `// Paper end - <COMMIT DESCRIPTION>`.
|
||||
- One-line changes should have `// Paper - <COMMIT DESCRIPTION>` at the end of the line.
|
||||
|
||||
> [!NOTE]
|
||||
> These comments are incredibly important to be able to keep track of changes
|
||||
> [!NOTE] These comments are incredibly important to be able to keep track of changes
|
||||
> across files and to remember what they are for, even a decade into the future.
|
||||
|
||||
Here's an example of how to mark changes by Paper:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tiny 2 0 spigot mojang
|
||||
tiny 2 0 spigot mojang+yarn
|
||||
|
||||
# Originally DistanceManager, which also implements DistanceManager, so clashes since the implemented class
|
||||
# is imported and not fully qualified. Easiest fix is to just change the name
|
||||
|
||||
@@ -110,8 +110,6 @@ public net.minecraft.server.network.ServerLoginPacketListenerImpl connection
|
||||
public net.minecraft.server.network.ServerLoginPacketListenerImpl state
|
||||
public net.minecraft.server.network.ServerLoginPacketListenerImpl$State
|
||||
public net.minecraft.server.packs.VanillaPackResourcesBuilder safeGetPath(Ljava/net/URI;)Ljava/nio/file/Path;
|
||||
public net.minecraft.server.packs.repository.FolderRepositorySource$FolderPackDetector
|
||||
public net.minecraft.server.packs.repository.FolderRepositorySource$FolderPackDetector <init>(Lnet/minecraft/world/level/validation/DirectoryValidator;)V
|
||||
public net.minecraft.server.packs.repository.Pack resources
|
||||
public net.minecraft.server.players.PlayerList playerIo
|
||||
public net.minecraft.server.players.PlayerList players
|
||||
@@ -186,7 +184,6 @@ public net.minecraft.world.entity.Entity getEncodeId()Ljava/lang/String;
|
||||
public net.minecraft.world.entity.Entity getFireImmuneTicks()I
|
||||
public net.minecraft.world.entity.Entity getSharedFlag(I)Z
|
||||
public net.minecraft.world.entity.Entity hasVisualFire
|
||||
public net.minecraft.world.entity.Entity isAffectedByBlocks()Z
|
||||
public net.minecraft.world.entity.Entity isInBubbleColumn()Z
|
||||
public net.minecraft.world.entity.Entity isInRain()Z
|
||||
public net.minecraft.world.entity.Entity isInvulnerableToBase(Lnet/minecraft/world/damagesource/DamageSource;)Z
|
||||
@@ -197,7 +194,6 @@ public net.minecraft.world.entity.Entity random
|
||||
public net.minecraft.world.entity.Entity setLevel(Lnet/minecraft/world/level/Level;)V
|
||||
public net.minecraft.world.entity.Entity setRot(FF)V
|
||||
public net.minecraft.world.entity.Entity setSharedFlag(IZ)V
|
||||
public net.minecraft.world.entity.Entity teleportPassengers()V
|
||||
public net.minecraft.world.entity.Entity unsetRemoved()V
|
||||
public net.minecraft.world.entity.Entity wasTouchingWater
|
||||
public net.minecraft.world.entity.ExperienceOrb count
|
||||
@@ -505,7 +501,6 @@ public net.minecraft.world.item.ItemStackLinkedSet TYPE_AND_TAG
|
||||
public net.minecraft.world.item.JukeboxSongPlayer song
|
||||
public net.minecraft.world.item.MapItem createNewSavedData(Lnet/minecraft/world/level/Level;IIIZZLnet/minecraft/resources/ResourceKey;)Lnet/minecraft/world/level/saveddata/maps/MapId;
|
||||
public net.minecraft.world.item.StandingAndWallBlockItem wallBlock
|
||||
public net.minecraft.world.item.component.BundleContents$Mutable getMaxAmountToAdd(Lnet/minecraft/world/item/ItemStack;)I
|
||||
public net.minecraft.world.item.component.ItemContainerContents MAX_SIZE
|
||||
public net.minecraft.world.item.component.ItemContainerContents items
|
||||
public net.minecraft.world.item.context.UseOnContext <init>(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/InteractionHand;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/phys/BlockHitResult;)V
|
||||
@@ -625,16 +620,9 @@ public net.minecraft.world.level.block.entity.TheEndGatewayBlockEntity exitPorta
|
||||
public net.minecraft.world.level.block.entity.TrialSpawnerBlockEntity trialSpawner
|
||||
public net.minecraft.world.level.block.entity.trialspawner.TrialSpawner isOminous
|
||||
public net.minecraft.world.level.block.entity.trialspawner.TrialSpawner stateAccessor
|
||||
public net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerData cooldownEndsAt
|
||||
public net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerData currentMobs
|
||||
public net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerData detectedPlayers
|
||||
public net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerData nextMobSpawnsAt
|
||||
public net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerData nextSpawnData
|
||||
public net.minecraft.world.level.block.entity.vault.VaultBlockEntity serverData
|
||||
public net.minecraft.world.level.block.entity.vault.VaultServerData getRewardedPlayers()Ljava/util/Set;
|
||||
public net.minecraft.world.level.block.entity.vault.VaultServerData pauseStateUpdatingUntil(J)V
|
||||
public net.minecraft.world.level.block.entity.vault.VaultServerData stateUpdatingResumesAt()J
|
||||
public net.minecraft.world.level.block.entity.vault.VaultSharedData getConnectedPlayers()Ljava/util/Set;
|
||||
public net.minecraft.world.level.block.state.BlockBehaviour getMenuProvider(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/MenuProvider;
|
||||
public net.minecraft.world.level.block.state.BlockBehaviour hasCollision
|
||||
public net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase destroySpeed
|
||||
@@ -733,7 +721,6 @@ public-f net.minecraft.world.item.trading.MerchantOffer rewardExp
|
||||
public-f net.minecraft.world.item.trading.MerchantOffer xp
|
||||
public-f net.minecraft.world.level.LevelSettings hardcore
|
||||
public-f net.minecraft.world.level.LevelSettings levelName
|
||||
public-f net.minecraft.world.level.block.ChestBlock MENU_PROVIDER_COMBINER
|
||||
public-f net.minecraft.world.level.block.entity.BannerBlockEntity baseColor
|
||||
public-f net.minecraft.world.level.block.entity.trialspawner.TrialSpawner normalConfig
|
||||
public-f net.minecraft.world.level.block.entity.trialspawner.TrialSpawner ominousConfig
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
# a significant amount of time for us to track down every possible issue, so this file will likely be around and in
|
||||
# use - at least in some capacity - for a long time.
|
||||
|
||||
tiny 2 0 mojang spigot
|
||||
tiny 2 0 mojang+yarn spigot
|
||||
|
||||
# CraftBukkit changes type
|
||||
c net/minecraft/server/level/ServerLevel net/minecraft/server/level/WorldServer
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ import java.nio.file.Path
|
||||
import kotlin.random.Random
|
||||
|
||||
plugins {
|
||||
id("io.papermc.paperweight.core") version "2.0.0-beta.14" apply false
|
||||
id("io.papermc.paperweight.core") version "2.0.0-beta.8" apply false
|
||||
}
|
||||
|
||||
subprojects {
|
||||
|
||||
@@ -16,7 +16,7 @@ dependencies {
|
||||
implementation("com.squareup:javapoet:1.13.0")
|
||||
implementation(project(":paper-api"))
|
||||
implementation("io.github.classgraph:classgraph:4.8.47")
|
||||
implementation("org.jetbrains:annotations:26.0.1")
|
||||
implementation("org.jetbrains:annotations:24.1.0")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||
}
|
||||
@@ -25,7 +25,7 @@ tasks.register<JavaExec>("generate") {
|
||||
dependsOn(tasks.check)
|
||||
mainClass.set("io.papermc.generator.Main")
|
||||
classpath(sourceSets.main.map { it.runtimeClasspath })
|
||||
args(rootProject.layout.projectDirectory.dir("paper-api/src/generated/java").asFile.absolutePath)
|
||||
args(projectDir.toPath().resolve("generated").toString())
|
||||
javaLauncher = javaToolchains.defaultJavaLauncher(project)
|
||||
}
|
||||
|
||||
|
||||
File renamed without changes.
+2
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class AttributeKeys {
|
||||
/**
|
||||
* {@code minecraft:armor}
|
||||
+3
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.block.banner.PatternType;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class BannerPatternKeys {
|
||||
/**
|
||||
* {@code minecraft:base}
|
||||
@@ -335,6 +337,7 @@ public final class BannerPatternKeys {
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<PatternType> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.BANNER_PATTERN, key);
|
||||
}
|
||||
+3
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class BiomeKeys {
|
||||
/**
|
||||
* {@code minecraft:badlands}
|
||||
@@ -489,6 +491,7 @@ public final class BiomeKeys {
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<Biome> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.BIOME, key);
|
||||
}
|
||||
+2
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.block.BlockType;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class BlockTypeKeys {
|
||||
/**
|
||||
* {@code minecraft:acacia_button}
|
||||
+2
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.entity.Cat;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class CatVariantKeys {
|
||||
/**
|
||||
* {@code minecraft:all_black}
|
||||
+3
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.damage.DamageType;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class DamageTypeKeys {
|
||||
/**
|
||||
* {@code minecraft:arrow}
|
||||
@@ -377,6 +379,7 @@ public final class DamageTypeKeys {
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<DamageType> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.DAMAGE_TYPE, key);
|
||||
}
|
||||
+3
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class EnchantmentKeys {
|
||||
/**
|
||||
* {@code minecraft:aqua_affinity}
|
||||
@@ -328,6 +330,7 @@ public final class EnchantmentKeys {
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<Enchantment> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.ENCHANTMENT, key);
|
||||
}
|
||||
+2
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.Fluid;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class FluidKeys {
|
||||
/**
|
||||
* {@code minecraft:empty}
|
||||
+2
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.entity.Frog;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class FrogVariantKeys {
|
||||
/**
|
||||
* {@code minecraft:cold}
|
||||
+3
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.GameEvent;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class GameEventKeys {
|
||||
/**
|
||||
* {@code minecraft:block_activate}
|
||||
@@ -454,6 +456,7 @@ public final class GameEventKeys {
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<GameEvent> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.GAME_EVENT, key);
|
||||
}
|
||||
+3
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.MusicInstrument;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class InstrumentKeys {
|
||||
/**
|
||||
* {@code minecraft:admire_goat_horn}
|
||||
@@ -90,6 +92,7 @@ public final class InstrumentKeys {
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<MusicInstrument> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.INSTRUMENT, key);
|
||||
}
|
||||
+2
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.inventory.ItemType;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class ItemTypeKeys {
|
||||
/**
|
||||
* {@code minecraft:acacia_boat}
|
||||
+3
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.JukeboxSong;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class JukeboxSongKeys {
|
||||
/**
|
||||
* {@code minecraft:11}
|
||||
@@ -167,6 +169,7 @@ public final class JukeboxSongKeys {
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<JukeboxSong> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.JUKEBOX_SONG, key);
|
||||
}
|
||||
+2
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.map.MapCursor;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class MapDecorationTypeKeys {
|
||||
/**
|
||||
* {@code minecraft:banner_black}
|
||||
+2
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.inventory.MenuType;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class MenuTypeKeys {
|
||||
/**
|
||||
* {@code minecraft:anvil}
|
||||
+2
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class MobEffectKeys {
|
||||
/**
|
||||
* {@code minecraft:absorption}
|
||||
+3
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.Art;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class PaintingVariantKeys {
|
||||
/**
|
||||
* {@code minecraft:alban}
|
||||
@@ -384,6 +386,7 @@ public final class PaintingVariantKeys {
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<Art> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.PAINTING_VARIANT, key);
|
||||
}
|
||||
+2
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.Sound;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class SoundEventKeys {
|
||||
/**
|
||||
* {@code minecraft:ambient.basalt_deltas.additions}
|
||||
+3
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.generator.structure.Structure;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class StructureKeys {
|
||||
/**
|
||||
* {@code minecraft:ancient_city}
|
||||
@@ -272,6 +274,7 @@ public final class StructureKeys {
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<Structure> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.STRUCTURE, key);
|
||||
}
|
||||
+2
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.generator.structure.StructureType;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class StructureTypeKeys {
|
||||
/**
|
||||
* {@code minecraft:buried_treasure}
|
||||
+3
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.inventory.meta.trim.TrimMaterial;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class TrimMaterialKeys {
|
||||
/**
|
||||
* {@code minecraft:amethyst}
|
||||
@@ -111,6 +113,7 @@ public final class TrimMaterialKeys {
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<TrimMaterial> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.TRIM_MATERIAL, key);
|
||||
}
|
||||
+3
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.inventory.meta.trim.TrimPattern;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class TrimPatternKeys {
|
||||
/**
|
||||
* {@code minecraft:bolt}
|
||||
@@ -160,6 +162,7 @@ public final class TrimPatternKeys {
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<TrimPattern> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.TRIM_PATTERN, key);
|
||||
}
|
||||
+2
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class VillagerProfessionKeys {
|
||||
/**
|
||||
* {@code minecraft:armorer}
|
||||
+2
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class VillagerTypeKeys {
|
||||
/**
|
||||
* {@code minecraft:desert}
|
||||
+3
@@ -7,6 +7,7 @@ import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class WolfVariantKeys {
|
||||
/**
|
||||
* {@code minecraft:ashen}
|
||||
@@ -97,6 +99,7 @@ public final class WolfVariantKeys {
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TypedKey<Wolf.Variant> create(final Key key) {
|
||||
return TypedKey.create(RegistryKey.WOLF_VARIANT, key);
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -21,7 +21,6 @@ import org.bukkit.block.banner.PatternType;
|
||||
import org.bukkit.damage.DamageType;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Cat;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Frog;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.bukkit.entity.Wolf;
|
||||
@@ -80,9 +79,6 @@ public interface Generators {
|
||||
simpleTagKey("BannerPatternTagKeys", PatternType.class, Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN),
|
||||
simpleTagKey("PaintingVariantTagKeys", Art.class, Registries.PAINTING_VARIANT, RegistryKey.PAINTING_VARIANT),
|
||||
simpleTagKey("InstrumentTagKeys", MusicInstrument.class, Registries.INSTRUMENT, RegistryKey.INSTRUMENT),
|
||||
|
||||
// api only
|
||||
simpleTagKey("EntityTypeTagKeys", EntityType.class, Registries.ENTITY_TYPE, RegistryKey.ENTITY_TYPE),
|
||||
new MobGoalGenerator("VanillaGoal", "com.destroystokyo.paper.entity.ai")
|
||||
};
|
||||
|
||||
|
||||
@@ -101,6 +101,7 @@ public class GeneratedKeyType<T, A> extends SimpleGenerator {
|
||||
.addCode("return $T.create($T.$L, $N);", TypedKey.class, RegistryKey.class, requireNonNull(REGISTRY_KEY_FIELD_NAMES.get(this.apiRegistryKey), "Missing field for " + this.apiRegistryKey), keyParam)
|
||||
.returns(returnType);
|
||||
if (this.publicCreateKeyMethod) {
|
||||
create.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO remove once not experimental
|
||||
create.addJavadoc(CREATE_JAVADOC, this.apiType, this.registryKey.location().toString());
|
||||
}
|
||||
return create;
|
||||
@@ -156,6 +157,8 @@ public class GeneratedKeyType<T, A> extends SimpleGenerator {
|
||||
if (allExperimental) {
|
||||
typeBuilder.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
|
||||
createMethod.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
|
||||
} else {
|
||||
typeBuilder.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO experimental API
|
||||
}
|
||||
return typeBuilder.addMethod(createMethod.build()).build();
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@ java {
|
||||
withJavadocJar()
|
||||
}
|
||||
|
||||
val annotationsVersion = "26.0.1"
|
||||
val annotationsVersion = "24.1.0"
|
||||
val bungeeCordChatVersion = "1.20-R0.2"
|
||||
val adventureVersion = "4.18.0"
|
||||
val adventureVersion = "4.17.0"
|
||||
val slf4jVersion = "2.0.9"
|
||||
val log4jVersion = "2.17.1"
|
||||
|
||||
@@ -68,6 +68,9 @@ dependencies {
|
||||
apiAndDocs("net.kyori:adventure-text-serializer-plain")
|
||||
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
|
||||
|
||||
implementation("org.ow2.asm:asm:9.7.1")
|
||||
implementation("org.ow2.asm:asm-commons:9.7.1")
|
||||
|
||||
api("org.apache.maven:maven-resolver-provider:3.9.6") // make API dependency for Paper Plugins
|
||||
compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18")
|
||||
compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18")
|
||||
@@ -93,7 +96,7 @@ dependencies {
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||
}
|
||||
|
||||
val generatedApiPath: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath()
|
||||
val generatedApiPath: java.nio.file.Path = rootProject.projectDir.toPath().resolve("paper-api-generator/generated")
|
||||
idea {
|
||||
module {
|
||||
generatedSourceDirs.add(generatedApiPath.toFile())
|
||||
@@ -176,7 +179,7 @@ tasks.withType<Javadoc> {
|
||||
"https://guava.dev/releases/33.3.1-jre/api/docs/",
|
||||
"https://javadoc.io/doc/org.yaml/snakeyaml/2.2/",
|
||||
"https://javadoc.io/doc/org.jetbrains/annotations/$annotationsVersion/",
|
||||
"https://javadoc.io/doc/org.joml/joml/1.10.8/",
|
||||
"https://javadoc.io/doc/org.joml/joml/1.10.8/index.html",
|
||||
"https://www.javadoc.io/doc/com.google.code.gson/gson/2.11.0",
|
||||
"https://jspecify.dev/docs/api/",
|
||||
"https://jd.advntr.dev/api/$adventureVersion/",
|
||||
|
||||
-288
@@ -1,288 +0,0 @@
|
||||
package io.papermc.paper.registry.keys.tags;
|
||||
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.tag.TagKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#ENTITY_TYPE}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.4")
|
||||
@NullMarked
|
||||
@ApiStatus.Experimental
|
||||
public final class EntityTypeTagKeys {
|
||||
/**
|
||||
* {@code #minecraft:aquatic}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> AQUATIC = create(key("aquatic"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:arrows}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> ARROWS = create(key("arrows"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:arthropod}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> ARTHROPOD = create(key("arthropod"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:axolotl_always_hostiles}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> AXOLOTL_ALWAYS_HOSTILES = create(key("axolotl_always_hostiles"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:axolotl_hunt_targets}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> AXOLOTL_HUNT_TARGETS = create(key("axolotl_hunt_targets"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:beehive_inhabitors}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> BEEHIVE_INHABITORS = create(key("beehive_inhabitors"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:boat}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> BOAT = create(key("boat"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:can_breathe_under_water}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> CAN_BREATHE_UNDER_WATER = create(key("can_breathe_under_water"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:can_turn_in_boats}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> CAN_TURN_IN_BOATS = create(key("can_turn_in_boats"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:deflects_projectiles}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> DEFLECTS_PROJECTILES = create(key("deflects_projectiles"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:dismounts_underwater}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> DISMOUNTS_UNDERWATER = create(key("dismounts_underwater"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:fall_damage_immune}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> FALL_DAMAGE_IMMUNE = create(key("fall_damage_immune"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:freeze_hurts_extra_types}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> FREEZE_HURTS_EXTRA_TYPES = create(key("freeze_hurts_extra_types"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:freeze_immune_entity_types}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> FREEZE_IMMUNE_ENTITY_TYPES = create(key("freeze_immune_entity_types"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:frog_food}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> FROG_FOOD = create(key("frog_food"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:ignores_poison_and_regen}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> IGNORES_POISON_AND_REGEN = create(key("ignores_poison_and_regen"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:illager}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> ILLAGER = create(key("illager"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:illager_friends}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> ILLAGER_FRIENDS = create(key("illager_friends"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:immune_to_infested}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> IMMUNE_TO_INFESTED = create(key("immune_to_infested"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:immune_to_oozing}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> IMMUNE_TO_OOZING = create(key("immune_to_oozing"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:impact_projectiles}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> IMPACT_PROJECTILES = create(key("impact_projectiles"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:inverted_healing_and_harm}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> INVERTED_HEALING_AND_HARM = create(key("inverted_healing_and_harm"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:no_anger_from_wind_charge}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> NO_ANGER_FROM_WIND_CHARGE = create(key("no_anger_from_wind_charge"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:non_controlling_rider}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> NON_CONTROLLING_RIDER = create(key("non_controlling_rider"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:not_scary_for_pufferfish}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> NOT_SCARY_FOR_PUFFERFISH = create(key("not_scary_for_pufferfish"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:powder_snow_walkable_mobs}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> POWDER_SNOW_WALKABLE_MOBS = create(key("powder_snow_walkable_mobs"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:raiders}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> RAIDERS = create(key("raiders"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:redirectable_projectile}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> REDIRECTABLE_PROJECTILE = create(key("redirectable_projectile"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:sensitive_to_bane_of_arthropods}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> SENSITIVE_TO_BANE_OF_ARTHROPODS = create(key("sensitive_to_bane_of_arthropods"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:sensitive_to_impaling}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> SENSITIVE_TO_IMPALING = create(key("sensitive_to_impaling"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:sensitive_to_smite}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> SENSITIVE_TO_SMITE = create(key("sensitive_to_smite"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:skeletons}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> SKELETONS = create(key("skeletons"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:undead}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> UNDEAD = create(key("undead"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:wither_friends}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> WITHER_FRIENDS = create(key("wither_friends"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:zombies}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<EntityType> ZOMBIES = create(key("zombies"));
|
||||
|
||||
private EntityTypeTagKeys() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a tag key for {@link EntityType} in the registry {@code minecraft:entity_type}.
|
||||
*
|
||||
* @param key the tag key's key
|
||||
* @return a new tag key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static TagKey<EntityType> create(final Key key) {
|
||||
return TagKey.create(RegistryKey.ENTITY_TYPE, key);
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package com.destroystokyo.paper.event.executor;
|
||||
|
||||
import com.destroystokyo.paper.util.SneakyThrow;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.reflect.Method;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.EventException;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.EventExecutor;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@ApiStatus.Internal
|
||||
@NullMarked
|
||||
public class MethodHandleEventExecutor implements EventExecutor {
|
||||
|
||||
private final Class<? extends Event> eventClass;
|
||||
private final MethodHandle handle;
|
||||
private final @Nullable Method method;
|
||||
|
||||
public MethodHandleEventExecutor(final Class<? extends Event> eventClass, final MethodHandle handle) {
|
||||
this.eventClass = eventClass;
|
||||
this.handle = handle;
|
||||
this.method = null;
|
||||
}
|
||||
|
||||
public MethodHandleEventExecutor(final Class<? extends Event> eventClass, final Method m) {
|
||||
this.eventClass = eventClass;
|
||||
try {
|
||||
m.setAccessible(true);
|
||||
this.handle = MethodHandles.lookup().unreflect(m);
|
||||
} catch (final IllegalAccessException e) {
|
||||
throw new AssertionError("Unable to set accessible", e);
|
||||
}
|
||||
this.method = m;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(final Listener listener, final Event event) throws EventException {
|
||||
if (!this.eventClass.isInstance(event)) return;
|
||||
try {
|
||||
this.handle.invoke(listener, event);
|
||||
} catch (final Throwable t) {
|
||||
SneakyThrow.sneaky(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MethodHandleEventExecutor['" + this.method + "']";
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package com.destroystokyo.paper.event.executor;
|
||||
|
||||
import com.destroystokyo.paper.util.SneakyThrow;
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.EventException;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.EventExecutor;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@ApiStatus.Internal
|
||||
@NullMarked
|
||||
public class StaticMethodHandleEventExecutor implements EventExecutor {
|
||||
|
||||
private final Class<? extends Event> eventClass;
|
||||
private final MethodHandle handle;
|
||||
private final Method method;
|
||||
|
||||
public StaticMethodHandleEventExecutor(final Class<? extends Event> eventClass, final Method m) {
|
||||
Preconditions.checkArgument(Modifier.isStatic(m.getModifiers()), "Not a static method: %s", m);
|
||||
Preconditions.checkArgument(eventClass != null, "eventClass is null");
|
||||
this.eventClass = eventClass;
|
||||
try {
|
||||
m.setAccessible(true);
|
||||
this.handle = MethodHandles.lookup().unreflect(m);
|
||||
} catch (final IllegalAccessException e) {
|
||||
throw new AssertionError("Unable to set accessible", e);
|
||||
}
|
||||
this.method = m;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(final Listener listener, final Event event) throws EventException {
|
||||
if (!this.eventClass.isInstance(event)) return;
|
||||
try {
|
||||
this.handle.invoke(event);
|
||||
} catch (final Throwable throwable) {
|
||||
SneakyThrow.sneaky(throwable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StaticMethodHandleEventExecutor['" + this.method + "']";
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
package com.destroystokyo.paper.event.executor.asm;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import org.bukkit.plugin.EventExecutor;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.commons.GeneratorAdapter;
|
||||
|
||||
import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
|
||||
import static org.objectweb.asm.Opcodes.INVOKEINTERFACE;
|
||||
import static org.objectweb.asm.Opcodes.INVOKESPECIAL;
|
||||
import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL;
|
||||
import static org.objectweb.asm.Opcodes.V1_8;
|
||||
|
||||
@ApiStatus.Internal
|
||||
@NullMarked
|
||||
public final class ASMEventExecutorGenerator {
|
||||
|
||||
private static final String EXECUTE_DESCRIPTOR = "(Lorg/bukkit/event/Listener;Lorg/bukkit/event/Event;)V";
|
||||
|
||||
public static byte[] generateEventExecutor(final Method m, final String name) {
|
||||
final ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
|
||||
writer.visit(V1_8, ACC_PUBLIC, name.replace('.', '/'), null, Type.getInternalName(Object.class), new String[]{Type.getInternalName(EventExecutor.class)});
|
||||
// Generate constructor
|
||||
GeneratorAdapter methodGenerator = new GeneratorAdapter(writer.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null), ACC_PUBLIC, "<init>", "()V");
|
||||
methodGenerator.loadThis();
|
||||
methodGenerator.visitMethodInsn(INVOKESPECIAL, Type.getInternalName(Object.class), "<init>", "()V", false); // Invoke the super class (Object) constructor
|
||||
methodGenerator.returnValue();
|
||||
methodGenerator.endMethod();
|
||||
// Generate the execute method
|
||||
methodGenerator = new GeneratorAdapter(writer.visitMethod(ACC_PUBLIC, "execute", EXECUTE_DESCRIPTOR, null, null), ACC_PUBLIC, "execute", EXECUTE_DESCRIPTOR);
|
||||
methodGenerator.loadArg(0);
|
||||
methodGenerator.checkCast(Type.getType(m.getDeclaringClass()));
|
||||
methodGenerator.loadArg(1);
|
||||
methodGenerator.checkCast(Type.getType(m.getParameterTypes()[0]));
|
||||
methodGenerator.visitMethodInsn(m.getDeclaringClass().isInterface() ? INVOKEINTERFACE : INVOKEVIRTUAL, Type.getInternalName(m.getDeclaringClass()), m.getName(), Type.getMethodDescriptor(m), m.getDeclaringClass().isInterface());
|
||||
// The only purpose of this switch statement is to generate the correct pop instruction, should the event handler method return something other than void.
|
||||
// Non-void event handlers will be unsupported in a future release.
|
||||
switch (Type.getType(m.getReturnType()).getSize()) {
|
||||
// case 0 is omitted because the only type that has size 0 is void - no pop instruction needed.
|
||||
case 1 -> methodGenerator.pop(); // handles reference types and most primitives
|
||||
case 2 -> methodGenerator.pop2(); // handles long and double
|
||||
}
|
||||
methodGenerator.returnValue();
|
||||
methodGenerator.endMethod();
|
||||
writer.visitEnd();
|
||||
return writer.toByteArray();
|
||||
}
|
||||
|
||||
public static AtomicInteger NEXT_ID = new AtomicInteger(1);
|
||||
|
||||
public static String generateName() {
|
||||
final int id = NEXT_ID.getAndIncrement();
|
||||
return "com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor" + id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.destroystokyo.paper.event.executor.asm;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@ApiStatus.Internal
|
||||
@NullMarked
|
||||
public interface ClassDefiner {
|
||||
|
||||
/**
|
||||
* Returns if the defined classes can bypass access checks
|
||||
*
|
||||
* @return if classes bypass access checks
|
||||
*/
|
||||
default boolean isBypassAccessChecks() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a class
|
||||
*
|
||||
* @param parentLoader the parent classloader
|
||||
* @param name the name of the class
|
||||
* @param data the class data to load
|
||||
* @return the defined class
|
||||
* @throws ClassFormatError if the class data is invalid
|
||||
* @throws NullPointerException if any of the arguments are null
|
||||
*/
|
||||
Class<?> defineClass(ClassLoader parentLoader, String name, byte[] data);
|
||||
|
||||
static ClassDefiner getInstance() {
|
||||
return SafeClassDefiner.INSTANCE;
|
||||
}
|
||||
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package com.destroystokyo.paper.event.executor.asm;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.MapMaker;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@ApiStatus.Internal
|
||||
@NullMarked
|
||||
public class SafeClassDefiner implements ClassDefiner {
|
||||
|
||||
/* default */ static final SafeClassDefiner INSTANCE = new SafeClassDefiner();
|
||||
|
||||
private SafeClassDefiner() {
|
||||
}
|
||||
|
||||
private final ConcurrentMap<ClassLoader, GeneratedClassLoader> loaders = new MapMaker().weakKeys().makeMap();
|
||||
|
||||
@Override
|
||||
public Class<?> defineClass(final ClassLoader parentLoader, final String name, final byte[] data) {
|
||||
final GeneratedClassLoader loader = this.loaders.computeIfAbsent(parentLoader, GeneratedClassLoader::new);
|
||||
synchronized (loader.getClassLoadingLock(name)) {
|
||||
Preconditions.checkState(!loader.hasClass(name), "%s already defined", name);
|
||||
final Class<?> c = loader.define(name, data);
|
||||
assert c.getName().equals(name);
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
private static class GeneratedClassLoader extends ClassLoader {
|
||||
|
||||
static {
|
||||
ClassLoader.registerAsParallelCapable();
|
||||
}
|
||||
|
||||
protected GeneratedClassLoader(final ClassLoader parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
private Class<?> define(final String name, final byte[] data) {
|
||||
synchronized (this.getClassLoadingLock(name)) {
|
||||
assert !this.hasClass(name);
|
||||
final Class<?> c = this.defineClass(name, data, 0, data.length);
|
||||
this.resolveClass(c);
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClassLoadingLock(final String name) {
|
||||
return super.getClassLoadingLock(name);
|
||||
}
|
||||
|
||||
public boolean hasClass(final String name) {
|
||||
synchronized (this.getClassLoadingLock(name)) {
|
||||
try {
|
||||
Class.forName(name);
|
||||
return true;
|
||||
} catch (final ClassNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-23
@@ -5,7 +5,6 @@ import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -17,10 +16,8 @@ import static org.bukkit.Material.*;
|
||||
* Called when the player themselves change their armor items
|
||||
* <p>
|
||||
* Not currently called for environmental factors though it <strong>MAY BE IN THE FUTURE</strong>
|
||||
* @apiNote Use {@link io.papermc.paper.event.entity.EntityEquipmentChangedEvent} for all entity equipment changes
|
||||
*/
|
||||
@NullMarked
|
||||
@ApiStatus.Obsolete(since = "1.21.4")
|
||||
public class PlayerArmorChangeEvent extends PlayerEvent {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
@@ -41,27 +38,11 @@ public class PlayerArmorChangeEvent extends PlayerEvent {
|
||||
* Gets the type of slot being altered.
|
||||
*
|
||||
* @return type of slot being altered
|
||||
* @deprecated {@link SlotType} does not accurately represent what item types are valid in each slot. Use {@link #getSlot()} instead.
|
||||
*/
|
||||
@Deprecated(since = "1.21.4")
|
||||
public SlotType getSlotType() {
|
||||
return this.slotType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the slot being altered.
|
||||
*
|
||||
* @return slot being altered
|
||||
*/
|
||||
public EquipmentSlot getSlot() {
|
||||
return switch (this.slotType) {
|
||||
case HEAD -> EquipmentSlot.HEAD;
|
||||
case CHEST -> EquipmentSlot.CHEST;
|
||||
case LEGS -> EquipmentSlot.LEGS;
|
||||
case FEET -> EquipmentSlot.FEET;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the existing item that's being replaced
|
||||
*
|
||||
@@ -89,10 +70,6 @@ public class PlayerArmorChangeEvent extends PlayerEvent {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated {@link SlotType} does not accurately represent what item types are valid in each slot.
|
||||
*/
|
||||
@Deprecated(since = "1.21.4")
|
||||
public enum SlotType {
|
||||
HEAD(NETHERITE_HELMET, DIAMOND_HELMET, GOLDEN_HELMET, IRON_HELMET, CHAINMAIL_HELMET, LEATHER_HELMET, CARVED_PUMPKIN, PLAYER_HEAD, SKELETON_SKULL, ZOMBIE_HEAD, CREEPER_HEAD, WITHER_SKELETON_SKULL, TURTLE_HELMET, DRAGON_HEAD, PIGLIN_HEAD),
|
||||
CHEST(NETHERITE_CHESTPLATE, DIAMOND_CHESTPLATE, GOLDEN_CHESTPLATE, IRON_CHESTPLATE, CHAINMAIL_CHESTPLATE, LEATHER_CHESTPLATE, ELYTRA),
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents an event that is called when a player clicks an unknown entity.
|
||||
* Represents an event that is called when a player right-clicks an unknown entity.
|
||||
* Useful for plugins dealing with virtual entities (entities that aren't actually spawned on the server).
|
||||
* <br>
|
||||
* This event may be called multiple times per interaction with different interaction hands
|
||||
|
||||
+2
-1
@@ -304,7 +304,8 @@ public class PaperServerListPingEvent extends ServerListPingEvent implements Can
|
||||
return new PlayerIterator();
|
||||
}
|
||||
|
||||
protected @NotNull Object @NotNull [] getOnlinePlayers() {
|
||||
@NotNull
|
||||
protected Object[] getOnlinePlayers() {
|
||||
return Bukkit.getOnlinePlayers().toArray();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
package io.papermc.paper;
|
||||
|
||||
import net.kyori.adventure.util.Services;
|
||||
import org.bukkit.damage.DamageEffect;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Static bridge to the server internals.
|
||||
* <p>
|
||||
* Any and all methods in here are *not* to be called by plugin developers, may change at any time and may generally
|
||||
* cause issues when called under unexpected circumstances.
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
@NullMarked
|
||||
public interface InternalAPIBridge {
|
||||
|
||||
/**
|
||||
* Yields the instance of this API bridge by lazily requesting it from the java service loader API.
|
||||
*
|
||||
* @return the instance.
|
||||
*/
|
||||
static InternalAPIBridge get() {
|
||||
class Holder {
|
||||
public static final InternalAPIBridge INSTANCE = Services.service(InternalAPIBridge.class).orElseThrow();
|
||||
}
|
||||
|
||||
return Holder.INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a damage effect instance for the passed key.
|
||||
*
|
||||
* @param key the string key.
|
||||
* @return the damage effect.
|
||||
*/
|
||||
DamageEffect getDamageEffect(String key);
|
||||
}
|
||||
|
||||
-5
@@ -10,10 +10,5 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
public enum CommandRegistrationFlag {
|
||||
|
||||
/**
|
||||
* @deprecated This is the default behavior now.
|
||||
*/
|
||||
@Deprecated(since = "1.21.4")
|
||||
FLATTEN_ALIASES
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package io.papermc.paper.command.brigadier;
|
||||
|
||||
import com.mojang.brigadier.RedirectModifier;
|
||||
import com.mojang.brigadier.tree.CommandNode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Entity;
|
||||
@@ -50,24 +48,4 @@ public interface CommandSourceStack {
|
||||
* @return entity that executes this command
|
||||
*/
|
||||
@Nullable Entity getExecutor();
|
||||
|
||||
/**
|
||||
* Creates a new CommandSourceStack object with a different location for redirecting commands to other nodes.
|
||||
*
|
||||
* @param location The location to create a new CommandSourceStack object with
|
||||
* @return The newly created CommandSourceStack
|
||||
* @see #getLocation()
|
||||
* @see com.mojang.brigadier.builder.ArgumentBuilder#fork(CommandNode, RedirectModifier)
|
||||
*/
|
||||
CommandSourceStack withLocation(Location location);
|
||||
|
||||
/**
|
||||
* Creates a new CommandSourceStack object with a different executor for redirecting commands to other nodes.
|
||||
*
|
||||
* @param executor The executing entity to create a new CommandSourceStack object with
|
||||
* @return The newly created CommandSourceStack
|
||||
* @see #getExecutor()
|
||||
* @see com.mojang.brigadier.builder.ArgumentBuilder#fork(CommandNode, RedirectModifier)
|
||||
*/
|
||||
CommandSourceStack withExecutor(Entity executor);
|
||||
}
|
||||
@@ -113,7 +113,6 @@ public interface Commands extends Registrar {
|
||||
* <p>Commands have certain overriding behavior:
|
||||
* <ul>
|
||||
* <li>Aliases will not override already existing commands (excluding namespaced ones)</li>
|
||||
* <li>Aliases are <b>not</b> Brigadier redirects, they just copy the command to a different label</li>
|
||||
* <li>The main command/namespaced label will override already existing commands</li>
|
||||
* </ul>
|
||||
*
|
||||
@@ -130,7 +129,6 @@ public interface Commands extends Registrar {
|
||||
* <p>Commands have certain overriding behavior:
|
||||
* <ul>
|
||||
* <li>Aliases will not override already existing commands (excluding namespaced ones)</li>
|
||||
* <li>Aliases are <b>not</b> Brigadier redirects, they just copy the command to a different label</li>
|
||||
* <li>The main command/namespaced label will override already existing commands</li>
|
||||
* </ul>
|
||||
*
|
||||
@@ -148,7 +146,6 @@ public interface Commands extends Registrar {
|
||||
* <p>Commands have certain overriding behavior:
|
||||
* <ul>
|
||||
* <li>Aliases will not override already existing commands (excluding namespaced ones)</li>
|
||||
* <li>Aliases are <b>not</b> Brigadier redirects, they just copy the command to a different label</li>
|
||||
* <li>The main command/namespaced label will override already existing commands</li>
|
||||
* </ul>
|
||||
*
|
||||
@@ -166,7 +163,6 @@ public interface Commands extends Registrar {
|
||||
* <p>Commands have certain overriding behavior:
|
||||
* <ul>
|
||||
* <li>Aliases will not override already existing commands (excluding namespaced ones)</li>
|
||||
* <li>Aliases are <b>not</b> Brigadier redirects, they just copy the command to a different label</li>
|
||||
* <li>The main command/namespaced label will override already existing commands</li>
|
||||
* </ul>
|
||||
*
|
||||
@@ -183,7 +179,6 @@ public interface Commands extends Registrar {
|
||||
* <p>Commands have certain overriding behavior:
|
||||
* <ul>
|
||||
* <li>Aliases will not override already existing commands (excluding namespaced ones)</li>
|
||||
* <li>Aliases are <b>not</b> Brigadier redirects, they just copy the command to a different label</li>
|
||||
* <li>The main command/namespaced label will override already existing commands</li>
|
||||
* </ul>
|
||||
*
|
||||
|
||||
-10
@@ -7,7 +7,6 @@ import io.papermc.paper.command.brigadier.argument.range.IntegerRangeProvider;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.BlockPositionResolver;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.FinePositionResolver;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.PlayerProfileListResolver;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.RotationResolver;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.selector.EntitySelectorArgumentResolver;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.selector.PlayerSelectorArgumentResolver;
|
||||
import io.papermc.paper.entity.LookAnchor;
|
||||
@@ -124,15 +123,6 @@ public final class ArgumentTypes {
|
||||
return provider().finePosition(centerIntegers);
|
||||
}
|
||||
|
||||
/**
|
||||
* A rotation argument.
|
||||
*
|
||||
* @return rotation argument
|
||||
*/
|
||||
public static ArgumentType<RotationResolver> rotation() {
|
||||
return provider().rotation();
|
||||
}
|
||||
|
||||
/**
|
||||
* A blockstate argument which will provide rich parsing for specifying
|
||||
* the specific block variant and then the block entity NBT if applicable.
|
||||
|
||||
-3
@@ -7,7 +7,6 @@ import io.papermc.paper.command.brigadier.argument.range.IntegerRangeProvider;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.BlockPositionResolver;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.FinePositionResolver;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.PlayerProfileListResolver;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.RotationResolver;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.selector.EntitySelectorArgumentResolver;
|
||||
import io.papermc.paper.command.brigadier.argument.resolvers.selector.PlayerSelectorArgumentResolver;
|
||||
import io.papermc.paper.entity.LookAnchor;
|
||||
@@ -58,8 +57,6 @@ interface VanillaArgumentProvider {
|
||||
|
||||
ArgumentType<FinePositionResolver> finePosition(boolean centerIntegers);
|
||||
|
||||
ArgumentType<RotationResolver> rotation();
|
||||
|
||||
ArgumentType<BlockState> blockState();
|
||||
|
||||
ArgumentType<ItemStack> itemStack();
|
||||
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
package io.papermc.paper.command.brigadier.argument.resolvers;
|
||||
|
||||
import io.papermc.paper.command.brigadier.CommandSourceStack;
|
||||
import io.papermc.paper.math.Rotation;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* An {@link ArgumentResolver} that's capable of resolving
|
||||
* a rotation argument value using a {@link CommandSourceStack}.
|
||||
*
|
||||
* @see io.papermc.paper.command.brigadier.argument.ArgumentTypes#rotation()
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@ApiStatus.NonExtendable
|
||||
public interface RotationResolver extends ArgumentResolver<Rotation> {
|
||||
}
|
||||
@@ -21,9 +21,9 @@ public interface DamageResistant {
|
||||
}
|
||||
|
||||
/**
|
||||
* The types that this damage type is invincible to.
|
||||
* The types that this damage type is invincible tp.
|
||||
*
|
||||
* @return the key of the tag holding the respective damage types.
|
||||
* @return item
|
||||
*/
|
||||
@Contract(value = "-> new", pure = true)
|
||||
TagKey<DamageType> types();
|
||||
|
||||
+18
-21
@@ -21,7 +21,7 @@ public interface ConsumeEffect {
|
||||
* Creates a consume effect that randomly teleports the entity on consumption.
|
||||
*
|
||||
* @param diameter diameter of random teleportation
|
||||
* @return the effect instance
|
||||
* @return the effect
|
||||
*/
|
||||
@Contract(value = "_ -> new", pure = true)
|
||||
static TeleportRandomly teleportRandomlyEffect(final float diameter) {
|
||||
@@ -29,21 +29,21 @@ public interface ConsumeEffect {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a consume effect that removes status effects on consumption.
|
||||
* Creates a consume effect that gives status effects on consumption.
|
||||
*
|
||||
* @param effects the potion effects to remove
|
||||
* @return the effect instance
|
||||
* @param key the sound effect to play
|
||||
* @return the effect
|
||||
*/
|
||||
@Contract(value = "_ -> new", pure = true)
|
||||
static RemoveStatusEffects removeEffects(final RegistryKeySet<PotionEffectType> effects) {
|
||||
return ConsumableTypesBridge.bridge().removeStatusEffects(effects);
|
||||
static RemoveStatusEffects removeEffects(final RegistryKeySet<PotionEffectType> key) {
|
||||
return ConsumableTypesBridge.bridge().removeStatusEffects(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a consume effect that plays a sound on consumption.
|
||||
*
|
||||
* @param key the key sound effect to play
|
||||
* @return the effect instance
|
||||
* @param key the sound effect to play
|
||||
* @return the effect
|
||||
*/
|
||||
@Contract(value = "_ -> new", pure = true)
|
||||
static PlaySound playSoundConsumeEffect(final Key key) {
|
||||
@@ -53,7 +53,7 @@ public interface ConsumeEffect {
|
||||
/**
|
||||
* Creates a consume effect that clears all status effects.
|
||||
*
|
||||
* @return the effect instance
|
||||
* @return effect instance
|
||||
*/
|
||||
@Contract(value = "-> new", pure = true)
|
||||
static ClearAllStatusEffects clearAllStatusEffects() {
|
||||
@@ -61,20 +61,17 @@ public interface ConsumeEffect {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a consume effect that gives potion effects on consumption.
|
||||
* Creates a consume effect that gives status effects on consumption.
|
||||
*
|
||||
* @param effects the potion effects to apply
|
||||
* @param probability the probability of these effects being applied, between 0 and 1 inclusive
|
||||
* @return the effect instance
|
||||
* @param probability the probability of these effects being applied, between 0 and 1 inclusive.
|
||||
* @return the effect
|
||||
*/
|
||||
@Contract(value = "_, _ -> new", pure = true)
|
||||
static ApplyStatusEffects applyStatusEffects(final List<PotionEffect> effects, final float probability) {
|
||||
return ConsumableTypesBridge.bridge().applyStatusEffects(effects, probability);
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a consumable effect that randomly teleports the entity on consumption.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@ApiStatus.NonExtendable
|
||||
interface TeleportRandomly extends ConsumeEffect {
|
||||
@@ -88,14 +85,14 @@ public interface ConsumeEffect {
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a consumable effect that removes status effects on consumption.
|
||||
* Represents a consumable effect that removes status effects on consumption
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@ApiStatus.NonExtendable
|
||||
interface RemoveStatusEffects extends ConsumeEffect {
|
||||
|
||||
/**
|
||||
* Potion effects to remove.
|
||||
* Potion effects to remove
|
||||
*
|
||||
* @return effects
|
||||
*/
|
||||
@@ -110,7 +107,7 @@ public interface ConsumeEffect {
|
||||
interface PlaySound extends ConsumeEffect {
|
||||
|
||||
/**
|
||||
* Sound effect to play in the world.
|
||||
* Sound effect to play in the world
|
||||
*
|
||||
* @return sound effect
|
||||
*/
|
||||
@@ -127,16 +124,16 @@ public interface ConsumeEffect {
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a consumable effect that applies potion effects based on a probability on consumption.
|
||||
* Represents a consumable effect that applies effects based on a probability on consumption.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@ApiStatus.NonExtendable
|
||||
interface ApplyStatusEffects extends ConsumeEffect {
|
||||
|
||||
/**
|
||||
* Potion effect instances to grant.
|
||||
* Effect instances to grant
|
||||
*
|
||||
* @return potion effects
|
||||
* @return effect
|
||||
*/
|
||||
List<PotionEffect> effects();
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package io.papermc.paper.datapack;
|
||||
|
||||
import java.util.Set;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.bukkit.FeatureFlag;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -10,8 +12,50 @@ import org.jspecify.annotations.NullMarked;
|
||||
* won't be updated as datapacks are updated.
|
||||
*/
|
||||
@NullMarked
|
||||
@ApiStatus.NonExtendable
|
||||
public interface Datapack extends DiscoveredDatapack {
|
||||
public interface Datapack {
|
||||
|
||||
/**
|
||||
* Gets the name/id of this datapack.
|
||||
*
|
||||
* @return the name of the pack
|
||||
*/
|
||||
@Contract(pure = true)
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Gets the title component of this datapack.
|
||||
*
|
||||
* @return the title
|
||||
*/
|
||||
Component getTitle();
|
||||
|
||||
/**
|
||||
* Gets the description component of this datapack.
|
||||
*
|
||||
* @return the description
|
||||
*/
|
||||
Component getDescription();
|
||||
|
||||
/**
|
||||
* Gets if this datapack is required to be enabled.
|
||||
*
|
||||
* @return true if the pack is required
|
||||
*/
|
||||
boolean isRequired();
|
||||
|
||||
/**
|
||||
* Gets the compatibility status of this pack.
|
||||
*
|
||||
* @return the compatibility of the pack
|
||||
*/
|
||||
Compatibility getCompatibility();
|
||||
|
||||
/**
|
||||
* Gets the set of required features for this datapack.
|
||||
*
|
||||
* @return the set of required features
|
||||
*/
|
||||
@Unmodifiable Set<FeatureFlag> getRequiredFeatures();
|
||||
|
||||
/**
|
||||
* Gets the enabled state of this pack.
|
||||
@@ -30,6 +74,13 @@ public interface Datapack extends DiscoveredDatapack {
|
||||
*/
|
||||
void setEnabled(boolean enabled);
|
||||
|
||||
/**
|
||||
* Gets the source for this datapack.
|
||||
*
|
||||
* @return the pack source
|
||||
*/
|
||||
DatapackSource getSource();
|
||||
|
||||
/**
|
||||
* Computes the component vanilla Minecraft uses
|
||||
* to display this datapack. Includes the {@link #getSource()},
|
||||
@@ -45,11 +96,4 @@ public interface Datapack extends DiscoveredDatapack {
|
||||
TOO_NEW,
|
||||
COMPATIBLE,
|
||||
}
|
||||
|
||||
/**
|
||||
* Position of the pack in the load order.
|
||||
*/
|
||||
enum Position {
|
||||
TOP, BOTTOM
|
||||
}
|
||||
}
|
||||
@@ -1,205 +0,0 @@
|
||||
package io.papermc.paper.datapack;
|
||||
|
||||
import io.papermc.paper.plugin.configuration.PluginMeta;
|
||||
import io.papermc.paper.plugin.lifecycle.event.registrar.Registrar;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* The registrar for datapacks. The event for this registrar
|
||||
* is called anytime the game tries to discover datapacks at any of the
|
||||
* configured locations. This means that if a datapack should stay available to the server,
|
||||
* it must always be discovered whenever this event fires.
|
||||
* <p>
|
||||
* An example of a plugin loading a datapack from within its own jar is below,
|
||||
* assuming the datapack is included under {@code resources/pack} folder:
|
||||
* <pre>{@code
|
||||
* public class YourPluginBootstrap implements PluginBootstrap {
|
||||
* @Override
|
||||
* public void bootstrap(BootstrapContext context) {
|
||||
* final LifecycleEventManager<BootstrapContext> manager = context.getLifecycleManager();
|
||||
* manager.registerEventHandler(LifecycleEvents.DATAPACK_DISCOVERY, event -> {
|
||||
* DatapackRegistrar registrar = event.registrar();
|
||||
* try {
|
||||
* final URI uri = Objects.requireNonNull(
|
||||
* YourPluginBootstrap.class.getResource("/pack")
|
||||
* ).toURI();
|
||||
* registrar.discoverPack(uri, "packId");
|
||||
* } catch (final URISyntaxException | IOException e) {
|
||||
* throw new RuntimeException(e);
|
||||
* }
|
||||
* });
|
||||
* }
|
||||
* }
|
||||
* }</pre>
|
||||
*
|
||||
* @see io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents#DATAPACK_DISCOVERY
|
||||
*/
|
||||
@ApiStatus.NonExtendable
|
||||
@ApiStatus.Experimental
|
||||
@NullMarked
|
||||
public interface DatapackRegistrar extends Registrar {
|
||||
|
||||
/**
|
||||
* Checks if a datapack with the specified name has been discovered.
|
||||
*
|
||||
* @param name the name of the pack
|
||||
* @return true if the pack has been discovered
|
||||
* @see Datapack#getName()
|
||||
*/
|
||||
@Contract(pure = true)
|
||||
boolean hasPackDiscovered(String name);
|
||||
|
||||
/**
|
||||
* Gets a discovered datapack by its name.
|
||||
*
|
||||
* @param name the name of the pack
|
||||
* @return the datapack
|
||||
* @throws java.util.NoSuchElementException if the pack is not discovered
|
||||
* @see Datapack#getName()
|
||||
*/
|
||||
@Contract(pure = true)
|
||||
DiscoveredDatapack getDiscoveredPack(String name);
|
||||
|
||||
/**
|
||||
* Removes a discovered datapack by its name.
|
||||
*
|
||||
* @param name the name of the pack
|
||||
* @return true if the pack was removed
|
||||
* @see Datapack#getName()
|
||||
*/
|
||||
@Contract(mutates = "this")
|
||||
boolean removeDiscoveredPack(String name);
|
||||
|
||||
/**
|
||||
* Gets all discovered datapacks.
|
||||
*
|
||||
* @return an unmodifiable map of discovered packs
|
||||
*/
|
||||
@Contract(pure = true)
|
||||
@Unmodifiable Map<String, DiscoveredDatapack> getDiscoveredPacks();
|
||||
|
||||
/**
|
||||
* Discovers a datapack at the specified {@link URI} with the id.
|
||||
* <p>Symlinks obey the {@code allowed_symlinks.txt} in the server root directory.</p>
|
||||
*
|
||||
* @param uri the location of the pack
|
||||
* @param id a unique id (will be combined with plugin for the datapacks name)
|
||||
* @return the discovered datapack (or null if it failed)
|
||||
* @throws IOException if any IO error occurs
|
||||
*/
|
||||
default @Nullable DiscoveredDatapack discoverPack(final URI uri, final String id) throws IOException {
|
||||
return this.discoverPack(uri, id, c -> {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Discovers a datapack at the specified {@link URI} with the id.
|
||||
* <p>Symlinks obey the {@code allowed_symlinks.txt} in the server root directory.</p>
|
||||
*
|
||||
* @param uri the location of the pack
|
||||
* @param id a unique id (will be combined with plugin for the datapacks name)
|
||||
* @param configurer a configurer for extra options
|
||||
* @return the discovered datapack (or null if it failed)
|
||||
* @throws IOException if any IO error occurs
|
||||
*/
|
||||
@Nullable DiscoveredDatapack discoverPack(URI uri, String id, Consumer<Configurer> configurer) throws IOException;
|
||||
|
||||
/**
|
||||
* Discovers a datapack at the specified {@link Path} with the id.
|
||||
* <p>Symlinks obey the {@code allowed_symlinks.txt} in the server root directory.</p>
|
||||
*
|
||||
* @param path the location of the pack
|
||||
* @param id a unique id (will be combined with plugin for the datapacks name)
|
||||
* @return the discovered datapack (or null if it failed)
|
||||
* @throws IOException if any IO error occurs
|
||||
*/
|
||||
default @Nullable DiscoveredDatapack discoverPack(final Path path, final String id) throws IOException {
|
||||
return this.discoverPack(path, id, c -> {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Discovers a datapack at the specified {@link Path} with the id.
|
||||
* <p>Symlinks obey the {@code allowed_symlinks.txt} in the server root directory.</p>
|
||||
*
|
||||
* @param path the location of the pack
|
||||
* @param id a unique id (will be combined with plugin for the datapacks name)
|
||||
* @param configurer a configurer for extra options
|
||||
* @return the discovered datapack (or null if it failed)
|
||||
* @throws IOException if any IO error occurs
|
||||
*/
|
||||
@Nullable DiscoveredDatapack discoverPack(Path path, String id, Consumer<Configurer> configurer) throws IOException;
|
||||
|
||||
/**
|
||||
* Discovers a datapack at the specified {@link URI} with the id.
|
||||
* <p>Symlinks obey the {@code allowed_symlinks.txt} in the server root directory.</p>
|
||||
*
|
||||
* @param pluginMeta the plugin which will be the "owner" of this datapack
|
||||
* @param uri the location of the pack
|
||||
* @param id a unique id (will be combined with plugin for the datapacks name)
|
||||
* @param configurer a configurer for extra options
|
||||
* @return the discovered datapack (or null if it failed)
|
||||
* @throws IOException if any IO error occurs
|
||||
*/
|
||||
@Nullable DiscoveredDatapack discoverPack(PluginMeta pluginMeta, URI uri, String id, Consumer<Configurer> configurer) throws IOException;
|
||||
|
||||
/**
|
||||
* Discovers a datapack at the specified {@link Path} with the id.
|
||||
* <p>Symlinks obey the {@code allowed_symlinks.txt} in the server root directory.</p>
|
||||
*
|
||||
* @param pluginMeta the plugin which will be the "owner" of this datapack
|
||||
* @param path the location of the pack
|
||||
* @param id a unique id (will be combined with plugin for the datapacks name)
|
||||
* @param configurer a configurer for extra options
|
||||
* @return the discovered datapack (or null if it failed)
|
||||
* @throws IOException if any IO error occurs
|
||||
*/
|
||||
@Nullable DiscoveredDatapack discoverPack(PluginMeta pluginMeta, Path path, String id, Consumer<Configurer> configurer) throws IOException;
|
||||
|
||||
/**
|
||||
* Configures additional, optional, details about a datapack.
|
||||
*/
|
||||
@ApiStatus.NonExtendable
|
||||
@ApiStatus.Experimental
|
||||
interface Configurer {
|
||||
|
||||
/**
|
||||
* Changes the title of the datapack from the default which
|
||||
* is just the "id" in the {@code registerPack} methods.
|
||||
*
|
||||
* @param title the new title
|
||||
* @return the configurer for chaining
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
Configurer title(Component title);
|
||||
|
||||
/**
|
||||
* Sets whether this pack is going to be automatically enabled on server starts even if previously disabled.
|
||||
* Defaults to false.
|
||||
*
|
||||
* @param autoEnableOnServerStart true to ensure the pack is enabled on server starts.
|
||||
* @return the configurer for chaining
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
Configurer autoEnableOnServerStart(boolean autoEnableOnServerStart);
|
||||
|
||||
/**
|
||||
* Configures the position in the
|
||||
* load order of this datapack.
|
||||
*
|
||||
* @param fixed won't move around in the load order as packs are added/removed
|
||||
* @param position try to insert at the top of the order or bottom
|
||||
* @return the configurer for chaining
|
||||
*/
|
||||
@Contract(value = "_, _ -> this", mutates = "this")
|
||||
Configurer position(boolean fixed, Datapack.Position position);
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ public sealed interface DatapackSource permits DatapackSourceImpl {
|
||||
DatapackSource FEATURE = create("feature");
|
||||
DatapackSource WORLD = create("world");
|
||||
DatapackSource SERVER = create("server");
|
||||
DatapackSource PLUGIN = create("plugin");
|
||||
|
||||
private static DatapackSource create(final String name) {
|
||||
return new DatapackSourceImpl(name);
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
package io.papermc.paper.datapack;
|
||||
|
||||
import java.util.Set;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.FeatureFlag;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Represents a snapshot of a datapack that the server has found by
|
||||
* searching available sources. It may or may not be enabled and isn't
|
||||
* guaranteed to be available. This object won't be
|
||||
* updated as datapacks are updated.
|
||||
* @see DatapackRegistrar
|
||||
*/
|
||||
@NullMarked
|
||||
@ApiStatus.NonExtendable
|
||||
public interface DiscoveredDatapack {
|
||||
|
||||
/**
|
||||
* Gets the name/id of this datapack.
|
||||
*
|
||||
* @return the name of the pack
|
||||
*/
|
||||
@Contract(pure = true)
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Gets the title component of this datapack.
|
||||
*
|
||||
* @return the title
|
||||
*/
|
||||
Component getTitle();
|
||||
|
||||
/**
|
||||
* Gets the description component of this datapack.
|
||||
*
|
||||
* @return the description
|
||||
*/
|
||||
Component getDescription();
|
||||
|
||||
/**
|
||||
* Gets if this datapack is required.
|
||||
* <p>
|
||||
* A "required" datapack will always be enabled on server startup, even if previously disabled.
|
||||
*
|
||||
* @return true if the pack is required
|
||||
*/
|
||||
boolean isRequired();
|
||||
|
||||
/**
|
||||
* Gets the compatibility status of this pack.
|
||||
*
|
||||
* @return the compatibility of the pack
|
||||
*/
|
||||
Datapack.Compatibility getCompatibility();
|
||||
|
||||
/**
|
||||
* Gets the set of required features for this datapack.
|
||||
*
|
||||
* @return the set of required features
|
||||
*/
|
||||
@Unmodifiable
|
||||
Set<FeatureFlag> getRequiredFeatures();
|
||||
|
||||
/**
|
||||
* Gets the source for this datapack.
|
||||
*
|
||||
* @return the pack source
|
||||
*/
|
||||
DatapackSource getSource();
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package io.papermc.paper.entity;
|
||||
|
||||
import org.bukkit.UnsafeValues;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Represents flags for entity serialization.
|
||||
*
|
||||
* @see UnsafeValues#serializeEntity(Entity, EntitySerializationFlag... serializationFlags)
|
||||
* @since 1.21.4
|
||||
*/
|
||||
public enum EntitySerializationFlag {
|
||||
|
||||
/**
|
||||
* Serialize entities that wouldn't be serialized normally
|
||||
* (e.g. dead, despawned, non-persistent, etc.).
|
||||
*
|
||||
* @see Entity#isValid()
|
||||
* @see Entity#isPersistent()
|
||||
*/
|
||||
FORCE,
|
||||
/**
|
||||
* Serialize misc non-saveable entities like lighting bolts, fishing bobbers, etc.
|
||||
* <br>Note: players require a separate flag: {@link #PLAYER}.
|
||||
*/
|
||||
MISC,
|
||||
/**
|
||||
* Include passengers in the serialized data.
|
||||
*/
|
||||
PASSENGERS,
|
||||
/**
|
||||
* Allow serializing {@link Player}s.
|
||||
* <p>Note: deserializing player data will always fail.
|
||||
*/
|
||||
PLAYER
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package io.papermc.paper.entity;
|
||||
|
||||
import java.util.Collection;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* A result type used by {@link org.bukkit.entity.Player#give(ItemStack...)} and its overloads.
|
||||
*/
|
||||
@NullMarked
|
||||
public interface PlayerGiveResult {
|
||||
|
||||
/**
|
||||
* A collection of itemstacks that were not added to the player's inventory as they did not fit.
|
||||
* The collection is derived from the collections of items to add by creating copies of each stack that was not
|
||||
* fully added to the inventory and assigning the non-added count as their amount.
|
||||
* <p>
|
||||
* Itemstacks found here *may* also be found as item entities in the {@link #drops()} collection, as the
|
||||
* give logic may have dropped them.
|
||||
*
|
||||
* @return the unmodifiable collection of itemstacks that are leftover as they could not be added. Each element is a
|
||||
* copy of the input stack they are derived from.
|
||||
*/
|
||||
@Unmodifiable
|
||||
Collection<ItemStack> leftovers();
|
||||
|
||||
/**
|
||||
* A collection of item entities dropped as a result of this call to {@link org.bukkit.entity.Player#give(ItemStack...)}.
|
||||
* The item entities contained here are not guaranteed to match the {@link #leftovers()} as plugins may cancel the
|
||||
* spawning of item entities.
|
||||
*
|
||||
* @return the unmodifiable collection of dropped item entities.
|
||||
*/
|
||||
@Unmodifiable
|
||||
Collection<Item> drops();
|
||||
|
||||
}
|
||||
@@ -12,10 +12,10 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Called when a player uses shears on a block.
|
||||
* Called when a player uses sheers on a block.
|
||||
* <p>
|
||||
* This event is <b>not</b> called when a player breaks blocks with shears, but rather when a
|
||||
* player uses the shears on a block to collect drops from it and/or modify its state.
|
||||
* This event is <b>not</b> called when breaking blocks with shears but instead only when a
|
||||
* player uses the sheer item on a block to garner drops from said block and/or change its state.
|
||||
* <p>
|
||||
* Examples include shearing a pumpkin to turn it into a carved pumpkin or shearing a beehive to get honeycomb.
|
||||
*/
|
||||
|
||||
-103
@@ -1,103 +0,0 @@
|
||||
package io.papermc.paper.event.entity;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.entity.EntityEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Called when an entity attempts to perform a smash attack.
|
||||
*/
|
||||
@NullMarked
|
||||
public class EntityAttemptSmashAttackEvent extends EntityEvent {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private final LivingEntity target;
|
||||
private final ItemStack weapon;
|
||||
private final boolean originalResult;
|
||||
private Result result = Result.DEFAULT;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public EntityAttemptSmashAttackEvent(
|
||||
final LivingEntity attacker,
|
||||
final LivingEntity target,
|
||||
final ItemStack weapon,
|
||||
final boolean originalResult
|
||||
) {
|
||||
super(attacker);
|
||||
this.target = target;
|
||||
this.weapon = weapon;
|
||||
this.originalResult = originalResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Yields the target of the attempted smash attack.
|
||||
*
|
||||
* @return the target entity
|
||||
*/
|
||||
public LivingEntity getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Yields a copy of the itemstack used in the smash attack attempt.
|
||||
*
|
||||
* @return the itemstack
|
||||
*/
|
||||
public ItemStack getWeapon() {
|
||||
return weapon.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Yields the original result the server computed.
|
||||
*
|
||||
* @return {@code true} if this attempt would have been successful by vanilla's logic, {@code false} otherwise.
|
||||
*/
|
||||
public boolean getOriginalResult() {
|
||||
return originalResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Yields the effective result of this event.
|
||||
* The result may take one of three values:
|
||||
*
|
||||
* <ul>
|
||||
* <li>{@link Result#ALLOW}: The attempt will succeed.</li>
|
||||
* <li>{@link Result#DENY}: The attempt will fail.</li>
|
||||
* <li>{@link Result#DEFAULT}: The attempt will succeed if {@link #getOriginalResult()} is {@code true} and fail otherwise.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @return the result.
|
||||
*/
|
||||
public Result getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures a new result for this event.
|
||||
* The passes result may take one of three values:
|
||||
*
|
||||
* <ul>
|
||||
* <li>{@link Result#ALLOW}: The attempt will succeed.</li>
|
||||
* <li>{@link Result#DENY}: The attempt will fail.</li>
|
||||
* <li>{@link Result#DEFAULT}: The attempt will succeed if {@link #getOriginalResult()} is {@code true} and fail otherwise.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param result the new result of the event.
|
||||
*/
|
||||
public void setResult(final Result result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
package io.papermc.paper.event.entity;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.entity.EntityEvent;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* An event that is triggered when an entity receives a potion effect instantly
|
||||
* or when the potion effect is applied on each tick (e.g. every 25 ticks for Poison level 1).
|
||||
* <p>
|
||||
* For example, this event may be called when an entity regenerates health
|
||||
* or takes poison damage as a result of a potion effect.
|
||||
*/
|
||||
@NullMarked
|
||||
public class EntityEffectTickEvent extends EntityEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private final PotionEffectType type;
|
||||
private final int amplifier;
|
||||
private boolean cancelled;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public EntityEffectTickEvent(final LivingEntity entity, final PotionEffectType type, final int amplifier) {
|
||||
super(entity);
|
||||
this.type = type;
|
||||
this.amplifier = amplifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LivingEntity getEntity() {
|
||||
return (LivingEntity) super.getEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type of the potion effect associated with this event.
|
||||
*
|
||||
* @return the {@link PotionEffectType} of the effect
|
||||
*/
|
||||
public PotionEffectType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amplifier level of the potion effect associated with this event.
|
||||
*
|
||||
* @return the amplifier level of the potion effect
|
||||
*/
|
||||
public int getAmplifier() {
|
||||
return amplifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(final boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
}
|
||||
-89
@@ -1,89 +0,0 @@
|
||||
package io.papermc.paper.event.entity;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.entity.EntityEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Called whenever a change to an entity's equipment has been detected. This event is called after effects from
|
||||
* attribute modifiers and enchantments have been updated.
|
||||
* <p>
|
||||
* Examples of actions that can trigger this event:
|
||||
* <ul>
|
||||
* <li>An entity being added to a world.</li>
|
||||
* <li>A player logging in.</li>
|
||||
* <li>The durability of an equipment item changing.</li>
|
||||
* <li>A dispenser equipping an item onto an entity.</li>
|
||||
* <li>An entity picking up an armor or weapon item from the ground.</li>
|
||||
* <li>A player changing their equipped armor.</li>
|
||||
* <li>A player changes their currently held item.</li>
|
||||
* </ul>
|
||||
*/
|
||||
@NullMarked
|
||||
public class EntityEquipmentChangedEvent extends EntityEvent {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private final Map<EquipmentSlot, EquipmentChange> equipmentChanges;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public EntityEquipmentChangedEvent(final LivingEntity entity, final Map<EquipmentSlot, EquipmentChange> equipmentChanges) {
|
||||
super(entity);
|
||||
|
||||
this.equipmentChanges = equipmentChanges;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LivingEntity getEntity() {
|
||||
return (LivingEntity) this.entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a map of changed slots to their respective equipment changes.
|
||||
*
|
||||
* @return the equipment changes map
|
||||
*/
|
||||
public @Unmodifiable Map<EquipmentSlot, EquipmentChange> getEquipmentChanges() {
|
||||
return Collections.unmodifiableMap(this.equipmentChanges);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a change in equipment for a single equipment slot.
|
||||
*/
|
||||
@ApiStatus.NonExtendable
|
||||
public interface EquipmentChange {
|
||||
|
||||
/**
|
||||
* Gets the existing item that is being replaced.
|
||||
*
|
||||
* @return the existing item
|
||||
*/
|
||||
@Contract(pure = true, value = "-> new")
|
||||
ItemStack oldItem();
|
||||
|
||||
/**
|
||||
* Gets the new item that is replacing the existing item.
|
||||
*
|
||||
* @return the new item
|
||||
*/
|
||||
@Contract(pure = true, value = "-> new")
|
||||
ItemStack newItem();
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
package io.papermc.paper.event.executor;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.EventExecutor;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.constant.ConstantDescs;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.MethodType;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@ApiStatus.Internal
|
||||
@NullMarked
|
||||
public final class EventExecutorFactory {
|
||||
private static final byte[] TEMPLATE_CLASS_BYTES;
|
||||
|
||||
static {
|
||||
try (final InputStream is = EventExecutorFactory.class.getResourceAsStream("MethodHandleEventExecutorTemplate.class")) {
|
||||
TEMPLATE_CLASS_BYTES = Objects.requireNonNull(is, "template class is missing").readAllBytes();
|
||||
} catch (IOException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
|
||||
private EventExecutorFactory() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return an {@link EventExecutor} implemented by a hidden class calling a method handle}
|
||||
*
|
||||
* @param method the method to be invoked by the created event executor
|
||||
* @param eventClass the class of the event to handle
|
||||
*/
|
||||
public static EventExecutor create(final Method method, final Class<? extends Event> eventClass) {
|
||||
final List<?> classData = List.of(method, eventClass);
|
||||
try {
|
||||
final MethodHandles.Lookup newClass = MethodHandles.lookup().defineHiddenClassWithClassData(TEMPLATE_CLASS_BYTES, classData, true);
|
||||
return newClass.lookupClass().asSubclass(EventExecutor.class).getDeclaredConstructor().newInstance();
|
||||
} catch (ReflectiveOperationException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
|
||||
record ClassData(Method method, MethodHandle methodHandle, Class<? extends Event> eventClass) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the class data and creates an adjusted MethodHandle directly usable by the lookup class.
|
||||
* The logic is kept here to minimize memory usage per created class.
|
||||
*/
|
||||
static ClassData classData(final MethodHandles.Lookup lookup) {
|
||||
try {
|
||||
final Method method = MethodHandles.classDataAt(lookup, ConstantDescs.DEFAULT_NAME, Method.class, 0);
|
||||
MethodHandle mh = lookup.unreflect(method);
|
||||
if (Modifier.isStatic(method.getModifiers())) {
|
||||
mh = MethodHandles.dropArguments(mh, 0, Listener.class);
|
||||
}
|
||||
mh = mh.asType(MethodType.methodType(void.class, Listener.class, Event.class));
|
||||
final Class<?> eventClass = MethodHandles.classDataAt(lookup, ConstantDescs.DEFAULT_NAME, Class.class, 1);
|
||||
return new ClassData(method, mh, eventClass.asSubclass(Event.class));
|
||||
} catch (ReflectiveOperationException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
-56
@@ -1,56 +0,0 @@
|
||||
package io.papermc.paper.event.executor;
|
||||
|
||||
import com.destroystokyo.paper.util.SneakyThrow;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.EventException;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.EventExecutor;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* This class is designed to be used as hidden class template.
|
||||
* Initializing the class directly will fail due to missing {@code classData}.
|
||||
* Instead, {@link java.lang.invoke.MethodHandles.Lookup#defineHiddenClassWithClassData(byte[], Object, boolean, MethodHandles.Lookup.ClassOption...)}
|
||||
* must be used, with the {@code classData} object being a list consisting of two elements:
|
||||
* <ol>
|
||||
* <li>A {@link Method} representing the event handler method</li>
|
||||
* <li>A {@link Class} representing the event type</li>
|
||||
* </ol>
|
||||
* The method must take {@link Event} or a subtype of it as its single parameter.
|
||||
* If the method is non-static, it also needs to reside in a class implementing {@link Listener}.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@ApiStatus.Internal
|
||||
@NullMarked
|
||||
class MethodHandleEventExecutorTemplate implements EventExecutor {
|
||||
private static final Method METHOD;
|
||||
private static final MethodHandle HANDLE;
|
||||
private static final Class<? extends Event> EVENT_CLASS;
|
||||
|
||||
static {
|
||||
final MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
final EventExecutorFactory.ClassData classData = EventExecutorFactory.classData(lookup);
|
||||
METHOD = classData.method();
|
||||
HANDLE = classData.methodHandle();
|
||||
EVENT_CLASS = classData.eventClass();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(final Listener listener, final Event event) throws EventException {
|
||||
if (!EVENT_CLASS.isInstance(event)) return;
|
||||
try {
|
||||
HANDLE.invokeExact(listener, event);
|
||||
} catch (Throwable t) {
|
||||
SneakyThrow.sneaky(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MethodHandleEventExecutorTemplate['" + METHOD + "']";
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package io.papermc.paper.event.packet;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Called when a {@code minecraft:client_tick_end} packet is received by the server.
|
||||
*/
|
||||
@NullMarked
|
||||
public class ClientTickEndEvent extends PlayerEvent {
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
@ApiStatus.Internal
|
||||
public ClientTickEndEvent(final Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
}
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
package io.papermc.paper.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Called when a player is marked as loaded.
|
||||
* <p>
|
||||
* This either happens when the player notifies the server after loading the world (closing the downloading terrain screen)
|
||||
* or when the player has not done so for 60 ticks after joining the server or respawning.
|
||||
*/
|
||||
@NullMarked
|
||||
public class PlayerClientLoadedWorldEvent extends PlayerEvent {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private final boolean timeout;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public PlayerClientLoadedWorldEvent(final Player who, final boolean timeout) {
|
||||
super(who);
|
||||
this.timeout = timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* True if the event was triggered because the server has not been notified by the player
|
||||
* for 60 ticks after the player joined the server or respawned.
|
||||
*
|
||||
* @return true if the event was triggered because of a timeout
|
||||
*/
|
||||
public boolean isTimeout() {
|
||||
return timeout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package io.papermc.paper.math;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Represents a rotation with specified pitch and yaw values.
|
||||
*/
|
||||
@NullMarked
|
||||
public interface Rotation {
|
||||
/**
|
||||
* Creates a new rotation with the specified yaw and pitch values.
|
||||
*
|
||||
* @param yaw the yaw component of the rotation, measured in degrees
|
||||
* @param pitch the pitch component of the rotation, measured in degrees
|
||||
* @return a new {@code Rotation} instance with the specified yaw and pitch
|
||||
*/
|
||||
static Rotation rotation(float yaw, float pitch) {
|
||||
return new RotationImpl(yaw, pitch);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the pitch component of the rotation, measured in degrees.
|
||||
*
|
||||
* @return the pitch value in degrees
|
||||
*/
|
||||
float pitch();
|
||||
|
||||
/**
|
||||
* Retrieves the yaw component of the rotation, measured in degrees.
|
||||
*
|
||||
* @return the yaw value in degrees
|
||||
*/
|
||||
float yaw();
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package io.papermc.paper.math;
|
||||
|
||||
record RotationImpl(float yaw, float pitch) implements Rotation {
|
||||
}
|
||||
-10
@@ -1,12 +1,10 @@
|
||||
package io.papermc.paper.plugin.lifecycle.event.types;
|
||||
|
||||
import io.papermc.paper.command.brigadier.Commands;
|
||||
import io.papermc.paper.datapack.DatapackRegistrar;
|
||||
import io.papermc.paper.plugin.bootstrap.BootstrapContext;
|
||||
import io.papermc.paper.plugin.lifecycle.event.LifecycleEvent;
|
||||
import io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager;
|
||||
import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner;
|
||||
import io.papermc.paper.plugin.lifecycle.event.registrar.RegistrarEvent;
|
||||
import io.papermc.paper.plugin.lifecycle.event.registrar.ReloadableRegistrarEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
@@ -34,14 +32,6 @@ public final class LifecycleEvents {
|
||||
*/
|
||||
public static final TagEventTypeProvider TAGS = LifecycleEventTypeProvider.provider().tagProvider();
|
||||
|
||||
|
||||
/**
|
||||
* This event is for informing the server about any available datapacks from other sources such as inside a plugin's jar. You
|
||||
* can register a handler for this event only in {@link io.papermc.paper.plugin.bootstrap.PluginBootstrap#bootstrap(BootstrapContext)}.
|
||||
* @see DatapackRegistrar an example of a datapack being discovered
|
||||
*/
|
||||
public static final LifecycleEventType.Prioritizable<BootstrapContext, RegistrarEvent<DatapackRegistrar>> DATAPACK_DISCOVERY = bootstrapPrioritized("datapack_discovery");
|
||||
|
||||
//<editor-fold desc="helper methods" defaultstate="collapsed">
|
||||
@ApiStatus.Internal
|
||||
static <E extends LifecycleEvent> LifecycleEventType.Monitorable<Plugin, E> plugin(final String name) {
|
||||
|
||||
-112
@@ -1,112 +0,0 @@
|
||||
package io.papermc.paper.raytracing;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
import org.bukkit.FluidCollisionMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.checkerframework.checker.index.qual.NonNegative;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* A builder for configuring a raytrace with a starting location
|
||||
* and direction.
|
||||
*/
|
||||
@NullMarked
|
||||
public interface PositionedRayTraceConfigurationBuilder {
|
||||
|
||||
/**
|
||||
* Sets the starting location.
|
||||
*
|
||||
* @param start the new starting location
|
||||
* @return a reference to this object
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
PositionedRayTraceConfigurationBuilder start(Location start);
|
||||
|
||||
/**
|
||||
* Sets the direction.
|
||||
*
|
||||
* @param direction the new direction
|
||||
* @return a reference to this object
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
PositionedRayTraceConfigurationBuilder direction(Vector direction);
|
||||
|
||||
/**
|
||||
* Sets the maximum distance.
|
||||
*
|
||||
* @param maxDistance the new maxDistance
|
||||
* @return a reference to this object
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
PositionedRayTraceConfigurationBuilder maxDistance(@NonNegative double maxDistance);
|
||||
|
||||
/**
|
||||
* Sets the FluidCollisionMode when looking for block collisions.
|
||||
* <p>
|
||||
* If collisions with passable blocks are ignored, fluid collisions are
|
||||
* ignored as well regardless of the fluid collision mode.
|
||||
*
|
||||
* @param fluidCollisionMode the new FluidCollisionMode
|
||||
* @return a reference to this object
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
PositionedRayTraceConfigurationBuilder fluidCollisionMode(FluidCollisionMode fluidCollisionMode);
|
||||
|
||||
/**
|
||||
* Sets whether the raytrace should ignore passable blocks when looking for
|
||||
* block collisions.
|
||||
* <p>
|
||||
* If collisions with passable blocks are ignored, fluid collisions are
|
||||
* ignored as well regardless of the fluid collision mode.
|
||||
* <p>
|
||||
* Portal blocks are only considered passable if the ray starts within them.
|
||||
* Apart from that collisions with portal blocks will be considered even if
|
||||
* collisions with passable blocks are otherwise ignored.
|
||||
*
|
||||
* @param ignorePassableBlocks if the raytrace should ignore passable blocks
|
||||
* @return a reference to this object
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
PositionedRayTraceConfigurationBuilder ignorePassableBlocks(boolean ignorePassableBlocks);
|
||||
|
||||
/**
|
||||
* Sets the size of the raytrace when looking for entity collisions.
|
||||
*
|
||||
* @param raySize the new raytrace size
|
||||
* @return a reference to this object
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
PositionedRayTraceConfigurationBuilder raySize(@NonNegative double raySize);
|
||||
|
||||
/**
|
||||
* Sets the current entity filter when looking for entity collisions.
|
||||
*
|
||||
* @param entityFilter predicate for entities the ray can potentially collide with
|
||||
* @return a reference to this object
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
PositionedRayTraceConfigurationBuilder entityFilter(Predicate<? super Entity> entityFilter);
|
||||
|
||||
/**
|
||||
* Sets the current block filter when looking for block collisions.
|
||||
*
|
||||
* @param blockFilter predicate for blocks the ray can potentially collide with
|
||||
* @return a reference to this object
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
PositionedRayTraceConfigurationBuilder blockFilter(Predicate<? super Block> blockFilter);
|
||||
|
||||
/**
|
||||
* Sets the targets for the rayTrace.
|
||||
*
|
||||
* @param first the first target
|
||||
* @param others the other targets
|
||||
* @return a reference to this object
|
||||
*/
|
||||
@Contract(value = "_, _ -> this", mutates = "this")
|
||||
PositionedRayTraceConfigurationBuilder targets(RayTraceTarget first, RayTraceTarget... others);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package io.papermc.paper.raytracing;
|
||||
|
||||
/**
|
||||
* List of Targets a builder can target.
|
||||
*/
|
||||
public enum RayTraceTarget {
|
||||
ENTITY,
|
||||
BLOCK
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package io.papermc.paper.registry;
|
||||
|
||||
import io.papermc.paper.datacomponent.DataComponentType;
|
||||
import io.papermc.paper.registry.tag.TagKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.key.KeyPattern;
|
||||
import net.kyori.adventure.key.Keyed;
|
||||
@@ -210,6 +209,7 @@ public sealed interface RegistryKey<T> extends Keyed permits RegistryKeyImpl {
|
||||
* @param key the key of the typed key.
|
||||
* @return the constructed typed key.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
default TypedKey<T> typedKey(final Key key) {
|
||||
return TypedKey.create(this, key);
|
||||
}
|
||||
@@ -220,29 +220,8 @@ public sealed interface RegistryKey<T> extends Keyed permits RegistryKeyImpl {
|
||||
* @param key the string representation of the key that will be passed to {@link Key#key(String)}.
|
||||
* @return the constructed typed key.
|
||||
*/
|
||||
default TypedKey<T> typedKey(@KeyPattern final String key) {
|
||||
@ApiStatus.Experimental
|
||||
default TypedKey<T> typedKey(final @KeyPattern String key) {
|
||||
return TypedKey.create(this, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@link TagKey} for this registry given the tag key's key.
|
||||
*
|
||||
* @param key the key of the typed key.
|
||||
* @return the constructed tag key.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
default TagKey<T> tagKey(final Key key) {
|
||||
return TagKey.create(this, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@link TagKey} for this registry given the tag key's key.
|
||||
*
|
||||
* @param key the string representation of the key that will be passed to {@link Key#key(String)}.
|
||||
* @return the constructed tag key.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
default TagKey<T> tagKey(@KeyPattern final String key) {
|
||||
return TagKey.create(this, key);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
*
|
||||
* @param <T> the value type for the registry
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@NullMarked
|
||||
public sealed interface TypedKey<T> extends Key permits TypedKeyImpl {
|
||||
|
||||
@@ -38,6 +39,7 @@ public sealed interface TypedKey<T> extends Key permits TypedKeyImpl {
|
||||
* @param <T> value type
|
||||
* @return a new key for the value key and registry key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
static <T> TypedKey<T> create(final RegistryKey<T> registryKey, final Key key) {
|
||||
return new TypedKeyImpl<>(key, registryKey);
|
||||
}
|
||||
@@ -51,7 +53,8 @@ public sealed interface TypedKey<T> extends Key permits TypedKeyImpl {
|
||||
* @return a new key for the value key and registry key
|
||||
* @see Key#key(String)
|
||||
*/
|
||||
static <T> TypedKey<T> create(final RegistryKey<T> registryKey, @KeyPattern final String key) {
|
||||
@ApiStatus.Experimental
|
||||
static <T> TypedKey<T> create(final RegistryKey<T> registryKey, final @KeyPattern String key) {
|
||||
return create(registryKey, Key.key(key));
|
||||
}
|
||||
}
|
||||
-65
@@ -1,65 +0,0 @@
|
||||
package io.papermc.paper.registry.data;
|
||||
|
||||
import io.papermc.paper.registry.RegistryBuilder;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.block.banner.PatternType;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
|
||||
/**
|
||||
* A data-centric version-specific registry entry for the {@link PatternType} type.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@ApiStatus.NonExtendable
|
||||
public interface BannerPatternRegistryEntry {
|
||||
|
||||
/**
|
||||
* Provides the asset id of the pattern type, which is the location of the sprite to use.
|
||||
*
|
||||
* @return the asset id.
|
||||
*/
|
||||
Key assetId();
|
||||
|
||||
/**
|
||||
* Provides the translation key for displaying the pattern inside the banner's tooltip.
|
||||
*
|
||||
* @return the translation key.
|
||||
*/
|
||||
String translationKey();
|
||||
|
||||
/**
|
||||
* A mutable builder for the {@link BannerPatternRegistryEntry} plugins may change in applicable registry events.
|
||||
* <p>
|
||||
* The following values are required for each builder:
|
||||
* <ul>
|
||||
* <li>{@link #assetId(Key)}</li>
|
||||
* <li>{@link #translationKey(String)}</li>
|
||||
* </ul>
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@ApiStatus.NonExtendable
|
||||
interface Builder extends BannerPatternRegistryEntry, RegistryBuilder<PatternType> {
|
||||
|
||||
/**
|
||||
* Sets the asset id of the pattern type, which is the location of the sprite to use.
|
||||
*
|
||||
* @param assetId the asset id.
|
||||
* @return this builder instance.
|
||||
* @see BannerPatternRegistryEntry#assetId()
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
Builder assetId(Key assetId);
|
||||
|
||||
/**
|
||||
* Sets the translation key for displaying the pattern inside the banner's tooltip.
|
||||
*
|
||||
* @param translationKey the translation key.
|
||||
* @return this builder instance.
|
||||
* @see BannerPatternRegistryEntry#translationKey()
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
Builder translationKey(String translationKey);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
package io.papermc.paper.registry.data;
|
||||
|
||||
import io.papermc.paper.registry.RegistryBuilder;
|
||||
import org.bukkit.damage.DamageEffect;
|
||||
import org.bukkit.damage.DamageScaling;
|
||||
import org.bukkit.damage.DamageType;
|
||||
import org.bukkit.damage.DeathMessageType;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
|
||||
/**
|
||||
* A data-centric version-specific registry entry for the {@link DamageType} type.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@ApiStatus.NonExtendable
|
||||
public interface DamageTypeRegistryEntry {
|
||||
|
||||
/**
|
||||
* Provides part of the death message translation key. (death.attack.<message_id>)
|
||||
* <p>
|
||||
* <strong>Note</strong> The translation key is only used if
|
||||
* {@link #deathMessageType()} is {@link DeathMessageType#DEFAULT}
|
||||
*
|
||||
* @return part of the translation key
|
||||
*/
|
||||
String messageId();
|
||||
|
||||
/**
|
||||
* Provides the amount of hunger exhaustion caused by this damage type.
|
||||
*
|
||||
* @return the exhaustion
|
||||
*/
|
||||
float exhaustion();
|
||||
|
||||
/**
|
||||
* Provides the {@link DamageScaling} for this damage type.
|
||||
*
|
||||
* @return the damage scaling
|
||||
*/
|
||||
DamageScaling damageScaling();
|
||||
|
||||
/**
|
||||
* Provides the {@link DamageEffect} for this damage type.
|
||||
*
|
||||
* @return the damage effect
|
||||
*/
|
||||
DamageEffect damageEffect();
|
||||
|
||||
/**
|
||||
* Provides the {@link DeathMessageType} for this damage type.
|
||||
*
|
||||
* @return the death message type
|
||||
*/
|
||||
DeathMessageType deathMessageType();
|
||||
|
||||
/**
|
||||
* A mutable builder for the {@link DamageTypeRegistryEntry} plugins may change in applicable registry events.
|
||||
* <p>
|
||||
* The following values are required for each builder:
|
||||
* <ul>
|
||||
* <li>{@link #messageId(String)}</li>
|
||||
* <li>{@link #exhaustion(float)}</li>
|
||||
* <li>{@link #damageScaling(DamageScaling)}</li>
|
||||
* </ul>
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@ApiStatus.NonExtendable
|
||||
interface Builder extends DamageTypeRegistryEntry, RegistryBuilder<DamageType> {
|
||||
|
||||
/**
|
||||
* Sets part of the death message translation key.
|
||||
*
|
||||
* @return this builder instance.
|
||||
* @see DamageTypeRegistryEntry#messageId()
|
||||
* @see DamageType#getTranslationKey()
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
Builder messageId(String messageId);
|
||||
|
||||
/**
|
||||
* Sets the amount of hunger exhaustion caused by this damage type.
|
||||
*
|
||||
* @return this builder instance.
|
||||
* @see DamageTypeRegistryEntry#exhaustion()
|
||||
* @see DamageType#getExhaustion()
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
Builder exhaustion(float exhaustion);
|
||||
|
||||
/**
|
||||
* Sets the {@link DamageScaling} for this damage type.
|
||||
*
|
||||
* @return this builder instance.
|
||||
* @see DamageTypeRegistryEntry#damageScaling()
|
||||
* @see DamageType#getDamageScaling()
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
Builder damageScaling(DamageScaling scaling);
|
||||
|
||||
/**
|
||||
* Sets the {@link DamageEffect} for this damage type.
|
||||
*
|
||||
* @return this builder instance.
|
||||
* @see DamageTypeRegistryEntry#damageEffect()
|
||||
* @see DamageType#getDamageEffect()
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
Builder damageEffect(DamageEffect effect);
|
||||
|
||||
/**
|
||||
* Sets the {@link DeathMessageType} for this damage type.
|
||||
*
|
||||
* @return this builder instance.
|
||||
* @see DamageTypeRegistryEntry#deathMessageType()
|
||||
* @see DamageType#getDeathMessageType()
|
||||
*/
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
Builder deathMessageType(DeathMessageType deathMessageType);
|
||||
}
|
||||
}
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
package io.papermc.paper.registry.data;
|
||||
|
||||
import io.papermc.paper.registry.RegistryBuilderFactory;
|
||||
import java.util.Optional;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.function.Consumer;
|
||||
import org.bukkit.Art;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
@ApiStatus.Internal
|
||||
@ApiStatus.NonExtendable
|
||||
public interface InlinedRegistryBuilderProvider {
|
||||
|
||||
static InlinedRegistryBuilderProvider instance() {
|
||||
class Holder {
|
||||
static final Optional<InlinedRegistryBuilderProvider> INSTANCE = ServiceLoader.load(InlinedRegistryBuilderProvider.class).findFirst();
|
||||
}
|
||||
return Holder.INSTANCE.orElseThrow();
|
||||
}
|
||||
|
||||
Art createPaintingVariant(Consumer<RegistryBuilderFactory<Art, ? extends PaintingVariantRegistryEntry.Builder>> value);
|
||||
}
|
||||
@@ -1,15 +1,11 @@
|
||||
package io.papermc.paper.registry.event;
|
||||
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.data.BannerPatternRegistryEntry;
|
||||
import io.papermc.paper.registry.data.DamageTypeRegistryEntry;
|
||||
import io.papermc.paper.registry.data.EnchantmentRegistryEntry;
|
||||
import io.papermc.paper.registry.data.GameEventRegistryEntry;
|
||||
import io.papermc.paper.registry.data.PaintingVariantRegistryEntry;
|
||||
import org.bukkit.Art;
|
||||
import org.bukkit.GameEvent;
|
||||
import org.bukkit.block.banner.PatternType;
|
||||
import org.bukkit.damage.DamageType;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -27,8 +23,6 @@ public final class RegistryEvents {
|
||||
public static final RegistryEventProvider<GameEvent, GameEventRegistryEntry.Builder> GAME_EVENT = create(RegistryKey.GAME_EVENT);
|
||||
public static final RegistryEventProvider<Enchantment, EnchantmentRegistryEntry.Builder> ENCHANTMENT = create(RegistryKey.ENCHANTMENT);
|
||||
public static final RegistryEventProvider<Art, PaintingVariantRegistryEntry.Builder> PAINTING_VARIANT = create(RegistryKey.PAINTING_VARIANT);
|
||||
public static final RegistryEventProvider<PatternType, BannerPatternRegistryEntry.Builder> BANNER_PATTERN = create(RegistryKey.BANNER_PATTERN);
|
||||
public static final RegistryEventProvider<DamageType, DamageTypeRegistryEntry.Builder> DAMAGE_TYPE = create(RegistryKey.DAMAGE_TYPE);
|
||||
|
||||
private RegistryEvents() {
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package io.papermc.paper.registry.tag;
|
||||
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.key.KeyPattern;
|
||||
import net.kyori.adventure.key.Keyed;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
@@ -17,29 +15,15 @@ public sealed interface TagKey<T> extends Keyed permits TagKeyImpl {
|
||||
* Creates a new tag key for a registry.
|
||||
*
|
||||
* @param registryKey the registry for the tag
|
||||
* @param key the specific key for the tag
|
||||
* @param <T> the registry value type
|
||||
* @param key the specific key for the tag
|
||||
* @return a new tag key
|
||||
* @param <T> the registry value type
|
||||
*/
|
||||
@Contract(value = "_, _ -> new", pure = true)
|
||||
static <T> TagKey<T> create(final RegistryKey<T> registryKey, final Key key) {
|
||||
return new TagKeyImpl<>(registryKey, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new tag key for a registry.
|
||||
*
|
||||
* @param registryKey the registry for the tag
|
||||
* @param key the string version of a {@link Key} that will be passed to {@link Key#key(String)} for parsing.
|
||||
* @param <T> the registry value type
|
||||
* @return a new tag key
|
||||
* @see Key#key(String)
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
static <T> TagKey<T> create(final RegistryKey<T> registryKey, @KeyPattern final String key) {
|
||||
return create(registryKey, Key.key(key));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the registry key for this tag key.
|
||||
*
|
||||
|
||||
@@ -19,20 +19,18 @@ import org.jspecify.annotations.NullMarked;
|
||||
* tags only point to individual entries and not other nested tags.
|
||||
* <p>
|
||||
* An example of a custom enchant being registered to the vanilla
|
||||
* {@code #minecraft:in_enchanting_table} tag:
|
||||
* {@code #minecraft:in_enchanting_table} tag.
|
||||
* <pre>{@code
|
||||
* class YourBootstrapClass implements PluginBootstrap {
|
||||
*
|
||||
* public static final TypedKey<Enchantment> CUSTOM_POINTY_ENCHANT = EnchantmentKeys.create(Key.key("papermc:pointy"));
|
||||
*
|
||||
* @Override
|
||||
* public void bootstrap(BootstrapContext context) {
|
||||
* final LifecycleEventManager<BootstrapContext> manager = context.getLifecycleManager();
|
||||
* LifecycleEventManager<BootstrapContext> manager = context.getLifecycleManager();
|
||||
* manager.registerEventHandler(LifecycleEvents.TAGS.postFlatten(RegistryKey.ENCHANTMENT), event -> {
|
||||
* final PostFlattenTagRegistrar<Enchantment> registrar = event.registrar();
|
||||
* registrar.addToTag(
|
||||
* EnchantmentTagKeys.IN_ENCHANTING_TABLE,
|
||||
* Set.of(CUSTOM_POINTY_ENCHANT)
|
||||
* Set.of(CUSTOM_ENCHANT)
|
||||
* );
|
||||
* });
|
||||
* }
|
||||
|
||||
@@ -22,11 +22,9 @@ import org.jspecify.annotations.NullMarked;
|
||||
* <pre>{@code
|
||||
* class YourBootstrapClass implements PluginBootstrap {
|
||||
*
|
||||
* public static final TagKey<ItemType> AXE_PICKAXE = ItemTypeTagKeys.create(Key.key("papermc:axe_pickaxe"));
|
||||
*
|
||||
* @Override
|
||||
* public void bootstrap(BootstrapContext context) {
|
||||
* final LifecycleEventManager<BootstrapContext> manager = context.getLifecycleManager();
|
||||
* LifecycleEventManager<BootstrapContext> manager = context.getLifecycleManager();
|
||||
* manager.registerEventHandler(LifecycleEvents.TAGS.preFlatten(RegistryKey.ITEM), event -> {
|
||||
* final PreFlattenTagRegistrar<ItemType> registrar = event.registrar();
|
||||
* registrar.setTag(AXE_PICKAXE, Set.of(
|
||||
|
||||
@@ -2,15 +2,9 @@ package org.bukkit;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.papermc.paper.registry.RegistryAccess;
|
||||
import io.papermc.paper.registry.RegistryBuilderFactory;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.data.InlinedRegistryBuilderProvider;
|
||||
import io.papermc.paper.registry.data.PaintingVariantRegistryEntry;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Consumer;
|
||||
import org.bukkit.packs.DataPack;
|
||||
import org.bukkit.util.OldEnum;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -19,22 +13,11 @@ import org.jetbrains.annotations.Nullable;
|
||||
* <p>
|
||||
* The arts listed in this interface are present in the default server
|
||||
* or can be enabled via a {@link FeatureFlag}.
|
||||
* There may be additional arts present in the server, for example from a {@link io.papermc.paper.datapack.Datapack}
|
||||
* which can be accessed via {@link RegistryAccess#registryAccess()} and {@link RegistryKey#PAINTING_VARIANT}.
|
||||
* There may be additional arts present in the server, for example from a {@link DataPack}
|
||||
* which can be accessed via {@link Registry#ART}.
|
||||
*/
|
||||
public interface Art extends OldEnum<Art>, Keyed {
|
||||
|
||||
/**
|
||||
* Create an inlined painting variant.
|
||||
*
|
||||
* @param value a consumer for the builder factory
|
||||
* @return the created painting variant
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
static @NotNull Art create(final @NotNull Consumer<RegistryBuilderFactory<Art, ? extends PaintingVariantRegistryEntry.Builder>> value) {
|
||||
return InlinedRegistryBuilderProvider.instance().createPaintingVariant(value);
|
||||
}
|
||||
|
||||
Art KEBAB = getArt("kebab");
|
||||
Art AZTEC = getArt("aztec");
|
||||
Art ALBAN = getArt("alban");
|
||||
@@ -88,7 +71,7 @@ public interface Art extends OldEnum<Art>, Keyed {
|
||||
|
||||
@NotNull
|
||||
private static Art getArt(@NotNull String key) {
|
||||
return RegistryAccess.registryAccess().getRegistry(RegistryKey.PAINTING_VARIANT).getOrThrow(NamespacedKey.minecraft(key));
|
||||
return Registry.ART.getOrThrow(NamespacedKey.minecraft(key));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -190,7 +173,7 @@ public interface Art extends OldEnum<Art>, Keyed {
|
||||
static Art getByName(@NotNull String name) {
|
||||
Preconditions.checkArgument(name != null, "Name cannot be null");
|
||||
|
||||
return Bukkit.getUnsafe().get(RegistryKey.PAINTING_VARIANT, NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
|
||||
return Bukkit.getUnsafe().get(Registry.ART, NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -201,7 +184,7 @@ public interface Art extends OldEnum<Art>, Keyed {
|
||||
@NotNull
|
||||
@Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
|
||||
static Art valueOf(@NotNull String name) {
|
||||
Art art = Bukkit.getUnsafe().get(RegistryKey.PAINTING_VARIANT, NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
|
||||
Art art = Bukkit.getUnsafe().get(Registry.ART, NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
|
||||
Preconditions.checkArgument(art != null, "No art found with the name %s", name);
|
||||
return art;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemCraftResult;
|
||||
import org.bukkit.inventory.ItemFactory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.MenuType;
|
||||
import org.bukkit.inventory.Merchant;
|
||||
import org.bukkit.inventory.Recipe;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
@@ -1185,7 +1184,7 @@ public final class Bukkit {
|
||||
* @return the {@link Recipe} resulting from the given crafting matrix.
|
||||
*/
|
||||
@Nullable
|
||||
public static Recipe getCraftingRecipe(@NotNull ItemStack @NotNull [] craftingMatrix, @NotNull World world) {
|
||||
public static Recipe getCraftingRecipe(@NotNull ItemStack[] craftingMatrix, @NotNull World world) {
|
||||
return server.getCraftingRecipe(craftingMatrix, world);
|
||||
}
|
||||
|
||||
@@ -1214,7 +1213,7 @@ public final class Bukkit {
|
||||
* @return resulting {@link ItemCraftResult} containing the resulting item, matrix and any overflow items.
|
||||
*/
|
||||
@NotNull
|
||||
public static ItemCraftResult craftItemResult(@NotNull ItemStack @NotNull [] craftingMatrix, @NotNull World world, @NotNull Player player) {
|
||||
public static ItemCraftResult craftItemResult(@NotNull ItemStack[] craftingMatrix, @NotNull World world, @NotNull Player player) {
|
||||
return server.craftItemResult(craftingMatrix, world, player);
|
||||
}
|
||||
|
||||
@@ -1236,7 +1235,7 @@ public final class Bukkit {
|
||||
* @return resulting {@link ItemCraftResult} containing the resulting item, matrix and any overflow items.
|
||||
*/
|
||||
@NotNull
|
||||
public static ItemCraftResult craftItemResult(@NotNull ItemStack @NotNull [] craftingMatrix, @NotNull World world) {
|
||||
public static ItemCraftResult craftItemResult(@NotNull ItemStack[] craftingMatrix, @NotNull World world) {
|
||||
return server.craftItemResult(craftingMatrix, world);
|
||||
}
|
||||
|
||||
@@ -1267,7 +1266,7 @@ public final class Bukkit {
|
||||
* an ItemStack of {@link Material#AIR} is returned.
|
||||
*/
|
||||
@NotNull
|
||||
public static ItemStack craftItem(@NotNull ItemStack @NotNull [] craftingMatrix, @NotNull World world, @NotNull Player player) {
|
||||
public static ItemStack craftItem(@NotNull ItemStack[] craftingMatrix, @NotNull World world, @NotNull Player player) {
|
||||
return server.craftItem(craftingMatrix, world, player);
|
||||
}
|
||||
|
||||
@@ -1290,7 +1289,7 @@ public final class Bukkit {
|
||||
* an ItemStack of {@link Material#AIR} is returned.
|
||||
*/
|
||||
@NotNull
|
||||
public static ItemStack craftItem(@NotNull ItemStack @NotNull [] craftingMatrix, @NotNull World world) {
|
||||
public static ItemStack craftItem(@NotNull ItemStack[] craftingMatrix, @NotNull World world) {
|
||||
return server.craftItem(craftingMatrix, world);
|
||||
}
|
||||
|
||||
@@ -1373,11 +1372,7 @@ public final class Bukkit {
|
||||
* Sets the radius, in blocks, around each worlds spawn point to protect.
|
||||
*
|
||||
* @param value new spawn radius, or 0 if none
|
||||
* @deprecated has not functioned for a long time as the spawn radius is defined by the server.properties file.
|
||||
* There is no API replacement for this method. It is generally recommended to implement "protection"-like behaviour
|
||||
* via events or third-party plugin APIs.
|
||||
*/
|
||||
@Deprecated(since = "1.21.4", forRemoval = true)
|
||||
public static void setSpawnRadius(int value) {
|
||||
server.setSpawnRadius(value);
|
||||
}
|
||||
@@ -1761,7 +1756,8 @@ public final class Bukkit {
|
||||
*
|
||||
* @return an array containing all previous players
|
||||
*/
|
||||
public static @NotNull OfflinePlayer @NotNull [] getOfflinePlayers() {
|
||||
@NotNull
|
||||
public static OfflinePlayer[] getOfflinePlayers() {
|
||||
return server.getOfflinePlayers();
|
||||
}
|
||||
|
||||
@@ -1930,10 +1926,7 @@ public final class Bukkit {
|
||||
* @param title the title of the corresponding merchant inventory, displayed
|
||||
* when the merchant inventory is viewed
|
||||
* @return a new merchant
|
||||
* @deprecated The title parameter is no-longer needed when used with
|
||||
* {@link MenuType#MERCHANT} and {@link MenuType.Typed#builder()}.
|
||||
*/
|
||||
@Deprecated(since = "1.21.4")
|
||||
public static @NotNull Merchant createMerchant(net.kyori.adventure.text.@Nullable Component title) {
|
||||
return server.createMerchant(title);
|
||||
}
|
||||
@@ -1944,8 +1937,7 @@ public final class Bukkit {
|
||||
* @param title the title of the corresponding merchant inventory, displayed
|
||||
* when the merchant inventory is viewed
|
||||
* @return a new merchant
|
||||
* @deprecated in favour of {@link #createMerchant(net.kyori.adventure.text.Component)}. The title parameter is
|
||||
* no-longer needed when used with {@link MenuType#MERCHANT} and {@link MenuType.Typed#builder()}
|
||||
* @deprecated in favour of {@link #createMerchant(net.kyori.adventure.text.Component)}
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated // Paper
|
||||
@@ -1953,16 +1945,6 @@ public final class Bukkit {
|
||||
return server.createMerchant(title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an empty merchant.
|
||||
*
|
||||
* @return a new merchant
|
||||
*/
|
||||
@NotNull
|
||||
public static Merchant createMerchant() {
|
||||
return server.createMerchant();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amount of consecutive neighbor updates before skipping
|
||||
* additional ones.
|
||||
@@ -2422,7 +2404,8 @@ public final class Bukkit {
|
||||
* Gets the current server TPS
|
||||
* @return current server TPS (1m, 5m, 15m in Paper-Server)
|
||||
*/
|
||||
public static double @NotNull [] getTPS() {
|
||||
@NotNull
|
||||
public static double[] getTPS() {
|
||||
return server.getTPS();
|
||||
}
|
||||
|
||||
@@ -2431,7 +2414,8 @@ public final class Bukkit {
|
||||
*
|
||||
* @return A sample of the servers last tick times (in nanos)
|
||||
*/
|
||||
public static long @NotNull [] getTickTimes() {
|
||||
@NotNull
|
||||
public static long[] getTickTimes() {
|
||||
return server.getTickTimes();
|
||||
}
|
||||
|
||||
@@ -2980,19 +2964,8 @@ public final class Bukkit {
|
||||
}
|
||||
// Paper end - Folia region threading API
|
||||
|
||||
/**
|
||||
* @deprecated All methods on this class have been deprecated, see the individual methods for replacements.
|
||||
*/
|
||||
@Deprecated(since = "1.21.4", forRemoval = true)
|
||||
@NotNull
|
||||
public static Server.Spigot spigot() {
|
||||
return server.spigot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Restarts the server. If the server administrator has not configured restarting, the server will stop.
|
||||
*/
|
||||
public static void restart() {
|
||||
server.restart();
|
||||
}
|
||||
}
|
||||
@@ -133,7 +133,8 @@ public interface Chunk extends PersistentDataHolder {
|
||||
*
|
||||
* @return The entities.
|
||||
*/
|
||||
@NotNull Entity @NotNull [] getEntities();
|
||||
@NotNull
|
||||
Entity[] getEntities();
|
||||
|
||||
/**
|
||||
* Get a list of all tile entities in the chunk.
|
||||
@@ -142,7 +143,7 @@ public interface Chunk extends PersistentDataHolder {
|
||||
*/
|
||||
@NotNull
|
||||
// Paper start
|
||||
default BlockState @NotNull [] getTileEntities() {
|
||||
default BlockState[] getTileEntities() {
|
||||
return getTileEntities(true);
|
||||
}
|
||||
|
||||
@@ -153,7 +154,7 @@ public interface Chunk extends PersistentDataHolder {
|
||||
* @return The tile entities.
|
||||
*/
|
||||
@NotNull
|
||||
BlockState @NotNull [] getTileEntities(boolean useSnapshot);
|
||||
BlockState[] getTileEntities(boolean useSnapshot);
|
||||
|
||||
/**
|
||||
* Get a list of all tile entities that match a given predicate in the chunk.
|
||||
|
||||
Loaded 100 of 514 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user