mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-07-01 12:36:41 +00:00
Removal of Lombok
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!!
This commit is contained in:
@ -4,10 +4,9 @@ import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import joptsimple.internal.Strings;
|
||||
import lombok.Getter;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import me.totalfreedom.totalfreedommod.util.Response;
|
||||
@ -23,7 +22,6 @@ public class Pterodactyl extends FreedomService
|
||||
private final List<String> SERVER_HEADERS = Arrays.asList("Accept:Application/vnd.pterodactyl.v1+json", "Content-Type:application/json", "Authorization:Bearer " + SERVER_KEY);
|
||||
private final List<String> ADMIN_HEADERS = Arrays.asList("Accept:Application/vnd.pterodactyl.v1+json", "Content-Type:application/json", "Authorization:Bearer " + ADMIN_KEY);
|
||||
|
||||
@Getter
|
||||
private boolean enabled = !Strings.isNullOrEmpty(URL);
|
||||
|
||||
public void onStart()
|
||||
@ -54,6 +52,7 @@ public class Pterodactyl extends FreedomService
|
||||
addAccountToServer(id);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public String createAccount(String username, String password)
|
||||
{
|
||||
JSONObject json = new JSONObject();
|
||||
@ -94,6 +93,7 @@ public class Pterodactyl extends FreedomService
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void addAccountToServer(String id)
|
||||
{
|
||||
String url = URL + "/api/client/servers/" + ConfigEntry.PTERO_SERVER_UUID.getString() + "/users";
|
||||
@ -161,6 +161,7 @@ public class Pterodactyl extends FreedomService
|
||||
}
|
||||
|
||||
// API patch function on users doesnt work rn, it throws 500 errors, so it's probably not written yet
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setPassword(String id, String password)
|
||||
{
|
||||
JSONObject json = new JSONObject();
|
||||
@ -175,4 +176,39 @@ public class Pterodactyl extends FreedomService
|
||||
FLog.severe(e);
|
||||
}
|
||||
}
|
||||
|
||||
public String getURL()
|
||||
{
|
||||
return URL;
|
||||
}
|
||||
|
||||
public String getSERVER_KEY()
|
||||
{
|
||||
return SERVER_KEY;
|
||||
}
|
||||
|
||||
public String getADMIN_KEY()
|
||||
{
|
||||
return ADMIN_KEY;
|
||||
}
|
||||
|
||||
public List<String> getSERVER_HEADERS()
|
||||
{
|
||||
return SERVER_HEADERS;
|
||||
}
|
||||
|
||||
public List<String> getADMIN_HEADERS()
|
||||
{
|
||||
return ADMIN_HEADERS;
|
||||
}
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled)
|
||||
{
|
||||
this.enabled = enabled;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user