mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 10:36:10 +01:00
Add glowing for non-player characters, stop 1.8.8 noDamageTicks from going down too fast
This commit is contained in:
parent
a29fb3059a
commit
bf56a6dcb2
@ -816,8 +816,6 @@ public class NPCCommands {
|
||||
public void glowing(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
|
||||
if (args.hasValueFlag("color")) {
|
||||
ChatColor chatColor = Util.matchEnum(ChatColor.values(), args.getFlag("color"));
|
||||
if (!(npc.getEntity() instanceof Player))
|
||||
throw new CommandException(Messages.GLOWING_COLOR_PLAYER_ONLY);
|
||||
npc.getOrAddTrait(ScoreboardTrait.class).setColor(chatColor);
|
||||
if (!npc.data().has(NPC.GLOWING_METADATA)) {
|
||||
npc.data().setPersistent(NPC.GLOWING_METADATA, true);
|
||||
@ -2518,11 +2516,13 @@ public class NPCCommands {
|
||||
public void useitem(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
|
||||
boolean offhand = args.hasFlag('o');
|
||||
if (offhand) {
|
||||
npc.data().set(NPC.Metadata.USING_OFFHAND_ITEM, !npc.data().get(NPC.Metadata.USING_OFFHAND_ITEM, false));
|
||||
npc.data().setPersistent(NPC.Metadata.USING_OFFHAND_ITEM,
|
||||
!npc.data().get(NPC.Metadata.USING_OFFHAND_ITEM, false));
|
||||
Messaging.sendTr(sender, Messages.TOGGLED_USING_OFFHAND_ITEM,
|
||||
npc.data().get(NPC.Metadata.USING_OFFHAND_ITEM));
|
||||
} else {
|
||||
npc.data().set(NPC.Metadata.USING_HELD_ITEM, !npc.data().get(NPC.Metadata.USING_HELD_ITEM, false));
|
||||
npc.data().setPersistent(NPC.Metadata.USING_HELD_ITEM,
|
||||
!npc.data().get(NPC.Metadata.USING_HELD_ITEM, false));
|
||||
Messaging.sendTr(sender, Messages.TOGGLED_USING_HELD_ITEM, npc.data().get(NPC.Metadata.USING_HELD_ITEM));
|
||||
}
|
||||
}
|
||||
|
@ -427,8 +427,7 @@ public class CitizensNPC extends AbstractNPC {
|
||||
|
||||
String teamName = data().get(NPC.Metadata.SCOREBOARD_FAKE_TEAM_NAME, "");
|
||||
Team team = null;
|
||||
if (!(getEntity() instanceof Player) || teamName.length() == 0
|
||||
|| (team = Util.getDummyScoreboard().getTeam(teamName)) == null)
|
||||
if (teamName.length() == 0 || (team = Util.getDummyScoreboard().getTeam(teamName)) == null)
|
||||
return;
|
||||
|
||||
if (!Setting.USE_SCOREBOARD_TEAMS.asBoolean()) {
|
||||
@ -436,7 +435,6 @@ public class CitizensNPC extends AbstractNPC {
|
||||
data().remove(NPC.SCOREBOARD_FAKE_TEAM_NAME_METADATA);
|
||||
return;
|
||||
}
|
||||
|
||||
getOrAddTrait(ScoreboardTrait.class).apply(team, nameVisibility);
|
||||
}
|
||||
|
||||
|
@ -402,10 +402,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
boolean navigating = npc.getNavigator().isNavigating();
|
||||
updatePackets(navigating);
|
||||
|
||||
if (noDamageTicks > 0) {
|
||||
--noDamageTicks;
|
||||
}
|
||||
|
||||
npc.update();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user