2020-07-01 01:51:06 +00:00
|
|
|
package me.totalfreedom.totalfreedommod;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
import lombok.Getter;
|
|
|
|
|
|
|
|
public class FreedomServiceHandler
|
|
|
|
{
|
|
|
|
@Getter
|
|
|
|
private List<FreedomService> services;
|
|
|
|
|
|
|
|
public FreedomServiceHandler()
|
|
|
|
{
|
|
|
|
this.services = new ArrayList<>();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void add(FreedomService service)
|
|
|
|
{
|
|
|
|
services.add(service);
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getServiceAmount()
|
|
|
|
{
|
|
|
|
return services.size();
|
|
|
|
}
|
2020-08-04 22:16:11 +00:00
|
|
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-07-01 01:51:06 +00:00
|
|
|
}
|