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