Skip to content

Commit 2c286af

Browse files
authored
[Bukkit] Cleanup adapter version warnings (#2949)
1 parent 55a4210 commit 2c286af

6 files changed

Lines changed: 9 additions & 33 deletions

File tree

worldedit-bukkit/adapters/adapter-1.21.11/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/v1_21_11/PaperweightAdapter.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,6 @@ public final class PaperweightAdapter implements BukkitImplAdapter {
216216

217217
private static final RandomSource random = RandomSource.create();
218218

219-
private static final String WRONG_VERSION =
220-
"""
221-
This version of WorldEdit has not been tested with the current Minecraft version.
222-
While it may work, there might be unexpected issues.
223-
It is recommended to use a version of WorldEdit that supports your Minecraft version.
224-
For more information, see https://worldedit.enginehub.org/en/latest/faq/#bukkit-adapters
225-
""".stripIndent();
226-
227219
// ------------------------------------------------------------------------
228220
// Code that may break between versions of Minecraft
229221
// ------------------------------------------------------------------------
@@ -235,10 +227,7 @@ public PaperweightAdapter() throws NoSuchFieldException, NoSuchMethodException {
235227

236228
int dataVersion = SharedConstants.getCurrentVersion().dataVersion().version();
237229
if (dataVersion != Constants.DATA_VERSION_MC_1_21_11) {
238-
logger.warning(WRONG_VERSION);
239-
}
240-
if (dataVersion >= Constants.DATA_VERSION_MC_26_1) {
241-
throw new RuntimeException("Force prevent this loading on 26.1+");
230+
throw new RuntimeException("Force prevent this loading on >=26.1 or <=1.21.10");
242231
}
243232

244233
serverWorldsField = CraftServer.class.getDeclaredField("worlds");

worldedit-bukkit/adapters/adapter-1.21.4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/v1_21_4/PaperweightAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public PaperweightAdapter() throws NoSuchFieldException, NoSuchMethodException {
225225

226226
int dataVersion = SharedConstants.getCurrentVersion().getDataVersion().getVersion();
227227
if (dataVersion != Constants.DATA_VERSION_MC_1_21_4) {
228-
throw new UnsupportedClassVersionError("Not 1.21.4!");
228+
throw new RuntimeException("Not 1.21.4!");
229229
}
230230

231231
serverWorldsField = CraftServer.class.getDeclaredField("worlds");

worldedit-bukkit/adapters/adapter-1.21.5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/v1_21_5/PaperweightAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public PaperweightAdapter() throws NoSuchFieldException, NoSuchMethodException {
225225

226226
int dataVersion = SharedConstants.getCurrentVersion().getDataVersion().getVersion();
227227
if (dataVersion != Constants.DATA_VERSION_MC_1_21_5) {
228-
throw new UnsupportedClassVersionError("Not 1.21.5!");
228+
throw new RuntimeException("Not 1.21.5!");
229229
}
230230

231231
serverWorldsField = CraftServer.class.getDeclaredField("worlds");

worldedit-bukkit/adapters/adapter-1.21.6/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/v1_21_6/PaperweightAdapter.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,6 @@ public final class PaperweightAdapter implements BukkitImplAdapter {
217217

218218
private static final RandomSource random = RandomSource.create();
219219

220-
private static final String WRONG_VERSION =
221-
"""
222-
This version of WorldEdit has not been tested with the current Minecraft version.
223-
While it may work, there might be unexpected issues.
224-
It is recommended to use a version of WorldEdit that supports your Minecraft version.
225-
For more information, see https://worldedit.enginehub.org/en/latest/faq/#bukkit-adapters
226-
""".stripIndent();
227-
228220
// ------------------------------------------------------------------------
229221
// Code that may break between versions of Minecraft
230222
// ------------------------------------------------------------------------
@@ -236,7 +228,7 @@ public PaperweightAdapter() throws NoSuchFieldException, NoSuchMethodException {
236228

237229
int dataVersion = SharedConstants.getCurrentVersion().dataVersion().version();
238230
if (dataVersion < Constants.DATA_VERSION_MC_1_21_6 || dataVersion > Constants.DATA_VERSION_MC_1_21_8) {
239-
logger.warning(WRONG_VERSION);
231+
throw new RuntimeException("Force prevent this loading on >=1.21.9 or <=1.21.5");
240232
}
241233

242234
serverWorldsField = CraftServer.class.getDeclaredField("worlds");

worldedit-bukkit/adapters/adapter-1.21.9/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/v1_21_9/PaperweightAdapter.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,6 @@ public final class PaperweightAdapter implements BukkitImplAdapter {
216216

217217
private static final RandomSource random = RandomSource.create();
218218

219-
private static final String WRONG_VERSION =
220-
"""
221-
This version of WorldEdit has not been tested with the current Minecraft version.
222-
While it may work, there might be unexpected issues.
223-
It is recommended to use a version of WorldEdit that supports your Minecraft version.
224-
For more information, see https://worldedit.enginehub.org/en/latest/faq/#bukkit-adapters
225-
""".stripIndent();
226-
227219
// ------------------------------------------------------------------------
228220
// Code that may break between versions of Minecraft
229221
// ------------------------------------------------------------------------
@@ -235,7 +227,7 @@ public PaperweightAdapter() throws NoSuchFieldException, NoSuchMethodException {
235227

236228
int dataVersion = SharedConstants.getCurrentVersion().dataVersion().version();
237229
if (dataVersion != Constants.DATA_VERSION_MC_1_21_9 && dataVersion != Constants.DATA_VERSION_MC_1_21_10) {
238-
logger.warning(WRONG_VERSION);
230+
throw new RuntimeException("Force prevent this loading on >=1.21.11 or <=1.21.8");
239231
}
240232

241233
serverWorldsField = CraftServer.class.getDeclaredField("worlds");

worldedit-bukkit/adapters/adapter-26.1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/v26_1/PaperweightAdapter.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter {
223223
While it may work, there might be unexpected issues.
224224
It is recommended to use a version of WorldEdit that supports your Minecraft version.
225225
For more information, see https://worldedit.enginehub.org/en/latest/faq/#bukkit-adapters
226-
""".stripIndent();
226+
""";
227227

228228
// ------------------------------------------------------------------------
229229
// Code that may break between versions of Minecraft
@@ -236,6 +236,9 @@ public PaperweightAdapter() throws NoSuchFieldException, NoSuchMethodException {
236236

237237
int dataVersion = SharedConstants.getCurrentVersion().dataVersion().version();
238238
if (dataVersion < Constants.DATA_VERSION_MC_26_1 || dataVersion > Constants.DATA_VERSION_MC_26_1_2) {
239+
if (dataVersion <= Constants.DATA_VERSION_MC_1_21_11) {
240+
throw new RuntimeException("Force prevent this loading on <=1.21.11");
241+
}
239242
logger.warning(WRONG_VERSION);
240243
}
241244

0 commit comments

Comments
 (0)