From 2a16c8c66b93cda224d472730e5c993d2814a519 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Wed, 14 Apr 2021 14:23:06 +0200 Subject: [PATCH] Fixed Team Leader is Member --- src/de/steamwar/bungeecore/commands/TeamCommand.java | 2 +- src/de/steamwar/bungeecore/sql/Team.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index 082496e2..0fad2f10 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -177,7 +177,7 @@ public class TeamCommand extends BasicCommand { if(checkTeamName(player, team, args[2])) return; - Team.create(args[1], args[2], user.getId()); + Team.create(args[1], args[2], user); user.setTeam(Team.get(args[1]).getTeamId()); Message.send("TEAM_CREATE_CREATED", player, args[2]); } diff --git a/src/de/steamwar/bungeecore/sql/Team.java b/src/de/steamwar/bungeecore/sql/Team.java index 3fd3eab2..1256a1a3 100644 --- a/src/de/steamwar/bungeecore/sql/Team.java +++ b/src/de/steamwar/bungeecore/sql/Team.java @@ -52,8 +52,9 @@ public class Team { this(rs.getInt("TeamID"), rs.getString("TeamKuerzel"), rs.getString("TeamName"), rs.getString("TeamColor")); } - public static void create(String kuerzel, String name, int leader){ - SQL.update("INSERT INTO Team (TeamKuerzel, TeamName, TeamLeader) VALUES (?, ?, ?)", kuerzel, name, leader); + public static void create(String kuerzel, String name, SteamwarUser user){ + user.setLeader(true); + SQL.update("INSERT INTO Team (TeamKuerzel, TeamName) VALUES (?, ?)", kuerzel, name); } public static Team get(int id){