Better /npc sound messages

This commit is contained in:
fullwall 2014-01-29 22:32:42 +08:00
parent 7403323776
commit 845ecd1df5
5 changed files with 16 additions and 3 deletions

View File

@ -60,6 +60,7 @@ import org.bukkit.DyeColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.command.BlockCommandSender;
import org.bukkit.command.CommandSender;
@ -1153,6 +1154,12 @@ public class NPCCommands {
String ambientSound = npc.data().get(NPC.AMBIENT_SOUND_METADATA);
String deathSound = npc.data().get(NPC.DEATH_SOUND_METADATA);
String hurtSound = npc.data().get(NPC.HURT_SOUND_METADATA);
if (args.getValueFlags().size() == 0 && args.getFlags().size() == 0) {
Messaging.sendTr(sender, Messages.SOUND_INFO, npc.getName(), ambientSound, hurtSound, deathSound,
Util.listValuesPretty(Sound.values()));
return;
}
if (args.hasFlag('n')) {
ambientSound = deathSound = hurtSound = "";
}
@ -1172,6 +1179,8 @@ public class NPCCommands {
npc.data().setPersistent(NPC.DEATH_SOUND_METADATA, deathSound);
npc.data().setPersistent(NPC.HURT_SOUND_METADATA, hurtSound);
npc.data().setPersistent(NPC.AMBIENT_SOUND_METADATA, ambientSound);
Messaging.sendTr(sender, Messages.SOUND_SET, npc.getName(), ambientSound, hurtSound, deathSound);
}
@Command(

View File

@ -185,6 +185,8 @@ public class Messages {
public static final String SKIPPING_BROKEN_TRAIT = "citizens.notifications.skipping-broken-trait";
public static final String SKIPPING_INVALID_ANCHOR = "citizens.notifications.skipping-invalid-anchor";
public static final String SKIPPING_INVALID_POSE = "citizens.notifications.skipping-invalid-pose";
public static final String SOUND_INFO = "citizens.commands.npc.sound.info";
public static final String SOUND_SET = "citizens.commands.npc.sound.set";
public static final String SPAWN_NUMERIC_ID_ONLY = "citizens.commands.npc.spawn.numeric-id-only";
public static final String SPEED_MODIFIER_ABOVE_LIMIT = "citizens.commands.npc.speed.modifier-above-limit";
public static final String SPEED_MODIFIER_SET = "citizens.commands.npc.speed.set";

View File

@ -39,7 +39,7 @@ import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.CraftSound;
import org.bukkit.craftbukkit.v1_7_R1.CraftSound;
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
import org.bukkit.craftbukkit.v1_7_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
@ -174,7 +174,7 @@ public class NMS {
}
private static Constructor<?> getCustomEntityConstructor(Class<?> clazz, EntityType type) throws SecurityException,
NoSuchMethodException {
NoSuchMethodException {
Constructor<?> constructor = ENTITY_CONSTRUCTOR_CACHE.get(clazz);
if (constructor == null) {
constructor = clazz.getConstructor(World.class);

View File

@ -105,7 +105,7 @@ public class Util {
}
public static String listValuesPretty(Enum<?>[] values) {
return Joiner.on(", ").join(values).toLowerCase().replace('_', ' ');
return "<e>" + Joiner.on("<a>, <e>").join(values).toLowerCase().replace('_', ' ');
}
public static boolean locationWithinRange(Location current, Location target, double range) {

View File

@ -92,6 +92,8 @@ citizens.commands.npc.select.already-selected=You already have that NPC selected
citizens.commands.npc.size.description={0}''s size is [[{1}]].
citizens.commands.npc.size.set={0}''s size set to [[{1}]].
citizens.commands.npc.sound.invalid-sound=Invalid sound.
citizens.commands.npc.sound.set={0}''s sounds are now: ambient - [[{1}]] hurt - [[{2}]] and death - [[{3}]].
citizens.commands.npc.sound.info={0}''s sounds are: ambient - [[{1}]] hurt - [[{2}]] and death - [[{3}]].<br><br>Valid sounds are {4}.
citizens.commands.npc.skeletontype.set={0}''s skeleton type set to [[{1}]].
citizens.commands.npc.skeletontype.invalid-type=Invalid skeleton type.
citizens.commands.npc.spawn.already-spawned=[[{0}]] is already spawned at another location. Use ''/npc tphere'' to teleport the NPC to your location.