From 21b2908e8339e945567dc13acf8b6ae1b52fe8c0 Mon Sep 17 00:00:00 2001 From: fullwall Date: Sun, 9 Aug 2020 13:04:46 +0800 Subject: [PATCH] Remove team metadata --- main/src/main/java/net/citizensnpcs/EventListen.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main/src/main/java/net/citizensnpcs/EventListen.java b/main/src/main/java/net/citizensnpcs/EventListen.java index f38f065c3..5d9452b8a 100644 --- a/main/src/main/java/net/citizensnpcs/EventListen.java +++ b/main/src/main/java/net/citizensnpcs/EventListen.java @@ -427,11 +427,14 @@ public class EventListen implements Listener { if (!Setting.USE_SCOREBOARD_TEAMS.asBoolean()) return; String teamName = event.getNPC().data().get(NPC.SCOREBOARD_FAKE_TEAM_NAME_METADATA, ""); - if (teamName.isEmpty() || !(event.getNPC() instanceof Player)) + if (teamName.isEmpty()) + return; + Team team = Util.getDummyScoreboard().getTeam(teamName); + event.getNPC().data().remove(NPC.SCOREBOARD_FAKE_TEAM_NAME_METADATA); + if (team == null || !(event.getNPC().getEntity() instanceof Player)) return; Player player = (Player) event.getNPC().getEntity(); - Team team = Util.getDummyScoreboard().getTeam(teamName); - if (team != null && team.hasPlayer(player)) { + if (team.hasPlayer(player)) { if (team.getSize() == 1) { Util.sendTeamPacketToOnlinePlayers(team, 1); team.unregister();