diff --git a/src/com/Geekpower14/Quake/Commands/AddLobbyCommand.java b/src/com/Geekpower14/Quake/Commands/AddLobbyAreaCommand.java similarity index 83% rename from src/com/Geekpower14/Quake/Commands/AddLobbyCommand.java rename to src/com/Geekpower14/Quake/Commands/AddLobbyAreaCommand.java index 2c02011..27ca6e2 100644 --- a/src/com/Geekpower14/Quake/Commands/AddLobbyCommand.java +++ b/src/com/Geekpower14/Quake/Commands/AddLobbyAreaCommand.java @@ -5,18 +5,18 @@ import java.util.ArrayList; import java.util.List; import org.bukkit.entity.Player; -public class AddLobbyCommand +public class AddLobbyAreaCommand implements BasicCommand { private final Quake _plugin; - public AddLobbyCommand(Quake pl) { + public AddLobbyAreaCommand(Quake pl) { _plugin = pl; } @Override public boolean onCommand(Player player, String[] args) { if (Quake.hasPermission(player, getPermission())) { - _plugin._lobby.addLobby(player); + _plugin._lobby.addLobbyArea(player); _plugin._lobby.saveconfig(); } else { player.sendMessage(_plugin._trad.get("NoPermission")); @@ -32,7 +32,7 @@ implements BasicCommand { @Override public String help(Player p) { if (Quake.hasPermission(p, getPermission())) { - return "/quake addlobby - Add a sign wall lobby."; + return "/quake addlobbyarea - Add a lobby area."; } return ""; } diff --git a/src/com/Geekpower14/Quake/Commands/AddLobbyWallCommand.java b/src/com/Geekpower14/Quake/Commands/AddLobbyWallCommand.java new file mode 100644 index 0000000..e5d1585 --- /dev/null +++ b/src/com/Geekpower14/Quake/Commands/AddLobbyWallCommand.java @@ -0,0 +1,46 @@ +package com.Geekpower14.Quake.Commands; + +import com.Geekpower14.Quake.Quake; +import java.util.ArrayList; +import java.util.List; +import org.bukkit.entity.Player; + +public class AddLobbyWallCommand +implements BasicCommand { + private final Quake _plugin; + + public AddLobbyWallCommand(Quake pl) { + _plugin = pl; + } + + @Override + public boolean onCommand(Player player, String[] args) { + if (Quake.hasPermission(player, getPermission())) { + _plugin._lobby.addLobbyWall(player); + _plugin._lobby.saveconfig(); + } else { + player.sendMessage(_plugin._trad.get("NoPermission")); + } + return true; + } + + @Override + public String getPermission() { + return "Quake.lobby"; + } + + @Override + public String help(Player p) { + if (Quake.hasPermission(p, getPermission())) { + return "/quake addlobbywall - Add a sign wall lobby."; + } + return ""; + } + + @Override + public List getCompletionList(Player player, String[] args) { + List list = new ArrayList(); + + return list; + } +} diff --git a/src/com/Geekpower14/Quake/Commands/MyCommandExecutor.java b/src/com/Geekpower14/Quake/Commands/MyCommandExecutor.java index 397fb6a..c61f3a8 100644 --- a/src/com/Geekpower14/Quake/Commands/MyCommandExecutor.java +++ b/src/com/Geekpower14/Quake/Commands/MyCommandExecutor.java @@ -31,9 +31,11 @@ public class MyCommandExecutor implements CommandExecutor { _commands.put("setmap", new SetMapCommand(_plugin)); _commands.put("setmin", new SetMinCommand(_plugin)); _commands.put("setmax", new SetMaxCommand(_plugin)); - _commands.put("addlobby", new AddLobbyCommand(_plugin)); + _commands.put("addlobbyarea", new AddLobbyAreaCommand(_plugin)); + _commands.put("addlobbywall", new AddLobbyWallCommand(_plugin)); _commands.put("setlobbyspawn", new SetLobbySpawnCommand(_plugin)); - _commands.put("removelobby", new RemoveLobbyCommand(_plugin)); + _commands.put("removelobbyarea", new RemoveLobbyAreaCommand(_plugin)); + _commands.put("removelobbywall", new RemoveLobbyWallCommand(_plugin)); _commands.put("join", new JoinCommand(_plugin)); _commands.put("leave", new LeaveCommand(_plugin)); _commands.put("start", new StartCommand(_plugin)); diff --git a/src/com/Geekpower14/Quake/Commands/RemoveLobbyCommand.java b/src/com/Geekpower14/Quake/Commands/RemoveLobbyAreaCommand.java similarity index 75% rename from src/com/Geekpower14/Quake/Commands/RemoveLobbyCommand.java rename to src/com/Geekpower14/Quake/Commands/RemoveLobbyAreaCommand.java index 486de3d..e6baa16 100644 --- a/src/com/Geekpower14/Quake/Commands/RemoveLobbyCommand.java +++ b/src/com/Geekpower14/Quake/Commands/RemoveLobbyAreaCommand.java @@ -13,10 +13,10 @@ import java.util.List; import org.bukkit.ChatColor; import org.bukkit.entity.Player; -public class RemoveLobbyCommand implements BasicCommand { +public class RemoveLobbyAreaCommand implements BasicCommand { private final Quake _plugin; - public RemoveLobbyCommand(Quake pl) { + public RemoveLobbyAreaCommand(Quake pl) { _plugin = pl; } @@ -24,12 +24,12 @@ public class RemoveLobbyCommand implements BasicCommand { public boolean onCommand(Player player, String[] args) { if (Quake.hasPermission(player, getPermission())) { if (args.length != 1) { - player.sendMessage(ChatColor.RED + "Please type a good number of lobby !"); + player.sendMessage(ChatColor.RED + "Please type a good lobby ID!"); return true; } - int lobby = Integer.valueOf(args[0]); - _plugin._lobby.removeLobby("lobby" + (lobby - 1)); - player.sendMessage(ChatColor.YELLOW + "Lobby number : " + (lobby - 1) + " removed with success"); + int lobbyarea = Integer.valueOf(args[0]); + _plugin._lobby.removeLobbyArea("lobbyarea" + lobbyarea); + player.sendMessage(ChatColor.YELLOW + "Lobby area number " + lobbyarea + " successfully removed."); _plugin._lobby.saveconfig(); } else { player.sendMessage(_plugin._trad.get("NoPermission")); @@ -45,7 +45,7 @@ public class RemoveLobbyCommand implements BasicCommand { @Override public String help(Player p) { if (Quake.hasPermission(p, getPermission())) { - return "/quake removelobby [ID of the lobby] - Remove a lobby wall."; + return "/quake removelobby [ID of the lobby] - Remove a lobby area."; } return ""; } @@ -56,7 +56,7 @@ public class RemoveLobbyCommand implements BasicCommand { if( args.length <= 2) { - list = _plugin._lobby.getLobbyIndexList(); + list = _plugin._lobby.getLobbyAreaIDList(); } else { list = new ArrayList(); } diff --git a/src/com/Geekpower14/Quake/Commands/RemoveLobbyWallCommand.java b/src/com/Geekpower14/Quake/Commands/RemoveLobbyWallCommand.java new file mode 100644 index 0000000..6218a95 --- /dev/null +++ b/src/com/Geekpower14/Quake/Commands/RemoveLobbyWallCommand.java @@ -0,0 +1,67 @@ +/* + * Decompiled with CFR 0_114. + * + * Could not load the following classes: + * org.bukkit.ChatColor + * org.bukkit.entity.Player + */ +package com.Geekpower14.Quake.Commands; + +import com.Geekpower14.Quake.Quake; +import java.util.ArrayList; +import java.util.List; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +public class RemoveLobbyWallCommand implements BasicCommand { + private final Quake _plugin; + + public RemoveLobbyWallCommand(Quake pl) { + _plugin = pl; + } + + @Override + public boolean onCommand(Player player, String[] args) { + if (Quake.hasPermission(player, getPermission())) { + if (args.length != 1) { + player.sendMessage(ChatColor.RED + "Please type a good lobby wall ID!"); + return true; + } + int lobbywall = Integer.valueOf(args[0]); + _plugin._lobby.removeLobbyWall("lobbywall " + lobbywall); + player.sendMessage(ChatColor.YELLOW + "Lobby wall number " + lobbywall + " successfully removed."); + _plugin._lobby.saveconfig(); + } else { + player.sendMessage(_plugin._trad.get("NoPermission")); + } + return true; + } + + @Override + public String getPermission() { + return "Quake.lobby"; + } + + @Override + public String help(Player p) { + if (Quake.hasPermission(p, getPermission())) { + return "/quake removelobbywall [ID of the lobby wall] - Remove a lobby wall."; + } + return ""; + } + + @Override + public List getCompletionList(Player player, String[] args) { + List list; + + if( args.length <= 2) { + + list = _plugin._lobby.getLobbyWallIDList(); + } else { + list = new ArrayList(); + } + + return list; + } +} + diff --git a/src/com/Geekpower14/Quake/Listener/PlayerListener.java b/src/com/Geekpower14/Quake/Listener/PlayerListener.java index 2b5d14f..d6f1e35 100644 --- a/src/com/Geekpower14/Quake/Listener/PlayerListener.java +++ b/src/com/Geekpower14/Quake/Listener/PlayerListener.java @@ -52,7 +52,7 @@ public class PlayerListener implements Listener { Arena arena = _plugin._am.getArenabyPlayer(player); if(arena == null) { Block block = event.getClickedBlock(); - if ((action == Action.LEFT_CLICK_BLOCK || action == Action.RIGHT_CLICK_BLOCK) && _plugin._lobby.isinLobby(event.getClickedBlock().getLocation()) && block.getState() instanceof Sign) { + if ((action == Action.LEFT_CLICK_BLOCK || action == Action.RIGHT_CLICK_BLOCK) && _plugin._lobby.isinLobbyWall(event.getClickedBlock().getLocation()) && block.getState() instanceof Sign) { Sign sign = (Sign)block.getState(); if (sign.getLine(1).equals("")) { return; @@ -244,20 +244,17 @@ public class PlayerListener implements Listener { @EventHandler(priority=EventPriority.HIGHEST) public void onPlayerTeleport(PlayerTeleportEvent event) { Player p = event.getPlayer(); - if (isScoreWorld(event.getFrom().getWorld().getName()) && !isScoreWorld(event.getTo().getWorld().getName())) { - p.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard()); - return; - } - if (!isScoreWorld(event.getFrom().getWorld().getName()) && isScoreWorld(event.getTo().getWorld().getName())) { - if (_plugin._scores.containsKey(p.getName())) { - p.setScoreboard(_plugin._scores.get(p.getName()).getScoreBoard()); - } else { - _plugin._scores.put(p.getName(), new ScoreB(_plugin, p)); - } - return; - } - } + if( isScoreWorld(event.getFrom().getWorld().getName()) ^ isScoreWorld(event.getTo().getWorld().getName())) { + + if (_plugin._scores.containsKey(p.getName())) { + _plugin._scores.get(p.getName()).displayScoreB( event.getTo().getWorld().getName()); + } else { + _plugin._scores.put(p.getName(), new ScoreB(_plugin, p)); + } + } + } + @EventHandler(priority=EventPriority.HIGHEST) public void onPlayerChat(AsyncPlayerChatEvent event) { Player player = event.getPlayer(); @@ -354,7 +351,7 @@ public class PlayerListener implements Listener { if (arena == null) { return; } - _plugin.getLogger().warning("Player : " + player.getName() + " Rage Quit !"); + _plugin.getLogger().warning("Player : " + player.getName() + " Rage Quit!"); arena.CrashLeaveArena(event.getPlayer()); } diff --git a/src/com/Geekpower14/Quake/Lobby/LobbyManager.java b/src/com/Geekpower14/Quake/Lobby/LobbyManager.java index 3dd0989..867749c 100644 --- a/src/com/Geekpower14/Quake/Lobby/LobbyManager.java +++ b/src/com/Geekpower14/Quake/Lobby/LobbyManager.java @@ -24,8 +24,10 @@ import org.bukkit.entity.Player; public class LobbyManager { public Quake _plugin; - public HashMap _locmin = new HashMap(); - public HashMap _locmax = new HashMap(); + public HashMap _arealocmin = new HashMap(); + public HashMap _arealocmax = new HashMap(); + public HashMap _walllocmin = new HashMap(); + public HashMap _walllocmax = new HashMap(); public Location _lobbyspawn = null; public List _LOBBYS = new ArrayList<>(); public List _LOBBYS_SIGN = new ArrayList<>(); @@ -36,42 +38,83 @@ public class LobbyManager { } public final void loadconfig() { - String nom; - File fichier_config = new File(_plugin.getDataFolder(), String.valueOf(File.separator) + "lobby.yml"); - YamlConfiguration config = YamlConfiguration.loadConfiguration((File)fichier_config); + String name; + int number,i; + File config_file = new File(_plugin.getDataFolder(), String.valueOf(File.separator) + "lobby.yml"); + YamlConfiguration config = YamlConfiguration.loadConfiguration((File)config_file); _lobbyspawn = str2loc(config.getString("LobbySpawn")); - int nombre = config.getInt("Nombre"); - int i = 0; - while (i < nombre) { - nom = config.getString("min.lobby" + i); - _locmin.put("lobby" + i, str2loc(nom)); + + number = config.getInt("LobbyAreaNb"); + i = 0; + while (i < number) { + name = config.getString("min.lobbyarea" + i); + _arealocmin.put("lobbyarea" + i, str2loc(name)); ++i; } i = 0; - while (i < nombre) { - nom = config.getString("max.lobby" + i); - _locmax.put("lobby" + i, str2loc(nom)); + while (i < number) { + name = config.getString("max.lobbyarea" + i); + _arealocmax.put("lobbyarea" + i, str2loc(name)); ++i; } - _plugin.getLogger().info("Lobby loading (" + nombre + ")..."); + _plugin.getLogger().info("Lobby Area Loaded: " + number + "!"); + + number = config.getInt("LobbyWallNb"); + i = 0; + while (i < number) { + name = config.getString("min.lobbywall" + i); + _walllocmin.put("lobbywall" + i, str2loc(name)); + ++i; + } + i = 0; + while (i < number) { + name = config.getString("max.lobbywall" + i); + _walllocmax.put("lobbywall" + i, str2loc(name)); + ++i; + } + _plugin.getLogger().info("Lobby Wall Loaded: " + number + "!"); } public void saveconfig() { Location loc; - File fichier_config = new File(_plugin.getDataFolder(), String.valueOf(File.separator) + "lobby.yml"); - YamlConfiguration config = YamlConfiguration.loadConfiguration(fichier_config); + File config_file = new File(_plugin.getDataFolder(), String.valueOf(File.separator) + "lobby.yml"); + + config_file.delete(); + + if(!config_file.exists()) { + try { + config_file.createNewFile(); + } catch(IOException e) { + // empty catch block + } + } + YamlConfiguration config = YamlConfiguration.loadConfiguration(config_file); + + if(_lobbyspawn != null) { config.set("LobbySpawn", (String.valueOf(_lobbyspawn.getWorld().getName()) + ", " + _lobbyspawn.getX() + ", " + _lobbyspawn.getY() + ", " + _lobbyspawn.getZ() + ", " + _lobbyspawn.getYaw() + ", " + _lobbyspawn.getPitch())); } - config.set("Nombre", _locmin.size()); - for(String l2 : _locmin.keySet()) { - loc = _locmin.get(l2); + config.set("LobbyAreaNb", _arealocmin.size()); + config.set("LobbyWallNb", _walllocmin.size()); + + for(String l2 : _arealocmin.keySet()) { + loc = _arealocmin.get(l2); config.set("min." + l2, (String.valueOf(loc.getWorld().getName()) + ", " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ", " + loc.getYaw() + ", " + loc.getPitch())); } - for(String l2 : _locmax.keySet()) { - loc = _locmax.get(l2); + for(String l2 : _arealocmax.keySet()) { + loc = _arealocmax.get(l2); + config.set("max." + l2, (String.valueOf(loc.getWorld().getName()) + ", " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ", " + loc.getYaw() + ", " + loc.getPitch())); + } + + for(String l2 : _walllocmin.keySet()) { + loc = _walllocmin.get(l2); + config.set("min." + l2, (String.valueOf(loc.getWorld().getName()) + ", " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ", " + loc.getYaw() + ", " + loc.getPitch())); + } + + for(String l2 : _walllocmax.keySet()) { + loc = _walllocmax.get(l2); config.set("max." + l2, (String.valueOf(loc.getWorld().getName()) + ", " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ", " + loc.getYaw() + ", " + loc.getPitch())); } @@ -81,7 +124,7 @@ public class LobbyManager { } catch (IOException l) { // empty catch block } - _plugin.getLogger().info("Lobby saving..."); + _plugin.getLogger().info("Lobby config saved!"); } public Location str2loc(String loc) { @@ -98,32 +141,60 @@ public class LobbyManager { _lobbyspawn = player.getLocation(); } - public Boolean removeLobby(String lobby) { - _locmin.remove(lobby); - _locmax.remove(lobby); - HashMap tempmin = new HashMap<>(); - HashMap tempmax = new HashMap<>(); - int i = 0; - for (String s : _locmin.keySet()) { - tempmin.put("lobby" + i, _locmin.get(s)); - tempmax.put("lobby" + i, _locmax.get(s)); - ++i; - } - _locmin = tempmin; - _locmax = tempmax; - return true; - } - - public Boolean addLobby(Player player) { - String lobby = "lobby" + _locmin.size(); + public Boolean addLobbyArea(Player player) { + String lobby = "lobbyarea" + _arealocmin.size(); try { LocalSession ls = WorldEdit.getInstance().getSessionManager().get(BukkitAdapter.adapt(player)); Region reg = ls.getSelection(BukkitAdapter.adapt(player.getWorld())); if(reg != null) { - _locmin.put(lobby, BukkitAdapter.adapt(player.getWorld(), reg.getMinimumPoint())); - _locmax.put(lobby, BukkitAdapter.adapt(player.getWorld(), reg.getMaximumPoint())); - player.sendMessage(ChatColor.YELLOW + "Lobby " + _locmin.size() + " cr\u00e9e successful \u00e9s"); + _arealocmin.put(lobby, BukkitAdapter.adapt(player.getWorld(), reg.getMinimumPoint())); + _arealocmax.put(lobby, BukkitAdapter.adapt(player.getWorld(), reg.getMaximumPoint())); + player.sendMessage(ChatColor.YELLOW + "Lobby " + (_arealocmin.size() - 1) + " successfully created."); + return true; + } + } catch(Exception ex) { + player.sendMessage(ChatColor.RED + "Internal error on region selection."); + } + return false; + } + + public Boolean removeLobbyArea(String lobby) { + _arealocmin.remove(lobby); + _arealocmax.remove(lobby); + HashMap tempmin = new HashMap<>(); + HashMap tempmax = new HashMap<>(); + int i = 0; + for (String s : _arealocmin.keySet()) { + tempmin.put("lobbyarea" + i, _arealocmin.get(s)); + tempmax.put("lobbyarea" + i, _arealocmax.get(s)); + ++i; + } + _arealocmin = tempmin; + _arealocmax = tempmax; + return true; + } + + public List getLobbyAreaIDList() { + List list = new ArrayList(); + + for (int i = 0; i < _arealocmin.size(); i++) { + list.add(String.valueOf(i)); + } + + return list; + } + + public Boolean addLobbyWall(Player player) { + String lobby = "lobbywall" + _walllocmin.size(); + try { + LocalSession ls = WorldEdit.getInstance().getSessionManager().get(BukkitAdapter.adapt(player)); + Region reg = ls.getSelection(BukkitAdapter.adapt(player.getWorld())); + + if(reg != null) { + _walllocmin.put(lobby, BukkitAdapter.adapt(player.getWorld(), reg.getMinimumPoint())); + _walllocmax.put(lobby, BukkitAdapter.adapt(player.getWorld(), reg.getMaximumPoint())); + player.sendMessage(ChatColor.YELLOW + "Lobby wall " + (_walllocmin.size() - 1) + " successfully created."); initsign(); return true; } @@ -133,23 +204,42 @@ public class LobbyManager { return false; } - public List getLobbyIndexList() { - List list = new ArrayList(); - - return new ArrayList<>(_locmin.keySet()); + public Boolean removeLobbyWall(String lobbywall) { + _walllocmin.remove(lobbywall); + _walllocmax.remove(lobbywall); + HashMap tempmin = new HashMap<>(); + HashMap tempmax = new HashMap<>(); + int i = 0; + for (String s : _walllocmin.keySet()) { + tempmin.put("lobbywall" + i, _walllocmin.get(s)); + tempmax.put("lobbywall" + i, _walllocmax.get(s)); + ++i; + } + _walllocmin = tempmin; + _walllocmax = tempmax; + return true; } + public List getLobbyWallIDList() { + List list = new ArrayList(); + + for (int i = 0; i < _walllocmin.size(); i++) { + list.add(String.valueOf(i)); + } + + return list; + } public Boolean initsign() { int index = 0; int i = 0; - while(i < _locmin.size()) { + while(i < _walllocmin.size()) { int x; int y; Arena arena; - String lobby = "lobby" + i; - Location min = _locmin.get(lobby); - Location max = _locmax.get(lobby); + String lobby = "lobbywall" + i; + Location min = _walllocmin.get(lobby); + Location max = _walllocmax.get(lobby); int xmax = 0; int xmin = 0; int z = 0; @@ -201,31 +291,61 @@ public class LobbyManager { return true; } - public Boolean isinLobby(Location loc) { - int oui = _locmin.size(); + public Boolean isinLobbyArea(Location loc) { + int yes = _arealocmin.size(); int i = 0; - while (i < _locmin.size()) { - String lobby = "lobby" + i; - Location min = _locmin.get(lobby); - Location max = _locmax.get(lobby); + while (i < _arealocmin.size()) { + String lobby = "lobbyarea" + i; + Location min = _arealocmin.get(lobby); + Location max = _arealocmax.get(lobby); if (min.getWorld() != loc.getWorld()) { - --oui; + --yes; } else if (loc.getX() < min.getX()) { - --oui; + --yes; } else if (loc.getX() > max.getX()) { - --oui; + --yes; } else if (loc.getZ() < min.getZ()) { - --oui; + --yes; } else if (loc.getZ() > max.getZ()) { - --oui; + --yes; } else if (loc.getY() < min.getY()) { - --oui; + --yes; } else if (loc.getY() > max.getY()) { - --oui; + --yes; } ++i; } - if (oui <= 0) { + if (yes <= 0) { + return false; + } + return true; + } + + public Boolean isinLobbyWall(Location loc) { + int yes = _walllocmin.size(); + int i = 0; + while (i < _walllocmin.size()) { + String lobby = "lobbywall" + i; + Location min = _walllocmin.get(lobby); + Location max = _walllocmax.get(lobby); + if (min.getWorld() != loc.getWorld()) { + --yes; + } else if (loc.getX() < min.getX()) { + --yes; + } else if (loc.getX() > max.getX()) { + --yes; + } else if (loc.getZ() < min.getZ()) { + --yes; + } else if (loc.getZ() > max.getZ()) { + --yes; + } else if (loc.getY() < min.getY()) { + --yes; + } else if (loc.getY() > max.getY()) { + --yes; + } + ++i; + } + if (yes <= 0) { return false; } return true; diff --git a/src/com/Geekpower14/Quake/Utils/ScoreB.java b/src/com/Geekpower14/Quake/Utils/ScoreB.java index 229129e..575e944 100644 --- a/src/com/Geekpower14/Quake/Utils/ScoreB.java +++ b/src/com/Geekpower14/Quake/Utils/ScoreB.java @@ -38,39 +38,52 @@ public final class ScoreB { _objective.getScore(_plugin._trad.get("ScoreBoard.Shots.name")).setScore(_Shots); _objective.getScore(_plugin._trad.get("ScoreBoard.Wins.name")).setScore(_Wins); - if (isScoreWorld(_player.getWorld().getName())) { - _player.setScoreboard(_board); - } else if (!isScoreWorld(_player.getWorld().getName())) { - _player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard()); - } + displayScoreB( ""); } public void updateScore() { - if (_Shots == _plugin._eco.getScore(_player, Score.Type.Shot) && _Deaths == _plugin._eco.getScore(_player, Score.Type.Death) && _Money == _plugin._eco.getPlayerMoney(_player)) { - return; - } - _Kills = _plugin._eco.getScore(_player, Score.Type.Kill); - _Deaths = _plugin._eco.getScore(_player, Score.Type.Death); - _Shots = _plugin._eco.getScore(_player, Score.Type.Shot); - _Wins = _plugin._eco.getScore(_player, Score.Type.Win); - _Money = _plugin._eco.getPlayerMoney(_player); - _objective.getScore(_plugin._trad.get("Shop.Coins.name")).setScore(_Money); - _objective.getScore(_plugin._trad.get("ScoreBoard.Kills.name")).setScore(_Kills); - _objective.getScore(_plugin._trad.get("ScoreBoard.Deaths.name")).setScore(_Deaths); - _objective.getScore(_plugin._trad.get("ScoreBoard.Shots.name")).setScore(_Shots); - _objective.getScore(_plugin._trad.get("ScoreBoard.Wins.name")).setScore(_Wins); - - if (isScoreWorld(_player.getWorld().getName())) { - _player.setScoreboard(_board); - } else { - _player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard()); - } + if( _Shots != _plugin._eco.getScore(_player, Score.Type.Shot) || _Deaths != _plugin._eco.getScore(_player, Score.Type.Death) || _Money != _plugin._eco.getPlayerMoney(_player)) { + _Kills = _plugin._eco.getScore(_player, Score.Type.Kill); + _Deaths = _plugin._eco.getScore(_player, Score.Type.Death); + _Shots = _plugin._eco.getScore(_player, Score.Type.Shot); + _Wins = _plugin._eco.getScore(_player, Score.Type.Win); + _Money = _plugin._eco.getPlayerMoney(_player); + _objective.getScore(_plugin._trad.get("Shop.Coins.name")).setScore(_Money); + _objective.getScore(_plugin._trad.get("ScoreBoard.Kills.name")).setScore(_Kills); + _objective.getScore(_plugin._trad.get("ScoreBoard.Deaths.name")).setScore(_Deaths); + _objective.getScore(_plugin._trad.get("ScoreBoard.Shots.name")).setScore(_Shots); + _objective.getScore(_plugin._trad.get("ScoreBoard.Wins.name")).setScore(_Wins); + } + + displayScoreB( ""); } public Scoreboard getScoreBoard() { return _board; } + public void displayScoreB(String target_world) { + String world; + + if( target_world != "") { + world = target_world; + } else { + world = _player.getWorld().getName(); + } + + if( isScoreWorld( world)) { + if( _plugin._lobby.isinLobbyArea(_player.getLocation())) { + _player.setScoreboard(_board); + } else { + _player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard()); + } + } else { + _player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard()); + } + + return; + } + public Boolean isScoreWorld(String name) { return _plugin._ScoreWorlds.contains(name); }