mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-03 16:13:24 +01:00
/npc wolf command
This commit is contained in:
parent
1b1851cdf1
commit
8930e25fbe
@ -53,6 +53,7 @@ import net.citizensnpcs.util.StringHelper;
|
||||
import net.citizensnpcs.util.Util;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
@ -66,6 +67,7 @@ import org.bukkit.entity.LivingEntity;
|
||||
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;
|
||||
@ -1147,6 +1149,31 @@ public class NPCCommands {
|
||||
Messaging.sendTr(sender, key, npc.getName());
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = { "npc" },
|
||||
usage = "wolf (-s(itting) a(ngry) t(amed)) --collar [rgb color]",
|
||||
desc = "Sets wolf modifiers",
|
||||
modifiers = { "wolf" },
|
||||
min = 1,
|
||||
max = 1,
|
||||
flags = "sat",
|
||||
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'));
|
||||
if (args.hasValueFlag("collar")) {
|
||||
String unparsed = args.getFlag("colour");
|
||||
int rgb = Integer.parseInt(unparsed.replace("#", ""));
|
||||
DyeColor color = DyeColor.getByColor(org.bukkit.Color.fromRGB(rgb));
|
||||
if (color == null)
|
||||
throw new CommandException(Messages.COLLAR_COLOUR_NOT_RECOGNISED);
|
||||
wolf.setCollarColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = { "npc" },
|
||||
usage = "zombiemod (-b(aby), -v(illager))",
|
||||
|
@ -232,6 +232,5 @@ public class CitizensNavigator implements Navigator, Runnable {
|
||||
}
|
||||
|
||||
private static final Location STATIONARY_LOCATION = new Location(null, 0, 0, 0);
|
||||
|
||||
private static int UNINITIALISED_SPEED = Integer.MIN_VALUE;
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ public class Text extends Trait implements Runnable, Toggleable, Listener, Conve
|
||||
|
||||
int index = 0;
|
||||
if (randomTalker)
|
||||
index = new Random().nextInt(text.size());
|
||||
index = RANDOM.nextInt(text.size());
|
||||
else {
|
||||
if (currentIndex > text.size() - 1)
|
||||
currentIndex = 0;
|
||||
@ -191,8 +191,6 @@ public class Text extends Trait implements Runnable, Toggleable, Listener, Conve
|
||||
}
|
||||
|
||||
npc.getDefaultSpeechController().speak(new SpeechContext(text.get(index), player));
|
||||
// Messaging.sendWithNPC(player, Setting.CHAT_PREFIX.asString() +
|
||||
// text.get(index), npc);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@ public class Messages {
|
||||
public static final String CITIZENS_RELOADING = "citizens.notifications.reloading";
|
||||
public static final String CITIZENS_SAVED = "citizens.notifications.saved";
|
||||
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 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";
|
||||
|
@ -7,7 +7,6 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
@ -32,7 +31,6 @@ import net.minecraft.server.v1_4_R1.World;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_4_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_4_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_4_R1.entity.CraftEntity;
|
||||
@ -41,12 +39,9 @@ import org.bukkit.craftbukkit.v1_4_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.material.Stairs;
|
||||
import org.bukkit.material.Step;
|
||||
import org.bukkit.plugin.PluginLoadOrder;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class NMS {
|
||||
@ -65,10 +60,7 @@ public class NMS {
|
||||
private static final Location packetCacheLocation = new Location(null, 0, 0, 0);
|
||||
private static Field PATHFINDING_RANGE;
|
||||
private static final Random RANDOM = Util.getFastRandom();
|
||||
private static Set<Integer> SLAB_MATERIALS = Sets.newHashSet();
|
||||
private static Field SPEED_FIELD;
|
||||
private static Set<Integer> STAIR_MATERIALS = Sets.newHashSet();
|
||||
|
||||
private static Field THREAD_STOPPER;
|
||||
|
||||
public static void addOrRemoveFromPlayerList(LivingEntity bukkitEntity, boolean remove) {
|
||||
@ -223,6 +215,10 @@ public class NMS {
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
|
||||
public static void sendPacketNearby(Location location, Packet packet) {
|
||||
NMS.sendPacketsNearby(location, Arrays.asList(packet), 64);
|
||||
}
|
||||
|
||||
public static void sendPacketsNearby(Location location, Collection<Packet> packets) {
|
||||
NMS.sendPacketsNearby(location, packets, 64);
|
||||
}
|
||||
@ -246,10 +242,6 @@ public class NMS {
|
||||
public static void sendPacketsNearby(Location location, Packet... packets) {
|
||||
NMS.sendPacketsNearby(location, Arrays.asList(packets), 64);
|
||||
}
|
||||
|
||||
public static void sendPacketNearby(Location location, Packet packet) {
|
||||
NMS.sendPacketsNearby(location, Arrays.asList(packet), 64);
|
||||
}
|
||||
|
||||
public static void sendToOnline(Packet... packets) {
|
||||
Validate.notNull(packets, "packets cannot be null");
|
||||
@ -397,13 +389,4 @@ public class NMS {
|
||||
Messaging.logTr(Messages.ERROR_GETTING_ID_MAPPING, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
for (Material material : Material.values()) {
|
||||
if (Step.class.isAssignableFrom(material.getData()))
|
||||
SLAB_MATERIALS.add(material.getId());
|
||||
else if (Stairs.class.isAssignableFrom(material.getData()))
|
||||
STAIR_MATERIALS.add(material.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,6 +85,7 @@ citizens.commands.npc.type.set=[[{0}]]''s type set to [[{1}]].
|
||||
citizens.commands.npc.type.invalid=[[{0}]] is not a valid type.
|
||||
citizens.commands.npc.vulnerable.set=[[{0}]] is now vulnerable.
|
||||
citizens.commands.npc.vulnerable.stopped=[[{0}]] is no longer vulnerable.
|
||||
citizens.commands.npc.wolf.unknown-collar-color=[[{0}]] is not an RGB-formatted collar color.
|
||||
citizens.commands.npc.zombiemod.villager-set=[[{0}]] is now a villager.
|
||||
citizens.commands.npc.zombiemod.villager-unset=[[{0}]] is no longer a villager.
|
||||
citizens.commands.npc.zombiemod.baby-set=[[{0}]] is now a baby.
|
||||
|
@ -100,4 +100,5 @@ permissions:
|
||||
children:
|
||||
citizens.npc.trait: true
|
||||
citizens.npc.trait-configure: true
|
||||
citizens.npc.vulnerable: true
|
||||
citizens.npc.vulnerable: true
|
||||
citizens.npc.wolf: true
|
Loading…
Reference in New Issue
Block a user