Browse Source

Fixed tons of bugs

master
pintux98 6 years ago
parent
commit
d4428ff10e
  1. 1
      MultiArena-TheBridge/lang.yml
  2. 11
      MultiArena-TheBridge/src/cx/sfy/TheBridge/cmds/SetupCMD.java
  3. 21
      MultiArena-TheBridge/src/cx/sfy/TheBridge/database/Cosmeticbase.java
  4. 32
      MultiArena-TheBridge/src/cx/sfy/TheBridge/game/GameDuo.java
  5. 18
      MultiArena-TheBridge/src/cx/sfy/TheBridge/listeners/PlayerListener.java
  6. 3
      MultiArena-TheBridge/src/cx/sfy/TheBridge/managers/ScoreboardManager.java

1
MultiArena-TheBridge/lang.yml

@ -347,6 +347,7 @@ titles:
subtitle: <color><life>
scoreboards:
main-title: '&e&lTHE BRIDGE LOBBY'
main-enabled: true
main: |-
&f
&fName: &a<player>

11
MultiArena-TheBridge/src/cx/sfy/TheBridge/cmds/SetupCMD.java

@ -36,7 +36,11 @@ public class SetupCMD implements CommandExecutor {
if (sender instanceof Player) {
final Player p = (Player) sender;
if (args.length < 1) {
sendHelp(p);
if (p.hasPermission("bridges.admin")) {
sendHelp(p);
} else {
sendPlayerCommands(p);
}
return true;
}
switch (args[0].toLowerCase()) {
@ -270,7 +274,10 @@ public class SetupCMD implements CommandExecutor {
break;
case "help":
if (!p.hasPermission("bridges.admin")) {
p.sendMessage(plugin.getLang().get("messages.noPermission"));
if (args.length < 2) {
sendPlayerCommands(p);
return true;
}
return true;
}
if (args.length < 2) {

21
MultiArena-TheBridge/src/cx/sfy/TheBridge/database/Cosmeticbase.java

@ -86,10 +86,9 @@ public class Cosmeticbase {
try {
StringBuilder queryBuilder = new StringBuilder();
queryBuilder.append("INSERT INTO `BG_Cosmetic` ");
queryBuilder.append(
"(`UUID`, `Name`, `Cage`, `Arrow_Trail`, `Feet_Trail`, `KillSound`, 'Victory', 'Ability', 'Kit') ");
queryBuilder.append("(`UUID`, `Name`, `Cage`, `Arrow_Trail`, `Feet_Trail`, `KillSound`) ");
queryBuilder.append("VALUES ");
queryBuilder.append("(?, ?, ?, ?, ?, ?, ?, ?, ?);");
queryBuilder.append("(?, ?, ?, ?, ?, ?);");
preparedStatement = connection.prepareStatement(queryBuilder.toString());
preparedStatement.setString(1, fId);
preparedStatement.setString(2, name);
@ -97,9 +96,6 @@ public class Cosmeticbase {
preparedStatement.setString(4, "default");
preparedStatement.setString(5, "default");
preparedStatement.setString(6, "default");
preparedStatement.setString(7, "default");
preparedStatement.setString(8, "default");
preparedStatement.setString(9, "default");
preparedStatement.executeUpdate();
} catch (final SQLException sqlException) {
sqlException.printStackTrace();
@ -166,8 +162,7 @@ public class Cosmeticbase {
ResultSet resultSet = null;
try {
StringBuilder queryBuilder = new StringBuilder();
queryBuilder.append(
"SELECT `Cage`, `Arrow_Trail`, `Feet_Trail`, `KillSound`, 'Victory', 'Ability', 'Kit' ");
queryBuilder.append("SELECT `Cage`, `Arrow_Trail`, `Feet_Trail`, `KillSound` ");
queryBuilder.append("FROM `BG_Cosmetic` ");
queryBuilder.append("WHERE `UUID` = ? ");
queryBuilder.append("LIMIT 1;");
@ -206,18 +201,14 @@ public class Cosmeticbase {
try {
StringBuilder queryBuilder = new StringBuilder();
queryBuilder.append("UPDATE `BG_Cosmetic` SET ");
queryBuilder.append(
"`Cage` = ?, `Arrow_Trail` = ?, `Feet_Trail` = ?, `KillSound` = ?, 'Victory' = ?, 'Ability' = ?, 'Kit' = ?");
queryBuilder.append("`Cage` = ?, `Arrow_Trail` = ?, `Feet_Trail` = ?, `KillSound` = ?");
queryBuilder.append("WHERE `UUID` = ?;");
preparedStatement = connection.prepareStatement(queryBuilder.toString());
preparedStatement.setString(1, stat.getCage());
preparedStatement.setString(2, stat.getArrow_trail());
preparedStatement.setString(3, stat.getFeet_trail());
preparedStatement.setString(4, "default");
preparedStatement.setString(5, "default");
preparedStatement.setString(6, "default");
preparedStatement.setString(7, "default");
preparedStatement.setString(8, stat.getUUID());
preparedStatement.setString(5, stat.getUUID());
preparedStatement.executeUpdate();
} catch (SQLException sqlException) {
sqlException.printStackTrace();
@ -242,7 +233,7 @@ public class Cosmeticbase {
Statement statement = connection.createStatement();
try {
statement.executeUpdate(
"CREATE TABLE IF NOT EXISTS BG_Cosmetic (UUID VARCHAR(60), Name VARCHAR(60), Cage TEXT, Arrow_Trail TEXT, Feet_Trail TEXT, KillSound TEXT, Victory TEXT, Ability TEXT, Kit TEXT)");
"CREATE TABLE IF NOT EXISTS BG_Cosmetic (UUID VARCHAR(60), Name VARCHAR(60), Cage TEXT, Arrow_Trail TEXT, Feet_Trail TEXT, KillSound TEXT)");
} catch (SQLException ex) {
try {
if (statement != null) {

32
MultiArena-TheBridge/src/cx/sfy/TheBridge/game/GameDuo.java

@ -33,25 +33,25 @@ import cx.sfy.TheBridge.utils.Utils;
public class GameDuo {
private final Main plugin;
private final HashMap<ChatColor, TeamDuo> teams;
private final HashMap<Player, ChatColor> teamPlayer;
private final ArrayList<Player> players;
private final HashMap<Player, PlayerData> pd = new HashMap<>();
private final HashMap<Player, Integer> goals = new HashMap<>();
private final HashMap<Player, Integer> kills = new HashMap<>();
private final ArrayList<TruenoHologram> holograms = new ArrayList<>();
private final ArrayList<Location> build = new ArrayList<>();
private final ArrayList<Location> placed = new ArrayList<>();
private final String name;
private final String mode;
private final int min;
private final int max;
private final int teamSize;
private HashMap<ChatColor, TeamDuo> teams;
private HashMap<Player, ChatColor> teamPlayer;
private ArrayList<Player> players;
private HashMap<Player, PlayerData> pd = new HashMap<>();
private HashMap<Player, Integer> goals = new HashMap<>();
private HashMap<Player, Integer> kills = new HashMap<>();
private ArrayList<TruenoHologram> holograms = new ArrayList<>();
private ArrayList<Location> build = new ArrayList<>();
private ArrayList<Location> placed = new ArrayList<>();
private String name;
private String mode;
private int min;
private int max;
private int teamSize;
private int starting;
private int prestart;
private int restart;
private final Location lobby;
private final Location spect;
private Location lobby;
private Location spect;
private BukkitTask start;
private BukkitTask prestarts;
private State state;

18
MultiArena-TheBridge/src/cx/sfy/TheBridge/listeners/PlayerListener.java

@ -124,9 +124,11 @@ public class PlayerListener implements Listener {
public void onCommand(PlayerCommandPreprocessEvent e) {
if (plugin.getGm().getGameByPlayer(e.getPlayer()) != null
|| plugin.getGm().getGameFourByPlayer(e.getPlayer()) != null) {
final List<String> cmds = plugin.getConfig().getStringList("commands.list");
List<String> cmds = plugin.getConfig().getStringList("commands.list");
if (e.getMessage().contains("/bridges"))
return;
if (e.getPlayer().hasPermission("bridges.admin") || e.getPlayer().isOp())
return;
if (plugin.getConfig().getBoolean("commands.whitelist") == true) {
if (!cmds.contains(e.getMessage()))
e.setCancelled(true);
@ -1204,12 +1206,14 @@ public class PlayerListener implements Listener {
public void onShoot(EntityShootBowEvent e) {
if (e.getEntity() instanceof Player) {
final Player p = (Player) e.getEntity();
if (bow.contains(p)) {
p.sendMessage(plugin.getLang().get("messages.noShoot"));
e.setCancelled(true);
} else {
timeBow(p);
bow.add(p);
if (plugin.getGm().getGameFourByPlayer(p) != null || plugin.getGm().getGameByPlayer(p) != null) {
if (bow.contains(p)) {
p.sendMessage(plugin.getLang().get("messages.noShoot"));
e.setCancelled(true);
} else {
timeBow(p);
bow.add(p);
}
}
}
}

3
MultiArena-TheBridge/src/cx/sfy/TheBridge/managers/ScoreboardManager.java

@ -32,6 +32,9 @@ public class ScoreboardManager {
}
public void createLobbyBoard(Player p) {
if(!plugin.getLang().getBoolean("scoreboards.main-enabled")) {
return;
}
sb.put(p, "lobby");
p.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
ScoreboardUtil scoreboardUtil = new ScoreboardUtil("all", "starting", false);

Loading…
Cancel
Save