Performance

This commit is contained in:
Brianna O'Keefe 2018-10-30 16:36:48 -04:00
parent 11ccc93a9b
commit 267c370ae3
5 changed files with 9 additions and 13 deletions

View File

@ -25,13 +25,13 @@ public class AppearanceHandler {
public AppearanceHandler() {
try {
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(EpicSpawnersPlugin.getInstance(), this::displayItems, 30L, 30L);
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(EpicSpawnersPlugin.getInstance(), this::displayItems, 100L, 60L);
} catch (Exception e) {
Debugger.runReport(e);
}
}
public void displayItems() {
private void displayItems() {
try {
EpicSpawnersPlugin instance = EpicSpawnersPlugin.getInstance();
@ -128,9 +128,7 @@ public class AppearanceHandler {
List<Entity> near = (List<Entity>) location.getWorld().getNearbyEntities(location, 2, 4, 2);
if (near == null) return null;
near.removeIf(entity -> (entity == null));
near.removeIf(entity -> entity.getCustomName() == null);
near.removeIf(e -> (!(e.getCustomName().equalsIgnoreCase("EpicSpawners-Display"))));
near.removeIf(entity -> entity == null || entity.getType() != EntityType.ARMOR_STAND || entity.getCustomName() == null || !entity.getCustomName().equalsIgnoreCase("EpicSpawners-Display"));
if (near.size() != 0) {
if (Debugger.isDebug()) {
Bukkit.getLogger().info("Songoda-Debug: ArmorStand present");

View File

@ -4,10 +4,7 @@ import com.songoda.epicspawners.EpicSpawnersPlugin;
import com.songoda.epicspawners.api.spawner.Spawner;
import com.songoda.epicspawners.api.spawner.condition.SpawnCondition;
import org.bukkit.Location;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.*;
import java.util.Collection;
@ -37,7 +34,7 @@ public class SpawnConditionNearbyEntities implements SpawnCondition {
String[] arr = EpicSpawnersPlugin.getInstance().getConfig().getString("Main.Radius To Search Around Spawners").split("x");
Collection<Entity> amt = location.getWorld().getNearbyEntities(location, Integer.parseInt(arr[0]), Integer.parseInt(arr[1]), Integer.parseInt(arr[2]));
amt.removeIf(e -> e instanceof Player || !(e instanceof LivingEntity) || e instanceof ArmorStand);
amt.removeIf(e -> !(e instanceof LivingEntity) || e.getType() == EntityType.PLAYER || e.getType() == EntityType.ARMOR_STAND);
return amt.size() < max;
}

View File

@ -4,6 +4,7 @@ import com.songoda.epicspawners.api.spawner.Spawner;
import com.songoda.epicspawners.api.spawner.condition.SpawnCondition;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import java.util.Collection;
@ -33,7 +34,7 @@ public class SpawnConditionNearbyPlayers implements SpawnCondition {
Location location = spawner.getLocation().add(0.5, 0.5, 0.5);
Collection<Entity> players = location.getWorld().getNearbyEntities(location, distance, distance, distance);
players.removeIf(e -> !(e instanceof Player));
players.removeIf(e -> e.getType() != EntityType.PLAYER);
return players.size() >= amount;
}

View File

@ -1,6 +1,6 @@
name: EpicSpawners
description: EpicSpawners
version: 5.4
version: 5.5.8
depend: [Arconix, Vault]
softdepend: [Towny, RedProtect Kingdoms, PlotSquared, GriefPrevention, USkyBlock, ASkyBlock, WorldGuard, Factions, PlaceholderAPI]
main: com.songoda.epicspawners.EpicSpawnersPlugin

View File

@ -2,7 +2,7 @@
<groupId>com.songoda</groupId>
<artifactId>EpicSpawners</artifactId>
<modelVersion>4.0.0</modelVersion>
<version>5.4</version>
<version>5.5.8</version>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>