mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-23 09:37:35 +01:00
Fix scoreboards, villager level
This commit is contained in:
parent
68e9ca68b5
commit
f4ef934932
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user