Skip to content

Commit b0f82c5

Browse files
author
david
committed
Remove org.jetbrains annotations and update dependencies
Removed all `org.jetbrains` annotations from the codebase and updated the build script to exclude `org.jetbrains` annotations from `paper-api`. This streamlines our annotation usage to rely solely on `org.jspecify` annotations and ensures consistency across the project.
1 parent d315408 commit b0f82c5

File tree

5 files changed

+15
-20
lines changed

5 files changed

+15
-20
lines changed

paper/build.gradle.kts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ repositories {
2525

2626
dependencies {
2727
compileOnly("org.projectlombok:lombok:1.18.34")
28-
compileOnly("io.papermc.paper:paper-api:1.21.3-R0.1-SNAPSHOT")
28+
compileOnly("io.papermc.paper:paper-api:1.21.3-R0.1-SNAPSHOT") {
29+
exclude("org.jetbrains", "annotations")
30+
}
2931

3032
api(project(":version-checker")) {
3133
exclude("com.google.code.gson", "gson")

paper/src/main/java/core/paper/gui/GUI.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import org.bukkit.event.inventory.InventoryOpenEvent;
2020
import org.bukkit.inventory.Inventory;
2121
import org.bukkit.plugin.Plugin;
22-
import org.jetbrains.annotations.ApiStatus;
2322
import org.jspecify.annotations.NullMarked;
2423

2524
import java.util.stream.IntStream;
@@ -73,7 +72,6 @@ protected void formatDefault() {
7372
* <p>
7473
* Note: Do not call this method directly, it is automatically called by the system.
7574
*/
76-
@ApiStatus.OverrideOnly
7775
protected void onClose() {
7876
}
7977

@@ -83,7 +81,6 @@ protected void onClose() {
8381
* <p>
8482
* Note: Do not call this method directly, it is automatically called by the system.
8583
*/
86-
@ApiStatus.OverrideOnly
8784
protected void onOpen() {
8885
}
8986

paper/src/main/java/core/paper/item/ItemBuilder.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@
1212
import org.bukkit.inventory.meta.ItemMeta;
1313
import org.bukkit.inventory.meta.SkullMeta;
1414
import org.bukkit.inventory.meta.components.FoodComponent;
15-
import org.jetbrains.annotations.ApiStatus;
16-
import org.jetbrains.annotations.Nullable;
17-
import org.jetbrains.annotations.Range;
1815
import org.jspecify.annotations.NullMarked;
16+
import org.jspecify.annotations.Nullable;
1917

2018
import java.util.*;
2119
import java.util.function.Consumer;
@@ -95,7 +93,6 @@ public ItemBuilder displayName(Component name) {
9593
* @return the modified item builder
9694
* @see ItemMeta#setFood(FoodComponent)
9795
*/
98-
@ApiStatus.Experimental
9996
@SuppressWarnings("UnstableApiUsage")
10097
public ItemBuilder food(@Nullable FoodComponent food) {
10198
return modify(meta -> meta.setFood(food));
@@ -119,7 +116,7 @@ public ItemBuilder rarity(@Nullable ItemRarity rarity) {
119116
* @return the modified ItemBuilder object
120117
* @see ItemMeta#setMaxStackSize(Integer)
121118
*/
122-
public ItemBuilder maxStackSize(@Range(from = 1, to = 99) @Nullable Integer max) {
119+
public ItemBuilder maxStackSize(@Nullable Integer max) {
123120
return modify(meta -> meta.setMaxStackSize(max));
124121
}
125122

@@ -130,7 +127,7 @@ public ItemBuilder maxStackSize(@Range(from = 1, to = 99) @Nullable Integer max)
130127
* @return the modified item builder
131128
* @see ItemStack#setAmount(int)
132129
*/
133-
public ItemBuilder amount(@Range(from = 0, to = 99) int amount) {
130+
public ItemBuilder amount(int amount) {
134131
setAmount(Math.clamp(amount, 0, getMaxStackSize()));
135132
return this;
136133
}

paper/src/main/java/core/paper/scoreboard/BelowNameScoreboard.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import org.bukkit.scoreboard.DisplaySlot;
99
import org.bukkit.scoreboard.Objective;
1010
import org.bukkit.scoreboard.Scoreboard;
11-
import org.jetbrains.annotations.Nullable;
1211
import org.jspecify.annotations.NullMarked;
12+
import org.jspecify.annotations.Nullable;
1313

1414
@NullMarked
1515
public class BelowNameScoreboard {

paper/src/main/java/core/paper/scoreboard/Sidebar.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
import org.bukkit.Bukkit;
99
import org.bukkit.entity.Player;
1010
import org.bukkit.scoreboard.*;
11-
import org.jetbrains.annotations.Nullable;
12-
import org.jetbrains.annotations.Range;
1311
import org.jspecify.annotations.NullMarked;
12+
import org.jspecify.annotations.Nullable;
1413

1514
import java.util.Arrays;
1615

@@ -78,7 +77,7 @@ public Sidebar numberFormat(@Nullable NumberFormat format) {
7877
* @param format the number format to be set for the specified line
7978
* @return the Sidebar object
8079
*/
81-
public Sidebar numberFormat(@Range(from = 1, to = 15) int line, @Nullable NumberFormat format) {
80+
public Sidebar numberFormat(int line, @Nullable NumberFormat format) {
8281
getScore(line).numberFormat(format);
8382
return this;
8483
}
@@ -90,7 +89,7 @@ public Sidebar numberFormat(@Range(from = 1, to = 15) int line, @Nullable Number
9089
* @param content the component to be displayed on the line
9190
* @return the Sidebar object
9291
*/
93-
public Sidebar line(@Range(from = 1, to = 15) int line, @Nullable Component content) {
92+
public Sidebar line(int line, @Nullable Component content) {
9493
getTeam(line).prefix(content);
9594
return showLine(line);
9695
}
@@ -101,7 +100,7 @@ public Sidebar line(@Range(from = 1, to = 15) int line, @Nullable Component cont
101100
* @param line the line to display (1-15)
102101
* @return the Sidebar object
103102
*/
104-
public Sidebar showLine(@Range(from = 1, to = 15) int line) {
103+
public Sidebar showLine(int line) {
105104
var score = getScore(line);
106105
if (!score.isScoreSet()) score.setScore(line);
107106
return this;
@@ -113,7 +112,7 @@ public Sidebar showLine(@Range(from = 1, to = 15) int line) {
113112
* @param line the line to hide (1-15)
114113
* @return the Sidebar object
115114
*/
116-
public Sidebar hideLine(@Range(from = 1, to = 15) int line) {
115+
public Sidebar hideLine(int line) {
117116
var value = Line.valueOf(line);
118117
var objective = this.objective.getScore(value.color());
119118
if (objective.isScoreSet()) scoreboard.resetScores(value.color());
@@ -122,12 +121,12 @@ public Sidebar hideLine(@Range(from = 1, to = 15) int line) {
122121
return this;
123122
}
124123

125-
private Score getScore(@Range(from = 1, to = 15) int line) {
124+
private Score getScore(int line) {
126125
var value = Line.valueOf(line);
127126
return this.objective.getScore(value.color());
128127
}
129128

130-
private Team getTeam(@Range(from = 1, to = 15) int line) {
129+
private Team getTeam(int line) {
131130
var value = Line.valueOf(line);
132131
var team = scoreboard.getTeam(value.name());
133132
if (team != null) return team;
@@ -159,7 +158,7 @@ private enum Line {
159158
private final String color;
160159
private final int score;
161160

162-
private static Line valueOf(@Range(from = 1, to = 15) int line) {
161+
private static Line valueOf(int line) {
163162
return Arrays.stream(values())
164163
.filter(value -> value.score() == line)
165164
.findAny()

0 commit comments

Comments
 (0)