use of me.anton.sickcore.api.player.bungeePlayer.BungeePlayer in project SickCore by SickMC.
the class MCDiscordCommand method onCMD.
@Subcommand("update")
@Description("Updates your rank on discord")
public void onCMD(CommandSender sender) {
if (!(sender instanceof ProxiedPlayer)) {
ConsoleMessages.noPlayerBungee(sender);
return;
}
BungeePlayer player = new BungeePlayer(sender);
if (!player.api().isVerified()) {
player.getPlayer().sendMessage(new TextComponent((String) player.api().languageObject("§4You are not verifed!", "§4Du bist nicht verifiziert!")));
return;
}
new RankUpdate(player);
player.getPlayer().sendMessage(new TextComponent((String) player.api().languageObject("§7Your rank successfully updated!", "§7Dein Rang wurde erfolgreich neu geladen!")));
}
use of me.anton.sickcore.api.player.bungeePlayer.BungeePlayer in project SickCore by SickMC.
the class MCDiscordCommand method onCmd.
@Subcommand("verify")
@Description("Verify with discord account")
public void onCmd(CommandSender sender) {
if (!(sender instanceof ProxiedPlayer)) {
ConsoleMessages.noPlayerBungee(sender);
return;
}
BungeePlayer player = new BungeePlayer(sender);
if (player.api().isVerified()) {
player.getPlayer().sendMessage(new TextComponent((String) player.api().languageObject("§7You are already verified with §6" + DiscordModule.getInstance().getJda().getUserById(player.api().getDiscordID()).getAsTag() + "§7!", "§7Du bist bereits mit §6" + DiscordModule.getInstance().getJda().getUserById(player.api().getDiscordID()).getAsTag() + "§7 verbunden!")));
return;
}
int verifyCode = MathUtils.getRandomNumberInRange(100000, 999999);
if (VerifyModule.getVerifyModule().getVerifyList().containsValue(verifyCode))
verifyCode = MathUtils.getRandomNumberInRange(100000, 999999);
VerifyModule.getVerifyModule().getVerifyList().put(player, verifyCode);
VerifyModule.getVerifyModule().getVerifyListReturn().put(verifyCode, player);
BaseComponent en = new TextComponent("§7Your verify code is §6" + verifyCode + "§7!");
en.setClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, String.valueOf(verifyCode)));
en.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§7Click to copy the code!").create()));
BaseComponent de = new TextComponent("§7Dein Verifikationscode ist §6" + verifyCode + "§7!");
en.setClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, String.valueOf(verifyCode)));
en.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§7Klicke um den Code zu kopieren!").create()));
player.getPlayer().sendMessage((BaseComponent) player.api().languageObject(en, de));
MessageEmbed embed = new EmbedBuilder().setTimestamp(Instant.now()).setTitle("**Verify | SickMC**").setDescription(player.api().getName() + " started verification! \nHis code is " + verifyCode + "!").setFooter("SickMC • Requested by " + player.api().getName()).setColor(Color.ORANGE).build();
DiscordLogModule.getInstance().log(embed);
}
use of me.anton.sickcore.api.player.bungeePlayer.BungeePlayer in project SickCore by SickMC.
the class VerifyCommand method execute.
@Override
public void execute(User user, DiscordPlayer player, InteractionHook hook, SlashCommandEvent event) {
DiscordModule module = DiscordModule.getInstance();
VerifyModule verifyModule = VerifyModule.getVerifyModule();
int verifyID = (int) event.getOption("code").getAsLong();
if (DiscordAPIPlayerAdapter.isVerified(user)) {
hook.sendMessageEmbeds(getAlreadyVerified(user)).setEphemeral(false).queue();
return;
}
if (!verifyModule.getVerifyList().containsValue(verifyID)) {
hook.sendMessageEmbeds(getWrongCodeEmbed(user)).setEphemeral(true).queue();
return;
}
BungeePlayer bungeeplayer = verifyModule.getVerifyListReturn().get(verifyID);
verify(bungeeplayer, user.getId());
verifyModule.getVerifyListReturn().remove(verifyID, bungeeplayer);
verifyModule.getVerifyList().remove(bungeeplayer, verifyID);
sendLog(user, bungeeplayer);
bungeeplayer.getPlayer().sendMessage(new TextComponent((String) bungeeplayer.api().languageObject("§7Your account is now linked with §6" + event.getMember().getUser().getAsTag() + "§7!", "§7Dein Account ist nun mit §6" + event.getMember().getUser().getAsTag() + "§7 verbunden!")));
hook.sendMessageEmbeds(getVerified(user)).queue();
}
use of me.anton.sickcore.api.player.bungeePlayer.BungeePlayer in project SickCore by SickMC.
the class LobbyCommand method onCOm.
@Default
@Description("Sends you to lobby")
public void onCOm(CommandSender sender) {
if (!(sender instanceof ProxiedPlayer)) {
ConsoleMessages.noPlayerBungee(sender);
return;
}
BungeePlayer player = new BungeePlayer(sender);
if (player.api().cloud().cloudAPI().getConnectedServer().isLobby()) {
player.sendMessage(LanguagePath.PROXY_STAFF_COMMAND_LOBBY_ALREADY);
return;
}
player.api().cloud().cloudAPI().sendToLobby();
player.sendMessage(LanguagePath.PROXY_STAFF_COMMAND_LOBBY_SUCCESS);
}
use of me.anton.sickcore.api.player.bungeePlayer.BungeePlayer in project SickCore by SickMC.
the class PlaytimeCommand method onCMDD.
@Default
@Syntax("<Player>")
@Description("Shows the playtime of the player")
public void onCMDD(CommandSender sender, @Optional String targetRaw) {
if (!(sender instanceof ProxiedPlayer)) {
ConsoleMessages.noPlayerBungee(sender);
return;
}
BungeePlayer player = new BungeePlayer(sender);
if (targetRaw != null) {
IOfflineCloudPlayer cloudPlayer = CloudAPI.getInstance().getCloudPlayerManager().getOfflineCloudPlayer(targetRaw).getBlockingOrNull();
if (cloudPlayer == null) {
player.getPlayer().sendMessage(new TextComponent("§4This player cannot be found!"));
return;
}
player.sendMessage(player.api().languageString(LanguagePath.PROXY_COMMAND_PLAYTIME_TIME).replace(new Replacable("%playtime%", TimeUtils.formatMillis(cloudPlayer.getOnlineTime()))));
return;
}
player.sendMessage(player.api().languageString(LanguagePath.PROXY_COMMAND_PLAYTIME_TIME).replace(new Replacable("%playtime%", TimeUtils.formatMillis(player.api().cloud().cloudAPI().getOnlineTime()))));
}
Aggregations