TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/FreedomServiceHandler.java

59 lines
1.1 KiB
Java
Raw Normal View History

2020-07-01 01:51:06 +00:00
package me.totalfreedom.totalfreedommod;
import java.util.ArrayList;
import java.util.List;
public class FreedomServiceHandler
{
private final List<FreedomService> services;
2020-07-01 01:51:06 +00:00
public FreedomServiceHandler()
{
this.services = new ArrayList<>();
}
public void add(FreedomService service)
{
services.add(service);
}
public int getServiceAmount()
{
return services.size();
}
public void startServices()
{
for (FreedomService service : getServices())
{
try
{
service.onStart();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
public void stopServices()
{
for (FreedomService service : getServices())
{
try
{
service.onStop();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
public List<FreedomService> getServices()
{
return services;
}
2020-07-01 01:51:06 +00:00
}