Skip to content

Commit

Permalink
update deprecated versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Machine-Maker authored and lynxplay committed Dec 27, 2024
1 parent 49581ed commit 471642d
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 39 deletions.
11 changes: 0 additions & 11 deletions paper-api/src/main/java/io/papermc/paper/statistic/Statistic.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.papermc.paper.statistic;

import org.bukkit.scoreboard.Criteria;
import org.bukkit.scoreboard.RenderType;
import org.jetbrains.annotations.ApiStatus;

/**
Expand All @@ -25,14 +24,4 @@ public interface Statistic<S> extends Criteria {
* @return the stat type
*/
StatisticType<S> type();

@Override
default boolean isReadOnly() {
return false;
}

@Override
default RenderType getDefaultRenderType() {
return RenderType.INTEGER;
}
}
36 changes: 18 additions & 18 deletions paper-api/src/main/java/org/bukkit/OfflinePlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ default void decrementStatistic(@NotNull io.papermc.paper.statistic.Statistic<?>
* additional parameter
* @deprecated use {@link #incrementStatistic(io.papermc.paper.statistic.Statistic)}
*/
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4")
public void incrementStatistic(@NotNull Statistic statistic) throws IllegalArgumentException;

/**
Expand All @@ -398,7 +398,7 @@ default void decrementStatistic(@NotNull io.papermc.paper.statistic.Statistic<?>
* additional parameter
* @deprecated use {@link #decrementStatistic(io.papermc.paper.statistic.Statistic)}
*/
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4")
public void decrementStatistic(@NotNull Statistic statistic) throws IllegalArgumentException;

/**
Expand All @@ -412,7 +412,7 @@ default void decrementStatistic(@NotNull io.papermc.paper.statistic.Statistic<?>
* additional parameter
* @deprecated use {@link #incrementStatistic(io.papermc.paper.statistic.Statistic, int)}
*/
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4")
public void incrementStatistic(@NotNull Statistic statistic, int amount) throws IllegalArgumentException;

/**
Expand All @@ -426,7 +426,7 @@ default void decrementStatistic(@NotNull io.papermc.paper.statistic.Statistic<?>
* additional parameter
* @deprecated use {@link #decrementStatistic(io.papermc.paper.statistic.Statistic, int)}
*/
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4")
public void decrementStatistic(@NotNull Statistic statistic, int amount) throws IllegalArgumentException;

/**
Expand All @@ -440,7 +440,7 @@ default void decrementStatistic(@NotNull io.papermc.paper.statistic.Statistic<?>
* additional parameter
* @deprecated use {@link #setStatistic(io.papermc.paper.statistic.Statistic, int)}
*/
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4")
public void setStatistic(@NotNull Statistic statistic, int newValue) throws IllegalArgumentException;

/**
Expand All @@ -453,7 +453,7 @@ default void decrementStatistic(@NotNull io.papermc.paper.statistic.Statistic<?>
* additional parameter
* @deprecated use {@link #getStatistic(io.papermc.paper.statistic.Statistic)}
*/
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4")
public int getStatistic(@NotNull Statistic statistic) throws IllegalArgumentException;

/**
Expand All @@ -470,7 +470,7 @@ default void decrementStatistic(@NotNull io.papermc.paper.statistic.Statistic<?>
* for the statistic
* @deprecated use {@link #incrementStatistic(io.papermc.paper.statistic.Statistic)}
*/
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4")
public void incrementStatistic(@NotNull Statistic statistic, @NotNull Material material) throws IllegalArgumentException;

/**
Expand All @@ -487,7 +487,7 @@ default void decrementStatistic(@NotNull io.papermc.paper.statistic.Statistic<?>
* for the statistic
* @deprecated use {@link #decrementStatistic(io.papermc.paper.statistic.Statistic)}
*/
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4")
public void decrementStatistic(@NotNull Statistic statistic, @NotNull Material material) throws IllegalArgumentException;

/**
Expand All @@ -502,7 +502,7 @@ default void decrementStatistic(@NotNull io.papermc.paper.statistic.Statistic<?>
* for the statistic
* @deprecated use {@link #getStatistic(io.papermc.paper.statistic.Statistic)}
*/
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4")
public int getStatistic(@NotNull Statistic statistic, @NotNull Material material) throws IllegalArgumentException;

/**
Expand All @@ -518,7 +518,7 @@ default void decrementStatistic(@NotNull io.papermc.paper.statistic.Statistic<?>
* for the statistic
* @deprecated use {@link #incrementStatistic(io.papermc.paper.statistic.Statistic, int)}
*/
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4")
public void incrementStatistic(@NotNull Statistic statistic, @NotNull Material material, int amount) throws IllegalArgumentException;

/**
Expand All @@ -534,7 +534,7 @@ default void decrementStatistic(@NotNull io.papermc.paper.statistic.Statistic<?>
* for the statistic
* @deprecated use {@link #decrementStatistic(io.papermc.paper.statistic.Statistic, int)}
*/
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4")
public void decrementStatistic(@NotNull Statistic statistic, @NotNull Material material, int amount) throws IllegalArgumentException;

/**
Expand All @@ -550,7 +550,7 @@ default void decrementStatistic(@NotNull io.papermc.paper.statistic.Statistic<?>
* for the statistic
* @deprecated use {@link #setStatistic(io.papermc.paper.statistic.Statistic, int)}
*/
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4")
public void setStatistic(@NotNull Statistic statistic, @NotNull Material material, int newValue) throws IllegalArgumentException;

/**
Expand All @@ -567,7 +567,7 @@ default void decrementStatistic(@NotNull io.papermc.paper.statistic.Statistic<?>
* for the statistic
* @deprecated use {@link #incrementStatistic(io.papermc.paper.statistic.Statistic)}
*/
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4")
public void incrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType) throws IllegalArgumentException;

/**
Expand All @@ -584,7 +584,7 @@ default void decrementStatistic(@NotNull io.papermc.paper.statistic.Statistic<?>
* for the statistic
* @deprecated use {@link #decrementStatistic(io.papermc.paper.statistic.Statistic)}
*/
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4")
public void decrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType) throws IllegalArgumentException;

/**
Expand All @@ -599,7 +599,7 @@ default void decrementStatistic(@NotNull io.papermc.paper.statistic.Statistic<?>
* for the statistic
* @deprecated use {@link #getStatistic(io.papermc.paper.statistic.Statistic)}
*/
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4")
public int getStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType) throws IllegalArgumentException;

/**
Expand All @@ -615,7 +615,7 @@ default void decrementStatistic(@NotNull io.papermc.paper.statistic.Statistic<?>
* for the statistic
* @deprecated use {@link #incrementStatistic(io.papermc.paper.statistic.Statistic, int)}
*/
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4")
public void incrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int amount) throws IllegalArgumentException;

/**
Expand All @@ -631,7 +631,7 @@ default void decrementStatistic(@NotNull io.papermc.paper.statistic.Statistic<?>
* for the statistic
* @deprecated use {@link #decrementStatistic(io.papermc.paper.statistic.Statistic, int)}
*/
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4")
public void decrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int amount);

/**
Expand All @@ -647,7 +647,7 @@ default void decrementStatistic(@NotNull io.papermc.paper.statistic.Statistic<?>
* for the statistic
* @deprecated use {@link #setStatistic(io.papermc.paper.statistic.Statistic, int)}
*/
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4")
public void setStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int newValue);

/**
Expand Down
2 changes: 1 addition & 1 deletion paper-api/src/main/java/org/bukkit/Registry.java
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public Iterator<KeyedBossBar> iterator() {
* @see Statistic
* @deprecated use {@link #CUSTOM_STAT} and {@link #STAT_TYPE}
*/
@Deprecated(forRemoval = true, since = "1.21") // Paper
@Deprecated(forRemoval = true, since = "1.21.4")
Registry<Statistic> STATISTIC = new SimpleRegistry<>(Statistic.class);
/**
* Server structures.
Expand Down
2 changes: 1 addition & 1 deletion paper-api/src/main/java/org/bukkit/Statistic.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Represents a countable statistic, which is tracked by the server.
* @deprecated use {@link io.papermc.paper.statistic.StatisticType} and {@link io.papermc.paper.statistic.Statistic}
*/
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4") // Paper
public enum Statistic implements Keyed {
DAMAGE_DEALT,
DAMAGE_TAKEN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public PlayerStatisticIncrementEvent(@NotNull Player player, @NotNull io.papermc
* @deprecated use {@link #getStat()}
*/
@NotNull
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4")
public Statistic getStatistic() {
return Statistic.toLegacy(this.statistic); // Paper
}
Expand Down Expand Up @@ -88,7 +88,7 @@ public int getNewValue() {
* @deprecated use {@link #getStat()}
*/
@Nullable
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4")
public EntityType getEntityType() {
return entityType;
}
Expand All @@ -101,7 +101,7 @@ public EntityType getEntityType() {
* @deprecated use {@link #getStat()}
*/
@Nullable
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21,4")
public Material getMaterial() {
return material;
}
Expand Down
6 changes: 3 additions & 3 deletions paper-api/src/main/java/org/bukkit/scoreboard/Criteria.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public interface Criteria {
* @deprecated use {@link io.papermc.paper.statistic.Statistic}
*/
@NotNull
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4") // Paper
public static Criteria statistic(@NotNull Statistic statistic, @NotNull Material material) {
Preconditions.checkArgument(statistic != null, "statistic must not be null");
Preconditions.checkArgument(material != null, "material must not be null");
Expand Down Expand Up @@ -303,7 +303,7 @@ public static Criteria statistic(@NotNull Statistic statistic, @NotNull Material
* @deprecated use {@link io.papermc.paper.statistic.Statistic}
*/
@NotNull
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4") // Paper
public static Criteria statistic(@NotNull Statistic statistic, @NotNull EntityType entityType) {
Preconditions.checkArgument(statistic != null, "statistic must not be null");
Preconditions.checkArgument(entityType != null, "entityType must not be null");
Expand Down Expand Up @@ -338,7 +338,7 @@ public static Criteria statistic(@NotNull Statistic statistic, @NotNull EntityTy
* @deprecated Use {@link io.papermc.paper.statistic.Statistic}
*/
@NotNull
@Deprecated(since = "1.21") // Paper
@Deprecated(since = "1.21.4") // Paper
public static Criteria statistic(@NotNull Statistic statistic) {
Preconditions.checkArgument(statistic != null, "statistic must not be null");
return Bukkit.getScoreboardCriteria(org.bukkit.Bukkit.getUnsafe().getStatisticCriteriaKey(statistic)); // Paper
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
package io.papermc.paper.statistic;

import net.minecraft.stats.Stat;
import org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations;
import org.bukkit.scoreboard.RenderType;

public record PaperStatistic<S, M>(Stat<M> handle, S value, M nmsValue, StatisticType<S> type) implements Statistic<S> {

@Override
public String getName() {
return Stat.buildName(this.handle.getType(),this.nmsValue);
}

@Override
public boolean isReadOnly() {
return this.handle.isReadOnly();
}

@Override
public RenderType getDefaultRenderType() {
return CraftScoreboardTranslations.toBukkitRender(this.handle.getDefaultRenderType());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ public static net.minecraft.world.scores.DisplaySlot fromBukkitSlot(DisplaySlot
return net.minecraft.world.scores.DisplaySlot.CODEC.byName(CraftScoreboardTranslations.SLOTS.get(slot));
}

static RenderType toBukkitRender(ObjectiveCriteria.RenderType display) {
public static RenderType toBukkitRender(ObjectiveCriteria.RenderType display) {
return RenderType.valueOf(display.name());
}

static ObjectiveCriteria.RenderType fromBukkitRender(RenderType render) {
public static ObjectiveCriteria.RenderType fromBukkitRender(RenderType render) {
return ObjectiveCriteria.RenderType.valueOf(render.name());
}
}

0 comments on commit 471642d

Please sign in to comment.