mirror of
https://github.com/plexusorg/Plex.git
synced 2025-07-05 00:56:42 +00:00
autowipe + toggledrops
yay!
This commit is contained in:
40
src/main/java/dev/plex/services/impl/AutoWipeService.java
Normal file
40
src/main/java/dev/plex/services/impl/AutoWipeService.java
Normal file
@ -0,0 +1,40 @@
|
||||
package dev.plex.services.impl;
|
||||
|
||||
import dev.plex.services.AbstractService;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AutoWipeService extends AbstractService
|
||||
{
|
||||
public AutoWipeService()
|
||||
{
|
||||
super(true, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
List<String> entities = plugin.config.getStringList("autowipe.entities");
|
||||
|
||||
for (World world : Bukkit.getWorlds())
|
||||
{
|
||||
for (Entity entity : world.getEntities())
|
||||
{
|
||||
if (entities.stream().anyMatch(entityName -> entityName.equalsIgnoreCase(entity.getType().name())))
|
||||
{
|
||||
entity.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int repeatInSeconds()
|
||||
{
|
||||
return Math.max(1, plugin.config.getInt("autowipe.interval"));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user