mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-23 19:16:34 +01:00
Add /npc horse, /npc ocelot, make /npc wolf persist
This commit is contained in:
parent
26d79436d7
commit
870825d212
@ -25,6 +25,7 @@ import net.citizensnpcs.api.trait.trait.Owner;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.editor.Editor;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.trait.Controllable;
|
||||
import net.citizensnpcs.trait.CurrentLocation;
|
||||
import net.citizensnpcs.util.Messages;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
@ -32,6 +33,7 @@ import net.citizensnpcs.util.NMS;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -50,6 +52,7 @@ import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.vehicle.VehicleEnterEvent;
|
||||
import org.bukkit.event.world.ChunkLoadEvent;
|
||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||
import org.bukkit.event.world.WorldLoadEvent;
|
||||
@ -248,6 +251,16 @@ public class EventListen implements Listener {
|
||||
Editor.leave(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onVehicleEnter(VehicleEnterEvent event) {
|
||||
if (!npcRegistry.isNPC(event.getEntered()))
|
||||
return;
|
||||
NPC npc = npcRegistry.getNPC(event.getEntered());
|
||||
if (npc.getBukkitEntity().getType() == EntityType.HORSE && !npc.getTrait(Controllable.class).isEnabled()) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onWorldLoad(WorldLoadEvent event) {
|
||||
for (ChunkCoord chunk : toRespawn.keySet()) {
|
||||
|
@ -34,12 +34,15 @@ import net.citizensnpcs.trait.Anchors;
|
||||
import net.citizensnpcs.trait.Controllable;
|
||||
import net.citizensnpcs.trait.CurrentLocation;
|
||||
import net.citizensnpcs.trait.Gravity;
|
||||
import net.citizensnpcs.trait.HorseModifiers;
|
||||
import net.citizensnpcs.trait.LookClose;
|
||||
import net.citizensnpcs.trait.NPCSkeletonType;
|
||||
import net.citizensnpcs.trait.OcelotModifiers;
|
||||
import net.citizensnpcs.trait.Poses;
|
||||
import net.citizensnpcs.trait.Powered;
|
||||
import net.citizensnpcs.trait.SlimeSize;
|
||||
import net.citizensnpcs.trait.VillagerProfession;
|
||||
import net.citizensnpcs.trait.WolfModifiers;
|
||||
import net.citizensnpcs.trait.ZombieModifier;
|
||||
import net.citizensnpcs.util.Anchor;
|
||||
import net.citizensnpcs.util.Messages;
|
||||
@ -59,11 +62,14 @@ import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.entity.Ageable;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Horse.Color;
|
||||
import org.bukkit.entity.Horse.Style;
|
||||
import org.bukkit.entity.Horse.Variant;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Ocelot;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Skeleton.SkeletonType;
|
||||
import org.bukkit.entity.Villager.Profession;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
@ -446,6 +452,63 @@ public class NPCCommands {
|
||||
Messaging.sendTr(sender, key, npc.getName());
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = { "npc" },
|
||||
usage = "horse (--color color) (--type type) (--style style) (-cb)",
|
||||
desc = "Sets horse modifiers",
|
||||
help = "Use the -c flag to make the horse have a chest, or the -b flag to stop them from having a chest.",
|
||||
modifiers = { "horse" },
|
||||
min = 1,
|
||||
max = 1,
|
||||
flags = "cb",
|
||||
permission = "citizens.npc.horse")
|
||||
@Requirements(selected = true, ownership = true, types = { EntityType.HORSE })
|
||||
public void horse(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
|
||||
HorseModifiers horse = npc.getTrait(HorseModifiers.class);
|
||||
String output = "";
|
||||
if (args.hasFlag('c')) {
|
||||
horse.setCarryingChest(true);
|
||||
output += Messaging.tr(Messages.HORSE_CHEST_SET) + " ";
|
||||
} else if (args.hasFlag('b')) {
|
||||
horse.setCarryingChest(false);
|
||||
output += Messaging.tr(Messages.HORSE_CHEST_UNSET) + " ";
|
||||
}
|
||||
if (args.hasValueFlag("color") || args.hasValueFlag("colour")) {
|
||||
String colorRaw = args.getFlag("color", args.getFlag("colour"));
|
||||
Color color = Util.matchEnum(Color.values(), colorRaw);
|
||||
if (color == null) {
|
||||
String valid = Util.listValuesPretty(Color.values());
|
||||
throw new CommandException(Messages.INVALID_HORSE_COLOR, valid);
|
||||
}
|
||||
horse.setColor(color);
|
||||
output += Messaging.tr(Messages.HORSE_COLOR_SET, Util.prettyEnum(color));
|
||||
}
|
||||
if (args.hasValueFlag("type")) {
|
||||
Variant variant = Util.matchEnum(Variant.values(), args.getFlag("type"));
|
||||
if (variant == null) {
|
||||
String valid = Util.listValuesPretty(Variant.values());
|
||||
throw new CommandException(Messages.INVALID_HORSE_VARIANT, valid);
|
||||
}
|
||||
horse.setType(variant);
|
||||
output += Messaging.tr(Messages.HORSE_TYPE_SET, Util.prettyEnum(variant));
|
||||
}
|
||||
if (args.hasValueFlag("style")) {
|
||||
Style style = Util.matchEnum(Style.values(), args.getFlag("style"));
|
||||
if (style == null) {
|
||||
String valid = Util.listValuesPretty(Style.values());
|
||||
throw new CommandException(Messages.INVALID_HORSE_STYLE, valid);
|
||||
}
|
||||
horse.setStyle(style);
|
||||
output += Messaging.tr(Messages.HORSE_STYLE_SET, Util.prettyEnum(style));
|
||||
}
|
||||
if (output.isEmpty()) {
|
||||
Messaging.sendTr(sender, Messages.HORSE_DESCRIBE, Util.prettyEnum(horse.getColor()),
|
||||
Util.prettyEnum(horse.getType()), Util.prettyEnum(horse.getStyle()));
|
||||
} else {
|
||||
sender.sendMessage(output);
|
||||
}
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = { "npc" },
|
||||
usage = "id",
|
||||
@ -649,6 +712,33 @@ public class NPCCommands {
|
||||
}
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = { "npc" },
|
||||
usage = "ocelot (--type type) (-s(itting), -n(ot sitting))",
|
||||
desc = "Set the ocelot type of an NPC and whether it is sitting",
|
||||
modifiers = { "ocelot" },
|
||||
min = 1,
|
||||
max = 1,
|
||||
flags = "sn",
|
||||
permission = "citizens.npc.ocelot")
|
||||
@Requirements(selected = true, ownership = true, types = { EntityType.OCELOT })
|
||||
public void ocelot(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
|
||||
OcelotModifiers trait = npc.getTrait(OcelotModifiers.class);
|
||||
if (args.hasFlag('s')) {
|
||||
trait.setSitting(true);
|
||||
} else if (args.hasFlag('n')) {
|
||||
trait.setSitting(false);
|
||||
}
|
||||
if (args.hasValueFlag("type")) {
|
||||
Ocelot.Type type = Util.matchEnum(Ocelot.Type.values(), args.getFlag("type"));
|
||||
if (type == null) {
|
||||
String valid = Util.listValuesPretty(Ocelot.Type.values());
|
||||
throw new CommandException(Messages.INVALID_OCELOT_TYPE, valid);
|
||||
}
|
||||
trait.setType(type);
|
||||
}
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = { "npc" },
|
||||
usage = "owner [name]",
|
||||
@ -1155,10 +1245,10 @@ public class NPCCommands {
|
||||
permission = "citizens.npc.wolf")
|
||||
@Requirements(selected = true, ownership = true, types = EntityType.WOLF)
|
||||
public void wolf(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
|
||||
Wolf wolf = (Wolf) npc.getBukkitEntity();
|
||||
wolf.setAngry(args.hasFlag('a'));
|
||||
wolf.setSitting(args.hasFlag('s'));
|
||||
wolf.setTamed(args.hasFlag('t'));
|
||||
WolfModifiers trait = npc.getTrait(WolfModifiers.class);
|
||||
trait.setAngry(args.hasFlag('a'));
|
||||
trait.setSitting(args.hasFlag('s'));
|
||||
trait.setTamed(args.hasFlag('t'));
|
||||
if (args.hasValueFlag("collar")) {
|
||||
String unparsed = args.getFlag("collar");
|
||||
DyeColor color = null;
|
||||
@ -1170,7 +1260,7 @@ public class NPCCommands {
|
||||
}
|
||||
if (color == null)
|
||||
throw new CommandException(Messages.COLLAR_COLOUR_NOT_RECOGNISED);
|
||||
wolf.setCollarColor(color);
|
||||
trait.setCollarColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,14 +21,17 @@ import net.citizensnpcs.trait.Anchors;
|
||||
import net.citizensnpcs.trait.Controllable;
|
||||
import net.citizensnpcs.trait.CurrentLocation;
|
||||
import net.citizensnpcs.trait.Gravity;
|
||||
import net.citizensnpcs.trait.HorseModifiers;
|
||||
import net.citizensnpcs.trait.LookClose;
|
||||
import net.citizensnpcs.trait.NPCSkeletonType;
|
||||
import net.citizensnpcs.trait.OcelotModifiers;
|
||||
import net.citizensnpcs.trait.Poses;
|
||||
import net.citizensnpcs.trait.Powered;
|
||||
import net.citizensnpcs.trait.Saddle;
|
||||
import net.citizensnpcs.trait.Sheared;
|
||||
import net.citizensnpcs.trait.SlimeSize;
|
||||
import net.citizensnpcs.trait.VillagerProfession;
|
||||
import net.citizensnpcs.trait.WolfModifiers;
|
||||
import net.citizensnpcs.trait.WoolColor;
|
||||
import net.citizensnpcs.trait.ZombieModifier;
|
||||
import net.citizensnpcs.trait.text.Text;
|
||||
@ -47,9 +50,11 @@ public class CitizensTraitFactory implements TraitFactory {
|
||||
registerTrait(TraitInfo.create(Controllable.class).withName("controllable"));
|
||||
registerTrait(TraitInfo.create(Equipment.class).withName("equipment"));
|
||||
registerTrait(TraitInfo.create(Gravity.class).withName("gravity"));
|
||||
registerTrait(TraitInfo.create(HorseModifiers.class).withName("horsemodifiers"));
|
||||
registerTrait(TraitInfo.create(Inventory.class).withName("inventory"));
|
||||
registerTrait(TraitInfo.create(CurrentLocation.class).withName("location"));
|
||||
registerTrait(TraitInfo.create(LookClose.class).withName("lookclose"));
|
||||
registerTrait(TraitInfo.create(OcelotModifiers.class).withName("ocelotmodifiers"));
|
||||
registerTrait(TraitInfo.create(Owner.class).withName("owner"));
|
||||
registerTrait(TraitInfo.create(Poses.class).withName("poses"));
|
||||
registerTrait(TraitInfo.create(Powered.class).withName("powered"));
|
||||
@ -64,6 +69,7 @@ public class CitizensTraitFactory implements TraitFactory {
|
||||
registerTrait(TraitInfo.create(MobType.class).withName("type"));
|
||||
registerTrait(TraitInfo.create(Waypoints.class).withName("waypoints"));
|
||||
registerTrait(TraitInfo.create(WoolColor.class).withName("woolcolor"));
|
||||
registerTrait(TraitInfo.create(WolfModifiers.class).withName("wolfmodifiers"));
|
||||
registerTrait(TraitInfo.create(ZombieModifier.class).withName("zombiemodifier"));
|
||||
|
||||
for (String trait : registered.keySet()) {
|
||||
|
@ -39,6 +39,7 @@ public class HorseController extends MobEntityController {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
((Horse) getBukkitEntity()).setDomestication(((Horse) getBukkitEntity()).getMaxDomestication());
|
||||
}
|
||||
}
|
||||
|
||||
|
71
src/main/java/net/citizensnpcs/trait/HorseModifiers.java
Normal file
71
src/main/java/net/citizensnpcs/trait/HorseModifiers.java
Normal file
@ -0,0 +1,71 @@
|
||||
package net.citizensnpcs.trait;
|
||||
|
||||
import net.citizensnpcs.api.persistence.Persist;
|
||||
import net.citizensnpcs.api.trait.Trait;
|
||||
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Horse.Color;
|
||||
import org.bukkit.entity.Horse.Style;
|
||||
import org.bukkit.entity.Horse.Variant;
|
||||
|
||||
public class HorseModifiers extends Trait {
|
||||
@Persist("carryingChest")
|
||||
private boolean carryingChest;
|
||||
@Persist("color")
|
||||
private Color color = Color.CREAMY;
|
||||
@Persist("style")
|
||||
private Style style = Style.NONE;
|
||||
@Persist("type")
|
||||
private Variant type = Variant.HORSE;
|
||||
|
||||
public HorseModifiers() {
|
||||
super("horsemodifiers");
|
||||
}
|
||||
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public Style getStyle() {
|
||||
return style;
|
||||
}
|
||||
|
||||
public Variant getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpawn() {
|
||||
updateModifiers();
|
||||
}
|
||||
|
||||
public void setCarryingChest(boolean carryingChest) {
|
||||
this.carryingChest = carryingChest;
|
||||
updateModifiers();
|
||||
}
|
||||
|
||||
public void setColor(Horse.Color color) {
|
||||
this.color = color;
|
||||
updateModifiers();
|
||||
}
|
||||
|
||||
public void setStyle(Horse.Style style) {
|
||||
this.style = style;
|
||||
updateModifiers();
|
||||
}
|
||||
|
||||
public void setType(Horse.Variant type) {
|
||||
this.type = type;
|
||||
updateModifiers();
|
||||
}
|
||||
|
||||
private void updateModifiers() {
|
||||
if (npc.getBukkitEntity() instanceof Horse) {
|
||||
Horse horse = (Horse) npc.getBukkitEntity();
|
||||
horse.setCarryingChest(carryingChest);
|
||||
horse.setColor(color);
|
||||
horse.setStyle(style);
|
||||
horse.setVariant(type);
|
||||
}
|
||||
}
|
||||
}
|
40
src/main/java/net/citizensnpcs/trait/OcelotModifiers.java
Normal file
40
src/main/java/net/citizensnpcs/trait/OcelotModifiers.java
Normal file
@ -0,0 +1,40 @@
|
||||
package net.citizensnpcs.trait;
|
||||
|
||||
import net.citizensnpcs.api.persistence.Persist;
|
||||
import net.citizensnpcs.api.trait.Trait;
|
||||
|
||||
import org.bukkit.entity.Ocelot;
|
||||
|
||||
public class OcelotModifiers extends Trait {
|
||||
@Persist("sitting")
|
||||
private boolean sitting;
|
||||
@Persist("type")
|
||||
private Ocelot.Type type = Ocelot.Type.WILD_OCELOT;
|
||||
|
||||
public OcelotModifiers() {
|
||||
super("ocelotmodifiers");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpawn() {
|
||||
updateModifiers();
|
||||
}
|
||||
|
||||
public void setSitting(boolean sit) {
|
||||
this.sitting = sit;
|
||||
updateModifiers();
|
||||
}
|
||||
|
||||
public void setType(Ocelot.Type type) {
|
||||
this.type = type;
|
||||
updateModifiers();
|
||||
}
|
||||
|
||||
private void updateModifiers() {
|
||||
if (npc.getBukkitEntity() instanceof Ocelot) {
|
||||
Ocelot ocelot = (Ocelot) npc.getBukkitEntity();
|
||||
ocelot.setCatType(type);
|
||||
ocelot.setSitting(sitting);
|
||||
}
|
||||
}
|
||||
}
|
57
src/main/java/net/citizensnpcs/trait/WolfModifiers.java
Normal file
57
src/main/java/net/citizensnpcs/trait/WolfModifiers.java
Normal file
@ -0,0 +1,57 @@
|
||||
package net.citizensnpcs.trait;
|
||||
|
||||
import net.citizensnpcs.api.persistence.Persist;
|
||||
import net.citizensnpcs.api.trait.Trait;
|
||||
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.entity.Wolf;
|
||||
|
||||
public class WolfModifiers extends Trait {
|
||||
@Persist("angry")
|
||||
private boolean angry;
|
||||
@Persist("collarColor")
|
||||
private DyeColor collarColor = DyeColor.RED;
|
||||
@Persist("sitting")
|
||||
private boolean sitting;
|
||||
@Persist("tamed")
|
||||
private boolean tamed;
|
||||
|
||||
public WolfModifiers() {
|
||||
super("wolfmodifiers");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpawn() {
|
||||
updateModifiers();
|
||||
}
|
||||
|
||||
public void setAngry(boolean angry) {
|
||||
this.angry = angry;
|
||||
updateModifiers();
|
||||
}
|
||||
|
||||
public void setCollarColor(DyeColor color) {
|
||||
this.collarColor = color;
|
||||
updateModifiers();
|
||||
}
|
||||
|
||||
public void setSitting(boolean sitting) {
|
||||
this.sitting = sitting;
|
||||
updateModifiers();
|
||||
}
|
||||
|
||||
public void setTamed(boolean tamed) {
|
||||
this.tamed = tamed;
|
||||
updateModifiers();
|
||||
}
|
||||
|
||||
private void updateModifiers() {
|
||||
if (npc.getBukkitEntity() instanceof Wolf) {
|
||||
Wolf wolf = (Wolf) npc.getBukkitEntity();
|
||||
wolf.setCollarColor(collarColor);
|
||||
wolf.setSitting(sitting);
|
||||
wolf.setAngry(angry);
|
||||
wolf.setTamed(tamed);
|
||||
}
|
||||
}
|
||||
}
|
@ -77,10 +77,20 @@ public class Messages {
|
||||
public static final String GAMEMODE_SET = "citizens.commands.npc.gamemode.set";
|
||||
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 HORSE_CHEST_SET = "citizens.commands.npc.horse.chest-set";
|
||||
public static final String HORSE_CHEST_UNSET = "citizens.commands.npc.horse.chest-unset";
|
||||
public static final String HORSE_COLOR_SET = "citizens.commands.npc.horse.color-set";
|
||||
public static final String HORSE_DESCRIBE = "citizens.commands.npc.horse.describe";
|
||||
public static final String HORSE_STYLE_SET = "citizens.commands.npc.horse.style-set";
|
||||
public static final String HORSE_TYPE_SET = "citizens.commands.npc.horse.type-set";
|
||||
public static final String INVALID_AGE = "citizens.commands.npc.age.invalid-age";
|
||||
public static final String INVALID_ANCHOR_NAME = "citizens.commands.npc.anchor.invalid-name";
|
||||
public static final String INVALID_ANIMATION = "citizens.editors.waypoints.triggers.animation.invalid-animation";
|
||||
public static final String INVALID_ENTITY_TYPE = "citizens.commands.npc.type.invalid";
|
||||
public static final String INVALID_HORSE_COLOR = "citizens.commands.npc.horse.invalid-color";
|
||||
public static final String INVALID_HORSE_STYLE = "citizens.commands.npc.horse.invalid-style";
|
||||
public static final String INVALID_HORSE_VARIANT = "citizens.commands.npc.horse.invalid-variant";
|
||||
public static final String INVALID_OCELOT_TYPE = "citizens.commands.npc.ocelot.invalid-type";
|
||||
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_SKELETON_TYPE = "citizens.commands.npc.skeletontype.invalid-type";
|
||||
@ -112,6 +122,7 @@ public class Messages {
|
||||
public static final String MOVETO_FORMAT = "citizens.commands.npc.moveto.format";
|
||||
public static final String MOVETO_TELEPORTED = "citizens.commands.npc.moveto.teleported";
|
||||
public static final String NAMEPLATE_VISIBILITY_TOGGLED = "citizens.commands.npc.nameplate.toggled";
|
||||
public static final String NO_HORSE_MODIFIERS_GIVEN = "citizens.commands.npc.horse.no-modifiers";
|
||||
public static final String NO_NPC_WITH_ID_FOUND = "citizens.commands.npc.spawn.missing-npc-id";
|
||||
public static final String NO_STORED_SPAWN_LOCATION = "citizens.commands.npc.spawn.no-location";
|
||||
public static final String NOT_LIVING_MOBTYPE = "citizens.commands.npc.create.not-living-mobtype";
|
||||
|
@ -17,6 +17,7 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
@ -25,9 +26,6 @@ public class Util {
|
||||
private Util() {
|
||||
}
|
||||
|
||||
private static final Location AT_LOCATION = new Location(null, 0, 0, 0);
|
||||
private static final Location FROM_LOCATION = new Location(null, 0, 0, 0);
|
||||
|
||||
public static void assumePose(LivingEntity entity, float yaw, float pitch) {
|
||||
NMS.look(entity, yaw, pitch);
|
||||
}
|
||||
@ -87,6 +85,10 @@ public class Util {
|
||||
return location.getWorld().isChunkLoaded(chunkX, chunkZ);
|
||||
}
|
||||
|
||||
public static String listValuesPretty(Enum<?>[] values) {
|
||||
return Joiner.on(", ").join(values).toLowerCase().replace('_', ' ');
|
||||
}
|
||||
|
||||
public static boolean locationWithinRange(Location current, Location target, double range) {
|
||||
if (current == null || target == null)
|
||||
return false;
|
||||
@ -161,4 +163,11 @@ public class Util {
|
||||
return search.getLocation();
|
||||
}
|
||||
}
|
||||
|
||||
public static String prettyEnum(Enum<?> e) {
|
||||
return e.name().toLowerCase().replace('_', ' ');
|
||||
}
|
||||
|
||||
private static final Location AT_LOCATION = new Location(null, 0, 0, 0);
|
||||
private static final Location FROM_LOCATION = new Location(null, 0, 0, 0);
|
||||
}
|
||||
|
@ -40,6 +40,15 @@ 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.horse.chest-set=The horse is now carrying a chest.
|
||||
citizens.commands.npc.horse.chest-unset=The horse is no longer carrying a chest.
|
||||
citizens.commands.npc.horse.color-set=The horse''s color was set to [[{0}]].
|
||||
citizens.commands.npc.horse.type-set=The horse''s type was set to [[{0}]].
|
||||
citizens.commands.npc.horse.style-set=The horse''s style was set to [[{0}]].
|
||||
citizens.commands.npc.horse.describe=The horse''s color is [[{0}]], the type is [[{1}]] and the style is [[{2}]].
|
||||
citizens.commands.npc.horse.invalid-color=Invalid horse color given. Valid colors are: [[{0}]].
|
||||
citizens.commands.npc.horse.invalid-type=Invalid horse type given. Valid types are: [[{0}]].
|
||||
citizens.commands.npc.horse.invalid-style=Invalid horse style given. Valid styles are: [[{0}]].
|
||||
citizens.commands.npc.leashable.set=[[{0}]] is now leashable.
|
||||
citizens.commands.npc.leashable.stopped=[[{0}]] is no longer leashable.
|
||||
citizens.commands.npc.lookclose.set=[[{0}]] will now rotate when players are nearby.
|
||||
@ -48,6 +57,7 @@ citizens.commands.npc.mount.failed=Couldn''t mount [[{0}]].
|
||||
citizens.commands.npc.moveto.format=Format is x:y:z(:world) or x y z( world).
|
||||
citizens.commands.npc.moveto.teleported=[[{0}]] teleported to {1}.
|
||||
citizens.commands.npc.nameplate.toggled=Nameplate visibility toggled.
|
||||
citizens.commands.npc.ocelot.invalid-type=Invalid ocelot type. Valid types are: [[{0}]].
|
||||
citizens.commands.npc.owner.already-owner={0} is already the owner of {1}.
|
||||
citizens.commands.npc.owner.owner=[[{0}]]''s owner is [[{1}]].
|
||||
citizens.commands.npc.owner.set-server=[[The server]] is now the owner of {0}.
|
||||
|
Loading…
Reference in New Issue
Block a user