Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Fix team context #47

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.12-R0.1-SNAPSHOT</version>
<version>1.12.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

Expand All @@ -108,6 +108,11 @@
<version>2.9.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18-R0.1-SNAPSHOT</version>
</dependency>
</dependencies>

<repositories>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ public class TeamCalculator implements ContextCalculator<Player> {

@Override
public void calculate(Player target, ContextConsumer consumer) {
Team team = Bukkit.getScoreboardManager().getMainScoreboard().getTeam(target.getName());
if (team != null) {
consumer.accept(KEY, team.getName());
String teamName = null;
for (Team team : Bukkit.getScoreboardManager().getMainScoreboard().getTeams()) {
if (team.hasEntry(target.getName())) {
teamName = team.getName();
break;
}
}
if (teamName != null) {
consumer.accept(KEY, teamName);
}
}

Expand Down