Update to Minecraft 1.21

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot
2024-06-14 01:05:00 +10:00
parent 9c6bdb14e4
commit 5c69fd52f0
62 changed files with 550 additions and 610 deletions

View File

@@ -4,7 +4,6 @@ import org.bukkit.block.Block;
import org.bukkit.event.HandlerList;
import org.bukkit.event.inventory.FurnaceStartSmeltEvent;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
@@ -14,10 +13,7 @@ import org.jetbrains.annotations.NotNull;
* <li>A Brewing-Stand starts brewing {@link BrewingStartEvent}</li>
* <li>A Campfire starts cooking {@link CampfireStartEvent}</li>
* </ul>
*
* @apiNote draft API
*/
@ApiStatus.Experimental
public class InventoryBlockStartEvent extends BlockEvent {
private static final HandlerList handlers = new HandlerList();

View File

@@ -197,6 +197,10 @@ public class CreatureSpawnEvent extends EntitySpawnEvent {
* When a creature is spawned by the "/summon" command
*/
COMMAND,
/**
* When a creature is spawned by an enchantment
*/
ENCHANTMENT,
/**
* When a creature is spawned by plugins
*/

View File

@@ -11,7 +11,12 @@ import org.jetbrains.annotations.Nullable;
public class EntityCombustByBlockEvent extends EntityCombustEvent {
private final Block combuster;
@Deprecated
public EntityCombustByBlockEvent(@Nullable final Block combuster, @NotNull final Entity combustee, final int duration) {
this(combuster, combustee, (float) duration);
}
public EntityCombustByBlockEvent(@Nullable final Block combuster, @NotNull final Entity combustee, final float duration) {
super(combustee, duration);
this.combuster = combuster;
}

View File

@@ -9,7 +9,12 @@ import org.jetbrains.annotations.NotNull;
public class EntityCombustByEntityEvent extends EntityCombustEvent {
private final Entity combuster;
@Deprecated
public EntityCombustByEntityEvent(@NotNull final Entity combuster, @NotNull final Entity combustee, final int duration) {
this(combuster, combustee, (float) duration);
}
public EntityCombustByEntityEvent(@NotNull final Entity combuster, @NotNull final Entity combustee, final float duration) {
super(combustee, duration);
this.combuster = combuster;
}

View File

@@ -12,10 +12,15 @@ import org.jetbrains.annotations.NotNull;
*/
public class EntityCombustEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private int duration;
private float duration;
private boolean cancel;
@Deprecated
public EntityCombustEvent(@NotNull final Entity combustee, final int duration) {
this(combustee, (float) duration);
}
public EntityCombustEvent(@NotNull final Entity combustee, final float duration) {
super(combustee);
this.duration = duration;
this.cancel = false;
@@ -35,7 +40,7 @@ public class EntityCombustEvent extends EntityEvent implements Cancellable {
* @return the amount of time (in seconds) the combustee should be alight
* for
*/
public int getDuration() {
public float getDuration() {
return duration;
}
@@ -47,6 +52,21 @@ public class EntityCombustEvent extends EntityEvent implements Cancellable {
*
* @param duration the time in seconds to be alight for.
*/
public void setDuration(float duration) {
this.duration = duration;
}
/**
* The number of seconds the combustee should be alight for.
* <p>
* This value will only ever increase the combustion time, not decrease
* existing combustion times.
*
* @param duration the time in seconds to be alight for.
* @see #setDuration(float)
* @deprecated duration is now a float
*/
@Deprecated(forRemoval = true)
public void setDuration(int duration) {
this.duration = duration;
}

View File

@@ -1,7 +1,5 @@
package org.bukkit.event.inventory;
import org.bukkit.MinecraftExperimental;
import org.bukkit.MinecraftExperimental.Requires;
import org.bukkit.inventory.InventoryHolder;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
@@ -148,7 +146,6 @@ public enum InventoryType {
/**
* A crafter inventory, with 9 CRAFTING slots.
*/
@MinecraftExperimental(Requires.UPDATE_1_21)
@ApiStatus.Experimental
CRAFTER(9, "Crafter"),
/**

View File

@@ -2,13 +2,11 @@ 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;
/**
* Called when a player's experience cooldown changes.
*/
@ApiStatus.Experimental
public class PlayerExpCooldownChangeEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();

View File

@@ -0,0 +1,43 @@
package org.bukkit.event.player;
import org.bukkit.ServerLinks;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* This event is called when the list of links is sent to the player.
*/
@ApiStatus.Experimental
public class PlayerLinksSendEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
private final ServerLinks links;
public PlayerLinksSendEvent(@NotNull final Player player, @NotNull final ServerLinks links) {
super(player);
this.links = links;
}
/**
* Gets the links to be sent, for modification.
*
* @return the links
*/
@NotNull
public ServerLinks getLinks() {
return links;
}
@NotNull
@Override
public HandlerList getHandlers() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@@ -5,13 +5,11 @@ 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;
/**
* This event is fired when a sign is opened by the player.
*/
@ApiStatus.Experimental
public class PlayerSignOpenEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
@@ -78,7 +76,6 @@ public class PlayerSignOpenEvent extends PlayerEvent implements Cancellable {
return handlers;
}
@ApiStatus.Experimental
public enum Cause {
/**

View File

@@ -5,15 +5,12 @@ import org.bukkit.Location;
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;
/**
* This event is fired when the spawn point of the player is changed.
* @apiNote draft API
*/
@ApiStatus.Experimental
public class PlayerSpawnChangeEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();

View File

@@ -92,6 +92,10 @@ public class LightningStrikeEvent extends WeatherEvent implements Cancellable {
* Triggered by weather.
*/
WEATHER,
/**
* Triggered by an enchantment but not a trident.
*/
ENCHANTMENT,
/**
* Unknown trigger.
*/