mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 18:45:29 +01:00
Add /npc collidable for players colliding with entities
This commit is contained in:
parent
7daf2ccea3
commit
bc8e3128fa
@ -253,6 +253,22 @@ public class NPCCommands {
|
||||
}
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = { "npc" },
|
||||
usage = "collidable",
|
||||
desc = "Copies an NPC",
|
||||
modifiers = { "copy" },
|
||||
min = 1,
|
||||
max = 1,
|
||||
permission = "citizens.npc.collidable")
|
||||
@Requirements(ownership = true, selected = true, types = { EntityType.PLAYER })
|
||||
public void collidable(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
|
||||
npc.data().setPersistent(NPC.COLLIDABLE_METADATA, !npc.data().get(NPC.COLLIDABLE_METADATA, true));
|
||||
Messaging.sendTr(sender,
|
||||
npc.data().get(NPC.COLLIDABLE_METADATA) ? Messages.COLLIDABLE_SET : Messages.COLLIDABLE_UNSET,
|
||||
npc.getName());
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = { "npc" },
|
||||
usage = "controllable|control (-m(ount),-y,-n,-o)",
|
||||
|
@ -264,6 +264,11 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
setSkinFlags((byte) 0xFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCollidable() {
|
||||
return npc == null ? super.isCollidable() : npc.data().get(NPC.COLLIDABLE_METADATA, true);
|
||||
}
|
||||
|
||||
public boolean isNavigating() {
|
||||
return npc.getNavigator().isNavigating();
|
||||
}
|
||||
|
@ -32,6 +32,8 @@ public class Messages {
|
||||
public static final String CITIZENS_SAVING = "citizens.notifications.saving";
|
||||
public static final String COLLAR_COLOUR_NOT_RECOGNISED = "citizens.commands.npc.wolf.unknown-collar-color";
|
||||
public static final String COLLAR_COLOUR_NOT_SUPPORTED = "citizens.commands.npc.wolf.collar-color-unsupported";
|
||||
public static final String COLLIDABLE_SET = "citizens.commands.npc.collidable.set";
|
||||
public static final String COLLIDABLE_UNSET = "citizens.commands.npc.collidable.unset";
|
||||
public static final String COMMAND_AGE_HELP = "citizens.commands.npc.age.help";
|
||||
public static final String COMMAND_HELP_HEADER = "citizens.commands.help.header";
|
||||
public static final String COMMAND_INVALID_MOBTYPE = "citizens.commands.invalid-mobtype";
|
||||
|
@ -25,6 +25,8 @@ citizens.commands.npc.anchor.removed=Anchor removed.
|
||||
citizens.commands.npc.behaviour.added=Behaviours added.
|
||||
citizens.commands.npc.behaviour.help=The scripts argument is a comma-separated list of file names. Scripts will be loaded automatically and run every tick. Use the [[-r]] flag to remove behaviours.
|
||||
citizens.commands.npc.behaviour.removed=Behaviours removed.
|
||||
citizens.commands.npc.collidable.set=[[{0}]] will now collide with entities.
|
||||
citizens.commands.npc.collidable.unset=[[{0}]] will no longer collide with entities.
|
||||
citizens.commands.npc.controllable.not-controllable=[[{0}]] is not controllable.
|
||||
citizens.commands.npc.controllable.removed=[[{0}]] can no longer be controlled.
|
||||
citizens.commands.npc.controllable.set=[[{0}]] can now be controlled.
|
||||
|
Loading…
Reference in New Issue
Block a user