From 12cf195e553958117ef0945aeae1709f607240b4 Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Fri, 8 Oct 2021 17:54:21 -0500 Subject: [PATCH] TotalFreedomMod 7.0.0 --- build.gradle | 4 ++-- .../xsl/{checkstyle-custom.xsl => checkstyle.xsl} | 0 .../totalfreedom/totalfreedommod/Pterodactyl.java | 12 +++++------- .../totalfreedommod/TotalFreedomMod.java | 5 +++-- .../totalfreedommod/bridge/CoreProtectBridge.java | 3 ++- .../totalfreedommod/command/Command_fionn.java | 2 +- .../totalfreedommod/command/Command_restart.java | 2 +- .../totalfreedommod/command/Command_stop.java | 1 - src/main/resources/config.yml | 13 +++++++++---- 9 files changed, 23 insertions(+), 19 deletions(-) rename config/xsl/{checkstyle-custom.xsl => checkstyle.xsl} (100%) diff --git a/build.gradle b/build.gradle index 9bcb6d23..3851fc4a 100644 --- a/build.gradle +++ b/build.gradle @@ -106,7 +106,7 @@ dependencies { implementation('org.junit.jupiter:junit-jupiter:5.8.1') implementation('org.projectlombok:lombok:1.18.20') compileOnly('org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT') - compileOnly('me.totalfreedom:bukkittelnet:4.6') + compileOnly('me.totalfreedom:BukkitTelnet:4.6.1') compileOnly('me.totalfreedom:TF-LibsDisguises:10.0.26-SNAPSHOT') compileOnly('com.sk89q.worldedit:worldedit-bukkit:7.3.0-SNAPSHOT') compileOnly('net.essentialsx:EssentialsX:2.19.0') @@ -161,7 +161,7 @@ tasks.withType(Checkstyle) { reports { xml.required = false html.required = true - html.stylesheet resources.text.fromFile('config/xsl/checkstyle-custom.xsl') + html.stylesheet resources.text.fromFile('config/xsl/checkstyle.xsl') } } diff --git a/config/xsl/checkstyle-custom.xsl b/config/xsl/checkstyle.xsl similarity index 100% rename from config/xsl/checkstyle-custom.xsl rename to config/xsl/checkstyle.xsl diff --git a/src/main/java/me/totalfreedom/totalfreedommod/Pterodactyl.java b/src/main/java/me/totalfreedom/totalfreedommod/Pterodactyl.java index 886077ec..08946be4 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/Pterodactyl.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/Pterodactyl.java @@ -46,12 +46,12 @@ public class Pterodactyl extends FreedomService if (!admin.isActive() || admin.getRank() != Rank.SENIOR_ADMIN) { - FLog.debug("Disabling ptero acc"); + FLog.debug("Disabling Pterodactyl account"); removeAccountFromServer(id); return; } - FLog.debug("Enabling ptero acc"); + FLog.debug("Enabling Pterodactyl account"); addAccountToServer(id); } @@ -101,15 +101,13 @@ public class Pterodactyl extends FreedomService public void restartServer() { - ClientServer server = clientAPI.retrieveServerByIdentifier(IDENTIFIER).execute(); - server.setPower(PowerAction.RESTART).execute(); + clientAPI.retrieveServerByIdentifier(IDENTIFIER).flatMap(ClientServer::restart).execute(); } public void fionnTheServer() { - ClientServer server = clientAPI.retrieveServerByIdentifier(IDENTIFIER).execute(); - server.setPower(PowerAction.STOP).execute(); - plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, () -> server.setPower(PowerAction.KILL).execute(), 0, 60); + clientAPI.retrieveServerByIdentifier(IDENTIFIER).flatMap(ClientServer::stop).execute(); + plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, () -> clientAPI.retrieveServerByIdentifier(IDENTIFIER).flatMap(ClientServer::kill).execute(), 0, 60); } public String getURL() diff --git a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java index c40908ea..61fe492b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java @@ -54,6 +54,7 @@ import org.bukkit.generator.ChunkGenerator; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; import org.jetbrains.annotations.NotNull; +import org.spigotmc.SpigotCommand; import org.spigotmc.SpigotConfig; public class TotalFreedomMod extends JavaPlugin @@ -217,8 +218,8 @@ public class TotalFreedomMod extends JavaPlugin // Metrics @ https://bstats.org/plugin/bukkit/TotalFreedomMod/2966 new Metrics(this, 2966); - // little workaround to stop spigot from autorestarting - causing AMP to detach from process. - SpigotConfig.config.set("settings.restart-on-crash", false); + // Revert AMP changes + SpigotConfig.config.set("settings.restart-on-crash", true); } @Override diff --git a/src/main/java/me/totalfreedom/totalfreedommod/bridge/CoreProtectBridge.java b/src/main/java/me/totalfreedom/totalfreedommod/bridge/CoreProtectBridge.java index 53c82a89..74210100 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/bridge/CoreProtectBridge.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/bridge/CoreProtectBridge.java @@ -287,7 +287,6 @@ public class CoreProtectBridge extends FreedomService if (block != null) { event.setCancelled(true); - List lookup = coreProtect.blockLookup(block, -1); int cooldownTime = 3; @@ -302,6 +301,8 @@ public class CoreProtectBridge extends FreedomService } } + List lookup = coreProtect.blockLookup(block, -1); + if (!plugin.al.isAdmin(player)) { cooldown.put(player.getName(), System.currentTimeMillis()); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_fionn.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_fionn.java index 0cb1674a..d7deceb1 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_fionn.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_fionn.java @@ -8,7 +8,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH) -@CommandParameters(description = "Restart the server", usage = "/") +@CommandParameters(description = "Fionn the server", usage = "/") public class Command_fionn extends FreedomCommand { @Override diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_restart.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_restart.java index 105acf8d..e75d3299 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_restart.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_restart.java @@ -12,7 +12,7 @@ import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; @CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH) -@CommandParameters(description = "Restart the server", usage = "/ [reason]") +@CommandParameters(description = "Restart the server", usage = "/ [reason]", aliases="tfmrestart") public class Command_restart extends FreedomCommand { private static final Map RESTART_CONFIRM = new HashMap<>(); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stop.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stop.java index e4ea5880..8aed5454 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stop.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stop.java @@ -38,7 +38,6 @@ public class Command_stop extends FreedomCommand return true; } - msg("Warning: You're about to stop the server. Type /stop again to confirm you want to do this."); STOP_CONFIRM.put(sender, reason); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 82105ed1..a3a9b607 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -85,18 +85,23 @@ discord: # Owner role ID server_owner_role_id: '' -# Pterodactyl +# Pterodactyl (requires Discord verification to be enabled) ptero: # URL - do not leave a trailing forward slash url: '' # The default email domain used to set email addresses for new users - do not include the @ default_email_domain: 'example.com' - # Server UUID + # Long Server UUID (for example: abf9a712-6c5a-4504-b4bc-37f1061b8801) + # Do NOT give the short Server UUID server_uuid: '' # Admin panel API key + # Create this key by going to Settings > Application API > Create New + # Make sure you give it Users and Servers permissions admin_key: '' - # Server API key - server_key: '' + # Client API key + # Create a new user and add them as a subuser to the server with all control and subuser privileges. + # Then, login to the new user account and go to User Settings. Click on API Credentials and create a new one. + client_key: '' # The shop shop: