mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 18:45:29 +01:00
Fix PlayerAnimation START_USE_ITEM
This commit is contained in:
parent
03abd6384d
commit
ae58175abe
@ -287,8 +287,9 @@ public class CitizensNPC extends AbstractNPC {
|
||||
nameVisibility = OptionStatus.ALWAYS;
|
||||
getEntity().setCustomName(getFullName());
|
||||
}
|
||||
if (getEntity() instanceof Player && data().has(NPC.SCOREBOARD_FAKE_TEAM_NAME_METADATA)) {
|
||||
String teamName = data().get(NPC.SCOREBOARD_FAKE_TEAM_NAME_METADATA);
|
||||
String teamName = data().get(NPC.SCOREBOARD_FAKE_TEAM_NAME_METADATA, "");
|
||||
if (getEntity() instanceof Player
|
||||
&& Bukkit.getScoreboardManager().getMainScoreboard().getTeam(teamName) != null) {
|
||||
Team team = Bukkit.getScoreboardManager().getMainScoreboard().getTeam(teamName);
|
||||
team.setOption(Option.NAME_TAG_VISIBILITY, nameVisibility);
|
||||
if (data().has(NPC.GLOWING_COLOR_METADATA)) {
|
||||
|
@ -45,6 +45,7 @@ public class CitizensNPCRegistry implements NPCRegistry {
|
||||
Preconditions.checkNotNull(name, "name cannot be null");
|
||||
Preconditions.checkNotNull(type, "type cannot be null");
|
||||
CitizensNPC npc = getByType(type, uuid, id, name);
|
||||
|
||||
if (npc == null)
|
||||
throw new IllegalStateException("Could not create NPC.");
|
||||
npcs.put(npc.getId(), npc);
|
||||
|
@ -12,6 +12,7 @@ import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.trait.ArmorStandTrait;
|
||||
import net.minecraft.server.v1_9_R1.BlockPosition;
|
||||
import net.minecraft.server.v1_9_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_9_R1.EnumHand;
|
||||
import net.minecraft.server.v1_9_R1.Packet;
|
||||
import net.minecraft.server.v1_9_R1.PacketPlayOutAnimation;
|
||||
import net.minecraft.server.v1_9_R1.PacketPlayOutBed;
|
||||
@ -112,10 +113,18 @@ public enum PlayerAnimation {
|
||||
radius);
|
||||
}
|
||||
},
|
||||
START_USE_ITEM {
|
||||
START_USE_MAINHAND_ITEM {
|
||||
@Override
|
||||
protected void playAnimation(EntityPlayer player, int radius) {
|
||||
player.f(true);
|
||||
player.c(EnumHand.MAIN_HAND);
|
||||
sendPacketNearby(new PacketPlayOutEntityMetadata(player.getId(), player.getDataWatcher(), true), player,
|
||||
radius);
|
||||
}
|
||||
},
|
||||
START_USE_OFFHAND_ITEM {
|
||||
@Override
|
||||
protected void playAnimation(EntityPlayer player, int radius) {
|
||||
player.c(EnumHand.OFF_HAND);
|
||||
sendPacketNearby(new PacketPlayOutEntityMetadata(player.getId(), player.getDataWatcher(), true), player,
|
||||
radius);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user