mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-09-12 07:38:11 +02:00
Merge branch 'master' of github.com:CitizensDev/Citizens2
This commit is contained in:
commit
da723d47e8
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.
|
provides an API itself, which developers can use to create their own NPC characters.
|
||||||
|
|
||||||
Compatible With:
|
Compatible With:
|
||||||
-Bukkit 1.2.5-R1.0
|
-Bukkit 1.3.2 dev
|
||||||
-CitizensAPI 2.0
|
-CitizensAPI 2.0.2
|
||||||
-CraftBukkit 1.2.5-R1.0
|
-CraftBukkit 1.3.2 dev
|
||||||
-Minecraft 1.2.5
|
-Minecraft 1.3.2
|
@ -34,11 +34,14 @@ import net.citizensnpcs.util.Paginator;
|
|||||||
import net.citizensnpcs.util.StringHelper;
|
import net.citizensnpcs.util.StringHelper;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
|
|
||||||
|
import net.minecraft.server.EntityLiving;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||||
import org.bukkit.entity.Ageable;
|
import org.bukkit.entity.Ageable;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@ -649,4 +652,39 @@ public class NPCCommands {
|
|||||||
Messaging.sendF(sender, ChatColor.GREEN + "%s is %s vulnerable.", StringHelper.wrap(npc.getName()),
|
Messaging.sendF(sender, ChatColor.GREEN + "%s is %s vulnerable.", StringHelper.wrap(npc.getName()),
|
||||||
vulnerable ? "now" : "no longer");
|
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) {
|
||||||
|
// Spawn the NPC if it isn't spawned to prevent NPEs
|
||||||
|
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.*:
|
citizens.npc.*:
|
||||||
children:
|
children:
|
||||||
citizens.npc.age: true
|
citizens.npc.age: true
|
||||||
|
citizens.npc.position.assume: true
|
||||||
citizens.npc.behaviour: true
|
citizens.npc.behaviour: true
|
||||||
citizens.npc.create: true
|
citizens.npc.create: true
|
||||||
citizens.npc.controllable: true
|
citizens.npc.controllable: true
|
||||||
|
Loading…
Reference in New Issue
Block a user