Fix scoreboards, villager level

This commit is contained in:
fullwall 2019-07-19 01:14:52 +08:00
parent 68e9ca68b5
commit f4ef934932
2 changed files with 5 additions and 4 deletions

View File

@ -31,13 +31,13 @@ public class ScoreboardTrait extends Trait {
public void apply(Team team, boolean nameVisibility) {
Set<String> newTags = new HashSet<String>(tags);
for (String oldTag : team.getEntries()) {
for (String oldTag : npc.getEntity().getScoreboardTags()) {
if (!newTags.remove(oldTag)) {
team.removeEntry(oldTag);
npc.getEntity().removeScoreboardTag(oldTag);
}
}
for (String tag : newTags) {
team.addEntry(tag);
npc.getEntity().addScoreboardTag(tag);
}
if (SUPPORT_TEAM_SETOPTION) {

View File

@ -9,7 +9,7 @@ import net.citizensnpcs.api.trait.TraitName;
@TraitName("villagertrait")
public class VillagerTrait extends Trait {
@Persist
private int level;
private int level = 1;
@Persist
private Villager.Type type;
@ -24,6 +24,7 @@ public class VillagerTrait extends Trait {
if (type != null) {
((Villager) npc.getEntity()).setVillagerType(type);
}
level = Math.min(5, Math.max(1, level));
((Villager) npc.getEntity()).setVillagerLevel(level);
}