Prints 'missing-license' message in the console as one long message

This prevents fragmentation of the idividual lines. `#getIP()` can take a couple of seconds
and because it is executed outside of the main-thread, other message can be printed bevore
the IP address and UUID are ready to be printed.
This commit is contained in:
Christian Koop 2023-03-04 12:36:20 +01:00
parent 386ff209a7
commit ca13e8b26e
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3

View File

@ -85,27 +85,28 @@ public abstract class SongodaPlugin extends JavaPlugin {
@Override @Override
public final void onEnable() { public final void onEnable() {
if (emergencyStop) { if (this.emergencyStop) {
setEnabled(false); setEnabled(false);
return; return;
} }
//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)) {
Thread thread = new Thread(() -> { new Thread(() -> {
console.sendMessage(ChatColor.RED + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); String message = ChatColor.RED + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" +
console.sendMessage(ChatColor.RED + "You do not have access to this plugin."); ChatColor.RED + "You do not have access to this plugin.\n" +
console.sendMessage(ChatColor.YELLOW + "Please purchase a license at https://sngda.to/marketplace"); ChatColor.YELLOW + "Please purchase a license at https://sngda.to/marketplace\n" +
console.sendMessage(ChatColor.YELLOW + "or set up your license at https://sngda.to/licenses"); ChatColor.YELLOW + "or set up your license at https://sngda.to/licenses\n" +
console.sendMessage(ChatColor.YELLOW + "License setup steps:"); ChatColor.YELLOW + "License setup steps:\n" +
console.sendMessage(ChatColor.YELLOW + "Visit the link mentioned above and click the 'Create License button'"); ChatColor.YELLOW + "Visit the link mentioned above and click the 'Create License button'\n" +
console.sendMessage(ChatColor.YELLOW + "Copy the following ip and uuid and click create."); ChatColor.YELLOW + "Copy the following ip and uuid and click create.\n" +
console.sendMessage(ChatColor.YELLOW + "IP: " + SongodaAuth.getIP()); ChatColor.YELLOW + "IP: " + SongodaAuth.getIP() + "\n" +
console.sendMessage(ChatColor.YELLOW + "UUID: " + SongodaAuth.getUUID()); ChatColor.YELLOW + "UUID: " + SongodaAuth.getUUID() + "\n" +
console.sendMessage(ChatColor.RED + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); ChatColor.RED + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
}); this.console.sendMessage(message);
thread.start(); }).start();
emergencyStop(); emergencyStop();
return; return;
} }