Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex
This commit is contained in:
commit
fea3793fca
@ -13,6 +13,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
@ -300,14 +301,21 @@ public class NpcManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
LivingEntity entity = (LivingEntity) _creature.SpawnEntity(npc.getLocation(), EntityType.valueOf(npc.getDatabaseRecord().getEntityType()));
|
LivingEntity entity = (LivingEntity) _creature.SpawnEntity(npc.getLocation(), EntityType.valueOf(npc.getDatabaseRecord().getEntityType()));
|
||||||
|
|
||||||
entity.setCustomNameVisible(true);
|
if (npc.getDatabaseRecord().getName() == null)
|
||||||
String name = npc.getDatabaseRecord().getName() == null ? "" : npc.getDatabaseRecord().getName();
|
{
|
||||||
|
entity.setCustomNameVisible(false);
|
||||||
|
entity.setCustomName(ChatColor.RESET.toString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
String name = npc.getDatabaseRecord().getName();
|
||||||
for (ChatColor color : ChatColor.values())
|
for (ChatColor color : ChatColor.values())
|
||||||
name = name.replace("(" + color.name().toLowerCase() + ")", color.toString());
|
name = name.replace("(" + color.name().toLowerCase() + ")", color.toString());
|
||||||
|
|
||||||
name = ChatColor.translateAlternateColorCodes('&', name);
|
name = ChatColor.translateAlternateColorCodes('&', name);
|
||||||
|
|
||||||
|
entity.setCustomNameVisible(true);
|
||||||
entity.setCustomName(ChatColor.RESET + name);
|
entity.setCustomName(ChatColor.RESET + name);
|
||||||
|
}
|
||||||
|
|
||||||
entity.setCanPickupItems(false);
|
entity.setCanPickupItems(false);
|
||||||
entity.setRemoveWhenFarAway(false);
|
entity.setRemoveWhenFarAway(false);
|
||||||
@ -338,6 +346,7 @@ public class NpcManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
UtilEnt.Vegetate(entity);
|
UtilEnt.Vegetate(entity);
|
||||||
UtilEnt.silence(entity, true);
|
UtilEnt.silence(entity, true);
|
||||||
|
UtilEnt.ghost(entity, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (npc.getDatabaseRecord().getHelmet() != null)
|
if (npc.getDatabaseRecord().getHelmet() != null)
|
||||||
@ -414,7 +423,10 @@ public class NpcManager extends MiniPlugin
|
|||||||
|
|
||||||
if (npc.getFailedAttempts() >= 10 || npc.getDatabaseRecord().getRadius() == 0)
|
if (npc.getFailedAttempts() >= 10 || npc.getDatabaseRecord().getRadius() == 0)
|
||||||
{
|
{
|
||||||
entity.teleport(npc.getLocation());
|
Location location = npc.getLocation();
|
||||||
|
location.setPitch(entity.getLocation().getPitch());
|
||||||
|
location.setYaw(entity.getLocation().getYaw());
|
||||||
|
entity.teleport(location);
|
||||||
entity.setVelocity(new Vector(0, 0, 0));
|
entity.setVelocity(new Vector(0, 0, 0));
|
||||||
npc.setFailedAttempts(0);
|
npc.setFailedAttempts(0);
|
||||||
}
|
}
|
||||||
@ -450,7 +462,10 @@ public class NpcManager extends MiniPlugin
|
|||||||
|
|
||||||
if (!entity.isDead() && entity.isValid())
|
if (!entity.isDead() && entity.isValid())
|
||||||
{
|
{
|
||||||
entity.teleport(npc.getLocation());
|
Location location = npc.getLocation();
|
||||||
|
location.setPitch(entity.getLocation().getPitch());
|
||||||
|
location.setYaw(entity.getLocation().getYaw());
|
||||||
|
entity.teleport(location);
|
||||||
entity.setVelocity(new Vector(0, 0, 0));
|
entity.setVelocity(new Vector(0, 0, 0));
|
||||||
|
|
||||||
npc.setFailedAttempts(0);
|
npc.setFailedAttempts(0);
|
||||||
@ -550,7 +565,10 @@ public class NpcManager extends MiniPlugin
|
|||||||
UtilEnt.ghost(entity, true, false);
|
UtilEnt.ghost(entity, true, false);
|
||||||
|
|
||||||
if (npc.getDatabaseRecord().getRadius() == 0)
|
if (npc.getDatabaseRecord().getRadius() == 0)
|
||||||
|
{
|
||||||
UtilEnt.Vegetate(entity);
|
UtilEnt.Vegetate(entity);
|
||||||
|
UtilEnt.ghost(entity, true, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isDetachedNpc((LivingEntity) entity))
|
if (isDetachedNpc((LivingEntity) entity))
|
||||||
|
Loading…
Reference in New Issue
Block a user