don't cull an entity if a player is nearby
This commit is contained in:
parent
afbccba36f
commit
ace4548b1e
@ -736,8 +736,13 @@ public class ClansUtility
|
||||
{
|
||||
for (int z = -1; z <= 1; z++)
|
||||
{
|
||||
if (x == 0 && z == 0) continue;
|
||||
if (Math.abs(x) == 1 && Math.abs(z) == 1) continue;
|
||||
if ((x == 1 && z == 1)
|
||||
|| (x == -1 && z == 1)
|
||||
|| (x == -1 && z == -1)
|
||||
|| (x == 1 && z == -1)
|
||||
|| (x == 0 && z == 0)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String other = UtilWorld.chunkToStr(caller.getWorld().getChunkAt(caller.getLocation().getChunk().getX() + x, caller.getLocation().getChunk().getZ() + z));
|
||||
|
||||
|
@ -891,6 +891,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
if (clan == null) return;
|
||||
|
||||
_manager.getClanUtility().join(caller, clan);
|
||||
_manager.getClanDataAccess().role(clan, caller.getUniqueId(), ClanRole.LEADER);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,9 +3,12 @@ package mineplex.game.clans.world;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@ -38,7 +41,23 @@ public class WorldManager extends MiniPlugin
|
||||
for (Entity ent : world.getEntities())
|
||||
{
|
||||
if (ent.getCustomName() == null)
|
||||
_ents.get(ent.getType()).add(ent);
|
||||
{
|
||||
boolean cull = true;
|
||||
|
||||
for (Player player : world.getPlayers())
|
||||
{
|
||||
if (player.getLocation().distance(ent.getLocation()) <= 64)
|
||||
{
|
||||
cull = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (cull)
|
||||
{
|
||||
_ents.get(ent.getType()).add(ent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (EntityType type : _ents.keySet())
|
||||
|
Loading…
Reference in New Issue
Block a user