Compare commits

...
35 Commits
Author SHA1 Message Date
Jason Penilla 73116ac9dd Update publishing endpoint 2025-09-24 23:56:30 -07:00
Jake Potrebic eddc7b48f3 Update to configurate 4.2.0 (#12869) 2025-09-24 23:48:02 -07:00
Jason Penilla 6abf5f0b74 Avoid and discourage use of Maven Central as a CDN (#12692)
* Default LibraryLoader to Google's Maven Central mirror, add MavenLibraryResolver.MAVEN_CENTRAL_DEFAULT_MIRROR, and warn on use of Maven Central with MavenLibraryResolver

* Account for both Maven Central URLs

* Update Javadoc

(cherry picked from commit 62b7f86dae)
2025-06-23 22:34:01 -07:00
Spottedleaf 12d8fe0beb Fix infinite loop in RegionFile IO
If an exception is thrown during decompress then the read process
would be started again, which of course would eventually throw in
the decompress process.
2025-06-09 02:57:21 -07:00
Shane Freeder 09e9afd295 Avoid off-main mutations of state 2025-05-19 18:44:47 +01:00
Bjarne Koll af71568bb3 Update mache 2025-05-11 22:29:09 +02:00
Nassim Jahnke e2ca477396 Remove simplify remote item matching option for now 2025-05-09 14:57:15 +02:00
OwenandWarrior c2bb144fd5 Properly save level data async (#12530)
Previously we added a parameter allowing for level data to be saved asynchronously which was then overriden by a vanilla parameter which does the opposite.

This reverts back to the previous behavior that we were doing before.

Co-authored-by: Warrior <50800980+Warriorrrr@users.noreply.github.com>
2025-05-08 00:06:40 +01:00
David 76753219c4 Allow Server#getDefaultGameMode before worlds are initialized (#12491)
Backport-Of: d1810f241c
2025-04-28 20:56:18 +02:00
David a838a886dc Add PlayerRespawnEvent#isMissingRespawnBlock (#12422) 2025-04-17 19:52:07 +01:00
Shane Bee 0767902699 CraftBlock - fix applyBoneMeal false result (#12407) 2025-04-11 22:38:33 +01:00
Bjarne Koll 0cf731589a Bump to adventure 4.20.0 (#12391)
* Update adventure to 4.19.0

The update only includes a new configuration for MiniMessage,
specifically one to prevent it from emitting virtual components.
As virtual components break the generated component tree, items quickly
become unstackable with items generated before adventure 4.18.

Plugin developers may construct their own mini message instance which
will emit virtual components if they so choose.

* Bump to adventure 4.20.0
2025-04-07 13:29:57 +02:00
Nassim Jahnke 9b1798d643 Simplify custom payload handling (#12347) 2025-03-27 14:22:38 +01:00
TonytheMacaroni c467df95a2 Add ItemStack#copyDataFrom (#12224) 2025-03-24 01:12:57 +01:00
Shane Bee 5a6ab97be6 Add config to remove player as vehicle restriction in /ride (#12327) 2025-03-24 00:55:15 +01:00
Tamion 515e12ca2d Check if BUNDLE_CONTENTS is present in InventoryClickEvent (#12321) 2025-03-24 00:38:25 +01:00
Strokkur24 37b9ca1f90 Add flush parameter to World#save (#12330) 2025-03-24 00:37:48 +01:00
Shane Bee 7819df10a4 Add getHeight method to ChunkData (#12311) 2025-03-24 00:33:34 +01:00
Pedro f225858235 Fix firework entity not being removed when FireworkExplodeEvent is cancelled (#12268)
* Fix Firework not removed when FireworkExplodeEvent is canceled

* JUnit require pass null

* tweaks
2025-03-24 00:20:14 +01:00
Miles 058455e4ca InventoryView QOL open method (#12282)
* Add QOL open method to InventoryView

* Check to ensure the opening isn't a InventoryMenu, allow HorseMenus

* Fix instanceof against API instaed of AbstractContainerMenu

* [ci skip] Remove suggested comment
2025-03-23 23:46:10 +01:00
Nassim Jahnke bb3b7e6979 Fix annotation mistakes 2025-03-23 22:33:28 +01:00
Shane Freeder 2aad131e74 Add config option for command spam whitelist 2025-03-23 18:31:39 +00:00
Matthew Peters 894631f0d0 Make advancement ordering predictable (#12292) 2025-03-21 17:52:42 +01:00
Shane Bee f49d18df89 Add get/set customName to Skull block (#12302) 2025-03-21 17:52:00 +01:00
TonytheMacaroni 7cc6cb5013 Check for trailing input in ItemFactory#createItemStack (#12312) 2025-03-21 17:51:09 +01:00
Pedro 72f13f8bbb [ci skip] Mention API Checks for CONTRIBUTING.md (#12315) 2025-03-21 17:50:58 +01:00
Nassim Jahnke 9f00461456 Update a whole lot of deprecated annotations 2025-03-21 17:50:04 +01:00
MartandWarrior bb1beda67b feat: add event to wind charge explode (#12248)
* feat: add event to wind charge explode

* fix: use correct parameters

* feat: allow setters to work

* fix: use consts

* Unify paper comments

---------

Co-authored-by: Warrior <50800980+Warriorrrr@users.noreply.github.com>
2025-03-17 10:54:49 +01:00
Nassim Jahnke aaaeb4e1e6 [ci skip] Make compilation logs actually readable (#12276)
* [ci skip] Make compilation logs actually readable

* Specifically disable deprecation and removal warnings instead
2025-03-17 10:53:56 +01:00
Davidanddavid 2d3a1385f1 [ci skip] Refine recipe management API documentation. (#12287)
* Refine recipe management API documentation.

Improve Javadoc clarity for recipe addition methods, specifying client update behavior and stability considerations. Adjust formatting for better readability and consistency.

* Fix typo in original javadoc

---------

Co-authored-by: david <mrminecraft00@gmail.com>
2025-03-17 10:53:06 +01:00
Tamion 6ea42025a4 Send all attributes on respawn (#12274) 2025-03-13 12:41:03 +01:00
Nassim Jahnke 310f52293b Add unsupported config option and internal API to simplify remote item matching
This is important for 1.21.5 servers/clients and non-Vanilla clients that may not be able to match 1.21.5 data hashes anymore
2025-03-13 12:32:50 +01:00
Nassim Jahnke c37b890c8b More deferred requireNonNull message creation 2025-03-13 12:27:12 +01:00
Pedro f0388e2f38 Call EntityPushedByEntityAttackEvent for Mace AoE (#12257) 2025-03-12 11:13:47 +01:00
Tamion 102c8bbc54 Add config for updating equipment on player actions (#12275) 2025-03-12 11:09:27 +01:00
198 changed files with 1962 additions and 1188 deletions

No files matched your search

+34
View File
@@ -264,6 +264,40 @@ are assumed to be non-null by default. For less obvious placing such as on gener
**For other classes**: Keep using both `@Nullable` and `@NotNull` from `org.jetbrains.annotations`. These
will be replaced later.
### API checks
When performing API-related checks where an exception needs to be thrown under specific conditions, you should use the `Preconditions` class.
#### Checking Method Arguments
To validate method arguments, use `Preconditions#checkArgument`. This will throw an `IllegalArgumentException` if the condition is not met.
> Don't use Preconditions#checkNotNull, as it throws a NullPointerException, which makes it harder to determine whether the error was caused by an internal issue or invalid arguments.
ex:
```java
@Override
public void sendMessage(Player player, Component message) {
Preconditions.checkArgument(player != null, "player cannot be null");
Preconditions.checkArgument(player.isOnline(), "player %s must be online", player.getName());
Preconditions.checkArgument(message != null, "message cannot be null");
// rest of code
}
```
#### Checking Object State
To validate the state of an object inside a method, use `Preconditions#checkState`. This will throw an `IllegalStateException` if the condition is not met.
ex:
```java
private Player player;
@Override
public void sendMessage(Component message) {
Preconditions.checkArgument(message != null, "message cannot be null");
Preconditions.checkState(this.player != null, "player cannot be null");
Preconditions.checkState(this.player.isOnline(), "player %s must be online", this.player.getName());
// rest of code
}
```
## Access Transformers
Sometimes, Vanilla code already contains a field, method, or type you want to access
but the visibility is too low (e.g. a private field in an entity class). Paper can use access transformers
+2
View File
@@ -492,6 +492,7 @@ public net.minecraft.world.inventory.BrewingStandMenu brewingStandData
public net.minecraft.world.inventory.CraftingMenu access
public net.minecraft.world.inventory.DispenserMenu dispenser
public net.minecraft.world.inventory.HorseInventoryMenu SLOT_BODY_ARMOR
public net.minecraft.world.inventory.HorseInventoryMenu horse
public net.minecraft.world.inventory.MerchantContainer selectionHint
public net.minecraft.world.inventory.Slot slot
public net.minecraft.world.item.AdventureModePredicate predicates
@@ -605,6 +606,7 @@ public net.minecraft.world.level.block.entity.SculkSensorBlockEntity lastVibrati
public net.minecraft.world.level.block.entity.SculkShriekerBlockEntity warningLevel
public net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity openCount
public net.minecraft.world.level.block.entity.SignBlockEntity playerWhoMayEdit
public net.minecraft.world.level.block.entity.SkullBlockEntity customName
public net.minecraft.world.level.block.entity.SkullBlockEntity noteBlockSound
public net.minecraft.world.level.block.entity.SkullBlockEntity owner
public net.minecraft.world.level.block.entity.StructureBlockEntity author
+2 -1
View File
@@ -38,6 +38,7 @@ subprojects {
options.encoding = Charsets.UTF_8.name()
options.release = 21
options.isFork = true
options.compilerArgs.addAll(listOf("-Xlint:-deprecation", "-Xlint:-removal"))
}
tasks.withType<Javadoc> {
options.encoding = Charsets.UTF_8.name()
@@ -60,7 +61,7 @@ subprojects {
extensions.configure<PublishingExtension> {
repositories {
maven("https://repo.papermc.io/repository/maven-snapshots/") {
maven("https://artifactory.papermc.io/artifactory/snapshots/") {
name = "paperSnapshots"
credentials(PasswordCredentials::class)
}
+1 -1
View File
@@ -11,7 +11,7 @@ java {
val annotationsVersion = "26.0.1"
val bungeeCordChatVersion = "1.20-R0.2"
val adventureVersion = "4.18.0"
val adventureVersion = "4.20.0"
val slf4jVersion = "2.0.9"
val log4jVersion = "2.17.1"
@@ -5,6 +5,7 @@ import java.util.Locale;
import java.util.UUID;
import java.util.regex.Pattern;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -126,6 +127,7 @@ public final class NamespacedTag implements com.destroystokyo.paper.Namespaced {
* @deprecated should never be used by plugins, for internal use only!!
*/
@Deprecated
@ApiStatus.Internal
public static NamespacedTag randomKey() {
return new NamespacedTag(BUKKIT, UUID.randomUUID().toString());
}
@@ -1,6 +1,5 @@
package com.destroystokyo.paper.event.entity;
import com.google.common.collect.ImmutableList;
import java.util.List;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.SkeletonHorse;
@@ -21,12 +20,6 @@ public class SkeletonHorseTrapEvent extends EntityEvent implements Cancellable {
private final List<HumanEntity> eligibleHumans;
private boolean cancelled;
@Deprecated
@ApiStatus.Internal
public SkeletonHorseTrapEvent(final SkeletonHorse horse) {
this(horse, ImmutableList.of());
}
@ApiStatus.Internal
public SkeletonHorseTrapEvent(final SkeletonHorse horse, final List<HumanEntity> eligibleHumans) {
super(horse);
@@ -10,7 +10,7 @@ import org.jetbrains.annotations.Nullable;
/**
* @deprecated Not used
*/
@Deprecated(since = "1.16.4")
@Deprecated(since = "1.16.4", forRemoval = true)
public class IllegalPacketEvent extends PlayerEvent {
private static final HandlerList HANDLER_LIST = new HandlerList();
@@ -30,20 +30,6 @@ public class PlayerClientOptionsChangeEvent extends PlayerEvent {
private final boolean textFilteringEnabled;
private final ParticleVisibility particleVisibility;
@Deprecated
public PlayerClientOptionsChangeEvent(final Player player, final String locale, final int viewDistance, final ChatVisibility chatVisibility, final boolean chatColors, final SkinParts skinParts, final MainHand mainHand) {
super(player);
this.locale = locale;
this.viewDistance = viewDistance;
this.chatVisibility = chatVisibility;
this.chatColors = chatColors;
this.skinparts = skinParts;
this.mainHand = mainHand;
this.allowsServerListings = false;
this.textFilteringEnabled = false;
this.particleVisibility = ParticleVisibility.ALL;
}
@ApiStatus.Internal
public PlayerClientOptionsChangeEvent(final Player player, final Map<ClientOption<?>, ?> options) {
super(player);
@@ -50,12 +50,6 @@ public class ProfileWhitelistVerifyEvent extends Event {
private boolean whitelisted;
private @Nullable Component kickMessage;
@Deprecated
@ApiStatus.Internal
public ProfileWhitelistVerifyEvent(final PlayerProfile profile, final boolean whitelistEnabled, final boolean whitelisted, final boolean isOp, final @Nullable String kickMessage) {
this(profile, whitelistEnabled, whitelisted, isOp, kickMessage == null ? null : LegacyComponentSerializer.legacySection().deserialize(kickMessage));
}
@ApiStatus.Internal
public ProfileWhitelistVerifyEvent(final PlayerProfile profile, final boolean whitelistEnabled, final boolean whitelisted, final boolean isOp, final @Nullable Component kickMessage) {
this.profile = profile;
@@ -55,18 +55,6 @@ public class PaperServerListPingEvent extends ServerListPingEvent implements Can
private boolean originalPlayerCount = true;
private Object[] players;
@Deprecated
@ApiStatus.Internal
public PaperServerListPingEvent(@NotNull StatusClient client, @NotNull String motd, int numPlayers, int maxPlayers,
@NotNull String version, int protocolVersion, @Nullable CachedServerIcon favicon) {
super("", client.getAddress().getAddress(), motd, numPlayers, maxPlayers);
this.client = client;
this.numPlayers = numPlayers;
this.version = version;
this.protocolVersion = protocolVersion;
setServerIcon(favicon);
}
@ApiStatus.Internal
public PaperServerListPingEvent(@NotNull StatusClient client, @NotNull net.kyori.adventure.text.Component motd, int numPlayers, int maxPlayers,
@NotNull String version, int protocolVersion, @Nullable CachedServerIcon favicon) {
@@ -41,7 +41,7 @@ import org.slf4j.LoggerFactory;
* MavenLibraryResolver resolver = new MavenLibraryResolver();
* resolver.addDependency(new Dependency(new DefaultArtifact("org.jooq:jooq:3.17.7"), null));
* resolver.addRepository(new RemoteRepository.Builder(
* "central", "default", "https://repo1.maven.org/maven2/"
* "central", "default", MavenLibraryResolver.MAVEN_CENTRAL_DEFAULT_MIRROR
* ).build());
* }</pre>
* <p>
@@ -50,6 +50,21 @@ import org.slf4j.LoggerFactory;
@NullMarked
public class MavenLibraryResolver implements ClassPathLibrary {
/**
* The default Maven Central mirror, configurable through the {@code PAPER_DEFAULT_CENTRAL_REPOSITORY} environment
* variable. Use this instead of Maven Central directly when you do not have your own mirror, as using
* Maven Central as a CDN is against the Maven Central Terms of Service, and you will cause users to hit
* rate limits.
*
* <p>This repository is also used by the legacy {@link org.bukkit.plugin.java.LibraryLoader}.</p>
*/
public static final String MAVEN_CENTRAL_DEFAULT_MIRROR = getDefaultMavenCentralMirror();
private static final List<String> MAVEN_CENTRAL_URLS = List.of(
"https://repo1.maven.org/maven2",
"http://repo1.maven.org/maven2",
"https://repo.maven.apache.org/maven2",
"http://repo.maven.apache.org/maven2"
);
private static final Logger LOGGER = LoggerFactory.getLogger("MavenLibraryResolver");
private final RepositorySystem repository;
@@ -105,6 +120,12 @@ public class MavenLibraryResolver implements ClassPathLibrary {
* dependencies from
*/
public void addRepository(final RemoteRepository remoteRepository) {
if (MAVEN_CENTRAL_URLS.stream().anyMatch(remoteRepository.getUrl()::startsWith)) {
LOGGER.warn(
"Use of Maven Central as a CDN is against the Maven Central Terms of Service. Use MavenLibraryResolver.MAVEN_CENTRAL_DEFAULT_MIRROR instead.",
new RuntimeException("Plugin used Maven Central for library resolution")
);
}
this.repositories.add(remoteRepository);
}
@@ -130,4 +151,15 @@ public class MavenLibraryResolver implements ClassPathLibrary {
store.addLibrary(file.toPath());
}
}
private static String getDefaultMavenCentralMirror() {
String central = System.getenv("PAPER_DEFAULT_CENTRAL_REPOSITORY");
if (central == null) {
central = System.getProperty("org.bukkit.plugin.java.LibraryLoader.centralURL");
}
if (central == null) {
central = "https://maven-central.storage-download.googleapis.com/maven2";
}
return central;
}
}
@@ -79,7 +79,7 @@ public sealed interface RegistryKey<T> extends Keyed permits RegistryKeyImpl {
RegistryKey<BlockType> BLOCK = create("block");
/**
* @apiNote use preferably only in the context of registry entries.
* @see io.papermc.paper.registry.data
* @see io.papermc.paper.registry.keys.ItemTypeKeys
*/
@ApiStatus.Experimental // Paper - already required for registry builders
RegistryKey<ItemType> ITEM = create("item");
+4 -4
View File
@@ -109,9 +109,9 @@ public interface Art extends OldEnum<Art>, Keyed {
* Get the ID of this painting.
*
* @return The ID of this painting
* @deprecated Magic value
* @deprecated Magic value that is based on inconsistent, data-driven registry
*/
@Deprecated(since = "1.6.2")
@Deprecated(since = "1.6.2", forRemoval = true)
int getId();
// Paper start - deprecate getKey
@@ -162,9 +162,9 @@ public interface Art extends OldEnum<Art>, Keyed {
*
* @param id The ID
* @return The painting
* @deprecated Magic value
* @deprecated Magic value that is based on inconsistent, data-driven registry
*/
@Deprecated(since = "1.6.2")
@Deprecated(since = "1.6.2", forRemoval = true)
@Nullable
static Art getById(int id) {
for (Art art : Registry.ART) {
@@ -930,7 +930,6 @@ public final class Bukkit {
* @param id the id of the map to get
* @return a map view if it exists, or null otherwise
*/
// @Deprecated(since = "1.6.2") // Paper - Not a magic value
@Nullable
public static MapView getMap(int id) {
return server.getMap(id);
@@ -1117,20 +1116,24 @@ public final class Bukkit {
/**
* Adds a recipe to the crafting manager.
* Recipes added with this method won't be sent to the client automatically.
* <p>
* Players still have to discover recipes via {@link Player#discoverRecipe(NamespacedKey)}
* before seeing them in their recipe book.
*
* @param recipe the recipe to add
* @return true if the recipe was added, false if it wasn't for some
* reason
* @return true if the recipe was added, false if it wasn't for some reason
* @see #addRecipe(Recipe, boolean)
*/
@Contract("null -> false")
public static boolean addRecipe(@Nullable Recipe recipe) {
return server.addRecipe(recipe);
}
// Paper start - method to send recipes immediately
/**
* Adds a recipe to the crafting manager.
*
* @apiNote resendRecipes is ignored at the moment for stability reasons, recipes will always be updated
* @param recipe the recipe to add
* @param resendRecipes true to update the client with the full set of recipes
* @return true if the recipe was added, false if it wasn't for some reason
@@ -1139,7 +1142,6 @@ public final class Bukkit {
public static boolean addRecipe(@Nullable Recipe recipe, boolean resendRecipes) {
return server.addRecipe(recipe, resendRecipes);
}
// Paper end - method to send recipes immediately
/**
* Get a list of all recipes for a given item. The stack size is ignored
@@ -1389,7 +1391,7 @@ public final class Bukkit {
* @return true if the server should send a preview, false otherwise
* @deprecated chat previews have been removed
*/
@Deprecated(since = "1.19.3")
@Deprecated(since = "1.19.3", forRemoval = true)
public static boolean shouldSendChatPreviews() {
return server.shouldSendChatPreviews();
}
@@ -1512,7 +1514,6 @@ public final class Bukkit {
* @return an offline player
* @see #getOfflinePlayer(java.util.UUID)
*/
// @Deprecated(since = "1.7.5") // Paper
@NotNull
public static OfflinePlayer getOfflinePlayer(@NotNull String name) {
return server.getOfflinePlayer(name);
@@ -65,7 +65,7 @@ public interface ChunkSnapshot {
* @return 0-15
* @deprecated Magic value
*/
@Deprecated(since = "1.6.2")
@Deprecated(since = "1.6.2", forRemoval = true)
int getData(int x, int y, int z);
/**
+10 -10
View File
@@ -27,70 +27,70 @@ public enum Effect {
* @deprecated no longer exists
* @see Sound#BLOCK_WOODEN_DOOR_OPEN
*/
@Deprecated(since = "1.19.3")
@Deprecated(since = "1.19.3", forRemoval = true)
DOOR_TOGGLE(1006, Type.SOUND),
/**
* Sound of a door opening.
* @deprecated no longer exists
* @see Sound#BLOCK_IRON_DOOR_OPEN
*/
@Deprecated(since = "1.19.3")
@Deprecated(since = "1.19.3", forRemoval = true)
IRON_DOOR_TOGGLE(1005, Type.SOUND),
/**
* Sound of a trapdoor opening.
* @deprecated no longer exists
* @see Sound#BLOCK_WOODEN_TRAPDOOR_OPEN
*/
@Deprecated(since = "1.19.3")
@Deprecated(since = "1.19.3", forRemoval = true)
TRAPDOOR_TOGGLE(1007, Type.SOUND),
/**
* Sound of a door opening.
* @deprecated no longer exists
* @see Sound#BLOCK_IRON_TRAPDOOR_OPEN
*/
@Deprecated(since = "1.19.3")
@Deprecated(since = "1.19.3", forRemoval = true)
IRON_TRAPDOOR_TOGGLE(1037, Type.SOUND),
/**
* Sound of a door opening.
* @deprecated no longer exists
* @see Sound#BLOCK_FENCE_GATE_OPEN
*/
@Deprecated(since = "1.19.3")
@Deprecated(since = "1.19.3", forRemoval = true)
FENCE_GATE_TOGGLE(1008, Type.SOUND),
/**
* Sound of a door closing.
* @deprecated no longer exists
* @see Sound#BLOCK_WOODEN_DOOR_CLOSE
*/
@Deprecated(since = "1.19.3")
@Deprecated(since = "1.19.3", forRemoval = true)
DOOR_CLOSE(1012, Type.SOUND),
/**
* Sound of a door closing.
* @deprecated no longer exists
* @see Sound#BLOCK_IRON_DOOR_CLOSE
*/
@Deprecated(since = "1.19.3")
@Deprecated(since = "1.19.3", forRemoval = true)
IRON_DOOR_CLOSE(1011, Type.SOUND),
/**
* Sound of a trapdoor closing.
* @deprecated no longer exists
* @see Sound#BLOCK_WOODEN_TRAPDOOR_CLOSE
*/
@Deprecated(since = "1.19.3")
@Deprecated(since = "1.19.3", forRemoval = true)
TRAPDOOR_CLOSE(1013, Type.SOUND),
/**
* Sound of a door closing.
* @deprecated no longer exists
* @see Sound#BLOCK_IRON_TRAPDOOR_CLOSE
*/
@Deprecated(since = "1.19.3")
@Deprecated(since = "1.19.3", forRemoval = true)
IRON_TRAPDOOR_CLOSE(1036, Type.SOUND),
/**
* Sound of a door closing.
* @deprecated no longer exists
* @see Sound#BLOCK_FENCE_GATE_CLOSE
*/
@Deprecated(since = "1.19.3")
@Deprecated(since = "1.19.3", forRemoval = true)
FENCE_GATE_CLOSE(1014, Type.SOUND),
/**
* Sound of fire being extinguished.
File diff suppressed because it is too large. Load diff
@@ -83,14 +83,12 @@ 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 && 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);
Preconditions.checkArgument(namespace != null, "Namespace cannot be null");
Preconditions.checkArgument(key != null, "Key cannot be null");
this.namespace = namespace;
this.key = key;
String string = toString();
Preconditions.checkArgument(string.length() <= Short.MAX_VALUE, "NamespacedKey must be less than 32768 characters", string); // Paper - Fix improper length validation
this.validate();
}
/**
@@ -108,16 +106,17 @@ 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
@@ -64,7 +64,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
@SuppressWarnings("removal")
@Deprecated(forRemoval = true, since = "1.21.4")
private static <A extends Keyed> Registry<A> legacyRegistryFor(final Class<A> clazz) {
return Objects.requireNonNull(RegistryAccess.registryAccess().getRegistry(clazz), "No registry present for " + clazz.getSimpleName() + ". This is a bug.");
return Objects.requireNonNull(RegistryAccess.registryAccess().getRegistry(clazz), () -> "No registry present for " + clazz.getSimpleName() + ". This is a bug.");
}
/**
+10 -10
View File
@@ -988,26 +988,24 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
public boolean dispatchCommand(@NotNull CommandSender sender, @NotNull String commandLine) throws CommandException;
/**
* Adds a recipe to the crafting manager. Recipes added with
* this method won't be sent to the client automatically. Use
* {@link #updateRecipes()} or {@link #updateResources()} to
* update clients to new recipes added.
* Adds a recipe to the crafting manager.
* Recipes added with this method won't be sent to the client automatically.
* <p>
* Player's still have to discover recipes via {@link Player#discoverRecipe(NamespacedKey)}
* Players still have to discover recipes via {@link Player#discoverRecipe(NamespacedKey)}
* before seeing them in their recipe book.
*
* @param recipe the recipe to add
* @return true if the recipe was added, false if it wasn't for some
* reason
* @return true if the recipe was added, false if it wasn't for some reason
* @see #addRecipe(Recipe, boolean)
*/
@Contract("null -> false")
public boolean addRecipe(@Nullable Recipe recipe);
boolean addRecipe(@Nullable Recipe recipe);
// Paper start - method to send recipes immediately
/**
* Adds a recipe to the crafting manager.
*
* @apiNote resendRecipes is ignored for now for stability reasons, recipes will always be updated
* @param recipe the recipe to add
* @param resendRecipes true to update the client with the full set of recipes
* @return true if the recipe was added, false if it wasn't for some reason
@@ -1233,8 +1231,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return true if the server should send a preview, false otherwise
* @deprecated chat previews have been removed
*/
@Deprecated(since = "1.19.3")
public boolean shouldSendChatPreviews();
@Deprecated(since = "1.19.3", forRemoval = true)
default boolean shouldSendChatPreviews() {
return false;
}
/**
* Gets whether the server only allow players with Mojang-signed public key
+13 -8
View File
@@ -1,9 +1,7 @@
package org.bukkit;
import java.io.File;
import io.papermc.paper.raytracing.PositionedRayTraceConfigurationBuilder;
import org.bukkit.generator.ChunkGenerator;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -494,7 +492,6 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* @return Whether the chunk was actually refreshed
*
*/
// @Deprecated(since = "1.8") // Paper
public boolean refreshChunk(int x, int z);
/**
@@ -2411,9 +2408,17 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
public BiomeProvider getBiomeProvider();
/**
* Saves world to disk
* Saves the world to disk
*/
public void save();
default void save() {
save(false);
}
/**
* Saves the world to disk
* @param flush Whether to wait for the chunk writer to finish
*/
void save(boolean flush);
/**
* Gets a list of all applied {@link BlockPopulator}s for this World
@@ -2478,7 +2483,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* @deprecated Use {@link #spawn(Location, Class, Consumer)} (or a variation thereof) in combination with {@link FallingBlock#setBlockData(BlockData)}
*/
@NotNull
@Deprecated(since = "1.20.2") // Paper
@Deprecated(since = "1.20.2", forRemoval = true)
public FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull MaterialData data) throws IllegalArgumentException;
/**
@@ -2513,7 +2518,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* Material} are null or {@link Material} is not a block
* @deprecated Magic value. Use {@link #spawn(Location, Class, Consumer)} (or a variation thereof) in combination with {@link FallingBlock#setBlockData(BlockData)}
*/
@Deprecated(since = "1.7.5")
@Deprecated(since = "1.7.5", forRemoval = true)
@NotNull
public FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull Material material, byte data) throws IllegalArgumentException;
@@ -40,7 +40,7 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
* @return block specific metadata
* @deprecated Magic value
*/
@Deprecated(since = "1.6.2")
@Deprecated(since = "1.6.2", forRemoval = true)
byte getData();
/**
@@ -225,14 +225,14 @@ public interface BlockState extends Metadatable {
* @return The data as a raw byte.
* @deprecated Magic value
*/
@Deprecated(since = "1.6.2")
@Deprecated(since = "1.6.2", forRemoval = true)
public byte getRawData();
/**
* @param data The new data value for the block.
* @deprecated Magic value
*/
@Deprecated(since = "1.6.2")
@Deprecated(since = "1.6.2", forRemoval = true)
public void setRawData(byte data);
/**
@@ -1,5 +1,6 @@
package org.bukkit.block;
import net.kyori.adventure.text.Component;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.OfflinePlayer;
@@ -155,7 +156,7 @@ public interface Skull extends TileState {
* @return the type of skull
* @deprecated check {@link Material} instead
*/
@Deprecated(since = "1.13")
@Deprecated(since = "1.13", forRemoval = true)
@NotNull
public SkullType getSkullType();
@@ -165,7 +166,27 @@ public interface Skull extends TileState {
* @param skullType the type of skull
* @deprecated check {@link Material} instead
*/
@Deprecated(since = "1.13")
@Deprecated(since = "1.13", forRemoval = true)
@Contract("_ -> fail")
public void setSkullType(SkullType skullType);
/**
* Get the custom name of skull.
* <p>This name is set when placing a skull item that has a custom name.
* This name is only carried back to the item when broken for player heads
* (skeleton/creeper heads will not retain the name).</p>
*
* @return Custom name of skull
*/
public @Nullable Component customName();
/**
* Set the custom name of skull.
* <p>This name is set when placing a skull item that has a custom name.
* This name is only carried back to the item when broken for player heads
* (skeleton/creeper heads will not retain the name).</p>
*
* @param customName Custom name of skull
*/
public void customName(@Nullable Component customName);
}
@@ -241,7 +241,7 @@ public abstract class Enchantment implements Keyed, Translatable, net.kyori.adve
* @deprecated enchantments are badly named, use {@link #getKey()}.
*/
@NotNull
@Deprecated(since = "1.13")
@Deprecated(since = "1.13", forRemoval = true)
public abstract String getName();
/**
@@ -13,7 +13,7 @@ public enum EnchantmentTarget {
*
* @deprecated this target no longer exists in Vanilla
*/
@Deprecated(since = "1.16.1")
@Deprecated(since = "1.16.1", forRemoval = true)
ALL {
@Override
public boolean includes(@NotNull Material item) {
@@ -6,7 +6,7 @@ import org.jetbrains.annotations.NotNull;
* A simple wrapper for ease of selecting {@link Enchantment}s
* @deprecated only for backwards compatibility, EnchantmentWrapper is no longer used.
*/
@Deprecated(since = "1.20.3")
@Deprecated(since = "1.20.3", forRemoval = true)
public abstract class EnchantmentWrapper extends Enchantment {
protected EnchantmentWrapper() {
}
@@ -20,9 +20,9 @@ public interface AbstractArrow extends Projectile {
*
* @return the knockback strength value
* @see #getWeapon()
* @deprecated a function of the firing weapon
* @deprecated moved to being a function of the firing weapon, always returns 0 here
*/
@Deprecated(since = "1.21")
@Deprecated(since = "1.21", forRemoval = true)
public int getKnockbackStrength();
/**
@@ -30,9 +30,9 @@ public interface AbstractArrow extends Projectile {
*
* @param knockbackStrength the knockback strength value
* @see #setWeapon(org.bukkit.inventory.ItemStack)
* @deprecated a function of the firing weapon
* @deprecated moved to being a function of the firing weapon, does nothing here
*/
@Deprecated(since = "1.21")
@Deprecated(since = "1.21", forRemoval = true)
public void setKnockbackStrength(int knockbackStrength);
/**
@@ -145,9 +145,9 @@ public interface AbstractArrow extends Projectile {
*
* @param shotFromCrossbow if shot from a crossbow
* @see #setWeapon(org.bukkit.inventory.ItemStack)
* @deprecated a function of the firing weapon instead
* @deprecated a function of the firing weapon instead, this method does nothing
*/
@Deprecated(since = "1.21")
@Deprecated(since = "1.21", forRemoval = true)
public void setShotFromCrossbow(boolean shotFromCrossbow);
/**
@@ -20,7 +20,7 @@ public interface AbstractHorse extends Vehicle, InventoryHolder, Tameable {
* @return a {@link Horse.Variant} representing the horse's variant
* @deprecated different variants are different classes
*/
@Deprecated(since = "1.11")
@Deprecated(since = "1.11", forRemoval = true)
@NotNull
public Horse.Variant getVariant();
@@ -28,7 +28,7 @@ public interface AbstractHorse extends Vehicle, InventoryHolder, Tameable {
* @param variant variant
* @deprecated you are required to spawn a different entity
*/
@Deprecated(since = "1.11")
@Deprecated(since = "1.11", forRemoval = true)
@Contract("_ -> fail")
public void setVariant(Horse.Variant variant);
@@ -108,7 +108,7 @@ public interface AbstractHorse extends Vehicle, InventoryHolder, Tameable {
* @return true if eating hay
* @deprecated use {@link #isEatingGrass()}, this name is incorrect
*/
@Deprecated // Paper - Horse API
@Deprecated(forRemoval = true)
boolean isEatingHaystack();
/**
@@ -117,7 +117,7 @@ public interface AbstractHorse extends Vehicle, InventoryHolder, Tameable {
* @param eatingHaystack new hay grazing status
* @deprecated use {@link #setEatingGrass(boolean)}, this name is incorrect
*/
@Deprecated // Paper - Horse API
@Deprecated(forRemoval = true)
void setEatingHaystack(boolean eatingHaystack);
@NotNull
@@ -21,7 +21,7 @@ public interface AbstractSkeleton extends Monster, com.destroystokyo.paper.entit
* @return Current type
* @deprecated should check what class instance this is.
*/
@Deprecated(since = "1.17")
@Deprecated(since = "1.17", forRemoval = true)
@NotNull
public Skeleton.SkeletonType getSkeletonType();
@@ -29,7 +29,7 @@ public interface AbstractSkeleton extends Monster, com.destroystokyo.paper.entit
* @param type type
* @deprecated Must spawn a new subtype variant
*/
@Deprecated(since = "1.17")
@Deprecated(since = "1.17", forRemoval = true)
@Contract("_ -> fail")
public void setSkeletonType(Skeleton.SkeletonType type);
@@ -152,7 +152,7 @@ public interface AreaEffectCloud extends Entity {
* @param data PotionData to set the base potion state to
* @deprecated Upgraded / extended potions are now their own {@link PotionType} use {@link #setBasePotionType} instead.
*/
@Deprecated(since = "1.20.6")
@Deprecated(since = "1.20.6", forRemoval = true)
void setBasePotionData(@Nullable PotionData data);
/**
@@ -162,7 +162,7 @@ public interface AreaEffectCloud extends Entity {
* @deprecated Upgraded / extended potions are now their own {@link PotionType} use {@link #getBasePotionType()} instead.
*/
@Nullable
@Deprecated(since = "1.20.6")
@Deprecated(since = "1.20.6", forRemoval = true)
PotionData getBasePotionData();
/**
@@ -17,7 +17,7 @@ public interface Arrow extends AbstractArrow {
* @param data PotionData to set the base potion state to
* @deprecated Upgraded / extended potions are now their own {@link PotionType} use {@link #setBasePotionType} instead.
*/
@Deprecated(since = "1.20.6")
@Deprecated(since = "1.20.6", forRemoval = true)
void setBasePotionData(@Nullable PotionData data);
/**
@@ -27,7 +27,7 @@ public interface Arrow extends AbstractArrow {
* @deprecated Upgraded / extended potions are now their own {@link PotionType} use {@link #getBasePotionType()} instead.
*/
@Nullable
@Deprecated(since = "1.20.6")
@Deprecated(since = "1.20.6", forRemoval = true)
PotionData getBasePotionData();
/**
@@ -15,7 +15,7 @@ public interface Boat extends Vehicle, io.papermc.paper.entity.Leashable { // Pa
* @return the wood type
* @deprecated deprecated in favor of {@link #getBoatType()}
*/
@Deprecated(since = "1.19")
@Deprecated(since = "1.19", forRemoval = true)
@NotNull
TreeSpecies getWoodType();
@@ -25,7 +25,7 @@ public interface Boat extends Vehicle, io.papermc.paper.entity.Leashable { // Pa
* @param species the new wood type
* @deprecated deprecated in favor of {@link #setBoatType(Type)}
*/
@Deprecated(since = "1.19")
@Deprecated(since = "1.19", forRemoval = true)
void setWoodType(@NotNull TreeSpecies species);
/**
@@ -10,7 +10,7 @@ public interface Endermite extends Monster {
* @return player spawned status
* @deprecated this functionality no longer exists
*/
@Deprecated(since = "1.17")
@Deprecated(since = "1.17", forRemoval = true)
boolean isPlayerSpawned();
/**
@@ -21,7 +21,7 @@ public interface Endermite extends Monster {
* @param playerSpawned player spawned status
* @deprecated this functionality no longer exists
*/
@Deprecated(since = "1.17")
@Deprecated(since = "1.17", forRemoval = true)
void setPlayerSpawned(boolean playerSpawned);
// Paper start
/**
@@ -407,7 +407,7 @@ public enum EntityType implements Keyed, Translatable, net.kyori.adventure.trans
* @return the raw type id
* @deprecated Magic value
*/
@Deprecated(since = "1.6.2")
@Deprecated(since = "1.6.2", forRemoval = true)
public short getTypeId() {
return typeId;
}
@@ -436,7 +436,7 @@ public enum EntityType implements Keyed, Translatable, net.kyori.adventure.trans
* @return the matching entity type or null
* @deprecated Magic value
*/
@Deprecated(since = "1.6.2")
@Deprecated(since = "1.6.2", forRemoval = true)
@Nullable
public static EntityType fromId(int id) {
if (id > Short.MAX_VALUE) {
@@ -208,7 +208,7 @@ public interface FishHook extends Projectile {
* @return chance the bite chance
* @deprecated has no effect in newer Minecraft versions
*/
@Deprecated(since = "1.9.2")
@Deprecated(since = "1.9.2", forRemoval = true)
public double getBiteChance();
/**
@@ -222,7 +222,7 @@ public interface FishHook extends Projectile {
* and 1
* @deprecated has no effect in newer Minecraft versions
*/
@Deprecated(since = "1.9.2")
@Deprecated(since = "1.9.2", forRemoval = true)
public void setBiteChance(double chance) throws IllegalArgumentException;
/**
@@ -154,14 +154,14 @@ public interface Horse extends AbstractHorse {
* @return carrying chest status
* @deprecated see {@link ChestedHorse}
*/
@Deprecated(since = "1.11")
@Deprecated(since = "1.11", forRemoval = true)
public boolean isCarryingChest();
/**
* @param chest chest
* @deprecated see {@link ChestedHorse}
*/
@Deprecated(since = "1.11")
@Deprecated(since = "1.11", forRemoval = true)
public void setCarryingChest(boolean chest);
@NotNull
@@ -91,7 +91,7 @@ public interface LightningStrike extends Entity {
/**
* @deprecated Unsupported api
*/
@Deprecated // Paper
@Deprecated(forRemoval = true)
public class Spigot extends Entity.Spigot {
/**
@@ -100,7 +100,7 @@ public interface LightningStrike extends Entity {
* @return whether the strike is silent.
* @deprecated sound is now client side and cannot be removed
*/
@Deprecated(since = "1.20.4")
@Deprecated(since = "1.20.4", forRemoval = true)
public boolean isSilent() {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -111,7 +111,7 @@ public interface LightningStrike extends Entity {
*/
@NotNull
@Override
@Deprecated // Paper
@Deprecated(forRemoval = true)
Spigot spigot();
// Spigot end
@@ -73,7 +73,7 @@ public interface Ocelot extends Animals {
* @return Type ID.
* @deprecated Magic value
*/
@Deprecated(since = "1.6.2")
@Deprecated(since = "1.6.2", forRemoval = true)
public int getId() {
return id;
}
@@ -85,7 +85,7 @@ public interface Ocelot extends Animals {
* @return Resulting type, or null if not found.
* @deprecated Magic value
*/
@Deprecated(since = "1.6.2")
@Deprecated(since = "1.6.2", forRemoval = true)
@Nullable
public static Type getType(int id) {
return (id >= types.length) ? null : types[id];
@@ -32,14 +32,14 @@ public interface Zombie extends Monster, Ageable {
* @return Whether the zombie is a villager
* @deprecated check if instanceof {@link ZombieVillager}.
*/
@Deprecated(since = "1.10.2")
@Deprecated(since = "1.10.2", forRemoval = true)
public boolean isVillager();
/**
* @param flag flag
* @deprecated must spawn {@link ZombieVillager}.
*/
@Deprecated(since = "1.9")
@Deprecated(since = "1.9", forRemoval = true)
@Contract("_ -> fail")
public void setVillager(boolean flag);
@@ -47,7 +47,7 @@ public interface Zombie extends Monster, Ageable {
* @param profession profession
* @see ZombieVillager#getVillagerProfession()
*/
@Deprecated(since = "1.10.2")
@Deprecated(since = "1.10.2", forRemoval = true)
@Contract("_ -> fail")
public void setVillagerProfession(Villager.Profession profession);
@@ -55,7 +55,7 @@ public interface Zombie extends Monster, Ageable {
* @return profession
* @see ZombieVillager#getVillagerProfession()
*/
@Deprecated(since = "1.10.2")
@Deprecated(since = "1.10.2", forRemoval = true)
@Nullable
@Contract("-> null")
public Villager.Profession getVillagerProfession();
@@ -3,6 +3,7 @@ package org.bukkit.event.block;
import org.bukkit.block.Block;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -17,11 +18,12 @@ public class BlockBurnEvent extends BlockEvent implements Cancellable {
private boolean cancelled;
private final Block ignitingBlock;
@Deprecated(since = "1.11.2")
@Deprecated(since = "1.11.2", forRemoval = true)
public BlockBurnEvent(@NotNull final Block block) {
this(block, null);
}
@ApiStatus.Internal
public BlockBurnEvent(@NotNull final Block block, @Nullable final Block ignitingBlock) {
super(block);
this.ignitingBlock = ignitingBlock;
@@ -5,6 +5,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -27,7 +28,7 @@ public class BlockCanBuildEvent extends BlockEvent {
private final Player player;
private final org.bukkit.inventory.EquipmentSlot hand; // Paper - expose hand
@Deprecated(since = "1.13.2")
@Deprecated(since = "1.13.2", forRemoval = true)
public BlockCanBuildEvent(@NotNull final Block block, @NotNull final BlockData type, final boolean canBuild) {
this(block, null, type, canBuild, org.bukkit.inventory.EquipmentSlot.HAND); // Paper - expose hand
}
@@ -38,12 +39,13 @@ public class BlockCanBuildEvent extends BlockEvent {
* @param type the id of the block to place
* @param canBuild whether we can build
*/
@java.lang.Deprecated // Paper
@io.papermc.paper.annotation.DoNotUse // Paper
@Deprecated(forRemoval = true)
@io.papermc.paper.annotation.DoNotUse
public BlockCanBuildEvent(@NotNull final Block block, @Nullable final Player player, @NotNull final BlockData type, final boolean canBuild) {
this(block, player, type, canBuild, org.bukkit.inventory.EquipmentSlot.HAND); // Paper start - expose hand
}
@org.jetbrains.annotations.ApiStatus.Internal
@ApiStatus.Internal
public BlockCanBuildEvent(@NotNull final Block block, @Nullable final Player player, @NotNull final BlockData type, final boolean canBuild, @NotNull final org.bukkit.inventory.EquipmentSlot hand) { // Paper end - expose hand
super(block);
this.player = player;
@@ -4,6 +4,7 @@ import org.bukkit.block.Block;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -16,12 +17,13 @@ public class BlockCookEvent extends BlockEvent implements Cancellable {
private boolean cancelled;
private final org.bukkit.inventory.CookingRecipe<?> recipe; // Paper
@Deprecated // Paper
@Deprecated(forRemoval = true)
public BlockCookEvent(@NotNull final Block block, @NotNull final ItemStack source, @NotNull final ItemStack result) {
// Paper start
this(block, source, result, null);
}
@ApiStatus.Internal
public BlockCookEvent(@NotNull final Block block, @NotNull final ItemStack source, @NotNull final ItemStack result, @org.jetbrains.annotations.Nullable org.bukkit.inventory.CookingRecipe<?> recipe) {
// Paper end
super(block);
@@ -6,6 +6,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -18,13 +19,13 @@ import org.jetbrains.annotations.NotNull;
public class BlockMultiPlaceEvent extends BlockPlaceEvent {
private final List<BlockState> states;
@Deprecated // Paper
@Deprecated(forRemoval = true)
public BlockMultiPlaceEvent(@NotNull List<BlockState> states, @NotNull Block clicked, @NotNull ItemStack itemInHand, @NotNull Player thePlayer, boolean canBuild) {
// Paper start - add hand to BlockMultiPlaceEvent
this(states, clicked, itemInHand, thePlayer, canBuild, org.bukkit.inventory.EquipmentSlot.HAND);
}
@ApiStatus.Internal
public BlockMultiPlaceEvent(@NotNull List<BlockState> states, @NotNull Block clicked, @NotNull ItemStack itemInHand, @NotNull Player thePlayer, boolean canBuild, @NotNull org.bukkit.inventory.EquipmentSlot hand) {
super(states.get(0).getBlock(), states.get(0), clicked, itemInHand, thePlayer, canBuild, hand);
this.states = ImmutableList.copyOf(states);
@@ -5,6 +5,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -33,16 +34,18 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable {
private boolean cancel = false;
// Paper start - Legacy constructor, use #BlockPhysicsEvent(Block, BlockData, Block)
@Deprecated
@Deprecated(forRemoval = true)
public BlockPhysicsEvent(final Block block, final BlockData changed, final int sourceX, final int sourceY, final int sourceZ) {
this(block, changed, block.getWorld().getBlockAt(sourceX, sourceY, sourceZ));
}
// Paper end
@ApiStatus.Internal
public BlockPhysicsEvent(@NotNull final Block block, @NotNull final BlockData changed) {
this(block, changed, block);
}
@ApiStatus.Internal
public BlockPhysicsEvent(@NotNull final Block block, @NotNull final BlockData changed, @NotNull final Block sourceBlock) {
super(block);
this.changed = changed;
@@ -6,6 +6,7 @@ import java.util.List;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -16,13 +17,14 @@ public class BlockPistonExtendEvent extends BlockPistonEvent {
private final int length;
private List<Block> blocks;
@Deprecated(since = "1.8")
@Deprecated(since = "1.8", forRemoval = true)
public BlockPistonExtendEvent(@NotNull final Block block, final int length, @NotNull final BlockFace direction) {
super(block, direction);
this.length = length;
}
@ApiStatus.Internal
public BlockPistonExtendEvent(@NotNull final Block block, @NotNull final List<Block> blocks, @NotNull final BlockFace direction) {
super(block, direction);
@@ -51,7 +53,7 @@ public class BlockPistonExtendEvent extends BlockPistonEvent {
@NotNull
public List<Block> getBlocks() {
if (blocks == null) {
ArrayList<Block> tmp = new ArrayList<Block>();
List<Block> tmp = new ArrayList<Block>();
for (int i = 0; i < this.getLength(); i++) {
tmp.add(block.getRelative(getDirection(), i + 1));
}
@@ -7,6 +7,7 @@ import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -24,11 +25,12 @@ public class BlockPlaceEvent extends BlockEvent implements Cancellable {
protected Player player;
protected EquipmentSlot hand;
@Deprecated(since = "1.9")
@Deprecated(since = "1.9", forRemoval = true)
public BlockPlaceEvent(@NotNull final Block placedBlock, @NotNull final BlockState replacedBlockState, @NotNull final Block placedAgainst, @NotNull final ItemStack itemInHand, @NotNull final Player thePlayer, final boolean canBuild) {
this(placedBlock, replacedBlockState, placedAgainst, itemInHand, thePlayer, canBuild, EquipmentSlot.HAND);
}
@ApiStatus.Internal
public BlockPlaceEvent(@NotNull final Block placedBlock, @NotNull final BlockState replacedBlockState, @NotNull final Block placedAgainst, @NotNull final ItemStack itemInHand, @NotNull final Player thePlayer, final boolean canBuild, @NotNull final EquipmentSlot hand) {
super(placedBlock);
this.placedAgainst = placedAgainst;
@@ -5,6 +5,7 @@ import org.bukkit.block.sign.Side;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -21,6 +22,7 @@ public class SignChangeEvent extends BlockEvent implements Cancellable {
private final Side side;
// Paper start
@ApiStatus.Internal
public SignChangeEvent(@NotNull final Block theBlock, @NotNull final Player player, @NotNull final java.util.List<net.kyori.adventure.text.Component> adventure$lines, @NotNull Side side) {
super(theBlock);
this.player = player;
@@ -28,18 +30,18 @@ public class SignChangeEvent extends BlockEvent implements Cancellable {
this.side = side;
}
@Deprecated
@Deprecated(forRemoval = true)
public SignChangeEvent(@NotNull final Block theBlock, @NotNull final Player player, @NotNull final java.util.List<net.kyori.adventure.text.Component> adventure$lines) {
this(theBlock, player, adventure$lines, Side.FRONT);
}
// Paper end
@Deprecated(since = "1.19.4")
@Deprecated(since = "1.19.4", forRemoval = true)
public SignChangeEvent(@NotNull final Block theBlock, @NotNull final Player thePlayer, @NotNull final String[] theLines) {
this(theBlock, thePlayer, theLines, Side.FRONT);
}
@Deprecated // Paper
@Deprecated(forRemoval = true)
public SignChangeEvent(@NotNull final Block theBlock, @NotNull final Player thePlayer, @NotNull final String[] theLines, @NotNull Side side) {
super(theBlock);
this.player = thePlayer;
@@ -57,7 +57,7 @@ public class CreatureSpawnEvent extends EntitySpawnEvent {
* {@link ChunkLoadEvent#isNewChunk()} and {@link Chunk#getEntities()}
* for similar effect.
*/
@Deprecated(since = "1.14")
@Deprecated(since = "1.14", forRemoval = true)
CHUNK_GEN,
/**
* When a creature spawns from a spawner
@@ -2,6 +2,7 @@ package org.bukkit.event.entity;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -11,11 +12,12 @@ import org.jetbrains.annotations.Nullable;
public class EntityCombustByBlockEvent extends EntityCombustEvent {
private final Block combuster;
@Deprecated(since = "1.21")
@Deprecated(since = "1.21", forRemoval = true)
public EntityCombustByBlockEvent(@Nullable final Block combuster, @NotNull final Entity combustee, final int duration) {
this(combuster, combustee, (float) duration);
}
@ApiStatus.Internal
public EntityCombustByBlockEvent(@Nullable final Block combuster, @NotNull final Entity combustee, final float duration) {
super(combustee, duration);
this.combuster = combuster;
@@ -1,6 +1,7 @@
package org.bukkit.event.entity;
import org.bukkit.entity.Entity;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -9,11 +10,12 @@ import org.jetbrains.annotations.NotNull;
public class EntityCombustByEntityEvent extends EntityCombustEvent {
private final Entity combuster;
@Deprecated(since = "1.21")
@Deprecated(since = "1.21", forRemoval = true)
public EntityCombustByEntityEvent(@NotNull final Entity combuster, @NotNull final Entity combustee, final int duration) {
this(combuster, combustee, (float) duration);
}
@ApiStatus.Internal
public EntityCombustByEntityEvent(@NotNull final Entity combuster, @NotNull final Entity combustee, final float duration) {
super(combustee, duration);
this.combuster = combuster;
@@ -3,6 +3,7 @@ package org.bukkit.event.entity;
import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -15,11 +16,12 @@ public class EntityCombustEvent extends EntityEvent implements Cancellable {
private float duration;
private boolean cancel;
@Deprecated(since = "1.21")
@Deprecated(since = "1.21", forRemoval = true)
public EntityCombustEvent(@NotNull final Entity combustee, final int duration) {
this(combustee, (float) duration);
}
@ApiStatus.Internal
public EntityCombustEvent(@NotNull final Entity combustee, final float duration) {
super(combustee);
this.duration = duration;
@@ -20,7 +20,7 @@ public class EntityDamageByEntityEvent extends EntityDamageEvent {
this(damager, damagee, cause, DamageSource.builder(DamageType.GENERIC).build(), damage);
}
@Deprecated
@Deprecated(forRemoval = true)
public EntityDamageByEntityEvent(@NotNull final Entity damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, final double damage) {
super(damagee, cause, damageSource, damage);
this.damager = damager;
@@ -32,7 +32,7 @@ public class EntityDamageByEntityEvent extends EntityDamageEvent {
this(damager, damagee, cause, DamageSource.builder(DamageType.GENERIC).build(), modifiers, modifierFunctions);
}
@Deprecated
@Deprecated(forRemoval = true)
public EntityDamageByEntityEvent(@NotNull final Entity damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, @NotNull final Map<DamageModifier, Double> modifiers, @NotNull final Map<DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) {
super(damagee, cause, damageSource, modifiers, modifierFunctions);
this.damager = damager;
@@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.EquipmentSlot;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -26,6 +27,7 @@ public class EntityPlaceEvent extends EntityEvent implements Cancellable {
private final BlockFace blockFace;
private final EquipmentSlot hand;
@ApiStatus.Internal
public EntityPlaceEvent(@NotNull final Entity entity, @Nullable final Player player, @NotNull final Block block, @NotNull final BlockFace blockFace, @NotNull final EquipmentSlot hand) {
super(entity);
this.player = player;
@@ -34,7 +36,7 @@ public class EntityPlaceEvent extends EntityEvent implements Cancellable {
this.hand = hand;
}
@Deprecated(since = "1.19.2")
@Deprecated(since = "1.19.2", forRemoval = true)
public EntityPlaceEvent(@NotNull final Entity entity, @Nullable final Player player, @NotNull final Block block, @NotNull final BlockFace blockFace) {
this(entity, player, block, blockFace, EquipmentSlot.HAND);
}
@@ -221,7 +221,7 @@ public class EntityPotionEffectEvent extends EntityEvent implements Cancellable
*
* @deprecated no longer used, player now gets an ominous bottle instead
*/
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21", forRemoval = true)
PATROL_CAPTAIN,
/**
* When a potion effect is modified through the plugin methods.
@@ -4,6 +4,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.EquipmentSlot;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -20,12 +21,13 @@ public class EntityResurrectEvent extends EntityEvent implements Cancellable {
private final EquipmentSlot hand;
@ApiStatus.Internal
public EntityResurrectEvent(@NotNull LivingEntity what, @Nullable EquipmentSlot hand) {
super(what);
this.hand = hand;
}
@Deprecated(since = "1.19.2")
@Deprecated(since = "1.19.2", forRemoval = true)
public EntityResurrectEvent(@NotNull LivingEntity what) {
this(what, null);
}
@@ -7,6 +7,7 @@ import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -38,16 +39,18 @@ public class EntityShootBowEvent extends EntityEvent implements Cancellable {
return this.getConsumable();
}
@Deprecated
@Deprecated(forRemoval = true)
public EntityShootBowEvent(@NotNull final LivingEntity shooter, @Nullable final ItemStack bow, @NotNull final Entity projectile, final float force) {
this(shooter, bow, new ItemStack(org.bukkit.Material.AIR), projectile, force);
}
@Deprecated
@Deprecated(forRemoval = true)
public EntityShootBowEvent(@NotNull final LivingEntity shooter, @Nullable final ItemStack bow, @NotNull ItemStack arrowItem, @NotNull final Entity projectile, final float force) {
this(shooter, bow, arrowItem, projectile, EquipmentSlot.HAND, force, true);
}
// Paper end
@ApiStatus.Internal
public EntityShootBowEvent(@NotNull final LivingEntity shooter, @Nullable final ItemStack bow, @Nullable final ItemStack consumable, @NotNull final Entity projectile, @NotNull final EquipmentSlot hand, final float force, final boolean consumeItem) {
super(shooter);
this.bow = bow;
@@ -105,7 +105,7 @@ public class EntityTargetEvent extends EntityEvent implements Cancellable {
*
* @deprecated obsoleted by {@link #TARGET_ATTACKED_NEARBY_ENTITY}
*/
@Deprecated(since = "1.13")
@Deprecated(since = "1.13", forRemoval = true)
PIG_ZOMBIE_TARGET,
/**
* When the target is forgotten for whatever reason.
@@ -2,6 +2,7 @@ package org.bukkit.event.entity;
import org.bukkit.entity.Entity;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -22,11 +23,12 @@ public class EntityUnleashEvent extends EntityEvent implements org.bukkit.event.
private boolean cancelled; // Paper
// Paper start - drop leash variable
@Deprecated
@Deprecated(forRemoval = true)
public EntityUnleashEvent(@NotNull Entity entity, @NotNull UnleashReason reason) {
this(entity, reason, false);
}
@ApiStatus.Internal
public EntityUnleashEvent(@NotNull Entity entity, @NotNull UnleashReason reason, boolean dropLeash) {
super(entity);
// Paper end
@@ -5,6 +5,7 @@ import org.bukkit.block.BlockFace;
import org.bukkit.entity.Entity;
import org.bukkit.entity.ThrownExpBottle;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -16,11 +17,12 @@ public class ExpBottleEvent extends ProjectileHitEvent {
private int exp;
private boolean showEffect = true;
@Deprecated(since = "1.20.2")
@Deprecated(since = "1.20.2", forRemoval = true)
public ExpBottleEvent(@NotNull final ThrownExpBottle bottle, final int exp) {
this(bottle, null, null, null, exp);
}
@ApiStatus.Internal
public ExpBottleEvent(@NotNull final ThrownExpBottle bottle, @Nullable Entity hitEntity, @Nullable Block hitBlock, @Nullable BlockFace hitFace, final int exp) {
super(bottle, hitEntity, hitBlock, hitFace);
this.exp = exp;
@@ -2,6 +2,7 @@ package org.bukkit.event.entity;
import org.bukkit.Location;
import org.bukkit.entity.Item;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -9,11 +10,12 @@ import org.jetbrains.annotations.NotNull;
*/
public class ItemSpawnEvent extends EntitySpawnEvent {
@Deprecated(since = "1.13.2")
@Deprecated(since = "1.13.2", forRemoval = true)
public ItemSpawnEvent(@NotNull final Item spawnee, final Location loc) {
this(spawnee);
}
@ApiStatus.Internal
public ItemSpawnEvent(@NotNull final Item spawnee) {
super(spawnee);
}
@@ -7,6 +7,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -19,11 +20,12 @@ public class LingeringPotionSplashEvent extends ProjectileHitEvent implements Ca
private final AreaEffectCloud entity;
private boolean allowEmptyAreaEffectCreation; // Paper
@Deprecated(since = "1.20.2")
@Deprecated(since = "1.20.2", forRemoval = true)
public LingeringPotionSplashEvent(@NotNull final ThrownPotion potion, @NotNull final AreaEffectCloud entity) {
this(potion, null, null, null, entity);
}
@ApiStatus.Internal
public LingeringPotionSplashEvent(@NotNull final ThrownPotion potion, @Nullable Entity hitEntity, @Nullable Block hitBlock, @Nullable BlockFace hitFace, @NotNull final AreaEffectCloud entity) {
super(potion, hitEntity, hitBlock, hitFace);
this.entity = entity;
@@ -34,6 +34,7 @@ public class PlayerDeathEvent extends EntityDeathEvent {
// Paper start - shouldDropExperience API
this(player, damageSource, drops, droppedExp, newExp, newTotalExp, newLevel, deathMessage, true);
}
@org.jetbrains.annotations.ApiStatus.Internal
public PlayerDeathEvent(final @NotNull Player player, final @NotNull DamageSource damageSource, final @NotNull List<ItemStack> drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, final @Nullable net.kyori.adventure.text.Component deathMessage, final boolean doExpDrop) {
// Paper end - shouldDropExperience API
@@ -46,23 +47,23 @@ public class PlayerDeathEvent extends EntityDeathEvent {
}
// Paper end - adventure
@Deprecated // Paper
@Deprecated(forRemoval = true)
public PlayerDeathEvent(@NotNull final Player player, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops, final int droppedExp, @Nullable final String deathMessage) {
this(player, damageSource, drops, droppedExp, 0, deathMessage);
}
@Deprecated // Paper
@Deprecated(forRemoval = true)
public PlayerDeathEvent(@NotNull final Player player, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops, final int droppedExp, final int newExp, @Nullable final String deathMessage) {
this(player, damageSource, drops, droppedExp, newExp, 0, 0, deathMessage);
}
@Deprecated // Paper
@Deprecated(forRemoval = true)
public PlayerDeathEvent(@NotNull final Player player, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, @Nullable final String deathMessage) {
// Paper start - shouldDropExperience API
this(player, damageSource, drops, droppedExp, newExp, newTotalExp, newLevel, deathMessage, true);
}
@Deprecated // Paper
@Deprecated(forRemoval = true)
public PlayerDeathEvent(@NotNull final Player player, final @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, @Nullable final String deathMessage, boolean doExpDrop) {
// Paper end - shouldDropExperience API
super(player, damageSource, drops, droppedExp);
@@ -6,6 +6,7 @@ import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.EquipmentSlot;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -19,6 +20,7 @@ public class PlayerLeashEntityEvent extends Event implements Cancellable {
private final Player player;
private final EquipmentSlot hand;
@ApiStatus.Internal
public PlayerLeashEntityEvent(@NotNull Entity what, @NotNull Entity leashHolder, @NotNull Player leasher, @NotNull EquipmentSlot hand) {
this.leashHolder = leashHolder;
this.entity = what;
@@ -26,7 +28,7 @@ public class PlayerLeashEntityEvent extends Event implements Cancellable {
this.hand = hand;
}
@Deprecated(since = "1.19.2")
@Deprecated(since = "1.19.2", forRemoval = true)
public PlayerLeashEntityEvent(@NotNull Entity what, @NotNull Entity leashHolder, @NotNull Player leasher) {
this(what, leashHolder, leasher, EquipmentSlot.HAND);
}
@@ -11,6 +11,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -22,11 +23,12 @@ public class PotionSplashEvent extends ProjectileHitEvent implements Cancellable
private boolean cancelled;
protected final Map<LivingEntity, Double> affectedEntities; // Paper
@Deprecated(since = "1.20.2")
@Deprecated(since = "1.20.2", forRemoval = true)
public PotionSplashEvent(@NotNull final ThrownPotion potion, @NotNull final Map<LivingEntity, Double> affectedEntities) {
this(potion, null, null, null, affectedEntities);
}
@ApiStatus.Internal
public PotionSplashEvent(@NotNull final ThrownPotion potion, @Nullable Entity hitEntity, @Nullable Block hitBlock, @Nullable BlockFace hitFace, @NotNull final Map<LivingEntity, Double> affectedEntities) {
super(potion, hitEntity, hitBlock, hitFace);
this.affectedEntities = affectedEntities;
@@ -6,6 +6,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Projectile;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -19,27 +20,27 @@ public class ProjectileHitEvent extends EntityEvent implements Cancellable {
private final BlockFace hitFace;
private boolean cancel = false;
@Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
@Deprecated(forRemoval = true) @io.papermc.paper.annotation.DoNotUse // Paper
public ProjectileHitEvent(@NotNull final Projectile projectile) {
this(projectile, null, null, null); // Paper
}
@Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
@Deprecated(forRemoval = true) @io.papermc.paper.annotation.DoNotUse // Paper
public ProjectileHitEvent(@NotNull final Projectile projectile, @Nullable Entity hitEntity) {
this(projectile, hitEntity, null, null); // Paper
}
@Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
@Deprecated(forRemoval = true) @io.papermc.paper.annotation.DoNotUse // Paper
public ProjectileHitEvent(@NotNull final Projectile projectile, @Nullable Block hitBlock) {
this(projectile, null, hitBlock, null); // Paper
}
@Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
@Deprecated(forRemoval = true) @io.papermc.paper.annotation.DoNotUse // Paper
public ProjectileHitEvent(@NotNull final Projectile projectile, @Nullable Entity hitEntity, @Nullable Block hitBlock) {
this(projectile, hitEntity, hitBlock, null);
}
@org.jetbrains.annotations.ApiStatus.Internal // Paper
@ApiStatus.Internal
public ProjectileHitEvent(@NotNull final Projectile projectile, @Nullable Entity hitEntity, @Nullable Block hitBlock, @Nullable BlockFace hitFace) {
super(projectile);
this.hitEntity = hitEntity;
@@ -5,6 +5,7 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -14,11 +15,12 @@ import org.jetbrains.annotations.Nullable;
public class SheepDyeWoolEvent extends io.papermc.paper.event.entity.EntityDyeEvent implements Cancellable {
// Paper - move everything to superclass
@Deprecated(since = "1.17.1")
@Deprecated(since = "1.17.1", forRemoval = true)
public SheepDyeWoolEvent(@NotNull final Sheep sheep, @NotNull final DyeColor color) {
this(sheep, color, null);
}
@ApiStatus.Internal
public SheepDyeWoolEvent(@NotNull final Sheep sheep, @NotNull final DyeColor color, @Nullable Player player) {
super(sheep, color, player); // Paper
}
@@ -8,6 +8,7 @@ import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -28,6 +29,7 @@ public class HangingPlaceEvent extends HangingEvent implements Cancellable {
this(hanging, player, block, blockFace, hand, null);
}
@ApiStatus.Internal
public HangingPlaceEvent(@NotNull final Hanging hanging, @Nullable final Player player, @NotNull final Block block, @NotNull final BlockFace blockFace, @Nullable final EquipmentSlot hand, @Nullable ItemStack itemStack) {
super(hanging);
this.player = player;
@@ -3,6 +3,7 @@ package org.bukkit.event.inventory;
import org.bukkit.block.Block;
import org.bukkit.event.block.BlockCookEvent;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -12,13 +13,13 @@ import org.jetbrains.annotations.NotNull;
*/
public class FurnaceSmeltEvent extends BlockCookEvent {
@Deprecated // Paper
@Deprecated(forRemoval = true)
public FurnaceSmeltEvent(@NotNull final Block furnace, @NotNull final ItemStack source, @NotNull final ItemStack result) {
super(furnace, source, result);
}
// Paper start
@ApiStatus.Internal
public FurnaceSmeltEvent(@NotNull final Block furnace, @NotNull final ItemStack source, @NotNull final ItemStack result, @org.jetbrains.annotations.Nullable org.bukkit.inventory.CookingRecipe<?> recipe) {
super(furnace, source, result, recipe);
}
// Paper end
}
@@ -5,6 +5,7 @@ import org.bukkit.event.HandlerList;
import org.bukkit.event.block.InventoryBlockStartEvent;
import org.bukkit.inventory.CookingRecipe;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -18,12 +19,13 @@ public class FurnaceStartSmeltEvent extends InventoryBlockStartEvent {
private final CookingRecipe<?> recipe;
private int totalCookTime;
@Deprecated // Paper - furnace cook speed multiplier
@Deprecated(forRemoval = true)
public FurnaceStartSmeltEvent(@NotNull final Block furnace, @NotNull ItemStack source, @NotNull final CookingRecipe<?> recipe) {
// Paper start
this(furnace, source, recipe, recipe.getCookingTime());
}
@ApiStatus.Internal
public FurnaceStartSmeltEvent(final @NotNull Block furnace, final @NotNull ItemStack source, final @NotNull CookingRecipe<?> recipe, final int cookingTime) {
// Paper end
super(furnace, source);
@@ -72,7 +72,7 @@ public enum InventoryAction {
* The hotbar includes the player's off hand.
* @deprecated This action no longer happens, they are all {@link #HOTBAR_SWAP}s.
*/
@Deprecated(since = "1.20.6") // Paper
@Deprecated(since = "1.20.6", forRemoval = true) // Paper
HOTBAR_MOVE_AND_READD,
/**
* The clicked slot and the picked hotbar slot are swapped.
@@ -4,6 +4,7 @@ import java.net.InetAddress;
import java.util.UUID;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -28,16 +29,17 @@ public class AsyncPlayerPreLoginEvent extends Event {
private final String hostname; // Paper
private final boolean transferred;
@Deprecated(since = "1.7.5")
@Deprecated(since = "1.7.5", forRemoval = true)
public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress) {
this(name, ipAddress, null);
}
@Deprecated(since = "1.20.5")
@Deprecated(since = "1.20.5", forRemoval = true)
public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final UUID uniqueId) {
this(name, ipAddress, uniqueId, false);
}
@ApiStatus.Internal
public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final UUID uniqueId, boolean transferred) {
// Paper start
this(name, ipAddress, uniqueId, transferred, org.bukkit.Bukkit.createProfile(uniqueId, name));
@@ -53,7 +55,7 @@ public class AsyncPlayerPreLoginEvent extends Event {
this(name, ipAddress, rawAddress, uniqueId, transferred, profile, "");
}
@org.jetbrains.annotations.ApiStatus.Internal
@ApiStatus.Internal
public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final InetAddress rawAddress, @NotNull final UUID uniqueId, boolean transferred, @NotNull com.destroystokyo.paper.profile.PlayerProfile profile, @NotNull String hostname) {
// Paper end
super(true);
@@ -3,6 +3,7 @@ package org.bukkit.event.player;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -14,7 +15,7 @@ public class PlayerAnimationEvent extends PlayerEvent implements Cancellable {
private final PlayerAnimationType animationType;
private boolean isCancelled = false;
@Deprecated(since = "1.19")
@Deprecated(since = "1.19", forRemoval = true)
public PlayerAnimationEvent(@NotNull final Player player) {
this(player, PlayerAnimationType.ARM_SWING);
}
@@ -25,6 +26,7 @@ public class PlayerAnimationEvent extends PlayerEvent implements Cancellable {
* @param player The player instance
* @param playerAnimationType The animation type
*/
@ApiStatus.Internal
public PlayerAnimationEvent(@NotNull final Player player, @NotNull final PlayerAnimationType playerAnimationType) {
super(player);
animationType = playerAnimationType;
@@ -26,7 +26,7 @@ public class PlayerArmorStandManipulateEvent extends PlayerInteractEntityEvent {
this.slot = slot;
}
@Deprecated(since = "1.19.2")
@Deprecated(since = "1.19.2", forRemoval = true)
public PlayerArmorStandManipulateEvent(@NotNull final Player who, @NotNull final ArmorStand clickedEntity, @NotNull final ItemStack playerItem, @NotNull final ItemStack armorStandItem, @NotNull final EquipmentSlot slot) {
this(who, clickedEntity, playerItem, armorStandItem, slot, EquipmentSlot.HAND);
}
@@ -21,7 +21,7 @@ public class PlayerAttemptPickupItemEvent extends PlayerEvent implements Cancell
private boolean cancelled;
@Deprecated // Remove in 1.13 // Remove in 1.14?
@Deprecated(forRemoval = true) // Remove in 1.13 // Remove in 1.14? // Remove before the heat death of the universe?
@ApiStatus.Internal
public PlayerAttemptPickupItemEvent(final Player player, final Item item) {
this(player, item, 0);
@@ -5,6 +5,7 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -63,13 +64,14 @@ public class PlayerBedEnterEvent extends PlayerEvent implements Cancellable {
private final BedEnterResult bedEnterResult;
private Result useBed = Result.DEFAULT;
@ApiStatus.Internal
public PlayerBedEnterEvent(@NotNull Player who, @NotNull Block bed, @NotNull BedEnterResult bedEnterResult) {
super(who);
this.bed = bed;
this.bedEnterResult = bedEnterResult;
}
@Deprecated(since = "1.13.2")
@Deprecated(since = "1.13.2", forRemoval = true)
public PlayerBedEnterEvent(@NotNull Player who, @NotNull Block bed) {
this(who, bed, BedEnterResult.OK);
}
@@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -15,16 +16,17 @@ import org.jetbrains.annotations.NotNull;
public class PlayerBucketEmptyEvent extends PlayerBucketEvent {
private static final HandlerList handlers = new HandlerList();
@Deprecated(since = "1.14.4")
@Deprecated(since = "1.14.4", forRemoval = true)
public PlayerBucketEmptyEvent(@NotNull final Player who, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand) {
super(who, blockClicked, blockFace, bucket, itemInHand);
}
@Deprecated(since = "1.19.2")
@Deprecated(since = "1.19.2", forRemoval = true)
public PlayerBucketEmptyEvent(@NotNull final Player who, @NotNull final Block block, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand) {
super(who, block, blockClicked, blockFace, bucket, itemInHand);
}
@ApiStatus.Internal
public PlayerBucketEmptyEvent(@NotNull final Player who, @NotNull final Block block, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand, @NotNull final EquipmentSlot hand) {
super(who, block, blockClicked, blockFace, bucket, itemInHand, hand);
}
@@ -9,6 +9,7 @@ import org.bukkit.event.Cancellable;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.MaterialData;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -24,16 +25,17 @@ public abstract class PlayerBucketEvent extends PlayerEvent implements Cancellab
private final Material bucket;
private final EquipmentSlot hand;
@Deprecated(since = "1.14.4")
@Deprecated(since = "1.14.4", forRemoval = true)
public PlayerBucketEvent(@NotNull final Player who, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand) {
this(who, null, blockClicked.getRelative(blockFace), blockFace, bucket, itemInHand, EquipmentSlot.HAND);
}
@Deprecated(since = "1.19.2")
@Deprecated(since = "1.19.2", forRemoval = true)
public PlayerBucketEvent(@NotNull final Player who, @NotNull final Block block, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand) {
this(who, block, blockClicked, blockFace, bucket, itemInHand, EquipmentSlot.HAND);
}
@ApiStatus.Internal
public PlayerBucketEvent(@NotNull final Player who, @NotNull final Block block, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand, @NotNull final EquipmentSlot hand) {
super(who);
this.block = block;
@@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -15,16 +16,17 @@ import org.jetbrains.annotations.NotNull;
public class PlayerBucketFillEvent extends PlayerBucketEvent {
private static final HandlerList handlers = new HandlerList();
@Deprecated(since = "1.14.4")
@Deprecated(since = "1.14.4", forRemoval = true)
public PlayerBucketFillEvent(@NotNull final Player who, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand) {
super(who, blockClicked, blockFace, bucket, itemInHand);
}
@Deprecated(since = "1.19.2")
@Deprecated(since = "1.19.2", forRemoval = true)
public PlayerBucketFillEvent(@NotNull final Player who, @NotNull final Block block, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand) {
super(who, block, blockClicked, blockFace, bucket, itemInHand);
}
@ApiStatus.Internal
public PlayerBucketFillEvent(@NotNull final Player who, @NotNull final Block block, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand, @NotNull final EquipmentSlot hand) {
super(who, block, blockClicked, blockFace, bucket, itemInHand, hand);
}
@@ -74,7 +74,7 @@ public class PlayerEditBookEvent extends PlayerEvent implements Cancellable {
* @return the inventory slot number that the book item occupies
* @deprecated books may be signed from off hand
*/
@Deprecated(since = "1.13.1")
@Deprecated(since = "1.13.1", forRemoval = true)
public int getSlot() {
return slot;
}
@@ -4,6 +4,7 @@ import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -22,12 +23,13 @@ public class PlayerGameModeChangeEvent extends PlayerEvent implements Cancellabl
private final Cause cause;
private net.kyori.adventure.text.Component cancelMessage;
@Deprecated // Paper end
@Deprecated(forRemoval = true) // Paper end
public PlayerGameModeChangeEvent(@NotNull final Player player, @NotNull final GameMode newGameMode) {
// Paper start
this(player, newGameMode, Cause.UNKNOWN, null);
}
@ApiStatus.Internal
public PlayerGameModeChangeEvent(@NotNull final Player player, @NotNull final GameMode newGameMode, @NotNull Cause cause, @org.jetbrains.annotations.Nullable net.kyori.adventure.text.Component cancelMessage) {
// Paper end
super(player);
@@ -7,6 +7,7 @@ import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -27,6 +28,7 @@ public class PlayerHarvestBlockEvent extends PlayerEvent implements Cancellable
private final EquipmentSlot hand;
private final List<ItemStack> itemsHarvested;
@ApiStatus.Internal
public PlayerHarvestBlockEvent(@NotNull Player player, @NotNull Block harvestedBlock, @NotNull EquipmentSlot hand, @NotNull List<ItemStack> itemsHarvested) {
super(player);
this.harvestedBlock = harvestedBlock;
@@ -34,7 +36,7 @@ public class PlayerHarvestBlockEvent extends PlayerEvent implements Cancellable
this.itemsHarvested = itemsHarvested;
}
@Deprecated(since = "1.19.2")
@Deprecated(since = "1.19.2", forRemoval = true)
public PlayerHarvestBlockEvent(@NotNull Player player, @NotNull Block harvestedBlock, @NotNull List<ItemStack> itemsHarvested) {
this(player, harvestedBlock, EquipmentSlot.HAND, itemsHarvested);
}
@@ -6,6 +6,7 @@ import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -31,6 +32,7 @@ public class PlayerItemConsumeEvent extends PlayerEvent implements Cancellable {
* @param item the ItemStack being consumed
* @param hand the hand that was used
*/
@ApiStatus.Internal
public PlayerItemConsumeEvent(@NotNull final Player player, @NotNull final ItemStack item, @NotNull final EquipmentSlot hand) {
super(player);
@@ -43,7 +45,7 @@ public class PlayerItemConsumeEvent extends PlayerEvent implements Cancellable {
* @param item the ItemStack being consumed
* @deprecated use {@link #PlayerItemConsumeEvent(Player, ItemStack, EquipmentSlot)}
*/
@Deprecated(since = "1.19.2")
@Deprecated(since = "1.19.2", forRemoval = true)
public PlayerItemConsumeEvent(@NotNull final Player player, @NotNull final ItemStack item) {
this(player, item, EquipmentSlot.HAND);
}
@@ -4,6 +4,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -14,16 +15,17 @@ public class PlayerItemDamageEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final ItemStack item;
private final int originalDamage;
private int damage;
private int originalDamage; // Paper - Add pre-reduction damage
private boolean cancelled = false;
@Deprecated // Paper - Add pre-reduction damage
@Deprecated(forRemoval = true)
public PlayerItemDamageEvent(@NotNull Player player, @NotNull ItemStack what, int damage) {
// Paper start - Add pre-reduction damage
this(player, what, damage, damage);
}
@ApiStatus.Internal
public PlayerItemDamageEvent(@NotNull Player player, @NotNull ItemStack what, int damage, int originalDamage) {
super(player);
this.item = what;
@@ -6,6 +6,7 @@ import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
@@ -26,13 +27,13 @@ public class PlayerItemMendEvent extends PlayerEvent implements Cancellable {
private boolean cancelled;
private final int consumedExperience; // Paper
@Deprecated // Paper
@Deprecated(forRemoval = true) // Paper
public PlayerItemMendEvent(@NotNull Player who, @NotNull ItemStack item, @NotNull EquipmentSlot slot, @NotNull ExperienceOrb experienceOrb, int repairAmount) {
// Paper start
this(who, item, slot, experienceOrb, repairAmount, repairAmount / 2);
}
@org.jetbrains.annotations.ApiStatus.Internal
@ApiStatus.Internal
public PlayerItemMendEvent(@NotNull Player who, @NotNull ItemStack item, @NotNull EquipmentSlot slot, @NotNull ExperienceOrb experienceOrb, int repairAmount, int consumedExperience) {
// Paper end
super(who);
@@ -86,7 +87,7 @@ public class PlayerItemMendEvent extends PlayerEvent implements Cancellable {
}
// Paper end
@Deprecated(since = "1.19.2")
@Deprecated(since = "1.19.2", forRemoval = true)
public PlayerItemMendEvent(@NotNull Player who, @NotNull ItemStack item, @NotNull ExperienceOrb experienceOrb, int repairAmount) {
this(who, item, null, experienceOrb, repairAmount);
}
@@ -2,6 +2,7 @@ package org.bukkit.event.player;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -12,12 +13,14 @@ public class PlayerJoinEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
// Paper start
private net.kyori.adventure.text.Component joinMessage;
@ApiStatus.Internal
public PlayerJoinEvent(@NotNull final Player playerJoined, @Nullable final net.kyori.adventure.text.Component joinMessage) {
super(playerJoined);
this.joinMessage = joinMessage;
}
@Deprecated // Paper end
@Deprecated(forRemoval = true) // Paper end
public PlayerJoinEvent(@NotNull final Player playerJoined, @Nullable final String joinMessage) {
super(playerJoined);
this.joinMessage = joinMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(joinMessage) : null; // Paper end
@@ -3,6 +3,7 @@ package org.bukkit.event.player;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -15,7 +16,7 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable {
private final Cause cause; // Paper
private boolean cancel;
@Deprecated // Paper
@Deprecated(forRemoval = true)
public PlayerKickEvent(@NotNull final Player playerKicked, @NotNull final String kickReason, @NotNull final String leaveMessage) {
super(playerKicked);
this.kickReason = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(kickReason); // Paper
@@ -24,7 +25,7 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable {
this.cancel = false;
}
// Paper start
@Deprecated
@Deprecated(forRemoval = true)
public PlayerKickEvent(@NotNull final Player playerKicked, @NotNull final net.kyori.adventure.text.Component kickReason, @NotNull final net.kyori.adventure.text.Component leaveMessage) {
super(playerKicked);
this.kickReason = kickReason;
@@ -33,7 +34,7 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable {
this.cause = Cause.UNKNOWN;
}
@org.jetbrains.annotations.ApiStatus.Internal
@ApiStatus.Internal
public PlayerKickEvent(@NotNull final Player playerKicked, @NotNull final net.kyori.adventure.text.Component kickReason, @NotNull final net.kyori.adventure.text.Component leaveMessage, @NotNull final Cause cause) {
super(playerKicked);
this.kickReason = kickReason;
@@ -3,6 +3,7 @@ package org.bukkit.event.player;
import java.net.InetAddress;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -30,6 +31,7 @@ public class PlayerLoginEvent extends PlayerEvent {
* timing issues
* @param realAddress the actual, unspoofed connecting address
*/
@ApiStatus.Internal
public PlayerLoginEvent(@NotNull final Player player, @NotNull final String hostname, @NotNull final InetAddress address, final @NotNull InetAddress realAddress) {
super(player);
this.hostname = hostname;
@@ -46,6 +48,7 @@ public class PlayerLoginEvent extends PlayerEvent {
* @param address The address the player used to connect, provided for
* timing issues
*/
@ApiStatus.Internal
public PlayerLoginEvent(@NotNull final Player player, @NotNull final String hostname, @NotNull final InetAddress address) {
this(player, hostname, address, address);
}
@@ -62,7 +65,7 @@ public class PlayerLoginEvent extends PlayerEvent {
* @param realAddress the actual, unspoofed connecting address
* @deprecated in favour of {@link #PlayerLoginEvent(Player, String, InetAddress, Result, net.kyori.adventure.text.Component, InetAddress)}
*/
@Deprecated // Paper
@Deprecated(forRemoval = true)
public PlayerLoginEvent(@NotNull final Player player, @NotNull String hostname, @NotNull final InetAddress address, @NotNull final Result result, @NotNull final String message, @NotNull final InetAddress realAddress) {
this(player, hostname, address, realAddress);
this.result = result;
@@ -81,6 +84,7 @@ public class PlayerLoginEvent extends PlayerEvent {
* @param message The message to be displayed if result denies login
* @param realAddress the actual, unspoofed connecting address
*/
@ApiStatus.Internal
public PlayerLoginEvent(@NotNull final Player player, @NotNull String hostname, @NotNull final InetAddress address, @NotNull final Result result, @NotNull final net.kyori.adventure.text.Component message, @NotNull final InetAddress realAddress) {
this(player, hostname, address, realAddress); // Spigot
this.result = result;
@@ -62,7 +62,7 @@ public class PlayerPortalEvent extends PlayerTeleportEvent {
* @return no effect
* @deprecated No effect
*/
@Deprecated
@Deprecated(forRemoval = true)
@Override
public boolean willDismountPlayer() {
return super.willDismountPlayer();
@@ -73,7 +73,7 @@ public class PlayerPortalEvent extends PlayerTeleportEvent {
* @return no effect
* @deprecated No effect
*/
@Deprecated
@Deprecated(forRemoval = true)
@Override
public @NotNull java.util.Set<io.papermc.paper.entity.TeleportFlag.@NotNull Relative> getRelativeTeleportationFlags() {
return super.getRelativeTeleportationFlags();
@@ -5,6 +5,7 @@ import java.util.UUID;
import org.bukkit.Warning;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -31,11 +32,12 @@ public class PlayerPreLoginEvent extends Event {
private final InetAddress ipAddress;
private final UUID uniqueId;
@Deprecated(since = "1.7.5")
@Deprecated(since = "1.7.5", forRemoval = true)
public PlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress) {
this(name, ipAddress, null);
}
@ApiStatus.Internal
public PlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final UUID uniqueId) {
this.result = Result.ALLOWED;
this.message = net.kyori.adventure.text.Component.empty(); // Paper
@@ -2,6 +2,7 @@ package org.bukkit.event.player;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -13,22 +14,24 @@ public class PlayerQuitEvent extends PlayerEvent {
private net.kyori.adventure.text.Component quitMessage; // Paper
private final QuitReason reason; // Paper
@Deprecated // Paper
@Deprecated(forRemoval = true)
public PlayerQuitEvent(@NotNull final Player who, @Nullable final String quitMessage) {
// Paper start
this(who, quitMessage, null);
}
@Deprecated // Paper
@Deprecated(forRemoval = true)
public PlayerQuitEvent(@NotNull final Player who, @Nullable final String quitMessage, @Nullable QuitReason quitReason) {
super(who);
this.quitMessage = quitMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(quitMessage) : null; // Paper
this.reason = quitReason == null ? QuitReason.DISCONNECTED : quitReason;
}
// Paper start
@Deprecated
@Deprecated(forRemoval = true)
public PlayerQuitEvent(@NotNull final Player who, @Nullable final net.kyori.adventure.text.Component quitMessage) {
this(who, quitMessage, null);
}
@ApiStatus.Internal
public PlayerQuitEvent(@NotNull final Player who, @Nullable final net.kyori.adventure.text.Component quitMessage, @Nullable QuitReason quitReason) {
super(who);
this.quitMessage = quitMessage;
@@ -4,6 +4,7 @@ import com.google.common.base.Preconditions;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -17,37 +18,36 @@ public class PlayerRespawnEvent extends PlayerEvent {
private Location respawnLocation;
private final boolean isBedSpawn;
private final boolean isAnchorSpawn;
private final boolean missingRespawnBlock;
private final RespawnReason respawnReason;
private final java.util.Set<RespawnFlag> respawnFlags; // Paper
private final java.util.Set<RespawnFlag> respawnFlags;
@Deprecated(since = "1.16.1")
@Deprecated(since = "1.16.1", forRemoval = true)
public PlayerRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnLocation, final boolean isBedSpawn) {
this(respawnPlayer, respawnLocation, isBedSpawn, false);
}
@Deprecated(since = "1.19.4")
@Deprecated(since = "1.19.4", forRemoval = true)
public PlayerRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnLocation, final boolean isBedSpawn, final boolean isAnchorSpawn) {
this(respawnPlayer, respawnLocation, isBedSpawn, false, RespawnReason.PLUGIN);
}
@Deprecated // Paper
@Deprecated(forRemoval = true)
public PlayerRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnLocation, final boolean isBedSpawn, final boolean isAnchorSpawn, @NotNull final RespawnReason respawnReason) {
// Paper start
this(respawnPlayer, respawnLocation, isBedSpawn, isAnchorSpawn, respawnReason, com.google.common.collect.ImmutableSet.builder());
this(respawnPlayer, respawnLocation, isBedSpawn, isAnchorSpawn, false, respawnReason, com.google.common.collect.ImmutableSet.builder());
}
public PlayerRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnLocation, final boolean isBedSpawn, final boolean isAnchorSpawn, @NotNull final RespawnReason respawnReason, @NotNull final com.google.common.collect.ImmutableSet.Builder<org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag> respawnFlags) {
// Paper end
@ApiStatus.Internal
public PlayerRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnLocation, final boolean isBedSpawn, final boolean isAnchorSpawn, final boolean missingRespawnBlock, @NotNull final RespawnReason respawnReason, @NotNull final com.google.common.collect.ImmutableSet.Builder<org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag> respawnFlags) {
super(respawnPlayer);
this.respawnLocation = respawnLocation;
this.isBedSpawn = isBedSpawn;
this.isAnchorSpawn = isAnchorSpawn;
this.respawnReason = respawnReason;
// Paper start
this.missingRespawnBlock = missingRespawnBlock;
if (this.isBedSpawn) { respawnFlags.add(RespawnFlag.BED_SPAWN); }
if (this.isAnchorSpawn) { respawnFlags.add(RespawnFlag.ANCHOR_SPAWN); }
this.respawnFlags = respawnFlags.build();
// Paper end
}
/**
@@ -90,6 +90,19 @@ public class PlayerRespawnEvent extends PlayerEvent {
return isAnchorSpawn;
}
/**
* Gets whether the player is missing a valid respawn block.
* <p>
* This will occur if the players respawn block is obstructed,
* or it is the first death after it was either destroyed or
* in case of a respawn anchor, ran out of charges.
*
* @return whether the player is missing a valid respawn block
*/
public boolean isMissingRespawnBlock() {
return this.missingRespawnBlock;
}
/**
* Gets the reason this respawn event was called.
*
@@ -130,7 +143,6 @@ public class PlayerRespawnEvent extends PlayerEvent {
PLUGIN;
}
// Paper start
/**
* Get the set of flags that apply to this respawn.
*
@@ -155,5 +167,4 @@ public class PlayerRespawnEvent extends PlayerEvent {
*/
END_PORTAL,
}
// Paper end
}
@@ -4,6 +4,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -19,13 +20,14 @@ public class PlayerRiptideEvent extends PlayerEvent {
private final ItemStack item;
private final Vector velocity;
@ApiStatus.Internal
public PlayerRiptideEvent(@NotNull final Player who, @NotNull final ItemStack item, @NotNull Vector velocity) {
super(who);
this.item = item;
this.velocity = velocity;
}
@Deprecated(since = "1.20.4")
@Deprecated(since = "1.20.4", forRemoval = true)
public PlayerRiptideEvent(@NotNull final Player who, @NotNull final ItemStack item) {
this(who, item, new Vector());
}
@@ -7,6 +7,7 @@ import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -20,7 +21,7 @@ public class PlayerShearEntityEvent extends PlayerEvent implements Cancellable {
private final EquipmentSlot hand;
private java.util.List<ItemStack> drops; // Paper - custom shear drops
@org.jetbrains.annotations.ApiStatus.Internal // Paper
@ApiStatus.Internal
public PlayerShearEntityEvent(@NotNull Player who, @NotNull Entity what, @NotNull ItemStack item, @NotNull EquipmentSlot hand, final java.util.@NotNull List<ItemStack> drops) { // Paper - custom shear drops
super(who);
this.what = what;
@@ -29,7 +30,7 @@ public class PlayerShearEntityEvent extends PlayerEvent implements Cancellable {
this.drops = drops; // Paper - custom shear drops
}
@Deprecated(since = "1.15.2")
@Deprecated(since = "1.15.2", forRemoval = true)
public PlayerShearEntityEvent(@NotNull final Player who, @NotNull final Entity what) {
this(who, what, new ItemStack(Material.SHEARS), EquipmentSlot.HAND, java.util.Collections.emptyList()); // Paper - custom shear drops
}
@@ -5,6 +5,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.entity.EntityUnleashEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -18,11 +19,12 @@ public class PlayerUnleashEntityEvent extends EntityUnleashEvent implements Canc
private final EquipmentSlot hand;
// Paper start - drop leash variable
@Deprecated
@Deprecated(forRemoval = true)
public PlayerUnleashEntityEvent(@NotNull Entity entity, @NotNull Player player, @NotNull EquipmentSlot hand) {
this(entity, player, hand, false);
}
@ApiStatus.Internal
public PlayerUnleashEntityEvent(@NotNull Entity entity, @NotNull Player player, @NotNull EquipmentSlot hand, boolean dropLeash) {
super(entity, UnleashReason.PLAYER_UNLEASH, dropLeash);
// Paper end
@@ -30,7 +32,7 @@ public class PlayerUnleashEntityEvent extends EntityUnleashEvent implements Canc
this.hand = hand;
}
@Deprecated(since = "1.19.2")
@Deprecated(since = "1.19.2", forRemoval = true)
public PlayerUnleashEntityEvent(@NotNull Entity entity, @NotNull Player player) {
this(entity, player, EquipmentSlot.HAND);
}
@@ -5,6 +5,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -22,12 +23,12 @@ public class BroadcastMessageEvent extends ServerEvent implements Cancellable {
private final Set<CommandSender> recipients;
private boolean cancelled = false;
@Deprecated(since = "1.14")
@Deprecated(since = "1.14", forRemoval = true)
public BroadcastMessageEvent(@NotNull String message, @NotNull Set<CommandSender> recipients) {
this(false, message, recipients);
}
@Deprecated // Paper
@Deprecated(forRemoval = true)
public BroadcastMessageEvent(boolean isAsync, @NotNull String message, @NotNull Set<CommandSender> recipients) {
// Paper start
super(isAsync);
@@ -35,11 +36,12 @@ public class BroadcastMessageEvent extends ServerEvent implements Cancellable {
this.recipients = recipients;
}
@Deprecated
@Deprecated(forRemoval = true)
public BroadcastMessageEvent(net.kyori.adventure.text.@NotNull Component message, @NotNull Set<CommandSender> recipients) {
this(false, message, recipients);
}
@ApiStatus.Internal
public BroadcastMessageEvent(boolean isAsync, net.kyori.adventure.text.@NotNull Component message, @NotNull Set<CommandSender> recipients) {
// Paper end
super(isAsync);
@@ -8,6 +8,7 @@ import org.bukkit.UndefinedNullability;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.util.CachedServerIcon;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -26,6 +27,8 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
private final int numPlayers;
private int maxPlayers;
@Deprecated(forRemoval = true)
@ApiStatus.Internal
public ServerListPingEvent(@NotNull final String hostname, @NotNull final InetAddress address, @NotNull final String motd, final int numPlayers, final int maxPlayers) {
super(true);
Preconditions.checkArgument(numPlayers >= 0, "Cannot have negative number of players online", numPlayers);
@@ -47,7 +50,8 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
* @param maxPlayers the max number of players
* @deprecated in favour of {@link #ServerListPingEvent(String, java.net.InetAddress, net.kyori.adventure.text.Component, int)}
*/
@Deprecated // Paper
@Deprecated(forRemoval = true)
@ApiStatus.Internal
protected ServerListPingEvent(@NotNull final String hostname, @NotNull final InetAddress address, @NotNull final String motd, final int maxPlayers) {
super(true);
this.numPlayers = MAGIC_PLAYER_COUNT;
@@ -56,11 +60,14 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
this.motd = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(motd); // Paper
this.maxPlayers = maxPlayers;
}
// Paper start
@Deprecated
@Deprecated(forRemoval = true)
@ApiStatus.Internal
public ServerListPingEvent(@NotNull final InetAddress address, @NotNull final net.kyori.adventure.text.Component motd, final int numPlayers, final int maxPlayers) {
this("", address, motd, numPlayers, maxPlayers);
}
@ApiStatus.Internal
public ServerListPingEvent(@NotNull final String hostname, @NotNull final InetAddress address, @NotNull final net.kyori.adventure.text.Component motd, final int numPlayers, final int maxPlayers) {
super(true);
Preconditions.checkArgument(numPlayers >= 0, "Cannot have negative number of players online (%s)", numPlayers);
@@ -80,7 +87,8 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
* @param maxPlayers the max number of players
* @deprecated in favour of {@link #ServerListPingEvent(String, java.net.InetAddress, net.kyori.adventure.text.Component, int)}
*/
@Deprecated
@Deprecated(forRemoval = true)
@ApiStatus.Internal
protected ServerListPingEvent(@NotNull final InetAddress address, @NotNull final net.kyori.adventure.text.Component motd, final int maxPlayers) {
this("", address, motd, maxPlayers);
}
@@ -95,6 +103,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
* @param motd the message of the day
* @param maxPlayers the max number of players
*/
@ApiStatus.Internal
protected ServerListPingEvent(final @NotNull String hostname, final @NotNull InetAddress address, final net.kyori.adventure.text.@NotNull Component motd, final int maxPlayers) {
this.numPlayers = MAGIC_PLAYER_COUNT;
this.hostname = hostname;
@@ -118,7 +127,6 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
public void motd(net.kyori.adventure.text.@NotNull Component motd) {
this.motd = motd;
}
// Paper end
/**
* Gets the hostname that the player used to connect to the server, or
@@ -196,7 +204,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
* @return true if chat preview is enabled, false otherwise
* @deprecated chat previews have been removed
*/
@Deprecated(since = "1.19.3")
@Deprecated(since = "1.19.3", forRemoval = true)
public boolean shouldSendChatPreviews() {
return false;
}
@@ -3,6 +3,7 @@ package org.bukkit.event.vehicle;
import org.bukkit.block.Block;
import org.bukkit.entity.Vehicle;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -13,11 +14,12 @@ public class VehicleBlockCollisionEvent extends VehicleCollisionEvent {
private final org.bukkit.util.Vector velocity; // Paper
// Paper start - Add pre-collision velocity
@Deprecated
@Deprecated(forRemoval = true)
public VehicleBlockCollisionEvent(@NotNull final Vehicle vehicle, @NotNull final Block block) {
this(vehicle, block, vehicle.getVelocity());
}
@ApiStatus.Internal
public VehicleBlockCollisionEvent(@NotNull final Vehicle vehicle, @NotNull final Block block, @NotNull final org.bukkit.util.Vector velocity) { // Paper - Added velocity
super(vehicle);
this.block = block;
@@ -4,6 +4,7 @@ import org.bukkit.World;
import org.bukkit.entity.LightningStrike;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -15,11 +16,12 @@ public class LightningStrikeEvent extends WeatherEvent implements Cancellable {
private final LightningStrike bolt;
private final Cause cause;
@Deprecated(since = "1.13.1")
@Deprecated(since = "1.13.1", forRemoval = true)
public LightningStrikeEvent(@NotNull final World world, @NotNull final LightningStrike bolt) {
this(world, bolt, Cause.UNKNOWN);
}
@ApiStatus.Internal
public LightningStrikeEvent(@NotNull final World world, @NotNull final LightningStrike bolt, @NotNull final Cause cause) {
super(world);
this.bolt = bolt;
@@ -3,6 +3,7 @@ package org.bukkit.event.weather;
import org.bukkit.World;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -12,16 +13,16 @@ public class ThunderChangeEvent extends WeatherEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean canceled;
private final boolean to;
// Paper start
private final Cause cause;
@ApiStatus.Internal
public ThunderChangeEvent(@NotNull final World world, final boolean to, @NotNull final Cause cause) {
super(world);
this.to = to;
this.cause = cause;
}
@Deprecated // Paper end
@Deprecated(forRemoval = true)
public ThunderChangeEvent(@NotNull final World world, final boolean to) {
super(world);
this.to = to;
Loaded 100 of 198 files, more files were not shown because too many files have changed in this diff. Show more