Compare commits
20
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
64107df246 | ||
|
|
5e2d34c096 | ||
|
|
a0bec2312c | ||
|
|
849d6107a9 | ||
|
|
1c35f64788 | ||
|
|
cb005e4559 | ||
|
|
08370f6416 | ||
|
|
6d981e0f10 | ||
|
|
ed5d703779 | ||
|
|
7920bd0568 | ||
|
|
7a85e6cdfc | ||
|
|
d86abcf028 | ||
|
|
d6c754a520 | ||
|
|
af3882662f | ||
|
|
8078445228 | ||
|
|
3af3c9b773 | ||
|
|
a95608398b | ||
|
|
d7799ff7e8 | ||
|
|
6c6e412974 | ||
|
|
b27cc5ddd4 |
No files matched your search
+28
-13
@@ -1,38 +1,53 @@
|
||||
[*]
|
||||
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
|
||||
trim_trailing_whitespace = 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
|
||||
[{*.patch,*.md}]
|
||||
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_layout_static_imports_separately = true
|
||||
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
|
||||
# javadoc
|
||||
ij_java_doc_add_blank_line_after_description = true
|
||||
ij_java_doc_add_blank_line_after_param_comments = false
|
||||
ij_java_doc_add_blank_line_after_return = false
|
||||
ij_java_doc_add_p_tag_on_empty_lines = true
|
||||
ij_java_doc_align_exception_comments = true
|
||||
ij_java_doc_align_param_comments = true
|
||||
ij_java_doc_do_not_wrap_if_one_line = false
|
||||
ij_java_doc_enable_formatting = true
|
||||
ij_java_doc_enable_leading_asterisks = true
|
||||
ij_java_doc_indent_on_continuation = true
|
||||
ij_java_doc_param_description_on_new_line = false
|
||||
ij_java_doc_use_throws_not_exception_tag = true
|
||||
|
||||
[paper-server/src/minecraft/java/**/*.java]
|
||||
ij_java_use_fq_class_names = true
|
||||
@@ -40,5 +55,5 @@ 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
|
||||
+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:
|
||||
|
||||
@@ -186,7 +186,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
|
||||
@@ -505,7 +504,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 +623,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 +724,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
|
||||
|
||||
+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-SNAPSHOT" apply false
|
||||
}
|
||||
|
||||
subprojects {
|
||||
|
||||
@@ -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.
File renamed without changes.
@@ -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();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,214 @@
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
|
||||
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||
<module name="Checker">
|
||||
<module name="SuppressionFilter">
|
||||
<property name="file" value="${config_loc}/suppressions.xml"/>
|
||||
<property name="optional" value="false"/>
|
||||
</module>
|
||||
|
||||
<!--Single Suppression Filters-->
|
||||
<module name="SuppressionSingleFilter">
|
||||
<!--Suppresses warnings except for common TYPE_USE that should be on same line-->
|
||||
<property name="checks" value="AnnotationOnSameLine"/>
|
||||
<property name="message" value="^Annotation '(?!(${type_use_annotations}))"/>
|
||||
</module>
|
||||
<module name="SuppressionSingleFilter">
|
||||
<property name="checks" value="Javadoc(Method|Type)"/>
|
||||
<!--[A-Z].* check is for java annotations inside code blocks inside javadocs-->
|
||||
<property name="message" value="^Unknown tag '(${custom_javadoc_tags}|[A-Z].*)'.$"/>
|
||||
</module>
|
||||
|
||||
<!--Javadoc Comments-->
|
||||
<module name="JavadocPackage"/>
|
||||
<!--Misc-->
|
||||
<module name="NewlineAtEndOfFile"/>
|
||||
<module name="OrderedProperties"/>
|
||||
<!--Whitespace-->
|
||||
<module name="FileTabCharacter"/>
|
||||
|
||||
<module name="TreeWalker">
|
||||
<module name="SuppressionXpathFilter">
|
||||
<property name="file" value="${config_loc}/xpath-suppressions.xml"/>
|
||||
<property name="optional" value="false"/>
|
||||
</module>
|
||||
|
||||
<!--Annotations-->
|
||||
<module name="AnnotationOnSameLine">
|
||||
<!--matches all annotations, but most are suppressed in above-->
|
||||
<property name="tokens" value="METHOD_DEF"/>
|
||||
</module>
|
||||
<module name="AnnotationUseStyle"/>
|
||||
<module name="MissingDeprecated"/>
|
||||
|
||||
<!--Block Checks-->
|
||||
<module name="AvoidNestedBlocks"/>
|
||||
<module name="EmptyBlock"/>
|
||||
<module name="LeftCurly"/>
|
||||
<module name="RightCurly"/>
|
||||
<module name="OneTopLevelClass"/>
|
||||
<module name="SealedShouldHavePermitsList"/>
|
||||
|
||||
<!--Class Design-->
|
||||
<module name="FinalClass"/>
|
||||
<module name="HideUtilityClassConstructor"/>
|
||||
<module name="InterfaceIsType"/>
|
||||
|
||||
<!--Coding-->
|
||||
<module name="ArrayTrailingComma"/>
|
||||
<module name="AvoidDoubleBraceInitialization"/>
|
||||
<module name="AvoidNoArgumentSuperConstructorCall"/>
|
||||
<module name="ConstructorsDeclarationGrouping"/>
|
||||
<module name="CovariantEquals"/>
|
||||
<module name="DeclarationOrder"/>
|
||||
<module name="DefaultComesLast"/>
|
||||
<module name="EmptyStatement"/>
|
||||
<module name="EqualsAvoidNull"/>
|
||||
<module name="EqualsHashCode"/>
|
||||
<module name="FallThrough"/>
|
||||
<!--<module name="FinalLocalVariable">
|
||||
<property name="validateEnhancedForLoopVariable" value="true"/>
|
||||
<property name="validateUnnamedVariables" value="true"/>
|
||||
<!–TODO atm, PARAMETER_DEF doesn't seem to function inside interfaces–>
|
||||
<!–https://github.com/checkstyle/checkstyle/issues/16081–>
|
||||
<property name="tokens" value="PARAMETER_DEF,VARIABLE_DEF"/>
|
||||
</module>-->
|
||||
<module name="IllegalToken"/> <!--just labels by default-->
|
||||
<module name="IllegalType"/>
|
||||
<module name="RequireThis">
|
||||
<property name="validateOnlyOverlapping" value="false"/>
|
||||
</module>
|
||||
<module name="SimplifyBooleanExpression"/>
|
||||
<module name="SimplifyBooleanReturn"/>
|
||||
<module name="StringLiteralEquality"/>
|
||||
<module name="UnnecessarySemicolonAfterOuterTypeDeclaration"/>
|
||||
<module name="UnnecessarySemicolonAfterTypeMemberDeclaration"/>
|
||||
<module name="UnnecessarySemicolonInEnumeration"/>
|
||||
<module name="UnnecessarySemicolonInTryWithResources"/>
|
||||
<module name="UnusedCatchParameterShouldBeUnnamed"/>
|
||||
<module name="UnusedLambdaParameterShouldBeUnnamed"/>
|
||||
<module name="UnusedLocalVariable"/>
|
||||
<module name="WhenShouldBeUsed"/>
|
||||
|
||||
<!--Headers--> <!--N/A-->
|
||||
|
||||
<!--Imports-->
|
||||
<module name="AvoidStarImport"/>
|
||||
<module name="CustomImportOrder">
|
||||
<property name="customImportOrderRules" value="THIRD_PARTY_PACKAGE,STATIC"/>
|
||||
<property name="standardPackageRegExp" value="^$"/>
|
||||
<property name="sortImportsInGroupAlphabetically" value="true"/>
|
||||
</module>
|
||||
<module name="IllegalImport">
|
||||
<property name="regexp" value="true"/>
|
||||
<!--checker-qual nullability-->
|
||||
<property name="illegalClasses" value="org\.checkerframework\.checker\.nullness\.qual\.(Nullable|NonNull|DefaultQualifier)"/>
|
||||
<!--jetbrains nullability-->
|
||||
<property name="illegalClasses" value="org\.jetbrains\.annotations\.(NotNull|Nullable|NotNullByDefault)"/>
|
||||
<!--javax nullability-->
|
||||
</module>
|
||||
<module name="IllegalImport">
|
||||
<property name="regexp" value="true"/>
|
||||
<!--attempts to guard against nested imports (by looking for capital letters in imports)-->
|
||||
<property name="illegalClasses" value="^[^\.A-Z]+(\.[^\.A-Z]+)+?(\.[A-Z][^\.]*)(\.[A-Z][^\.]*)+$"/>
|
||||
<message key="import.illegal" value="Illegal nested import - {0}"/>
|
||||
</module>
|
||||
<module name="RedundantImport"/>
|
||||
<module name="UnusedImports"/>
|
||||
|
||||
<!--Javadoc Comments-->
|
||||
<module name="AtclauseOrder">
|
||||
<property name="tagOrder" value="@param, @return, @throws, @see, @deprecated, @hidden"/>
|
||||
</module>
|
||||
<module name="InvalidJavadocPosition"/>
|
||||
<module name="JavadocBlockTagLocation"/>
|
||||
<module name="JavadocContentLocation"/>
|
||||
<module name="JavadocLeadingAsteriskAlign"/>
|
||||
<module name="JavadocMethod">
|
||||
<!--checks all, but doesn't require. If we have a doc, it should be valid-->
|
||||
<property name="validateThrows" value="true"/>
|
||||
</module>
|
||||
<module name="JavadocMissingLeadingAsterisk"/>
|
||||
<module name="JavadocMissingWhitespaceAfterAsterisk"/>
|
||||
<module name="JavadocStyle"/> <!--checks all, but doesn't require. If we have a doc, it should be valid-->
|
||||
<module name="JavadocTagContinuationIndentation"/>
|
||||
<module name="JavadocType"/> <!--checks all, but doesn't require. If we have a doc, it should be valid-->
|
||||
<module name="MissingJavadocMethod">
|
||||
<property name="allowedAnnotations" value="Override, ApiStatus.Internal"/>
|
||||
<property name="ignoreMethodNamesRegex" value="^getHandlerList$"/>
|
||||
</module>
|
||||
<module name="MissingJavadocPackage"/>
|
||||
<module name="MissingJavadocType">
|
||||
<property name="skipAnnotations" value="Generated, ApiStatus.Internal" />
|
||||
</module>
|
||||
<module name="NonEmptyAtclauseDescription"/>
|
||||
<module name="RequireEmptyLineBeforeBlockTagGroup"/>
|
||||
|
||||
<!--Metrics--> <!--N/A-->
|
||||
|
||||
<!--Miscellaneous-->
|
||||
<module name="ArrayTypeStyle"/>
|
||||
<module name="AvoidEscapedUnicodeCharacters"/>
|
||||
<module name="CommentsIndentation"/>
|
||||
<module name="FinalParameters"/>
|
||||
|
||||
<module name="NoCodeInFile"/>
|
||||
<module name="OuterTypeFilename"/>
|
||||
<module name="UpperEll"/>
|
||||
|
||||
<!--Modifiers-->
|
||||
<module name="ModifierOrder"/>
|
||||
<module name="RedundantModifier"/>
|
||||
|
||||
<!--Naming Conventions-->
|
||||
<module name="AbbreviationAsWordInName">
|
||||
<property name="allowedAbbreviations" value="JSON,UUID"/>
|
||||
<property name="ignoreFinal" value="false"/>
|
||||
</module>
|
||||
<module name="ClassTypeParameterName"/>
|
||||
<module name="ConstantName"/>
|
||||
<module name="IllegalIdentifierName"/>
|
||||
<module name="InterfaceTypeParameterName"/>
|
||||
<module name="LambdaParameterName"/>
|
||||
<module name="LocalFinalVariableName"/>
|
||||
<module name="LocalVariableName"/>
|
||||
<module name="MemberName"/>
|
||||
<module name="MethodName"/>
|
||||
<module name="MethodTypeParameterName"/>
|
||||
<module name="PackageName">
|
||||
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
|
||||
</module>
|
||||
<module name="ParameterName"/>
|
||||
<module name="PatternVariableName"/>
|
||||
<module name="RecordComponentName"/>
|
||||
<module name="RecordTypeParameterName"/>
|
||||
<module name="StaticVariableName"/>
|
||||
<module name="TypeName"/>
|
||||
|
||||
<!--Regexp--> <!--N/A-->
|
||||
<!--Size Violations--> <!--N/A-->
|
||||
|
||||
<!--Whitespace-->
|
||||
<module name="EmptyForInitializerPad"/>
|
||||
<module name="EmptyForIteratorPad"/>
|
||||
<module name="EmptyLineSeparator">
|
||||
<property name="allowNoEmptyLineBetweenFields" value="true"/>
|
||||
<property name="tokens" value="IMPORT,STATIC_IMPORT,CLASS_DEF,INTERFACE_DEF,ENUM_DEF,STATIC_INIT,INSTANCE_INIT,METHOD_DEF,CTOR_DEF,VARIABLE_DEF,RECORD_DEF,COMPACT_CTOR_DEF"/>
|
||||
</module>
|
||||
<module name="GenericWhitespace"/>
|
||||
<module name="MethodParamPad"/>
|
||||
<module name="NoLineWrap"/> <!--just imports and packages-->
|
||||
<module name="NoWhitespaceAfter"/>
|
||||
<module name="NoWhitespaceBefore"/>
|
||||
<module name="NoWhitespaceBeforeCaseDefaultColon"/>
|
||||
<module name="ParenPad"/>
|
||||
<module name="SingleSpaceSeparator"/>
|
||||
<module name="TypecastParenPad"/>
|
||||
<module name="WhitespaceAfter"/>
|
||||
<module name="WhitespaceAround"/>
|
||||
|
||||
<!--Custom-->
|
||||
<module name="JavadocAlignParameterDescription"/>
|
||||
<module name="NullabilityAnnotations"/>
|
||||
</module>
|
||||
</module>
|
||||
@@ -0,0 +1,182 @@
|
||||
paper-api-generator/generated/com/destroystokyo/paper/entity/ai/
|
||||
paper-api-generator/generated/io/papermc/paper/registry/keys/
|
||||
paper-api-generator/generated/io/papermc/paper/registry/keys/tags/
|
||||
paper-api/src/main/java/co/aikar/timings/
|
||||
paper-api/src/main/java/co/aikar/util/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/block/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/brigadier/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/entity/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/entity/ai/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/entity/villager/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/event/block/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/event/brigadier/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/event/entity/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/event/inventory/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/event/player/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/event/profile/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/event/server/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/exception/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/inventory/meta/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/loottable/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/network/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/profile/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/util/
|
||||
paper-api/src/main/java/com/destroystokyo/paper/utils/
|
||||
paper-api/src/main/java/io/papermc/paper/advancement/
|
||||
paper-api/src/main/java/io/papermc/paper/annotation/
|
||||
paper-api/src/main/java/io/papermc/paper/ban/
|
||||
paper-api/src/main/java/io/papermc/paper/block/
|
||||
paper-api/src/main/java/io/papermc/paper/block/fluid/
|
||||
paper-api/src/main/java/io/papermc/paper/block/fluid/type/
|
||||
paper-api/src/main/java/io/papermc/paper/brigadier/
|
||||
paper-api/src/main/java/io/papermc/paper/chat/
|
||||
paper-api/src/main/java/io/papermc/paper/command/
|
||||
paper-api/src/main/java/io/papermc/paper/command/brigadier/
|
||||
paper-api/src/main/java/io/papermc/paper/command/brigadier/argument/
|
||||
paper-api/src/main/java/io/papermc/paper/command/brigadier/argument/predicate/
|
||||
paper-api/src/main/java/io/papermc/paper/command/brigadier/argument/range/
|
||||
paper-api/src/main/java/io/papermc/paper/command/brigadier/argument/resolvers/
|
||||
paper-api/src/main/java/io/papermc/paper/command/brigadier/argument/resolvers/selector/
|
||||
paper-api/src/main/java/io/papermc/paper/datacomponent/
|
||||
paper-api/src/main/java/io/papermc/paper/datacomponent/item/
|
||||
paper-api/src/main/java/io/papermc/paper/datacomponent/item/consumable/
|
||||
paper-api/src/main/java/io/papermc/paper/datapack/
|
||||
paper-api/src/main/java/io/papermc/paper/enchantments/
|
||||
paper-api/src/main/java/io/papermc/paper/entity/
|
||||
paper-api/src/main/java/io/papermc/paper/event/block/
|
||||
paper-api/src/main/java/io/papermc/paper/event/entity/
|
||||
paper-api/src/main/java/io/papermc/paper/event/executor/
|
||||
paper-api/src/main/java/io/papermc/paper/event/packet/
|
||||
paper-api/src/main/java/io/papermc/paper/event/player/
|
||||
paper-api/src/main/java/io/papermc/paper/event/server/
|
||||
paper-api/src/main/java/io/papermc/paper/event/world/
|
||||
paper-api/src/main/java/io/papermc/paper/event/world/border/
|
||||
paper-api/src/main/java/io/papermc/paper/generated/
|
||||
paper-api/src/main/java/io/papermc/paper/inventory/
|
||||
paper-api/src/main/java/io/papermc/paper/inventory/tooltip/
|
||||
paper-api/src/main/java/io/papermc/paper/item/
|
||||
paper-api/src/main/java/io/papermc/paper/math/
|
||||
paper-api/src/main/java/io/papermc/paper/persistence/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/bootstrap/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/configuration/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/lifecycle/event/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/loader/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/loader/library/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/loader/library/impl/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/provider/classloader/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/provider/entrypoint/
|
||||
paper-api/src/main/java/io/papermc/paper/plugin/provider/util/
|
||||
paper-api/src/main/java/io/papermc/paper/potion/
|
||||
paper-api/src/main/java/io/papermc/paper/registry/
|
||||
paper-api/src/main/java/io/papermc/paper/registry/data/
|
||||
paper-api/src/main/java/io/papermc/paper/registry/event/
|
||||
paper-api/src/main/java/io/papermc/paper/registry/event/type/
|
||||
paper-api/src/main/java/io/papermc/paper/registry/set/
|
||||
paper-api/src/main/java/io/papermc/paper/registry/tag/
|
||||
paper-api/src/main/java/io/papermc/paper/scoreboard/numbers/
|
||||
paper-api/src/main/java/io/papermc/paper/tag/
|
||||
paper-api/src/main/java/io/papermc/paper/text/
|
||||
paper-api/src/main/java/io/papermc/paper/threadedregions/scheduler/
|
||||
paper-api/src/main/java/io/papermc/paper/util/
|
||||
paper-api/src/main/java/io/papermc/paper/world/
|
||||
paper-api/src/main/java/io/papermc/paper/world/flag/
|
||||
paper-api/src/main/java/org/bukkit/
|
||||
paper-api/src/main/java/org/bukkit/advancement/
|
||||
paper-api/src/main/java/org/bukkit/attribute/
|
||||
paper-api/src/main/java/org/bukkit/ban/
|
||||
paper-api/src/main/java/org/bukkit/block/
|
||||
paper-api/src/main/java/org/bukkit/block/banner/
|
||||
paper-api/src/main/java/org/bukkit/block/data/
|
||||
paper-api/src/main/java/org/bukkit/block/data/type/
|
||||
paper-api/src/main/java/org/bukkit/block/sign/
|
||||
paper-api/src/main/java/org/bukkit/block/spawner/
|
||||
paper-api/src/main/java/org/bukkit/block/structure/
|
||||
paper-api/src/main/java/org/bukkit/boss/
|
||||
paper-api/src/main/java/org/bukkit/command/
|
||||
paper-api/src/main/java/org/bukkit/command/defaults/
|
||||
paper-api/src/main/java/org/bukkit/configuration/
|
||||
paper-api/src/main/java/org/bukkit/configuration/file/
|
||||
paper-api/src/main/java/org/bukkit/configuration/serialization/
|
||||
paper-api/src/main/java/org/bukkit/conversations/
|
||||
paper-api/src/main/java/org/bukkit/damage/
|
||||
paper-api/src/main/java/org/bukkit/enchantments/
|
||||
paper-api/src/main/java/org/bukkit/entity/
|
||||
paper-api/src/main/java/org/bukkit/entity/boat/
|
||||
paper-api/src/main/java/org/bukkit/entity/memory/
|
||||
paper-api/src/main/java/org/bukkit/entity/minecart/
|
||||
paper-api/src/main/java/org/bukkit/event/
|
||||
paper-api/src/main/java/org/bukkit/event/block/
|
||||
paper-api/src/main/java/org/bukkit/event/command/
|
||||
paper-api/src/main/java/org/bukkit/event/enchantment/
|
||||
paper-api/src/main/java/org/bukkit/event/entity/
|
||||
paper-api/src/main/java/org/bukkit/event/hanging/
|
||||
paper-api/src/main/java/org/bukkit/event/inventory/
|
||||
paper-api/src/main/java/org/bukkit/event/player/
|
||||
paper-api/src/main/java/org/bukkit/event/raid/
|
||||
paper-api/src/main/java/org/bukkit/event/server/
|
||||
paper-api/src/main/java/org/bukkit/event/vehicle/
|
||||
paper-api/src/main/java/org/bukkit/event/weather/
|
||||
paper-api/src/main/java/org/bukkit/event/world/
|
||||
paper-api/src/main/java/org/bukkit/generator/
|
||||
paper-api/src/main/java/org/bukkit/generator/structure/
|
||||
paper-api/src/main/java/org/bukkit/help/
|
||||
paper-api/src/main/java/org/bukkit/inventory/
|
||||
paper-api/src/main/java/org/bukkit/inventory/meta/
|
||||
paper-api/src/main/java/org/bukkit/inventory/meta/components/
|
||||
paper-api/src/main/java/org/bukkit/inventory/meta/tags/
|
||||
paper-api/src/main/java/org/bukkit/inventory/meta/trim/
|
||||
paper-api/src/main/java/org/bukkit/inventory/recipe/
|
||||
paper-api/src/main/java/org/bukkit/inventory/view/
|
||||
paper-api/src/main/java/org/bukkit/loot/
|
||||
paper-api/src/main/java/org/bukkit/map/
|
||||
paper-api/src/main/java/org/bukkit/material/
|
||||
paper-api/src/main/java/org/bukkit/material/types/
|
||||
paper-api/src/main/java/org/bukkit/metadata/
|
||||
paper-api/src/main/java/org/bukkit/packs/
|
||||
paper-api/src/main/java/org/bukkit/permissions/
|
||||
paper-api/src/main/java/org/bukkit/persistence/
|
||||
paper-api/src/main/java/org/bukkit/plugin/
|
||||
paper-api/src/main/java/org/bukkit/plugin/java/
|
||||
paper-api/src/main/java/org/bukkit/plugin/messaging/
|
||||
paper-api/src/main/java/org/bukkit/potion/
|
||||
paper-api/src/main/java/org/bukkit/profile/
|
||||
paper-api/src/main/java/org/bukkit/projectiles/
|
||||
paper-api/src/main/java/org/bukkit/scheduler/
|
||||
paper-api/src/main/java/org/bukkit/scoreboard/
|
||||
paper-api/src/main/java/org/bukkit/spawner/
|
||||
paper-api/src/main/java/org/bukkit/structure/
|
||||
paper-api/src/main/java/org/bukkit/tag/
|
||||
paper-api/src/main/java/org/bukkit/util/
|
||||
paper-api/src/main/java/org/bukkit/util/io/
|
||||
paper-api/src/main/java/org/bukkit/util/noise/
|
||||
paper-api/src/main/java/org/bukkit/util/permissions/
|
||||
paper-api/src/main/java/org/spigotmc/
|
||||
paper-api/src/main/java/org/spigotmc/event/player/
|
||||
paper-api/src/test/java/com/destroystokyo/paper/
|
||||
paper-api/src/test/java/io/papermc/paper/
|
||||
paper-api/src/test/java/io/papermc/paper/adventure/
|
||||
paper-api/src/test/java/io/papermc/paper/registry/
|
||||
paper-api/src/test/java/io/papermc/paper/testing/
|
||||
paper-api/src/test/java/io/papermc/paper/util/
|
||||
paper-api/src/test/java/org/bukkit/
|
||||
paper-api/src/test/java/org/bukkit/configuration/
|
||||
paper-api/src/test/java/org/bukkit/configuration/file/
|
||||
paper-api/src/test/java/org/bukkit/conversations/
|
||||
paper-api/src/test/java/org/bukkit/entity/memory/
|
||||
paper-api/src/test/java/org/bukkit/event/
|
||||
paper-api/src/test/java/org/bukkit/materials/
|
||||
paper-api/src/test/java/org/bukkit/metadata/
|
||||
paper-api/src/test/java/org/bukkit/plugin/
|
||||
paper-api/src/test/java/org/bukkit/plugin/messaging/
|
||||
paper-api/src/test/java/org/bukkit/scoreboard/
|
||||
paper-api/src/test/java/org/bukkit/support/
|
||||
paper-api/src/test/java/org/bukkit/support/provider/
|
||||
paper-api/src/test/java/org/bukkit/support/test/
|
||||
paper-api/src/test/java/org/bukkit/util/
|
||||
paper-api/src/test/java/org/bukkit/util/io/
|
||||
@@ -0,0 +1,6 @@
|
||||
<!DOCTYPE suppressions PUBLIC
|
||||
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
|
||||
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
|
||||
<suppressions>
|
||||
<suppress checks="MissingJavadoc.*" files="src[\\/]test[\\/]java[^\\/]*[\\/].*"/>
|
||||
</suppressions>
|
||||
@@ -0,0 +1,9 @@
|
||||
NonNull
|
||||
NotNull
|
||||
Nullable
|
||||
UnknownNullability
|
||||
Unmodifiable
|
||||
UnmodifiableView
|
||||
Range
|
||||
Positive
|
||||
NonNegative
|
||||
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE suppressions PUBLIC
|
||||
"-//Checkstyle//DTD SuppressionXpathFilter Experimental Configuration 1.2//EN"
|
||||
"https://checkstyle.org/dtds/suppressions_1_2_xpath_experimental.dtd">
|
||||
<suppressions>
|
||||
<!--ignores all checks for @Deprecated(forRemoval=*) children-->
|
||||
<suppress-xpath checks=".*" query="//*[MODIFIERS/ANNOTATION[(@text = 'Deprecated' or *[@text = 'Deprecated'] and ANNOTATION_MEMBER_VALUE_PAIR/IDENT[@text='forRemoval'])]]/descendant-or-self::node()"/>
|
||||
<!--special case to ignore extra checks outside the root CLASS_DEF if the root CLASS_DEF is marked as deprecated for removal-->
|
||||
<suppress-xpath checks=".*" query="/COMPILATION_UNIT[CLASS_DEF/MODIFIERS/ANNOTATION[IDENT[@text = 'Deprecated'] and ANNOTATION_MEMBER_VALUE_PAIR/IDENT[@text='forRemoval']]]/descendant-or-self::node()"/>
|
||||
<!--ignores MissingJavadoc for ApiStatus.Internal children-->
|
||||
<suppress-xpath checks="MissingJavadoc(Method|Type)" query="//*[MODIFIERS/ANNOTATION/DOT[@text = 'Internal' or *[@text = 'Internal']]]/descendant-or-self::node()"/>
|
||||
|
||||
<!--skip for private classes-->
|
||||
<suppress-xpath checks="FinalClass" query="//CLASS_DEF[MODIFIERS/LITERAL_PRIVATE]"/>
|
||||
|
||||
<!--skip for classes inside of methods-->
|
||||
<suppress-xpath checks="HideUtilityClassConstructor|MissingJavadoc(Method|Type)" query="//CLASS_DEF[ancestor::METHOD_DEF]"/>
|
||||
</suppressions>
|
||||
@@ -1,7 +1,12 @@
|
||||
import io.papermc.paperweight.checkstyle.JavadocTag
|
||||
import io.papermc.paperweight.checkstyle.PaperCheckstyleTask
|
||||
import io.papermc.paperweight.checkstyle.setCustomJavadocTags
|
||||
|
||||
plugins {
|
||||
`java-library`
|
||||
`maven-publish`
|
||||
idea
|
||||
id("io.papermc.paperweight.paper-checkstyle")
|
||||
}
|
||||
|
||||
java {
|
||||
@@ -9,6 +14,22 @@ java {
|
||||
withJavadocJar()
|
||||
}
|
||||
|
||||
val customJavadocTags = setOf(
|
||||
JavadocTag("apiNote", "a", "API Note:"),
|
||||
)
|
||||
|
||||
paperCheckstyle {
|
||||
val packagesToSkipSource = providers.fileContents(projectLocalCheckstyleConfig.file("packages.txt")).asText.map { it.trim().split("\n").toSet() }
|
||||
val typeUseAnnotationsProvider = providers.fileContents(projectLocalCheckstyleConfig.file("type-use-annotations.txt")).asText.map { it.trim().split("\n").toSet() }
|
||||
|
||||
directoriesToSkip.set(packagesToSkipSource)
|
||||
typeUseAnnotations.set(typeUseAnnotationsProvider)
|
||||
}
|
||||
|
||||
tasks.withType<PaperCheckstyleTask> {
|
||||
setCustomJavadocTags(customJavadocTags)
|
||||
}
|
||||
|
||||
val annotationsVersion = "26.0.1"
|
||||
val bungeeCordChatVersion = "1.20-R0.2"
|
||||
val adventureVersion = "4.18.0"
|
||||
@@ -39,6 +60,7 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
checkstyle(project(":paper-api:custom-checkstyle"))
|
||||
|
||||
// api dependencies are listed transitively to API consumers
|
||||
api("com.google.guava:guava:33.3.1-jre")
|
||||
@@ -93,7 +115,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())
|
||||
@@ -190,7 +212,7 @@ tasks.withType<Javadoc> {
|
||||
"https://javadoc.io/doc/org.apache.logging.log4j/log4j-api/$log4jVersion/",
|
||||
"https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/1.7.3",
|
||||
)
|
||||
options.tags("apiNote:a:API Note:")
|
||||
options.tags(customJavadocTags.map { it.toOptionString() })
|
||||
|
||||
inputs.files(apiAndDocs).ignoreEmptyDirectories().withPropertyName(apiAndDocs.name + "-configuration")
|
||||
val apiAndDocsElements = apiAndDocs.elements
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
plugins {
|
||||
java
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("com.puppycrawl.tools:checkstyle:10.21.1")
|
||||
implementation("org.jspecify:jspecify:1.0.0")
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package io.papermc.checkstyle;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.api.DetailAST;
|
||||
import com.puppycrawl.tools.checkstyle.api.DetailNode;
|
||||
import com.puppycrawl.tools.checkstyle.utils.JavadocUtil;
|
||||
import com.puppycrawl.tools.checkstyle.utils.TokenUtil;
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Utility class containing utility methods for custom checkstyle checks.
|
||||
*/
|
||||
public final class Util {
|
||||
|
||||
private Util() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the previous sibling of the given node with the given type.
|
||||
*
|
||||
* @param node the node
|
||||
* @param type the type
|
||||
* @return the previous sibling with the given type, or {@code null} if not found
|
||||
*/
|
||||
public static @Nullable DetailNode getPreviousSibling(final DetailNode node, final int type) {
|
||||
DetailNode sibling = JavadocUtil.getPreviousSibling(node);
|
||||
while (sibling != null && sibling.getType() != type) {
|
||||
sibling = JavadocUtil.getPreviousSibling(sibling);
|
||||
}
|
||||
return sibling;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the next sibling of the given node with the given type.
|
||||
*
|
||||
* @param node the node
|
||||
* @param type the type
|
||||
* @return the next sibling with the given type, or {@code null} if not found
|
||||
*/
|
||||
public static @Nullable DetailAST getNextSibling(final DetailAST node, final int type) {
|
||||
DetailAST sibling = node.getNextSibling();
|
||||
while (sibling != null && sibling.getType() != type) {
|
||||
sibling = sibling.getNextSibling();
|
||||
}
|
||||
return sibling;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the enclosing type declaration of the given node.
|
||||
*
|
||||
* @param node the node
|
||||
* @return the enclosing type declaration, or {@code null} if not found
|
||||
*/
|
||||
public static @Nullable DetailAST getEnclosingTypeDeclaration(final DetailAST node) {
|
||||
DetailAST parent = node.getParent();
|
||||
while (parent != null && !TokenUtil.isTypeDeclaration(parent.getType())) {
|
||||
parent = parent.getParent();
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an iterator over the children of the given node with the given type.
|
||||
*
|
||||
* @param ast the node
|
||||
* @param type the type
|
||||
* @return the iterator
|
||||
*/
|
||||
public static Iterable<DetailAST> childrenIterator(final DetailAST ast, final int type) {
|
||||
return () -> new Iterator<>() {
|
||||
private @Nullable DetailAST current = TokenUtil.findFirstTokenByPredicate(ast, child -> child.getType() == type).orElse(null);
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return this.current != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DetailAST next() {
|
||||
if (this.current == null) {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
final DetailAST result = this.current;
|
||||
this.current = getNextSibling(this.current, type);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package io.papermc.checkstyle.checks;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.api.DetailNode;
|
||||
import com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes;
|
||||
import com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck;
|
||||
import com.puppycrawl.tools.checkstyle.utils.JavadocUtil;
|
||||
import io.papermc.checkstyle.Util;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Checks that parameter descriptions in Javadoc are aligned.
|
||||
*/
|
||||
public final class JavadocAlignParameterDescriptionCheck extends AbstractJavadocCheck {
|
||||
|
||||
@Override
|
||||
public int[] getDefaultJavadocTokens() {
|
||||
return new int[]{JavadocTokenTypes.JAVADOC};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitJavadocToken(final DetailNode detailNode) {
|
||||
final List<DetailNode> params = new ArrayList<>();
|
||||
int maxColumn = -1;
|
||||
for (final DetailNode child : detailNode.getChildren()) {
|
||||
final DetailNode paramLiteralNode = JavadocUtil.findFirstToken(child, JavadocTokenTypes.PARAM_LITERAL);
|
||||
if (child.getType() != JavadocTokenTypes.JAVADOC_TAG || paramLiteralNode == null) {
|
||||
continue;
|
||||
}
|
||||
final DetailNode paramDescription = JavadocUtil.getNextSibling(paramLiteralNode, JavadocTokenTypes.DESCRIPTION);
|
||||
maxColumn = Math.max(maxColumn, paramDescription.getColumnNumber());
|
||||
params.add(paramDescription);
|
||||
}
|
||||
|
||||
for (final DetailNode param : params) {
|
||||
if (param.getColumnNumber() != maxColumn) {
|
||||
final DetailNode paramNameNode = Util.getPreviousSibling(param, JavadocTokenTypes.PARAMETER_NAME);
|
||||
if (paramNameNode == null) {
|
||||
continue;
|
||||
}
|
||||
this.log(
|
||||
param.getLineNumber(),
|
||||
param.getColumnNumber() - 1,
|
||||
"Param description for %s should start at column %d".formatted(paramNameNode.getText(), maxColumn)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+154
@@ -0,0 +1,154 @@
|
||||
package io.papermc.checkstyle.checks;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.JavaParser;
|
||||
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
|
||||
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
|
||||
import com.puppycrawl.tools.checkstyle.api.DetailAST;
|
||||
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
|
||||
import io.papermc.checkstyle.Util;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Checks that nullability annotations are present where required.
|
||||
*/
|
||||
public final class NullabilityAnnotationsCheck extends AbstractCheck {
|
||||
|
||||
@Override
|
||||
public int[] getDefaultTokens() {
|
||||
return this.getRequiredTokens();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAcceptableTokens() {
|
||||
return this.getRequiredTokens();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getRequiredTokens() {
|
||||
return new int[]{
|
||||
TokenTypes.METHOD_DEF,
|
||||
TokenTypes.PARAMETER_DEF,
|
||||
TokenTypes.ANNOTATION_FIELD_DEF,
|
||||
TokenTypes.RECORD_COMPONENT_DEF, // annotations are in ANNOTATIONS token block
|
||||
};
|
||||
}
|
||||
|
||||
private static final Set<String> NULLABILITY_ANNOTATIONS = Set.of("Nullable", "NonNull");
|
||||
|
||||
// for checking for annotations on nested types like "OuterType.@Nullable InnerType"
|
||||
private static boolean typeHasNullabilityAnnotation(final @Nullable DetailAST type) {
|
||||
final DetailAST dot;
|
||||
if (type == null || (dot = type.findFirstToken(TokenTypes.DOT)) == null) {
|
||||
return false;
|
||||
}
|
||||
return hasNullabilityAnnotationChild(dot.findFirstToken(TokenTypes.ANNOTATIONS));
|
||||
}
|
||||
|
||||
private static boolean hasNullabilityAnnotationChild(final @Nullable DetailAST ast) {
|
||||
if (ast == null) {
|
||||
return false;
|
||||
}
|
||||
for (final DetailAST annotation : Util.childrenIterator(ast, TokenTypes.ANNOTATION)) {
|
||||
if (annotation.getChildCount(TokenTypes.IDENT) != 1) {
|
||||
// skip `.` annotations like ApiStatus.Internal as these aren't nullability annotations
|
||||
continue;
|
||||
}
|
||||
final String ident = annotation.findFirstToken(TokenTypes.IDENT).getText();
|
||||
if (NULLABILITY_ANNOTATIONS.contains(ident)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean hasNullabilityAnnotation(final DetailAST inputAst) {
|
||||
if (inputAst.getType() == TokenTypes.RECORD_COMPONENT_DEF && hasNullabilityAnnotationChild(inputAst.findFirstToken(TokenTypes.ANNOTATIONS))) {
|
||||
return true;
|
||||
} else if (inputAst.getType() != TokenTypes.RECORD_COMPONENT_DEF && hasNullabilityAnnotationChild(inputAst.findFirstToken(TokenTypes.MODIFIERS))) {
|
||||
return true;
|
||||
} else {
|
||||
return typeHasNullabilityAnnotation(inputAst.findFirstToken(TokenTypes.TYPE));
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isNullMarkedAnnotation(final DetailAST annotation) {
|
||||
if (annotation.getChildCount(TokenTypes.IDENT) != 1) {
|
||||
return false;
|
||||
}
|
||||
final String ident = annotation.findFirstToken(TokenTypes.IDENT).getText();
|
||||
return "NullMarked".equals(ident);
|
||||
}
|
||||
|
||||
private static boolean isTypeDeclarationNullMarked(final DetailAST typeDeclaration) {
|
||||
final DetailAST modifiers = typeDeclaration.findFirstToken(TokenTypes.MODIFIERS);
|
||||
if (modifiers == null) {
|
||||
return false;
|
||||
}
|
||||
for (final DetailAST annotation : Util.childrenIterator(modifiers, TokenTypes.ANNOTATION)) {
|
||||
if (isNullMarkedAnnotation(annotation)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isPackageInfoNullMarked() {
|
||||
final Path currentPath = Path.of(this.getFilePath());
|
||||
final Path packageInfo = currentPath.getParent().resolve("package-info.java");
|
||||
if (Files.notExists(packageInfo)) {
|
||||
return false;
|
||||
}
|
||||
final DetailAST packageInfoAst;
|
||||
try {
|
||||
packageInfoAst = JavaParser.parseFile(packageInfo.toFile(), JavaParser.Options.WITHOUT_COMMENTS);
|
||||
} catch (final IOException | CheckstyleException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
final DetailAST firstToken = packageInfoAst.findFirstToken(TokenTypes.PACKAGE_DEF);
|
||||
if (firstToken == null) {
|
||||
return false;
|
||||
}
|
||||
final DetailAST annotations = firstToken.findFirstToken(TokenTypes.ANNOTATIONS);
|
||||
for (final DetailAST annotation : Util.childrenIterator(annotations, TokenTypes.ANNOTATION)) {
|
||||
if (isNullMarkedAnnotation(annotation)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitToken(final DetailAST ast) {
|
||||
if (hasNullabilityAnnotation(ast)) {
|
||||
return;
|
||||
}
|
||||
for (DetailAST parentDef = Util.getEnclosingTypeDeclaration(ast); parentDef != null; parentDef = Util.getEnclosingTypeDeclaration(parentDef)) {
|
||||
if (isTypeDeclarationNullMarked(parentDef)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (this.isPackageInfoNullMarked()) {
|
||||
return;
|
||||
}
|
||||
this.recordViolation(ast);
|
||||
}
|
||||
|
||||
private static DetailAST getTypeAstForViolation(final DetailAST inputAst) {
|
||||
final DetailAST typeToken = inputAst.findFirstToken(TokenTypes.TYPE);
|
||||
final DetailAST dot;
|
||||
if (typeToken != null && (dot = typeToken.findFirstToken(TokenTypes.DOT)) != null) {
|
||||
return Objects.requireNonNullElse(dot.getLastChild(), inputAst);
|
||||
}
|
||||
return Objects.requireNonNullElse(typeToken, inputAst);
|
||||
}
|
||||
|
||||
private void recordViolation(final DetailAST ast) {
|
||||
final DetailAST typeAst = getTypeAstForViolation(ast);
|
||||
this.log(typeAst.getLineNo(), typeAst.getColumnNo() - 1, "Missing nullability annotation");
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Custom checkstyle checks for PaperMC projects.
|
||||
*/
|
||||
@NullMarked
|
||||
@SuppressWarnings("unused")
|
||||
package io.papermc.checkstyle.checks;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* This package contains custom checkstyle rules for PaperMC projects.
|
||||
*/
|
||||
@NullMarked
|
||||
package io.papermc.checkstyle;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!DOCTYPE checkstyle-packages PUBLIC
|
||||
"-//Checkstyle//DTD Package Names Configuration 1.0//EN"
|
||||
"https://checkstyle.org/dtds/packages_1_0.dtd">
|
||||
|
||||
<checkstyle-packages>
|
||||
<package name="io.papermc.checkstyle.checks"/>
|
||||
</checkstyle-packages>
|
||||
-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
|
||||
|
||||
@@ -3,7 +3,6 @@ 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.
|
||||
@@ -12,7 +11,6 @@ import org.jspecify.annotations.NullMarked;
|
||||
* cause issues when called under unexpected circumstances.
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
@NullMarked
|
||||
public interface InternalAPIBridge {
|
||||
|
||||
/**
|
||||
@@ -36,4 +34,3 @@ public interface InternalAPIBridge {
|
||||
*/
|
||||
DamageEffect getDamageEffect(String key);
|
||||
}
|
||||
|
||||
@@ -6,12 +6,10 @@ import java.util.OptionalInt;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.util.Services;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Information about the current server build.
|
||||
*/
|
||||
@NullMarked
|
||||
@ApiStatus.NonExtendable
|
||||
public interface ServerBuildInfo {
|
||||
/**
|
||||
@@ -30,6 +28,7 @@ public interface ServerBuildInfo {
|
||||
static final Optional<ServerBuildInfo> INSTANCE = Services.service(ServerBuildInfo.class);
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
return Holder.INSTANCE.orElseThrow();
|
||||
}
|
||||
|
||||
@@ -47,7 +46,7 @@ public interface ServerBuildInfo {
|
||||
* @return {@code true} if the server supports the specified brand
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
boolean isBrandCompatible(final Key brandId);
|
||||
boolean isBrandCompatible(Key brandId);
|
||||
|
||||
/**
|
||||
* Gets the brand name of the server.
|
||||
@@ -104,7 +103,7 @@ public interface ServerBuildInfo {
|
||||
* @param representation the type of representation
|
||||
* @return a string
|
||||
*/
|
||||
String asString(final StringRepresentation representation);
|
||||
String asString(StringRepresentation representation);
|
||||
|
||||
/**
|
||||
* String representation types.
|
||||
|
||||
-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();
|
||||
|
||||
|
||||
@@ -19,13 +19,11 @@ import org.jspecify.annotations.Nullable;
|
||||
* 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:
|
||||
* <p>An example of a plugin loading a datapack from within it's own jar is below</p>
|
||||
* <pre>{@code
|
||||
* public class YourPluginBootstrap implements PluginBootstrap {
|
||||
* @Override
|
||||
* public void bootstrap(BootstrapContext context) {
|
||||
* public void bootstrap(BoostrapContext context) {
|
||||
* final LifecycleEventManager<BootstrapContext> manager = context.getLifecycleManager();
|
||||
* manager.registerEventHandler(LifecycleEvents.DATAPACK_DISCOVERY, event -> {
|
||||
* DatapackRegistrar registrar = event.registrar();
|
||||
@@ -41,7 +39,6 @@ import org.jspecify.annotations.Nullable;
|
||||
* }
|
||||
* }
|
||||
* }</pre>
|
||||
*
|
||||
* @see io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents#DATAPACK_DISCOVERY
|
||||
*/
|
||||
@ApiStatus.NonExtendable
|
||||
|
||||
@@ -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,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 {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Root package for the Paper API.
|
||||
*/
|
||||
@NullMarked
|
||||
package io.papermc.paper;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
-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));
|
||||
}
|
||||
}
|
||||
@@ -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,13 +2,12 @@ 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;
|
||||
@@ -19,8 +18,8 @@ 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 {
|
||||
|
||||
@@ -88,7 +87,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 +189,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 +200,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;
|
||||
@@ -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);
|
||||
}
|
||||
@@ -1930,10 +1925,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 +1936,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 +1944,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.
|
||||
@@ -2980,19 +2961,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();
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,9 @@
|
||||
package org.bukkit;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import io.papermc.paper.datacomponent.DataComponentTypes;
|
||||
import org.bukkit.entity.Allay;
|
||||
import org.bukkit.entity.Animals;
|
||||
import org.bukkit.entity.Armadillo;
|
||||
import org.bukkit.entity.Ageable;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Cat;
|
||||
import org.bukkit.entity.Creaking;
|
||||
import org.bukkit.entity.Dolphin;
|
||||
import org.bukkit.entity.Egg;
|
||||
import org.bukkit.entity.Entity;
|
||||
@@ -20,8 +15,6 @@ import org.bukkit.entity.Guardian;
|
||||
import org.bukkit.entity.Hoglin;
|
||||
import org.bukkit.entity.IronGolem;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Mob;
|
||||
import org.bukkit.entity.Ocelot;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Rabbit;
|
||||
import org.bukkit.entity.Ravager;
|
||||
@@ -30,6 +23,7 @@ import org.bukkit.entity.Sniffer;
|
||||
import org.bukkit.entity.Snowball;
|
||||
import org.bukkit.entity.Squid;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.entity.TippedArrow;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.bukkit.entity.Warden;
|
||||
import org.bukkit.entity.Witch;
|
||||
@@ -38,34 +32,32 @@ import org.bukkit.entity.Zoglin;
|
||||
import org.bukkit.entity.ZombieVillager;
|
||||
import org.bukkit.entity.minecart.ExplosiveMinecart;
|
||||
import org.bukkit.entity.minecart.SpawnerMinecart;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A list of all effects that can happen to entities.
|
||||
* A list of all Effects that can happen to entities.
|
||||
*/
|
||||
public enum EntityEffect {
|
||||
|
||||
/**
|
||||
* Colored particles from an arrow.
|
||||
* Colored particles from a tipped arrow.
|
||||
*/
|
||||
ARROW_PARTICLES(0, Arrow.class),
|
||||
ARROW_PARTICLES(0, TippedArrow.class),
|
||||
/**
|
||||
* Rabbit jumping.
|
||||
*/
|
||||
RABBIT_JUMP(1, Rabbit.class),
|
||||
/**
|
||||
* Resets a spawner minecart's delay to 200. Does not affect actual spawning
|
||||
* delay, only the speed at which the entity in the spawner spins.
|
||||
* Resets a spawner minecart's delay to 200. Does not effect actual spawning
|
||||
* delay, only the speed at which the entity in the spawner spins
|
||||
*/
|
||||
RESET_SPAWNER_MINECART_DELAY(1, SpawnerMinecart.class),
|
||||
/**
|
||||
* When mobs get hurt.
|
||||
*
|
||||
* @deprecated use {@link LivingEntity#playHurtAnimation(float)}
|
||||
* @deprecated Use {@link LivingEntity#playHurtAnimation(float)}
|
||||
*/
|
||||
@Deprecated(since = "1.20.1", forRemoval = true)
|
||||
@Deprecated(since = "1.20.1")
|
||||
HURT(2, LivingEntity.class),
|
||||
/**
|
||||
* When a mob dies.
|
||||
@@ -73,97 +65,58 @@ public enum EntityEffect {
|
||||
* <b>This will cause client-glitches!</b>
|
||||
*
|
||||
* @deprecated split into individual effects
|
||||
* @see #PROJECTILE_CRACK
|
||||
* @see #EGG_BREAK
|
||||
* @see #SNOWBALL_BREAK
|
||||
* @see #ENTITY_DEATH
|
||||
*/
|
||||
@Deprecated(since = "1.12.2", forRemoval = true)
|
||||
@Deprecated(since = "1.12.2")
|
||||
DEATH(3, Entity.class),
|
||||
/**
|
||||
* Spawns the egg breaking particles.
|
||||
*
|
||||
* @deprecated use {@link #PROJECTILE_CRACK}
|
||||
* Spawns the egg breaking particles
|
||||
*/
|
||||
@Deprecated(since = "1.21.4", forRemoval = true)
|
||||
EGG_BREAK(3, Egg.class),
|
||||
/**
|
||||
* Spawns the snowball breaking particles.
|
||||
*
|
||||
* @deprecated use {@link #PROJECTILE_CRACK}
|
||||
* Spawns the snowball breaking particles
|
||||
*/
|
||||
@Deprecated(since = "1.21.4", forRemoval = true)
|
||||
SNOWBALL_BREAK(3, Snowball.class),
|
||||
/**
|
||||
* Shows the crack particles when a projectile
|
||||
* hits something.
|
||||
*/
|
||||
PROJECTILE_CRACK(3, Egg.class, Snowball.class),
|
||||
/**
|
||||
* Plays the entity death sound and animation.
|
||||
* Plays the entity death sound and animation
|
||||
* <p>
|
||||
* <b>This will cause client-glitches!</b>
|
||||
*/
|
||||
ENTITY_DEATH(3, LivingEntity.class),
|
||||
/**
|
||||
* Plays the evoker's fang attack animation.
|
||||
*
|
||||
* @deprecated use {@link #ENTITY_ATTACK}
|
||||
* Plays the fang attack animation
|
||||
*/
|
||||
@Deprecated(since = "1.21.4", forRemoval = true)
|
||||
FANG_ATTACK(4, EvokerFangs.class),
|
||||
/**
|
||||
* Plays the hoglin attack animation.
|
||||
*
|
||||
* @deprecated use {@link #ENTITY_ATTACK}
|
||||
* Plays the hoglin attack animation
|
||||
*/
|
||||
@Deprecated(since = "1.21.4", forRemoval = true)
|
||||
HOGLIN_ATTACK(4, Hoglin.class),
|
||||
/**
|
||||
* Plays the iron golem attack animation.
|
||||
*
|
||||
* @deprecated use {@link #ENTITY_ATTACK}
|
||||
* Plays the iron golem attack animation
|
||||
*/
|
||||
@Deprecated(since = "1.21.4", forRemoval = true)
|
||||
IRON_GOLEN_ATTACK(4, IronGolem.class),
|
||||
/**
|
||||
* Plays the ravager attack animation.
|
||||
*
|
||||
* @deprecated use {@link #ENTITY_ATTACK}
|
||||
* Plays the ravager attack animation
|
||||
*/
|
||||
@Deprecated(since = "1.21.4", forRemoval = true)
|
||||
RAVAGER_ATTACK(4, Ravager.class),
|
||||
/**
|
||||
* Plays the warden attack animation.
|
||||
*
|
||||
* @deprecated use {@link #ENTITY_ATTACK}
|
||||
* Plays the warden attack animation
|
||||
*/
|
||||
@Deprecated(since = "1.21.4", forRemoval = true)
|
||||
WARDEN_ATTACK(4, Warden.class),
|
||||
/**
|
||||
* Plays the zoglin attack animation.
|
||||
*
|
||||
* @deprecated use {@link #ENTITY_ATTACK}
|
||||
* Plays the zoglin attack animation
|
||||
*/
|
||||
@Deprecated(since = "1.21.4", forRemoval = true)
|
||||
ZOGLIN_ATTACK(4, Zoglin.class),
|
||||
/**
|
||||
* Plays an attack animation for the respective entities.
|
||||
*/
|
||||
ENTITY_ATTACK(4, EvokerFangs.class, Hoglin.class, IronGolem.class, Ravager.class, Warden.class, Zoglin.class, Creaking.class),
|
||||
// 5 - unused
|
||||
/**
|
||||
* The smoke when taming an entity fails.
|
||||
*
|
||||
* @deprecated use {@link EntityEffect#TAMING_FAILED}
|
||||
*/
|
||||
@Deprecated(since = "1.21", forRemoval = true)
|
||||
@Deprecated(since = "1.21") // Paper
|
||||
WOLF_SMOKE(6, Tameable.class),
|
||||
/**
|
||||
* The hearts when taming an entity succeeds.
|
||||
*
|
||||
* @deprecated use {@link EntityEffect#TAMING_SUCCEEDED}
|
||||
*/
|
||||
@Deprecated(since = "1.21", forRemoval = true)
|
||||
WOLF_HEARTS(7, Tameable.class),
|
||||
// Paper start - rename "wolf" effects
|
||||
/**
|
||||
* The smoke when taming an entity fails.
|
||||
*/
|
||||
@@ -172,13 +125,20 @@ public enum EntityEffect {
|
||||
* The hearts when taming an entity succeeds.
|
||||
*/
|
||||
TAMING_SUCCEEDED(7, Tameable.class),
|
||||
// Paper end - rename "wolf" effects
|
||||
/**
|
||||
* The hearts when taming an entity succeeds.
|
||||
* @deprecated use {@link EntityEffect#TAMING_SUCCEEDED}
|
||||
*/
|
||||
@Deprecated(since = "1.21") // Paper
|
||||
WOLF_HEARTS(7, Tameable.class),
|
||||
/**
|
||||
* When a wolf shakes (after being wet).
|
||||
*
|
||||
* @see EntityEffect#WOLF_SHAKE_STOP
|
||||
*/
|
||||
WOLF_SHAKE(8, Wolf.class),
|
||||
// 9 - internal
|
||||
// 9 - unused
|
||||
/**
|
||||
* When an entity eats a LONG_GRASS block.
|
||||
*
|
||||
@@ -186,10 +146,10 @@ public enum EntityEffect {
|
||||
* @see #SHEEP_EAT_GRASS
|
||||
* @see #TNT_MINECART_IGNITE
|
||||
*/
|
||||
@Deprecated(since = "1.12.2", forRemoval = true)
|
||||
@Deprecated(since = "1.12.2")
|
||||
SHEEP_EAT(10, Entity.class),
|
||||
/**
|
||||
* Plays the sheep eating grass animation.
|
||||
* Plays the sheep eating grass animation
|
||||
*/
|
||||
SHEEP_EAT_GRASS(10, Sheep.class),
|
||||
/**
|
||||
@@ -219,8 +179,7 @@ public enum EntityEffect {
|
||||
*/
|
||||
WITCH_MAGIC(15, Witch.class),
|
||||
/**
|
||||
* Plays the sound when a zombie villager is
|
||||
* cured.
|
||||
* When a zombie transforms into a villager by shaking violently.
|
||||
*/
|
||||
ZOMBIE_TRANSFORM(16, ZombieVillager.class),
|
||||
/**
|
||||
@@ -228,10 +187,9 @@ public enum EntityEffect {
|
||||
*/
|
||||
FIREWORK_EXPLODE(17, Firework.class),
|
||||
/**
|
||||
* Hearts from a breeding entity
|
||||
* or when an Allay duplicates.
|
||||
* Hearts from a breeding entity.
|
||||
*/
|
||||
LOVE_HEARTS(18, Animals.class, Allay.class),
|
||||
LOVE_HEARTS(18, Ageable.class),
|
||||
/**
|
||||
* Resets squid rotation.
|
||||
*/
|
||||
@@ -239,7 +197,7 @@ public enum EntityEffect {
|
||||
/**
|
||||
* Silverfish entering block, spawner spawning.
|
||||
*/
|
||||
ENTITY_POOF(20, Mob.class),
|
||||
ENTITY_POOF(20, LivingEntity.class),
|
||||
/**
|
||||
* Guardian plays the attack sound effect.
|
||||
*/
|
||||
@@ -260,10 +218,9 @@ public enum EntityEffect {
|
||||
ARMOR_STAND_HIT(32, ArmorStand.class),
|
||||
/**
|
||||
* Entity hurt by thorns attack.
|
||||
*
|
||||
* @deprecated in favor of {@link LivingEntity#playHurtAnimation(float)} or {@link Entity#broadcastHurtAnimation(java.util.Collection)}
|
||||
*/
|
||||
@Deprecated(since = "1.19.4", forRemoval = true)
|
||||
@Deprecated(since = "1.19.4", forRemoval = true) // Paper
|
||||
THORNS_HURT(33, LivingEntity.class),
|
||||
/**
|
||||
* Iron golem puts away rose.
|
||||
@@ -271,27 +228,16 @@ public enum EntityEffect {
|
||||
IRON_GOLEM_SHEATH(34, IronGolem.class),
|
||||
/**
|
||||
* Totem prevents entity death.
|
||||
*
|
||||
* @deprecated see {@link #PROTECTED_FROM_DEATH}
|
||||
*/
|
||||
@Deprecated(since = "1.21.2", forRemoval = true)
|
||||
TOTEM_RESURRECT(35, LivingEntity.class),
|
||||
/**
|
||||
* Item with {@link DataComponentTypes#DEATH_PROTECTION} prevents entity death.
|
||||
* For player, the item selected will be shown for a moment on the screen, if the
|
||||
* item is not found a totem will appear.
|
||||
*/
|
||||
PROTECTED_FROM_DEATH(35, Entity.class),
|
||||
/**
|
||||
* Entity hurt due to drowning damage.
|
||||
*
|
||||
* @deprecated in favor of {@link LivingEntity#playHurtAnimation(float)} or {@link Entity#broadcastHurtAnimation(java.util.Collection)}
|
||||
*/
|
||||
@Deprecated(since = "1.19.4", forRemoval = true)
|
||||
HURT_DROWN(36, LivingEntity.class),
|
||||
/**
|
||||
* Entity hurt due to explosion damage.
|
||||
*
|
||||
* @deprecated in favor of {@link LivingEntity#playHurtAnimation(float)} or {@link Entity#broadcastHurtAnimation(java.util.Collection)}
|
||||
*/
|
||||
@Deprecated(since = "1.19.4", forRemoval = true)
|
||||
@@ -306,94 +252,66 @@ public enum EntityEffect {
|
||||
RAVAGER_STUNNED(39, Ravager.class),
|
||||
/**
|
||||
* Cat taming failed.
|
||||
*
|
||||
* @deprecated use {@link #TRUSTING_FAILED}
|
||||
*/
|
||||
@Deprecated(since = "1.14", forRemoval = true)
|
||||
CAT_TAME_FAIL(40, Cat.class),
|
||||
/**
|
||||
* Cat taming succeeded.
|
||||
*
|
||||
* @deprecated use {@link #TRUSTING_SUCCEEDED}
|
||||
*/
|
||||
@Deprecated(since = "1.14", forRemoval = true)
|
||||
CAT_TAME_SUCCESS(41, Cat.class),
|
||||
/**
|
||||
* Ocelot trusting failed.
|
||||
*/
|
||||
TRUSTING_FAILED(40, Ocelot.class),
|
||||
/**
|
||||
* Ocelot trusting succeeded.
|
||||
*/
|
||||
TRUSTING_SUCCEEDED(41, Ocelot.class),
|
||||
/**
|
||||
* Villager splashes particles during a raid.
|
||||
*/
|
||||
VILLAGER_SPLASH(42, Villager.class),
|
||||
/**
|
||||
* Player's bad omen effect removed to start or increase raid difficult.
|
||||
*
|
||||
* @deprecated raid system was overhauled in 1.20.5
|
||||
*/
|
||||
@Deprecated(since = "1.20.5", forRemoval = true)
|
||||
PLAYER_BAD_OMEN_RAID(43, Player.class),
|
||||
/**
|
||||
* Entity hurt due to berry bush. Prickly!
|
||||
*
|
||||
* @deprecated in favor of {@link LivingEntity#playHurtAnimation(float)} or {@link Entity#broadcastHurtAnimation(java.util.Collection)}
|
||||
*/
|
||||
@Deprecated(since = "1.19.4", forRemoval = true)
|
||||
HURT_BERRY_BUSH(44, LivingEntity.class),
|
||||
/**
|
||||
* Fox chews the food in its mouth.
|
||||
* Fox chews the food in its mouth
|
||||
*/
|
||||
FOX_CHEW(45, Fox.class),
|
||||
/**
|
||||
* Entity teleported as a result of chorus fruit or as an enderman.
|
||||
* Entity teleported as a result of chorus fruit or as an enderman
|
||||
*/
|
||||
TELEPORT_ENDER(46, LivingEntity.class),
|
||||
/**
|
||||
* Entity breaks item in main hand.
|
||||
*
|
||||
* @see org.bukkit.inventory.EquipmentSlot#HAND
|
||||
* Entity breaks item in main hand
|
||||
*/
|
||||
BREAK_EQUIPMENT_MAIN_HAND(47, LivingEntity.class),
|
||||
/**
|
||||
* Entity breaks item in off hand.
|
||||
*
|
||||
* @see org.bukkit.inventory.EquipmentSlot#OFF_HAND
|
||||
* Entity breaks item in off hand
|
||||
*/
|
||||
BREAK_EQUIPMENT_OFF_HAND(48, LivingEntity.class),
|
||||
/**
|
||||
* Entity breaks item in helmet slot.
|
||||
*
|
||||
* @see org.bukkit.inventory.EquipmentSlot#HEAD
|
||||
* Entity breaks item in helmet slot
|
||||
*/
|
||||
BREAK_EQUIPMENT_HELMET(49, LivingEntity.class),
|
||||
/**
|
||||
* Entity breaks item in chestplate slot.
|
||||
*
|
||||
* @see org.bukkit.inventory.EquipmentSlot#CHEST
|
||||
* Entity breaks item in chestplate slot
|
||||
*/
|
||||
BREAK_EQUIPMENT_CHESTPLATE(50, LivingEntity.class),
|
||||
/**
|
||||
* Entity breaks item in legging slot.
|
||||
*
|
||||
* @see org.bukkit.inventory.EquipmentSlot#LEGS
|
||||
* Entity breaks item in legging slot
|
||||
*/
|
||||
BREAK_EQUIPMENT_LEGGINGS(51, LivingEntity.class),
|
||||
/**
|
||||
* Entity breaks item in boot slot.
|
||||
*
|
||||
* @see org.bukkit.inventory.EquipmentSlot#FEET
|
||||
* Entity breaks item in boot slot
|
||||
*/
|
||||
BREAK_EQUIPMENT_BOOTS(52, LivingEntity.class),
|
||||
/**
|
||||
* Spawns honey block slide particles at the entity's feet.
|
||||
* Spawns honey block slide particles at the entity's feet
|
||||
*/
|
||||
HONEY_BLOCK_SLIDE_PARTICLES(53, Entity.class),
|
||||
/**
|
||||
* Spawns honey block fall particles at the entity's feet.
|
||||
* Spawns honey block fall particles at the entity's feet
|
||||
*/
|
||||
HONEY_BLOCK_FALL_PARTICLES(54, LivingEntity.class),
|
||||
/**
|
||||
@@ -401,136 +319,110 @@ public enum EntityEffect {
|
||||
*/
|
||||
SWAP_HAND_ITEMS(55, LivingEntity.class),
|
||||
/**
|
||||
* Stops a wolf that is currently shaking.
|
||||
* Stops a wolf that is currently shaking
|
||||
*
|
||||
* @see EntityEffect#WOLF_SHAKE
|
||||
*/
|
||||
WOLF_SHAKE_STOP(56, Wolf.class),
|
||||
// 57 - unused
|
||||
/**
|
||||
* Goat lowers its head for ramming.
|
||||
* Goat lowers its head for ramming
|
||||
*
|
||||
* @see #GOAT_RAISE_HEAD
|
||||
*/
|
||||
GOAT_LOWER_HEAD(58, Goat.class),
|
||||
/**
|
||||
* Goat raises its head.
|
||||
* Goat raises its head
|
||||
*
|
||||
* @see #GOAT_LOWER_HEAD
|
||||
*/
|
||||
GOAT_RAISE_HEAD(59, Goat.class),
|
||||
/**
|
||||
* Spawns death smoke particles.
|
||||
* Spawns death smoke particles
|
||||
*/
|
||||
SPAWN_DEATH_SMOKE(60, LivingEntity.class),
|
||||
/**
|
||||
* Warden shakes its tendrils.
|
||||
* Warden shakes its tendrils
|
||||
*/
|
||||
WARDEN_TENDRIL_SHAKE(61, Warden.class),
|
||||
/**
|
||||
* Warden performs sonic attack animation.
|
||||
* <br>
|
||||
* Does not play the sound or fire the beam.
|
||||
* Warden performs sonic attack animation <br>
|
||||
* Does not play the sound or fire the beam
|
||||
*/
|
||||
WARDEN_SONIC_ATTACK(62, Warden.class),
|
||||
/**
|
||||
* Plays sniffer digging sound.
|
||||
* <br>
|
||||
* Plays sniffer digging sound <br>
|
||||
* Sniffer must have a target and be in {@link Sniffer.State#SEARCHING} or
|
||||
* {@link Sniffer.State#DIGGING}.
|
||||
* {@link Sniffer.State#DIGGING}
|
||||
*/
|
||||
SNIFFER_DIG(63, Sniffer.class),
|
||||
// Paper start - add missing EntityEffect
|
||||
/**
|
||||
* Armadillo peeks out of its shell
|
||||
*/
|
||||
ARMADILLO_PEEK(64, Armadillo.class),
|
||||
ARMADILLO_PEEK(64, org.bukkit.entity.Armadillo.class),
|
||||
/**
|
||||
* {@link org.bukkit.inventory.EquipmentSlot#BODY} armor piece breaks.
|
||||
*
|
||||
* @deprecated use {@link #BREAK_EQUIPMENT_BODY}
|
||||
* {@link org.bukkit.inventory.EquipmentSlot#BODY} armor piece breaks
|
||||
*/
|
||||
@Deprecated(since = "1.21.4", forRemoval = true)
|
||||
BODY_BREAK(65, LivingEntity.class),
|
||||
/**
|
||||
* Entity breaks item in body slot.
|
||||
*
|
||||
* @see org.bukkit.inventory.EquipmentSlot#BODY
|
||||
*/
|
||||
BREAK_EQUIPMENT_BODY(65, LivingEntity.class),
|
||||
/**
|
||||
* A creaking transient shaking when being hit.
|
||||
* Does not apply to plain creaking entities as they are not invulnerable like the transient ones spawned by the
|
||||
* creaking heart.
|
||||
*/
|
||||
SHAKE(66, Creaking.class);
|
||||
SHAKE(66, org.bukkit.entity.Creaking.class);
|
||||
// Paper end - add missing EntityEffect
|
||||
|
||||
private final byte data;
|
||||
private final Set<Class<? extends Entity>> applicableClasses;
|
||||
private final Class<? extends Entity> applicable;
|
||||
|
||||
EntityEffect(int data, Class<? extends Entity>... applicableClasses) {
|
||||
Preconditions.checkState(applicableClasses.length > 0, "Unknown applicable classes");
|
||||
EntityEffect(final int data, /*@NotNull*/ Class<? extends Entity> clazz) {
|
||||
this.data = (byte) data;
|
||||
this.applicableClasses = Set.of(applicableClasses);
|
||||
this.applicable = clazz;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the data value of this entity effect, may not be unique.
|
||||
* Gets the data value of this EntityEffect, may not be unique.
|
||||
*
|
||||
* @return the data value
|
||||
* @return The data value
|
||||
* @apiNote Internal Use Only
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
@org.jetbrains.annotations.ApiStatus.Internal // Paper
|
||||
public byte getData() {
|
||||
return this.data;
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets entity superclass which this entity effect is applicable to.
|
||||
* Gets entity superclass which this affect is applicable to.
|
||||
*
|
||||
* @return applicable class
|
||||
* @deprecated an entity effect can apply to multiple superclasses, see {@link #getApplicableClasses()}
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated(since = "1.21.4")
|
||||
public Class<? extends Entity> getApplicable() {
|
||||
return this.applicableClasses.iterator().next();
|
||||
return applicable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entity superclasses which this entity effect is applicable to.
|
||||
*
|
||||
* @return the applicable classes
|
||||
*/
|
||||
@NotNull
|
||||
public Set<Class<? extends Entity>> getApplicableClasses() {
|
||||
return this.applicableClasses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this entity effect is applicable to the given entity.
|
||||
* Checks if this effect is applicable to the given entity.
|
||||
*
|
||||
* @param entity the entity to check
|
||||
* @return {@code true} if applicable
|
||||
* @return true if applicable
|
||||
*/
|
||||
public boolean isApplicableTo(@NotNull Entity entity) {
|
||||
Preconditions.checkArgument(entity != null, "Entity cannot be null");
|
||||
|
||||
return this.isApplicableTo(entity.getClass());
|
||||
return isApplicableTo(entity.getClass());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this entity effect is applicable to the given entity class.
|
||||
* Checks if this effect is applicable to the given entity class.
|
||||
*
|
||||
* @param clazz the entity class to check
|
||||
* @return {@code true} if applicable
|
||||
* @return true if applicable
|
||||
*/
|
||||
public boolean isApplicableTo(@NotNull Class<? extends Entity> clazz) {
|
||||
Preconditions.checkArgument(clazz != null, "Class cannot be null");
|
||||
|
||||
for (Class<? extends Entity> applicableClass : this.applicableClasses) {
|
||||
if (applicableClass.isAssignableFrom(clazz)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return applicable.isAssignableFrom(clazz);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package org.bukkit;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.util.OldEnum;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -46,7 +45,7 @@ public interface Fluid extends OldEnum<Fluid>, 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 Fluid valueOf(@NotNull String name) {
|
||||
Fluid fluid = Bukkit.getUnsafe().get(RegistryKey.FLUID, NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
|
||||
Fluid fluid = Bukkit.getUnsafe().get(Registry.FLUID, NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
|
||||
Preconditions.checkArgument(fluid != null, "No fluid found with the name %s", name);
|
||||
return fluid;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package org.bukkit;
|
||||
|
||||
import io.papermc.paper.registry.RegistryAccess;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -33,7 +31,7 @@ public interface JukeboxSong extends Keyed, Translatable {
|
||||
|
||||
@NotNull
|
||||
private static JukeboxSong get(@NotNull String key) {
|
||||
return RegistryAccess.registryAccess().getRegistry(RegistryKey.JUKEBOX_SONG).getOrThrow(NamespacedKey.minecraft(key));
|
||||
return Registry.JUKEBOX_SONG.getOrThrow(NamespacedKey.minecraft(key));
|
||||
}
|
||||
|
||||
// Paper start - adventure
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
import io.papermc.paper.math.FinePosition;
|
||||
import io.papermc.paper.math.Rotation;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||
import org.bukkit.entity.Entity;
|
||||
@@ -412,19 +411,6 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds rotation to this location. Not world-aware.
|
||||
*
|
||||
* @param rotation the rotation to add.
|
||||
* @return the same location
|
||||
* @see Vector
|
||||
*/
|
||||
@NotNull
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
public Location addRotation(@NotNull Rotation rotation) {
|
||||
return addRotation(rotation.yaw(), rotation.pitch());
|
||||
}
|
||||
|
||||
/**
|
||||
* Subtracts the location by another.
|
||||
*
|
||||
@@ -494,19 +480,6 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Subtracts rotation from this location.
|
||||
*
|
||||
* @param rotation the rotation to subtract.
|
||||
* @return the same location
|
||||
* @see Vector
|
||||
*/
|
||||
@NotNull
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
public Location subtractRotation(@NotNull Rotation rotation) {
|
||||
return subtractRotation(rotation.yaw(), rotation.pitch());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the magnitude of the location, defined as sqrt(x^2+y^2+z^2). The
|
||||
* value of this method is not cached and uses a costly square-root
|
||||
@@ -649,20 +622,6 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the rotation of this location and returns itself.
|
||||
* <p>
|
||||
* This mutates this object, clone first.
|
||||
*
|
||||
* @param rotation the new rotation.
|
||||
* @return self (not cloned)
|
||||
*/
|
||||
@NotNull
|
||||
@Contract(value = "_ -> this", mutates = "this")
|
||||
public Location setRotation(@NotNull Rotation rotation) {
|
||||
return setRotation(rotation.yaw(), rotation.pitch());
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes the x/y/z from base and adds the specified x/y/z to it and returns self
|
||||
* <p>
|
||||
|
||||
@@ -5706,9 +5706,8 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
|
||||
*
|
||||
* @param world the world to check
|
||||
* @return true if this material can be used in this World.
|
||||
* @deprecated use {@link io.papermc.paper.world.flag.FeatureFlagSetHolder#isEnabled(io.papermc.paper.world.flag.FeatureDependant)}
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "1.20")
|
||||
@Deprecated(forRemoval = true, since = "1.20") // Paper
|
||||
public boolean isEnabledByFeature(@NotNull World world) {
|
||||
if (isItem()) {
|
||||
return Bukkit.getDataPackManager().isEnabledByFeature(asItemType(), world);
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package org.bukkit;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import io.papermc.paper.registry.RegistryAccess;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -46,7 +44,7 @@ public abstract class MusicInstrument implements Keyed, net.kyori.adventure.tran
|
||||
|
||||
@NotNull
|
||||
private static MusicInstrument getInstrument(@NotNull String key) {
|
||||
return RegistryAccess.registryAccess().getRegistry(RegistryKey.INSTRUMENT).getOrThrow(NamespacedKey.minecraft(key));
|
||||
return Registry.INSTRUMENT.getOrThrow(NamespacedKey.minecraft(key));
|
||||
}
|
||||
|
||||
// Paper start - deprecate getKey
|
||||
|
||||
@@ -83,12 +83,14 @@ public final class NamespacedKey implements net.kyori.adventure.key.Key, com.des
|
||||
* @see #NamespacedKey(Plugin, String)
|
||||
*/
|
||||
public NamespacedKey(@NotNull String namespace, @NotNull String key) {
|
||||
Preconditions.checkArgument(namespace != null, "Namespace cannot be null");
|
||||
Preconditions.checkArgument(key != null, "Key cannot be null");
|
||||
Preconditions.checkArgument(namespace != null && isValidNamespace(namespace), "Invalid namespace. Must be [a-z0-9._-]: %s", namespace);
|
||||
Preconditions.checkArgument(key != null && isValidKey(key), "Invalid key. Must be [a-z0-9/._-]: %s", key);
|
||||
|
||||
this.namespace = namespace;
|
||||
this.key = key;
|
||||
|
||||
this.validate();
|
||||
String string = toString();
|
||||
Preconditions.checkArgument(string.length() <= Short.MAX_VALUE, "NamespacedKey must be less than 32768 characters", string); // Paper - Fix improper length validation
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,17 +108,16 @@ public final class NamespacedKey implements net.kyori.adventure.key.Key, com.des
|
||||
public NamespacedKey(@NotNull Plugin plugin, @NotNull String key) {
|
||||
Preconditions.checkArgument(plugin != null, "Plugin cannot be null");
|
||||
Preconditions.checkArgument(key != null, "Key cannot be null");
|
||||
|
||||
this.namespace = plugin.getName().toLowerCase(Locale.ROOT);
|
||||
this.key = key.toLowerCase(Locale.ROOT);
|
||||
|
||||
// Check validity after normalization
|
||||
this.validate();
|
||||
}
|
||||
|
||||
private void validate() {
|
||||
Preconditions.checkArgument(this.namespace.length() + 1 + this.key.length() <= Short.MAX_VALUE, "NamespacedKey must be less than 32768 characters");
|
||||
Preconditions.checkArgument(isValidNamespace(this.namespace), "Invalid namespace. Must be [a-z0-9._-]: %s", this.namespace);
|
||||
Preconditions.checkArgument(isValidKey(this.key), "Invalid key. Must be [a-z0-9/._-]: %s", this.key);
|
||||
|
||||
String string = toString();
|
||||
Preconditions.checkArgument(string.length() <= Short.MAX_VALUE, "NamespacedKey must be less than 32768 characters", string); // Paper - Fix improper length validation
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -11,15 +11,14 @@ import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.ServerOperator;
|
||||
import org.bukkit.profile.PlayerProfile;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents a reference to a player identity and the data belonging to a
|
||||
* player that is stored on the disk and can, thus, be retrieved without the
|
||||
* player needing to be online.
|
||||
*/
|
||||
@NullMarked
|
||||
public interface OfflinePlayer extends ServerOperator, AnimalTamer, ConfigurationSerializable, io.papermc.paper.persistence.PersistentDataViewHolder { // Paper - Add Offline PDC API
|
||||
|
||||
/**
|
||||
@@ -63,6 +62,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @return Player UUID
|
||||
*/
|
||||
@Override
|
||||
@NotNull
|
||||
public UUID getUniqueId();
|
||||
|
||||
/**
|
||||
@@ -74,6 +74,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
*
|
||||
* @return the player's profile
|
||||
*/
|
||||
@NotNull
|
||||
com.destroystokyo.paper.profile.PlayerProfile getPlayerProfile(); // Paper
|
||||
|
||||
/**
|
||||
@@ -90,6 +91,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @return Ban Entry
|
||||
* @deprecated use {@link #ban(String, Date, String)}
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated(since = "1.20.4")
|
||||
public default BanEntry banPlayer(@Nullable String reason) {
|
||||
return banPlayer(reason, null, null);
|
||||
@@ -102,6 +104,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @return Ban Entry
|
||||
* @deprecated use {@link #ban(String, Date, String)}
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated(since = "1.20.4")
|
||||
public default BanEntry banPlayer(@Nullable String reason, @Nullable String source) {
|
||||
return banPlayer(reason, null, source);
|
||||
@@ -114,8 +117,9 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @return Ban Entry
|
||||
* @deprecated use {@link #ban(String, Date, String)}
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated(since = "1.20.4")
|
||||
public default BanEntry banPlayer(@Nullable String reason, java.util.@Nullable Date expires) {
|
||||
public default BanEntry banPlayer(@Nullable String reason, @Nullable java.util.Date expires) {
|
||||
return banPlayer(reason, expires, null);
|
||||
}
|
||||
|
||||
@@ -127,16 +131,18 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @return Ban Entry
|
||||
* @deprecated use {@link #ban(String, Date, String)}
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated(since = "1.20.4")
|
||||
public default BanEntry banPlayer(@Nullable String reason, java.util.@Nullable Date expires, @Nullable String source) {
|
||||
public default BanEntry banPlayer(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source) {
|
||||
return banPlayer(reason, expires, source, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #ban(String, Date, String)}
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated(since = "1.20.4")
|
||||
public default BanEntry banPlayer(@Nullable String reason, java.util.@Nullable Date expires, @Nullable String source, boolean kickIfOnline) {
|
||||
public default BanEntry banPlayer(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source, boolean kickIfOnline) {
|
||||
BanEntry banEntry = Bukkit.getServer().getBanList(BanList.Type.NAME).addBan(getName(), reason, expires, source);
|
||||
if (kickIfOnline && isOnline()) {
|
||||
getPlayer().kickPlayer(reason);
|
||||
@@ -303,7 +309,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the statistic requires an
|
||||
* additional parameter
|
||||
*/
|
||||
public void incrementStatistic(Statistic statistic) throws IllegalArgumentException;
|
||||
public void incrementStatistic(@NotNull Statistic statistic) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Decrements the given statistic for this player.
|
||||
@@ -316,7 +322,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the statistic requires an
|
||||
* additional parameter
|
||||
*/
|
||||
public void decrementStatistic(Statistic statistic) throws IllegalArgumentException;
|
||||
public void decrementStatistic(@NotNull Statistic statistic) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Increments the given statistic for this player.
|
||||
@@ -328,7 +334,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the statistic requires an
|
||||
* additional parameter
|
||||
*/
|
||||
public void incrementStatistic(Statistic statistic, int amount) throws IllegalArgumentException;
|
||||
public void incrementStatistic(@NotNull Statistic statistic, int amount) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Decrements the given statistic for this player.
|
||||
@@ -340,7 +346,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the statistic requires an
|
||||
* additional parameter
|
||||
*/
|
||||
public void decrementStatistic(Statistic statistic, int amount) throws IllegalArgumentException;
|
||||
public void decrementStatistic(@NotNull Statistic statistic, int amount) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Sets the given statistic for this player.
|
||||
@@ -352,7 +358,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the statistic requires an
|
||||
* additional parameter
|
||||
*/
|
||||
public void setStatistic(Statistic statistic, int newValue) throws IllegalArgumentException;
|
||||
public void setStatistic(@NotNull Statistic statistic, int newValue) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Gets the value of the given statistic for this player.
|
||||
@@ -363,7 +369,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the statistic requires an
|
||||
* additional parameter
|
||||
*/
|
||||
public int getStatistic(Statistic statistic) throws IllegalArgumentException;
|
||||
public int getStatistic(@NotNull Statistic statistic) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Increments the given statistic for this player for the given material.
|
||||
@@ -378,7 +384,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public void incrementStatistic(Statistic statistic, Material material) throws IllegalArgumentException;
|
||||
public void incrementStatistic(@NotNull Statistic statistic, @NotNull Material material) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Decrements the given statistic for this player for the given material.
|
||||
@@ -393,7 +399,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public void decrementStatistic(Statistic statistic, Material material) throws IllegalArgumentException;
|
||||
public void decrementStatistic(@NotNull Statistic statistic, @NotNull Material material) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Gets the value of the given statistic for this player.
|
||||
@@ -406,7 +412,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public int getStatistic(Statistic statistic, Material material) throws IllegalArgumentException;
|
||||
public int getStatistic(@NotNull Statistic statistic, @NotNull Material material) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Increments the given statistic for this player for the given material.
|
||||
@@ -420,7 +426,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public void incrementStatistic(Statistic statistic, Material material, int amount) throws IllegalArgumentException;
|
||||
public void incrementStatistic(@NotNull Statistic statistic, @NotNull Material material, int amount) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Decrements the given statistic for this player for the given material.
|
||||
@@ -434,7 +440,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public void decrementStatistic(Statistic statistic, Material material, int amount) throws IllegalArgumentException;
|
||||
public void decrementStatistic(@NotNull Statistic statistic, @NotNull Material material, int amount) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Sets the given statistic for this player for the given material.
|
||||
@@ -448,7 +454,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public void setStatistic(Statistic statistic, Material material, int newValue) throws IllegalArgumentException;
|
||||
public void setStatistic(@NotNull Statistic statistic, @NotNull Material material, int newValue) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Increments the given statistic for this player for the given entity.
|
||||
@@ -463,7 +469,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public void incrementStatistic(Statistic statistic, EntityType entityType) throws IllegalArgumentException;
|
||||
public void incrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Decrements the given statistic for this player for the given entity.
|
||||
@@ -478,7 +484,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public void decrementStatistic(Statistic statistic, EntityType entityType) throws IllegalArgumentException;
|
||||
public void decrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Gets the value of the given statistic for this player.
|
||||
@@ -491,7 +497,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public int getStatistic(Statistic statistic, EntityType entityType) throws IllegalArgumentException;
|
||||
public int getStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Increments the given statistic for this player for the given entity.
|
||||
@@ -505,7 +511,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public void incrementStatistic(Statistic statistic, EntityType entityType, int amount) throws IllegalArgumentException;
|
||||
public void incrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int amount) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Decrements the given statistic for this player for the given entity.
|
||||
@@ -519,7 +525,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public void decrementStatistic(Statistic statistic, EntityType entityType, int amount);
|
||||
public void decrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int amount);
|
||||
|
||||
/**
|
||||
* Sets the given statistic for this player for the given entity.
|
||||
@@ -533,7 +539,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @throws IllegalArgumentException if the given parameter is not valid
|
||||
* for the statistic
|
||||
*/
|
||||
public void setStatistic(Statistic statistic, EntityType entityType, int newValue);
|
||||
public void setStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int newValue);
|
||||
|
||||
/**
|
||||
* Gets the player's last death location.
|
||||
@@ -565,6 +571,6 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @see io.papermc.paper.persistence.PersistentDataViewHolder#getPersistentDataContainer()
|
||||
*/
|
||||
@Override
|
||||
io.papermc.paper.persistence.PersistentDataContainerView getPersistentDataContainer();
|
||||
io.papermc.paper.persistence.@NotNull PersistentDataContainerView getPersistentDataContainer();
|
||||
// Paper end - add pdc to offline player
|
||||
}
|
||||
Loaded 100 of 421 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user