Add messages for /npc sheep

This commit is contained in:
fullwall 2015-03-22 16:30:30 +08:00
parent 660dc1fd85
commit 432d9d7855
3 changed files with 29 additions and 23 deletions

View File

@ -272,7 +272,7 @@ public class NPCCommands {
}
CommandSenderCreateNPCEvent event = sender instanceof Player ? new PlayerCreateNPCEvent((Player) sender, copy)
: new CommandSenderCreateNPCEvent(sender, copy);
: new CommandSenderCreateNPCEvent(sender, copy);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
event.getNPC().destroy();
@ -348,7 +348,7 @@ public class NPCCommands {
spawnLoc = args.getSenderLocation();
}
CommandSenderCreateNPCEvent event = sender instanceof Player ? new PlayerCreateNPCEvent((Player) sender, npc)
: new CommandSenderCreateNPCEvent(sender, npc);
: new CommandSenderCreateNPCEvent(sender, npc);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
npc.destroy();
@ -1025,7 +1025,7 @@ public class NPCCommands {
@Requirements(selected = true, ownership = true, types = { EntityType.CREEPER })
public void power(CommandContext args, CommandSender sender, NPC npc) {
Messaging
.sendTr(sender, npc.getTrait(Powered.class).toggle() ? Messages.POWERED_SET : Messages.POWERED_STOPPED);
.sendTr(sender, npc.getTrait(Powered.class).toggle() ? Messages.POWERED_SET : Messages.POWERED_STOPPED);
}
@Command(
@ -1063,7 +1063,7 @@ public class NPCCommands {
}
@Command(aliases = { "npc" }, usage = "remove|rem (all|id|name)", desc = "Remove a NPC", modifiers = { "remove",
"rem" }, min = 1, max = 2)
"rem" }, min = 1, max = 2)
@Requirements
public void remove(final CommandContext args, final CommandSender sender, NPC npc) throws CommandException {
if (args.argsLength() == 2) {
@ -1209,6 +1209,9 @@ public class NPCCommands {
DyeColor color = Util.matchEnum(DyeColor.values(), args.getFlag("color"));
if (color != null) {
trait.setColor(color);
Messaging.sendTr(sender, Messages.SHEEP_COLOR_SET, color.toString().toLowerCase());
} else {
Messaging.sendErrorTr(sender, Messages.INVALID_SHEEP_COLOR, Util.listValuesPretty(DyeColor.values()));
}
}
}

View File

@ -79,6 +79,7 @@ public class EnderDragonController extends MobEntityController {
}
return false; // shouldLeash
}
@Override
public void collide(net.minecraft.server.v1_8_R2.Entity entity) {
// this method is called by both the entities involved - cancelling
@ -94,18 +95,9 @@ public class EnderDragonController extends MobEntityController {
}
@Override
public void m() {
if (npc != null) {
npc.update();
if (motX != 0 || motY != 0 || motZ != 0) {
motX *= 0.98;
motY *= 0.98;
motZ *= 0.98;
yaw = getCorrectYaw(locX + motX, locZ + motZ);
setPosition(locX + motX, locY + motY, locZ + motZ);
}
} else {
super.m();
protected void D() {
if (npc == null) {
super.D();
}
}
@ -152,17 +144,26 @@ public class EnderDragonController extends MobEntityController {
return npc;
}
@Override
public void m() {
if (npc != null) {
npc.update();
if (motX != 0 || motY != 0 || motZ != 0) {
motX *= 0.98;
motY *= 0.98;
motZ *= 0.98;
yaw = getCorrectYaw(locX + motX, locZ + motZ);
setPosition(locX + motX, locY + motY, locZ + motZ);
}
} else {
super.m();
}
}
@Override
protected String z() {
return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() : npc.data().get(
NPC.AMBIENT_SOUND_METADATA, super.z());
}
@Override
protected void D() {
if (npc == null) {
super.D();
}
}
}
}

View File

@ -102,6 +102,7 @@ public class Messages {
public static final String INVALID_POSE_NAME = "citizens.commands.npc.pose.invalid-name";
public static final String INVALID_PROFESSION = "citizens.commands.npc.profession.invalid-profession";
public static final String INVALID_RABBIT_TYPE = "citizens.commands.npc.rabbittype.invalid-type";
public static final String INVALID_SHEEP_COLOR = "citizens.commands.npc.sheep.invalid-color";
public static final String INVALID_SKELETON_TYPE = "citizens.commands.npc.skeletontype.invalid-type";
public static final String INVALID_SOUND = "citizens.commands.npc.sound.invalid-sound";
public static final String INVALID_SPAWN_LOCATION = "citizens.commands.npc.create.invalid-location";
@ -184,6 +185,7 @@ public class Messages {
public static final String SELECTION_PROMPT_INVALID_CHOICE = "citizens.conversations.selection.invalid-choice";
public static final String SHEARED_SET = "citizens.editors.equipment.sheared-set";
public static final String SHEARED_STOPPED = "citizens.editors.equipment.sheared-stopped";
public static final String SHEEP_COLOR_SET = "citizens.commands.npc.sheep.color-set";
public static final String SIZE_DESCRIPTION = "citizens.commands.npc.size.description";
public static final String SIZE_SET = "citizens.commands.npc.size.set";
public static final String SKELETON_TYPE_SET = "citizens.commands.npc.skeletontype.set";