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

@@ -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;
}