mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-23 09:37:37 +00:00
fix autowiping
so it can work with reloads
This commit is contained in:
parent
34d1eafaaf
commit
21bef1280d
@ -20,7 +20,7 @@ public class ServiceManager
|
|||||||
registerService(new BanService());
|
registerService(new BanService());
|
||||||
registerService(new GameRuleService());
|
registerService(new GameRuleService());
|
||||||
registerService(new UpdateCheckerService());
|
registerService(new UpdateCheckerService());
|
||||||
if (Plex.get().config.getBoolean("autowipe.enabled")) registerService(new AutoWipeService());
|
registerService(new AutoWipeService());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startServices()
|
public void startServices()
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package dev.plex.services.impl;
|
package dev.plex.services.impl;
|
||||||
|
|
||||||
|
import dev.plex.Plex;
|
||||||
import dev.plex.services.AbstractService;
|
import dev.plex.services.AbstractService;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -18,15 +19,18 @@ public class AutoWipeService extends AbstractService
|
|||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
List<String> entities = plugin.config.getStringList("autowipe.entities");
|
if (Plex.get().config.getBoolean("autowipe.enabled"))
|
||||||
|
|
||||||
for (World world : Bukkit.getWorlds())
|
|
||||||
{
|
{
|
||||||
for (Entity entity : world.getEntities())
|
List<String> entities = plugin.config.getStringList("autowipe.entities");
|
||||||
|
|
||||||
|
for (World world : Bukkit.getWorlds())
|
||||||
{
|
{
|
||||||
if (entities.stream().anyMatch(entityName -> entityName.equalsIgnoreCase(entity.getType().name())))
|
for (Entity entity : world.getEntities())
|
||||||
{
|
{
|
||||||
entity.remove();
|
if (entities.stream().anyMatch(entityName -> entityName.equalsIgnoreCase(entity.getType().name())))
|
||||||
|
{
|
||||||
|
entity.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user