From 7d67c7615b13880fcf472b8858cc040186599b25 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 28 Dec 2020 17:33:24 +0100 Subject: [PATCH 01/10] Add Teamcolor --- .../bungeecore/commands/TeamCommand.java | 46 +++++++++++++++++++ .../steamwar/bungeecore/inventory/SWItem.java | 7 ++- .../bungeecore/listeners/ChatListener.java | 2 +- src/de/steamwar/bungeecore/sql/Team.java | 20 ++++++-- 4 files changed, 68 insertions(+), 7 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index 601bd580..fa16480a 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -20,6 +20,9 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.inventory.SWItem; +import de.steamwar.bungeecore.inventory.SWListInv; +import de.steamwar.bungeecore.schematic.SchemGUI; import de.steamwar.bungeecore.sql.Event; import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.bungeecore.sql.Team; @@ -40,6 +43,27 @@ import static de.steamwar.bungeecore.Storage.teamInvitations; public class TeamCommand extends BasicCommand { + private static final List> COLOR_CODES = new ArrayList<>(); + + static { + COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§4", 1), "4")); + COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("brick", "§c"), "c")); + COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§6", 14), "6")); + COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§e", 11), "e")); + COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§2", 2), "2")); + COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§a", 10), "a")); + COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§b", 12), "b")); + COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§3", 6), "3")); + COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§1", 4), "1")); + COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§9", 6), "9")); + COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§d", 9), "d")); + COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§5", 13), "5")); + COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§f", 15), "f")); + COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§7", 7), "7")); + COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§8", 8), "8")); + COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§0", 0), "0")); + } + public TeamCommand() { super("team", ""); } @@ -67,6 +91,7 @@ public class TeamCommand extends BasicCommand { BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam remove §8- §7Entferne jemanden aus deinem Team"); BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam changekuerzel §8- §7Ändere dein Teamkürzel"); BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam changename §8- §7Ändere deinen Teamnamen"); + BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam changecolor §8- §7Ändere deine Teamfarbe"); BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam changeleader §8- §7Ernenne jemanden zum Teamleader"); } } @@ -111,6 +136,9 @@ public class TeamCommand extends BasicCommand { case "changeleader": changeleader(player, user, team, args); break; + case "changecolor": + changeColor(player, user, team); + break; case "info": info(player, user, team, args); break; @@ -490,6 +518,23 @@ public class TeamCommand extends BasicCommand { } } + private void changeColor(ProxiedPlayer player, SteamwarUser user, Team team) { + if(notLeader(player, user, team)) + return; + + if(notDuringEvent(player)) + return; + + List> colors = new ArrayList<>(); + COLOR_CODES.forEach(stringSWListEntry -> colors.add(new SWListInv.SWListEntry<>(stringSWListEntry.getItem().setName(stringSWListEntry.getItem().getTitle() + Team.get(user.getTeam()).getTeamKuerzel()), stringSWListEntry.getObject()))); + + SWListInv inv = new SWListInv<>(player, "§6Farbe wählen", colors, (click, element) -> { + SchemGUI.closeInventory(player); + team.setTeamColor(element); + }); + inv.open(); + } + private boolean checkTeamName(ProxiedPlayer player, Team team, String arg){ if(arg.length() < 4 || arg.length() > 15){ BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cEin Teamname muss aus 4 bis 15 Buchstaben bestehen"); @@ -566,6 +611,7 @@ public class TeamCommand extends BasicCommand { tab.add("changekuerzel"); tab.add("changename"); tab.add("changeleader"); + tab.add("changecolor"); }else if(args.length == 2){ if(args[1].equalsIgnoreCase("event")){ List coming = Event.getComing(); diff --git a/src/de/steamwar/bungeecore/inventory/SWItem.java b/src/de/steamwar/bungeecore/inventory/SWItem.java index 41f6ea11..2e9d80c3 100644 --- a/src/de/steamwar/bungeecore/inventory/SWItem.java +++ b/src/de/steamwar/bungeecore/inventory/SWItem.java @@ -97,8 +97,13 @@ public class SWItem { this.hideAttributes = hideAttributes; } - public void setName(String name) { + public SWItem setName(String name) { title = name; + return this; + } + + public String getTitle() { + return title; } public void addLore(String lore) { diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index 0ee62653..96a06e87 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -166,7 +166,7 @@ public class ChatListener extends BasicListener { String msg = name + "§7»" + chatcolor + " " + message; if(user.getTeam() != 0){ - msg = "§8" + Team.get(user.getTeam()).getTeamKuerzel() + " §r" + msg; + msg = "§" + Team.get(user.getTeam()).getTeamColor() + Team.get(user.getTeam()).getTeamKuerzel() + " §r" + msg; } String[] msgSplits = msg.split(" "); diff --git a/src/de/steamwar/bungeecore/sql/Team.java b/src/de/steamwar/bungeecore/sql/Team.java index d2416cc3..2e7ba351 100644 --- a/src/de/steamwar/bungeecore/sql/Team.java +++ b/src/de/steamwar/bungeecore/sql/Team.java @@ -34,22 +34,24 @@ public class Team { private String teamKuerzel; private String teamName; private int teamLeader; + private String teamColor; private static final List teamCache = new LinkedList<>(); - private static final Team pub = new Team(0, "PUB", "Öffentlich", 0); + private static final Team pub = new Team(0, "PUB", "Öffentlich", 0, "&7"); - private Team(int id, String kuerzel, String name, int leader){ + private Team(int id, String kuerzel, String name, int leader, String color){ teamId = id; teamKuerzel = kuerzel; teamName = name; teamLeader = leader; + teamColor = color; if (id != 0) { teamCache.add(this); } } private Team(ResultSet rs) throws SQLException { - this(rs.getInt("TeamID"), rs.getString("TeamKuerzel"), rs.getString("TeamName"), rs.getInt("TeamLeader")); + this(rs.getInt("TeamID"), rs.getString("TeamKuerzel"), rs.getString("TeamName"), rs.getInt("TeamLeader"), rs.getString("TeamColor")); } public static void create(String kuerzel, String name, int leader){ @@ -58,7 +60,7 @@ public class Team { public static Team get(int id){ if(id == -1) - return new Team(-1, "?", "?", 0); + return new Team(-1, "?", "?", 0, "8"); if(id == 0) return pub; for(Team team : teamCache) @@ -108,7 +110,7 @@ public class Team { } private void updateDB(){ - SQL.update("INSERT INTO Team (TeamID, TeamKuerzel, TeamName, TeamLeader) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE TeamName = VALUES(TeamName), TeamKuerzel = VALUES(TeamKuerzel), TeamLeader = VALUES(TeamLeader)", teamId, teamKuerzel, teamName, teamLeader); + SQL.update("INSERT INTO Team (TeamID, TeamKuerzel, TeamName, TeamLeader, TeamColor) VALUES (?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE TeamName = VALUES(TeamName), TeamKuerzel = VALUES(TeamKuerzel), TeamLeader = VALUES(TeamLeader), TeamColor = VALUES(TeamColor)", teamId, teamKuerzel, teamName, teamLeader, teamColor); } public int getTeamId() { @@ -142,6 +144,14 @@ public class Team { updateDB(); } + public String getTeamColor() { + return teamColor; + } + + public void setTeamColor(String teamColor) { + this.teamColor = teamColor; + } + public int size(){ ResultSet rs = select("SELECT COUNT(id) FROM UserData WHERE Team = ?", teamId); try { From d86122a278ee25a360f4180b209edbf539ea4c26 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 28 Dec 2020 17:37:38 +0100 Subject: [PATCH 02/10] Fixing old Dependencies --- src/de/steamwar/bungeecore/commands/TeamCommand.java | 5 +++-- src/de/steamwar/bungeecore/inventory/SWListInv.java | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index fa16480a..aa724872 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -20,9 +20,10 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.comms.packets.CloseInventoryPacket; +import de.steamwar.bungeecore.inventory.SWInventory; import de.steamwar.bungeecore.inventory.SWItem; import de.steamwar.bungeecore.inventory.SWListInv; -import de.steamwar.bungeecore.schematic.SchemGUI; import de.steamwar.bungeecore.sql.Event; import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.bungeecore.sql.Team; @@ -529,7 +530,7 @@ public class TeamCommand extends BasicCommand { COLOR_CODES.forEach(stringSWListEntry -> colors.add(new SWListInv.SWListEntry<>(stringSWListEntry.getItem().setName(stringSWListEntry.getItem().getTitle() + Team.get(user.getTeam()).getTeamKuerzel()), stringSWListEntry.getObject()))); SWListInv inv = new SWListInv<>(player, "§6Farbe wählen", colors, (click, element) -> { - SchemGUI.closeInventory(player); + SWListInv.closeInventory(player); team.setTeamColor(element); }); inv.open(); diff --git a/src/de/steamwar/bungeecore/inventory/SWListInv.java b/src/de/steamwar/bungeecore/inventory/SWListInv.java index bd437303..e10925cd 100644 --- a/src/de/steamwar/bungeecore/inventory/SWListInv.java +++ b/src/de/steamwar/bungeecore/inventory/SWListInv.java @@ -19,8 +19,10 @@ package de.steamwar.bungeecore.inventory; +import de.steamwar.bungeecore.comms.packets.CloseInventoryPacket; import de.steamwar.bungeecore.sql.Schematic; import de.steamwar.bungeecore.sql.SchematicType; +import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.BungeeCord; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -142,4 +144,8 @@ public class SWListInv extends SWInventory { return object; } } + + public static void closeInventory(ProxiedPlayer player) { + new CloseInventoryPacket(SteamwarUser.get(player).getId()).send(player); + } } From 14479271cde3a280dbb853de9d33c04998223750 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 28 Dec 2020 17:38:26 +0100 Subject: [PATCH 03/10] Optimize Imports --- src/de/steamwar/bungeecore/commands/TeamCommand.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index aa724872..e652d8db 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -20,8 +20,6 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.BungeeCore; -import de.steamwar.bungeecore.comms.packets.CloseInventoryPacket; -import de.steamwar.bungeecore.inventory.SWInventory; import de.steamwar.bungeecore.inventory.SWItem; import de.steamwar.bungeecore.inventory.SWListInv; import de.steamwar.bungeecore.sql.Event; From 065ab72625483e7690cc32bb2740b3e1419c0c48 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 28 Dec 2020 17:54:24 +0100 Subject: [PATCH 04/10] Improve Color List --- .../bungeecore/commands/TeamCommand.java | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index e652d8db..f1e2fda6 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -45,22 +45,26 @@ public class TeamCommand extends BasicCommand { private static final List> COLOR_CODES = new ArrayList<>(); static { - COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§4", 1), "4")); - COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("brick", "§c"), "c")); - COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§6", 14), "6")); - COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§e", 11), "e")); - COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§2", 2), "2")); - COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§a", 10), "a")); - COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§b", 12), "b")); - COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§3", 6), "3")); - COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§1", 4), "1")); - COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§9", 6), "9")); - COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§d", 9), "d")); - COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§5", 13), "5")); - COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§f", 15), "f")); - COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§7", 7), "7")); - COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§8", 8), "8")); - COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§0", 0), "0")); + addColor("4", 1); + addColor("c", 15); + addColor("6", 14); + addColor("e", 11); + addColor("2", 2); + addColor("a", 10); + addColor("b", 12); + addColor("3", 6); + addColor("1", 4); + addColor("9", 6); + addColor("d", 9); + addColor("5", 5); + addColor("f", 15); + addColor("7", 7); + addColor("8", 8); + addColor("0", 0); + } + + private static void addColor(String color, int colorCode) { + COLOR_CODES.add(new SWListInv.SWListEntry(new SWItem("§" + color, colorCode), color)); } public TeamCommand() { From a2169ec3e181b613d107b9d249cae4d4c469d763 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 28 Dec 2020 19:16:51 +0100 Subject: [PATCH 05/10] Fixing --- src/de/steamwar/bungeecore/commands/EventCommand.java | 4 ++-- src/de/steamwar/bungeecore/commands/TeamCommand.java | 9 +++++---- src/de/steamwar/bungeecore/inventory/SWListInv.java | 4 ---- src/de/steamwar/bungeecore/sql/Team.java | 1 + 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/EventCommand.java b/src/de/steamwar/bungeecore/commands/EventCommand.java index 4a93cc19..6e4b8e54 100644 --- a/src/de/steamwar/bungeecore/commands/EventCommand.java +++ b/src/de/steamwar/bungeecore/commands/EventCommand.java @@ -91,9 +91,9 @@ public class EventCommand extends BasicCommand { e.getEventName()); Set teams = TeamTeilnahme.getTeams(e.getEventID()); if(!teams.isEmpty()){ - StringBuilder tline = new StringBuilder("§7 Mit§8: §e"); + StringBuilder tline = new StringBuilder("§7 Mit§8: "); for(Team t : teams){ - tline.append(t.getTeamKuerzel()).append(" "); + tline.append("§").append(t.getTeamColor()).append(t.getTeamKuerzel()).append(" "); } BungeeCore.send(player, tline.toString()); } diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index f1e2fda6..9b255436 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -402,7 +402,7 @@ public class TeamCommand extends BasicCommand { return; } - BungeeCore.send(player, "§7Team §e" + team.getTeamName() + " §8[§e" + team.getTeamKuerzel() + "§8]"); + BungeeCore.send(player, "§7Team §e" + team.getTeamName() + " §8[§" + team.getTeamColor() + team.getTeamKuerzel() + "§8]"); BungeeCore.send(player, "§7Leader§8: " + SteamwarUser.get(team.getTeamLeader()).getUserName()); if(team.getMembers().size() > 1) { @@ -454,7 +454,7 @@ public class TeamCommand extends BasicCommand { for(int i = (page-1) * TEAMS_PER_PAGE; i < (page-1) * TEAMS_PER_PAGE + TEAMS_PER_PAGE && i < all.size(); i++){ Team tm = all.get(i); BungeeCore.send(player, - "§8" + tm.getTeamKuerzel() + " §e" + tm.getTeamName() + " §8[§7" + SteamwarUser.get(tm.getTeamLeader()).getUserName() + "§8]", + "§" + tm.getTeamColor() + tm.getTeamKuerzel() + " §e" + tm.getTeamName() + " §8[§7" + SteamwarUser.get(tm.getTeamLeader()).getUserName() + "§8]", "§7Teaminfo", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/team info " + tm.getTeamKuerzel())); } @@ -531,8 +531,9 @@ public class TeamCommand extends BasicCommand { List> colors = new ArrayList<>(); COLOR_CODES.forEach(stringSWListEntry -> colors.add(new SWListInv.SWListEntry<>(stringSWListEntry.getItem().setName(stringSWListEntry.getItem().getTitle() + Team.get(user.getTeam()).getTeamKuerzel()), stringSWListEntry.getObject()))); - SWListInv inv = new SWListInv<>(player, "§6Farbe wählen", colors, (click, element) -> { - SWListInv.closeInventory(player); + SWListInv inv = new SWListInv<>(player, "§6Farbe wählen", colors, (click, element) -> {}); + inv.setCallback((click, element) -> { + inv.close(); team.setTeamColor(element); }); inv.open(); diff --git a/src/de/steamwar/bungeecore/inventory/SWListInv.java b/src/de/steamwar/bungeecore/inventory/SWListInv.java index e10925cd..d12c4324 100644 --- a/src/de/steamwar/bungeecore/inventory/SWListInv.java +++ b/src/de/steamwar/bungeecore/inventory/SWListInv.java @@ -144,8 +144,4 @@ public class SWListInv extends SWInventory { return object; } } - - public static void closeInventory(ProxiedPlayer player) { - new CloseInventoryPacket(SteamwarUser.get(player).getId()).send(player); - } } diff --git a/src/de/steamwar/bungeecore/sql/Team.java b/src/de/steamwar/bungeecore/sql/Team.java index 2e7ba351..8ca71244 100644 --- a/src/de/steamwar/bungeecore/sql/Team.java +++ b/src/de/steamwar/bungeecore/sql/Team.java @@ -150,6 +150,7 @@ public class Team { public void setTeamColor(String teamColor) { this.teamColor = teamColor; + updateDB(); } public int size(){ From 69e8a4e24f4a3547dc9ebbbad3ebf37628dcfc85 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 29 Dec 2020 01:38:47 +0100 Subject: [PATCH 06/10] Using more of Color --- src/de/steamwar/bungeecore/EventStarter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/EventStarter.java b/src/de/steamwar/bungeecore/EventStarter.java index 9cb1eaf9..5271eccc 100644 --- a/src/de/steamwar/bungeecore/EventStarter.java +++ b/src/de/steamwar/bungeecore/EventStarter.java @@ -73,7 +73,7 @@ public class EventStarter implements Runnable { eventServer.put(blue.getTeamId(), subserver); eventServer.put(red.getTeamId(), subserver); - BungeeCore.broadcast(BungeeCore.CHAT_PREFIX + "§7Hier §eklicken §7für den Kampf §e" + blue.getTeamName() + " §8vs §e" + red.getTeamName(), + BungeeCore.broadcast(BungeeCore.CHAT_PREFIX + "§7Hier §eklicken §7für den Kampf §" + blue.getTeamColor() + blue.getTeamName() + " §8vs §" + red.getTeamColor() + red.getTeamName(), "§eEvent beitreten", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/event " + blue.getTeamKuerzel())); } From 4d752e033cf95a9a4f0019f34789fab491365009 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 29 Dec 2020 14:47:58 +0100 Subject: [PATCH 07/10] Fixing --- src/de/steamwar/bungeecore/listeners/ChatListener.java | 3 ++- src/de/steamwar/bungeecore/sql/Team.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index 96a06e87..878ea45e 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -166,7 +166,8 @@ public class ChatListener extends BasicListener { String msg = name + "§7»" + chatcolor + " " + message; if(user.getTeam() != 0){ - msg = "§" + Team.get(user.getTeam()).getTeamColor() + Team.get(user.getTeam()).getTeamKuerzel() + " §r" + msg; + Team team = Team.get(user.getTeam()); + msg = "§" + team.getTeamColor() + team.getTeamKuerzel() + " §r" + msg; } String[] msgSplits = msg.split(" "); diff --git a/src/de/steamwar/bungeecore/sql/Team.java b/src/de/steamwar/bungeecore/sql/Team.java index 8ca71244..12855478 100644 --- a/src/de/steamwar/bungeecore/sql/Team.java +++ b/src/de/steamwar/bungeecore/sql/Team.java @@ -37,7 +37,7 @@ public class Team { private String teamColor; private static final List teamCache = new LinkedList<>(); - private static final Team pub = new Team(0, "PUB", "Öffentlich", 0, "&7"); + private static final Team pub = new Team(0, "PUB", "Öffentlich", 0, "8"); private Team(int id, String kuerzel, String name, int leader, String color){ teamId = id; From 8128d440112d5d5ab99e35b132811d02c7d8687f Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Wed, 30 Dec 2020 17:12:28 +0100 Subject: [PATCH 08/10] Imports... --- src/de/steamwar/bungeecore/inventory/SWListInv.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/inventory/SWListInv.java b/src/de/steamwar/bungeecore/inventory/SWListInv.java index d12c4324..bd437303 100644 --- a/src/de/steamwar/bungeecore/inventory/SWListInv.java +++ b/src/de/steamwar/bungeecore/inventory/SWListInv.java @@ -19,10 +19,8 @@ package de.steamwar.bungeecore.inventory; -import de.steamwar.bungeecore.comms.packets.CloseInventoryPacket; import de.steamwar.bungeecore.sql.Schematic; import de.steamwar.bungeecore.sql.SchematicType; -import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.BungeeCord; import net.md_5.bungee.api.connection.ProxiedPlayer; From 0ef5f6dcb9418978b7202becab54c99c22fe82aa Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 1 Jan 2021 02:15:12 +0100 Subject: [PATCH 09/10] Fixing Stuff... --- .../steamwar/bungeecore/commands/TeamCommand.java | 6 +++++- src/de/steamwar/bungeecore/inventory/SWItem.java | 14 ++++++++++++++ .../steamwar/bungeecore/inventory/SWListInv.java | 1 - 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index 9b255436..51b33d09 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -529,7 +529,11 @@ public class TeamCommand extends BasicCommand { return; List> colors = new ArrayList<>(); - COLOR_CODES.forEach(stringSWListEntry -> colors.add(new SWListInv.SWListEntry<>(stringSWListEntry.getItem().setName(stringSWListEntry.getItem().getTitle() + Team.get(user.getTeam()).getTeamKuerzel()), stringSWListEntry.getObject()))); + COLOR_CODES.forEach(stringSWListEntry -> { + SWItem item = stringSWListEntry.getItem().clone(); + item.setName(stringSWListEntry.getItem().getTitle() + Team.get(user.getTeam()).getTeamKuerzel()); + colors.add(new SWListInv.SWListEntry<>(item, stringSWListEntry.getObject())); + }); SWListInv inv = new SWListInv<>(player, "§6Farbe wählen", colors, (click, element) -> {}); inv.setCallback((click, element) -> { diff --git a/src/de/steamwar/bungeecore/inventory/SWItem.java b/src/de/steamwar/bungeecore/inventory/SWItem.java index 2e9d80c3..f5a4476a 100644 --- a/src/de/steamwar/bungeecore/inventory/SWItem.java +++ b/src/de/steamwar/bungeecore/inventory/SWItem.java @@ -156,4 +156,18 @@ public class SWItem { public void setLore(List lore) { this.lore = lore; } + + public SWItem clone() { + SWItem item; + if(color != 0) { + item = new SWItem(title, color); + }else { + item = new SWItem(material, title); + } + item.setLore(lore); + item.setCallback(callback); + item.setEnchanted(enchanted); + item.setHideAttributes(hideAttributes); + return item; + } } diff --git a/src/de/steamwar/bungeecore/inventory/SWListInv.java b/src/de/steamwar/bungeecore/inventory/SWListInv.java index bd437303..1161260c 100644 --- a/src/de/steamwar/bungeecore/inventory/SWListInv.java +++ b/src/de/steamwar/bungeecore/inventory/SWListInv.java @@ -40,7 +40,6 @@ public class SWListInv extends SWInventory { @Override public void open(){ - setCallback(-999, (InvCallback.ClickType click) -> close()); if(elements.size() > 54){ if(page != 0) addItem(45, new SWItem("§eSeite zurück", 10), (InvCallback.ClickType click) -> { From e0d158b152345baa014433f348fc33fd84b03d9e Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 1 Jan 2021 13:30:13 +0100 Subject: [PATCH 10/10] Fix Color --- src/de/steamwar/bungeecore/commands/TeamCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index 51b33d09..f9cb50eb 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -60,7 +60,7 @@ public class TeamCommand extends BasicCommand { addColor("f", 15); addColor("7", 7); addColor("8", 8); - addColor("0", 0); + addColor("0", 16); } private static void addColor(String color, int colorCode) {