This commit is contained in:
2024-11-23 15:43:05 +01:00
parent 7437f87d22
commit 97e4ccb076
8 changed files with 15 additions and 27 deletions
@@ -30,7 +30,7 @@ import org.bukkit.scoreboard.Scoreboard;
import java.util.HashMap;
import java.util.Map;
public class SWScoreboard21 implements SWScoreboard.ISWScoreboard {
public class SWScoreboard21 implements SWScoreboard {
private static final HashMap<Player, ScoreboardCallback> playerBoards = new HashMap<>();
private static final String SIDEBAR = "sw-sidebar";
@@ -29,7 +29,7 @@ import org.bukkit.entity.Player;
import java.util.HashMap;
import java.util.Map;
public class SWScoreboard8 implements SWScoreboard.ISWScoreboard {
public class SWScoreboard8 implements SWScoreboard {
private static final Reflection.FieldAccessor<String> scoreboardName = Reflection.getField(FlatteningWrapper.scoreboardObjective, String.class, 0);
private static final Reflection.FieldAccessor<Integer> scoreboardAction = Reflection.getField(FlatteningWrapper.scoreboardObjective, int.class, Core.getVersion() > 15 ? 3 : 0);
private static final Class<?> scoreboardDisplayEnum = Reflection.getClass("{nms.world.scores.criteria}.IScoreboardCriteria$EnumScoreboardHealthDisplay");
@@ -23,21 +23,9 @@ import de.steamwar.core.Core;
import de.steamwar.core.VersionDependent;
import org.bukkit.entity.Player;
public class SWScoreboard {
private SWScoreboard() {}
public interface SWScoreboard {
public static final SWScoreboard impl = VersionDependent.getVersionImpl(Core.getInstance());
private static final ISWScoreboard impl = VersionDependent.getVersionImpl(Core.getInstance());
public static boolean createScoreboard(Player player, ScoreboardCallback callback) {
return impl.createScoreboard(player, callback);
}
public static void removeScoreboard(Player player) {
impl.removeScoreboard(player);
}
public interface ISWScoreboard {
boolean createScoreboard(Player player, ScoreboardCallback callback);
void removeScoreboard(Player player);
}
boolean createScoreboard(Player player, ScoreboardCallback callback);
void removeScoreboard(Player player);
}