Fix potion effects on players

This commit is contained in:
fullwall 2016-06-05 19:20:42 +08:00
parent 5d060e73ee
commit 0b8f754197
2 changed files with 5 additions and 0 deletions

View File

@ -32,6 +32,8 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton.SkeletonType; import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.entity.Villager.Profession; import org.bukkit.entity.Villager.Profession;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.base.Splitter; import com.google.common.base.Splitter;
@ -977,6 +979,7 @@ public class NPCCommands {
Messaging.send(sender, Messaging.send(sender,
String.format(format, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), loc.getWorld().getName())); String.format(format, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), loc.getWorld().getName()));
} }
((LivingEntity) npc.getEntity()).addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 1, 10));
Messaging.send(sender, " <a>Traits<e>"); Messaging.send(sender, " <a>Traits<e>");
for (Trait trait : npc.getTraits()) { for (Trait trait : npc.getTraits()) {
if (CitizensAPI.getTraitFactory().isInternalTrait(trait)) if (CitizensAPI.getTraitFactory().isInternalTrait(trait))

View File

@ -278,6 +278,8 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
super.m(); super.m();
if (npc == null) if (npc == null)
return; return;
updateEffects = true;
tickPotionEffects();
boolean navigating = npc.getNavigator().isNavigating(); boolean navigating = npc.getNavigator().isNavigating();
updatePackets(navigating); updatePackets(navigating);