forked from SteamWar/SteamWar
Fixes
This commit is contained in:
+1
-1
@@ -56,7 +56,7 @@ public class BauScoreboard implements Listener {
|
|||||||
public void handlePlayerJoin(PlayerJoinEvent event) {
|
public void handlePlayerJoin(PlayerJoinEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
SWScoreboard.createScoreboard(player, new ScoreboardCallback() {
|
SWScoreboard.impl.createScoreboard(player, new ScoreboardCallback() {
|
||||||
@Override
|
@Override
|
||||||
public HashMap<String, Integer> getData() {
|
public HashMap<String, Integer> getData() {
|
||||||
Region region = Region.getRegion(player.getLocation());
|
Region region = Region.getRegion(player.getLocation());
|
||||||
|
|||||||
+3
-3
@@ -60,17 +60,17 @@ public class FightScoreboard implements Listener, ScoreboardCallback {
|
|||||||
|
|
||||||
private FightScoreboard(){
|
private FightScoreboard(){
|
||||||
new StateDependentListener(ArenaMode.Replay, FightState.All, this);
|
new StateDependentListener(ArenaMode.Replay, FightState.All, this);
|
||||||
Bukkit.getOnlinePlayers().forEach(player -> SWScoreboard.createScoreboard(player, this));
|
Bukkit.getOnlinePlayers().forEach(player -> SWScoreboard.impl.createScoreboard(player, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
SWScoreboard.createScoreboard(event.getPlayer(), this);
|
SWScoreboard.impl.createScoreboard(event.getPlayer(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
SWScoreboard.removeScoreboard(event.getPlayer());
|
SWScoreboard.impl.removeScoreboard(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitle(String t) {
|
public void setTitle(String t) {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class FightScoreboard implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
SWScoreboard.createScoreboard(event.getPlayer(), new ScoreboardCallback() {
|
SWScoreboard.impl.createScoreboard(event.getPlayer(), new ScoreboardCallback() {
|
||||||
@Override
|
@Override
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return "§eMissileWars";
|
return "§eMissileWars";
|
||||||
@@ -81,7 +81,7 @@ class FightScoreboard implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
SWScoreboard.removeScoreboard(event.getPlayer());
|
SWScoreboard.impl.removeScoreboard(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
static Scoreboard getScoreboard() {
|
static Scoreboard getScoreboard() {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import org.bukkit.scoreboard.Scoreboard;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
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 HashMap<Player, ScoreboardCallback> playerBoards = new HashMap<>();
|
||||||
private static final String SIDEBAR = "sw-sidebar";
|
private static final String SIDEBAR = "sw-sidebar";
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import org.bukkit.entity.Player;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
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<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 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");
|
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 de.steamwar.core.VersionDependent;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class SWScoreboard {
|
public interface SWScoreboard {
|
||||||
private SWScoreboard() {}
|
public static final SWScoreboard impl = VersionDependent.getVersionImpl(Core.getInstance());
|
||||||
|
|
||||||
private static final ISWScoreboard impl = VersionDependent.getVersionImpl(Core.getInstance());
|
boolean createScoreboard(Player player, ScoreboardCallback callback);
|
||||||
|
void removeScoreboard(Player player);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ object IngameListener: Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
fun onJoin(e: PlayerJoinEvent) {
|
fun onJoin(e: PlayerJoinEvent) {
|
||||||
SWScoreboard.createScoreboard(e.player, TNTLeagueScoreboard(e.player))
|
SWScoreboard.impl.createScoreboard(e.player, TNTLeagueScoreboard(e.player))
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ object TNTLeagueGame {
|
|||||||
|
|
||||||
state = GameState.RUNNING
|
state = GameState.RUNNING
|
||||||
|
|
||||||
plugin.server.onlinePlayers.forEach { SWScoreboard.createScoreboard(it, TNTLeagueScoreboard(it)) }
|
plugin.server.onlinePlayers.forEach { SWScoreboard.impl.createScoreboard(it, TNTLeagueScoreboard(it)) }
|
||||||
|
|
||||||
blueTeam.start()
|
blueTeam.start()
|
||||||
redTeam.start()
|
redTeam.start()
|
||||||
@@ -101,7 +101,7 @@ object TNTLeagueGame {
|
|||||||
|
|
||||||
plugin.server.onlinePlayers.forEach {
|
plugin.server.onlinePlayers.forEach {
|
||||||
it.gameMode = GameMode.SPECTATOR
|
it.gameMode = GameMode.SPECTATOR
|
||||||
SWScoreboard.removeScoreboard(it)
|
SWScoreboard.impl.removeScoreboard(it)
|
||||||
it.playSound(Sound.sound(org.bukkit.Sound.ENTITY_ENDER_DRAGON_DEATH.key, Sound.Source.MASTER, 1f, 1f))
|
it.playSound(Sound.sound(org.bukkit.Sound.ENTITY_ENDER_DRAGON_DEATH.key, Sound.Source.MASTER, 1f, 1f))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user