Add /npc glowing

This commit is contained in:
fullwall 2016-03-06 01:11:12 +08:00
parent f9308391ba
commit 2e41832873
4 changed files with 20 additions and 0 deletions

View File

@ -530,6 +530,21 @@ public class NPCCommands {
Messaging.sendTr(sender, Messages.GAMEMODE_SET, mode.name().toLowerCase());
}
@Command(
aliases = { "npc" },
usage = "glowing",
desc = "Toggles an NPC's glowing status",
modifiers = { "glowing" },
min = 1,
max = 1,
permission = "citizens.npc.glowing")
@Requirements(selected = true, ownership = true)
public void glowing(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
npc.data().setPersistent(NPC.GLOWING_METADATA, !npc.data().get(NPC.GLOWING_METADATA, false));
boolean glowing = npc.data().get(NPC.GLOWING_METADATA);
Messaging.sendTr(sender, glowing ? Messages.GLOWING_SET : Messages.GLOWING_UNSET);
}
@Command(
aliases = { "npc" },
usage = "gravity",

View File

@ -273,6 +273,7 @@ public class CitizensNPC extends AbstractNPC {
}
navigator.run();
getEntity().setGlowing(data().get(NPC.GLOWING_METADATA, false));
if (!getNavigator().isNavigating() && updateCounter++ > Setting.PACKET_UPDATE_DELAY.asInt()) {
updateCounter = 0;
if (getEntity() instanceof LivingEntity) {

View File

@ -82,6 +82,8 @@ public class Messages {
public static final String GAMEMODE_DESCRIBE = "citizens.commands.npc.gamemode.describe";
public static final String GAMEMODE_INVALID = "citizens.commands.npc.gamemode.invalid";
public static final String GAMEMODE_SET = "citizens.commands.npc.gamemode.set";
public static final String GLOWING_SET = "citizens.commands.npc.glowing.set";
public static final String GLOWING_UNSET = "citizens.commands.npc.glowing.unset";
public static final String GRAVITY_DISABLED = "citizens.commands.npc.gravity.disabled";
public static final String GRAVITY_ENABLED = "citizens.commands.npc.gravity.enabled";
public static final String GUIDED_WAYPOINT_EDITOR_ADDED_AVAILABLE = "citizens.editors.waypoints.guided.added-available";

View File

@ -42,6 +42,8 @@ citizens.commands.npc.gamemode.invalid={0} is not a valid gamemode.
citizens.commands.npc.gamemode.set=Gamemode set to [[{0}]].
citizens.commands.npc.gravity.disabled=Gravity [[disabled]].
citizens.commands.npc.gravity.enabled=Gravity [[enabled]].
citizens.commands.npc.glowing.set=[[{0}]] is now glowing.
citizens.commands.npc.glowing.unset=[[{0}]] is no longer glowing.
citizens.commands.npc.guardian.elder-unset=[[{0}]] is no longer an elder guardian.
citizens.commands.npc.guardian.elder-set=[[{0}]] is now an elder guardian.
citizens.commands.npc.horse.chest-set=The horse is now carrying a chest.