Slightly changes wording of 'missing-license' message

+ small refactoring – Putting the *expesive* method calls outside the string into variables
to easier see them, when trying to understand the code and the need
for its own thread for just printing some messages to  the console.
This commit is contained in:
Christian Koop 2023-03-04 12:38:33 +01:00
parent ca13e8b26e
commit d9586cfe86
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3

View File

@ -93,16 +93,22 @@ public abstract class SongodaPlugin extends JavaPlugin {
// Check plugin access, don't load plugin if user don't have access // Check plugin access, don't load plugin if user don't have access
if (!SongodaAuth.isAuthorized(true)) { if (!SongodaAuth.isAuthorized(true)) {
String pluginName = getDescription().getName();
new Thread(() -> { new Thread(() -> {
String message = ChatColor.RED + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" + String externalIP = SongodaAuth.getIP();
ChatColor.RED + "You do not have access to this plugin.\n" + String serverUuid = SongodaAuth.getUUID().toString();
String message = "\n" +
ChatColor.RED + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" +
ChatColor.RED + "You do not have access to the " + pluginName + " plugin.\n" +
ChatColor.YELLOW + "Please purchase a license at https://sngda.to/marketplace\n" + ChatColor.YELLOW + "Please purchase a license at https://sngda.to/marketplace\n" +
ChatColor.YELLOW + "or set up your license at https://sngda.to/licenses\n" + ChatColor.YELLOW + "or set up your license at https://sngda.to/licenses\n" +
ChatColor.YELLOW + "License setup steps:\n" + ChatColor.YELLOW + "License setup steps:\n" +
ChatColor.YELLOW + "Visit the link mentioned above and click the 'Create License button'\n" + ChatColor.YELLOW + "Visit the link mentioned above and click the 'Create License' button.\n" +
ChatColor.YELLOW + "Copy the following ip and uuid and click create.\n" + ChatColor.YELLOW + "Copy the following IP address and UUID and click create.\n" +
ChatColor.YELLOW + "IP: " + SongodaAuth.getIP() + "\n" + ChatColor.YELLOW + "IP: " + externalIP + "\n" +
ChatColor.YELLOW + "UUID: " + SongodaAuth.getUUID() + "\n" + ChatColor.YELLOW + "UUID: " + serverUuid + "\n" +
ChatColor.RED + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; ChatColor.RED + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
this.console.sendMessage(message); this.console.sendMessage(message);
}).start(); }).start();