mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-26 12:46:04 +01:00
Add
This commit is contained in:
parent
41ba6b1f64
commit
c6ac327728
8
README
8
README
@ -4,7 +4,7 @@ Citizens is an NPC plugin for the Bukkit API. It was first released on March 5,
|
||||
provides an API itself, which developers can use to create their own NPC characters.
|
||||
|
||||
Compatible With:
|
||||
-Bukkit 1.2.5-R1.0
|
||||
-CitizensAPI 2.0
|
||||
-CraftBukkit 1.2.5-R1.0
|
||||
-Minecraft 1.2.5
|
||||
-Bukkit 1.3.2 dev
|
||||
-CitizensAPI 2.0.2
|
||||
-CraftBukkit 1.3.2 dev
|
||||
-Minecraft 1.3.2
|
@ -34,11 +34,14 @@ import net.citizensnpcs.util.Paginator;
|
||||
import net.citizensnpcs.util.StringHelper;
|
||||
import net.citizensnpcs.util.Util;
|
||||
|
||||
import net.minecraft.server.EntityLiving;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.Ageable;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -649,4 +652,38 @@ public class NPCCommands {
|
||||
Messaging.sendF(sender, ChatColor.GREEN + "%s is %s vulnerable.", StringHelper.wrap(npc.getName()),
|
||||
vulnerable ? "now" : "no longer");
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = { "npc" },
|
||||
usage = "position (-a)",
|
||||
desc = "Changes NPC's head position",
|
||||
flags = "a",
|
||||
modifiers = { "position" },
|
||||
min = 1,
|
||||
max = 2,
|
||||
permission = "npc.position.assume")
|
||||
@Requirements(selected = true, ownership = true, types = { EntityType.PLAYER })
|
||||
public void position(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
|
||||
|
||||
// Assume Player's position
|
||||
if (args.hasFlag('a')) {
|
||||
if (sender instanceof Player) {
|
||||
if (!npc.isSpawned())
|
||||
npc.spawn(npc.getTrait(CurrentLocation.class).getLocation());
|
||||
|
||||
// Update entity with some NMS magic
|
||||
EntityLiving handle = ((CraftLivingEntity) npc.getBukkitEntity()).getHandle();
|
||||
handle.yaw = (float) ((Player) sender).getLocation().getYaw();
|
||||
handle.pitch = (float) ((Player) sender).getLocation().getPitch();
|
||||
handle.as = handle.yaw;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
else
|
||||
Messaging.sendF(sender, ChatColor.YELLOW + "This command can only be used by a Player in-game");
|
||||
}
|
||||
|
||||
Messaging.sendF(sender, ChatColor.YELLOW + "Usage: '/npc position -a' to assume Player's head position");
|
||||
}
|
||||
}
|
@ -35,6 +35,7 @@ permissions:
|
||||
citizens.npc.*:
|
||||
children:
|
||||
citizens.npc.age: true
|
||||
citizens.npc.position.assume: true
|
||||
citizens.npc.behaviour: true
|
||||
citizens.npc.create: true
|
||||
citizens.npc.controllable: true
|
||||
|
Loading…
Reference in New Issue
Block a user