Pterodactyl

This commit is contained in:
Seth 2020-09-14 02:36:25 -07:00
parent 3057421d6d
commit 81eb333b6a
No known key found for this signature in database
GPG Key ID: A7BAB4E14F089CF3
23 changed files with 431 additions and 472 deletions

View File

@ -1,187 +0,0 @@
package me.totalfreedom.totalfreedommod;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import joptsimple.internal.Strings;
import lombok.Getter;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.staff.StaffMember;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
public class AMP extends FreedomService
{
public String URL = ConfigEntry.AMP_URL.getString();
private String API_URL = URL + "/API/Core";
private String USERNAME = ConfigEntry.AMP_USERNAME.getString();
private String PASSWORD = ConfigEntry.AMP_PASSWORD.getString();
private String SESSION_ID;
@Getter
private boolean enabled = !Strings.isNullOrEmpty(URL);
private final List<String> headers = Arrays.asList("Accept:application/json");
public void onStart()
{
if (enabled)
{
login();
}
}
public void onStop()
{
if (enabled)
{
logout();
}
}
public void login()
{
JSONObject json = new JSONObject();
json.put("username", USERNAME);
json.put("password", PASSWORD);
json.put("token", "");
json.put("rememberMe", false);
String response;
try
{
response = FUtil.sendRequest(API_URL + "/Login", "POST", headers, json.toJSONString());
}
catch (IOException e)
{
e.printStackTrace();
return;
}
JSONObject jsonResponse;
try
{
jsonResponse = (JSONObject)new JSONParser().parse(response);
}
catch (ParseException e)
{
e.printStackTrace();
return;
}
Object sessionID = jsonResponse.get("sessionID");
if (sessionID == null)
{
FLog.warning("Invalid AMP credentials have been specified in the config");
enabled = false;
return;
}
SESSION_ID = sessionID.toString();
FLog.info("Logged into AMP");
}
public void logout()
{
JSONObject json = new JSONObject();
json.put("SESSIONID", SESSION_ID);
try
{
FUtil.sendRequest(API_URL + "/Logout", "POST", headers, json.toJSONString());
}
catch (IOException e)
{
e.printStackTrace();
return;
}
FLog.info("Logged out of AMP");
}
public void updateAccountStatus(StaffMember staffMember)
{
String username = staffMember.getAmpUsername();
if (username == null || !enabled)
{
return;
}
if (!staffMember.isActive() || staffMember.getRank() != Rank.ADMIN)
{
FLog.debug("Disabling amp acc");
setAccountEnabled(username, false);
return;
}
FLog.debug("Enabling amp acc");
setAccountEnabled(username, true);
}
public void createAccount(String username, String password)
{
makeAccount(username);
setPassword(username, password);
}
public void setAccountEnabled(String username, boolean enable)
{
JSONObject json = new JSONObject();
json.put("Username", username);
json.put("Disabled", !enable);
json.put("PasswordExpires", false);
json.put("CannotChangePassword", false);
json.put("MustChangePassword", false);
json.put("SESSIONID", SESSION_ID);
try
{
FUtil.sendRequest(API_URL + "/UpdateUserInfo", "POST", headers, json.toJSONString());
}
catch (IOException e)
{
e.printStackTrace();
return;
}
}
private void makeAccount(String username)
{
JSONObject json = new JSONObject();
json.put("Username", username);
json.put("SESSIONID", SESSION_ID);
try
{
FUtil.sendRequest(API_URL + "/CreateUser", "POST", headers, json.toJSONString());
}
catch (IOException e)
{
e.printStackTrace();
return;
}
}
public void setPassword(String username, String password)
{
JSONObject json = new JSONObject();
json.put("Username", username);
json.put("NewPassword", password);
json.put("SESSIONID", SESSION_ID);
try
{
FUtil.sendRequest(API_URL + "/ResetUserPassword", "POST", headers, json.toJSONString());
}
catch (IOException e)
{
e.printStackTrace();
return;
}
}
}

View File

@ -0,0 +1,178 @@
package me.totalfreedom.totalfreedommod;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import joptsimple.internal.Strings;
import lombok.Getter;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.staff.StaffMember;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import me.totalfreedom.totalfreedommod.util.Response;
import org.json.simple.JSONObject;
import org.json.simple.parser.ParseException;
public class Pterodactyl extends FreedomService
{
public final String URL = ConfigEntry.PTERO_URL.getString();
private final String SERVER_KEY = ConfigEntry.PTERO_SERVER_KEY.getString();
private final String ADMIN_KEY = ConfigEntry.PTERO_ADMIN_KEY.getString();
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()
{
}
public void onStop()
{
}
public void updateAccountStatus(StaffMember staffMember)
{
String id = staffMember.getPteroID();
if (Strings.isNullOrEmpty(id) || !enabled)
{
return;
}
if (!staffMember.isActive() || staffMember.getRank() != Rank.ADMIN)
{
FLog.debug("Disabling ptero acc");
removeAccountFromServer(id);
return;
}
FLog.debug("Enabling aptero acc");
addAccountToServer(id);
}
public String createAccount(String username, String password)
{
JSONObject json = new JSONObject();
json.put("username", username);
json.put("password", password);
json.put("email", username.toLowerCase() + "@" + ConfigEntry.PTERO_DEFAULT_EMAIL_DOMAIN.getString());
json.put("first_name", username);
json.put("last_name", "\u200E"); // required, so I made it appear empty
Response response;
JSONObject jsonResponse;
try
{
response = FUtil.sendRequest(URL + "/api/application/users", "POST", ADMIN_HEADERS, json.toJSONString());
jsonResponse = response.getJSONMessage();
}
catch (IOException | ParseException e)
{
FLog.severe(e);
return null;
}
return ((JSONObject)jsonResponse.get("attributes")).get("id").toString();
}
public boolean deleteAccount(String id)
{
JSONObject json = new JSONObject();
try
{
return FUtil.sendRequest(URL + "/api/application/users/" + id, "DELETE", ADMIN_HEADERS, json.toJSONString()).getCode() == 204;
}
catch (IOException e)
{
FLog.severe(e);
return false;
}
}
public void addAccountToServer(String id)
{
String url = URL + "/api/client/servers/" + ConfigEntry.PTERO_SERVER_UUID.getString() + "/users";
JSONObject userData = getUserData(id);
if (userData == null)
{
FLog.severe("The Pterodactyl user with the ID of " + id + " was not found");
return;
}
JSONObject json = new JSONObject();
json.put("email", userData.get("email").toString());
json.put("permissions", Arrays.asList("control.console", "control.start", "control.restart", "control.stop", "control.kill"));
try
{
FUtil.sendRequest(url, "POST", SERVER_HEADERS, json.toJSONString());
}
catch (IOException e)
{
FLog.severe(e);
}
}
public void removeAccountFromServer(String id)
{
JSONObject userData = getUserData(id);
if (userData == null)
{
FLog.severe("The Pterodactyl user with the ID of " + id + " was not found");
return;
}
String url = URL + "/api/client/servers/" + ConfigEntry.PTERO_SERVER_UUID.getString() + "/users/" + userData.get("uuid");
try
{
FUtil.sendRequest(url, "DELETE", SERVER_HEADERS, null);
}
catch (IOException e)
{
FLog.severe(e);
}
}
public JSONObject getUserData(String id)
{
Response response;
JSONObject jsonResponse;
try
{
response = FUtil.sendRequest(URL + "/api/application/users/" + id, "GET", ADMIN_HEADERS, null);
jsonResponse = response.getJSONMessage();
}
catch (IOException | ParseException e)
{
FLog.severe(e);
return null;
}
return (JSONObject)jsonResponse.get("attributes");
}
// API patch function on users doesnt work rn, it throws 500 errors, so it's probably not written yet
public void setPassword(String id, String password)
{
JSONObject json = new JSONObject();
json.put("password", password);
try
{
FUtil.sendRequest(URL + "/api/application/users/" + id, "PATCH", ADMIN_HEADERS, json.toJSONString());
}
catch (IOException e)
{
FLog.severe(e);
}
}
}

View File

@ -201,23 +201,19 @@ public class Reddit extends FreedomService
{ {
flairList.put(Title.OWNER, ConfigEntry.REDDIT_SERVER_OWNER_FLAIR_ID.getString()); flairList.put(Title.OWNER, ConfigEntry.REDDIT_SERVER_OWNER_FLAIR_ID.getString());
flairList.put(Title.EXECUTIVE, ConfigEntry.REDDIT_EXECUTIVE_FLAIR_ID.getString()); flairList.put(Title.EXECUTIVE, ConfigEntry.REDDIT_EXECUTIVE_FLAIR_ID.getString());
flairList.put(Title.ASSISTANT_EXECUTIVE, ConfigEntry.REDDIT_ASSISTANT_EXECUTIVE_FLAIR_ID.getString());
flairList.put(Title.DEVELOPER, ConfigEntry.REDDIT_DEVELOPER_FLAIR_ID.getString()); flairList.put(Title.DEVELOPER, ConfigEntry.REDDIT_DEVELOPER_FLAIR_ID.getString());
flairList.put(Rank.ADMIN, ConfigEntry.REDDIT_ADMIN_FLAIR_ID.getString()); flairList.put(Rank.ADMIN, ConfigEntry.REDDIT_ADMIN_FLAIR_ID.getString());
flairList.put(Rank.MOD, ConfigEntry.REDDIT_MOD_FLAIR_ID.getString()); flairList.put(Rank.MOD, ConfigEntry.REDDIT_MOD_FLAIR_ID.getString());
flairList.put(Rank.TRIAL_MOD, ConfigEntry.REDDIT_TRIAL_MOD_FLAIR_ID.getString()); flairList.put(Rank.TRIAL_MOD, ConfigEntry.REDDIT_TRIAL_MOD_FLAIR_ID.getString());
flairList.put(Title.MASTER_BUILDER, ConfigEntry.REDDIT_MASTER_BUILDER_FLAIR_ID.getString()); flairList.put(Title.MASTER_BUILDER, ConfigEntry.REDDIT_MASTER_BUILDER_FLAIR_ID.getString());
flairList.put(Title.DONATOR, ConfigEntry.REDDIT_DONATOR_FLAIR_ID.getString());
// Work around because the current flair id keeps returning null, either a JRAW bug or a reddit bug // Work around because the current flair id keeps returning null, either a JRAW bug or a reddit bug
flairNameList.put(Title.OWNER, "Server Owner"); flairNameList.put(Title.OWNER, "Server Owner");
flairNameList.put(Title.EXECUTIVE, "Executive"); flairNameList.put(Title.EXECUTIVE, "Executive");
flairNameList.put(Title.ASSISTANT_EXECUTIVE, "Assistant Executive");
flairNameList.put(Title.DEVELOPER, "Developer"); flairNameList.put(Title.DEVELOPER, "Developer");
flairNameList.put(Rank.ADMIN, "Admin"); flairNameList.put(Rank.ADMIN, "Admin");
flairNameList.put(Rank.MOD, "Mod"); flairNameList.put(Rank.MOD, "Mod");
flairNameList.put(Rank.TRIAL_MOD, "Trial Mod"); flairNameList.put(Rank.TRIAL_MOD, "Trial Mod");
flairNameList.put(Title.MASTER_BUILDER, "Master Builder"); flairNameList.put(Title.MASTER_BUILDER, "Master Builder");
flairNameList.put(Title.DONATOR, "Premium");
} }
} }

View File

@ -135,7 +135,7 @@ public class TotalFreedomMod extends JavaPlugin
public EntityWiper ew; public EntityWiper ew;
public Sitter st; public Sitter st;
public VanishHandler vh; public VanishHandler vh;
public AMP amp; public Pterodactyl ptero;
//public HubWorldRestrictions hwr; //public HubWorldRestrictions hwr;
// //
@ -233,7 +233,7 @@ public class TotalFreedomMod extends JavaPlugin
ew = new EntityWiper(); ew = new EntityWiper();
st = new Sitter(); st = new Sitter();
vh = new VanishHandler(); vh = new VanishHandler();
amp = new AMP(); ptero = new Pterodactyl();
// Single admin utils // Single admin utils
cs = new CommandSpy(); cs = new CommandSpy();

View File

@ -1,101 +0,0 @@
package me.totalfreedom.totalfreedommod.command;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.staff.StaffMember;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Manage your AMP account", usage = "/<command> <create | resetpassword>")
public class Command_amp extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!plugin.amp.isEnabled())
{
msg("AMP integration is currently disabled.", ChatColor.RED);
return true;
}
PlayerData playerData = getData(playerSender);
if (playerData.getDiscordID() == null)
{
msg("You must have a linked discord account.", ChatColor.RED);
return true;
}
if (args.length == 0)
{
return false;
}
if (args[0].equals("create"))
{
msg("Creating your AMP account...", ChatColor.GREEN);
StaffMember staffMember = getAdmin(playerSender);
if (staffMember.getAmpUsername() != null)
{
msg("You already have an AMP account.", ChatColor.RED);
return true;
}
String username = sender.getName();
String password = FUtil.randomString(30);
staffMember.setAmpUsername(username);
plugin.sl.save(staffMember);
plugin.sl.updateTables();
plugin.amp.createAccount(username, password);
plugin.dc.sendAMPInfo(playerData, username, password);
msg("Successfully created your AMP account. Check your DMs from " + plugin.dc.formatBotTag() + " on discord to get your credentials.", ChatColor.GREEN);
return true;
}
else if (args[0].equals("resetpassword"))
{
StaffMember staffMember = getAdmin(playerSender);
if (staffMember.getAmpUsername() == null)
{
msg("You do not have an AMP account.", ChatColor.RED);
return true;
}
msg("Resetting your password...", ChatColor.GREEN);
String username = staffMember.getAmpUsername();
String password = FUtil.randomString(30);
plugin.amp.setPassword(username,password);
plugin.dc.sendAMPInfo(playerData, username, password);
msg("Successfully reset your AMP account password. Check your DMs from " + plugin.dc.formatBotTag() + " on discord to get your credentials.", ChatColor.GREEN);
return true;
}
return false;
}
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (args.length == 1 && plugin.sl.isAdmin(sender))
{
return Arrays.asList("create", "resetpassword");
}
return Collections.emptyList();
}
}

View File

@ -1,91 +0,0 @@
package me.totalfreedom.totalfreedommod.command;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_CONSOLE)
@CommandParameters(description = "Adds or removes donators", usage = "/<command> <mode> <name> <ip> <package> [forum_user]")
public class Command_donator extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!FUtil.isFromHostConsole(sender.getName()) && !ConfigEntry.SERVER_OWNERS.getStringList().contains(sender.getName()))
{
return noPerms();
}
Boolean mode = args[0].equals("add");
String name = args[1];
String ip = args[2];
String pkg = args[3];
String forum_id = null;
if (args.length > 4)
{
forum_id = args[4];
}
PlayerData data = plugin.pl.getData(name);
if (data == null)
{
data = plugin.pl.getDataByIp(ip);
}
if (data != null)
{
data.setDonator(mode);
plugin.pl.save(data);
}
if (mode)
{
FUtil.bcastMsg(ChatColor.AQUA + name + ChatColor.GREEN + " has donated to the server!");
}
Player player = getPlayer(name);
if (player != null)
{
plugin.rm.updateDisplay(player);
}
if (forum_id != null && !forum_id.equals("0"))
{
String baseurl = ConfigEntry.DONATION_PROBOARDS_URL.getString();
String group_id = ConfigEntry.DONATION_GROUP_ID.getString();
String session_id = ConfigEntry.DONATION_SESSION_ID.getString();
String csrf_token = ConfigEntry.DONATION_CSRF_TOKEN.getString();
if (baseurl == null || group_id == null || session_id == null || csrf_token == null)
{
return true;
}
String url = baseurl + "/user/group_members/" + (mode ? "adding" : "remove");
List<String> headers = Arrays.asList("Cookie:session_id=" + session_id, "X-Requested-With:XMLHttpRequest");
String payload = "group_id=" + group_id + "&user_ids[]=" + forum_id + "&csrf_token=" + csrf_token;
try
{
FUtil.sendRequest(url, "POST", headers, payload);
}
catch (IOException e)
{
FLog.severe(e.getMessage());
e.printStackTrace();
}
}
return true;
}
}

View File

@ -44,14 +44,14 @@ public class Command_doom extends FreedomCommand
final String ip = player.getAddress().getAddress().getHostAddress().trim(); final String ip = player.getAddress().getAddress().getHostAddress().trim();
// Remove from admin // Remove from admin
StaffMember staffMember = getAdmin(player); StaffMember staffMember = getStaffMember(player);
if (staffMember != null) if (staffMember != null)
{ {
FUtil.staffAction(sender.getName(), "Removing " + player.getName() + " from the staff list", true); FUtil.staffAction(sender.getName(), "Removing " + player.getName() + " from the staff list", true);
staffMember.setActive(false); staffMember.setActive(false);
plugin.sl.save(staffMember); plugin.sl.save(staffMember);
plugin.sl.updateTables(); plugin.sl.updateTables();
plugin.amp.updateAccountStatus(staffMember); plugin.ptero.updateAccountStatus(staffMember);
if (plugin.dc.enabled && ConfigEntry.DISCORD_ROLE_SYNC.getBoolean()) if (plugin.dc.enabled && ConfigEntry.DISCORD_ROLE_SYNC.getBoolean())
{ {
plugin.dc.syncRoles(staffMember, plugin.pl.getData(staffMember.getName()).getDiscordID()); plugin.dc.syncRoles(staffMember, plugin.pl.getData(staffMember.getName()).getDiscordID());

View File

@ -29,7 +29,7 @@ public class Command_mystaff extends FreedomCommand
} }
Player init = null; Player init = null;
StaffMember target = getAdmin(playerSender); StaffMember target = getStaffMember(playerSender);
Player targetPlayer = playerSender; Player targetPlayer = playerSender;
// -o switch // -o switch
@ -44,7 +44,7 @@ public class Command_mystaff extends FreedomCommand
return true; return true;
} }
target = getAdmin(targetPlayer); target = getStaffMember(targetPlayer);
if (target == null) if (target == null)
{ {
msg("That player is not a staff member", ChatColor.RED); msg("That player is not a staff member", ChatColor.RED);

View File

@ -0,0 +1,136 @@
package me.totalfreedom.totalfreedommod.command;
import com.google.common.base.Strings;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.staff.StaffMember;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Manage your Pterodactyl panel account", usage = "/<command> <create | delete>")
public class Command_panel extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!plugin.ptero.isEnabled())
{
msg("Pterodactyl integration is currently disabled.", ChatColor.RED);
return true;
}
PlayerData playerData = getData(playerSender);
if (playerData.getDiscordID() == null)
{
msg("You must have a linked discord account.", ChatColor.RED);
return true;
}
if (args.length == 0)
{
return false;
}
if (args[0].equals("create"))
{
msg("Creating your Pterodactyl account...", ChatColor.GREEN);
StaffMember staffMember = getStaffMember(playerSender);
if (staffMember.getPteroID() != null)
{
msg("You already have a Pterodactyl account.", ChatColor.RED);
return true;
}
String username = sender.getName();
String password = FUtil.randomString(30);
String id = plugin.ptero.createAccount(username, password);
if (Strings.isNullOrEmpty(id))
{
msg("Failed to create your Pterodactyl account.", ChatColor.RED);
return true;
}
plugin.ptero.addAccountToServer(id);
staffMember.setPteroID(id);
plugin.sl.save(staffMember);
plugin.sl.updateTables();
plugin.dc.sendPteroInfo(playerData, username, password);
msg("Successfully created your Pterodactyl account. Check your DMs from " + plugin.dc.formatBotTag() + " on discord to get your credentials.", ChatColor.GREEN);
return true;
}
else if (args[0].equals("delete"))
{
msg("Deleting your Pterodactyl account...", ChatColor.GREEN);
StaffMember staffMember = getStaffMember(playerSender);
if (staffMember.getPteroID() == null)
{
msg("You do not have a Pterodactyl account.", ChatColor.RED);
return true;
}
boolean deleted = plugin.ptero.deleteAccount(staffMember.getPteroID());
if (!deleted)
{
msg("Failed to delete your Pterodactyl account.", ChatColor.RED);
return true;
}
staffMember.setPteroID(null);
plugin.sl.save(staffMember);
plugin.sl.updateTables();
msg("Successfully deleted your Pterodactyl account.", ChatColor.GREEN);
return true;
}
/*else if (args[0].equals("resetpassword"))
{
StaffMember staffMember = getAdmin(playerSender);
if (staffMember.getAmpUsername() == null)
{
msg("You do not have a Pterodactyl account.", ChatColor.RED);
return true;
}
msg("Resetting your password...", ChatColor.GREEN);
String id = staffMember.getPteroID();
String password = FUtil.randomString(30);
plugin.ptero.setPassword(id, password);
plugin.dc.sendPteroInfo(playerData, null, password);
msg("Successfully reset your AMP account password. Check your DMs from " + plugin.dc.formatBotTag() + " on discord to get your credentials.", ChatColor.GREEN);
return true;
}*/
return false;
}
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (args.length == 1 && plugin.sl.isAdmin(sender))
{
return Arrays.asList("create", "delete");
}
return Collections.emptyList();
}
}

View File

@ -112,7 +112,7 @@ public class Command_slconfig extends FreedomCommand
plugin.dc.syncRoles(staffMember, plugin.pl.getData(staffMember.getName()).getDiscordID()); plugin.dc.syncRoles(staffMember, plugin.pl.getData(staffMember.getName()).getDiscordID());
} }
plugin.amp.updateAccountStatus(staffMember); plugin.ptero.updateAccountStatus(staffMember);
msg("Set " + staffMember.getName() + "'s rank to " + rank.getName()); msg("Set " + staffMember.getName() + "'s rank to " + rank.getName());
return true; return true;
@ -206,7 +206,7 @@ public class Command_slconfig extends FreedomCommand
plugin.sl.addAdmin(staffMember); plugin.sl.addAdmin(staffMember);
plugin.rm.updateDisplay(player); plugin.rm.updateDisplay(player);
plugin.amp.updateAccountStatus(staffMember); plugin.ptero.updateAccountStatus(staffMember);
} }
else // Existing staff member else // Existing staff member
{ {
@ -243,7 +243,7 @@ public class Command_slconfig extends FreedomCommand
{ {
plugin.dc.syncRoles(staffMember, plugin.pl.getData(player).getDiscordID()); plugin.dc.syncRoles(staffMember, plugin.pl.getData(player).getDiscordID());
} }
plugin.amp.updateAccountStatus(staffMember); plugin.ptero.updateAccountStatus(staffMember);
} }
if (player != null) if (player != null)
@ -299,7 +299,7 @@ public class Command_slconfig extends FreedomCommand
Discord.syncRoles(staffMember, plugin.pl.getData(staffMember.getName()).getDiscordID()); Discord.syncRoles(staffMember, plugin.pl.getData(staffMember.getName()).getDiscordID());
} }
plugin.amp.updateAccountStatus(staffMember); plugin.ptero.updateAccountStatus(staffMember);
return true; return true;
} }

View File

@ -49,7 +49,7 @@ public class Command_verify extends FreedomCommand
{ {
String code = plugin.dc.generateCode(10); String code = plugin.dc.generateCode(10);
plugin.dc.addVerificationCode(code, playerData); plugin.dc.addVerificationCode(code, playerData);
plugin.dc.bot.getUserById(discordId).openPrivateChannel().complete().sendMessage("A user with the IP `" + FUtil.getIp(playerSender) + "` has sent a verification request. Please run the following in-game command: `/verify " + code + "`").complete(); plugin.dc.getUser(discordId).openPrivateChannel().complete().sendMessage("A user with the IP `" + FUtil.getIp(playerSender) + "` has sent a verification request. Please run the following in-game command: `/verify " + code + "`").complete();
msg("A verification code has been sent to your account, please copy the code and run /verify <code>", ChatColor.GREEN); msg("A verification code has been sent to your account, please copy the code and run /verify <code>", ChatColor.GREEN);
return true; return true;
} }

View File

@ -324,12 +324,12 @@ public abstract class FreedomCommand implements CommandExecutor, TabCompleter
return player; return player;
} }
protected StaffMember getAdmin(CommandSender sender) protected StaffMember getStaffMember(CommandSender sender)
{ {
return plugin.sl.getAdmin(sender); return plugin.sl.getAdmin(sender);
} }
protected StaffMember getAdmin(Player player) protected StaffMember getStaffMember(Player player)
{ {
return plugin.sl.getAdmin(player); return plugin.sl.getAdmin(player);
} }

View File

@ -57,7 +57,6 @@ public enum ConfigEntry
SERVER_LOGIN_SUBTITLE(String.class, "server.login_title.subtitle"), SERVER_LOGIN_SUBTITLE(String.class, "server.login_title.subtitle"),
SERVER_OWNERS(List.class, "server.owners"), SERVER_OWNERS(List.class, "server.owners"),
SERVER_EXECUTIVES(List.class, "server.executives"), SERVER_EXECUTIVES(List.class, "server.executives"),
SERVER_ASSISTANT_EXECUTIVES(List.class, "server.assistant_executives"),
SERVER_MASTER_BUILDER_MANAGEMENT(List.class, "server.master_builder_management"), SERVER_MASTER_BUILDER_MANAGEMENT(List.class, "server.master_builder_management"),
SERVER_BAN_URL(String.class, "server.ban_url"), SERVER_BAN_URL(String.class, "server.ban_url"),
SERVER_INDEFBAN_URL(String.class, "server.indefban_url"), SERVER_INDEFBAN_URL(String.class, "server.indefban_url"),
@ -80,7 +79,6 @@ public enum ConfigEntry
DISCORD_MOD_ROLE_ID(String.class, "discord.mod_role_id"), DISCORD_MOD_ROLE_ID(String.class, "discord.mod_role_id"),
DISCORD_ADMIN_ROLE_ID(String.class, "discord.admin_role_id"), DISCORD_ADMIN_ROLE_ID(String.class, "discord.admin_role_id"),
DISCORD_DEVELOPER_ROLE_ID(String.class, "discord.developer_role_id"), DISCORD_DEVELOPER_ROLE_ID(String.class, "discord.developer_role_id"),
DISCORD_ASSISTANT_EXECUTIVE_ROLE_ID(String.class, "discord.assistant_executive_role_id"),
DISCORD_EXECUTIVE_ROLE_ID(String.class, "discord.executive_role_id"), DISCORD_EXECUTIVE_ROLE_ID(String.class, "discord.executive_role_id"),
DISCORD_SERVER_OWNER_ROLE_ID(String.class, "discord.server_owner_role_id"), DISCORD_SERVER_OWNER_ROLE_ID(String.class, "discord.server_owner_role_id"),
// //
@ -95,13 +93,14 @@ public enum ConfigEntry
REDDIT_MOD_FLAIR_ID(String.class, "reddit.mod_flair_id"), REDDIT_MOD_FLAIR_ID(String.class, "reddit.mod_flair_id"),
REDDIT_ADMIN_FLAIR_ID(String.class, "reddit.admin_flair_id"), REDDIT_ADMIN_FLAIR_ID(String.class, "reddit.admin_flair_id"),
REDDIT_DEVELOPER_FLAIR_ID(String.class, "reddit.developer_flair_id"), REDDIT_DEVELOPER_FLAIR_ID(String.class, "reddit.developer_flair_id"),
REDDIT_ASSISTANT_EXECUTIVE_FLAIR_ID(String.class, "reddit.assistant_executive_flair_id"),
REDDIT_EXECUTIVE_FLAIR_ID(String.class, "reddit.executive_flair_id"), REDDIT_EXECUTIVE_FLAIR_ID(String.class, "reddit.executive_flair_id"),
REDDIT_SERVER_OWNER_FLAIR_ID(String.class, "reddit.server_owner_flair_id"), REDDIT_SERVER_OWNER_FLAIR_ID(String.class, "reddit.server_owner_flair_id"),
// //
AMP_URL(String.class, "amp.url"), PTERO_URL(String.class, "ptero.url"),
AMP_USERNAME(String.class, "amp.username"), PTERO_DEFAULT_EMAIL_DOMAIN(String.class, "ptero.default_email_domain"),
AMP_PASSWORD(String.class, "amp.password"), PTERO_SERVER_UUID(String.class, "ptero.server_uuid"),
PTERO_ADMIN_KEY(String.class, "ptero.admin_key"),
PTERO_SERVER_KEY(String.class, "ptero.server_key"),
// //
DONATION_PROBOARDS_URL(String.class, "donation.proboards_url"), DONATION_PROBOARDS_URL(String.class, "donation.proboards_url"),
DONATION_GROUP_ID(String.class, "donation.donator_group_id"), DONATION_GROUP_ID(String.class, "donation.donator_group_id"),

View File

@ -34,6 +34,9 @@ import net.dv8tion.jda.api.entities.TextChannel;
import net.dv8tion.jda.api.entities.User; import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.events.ReadyEvent; import net.dv8tion.jda.api.events.ReadyEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter; import net.dv8tion.jda.api.hooks.ListenerAdapter;
import net.dv8tion.jda.api.requests.GatewayIntent;
import net.dv8tion.jda.api.utils.ChunkingFilter;
import net.dv8tion.jda.api.utils.MemberCachePolicy;
import net.dv8tion.jda.internal.utils.concurrent.CountingThreadFactory; import net.dv8tion.jda.internal.utils.concurrent.CountingThreadFactory;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
@ -90,6 +93,9 @@ public class Discord extends FreedomService
}) })
.setAutoReconnect(true) .setAutoReconnect(true)
.setRateLimitPool(RATELIMIT_EXECUTOR) .setRateLimitPool(RATELIMIT_EXECUTOR)
.setChunkingFilter(ChunkingFilter.ALL)
.setMemberCachePolicy(MemberCachePolicy.ALL)
.enableIntents(GatewayIntent.GUILD_MEMBERS)
.build(); .build();
FLog.info("Discord verification bot has successfully enabled!"); FLog.info("Discord verification bot has successfully enabled!");
} }
@ -143,19 +149,39 @@ public class Discord extends FreedomService
} }
} }
public void sendAMPInfo(PlayerData playerData, String username, String password) public void sendPteroInfo(PlayerData playerData, String username, String password)
{ {
User user = bot.getUserById(playerData.getDiscordID()); User user = getUser(playerData.getDiscordID());
String message = "The following is your AMP details:\n\nUsername: " + username + "\nPassword: " + password + "\n\nYou can connect to AMP at " + plugin.amp.URL; String message = "The following are your Pterodactyl details:\n\nUsername: " + username + "\nPassword: " + password + "\n\nYou can connect to the panel at " + plugin.ptero.URL;
PrivateChannel privateChannel = user.openPrivateChannel().complete(); PrivateChannel privateChannel = user.openPrivateChannel().complete();
privateChannel.sendMessage(message).complete(); privateChannel.sendMessage(message).complete();
} }
public User getUser(String id)
{
Guild guild = bot.getGuildById(ConfigEntry.DISCORD_SERVER_ID.getString());
if (guild == null)
{
FLog.severe("Either the bot is not in the discord server or it doesn't exist. Check the server ID.");
return null;
}
Member member = guild.getMemberById(id);
if (member == null)
{
return null;
}
return member.getUser();
}
public boolean sendBackupCodes(PlayerData playerData) public boolean sendBackupCodes(PlayerData playerData)
{ {
List<String> codes = generateBackupCodes(); List<String> codes = generateBackupCodes();
List<String> encryptedCodes = generateEncryptedBackupCodes(codes); List<String> encryptedCodes = generateEncryptedBackupCodes(codes);
User user = bot.getUserById(playerData.getDiscordID()); User user = getUser(playerData.getDiscordID());
File file = generateBackupCodesFile(playerData.getName(), codes); File file = generateBackupCodesFile(playerData.getName(), codes);
if (file == null) if (file == null)
{ {

View File

@ -60,11 +60,6 @@ public class DiscordToMinecraftListener extends ListenerAdapter
{ {
return Title.EXECUTIVE.getColoredTag(); return Title.EXECUTIVE.getColoredTag();
} }
// Assistant Executives
else if (member.getRoles().contains(server.getRoleById(ConfigEntry.DISCORD_ASSISTANT_EXECUTIVE_ROLE_ID.getString())))
{
return Title.ASSISTANT_EXECUTIVE.getColoredTag();
}
// Admins // Admins
else if (member.getRoles().contains(server.getRoleById(ConfigEntry.DISCORD_ADMIN_ROLE_ID.getString()))) else if (member.getRoles().contains(server.getRoleById(ConfigEntry.DISCORD_ADMIN_ROLE_ID.getString())))
{ {

View File

@ -33,7 +33,6 @@ public class Module_list extends HTTPDModule
final JSONArray mods = new JSONArray(); final JSONArray mods = new JSONArray();
final JSONArray admins = new JSONArray(); final JSONArray admins = new JSONArray();
final JSONArray developers = new JSONArray(); final JSONArray developers = new JSONArray();
final JSONArray assistant_executives = new JSONArray();
final JSONArray executives = new JSONArray(); final JSONArray executives = new JSONArray();
final JSONArray owners = new JSONArray(); final JSONArray owners = new JSONArray();
@ -60,11 +59,6 @@ public class Module_list extends HTTPDModule
developers.add(player.getName()); developers.add(player.getName());
} }
if (ConfigEntry.SERVER_ASSISTANT_EXECUTIVES.getList().contains(player.getName()) && !FUtil.DEVELOPERS.contains(player.getName()))
{
assistant_executives.add(player.getName());
}
if (ConfigEntry.SERVER_EXECUTIVES.getList().contains(player.getName()) && !FUtil.DEVELOPERS.contains(player.getName())) if (ConfigEntry.SERVER_EXECUTIVES.getList().contains(player.getName()) && !FUtil.DEVELOPERS.contains(player.getName()))
{ {
executives.add(player.getName()); executives.add(player.getName());
@ -105,7 +99,6 @@ public class Module_list extends HTTPDModule
responseObject.put("mods", mods); responseObject.put("mods", mods);
responseObject.put("admins", admins); responseObject.put("admins", admins);
responseObject.put("developers", developers); responseObject.put("developers", developers);
responseObject.put("assistant_executives", assistant_executives);
responseObject.put("executives", executives); responseObject.put("executives", executives);
responseObject.put("owners", owners); responseObject.put("owners", owners);
responseObject.put("online", server.getOnlinePlayers().size()); responseObject.put("online", server.getOnlinePlayers().size());
@ -154,7 +147,7 @@ public class Module_list extends HTTPDModule
public boolean hasSpecialTitle(Player player) public boolean hasSpecialTitle(Player player)
{ {
if (FUtil.DEVELOPERS.contains(player.getName()) || ConfigEntry.SERVER_EXECUTIVES.getList().contains(player.getName()) || ConfigEntry.SERVER_ASSISTANT_EXECUTIVES.getList().contains(player.getName()) || ConfigEntry.SERVER_OWNERS.getList().contains(player.getName())) if (FUtil.DEVELOPERS.contains(player.getName()) || ConfigEntry.SERVER_EXECUTIVES.getList().contains(player.getName()) || ConfigEntry.SERVER_OWNERS.getList().contains(player.getName()))
{ {
return true; return true;
} }

View File

@ -63,11 +63,6 @@ public class RankManager extends FreedomService
return Title.EXECUTIVE; return Title.EXECUTIVE;
} }
if (ConfigEntry.SERVER_ASSISTANT_EXECUTIVES.getList().contains(player.getName()) && plugin.sl.isStaff(player))
{
return Title.ASSISTANT_EXECUTIVE;
}
if (plugin.sl.isVerifiedStaff(player)) if (plugin.sl.isVerifiedStaff(player))
{ {
return Title.VERIFIED_STAFF; return Title.VERIFIED_STAFF;
@ -79,12 +74,6 @@ public class RankManager extends FreedomService
return Title.MASTER_BUILDER; return Title.MASTER_BUILDER;
} }
PlayerData playerData = plugin.pl.getData(player);
if (!plugin.sl.isStaff(player) && playerData.isDonator())
{
return Title.DONATOR;
}
return getRank(player); return getRank(player);
} }

View File

@ -6,10 +6,8 @@ import net.md_5.bungee.api.ChatColor;
public enum Title implements Displayable public enum Title implements Displayable
{ {
DONATOR("a", "Premium Member", ChatColor.of("#ff5600"), org.bukkit.ChatColor.LIGHT_PURPLE, "Premium", true),
MASTER_BUILDER("a", "Master Builder", ChatColor.DARK_AQUA, org.bukkit.ChatColor.DARK_AQUA, "MB", true), MASTER_BUILDER("a", "Master Builder", ChatColor.DARK_AQUA, org.bukkit.ChatColor.DARK_AQUA, "MB", true),
VERIFIED_STAFF("a", "Verified Staff", ChatColor.LIGHT_PURPLE, org.bukkit.ChatColor.LIGHT_PURPLE, "VS", false), VERIFIED_STAFF("a", "Verified Staff", ChatColor.LIGHT_PURPLE, org.bukkit.ChatColor.LIGHT_PURPLE, "VS", false),
ASSISTANT_EXECUTIVE("an", "Assistant Executive", ChatColor.RED, org.bukkit.ChatColor.RED, "Asst Exec", true),
EXECUTIVE("an", "Executive", ChatColor.RED, org.bukkit.ChatColor.RED, "Exec", true), EXECUTIVE("an", "Executive", ChatColor.RED, org.bukkit.ChatColor.RED, "Exec", true),
DEVELOPER("a", "Developer", ChatColor.DARK_PURPLE, org.bukkit.ChatColor.DARK_PURPLE, "Dev", true), DEVELOPER("a", "Developer", ChatColor.DARK_PURPLE, org.bukkit.ChatColor.DARK_PURPLE, "Dev", true),
OWNER("the", "Owner", ChatColor.of("#ff0000"), org.bukkit.ChatColor.DARK_RED, "Owner", true); OWNER("the", "Owner", ChatColor.of("#ff0000"), org.bukkit.ChatColor.DARK_RED, "Owner", true);

View File

@ -82,7 +82,7 @@ public class SQLite extends FreedomService
{ {
try try
{ {
connection.createStatement().execute("CREATE TABLE `staff` (`username` VARCHAR NOT NULL, `ips` VARCHAR NOT NULL, `rank` VARCHAR NOT NULL, `active` BOOLEAN NOT NULL, `last_login` LONG NOT NULL, `login_message` VARCHAR, `command_spy` BOOLEAN NOT NULL, `potion_spy` BOOLEAN NOT NULL, `ac_format` VARCHAR, `amp_username` VARCHAR);"); connection.createStatement().execute("CREATE TABLE `staff` (`username` VARCHAR NOT NULL, `ips` VARCHAR NOT NULL, `rank` VARCHAR NOT NULL, `active` BOOLEAN NOT NULL, `last_login` LONG NOT NULL, `login_message` VARCHAR, `command_spy` BOOLEAN NOT NULL, `potion_spy` BOOLEAN NOT NULL, `ac_format` VARCHAR, `ptero_id` VARCHAR);");
} }
catch (SQLException e) catch (SQLException e)
{ {
@ -256,7 +256,7 @@ public class SQLite extends FreedomService
statement.setBoolean(7, staffMember.getCommandSpy()); statement.setBoolean(7, staffMember.getCommandSpy());
statement.setBoolean(8, staffMember.getPotionSpy()); statement.setBoolean(8, staffMember.getPotionSpy());
statement.setString(9, staffMember.getAcFormat()); statement.setString(9, staffMember.getAcFormat());
statement.setString(10, staffMember.getAmpUsername()); statement.setString(10, staffMember.getPteroID());
statement.executeUpdate(); statement.executeUpdate();
} }
catch (SQLException e) catch (SQLException e)

View File

@ -47,7 +47,7 @@ public class StaffMember
private String acFormat = null; private String acFormat = null;
@Getter @Getter
@Setter @Setter
private String ampUsername = null; private String pteroID = null;
public StaffMember(Player player) public StaffMember(Player player)
{ {
@ -69,7 +69,7 @@ public class StaffMember
this.commandSpy = resultSet.getBoolean("command_spy"); this.commandSpy = resultSet.getBoolean("command_spy");
this.potionSpy = resultSet.getBoolean("potion_spy"); this.potionSpy = resultSet.getBoolean("potion_spy");
this.acFormat = resultSet.getString("ac_format"); this.acFormat = resultSet.getString("ac_format");
this.ampUsername = resultSet.getString("amp_username"); this.pteroID = resultSet.getString("ptero_id");
} }
catch (SQLException e) catch (SQLException e)
{ {
@ -90,7 +90,7 @@ public class StaffMember
.append("- Is Active: ").append(active).append("\n") .append("- Is Active: ").append(active).append("\n")
.append("- Potion Spy: ").append(potionSpy).append("\n") .append("- Potion Spy: ").append(potionSpy).append("\n")
.append("- Admin Chat Format: ").append(acFormat).append("\n") .append("- Admin Chat Format: ").append(acFormat).append("\n")
.append("- AMP Username: ").append(ampUsername).append("\n"); .append("- Pterodactyl ID: ").append(pteroID).append("\n");
return output.toString(); return output.toString();
} }
@ -108,7 +108,7 @@ public class StaffMember
put("command_spy", commandSpy); put("command_spy", commandSpy);
put("potion_spy", potionSpy); put("potion_spy", potionSpy);
put("ac_format", acFormat); put("ac_format", acFormat);
put("amp_username", ampUsername); put("ptero_id", pteroID);
}}; }};
return map; return map;
} }

View File

@ -132,7 +132,7 @@ public class FUtil
public static boolean isExecutive(String name) public static boolean isExecutive(String name)
{ {
return ConfigEntry.SERVER_OWNERS.getStringList().contains(name) || ConfigEntry.SERVER_EXECUTIVES.getStringList().contains(name) || ConfigEntry.SERVER_ASSISTANT_EXECUTIVES.getStringList().contains(name); return ConfigEntry.SERVER_OWNERS.getStringList().contains(name) || ConfigEntry.SERVER_EXECUTIVES.getStringList().contains(name);
} }
public static boolean isDeveloper(Player player) public static boolean isDeveloper(Player player)
@ -237,10 +237,10 @@ public class FUtil
List<String> headers = new ArrayList<>(); List<String> headers = new ArrayList<>();
headers.add("Accept:application/json"); headers.add("Accept:application/json");
headers.add("Content-Type:application/json"); headers.add("Content-Type:application/json");
String response = sendRequest("https://api.mojang.com/profiles/minecraft", "POST", headers, json.toString()); Response response = sendRequest("https://api.mojang.com/profiles/minecraft", "POST", headers, json.toString());
// Don't care how stupid this looks, couldn't find anything to parse a json string to something readable in java with something not horrendously huge, maybe im just retarded // Don't care how stupid this looks, couldn't find anything to parse a json string to something readable in java with something not horrendously huge, maybe im just retarded
Pattern pattern = Pattern.compile("(?<=\"id\":\")[a-f0-9].{31}"); Pattern pattern = Pattern.compile("(?<=\"id\":\")[a-f0-9].{31}");
Matcher matcher = pattern.matcher(response); Matcher matcher = pattern.matcher(response.getMessage());
if (matcher.find()) if (matcher.find())
{ {
String rawUUID = matcher.group(0).replaceFirst("([a-f0-9]{8})([a-f0-9]{4})([a-f0-9]{4})([a-f0-9]{4})([a-f0-9]+)", "$1-$2-$3-$4-$5"); String rawUUID = matcher.group(0).replaceFirst("([a-f0-9]{8})([a-f0-9]{4})([a-f0-9]{4})([a-f0-9]{4})([a-f0-9]+)", "$1-$2-$3-$4-$5");
@ -254,21 +254,34 @@ public class FUtil
return null; return null;
} }
public static String sendRequest(String endpoint, String method, List<String>headers, String body) throws IOException public static Response sendRequest(String endpoint, String method, List<String>headers, String body) throws IOException
{ {
URL url = new URL(endpoint); URL url = new URL(endpoint);
HttpURLConnection connection = (HttpURLConnection)url.openConnection(); HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod(method); connection.setRequestMethod(method);
if (headers != null)
{
for (String header : headers) for (String header : headers)
{ {
String[] kv = header.split(":"); String[] kv = header.split(":");
connection.setRequestProperty(kv[0], kv[1]); connection.setRequestProperty(kv[0], kv[1]);
} }
}
FLog.info(connection.getRequestMethod());
if (body != null)
{
connection.setDoOutput(true); connection.setDoOutput(true);
DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream()); DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream());
outputStream.writeBytes(body); outputStream.writeBytes(body);
outputStream.flush(); outputStream.flush();
outputStream.close(); outputStream.close();
}
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine; String inputLine;
StringBuffer response = new StringBuffer(); StringBuffer response = new StringBuffer();
@ -279,7 +292,8 @@ public class FUtil
} }
in.close(); in.close();
return response.toString();
return new Response(connection.getResponseCode(), response.toString());
} }
public static void bcastMsg(String message, ChatColor color) public static void bcastMsg(String message, ChatColor color)
@ -854,10 +868,4 @@ public class FUtil
} }
}.runTaskLater(TotalFreedomMod.getPlugin(), delay); }.runTaskLater(TotalFreedomMod.getPlugin(), delay);
} }
private static class MojangResponse
{
String id;
String name;
}
} }

View File

@ -0,0 +1,25 @@
package me.totalfreedom.totalfreedommod.util;
import lombok.Getter;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
public class Response
{
@Getter
private int code;
@Getter
private String message;
public Response(int code, String message)
{
this.code = code;
this.message = message;
}
public JSONObject getJSONMessage() throws ParseException
{
return (JSONObject) new JSONParser().parse(message);
}
}

View File

@ -36,9 +36,6 @@ server:
# All players who show up as executive # All players who show up as executive
executives: [] executives: []
# All players who show up as assistant executive
assistant_executives: []
# All those who can manage the master builder list # All those who can manage the master builder list
master_builder_management: [] master_builder_management: []
@ -76,8 +73,6 @@ discord:
admin_role_id: '' admin_role_id: ''
# Developer role ID # Developer role ID
developer_role_id: '' developer_role_id: ''
# Assistant Executive Admin role ID
assistant_executive_role_id: ''
# Executive Admin role ID # Executive Admin role ID
executive_role_id: '' executive_role_id: ''
# Owner role ID # Owner role ID
@ -95,8 +90,6 @@ reddit:
client_id: '' client_id: ''
# Developer app secret # Developer app secret
client_secret: '' client_secret: ''
# Donator flair ID
donator_flair_id: ''
# Master Builder flair ID # Master Builder flair ID
master_builder_flair_id: '' master_builder_flair_id: ''
# Trial Mod flair ID # Trial Mod flair ID
@ -107,21 +100,23 @@ reddit:
admin_flair_id: '' admin_flair_id: ''
# Developer flair ID # Developer flair ID
developer_flair_id: '' developer_flair_id: ''
# Assistant Executive Admin flair ID
assistant_executive_flair_id: ''
# Executive Admin flair ID # Executive Admin flair ID
executive_flair_id: '' executive_flair_id: ''
# Owner flair ID # Owner flair ID
server_owner_flair_id: '' server_owner_flair_id: ''
# AMP # Pterodactyl
amp: ptero:
# URL - do not leave a trailing forward slash # URL - do not leave a trailing forward slash
url: '' url: ''
# Username # The default email domain used to set email addresses for new users - do not include the @
username: '' default_email_domain: 'example.com'
# Password # Server UUID
password: '' server_uuid: ''
# Admin panel API key
admin_key: ''
# Server API key
server_key: ''
# The shop # The shop
shop: shop: