Skip to content

Commit

Permalink
add deprecation notice for 1.8.8, 1.17.1, 1.19.1 and 1.20 (#939)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei1058 authored Dec 4, 2023
1 parent 22a334c commit 45d8c3a
Show file tree
Hide file tree
Showing 21 changed files with 32 additions and 0 deletions.
12 changes: 12 additions & 0 deletions bedwars-plugin/src/main/java/com/andrei1058/bedwars/BedWars.java
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,9 @@ public void onEnable() {

// TNT Spoil Feature
SpoilPlayerTNTFeature.init();

// Warn user if current server version support is deprecated
this.performDeprecationCheck();
}

/**
Expand Down Expand Up @@ -753,6 +756,15 @@ public static void setParty(Party party) {
BedWars.party = party;
}

public void performDeprecationCheck() {
Bukkit.getScheduler().runTaskAsynchronously(this, () -> {
if (Arrays.stream(nms.getClass().getAnnotations()).anyMatch(annotation -> annotation instanceof Deprecated)) {
this.getLogger().warning("Support for "+getServerVersion()+" is scheduled for removal. " +
"Please consider upgrading your server software to a newer Minecraft version.");
}
});
}

@Override
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
return new VoidChunkGenerator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.lang.reflect.Field;

@SuppressWarnings("ALL")
@Deprecated
public class IGolem extends EntityIronGolem {

private ITeam team;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.lang.reflect.Field;

@SuppressWarnings("ALL")
@Deprecated
public class Silverfish extends EntitySilverfish {

private ITeam team;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@

import static com.andrei1058.bedwars.api.language.Language.getMsg;

@Deprecated(forRemoval = true)
@SuppressWarnings("unused")
public class v1_8_R3 extends VersionSupport {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import java.util.Objects;

@SuppressWarnings("unchecked")
@Deprecated
public class IGolem extends EntityIronGolem {
private ITeam team;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.bukkit.event.entity.CreatureSpawnEvent;

@SuppressWarnings("ALL")
@Deprecated
public class Silverfish extends EntitySilverfish {

private ITeam team;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
import java.util.logging.Level;

@SuppressWarnings("unused")
@Deprecated
public class v1_17_R1 extends VersionSupport {

private static final UUID chatUUID = new UUID(0L, 0L);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.andrei1058.bedwars.support.version.v1_19_R2.despawnable;

@Deprecated
public record DespawnableAttributes(DespawnableType type, double speed, double health, double damage, int despawnSeconds) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.ArrayList;
import java.util.List;

@Deprecated
public class DespawnableFactory {

private final VersionSupport versionSupport;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.util.Objects;

@Deprecated
public abstract class DespawnableProvider<T> {

abstract DespawnableType getType();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.andrei1058.bedwars.support.version.v1_19_R2.despawnable;

@Deprecated
public enum DespawnableType {
IRON_GOLEM,
SILVERFISH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.util.Objects;

@Deprecated
public class TeamIronGolem extends DespawnableProvider<IronGolem> {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.util.Objects;

@Deprecated
public class TeamSilverfish extends DespawnableProvider<Silverfish> {
@Override
public DespawnableType getType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import java.util.logging.Level;

@SuppressWarnings("unused")
@Deprecated
public class v1_19_R2 extends VersionSupport {

private final DespawnableFactory despawnableFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.andrei1058.bedwars.support.version.v1_20_R1.despawnable;

@Deprecated
public record DespawnableAttributes(DespawnableType type, double speed, double health, double damage, int despawnSeconds) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.ArrayList;
import java.util.List;

@Deprecated
public class DespawnableFactory {

private final VersionSupport versionSupport;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.util.Objects;

@Deprecated
public abstract class DespawnableProvider<T> {

abstract DespawnableType getType();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.andrei1058.bedwars.support.version.v1_20_R1.despawnable;

@Deprecated
public enum DespawnableType {
IRON_GOLEM,
SILVERFISH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.util.Objects;

@Deprecated
public class TeamIronGolem extends DespawnableProvider<IronGolem> {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.util.Objects;

@Deprecated
public class TeamSilverfish extends DespawnableProvider<Silverfish> {
@Override
public DespawnableType getType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import java.util.logging.Level;

@SuppressWarnings("unused")
@Deprecated
public class v1_20_R1 extends VersionSupport {

private final DespawnableFactory despawnableFactory;
Expand Down

0 comments on commit 45d8c3a

Please sign in to comment.