1
0
This commit is contained in:
Lee
2024-03-29 17:46:05 +00:00
parent f9268f8bd4
commit 641e40b35d
13 changed files with 485 additions and 37 deletions

View File

@ -1,14 +1,15 @@
package cc.fascinated.account;
import cc.fascinated.Aetheria;
import cc.fascinated.config.Config;
import cc.fascinated.config.Lang;
import cc.fascinated.playercolor.PlayerColor;
import cc.fascinated.utils.DiscordWebhook;
import cc.fascinated.utils.Style;
import lombok.Getter;
import lombok.SneakyThrows;
import lombok.extern.log4j.Log4j2;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Bukkit;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
@ -16,6 +17,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import java.io.File;
import java.io.IOException;
import java.util.UUID;
@Getter @Log4j2
public class Account {
@ -76,7 +78,25 @@ public class Account {
this.save(false); // Save default values
log.info("Created new account for " + this.uuid);
Bukkit.broadcast(Style.getMiniMessage().deserialize(Lang.FIRST_JOIN_MESSAGE.getAsString()));
Bukkit.broadcast(Style.getMiniMessage().deserialize(Lang.FIRST_JOIN_MESSAGE.getAsString()
.replace("%player%", this.getName())
));
Aetheria.EXECUTOR.execute(() -> {
// todo: re-code this it's so ugly
DiscordWebhook discordWebhook = new DiscordWebhook(Config.DISCORD_LOG_WEBHOOK.getAsString());
DiscordWebhook.EmbedObject embed = new DiscordWebhook.EmbedObject();
embed.setTitle("New Player Joined");
embed.addField("Name", Bukkit.getOfflinePlayer(uuid).getName(), true);
embed.addField("UUID", uuid.toString(), true);
discordWebhook.addEmbed(embed);
try {
discordWebhook.execute();
} catch (IOException e) {
throw new RuntimeException(e);
}
});
}
this.firstJoin = config.getLong("firstJoin");