use of org.spongepowered.api.entity.Entity in project ClearMob by axle2005.
the class CommandDump method entityDump.
private void entityDump() {
List<String> listdump = new ArrayList<String>();
List<Integer> count = new ArrayList<Integer>();
for (World world : Sponge.getServer().getWorlds()) {
for (Entity entity : world.getEntities()) {
if (!listdump.contains("Entity: " + entity.getType()) && !plugin.getListEntityType().contains(entity.getType())) {
listdump.add("Entity: " + entity.getType());
count.add(1);
} else if (listdump.contains("Entity: " + entity.getType())) {
count.set(listdump.indexOf("Entity: " + entity.getType()), count.get(listdump.indexOf("Entity: " + entity.getType())) + 1);
}
}
}
if (listdump.isEmpty()) {
plugin.getLogger().info("No Entities to Add");
} else {
for (int i = 0; i <= listdump.size() - 1; i++) {
plugin.getLogger().info(listdump.get(i) + ": (" + count.get(i) + ")");
}
}
}
use of org.spongepowered.api.entity.Entity in project ClearMob by axle2005.
the class CommandDump method nearbyDump.
private void nearbyDump(CommandSource src) {
if (src instanceof Player) {
Player player = (Player) src;
List<String> listdump = new ArrayList<String>();
for (Entity entity : player.getNearbyEntities(10)) {
if (!listdump.contains("Entity: " + entity.getType().getId()) && !plugin.getListEntityType().contains(entity.getType().getId())) {
listdump.add("Entity: " + entity.getType().getId());
}
}
if (listdump.isEmpty()) {
plugin.getLogger().info("No Tile Entities to Add");
} else {
for (String s : listdump) {
plugin.getLogger().info(s);
}
}
} else {
src.sendMessage(Text.of("You must be a player to use this"));
}
}
use of org.spongepowered.api.entity.Entity in project ClearMob by axle2005.
the class ClearEntity method run.
public static void run(ClearMob plugin, List<EntityType> list, Collection<World> worlds, CommandSource src) {
int removedentities = 0;
//Collection<Entity> e = new ArrayList<Entity>();
Map<UUID, Entity> entityData = new ConcurrentHashMap<>();
for (World world : worlds) {
for (Entity entity : world.getEntities()) {
entityData.put(entity.getUniqueId(), entity);
plugin.getLogger().info("Test");
//e.add(entity);
}
}
for (Entity en : entityData.values()) {
for (int i = 0; i <= list.size() - 1; i++) {
if ((en.getType().equals(list.get(i)))) {
en.remove();
entityData.remove(en.getUniqueId());
removedentities++;
}
}
}
/*if (!e.isEmpty()) {
for (Entity entity : e) {
for (int i = 0; i <= list.size() - 1; i++) {
if ((entity.getType().equals(list.get(i)))) {
entity.remove();
removedentities++;
}
}
}
}*/
feedback(plugin, src, removedentities);
}
use of org.spongepowered.api.entity.Entity in project ClearMob by axle2005.
the class ClearXP method run.
public static int run(ClearMob plugin, Collection<World> worlds, CommandSource src) {
int removedentities = 0;
Collection<Entity> e = new ArrayList<Entity>();
for (World world : worlds) {
for (Entity entity : world.getEntities()) {
e.add(entity);
}
}
if (!e.isEmpty()) {
for (Entity entity : e) {
if ((entity instanceof ExperienceOrb)) {
entity.remove();
removedentities++;
}
}
}
feedback(plugin, src, removedentities);
return removedentities;
}
Aggregations