mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-19 13:55:00 +00:00
5c0f77c7c5
Lombok implementation removal. I have also gone through and replaced things with inline methods and variables, lambdas, and simplified loops down, removed unnecessary guard clauses, and overall cleaned up every single class. This took a long time, please do remember to follow proper naming conventions, don't include unnecessary guard clauses, follow exception rules and comment rules, and please PLEASE remember to use the DIAMOND OPERATOR rather than just inferring RAW TYPES!!! Thank you!!
59 lines
1.1 KiB
Java
59 lines
1.1 KiB
Java
package me.totalfreedom.totalfreedommod;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
public class FreedomServiceHandler
|
|
{
|
|
private final List<FreedomService> services;
|
|
|
|
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;
|
|
}
|
|
} |