1st party api improvements, gets rid of some asJDA usages

This commit is contained in:
Vankka 2024-01-01 00:46:21 +02:00
parent ab90d1ddfc
commit 4877235ace
No known key found for this signature in database
GPG Key ID: 6E50CB7A29B96AD0
65 changed files with 347 additions and 138 deletions

View File

@ -27,8 +27,8 @@ import com.discordsrv.api.component.MinecraftComponentFactory;
import com.discordsrv.api.discord.DiscordAPI;
import com.discordsrv.api.discord.connection.details.DiscordConnectionDetails;
import com.discordsrv.api.event.bus.EventBus;
import com.discordsrv.api.placeholder.PlainPlaceholderFormat;
import com.discordsrv.api.placeholder.PlaceholderService;
import com.discordsrv.api.placeholder.PlainPlaceholderFormat;
import com.discordsrv.api.player.DiscordSRVPlayer;
import com.discordsrv.api.player.IPlayerProvider;
import com.discordsrv.api.profile.IProfileManager;

View File

@ -38,7 +38,7 @@ public interface DiscordMemberCachePolicy {
.map(api -> api.profileManager().getProfile(member.getUser().getId()))
.map(IProfile::isLinked).orElse(false);
DiscordMemberCachePolicy VOICE = member -> member.asJDA().getVoiceState() != null;
DiscordMemberCachePolicy OWNER = member -> member.asJDA().isOwner();
DiscordMemberCachePolicy OWNER = DiscordGuildMember::isOwner;
boolean isCached(DiscordGuildMember member);
}

View File

@ -32,4 +32,40 @@ public interface DiscordThreadChannel extends DiscordGuildMessageChannel, JDAEnt
@NotNull
DiscordThreadContainer getParentChannel();
/**
* Is this thread archived.
* @return {@code true} if the thread is archived
*/
boolean isArchived();
/**
* Is this thread locked from replies by non-moderators.
* @return {@code true} if the thread is locked
*/
boolean isLocked();
/**
* Is the self user (bot) joined in this thread.
* @return {@code true} if the self user is current a part of this thread
*/
boolean isJoined();
/**
* Is this thread invitable, meaning non-moderators can invite non-moderators to the thread.
* @return {@code true} if the thread is invitable
*/
boolean isInvitable();
/**
* Is the self user (bot) the owner of this thread.
* @return {@code true} if the self user is the owner of this thread
*/
boolean isOwnedBySelfUser();
/**
* Is this thread public, meaning anybody can read and join it if they can see its parent channel.
* @return {@code true} if this thread is public
*/
boolean isPublic();
}

View File

@ -58,6 +58,12 @@ public interface DiscordGuildMember extends JDAEntity<Member>, Mentionable {
@NotNull
DiscordGuild getGuild();
/**
* If this Discord server member is the owner of the Discord server.
* @return {@code true} if this member is the server owner
*/
boolean isOwner();
/**
* Gets the nickname of the Discord server member.
* @return the nickname server member

View File

@ -39,8 +39,10 @@ public interface DiscordInteractionHook extends JDAEntity<InteractionHook> {
CompletableFuture<DiscordInteractionHook> replyLater(boolean ephemeral);
CompletableFuture<ReceivedDiscordMessage> editOriginal(SendableDiscordMessage message);
CompletableFuture<DiscordInteractionHook> reply(SendableDiscordMessage message);
CompletableFuture<DiscordInteractionHook> replyEphemeral(SendableDiscordMessage message);
CompletableFuture<DiscordInteractionHook> reply(SendableDiscordMessage message, boolean ephemeral);
default CompletableFuture<DiscordInteractionHook> reply(SendableDiscordMessage message) {
return reply(message, false);
}
CompletableFuture<Void> replyModal(Modal modal);
}

View File

@ -229,11 +229,11 @@ public class CommandOption implements JDAEntity<OptionData> {
}
/**
* Sets if this option is auto completed. See {@link com.discordsrv.api.discord.events.interaction.command.DiscordCommandAutoCompleteInteractionEvent}.
* Sets if this option is auto completed. See {@link com.discordsrv.api.event.events.discord.interaction.command.DiscordCommandAutoCompleteInteractionEvent}.
*
* @param autoComplete is this choice auto completing
* @return this builder, useful for chaining
* @see com.discordsrv.api.discord.events.interaction.command.DiscordCommandAutoCompleteInteractionEvent
* @see com.discordsrv.api.event.events.discord.interaction.command.DiscordCommandAutoCompleteInteractionEvent
*/
@NotNull
public Builder setAutoComplete(boolean autoComplete) {

View File

@ -25,7 +25,7 @@ package com.discordsrv.api.discord.entity.interaction.command;
import com.discordsrv.api.discord.entity.JDAEntity;
import com.discordsrv.api.discord.entity.interaction.component.ComponentIdentifier;
import com.discordsrv.api.discord.events.interaction.command.*;
import com.discordsrv.api.event.events.discord.interaction.command.*;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions;
import net.dv8tion.jda.api.interactions.commands.build.*;
@ -52,7 +52,7 @@ public class DiscordCommand implements JDAEntity<CommandData> {
* @param name the name of the command, 1-32 characters alphanumeric and dashes
* @param description the description of the command
* @return a new chat input command builder
* @see com.discordsrv.api.discord.events.interaction.command.DiscordChatInputInteractionEvent
* @see com.discordsrv.api.event.events.discord.interaction.command.DiscordChatInputInteractionEvent
*/
public static ChatInputBuilder chatInput(
ComponentIdentifier id,
@ -71,7 +71,7 @@ public class DiscordCommand implements JDAEntity<CommandData> {
* @param id a unique identifier for this interaction, used to check if a given event was for this interaction
* @param name the name of the command, 1-32 characters
* @return a new command builder
* @see com.discordsrv.api.discord.events.interaction.command.DiscordUserContextInteractionEvent
* @see com.discordsrv.api.event.events.discord.interaction.command.DiscordUserContextInteractionEvent
*/
public static Builder<DiscordUserContextInteractionEvent> user(
ComponentIdentifier id,
@ -86,7 +86,7 @@ public class DiscordCommand implements JDAEntity<CommandData> {
* @param id a unique identifier for this interaction, used to check if a given event was for this interaction
* @param name the name of the command, 1-32 characters
* @return a new command builder
* @see com.discordsrv.api.discord.events.interaction.command.DiscordMessageContextInteractionEvent
* @see com.discordsrv.api.event.events.discord.interaction.command.DiscordMessageContextInteractionEvent
*/
public static Builder<DiscordMessageContextInteractionEvent> message(
ComponentIdentifier id,

View File

@ -38,7 +38,7 @@ import java.util.UUID;
* A Discord button.
* @see #builder(ComponentIdentifier, Style)
* @see #urlBuilder(String)
* @see com.discordsrv.api.discord.events.interaction.component.DiscordButtonInteractionEvent
* @see com.discordsrv.api.event.events.discord.interaction.component.DiscordButtonInteractionEvent
*/
public class Button implements MessageComponent {

View File

@ -37,7 +37,7 @@ import java.util.stream.Collectors;
/**
* A Discord modal.
* @see #builder(ComponentIdentifier, String)
* @see com.discordsrv.api.discord.events.interaction.DiscordModalInteractionEvent
* @see com.discordsrv.api.event.events.discord.interaction.DiscordModalInteractionEvent
*/
public class Modal implements JDAEntity<net.dv8tion.jda.api.interactions.modals.Modal> {

View File

@ -38,7 +38,7 @@ import java.util.List;
/**
* A Discord selection menu.
* @see #builder(ComponentIdentifier)
* @see com.discordsrv.api.discord.events.interaction.component.DiscordSelectMenuInteractionEvent
* @see com.discordsrv.api.event.events.discord.interaction.component.DiscordSelectMenuInteractionEvent
*/
// TODO: newest changes
public class SelectMenu implements MessageComponent {

View File

@ -29,9 +29,9 @@ import com.discordsrv.api.discord.entity.message.AllowedMention;
import com.discordsrv.api.discord.entity.message.DiscordMessageEmbed;
import com.discordsrv.api.discord.entity.message.SendableDiscordMessage;
import com.discordsrv.api.discord.util.DiscordFormattingUtil;
import com.discordsrv.api.placeholder.PlainPlaceholderFormat;
import com.discordsrv.api.placeholder.FormattedText;
import com.discordsrv.api.placeholder.PlaceholderService;
import com.discordsrv.api.placeholder.PlainPlaceholderFormat;
import com.discordsrv.api.placeholder.util.Placeholders;
import net.dv8tion.jda.api.entities.MessageEmbed;
import org.jetbrains.annotations.NotNull;

View File

@ -21,7 +21,7 @@
* SOFTWARE.
*/
package com.discordsrv.api.discord.events;
package com.discordsrv.api.event.events.discord;
import net.dv8tion.jda.api.events.GenericEvent;

View File

@ -21,7 +21,7 @@
* SOFTWARE.
*/
package com.discordsrv.api.discord.events;
package com.discordsrv.api.event.events.discord;
import com.discordsrv.api.discord.entity.JDAEntity;
import com.discordsrv.api.event.events.Event;

View File

@ -21,7 +21,7 @@
* SOFTWARE.
*/
package com.discordsrv.api.discord.events.interaction;
package com.discordsrv.api.event.events.discord.interaction;
import com.discordsrv.api.discord.entity.DiscordUser;
import com.discordsrv.api.discord.entity.channel.DiscordMessageChannel;

View File

@ -21,14 +21,14 @@
* SOFTWARE.
*/
package com.discordsrv.api.discord.events.interaction;
package com.discordsrv.api.event.events.discord.interaction;
import com.discordsrv.api.discord.entity.DiscordUser;
import com.discordsrv.api.discord.entity.channel.DiscordMessageChannel;
import com.discordsrv.api.discord.entity.guild.DiscordGuild;
import com.discordsrv.api.discord.entity.guild.DiscordGuildMember;
import com.discordsrv.api.discord.entity.interaction.component.ComponentIdentifier;
import com.discordsrv.api.discord.events.AbstractDiscordEvent;
import com.discordsrv.api.event.events.discord.AbstractDiscordEvent;
import net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

View File

@ -21,7 +21,7 @@
* SOFTWARE.
*/
package com.discordsrv.api.discord.events.interaction;
package com.discordsrv.api.event.events.discord.interaction;
import com.discordsrv.api.discord.entity.DiscordUser;
import com.discordsrv.api.discord.entity.channel.DiscordMessageChannel;

View File

@ -21,17 +21,22 @@
* SOFTWARE.
*/
package com.discordsrv.api.discord.events.interaction.command;
package com.discordsrv.api.event.events.discord.interaction.command;
import com.discordsrv.api.discord.entity.DiscordUser;
import com.discordsrv.api.discord.entity.channel.DiscordMessageChannel;
import com.discordsrv.api.discord.entity.guild.DiscordGuildMember;
import com.discordsrv.api.discord.entity.interaction.DiscordInteractionHook;
import com.discordsrv.api.discord.entity.interaction.component.ComponentIdentifier;
import com.discordsrv.api.discord.events.interaction.AbstractDeferrableInteractionEvent;
import com.discordsrv.api.discord.entity.message.SendableDiscordMessage;
import com.discordsrv.api.event.events.discord.interaction.AbstractDeferrableInteractionEvent;
import net.dv8tion.jda.api.events.interaction.command.GenericCommandInteractionEvent;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import org.jetbrains.annotations.Nullable;
public class AbstractCommandInteractionEvent<E extends GenericCommandInteractionEvent>
import java.util.concurrent.CompletableFuture;
public abstract class AbstractCommandInteractionEvent<E extends GenericCommandInteractionEvent>
extends AbstractDeferrableInteractionEvent<E> {
public AbstractCommandInteractionEvent(
@ -44,4 +49,16 @@ public class AbstractCommandInteractionEvent<E extends GenericCommandInteraction
) {
super(jdaEvent, identifier, user, member, channel, interaction);
}
public abstract CompletableFuture<DiscordInteractionHook> reply(SendableDiscordMessage message, boolean ephemeral);
public CompletableFuture<DiscordInteractionHook> reply(SendableDiscordMessage message) {
return reply(message, false);
}
@Nullable
public String getOption(String name) {
OptionMapping mapping = jdaEvent.getOption(name);
return mapping != null ? mapping.getAsString() : null;
}
}

View File

@ -21,7 +21,7 @@
* SOFTWARE.
*/
package com.discordsrv.api.discord.events.interaction.command;
package com.discordsrv.api.event.events.discord.interaction.command;
import com.discordsrv.api.discord.entity.interaction.command.DiscordCommand;
import com.discordsrv.api.event.events.Event;

View File

@ -21,7 +21,7 @@
* SOFTWARE.
*/
package com.discordsrv.api.discord.events.interaction.command;
package com.discordsrv.api.event.events.discord.interaction.command;
import com.discordsrv.api.discord.entity.DiscordUser;
import com.discordsrv.api.discord.entity.channel.DiscordMessageChannel;
@ -30,7 +30,7 @@ import com.discordsrv.api.discord.entity.interaction.DiscordInteractionHook;
import com.discordsrv.api.discord.entity.interaction.component.ComponentIdentifier;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
public class DiscordChatInputInteractionEvent extends AbstractCommandInteractionEvent<SlashCommandInteractionEvent> {
public abstract class DiscordChatInputInteractionEvent extends AbstractCommandInteractionEvent<SlashCommandInteractionEvent> {
public DiscordChatInputInteractionEvent(
SlashCommandInteractionEvent jdaEvent,

View File

@ -21,14 +21,15 @@
* SOFTWARE.
*/
package com.discordsrv.api.discord.events.interaction.command;
package com.discordsrv.api.event.events.discord.interaction.command;
import com.discordsrv.api.discord.entity.DiscordUser;
import com.discordsrv.api.discord.entity.channel.DiscordMessageChannel;
import com.discordsrv.api.discord.entity.guild.DiscordGuildMember;
import com.discordsrv.api.discord.entity.interaction.component.ComponentIdentifier;
import com.discordsrv.api.discord.events.interaction.AbstractInteractionEvent;
import com.discordsrv.api.event.events.discord.interaction.AbstractInteractionEvent;
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import java.util.LinkedHashMap;
import java.util.Map;
@ -47,6 +48,11 @@ public class DiscordCommandAutoCompleteInteractionEvent extends AbstractInteract
super(jdaEvent, identifier, user, member, channel);
}
public String getOption(String name) {
OptionMapping mapping = jdaEvent.getOption(name);
return mapping != null ? mapping.getAsString() : null;
}
public void addChoice(String name, String value) {
this.choices.put(name, value);
}

View File

@ -21,7 +21,7 @@
* SOFTWARE.
*/
package com.discordsrv.api.discord.events.interaction.command;
package com.discordsrv.api.event.events.discord.interaction.command;
import com.discordsrv.api.discord.entity.DiscordUser;
import com.discordsrv.api.discord.entity.channel.DiscordMessageChannel;
@ -30,7 +30,7 @@ import com.discordsrv.api.discord.entity.interaction.DiscordInteractionHook;
import com.discordsrv.api.discord.entity.interaction.component.ComponentIdentifier;
import net.dv8tion.jda.api.events.interaction.command.MessageContextInteractionEvent;
public class DiscordMessageContextInteractionEvent
public abstract class DiscordMessageContextInteractionEvent
extends AbstractCommandInteractionEvent<MessageContextInteractionEvent> {
public DiscordMessageContextInteractionEvent(

View File

@ -21,7 +21,7 @@
* SOFTWARE.
*/
package com.discordsrv.api.discord.events.interaction.command;
package com.discordsrv.api.event.events.discord.interaction.command;
import com.discordsrv.api.discord.entity.DiscordUser;
import com.discordsrv.api.discord.entity.channel.DiscordMessageChannel;
@ -30,7 +30,7 @@ import com.discordsrv.api.discord.entity.interaction.DiscordInteractionHook;
import com.discordsrv.api.discord.entity.interaction.component.ComponentIdentifier;
import net.dv8tion.jda.api.events.interaction.command.UserContextInteractionEvent;
public class DiscordUserContextInteractionEvent extends AbstractCommandInteractionEvent<UserContextInteractionEvent> {
public abstract class DiscordUserContextInteractionEvent extends AbstractCommandInteractionEvent<UserContextInteractionEvent> {
public DiscordUserContextInteractionEvent(
UserContextInteractionEvent jdaEvent,

View File

@ -21,14 +21,14 @@
* SOFTWARE.
*/
package com.discordsrv.api.discord.events.interaction.component;
package com.discordsrv.api.event.events.discord.interaction.component;
import com.discordsrv.api.discord.entity.DiscordUser;
import com.discordsrv.api.discord.entity.channel.DiscordMessageChannel;
import com.discordsrv.api.discord.entity.guild.DiscordGuildMember;
import com.discordsrv.api.discord.entity.interaction.DiscordInteractionHook;
import com.discordsrv.api.discord.entity.interaction.component.ComponentIdentifier;
import com.discordsrv.api.discord.events.interaction.AbstractDeferrableInteractionEvent;
import com.discordsrv.api.event.events.discord.interaction.AbstractDeferrableInteractionEvent;
import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent;
public class DiscordButtonInteractionEvent extends AbstractDeferrableInteractionEvent<ButtonInteractionEvent> {

View File

@ -21,17 +21,16 @@
* SOFTWARE.
*/
package com.discordsrv.api.discord.events.interaction.component;
package com.discordsrv.api.event.events.discord.interaction.component;
import com.discordsrv.api.discord.entity.DiscordUser;
import com.discordsrv.api.discord.entity.channel.DiscordMessageChannel;
import com.discordsrv.api.discord.entity.guild.DiscordGuildMember;
import com.discordsrv.api.discord.entity.interaction.DiscordInteractionHook;
import com.discordsrv.api.discord.entity.interaction.component.ComponentIdentifier;
import com.discordsrv.api.discord.events.interaction.AbstractDeferrableInteractionEvent;
import com.discordsrv.api.event.events.discord.interaction.AbstractDeferrableInteractionEvent;
import net.dv8tion.jda.api.events.interaction.component.GenericSelectMenuInteractionEvent;
// TODO: newest changes
public class DiscordSelectMenuInteractionEvent extends AbstractDeferrableInteractionEvent<GenericSelectMenuInteractionEvent<?, ?>> {
public DiscordSelectMenuInteractionEvent(

View File

@ -21,10 +21,10 @@
* SOFTWARE.
*/
package com.discordsrv.api.discord.events.member;
package com.discordsrv.api.event.events.discord.member;
import com.discordsrv.api.discord.entity.guild.DiscordGuildMember;
import com.discordsrv.api.discord.events.AbstractDiscordEvent;
import com.discordsrv.api.event.events.discord.AbstractDiscordEvent;
import net.dv8tion.jda.api.events.guild.member.GenericGuildMemberEvent;
public abstract class AbstractDiscordMemberEvent<T extends GenericGuildMemberEvent> extends AbstractDiscordEvent<T> {

View File

@ -21,11 +21,11 @@
* SOFTWARE.
*/
package com.discordsrv.api.discord.events.member.role;
package com.discordsrv.api.event.events.discord.member.role;
import com.discordsrv.api.discord.entity.guild.DiscordGuildMember;
import com.discordsrv.api.discord.entity.guild.DiscordRole;
import com.discordsrv.api.discord.events.member.AbstractDiscordMemberEvent;
import com.discordsrv.api.event.events.discord.member.AbstractDiscordMemberEvent;
import net.dv8tion.jda.api.events.guild.member.GenericGuildMemberEvent;
import java.util.List;

View File

@ -21,7 +21,7 @@
* SOFTWARE.
*/
package com.discordsrv.api.discord.events.member.role;
package com.discordsrv.api.event.events.discord.member.role;
import com.discordsrv.api.discord.entity.guild.DiscordGuildMember;
import com.discordsrv.api.discord.entity.guild.DiscordRole;

View File

@ -21,7 +21,7 @@
* SOFTWARE.
*/
package com.discordsrv.api.discord.events.member.role;
package com.discordsrv.api.event.events.discord.member.role;
import com.discordsrv.api.discord.entity.guild.DiscordGuildMember;
import com.discordsrv.api.discord.entity.guild.DiscordRole;

View File

@ -21,13 +21,13 @@
* SOFTWARE.
*/
package com.discordsrv.api.discord.events.message;
package com.discordsrv.api.event.events.discord.message;
import com.discordsrv.api.discord.entity.channel.DiscordDMChannel;
import com.discordsrv.api.discord.entity.channel.DiscordMessageChannel;
import com.discordsrv.api.discord.entity.channel.DiscordTextChannel;
import com.discordsrv.api.discord.entity.channel.DiscordThreadChannel;
import com.discordsrv.api.discord.events.AbstractDiscordEvent;
import com.discordsrv.api.event.events.discord.AbstractDiscordEvent;
import net.dv8tion.jda.api.events.message.GenericMessageEvent;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

View File

@ -21,7 +21,7 @@
* SOFTWARE.
*/
package com.discordsrv.api.discord.events.message;
package com.discordsrv.api.event.events.discord.message;
import com.discordsrv.api.discord.entity.channel.DiscordMessageChannel;
import net.dv8tion.jda.api.events.message.MessageDeleteEvent;

View File

@ -21,7 +21,7 @@
* SOFTWARE.
*/
package com.discordsrv.api.discord.events.message;
package com.discordsrv.api.event.events.discord.message;
import com.discordsrv.api.discord.entity.channel.DiscordMessageChannel;
import com.discordsrv.api.discord.entity.message.ReceivedDiscordMessage;

View File

@ -21,7 +21,7 @@
* SOFTWARE.
*/
package com.discordsrv.api.discord.events.message;
package com.discordsrv.api.event.events.discord.message;
import com.discordsrv.api.discord.entity.channel.DiscordMessageChannel;
import com.discordsrv.api.discord.entity.message.ReceivedDiscordMessage;

View File

@ -20,7 +20,6 @@ package com.discordsrv.bukkit.requiredlinking;
import com.discordsrv.bukkit.BukkitDiscordSRV;
import com.discordsrv.bukkit.config.main.BukkitRequiredLinkingConfig;
import com.discordsrv.common.config.main.linking.RequirementsConfig;
import com.discordsrv.common.linking.requirelinking.ServerRequireLinkingModule;
import org.bukkit.event.Listener;

View File

@ -24,11 +24,11 @@ import com.discordsrv.bungee.player.BungeePlayerProvider;
import com.discordsrv.bungee.plugin.BungeePluginManager;
import com.discordsrv.common.ProxyDiscordSRV;
import com.discordsrv.common.command.game.handler.ICommandHandler;
import com.discordsrv.common.config.configurate.manager.ConnectionConfigManager;
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
import com.discordsrv.common.config.configurate.manager.MessagesConfigManager;
import com.discordsrv.common.config.connection.ConnectionConfig;
import com.discordsrv.common.config.main.MainConfig;
import com.discordsrv.common.config.configurate.manager.ConnectionConfigManager;
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
import com.discordsrv.common.config.messages.MessagesConfig;
import com.discordsrv.common.debug.data.OnlineMode;
import com.discordsrv.common.plugin.PluginManager;

View File

@ -24,12 +24,12 @@ import com.discordsrv.api.discord.entity.channel.DiscordTextChannel;
import com.discordsrv.api.discord.entity.channel.DiscordThreadChannel;
import com.discordsrv.api.event.events.channel.GameChannelLookupEvent;
import com.discordsrv.common.DiscordSRV;
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
import com.discordsrv.common.config.main.channels.base.BaseChannelConfig;
import com.discordsrv.common.config.main.channels.base.ChannelConfig;
import com.discordsrv.common.config.main.channels.base.IChannelConfig;
import com.discordsrv.common.config.main.generic.ThreadConfig;
import com.discordsrv.common.config.main.generic.DestinationConfig;
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
import com.discordsrv.common.config.main.generic.ThreadConfig;
import com.github.benmanes.caffeine.cache.CacheLoader;
import com.github.benmanes.caffeine.cache.LoadingCache;
import org.apache.commons.lang3.tuple.Pair;

View File

@ -1,8 +1,8 @@
package com.discordsrv.common.command.combined.abstraction;
import com.discordsrv.api.discord.entity.interaction.command.DiscordCommand;
import com.discordsrv.api.discord.events.interaction.command.DiscordChatInputInteractionEvent;
import com.discordsrv.api.discord.events.interaction.command.DiscordCommandAutoCompleteInteractionEvent;
import com.discordsrv.api.event.events.discord.interaction.command.DiscordChatInputInteractionEvent;
import com.discordsrv.api.event.events.discord.interaction.command.DiscordCommandAutoCompleteInteractionEvent;
import com.discordsrv.common.DiscordSRV;
import com.discordsrv.common.command.game.abstraction.GameCommandArguments;
import com.discordsrv.common.command.game.abstraction.GameCommandExecutor;

View File

@ -1,7 +1,7 @@
package com.discordsrv.common.command.combined.abstraction;
import com.discordsrv.api.discord.events.interaction.command.DiscordChatInputInteractionEvent;
import com.discordsrv.api.discord.events.interaction.command.DiscordCommandAutoCompleteInteractionEvent;
import com.discordsrv.api.event.events.discord.interaction.command.DiscordChatInputInteractionEvent;
import com.discordsrv.api.event.events.discord.interaction.command.DiscordCommandAutoCompleteInteractionEvent;
import com.discordsrv.common.DiscordSRV;
import com.discordsrv.common.config.messages.MessagesConfig;
import net.dv8tion.jda.api.entities.User;

View File

@ -1,7 +1,7 @@
package com.discordsrv.common.command.discord;
import com.discordsrv.api.discord.events.interaction.command.CommandRegisterEvent;
import com.discordsrv.api.event.bus.Subscribe;
import com.discordsrv.api.event.events.discord.interaction.command.CommandRegisterEvent;
import com.discordsrv.common.DiscordSRV;
import com.discordsrv.common.command.discord.commands.DiscordSRVDiscordCommand;
import com.discordsrv.common.module.type.AbstractModule;

View File

@ -2,11 +2,13 @@ package com.discordsrv.common.command.discord.commands.subcommand;
import com.discordsrv.api.discord.entity.DiscordUser;
import com.discordsrv.api.discord.entity.guild.DiscordGuildMember;
import com.discordsrv.api.discord.entity.interaction.DiscordInteractionHook;
import com.discordsrv.api.discord.entity.interaction.command.CommandOption;
import com.discordsrv.api.discord.entity.interaction.command.DiscordCommand;
import com.discordsrv.api.discord.entity.interaction.component.ComponentIdentifier;
import com.discordsrv.api.discord.events.interaction.command.DiscordChatInputInteractionEvent;
import com.discordsrv.api.discord.events.interaction.command.DiscordCommandAutoCompleteInteractionEvent;
import com.discordsrv.api.discord.entity.message.SendableDiscordMessage;
import com.discordsrv.api.event.events.discord.interaction.command.DiscordChatInputInteractionEvent;
import com.discordsrv.api.event.events.discord.interaction.command.DiscordCommandAutoCompleteInteractionEvent;
import com.discordsrv.common.DiscordSRV;
import com.discordsrv.common.command.game.GameCommandExecutionHelper;
import com.discordsrv.common.config.main.DiscordCommandConfig;
@ -14,8 +16,6 @@ import com.discordsrv.common.config.main.generic.GameCommandExecutionConditionCo
import com.discordsrv.common.logging.Logger;
import com.discordsrv.common.logging.NamedLogger;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.interactions.InteractionHook;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.kyori.adventure.text.Component;
import java.time.Duration;
@ -72,25 +72,28 @@ public class ExecuteCommand implements Consumer<DiscordChatInputInteractionEvent
public void accept(DiscordChatInputInteractionEvent event) {
DiscordCommandConfig.ExecuteConfig config = discordSRV.config().discordCommand.execute;
if (!config.enabled) {
event.asJDA().reply("The execute command is disabled").setEphemeral(true).queue();
event.reply(SendableDiscordMessage.builder().setContent("The execute command is disabled").build());
return;
}
OptionMapping mapping = event.asJDA().getOption("command");
if (mapping == null) {
String command = event.getOption("command");
if (command == null) {
return;
}
String command = mapping.getAsString();
if (isNotAcceptableCommand(event.getMember(), event.getUser(), command, false)) {
event.asJDA().reply("You do not have permission to run that command").setEphemeral(true).queue();
event.reply(SendableDiscordMessage.builder().setContent("You do not have permission to run that command").build());
return;
}
boolean ephemeral = config.ephemeral;
event.asJDA().reply("Executing command `" + command + "`")
.setEphemeral(ephemeral)
.queue(ih -> new ExecutionContext(discordSRV, ih, config.outputMode, ephemeral).run(event.getUser(), command));
event.reply(SendableDiscordMessage.builder().setContent("Executing command `" + command + "`").build())
.whenComplete((ih, t) -> {
if (t != null) {
return;
}
new ExecutionContext(discordSRV, ih, config.outputMode, ephemeral).run(event.getUser(), command);
});
}
@Override
@ -105,14 +108,12 @@ public class ExecuteCommand implements Consumer<DiscordChatInputInteractionEvent
return;
}
OptionMapping mapping = event.asJDA().getOption("command");
if (mapping == null) {
String command = event.getOption("command");
if (command == null) {
return;
}
String command = mapping.getAsString();
List<String> parts = new ArrayList<>(Arrays.asList(command.split(" ")));
List<String> suggestions = getSuggestions(parts);
if (suggestions == null) {
return;
@ -177,7 +178,7 @@ public class ExecuteCommand implements Consumer<DiscordChatInputInteractionEvent
private static class ExecutionContext {
private final DiscordSRV discordSRV;
private final InteractionHook hook;
private final DiscordInteractionHook hook;
private final DiscordCommandConfig.OutputMode outputMode;
private final boolean ephemeral;
private ScheduledFuture<?> future;
@ -185,7 +186,7 @@ public class ExecuteCommand implements Consumer<DiscordChatInputInteractionEvent
public ExecutionContext(
DiscordSRV discordSRV,
InteractionHook hook,
DiscordInteractionHook hook,
DiscordCommandConfig.OutputMode outputMode,
boolean ephemeral
) {
@ -241,7 +242,7 @@ public class ExecuteCommand implements Consumer<DiscordChatInputInteractionEvent
}
if (prefix.length() + suffix.length() + discord.length() + joiner.length() + delimiter.length() > Message.MAX_CONTENT_LENGTH) {
hook.sendMessage(prefix + joiner + suffix).setEphemeral(ephemeral).queue();
hook.reply(SendableDiscordMessage.builder().setContent(prefix + joiner + suffix).build(), ephemeral);
joiner = new StringJoiner(delimiter);
}
@ -249,7 +250,7 @@ public class ExecuteCommand implements Consumer<DiscordChatInputInteractionEvent
}
future = null;
}
hook.sendMessage(prefix + joiner + suffix).setEphemeral(ephemeral).queue();
hook.reply(SendableDiscordMessage.builder().setContent(prefix + joiner + suffix).build(), ephemeral);
}
}

View File

@ -20,8 +20,8 @@ package com.discordsrv.common.config.main.channels.base.proxy;
import com.discordsrv.common.config.configurate.annotation.Order;
import com.discordsrv.common.config.main.channels.JoinMessageConfig;
import com.discordsrv.common.config.main.channels.proxy.ServerSwitchMessageConfig;
import com.discordsrv.common.config.main.channels.base.BaseChannelConfig;
import com.discordsrv.common.config.main.channels.proxy.ServerSwitchMessageConfig;
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
@ConfigSerializable

View File

@ -19,9 +19,9 @@
package com.discordsrv.common.config.main.channels.base.server;
import com.discordsrv.common.config.configurate.annotation.Order;
import com.discordsrv.common.config.main.channels.base.BaseChannelConfig;
import com.discordsrv.common.config.main.channels.server.AwardMessageConfig;
import com.discordsrv.common.config.main.channels.server.DeathMessageConfig;
import com.discordsrv.common.config.main.channels.base.BaseChannelConfig;
import com.discordsrv.common.config.main.channels.server.ServerJoinMessageConfig;
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
import org.spongepowered.configurate.objectmapping.meta.Comment;

View File

@ -8,9 +8,9 @@ import com.discordsrv.api.discord.entity.channel.DiscordThreadChannel;
import com.discordsrv.api.discord.entity.guild.DiscordGuildMember;
import com.discordsrv.api.discord.entity.message.ReceivedDiscordMessage;
import com.discordsrv.api.discord.entity.message.SendableDiscordMessage;
import com.discordsrv.api.discord.events.message.DiscordMessageReceiveEvent;
import com.discordsrv.api.discord.util.DiscordFormattingUtil;
import com.discordsrv.api.event.bus.Subscribe;
import com.discordsrv.api.event.events.discord.message.DiscordMessageReceiveEvent;
import com.discordsrv.api.placeholder.PlainPlaceholderFormat;
import com.discordsrv.api.placeholder.provider.SinglePlaceholder;
import com.discordsrv.common.DiscordSRV;

View File

@ -1,13 +1,9 @@
package com.discordsrv.common.console.entry;
import com.discordsrv.api.placeholder.PlaceholderLookupResult;
import com.discordsrv.api.placeholder.annotation.Placeholder;
import com.discordsrv.api.placeholder.annotation.PlaceholderRemainder;
import com.discordsrv.common.logging.LogLevel;
import java.time.ZonedDateTime;
import java.util.LinkedHashSet;
import java.util.Set;
/**
* A raw log entry from a platform logger. May be parsed to become a {@link LogMessage}.

View File

@ -26,20 +26,23 @@ import com.discordsrv.api.discord.entity.interaction.command.CommandType;
import com.discordsrv.api.discord.entity.interaction.command.DiscordCommand;
import com.discordsrv.api.discord.entity.interaction.command.SubCommandGroup;
import com.discordsrv.api.discord.entity.interaction.component.ComponentIdentifier;
import com.discordsrv.api.discord.events.interaction.DiscordModalInteractionEvent;
import com.discordsrv.api.discord.events.interaction.command.*;
import com.discordsrv.api.discord.events.interaction.component.DiscordButtonInteractionEvent;
import com.discordsrv.api.discord.events.interaction.component.DiscordSelectMenuInteractionEvent;
import com.discordsrv.api.discord.events.member.role.DiscordMemberRoleAddEvent;
import com.discordsrv.api.discord.events.member.role.DiscordMemberRoleRemoveEvent;
import com.discordsrv.api.discord.events.message.DiscordMessageDeleteEvent;
import com.discordsrv.api.discord.events.message.DiscordMessageReceiveEvent;
import com.discordsrv.api.discord.events.message.DiscordMessageUpdateEvent;
import com.discordsrv.api.event.bus.Subscribe;
import com.discordsrv.api.event.events.Event;
import com.discordsrv.api.event.events.discord.interaction.DiscordModalInteractionEvent;
import com.discordsrv.api.event.events.discord.interaction.command.*;
import com.discordsrv.api.event.events.discord.interaction.component.DiscordButtonInteractionEvent;
import com.discordsrv.api.event.events.discord.interaction.component.DiscordSelectMenuInteractionEvent;
import com.discordsrv.api.event.events.discord.member.role.DiscordMemberRoleAddEvent;
import com.discordsrv.api.event.events.discord.member.role.DiscordMemberRoleRemoveEvent;
import com.discordsrv.api.event.events.discord.message.DiscordMessageDeleteEvent;
import com.discordsrv.api.event.events.discord.message.DiscordMessageReceiveEvent;
import com.discordsrv.api.event.events.discord.message.DiscordMessageUpdateEvent;
import com.discordsrv.common.DiscordSRV;
import com.discordsrv.common.discord.api.entity.component.DiscordInteractionHookImpl;
import com.discordsrv.common.discord.api.entity.message.ReceivedDiscordMessageImpl;
import com.discordsrv.common.event.events.discord.interaction.command.DiscordChatInputInteractionEventImpl;
import com.discordsrv.common.event.events.discord.interaction.command.DiscordMessageContextInteractionEventImpl;
import com.discordsrv.common.event.events.discord.interaction.command.DiscordUserContextInteractionEventImpl;
import com.discordsrv.common.module.type.AbstractModule;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Member;
@ -181,7 +184,8 @@ public class DiscordAPIEventModule extends AbstractModule<DiscordSRV> {
return;
}
DiscordMessageContextInteractionEvent interactionEvent = new DiscordMessageContextInteractionEvent(
DiscordMessageContextInteractionEvent interactionEvent = new DiscordMessageContextInteractionEventImpl(
discordSRV,
(MessageContextInteractionEvent) event,
command.getId(),
user,
@ -202,7 +206,8 @@ public class DiscordAPIEventModule extends AbstractModule<DiscordSRV> {
return;
}
DiscordUserContextInteractionEvent interactionEvent = new DiscordUserContextInteractionEvent(
DiscordUserContextInteractionEvent interactionEvent = new DiscordUserContextInteractionEventImpl(
discordSRV,
(UserContextInteractionEvent) event,
command.getId(),
user,
@ -228,7 +233,8 @@ public class DiscordAPIEventModule extends AbstractModule<DiscordSRV> {
((SlashCommandInteractionEvent) event).getSubcommandName()
);
DiscordChatInputInteractionEvent interactionEvent = new DiscordChatInputInteractionEvent(
DiscordChatInputInteractionEvent interactionEvent = new DiscordChatInputInteractionEventImpl(
discordSRV,
(SlashCommandInteractionEvent) event,
command.getId(),
user,

View File

@ -33,8 +33,8 @@ import com.discordsrv.api.discord.exception.RestErrorResponseException;
import com.discordsrv.common.DiscordSRV;
import com.discordsrv.common.config.main.channels.base.BaseChannelConfig;
import com.discordsrv.common.config.main.channels.base.IChannelConfig;
import com.discordsrv.common.config.main.generic.ThreadConfig;
import com.discordsrv.common.config.main.generic.DestinationConfig;
import com.discordsrv.common.config.main.generic.ThreadConfig;
import com.discordsrv.common.discord.api.entity.DiscordUserImpl;
import com.discordsrv.common.discord.api.entity.channel.*;
import com.discordsrv.common.discord.api.entity.guild.DiscordCustomEmojiImpl;
@ -139,10 +139,9 @@ public class DiscordAPIImpl implements DiscordAPI {
// Check if a thread by the same name is still active
DiscordThreadChannel thread = findThread(threadConfig, channel.getActiveThreads());
if (thread != null) {
ThreadChannel jdaChannel = thread.asJDA();
if (!jdaChannel.isArchived()) {
if (!thread.isArchived()) {
synchronized (channels) {
channels.add(getThreadChannel(jdaChannel));
channels.add(thread);
}
continue;
}
@ -253,10 +252,10 @@ public class DiscordAPIImpl implements DiscordAPI {
CompletableFuture<DiscordThreadChannel> future
) {
if (thread != null) {
ThreadChannel channel = thread.asJDA();
if (channel.isLocked() || channel.isArchived()) {
if (thread.isLocked() || thread.isArchived()) {
try {
channel.getManager()
thread.asJDA()
.getManager()
.setArchived(false)
.reason("DiscordSRV Auto Unarchive")
.queue(v -> future.complete(thread), future::completeExceptionally);

View File

@ -19,9 +19,9 @@
package com.discordsrv.common.discord.api;
import com.discordsrv.api.discord.entity.JDAEntity;
import com.discordsrv.api.discord.entity.interaction.command.DiscordCommand;
import com.discordsrv.api.discord.entity.interaction.command.CommandType;
import com.discordsrv.api.discord.events.interaction.command.CommandRegisterEvent;
import com.discordsrv.api.discord.entity.interaction.command.DiscordCommand;
import com.discordsrv.api.event.events.discord.interaction.command.CommandRegisterEvent;
import com.discordsrv.common.DiscordSRV;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.entities.Guild;

View File

@ -81,6 +81,36 @@ public class DiscordThreadChannelImpl extends AbstractDiscordGuildMessageChannel
return threadContainer;
}
@Override
public boolean isArchived() {
return channel.isArchived();
}
@Override
public boolean isLocked() {
return channel.isLocked();
}
@Override
public boolean isJoined() {
return channel.isJoined();
}
@Override
public boolean isInvitable() {
return channel.isInvitable();
}
@Override
public boolean isOwnedBySelfUser() {
return channel.isOwner();
}
@Override
public boolean isPublic() {
return channel.isPublic();
}
@Override
public String toString() {
return "Thread:" + getName() + "(" + Long.toUnsignedString(getId()) + " in " + threadContainer + ")";

View File

@ -72,20 +72,11 @@ public class DiscordInteractionHookImpl implements DiscordInteractionHook {
}
@Override
public CompletableFuture<DiscordInteractionHook> reply(SendableDiscordMessage message) {
public CompletableFuture<DiscordInteractionHook> reply(SendableDiscordMessage message, boolean ephemeral) {
if (!(hook instanceof IReplyCallback)) {
throw new IllegalStateException("This interaction cannot be replied to");
}
return ((IReplyCallback) hook).reply(SendableDiscordMessageUtil.toJDASend(message)).submit()
.thenApply(hook -> new DiscordInteractionHookImpl(discordSRV, hook));
}
@Override
public CompletableFuture<DiscordInteractionHook> replyEphemeral(SendableDiscordMessage message) {
if (!(hook instanceof IReplyCallback)) {
throw new IllegalStateException("This interaction cannot be replied to");
}
return ((IReplyCallback) hook).reply(SendableDiscordMessageUtil.toJDASend(message)).setEphemeral(true).submit()
return ((IReplyCallback) hook).reply(SendableDiscordMessageUtil.toJDASend(message)).setEphemeral(ephemeral).submit()
.thenApply(hook -> new DiscordInteractionHookImpl(discordSRV, hook));
}

View File

@ -74,6 +74,11 @@ public class DiscordGuildMemberImpl implements DiscordGuildMember {
return guild;
}
@Override
public boolean isOwner() {
return member.isOwner();
}
@Override
public @Nullable String getNickname() {
return member.getNickname();

View File

@ -0,0 +1,39 @@
package com.discordsrv.common.event.events.discord.interaction.command;
import com.discordsrv.api.discord.entity.DiscordUser;
import com.discordsrv.api.discord.entity.channel.DiscordMessageChannel;
import com.discordsrv.api.discord.entity.guild.DiscordGuildMember;
import com.discordsrv.api.discord.entity.interaction.DiscordInteractionHook;
import com.discordsrv.api.discord.entity.interaction.component.ComponentIdentifier;
import com.discordsrv.api.discord.entity.message.SendableDiscordMessage;
import com.discordsrv.api.event.events.discord.interaction.command.DiscordChatInputInteractionEvent;
import com.discordsrv.common.DiscordSRV;
import com.discordsrv.common.discord.api.entity.component.DiscordInteractionHookImpl;
import com.discordsrv.common.discord.api.entity.message.util.SendableDiscordMessageUtil;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import java.util.concurrent.CompletableFuture;
public class DiscordChatInputInteractionEventImpl extends DiscordChatInputInteractionEvent {
private final DiscordSRV discordSRV;
public DiscordChatInputInteractionEventImpl(
DiscordSRV discordSRV,
SlashCommandInteractionEvent jdaEvent,
ComponentIdentifier identifier,
DiscordUser user,
DiscordGuildMember member,
DiscordMessageChannel channel, DiscordInteractionHook interaction) {
super(jdaEvent, identifier, user, member, channel, interaction);
this.discordSRV = discordSRV;
}
@Override
public CompletableFuture<DiscordInteractionHook> reply(SendableDiscordMessage message, boolean ephemeral) {
return discordSRV.discordAPI().mapExceptions(
() -> jdaEvent.reply(SendableDiscordMessageUtil.toJDASend(message)).setEphemeral(ephemeral).submit()
.thenApply(ih -> new DiscordInteractionHookImpl(discordSRV, ih))
);
}
}

View File

@ -0,0 +1,39 @@
package com.discordsrv.common.event.events.discord.interaction.command;
import com.discordsrv.api.discord.entity.DiscordUser;
import com.discordsrv.api.discord.entity.channel.DiscordMessageChannel;
import com.discordsrv.api.discord.entity.guild.DiscordGuildMember;
import com.discordsrv.api.discord.entity.interaction.DiscordInteractionHook;
import com.discordsrv.api.discord.entity.interaction.component.ComponentIdentifier;
import com.discordsrv.api.discord.entity.message.SendableDiscordMessage;
import com.discordsrv.api.event.events.discord.interaction.command.DiscordMessageContextInteractionEvent;
import com.discordsrv.common.DiscordSRV;
import com.discordsrv.common.discord.api.entity.component.DiscordInteractionHookImpl;
import com.discordsrv.common.discord.api.entity.message.util.SendableDiscordMessageUtil;
import net.dv8tion.jda.api.events.interaction.command.MessageContextInteractionEvent;
import java.util.concurrent.CompletableFuture;
public class DiscordMessageContextInteractionEventImpl extends DiscordMessageContextInteractionEvent {
private final DiscordSRV discordSRV;
public DiscordMessageContextInteractionEventImpl(
DiscordSRV discordSRV,
MessageContextInteractionEvent jdaEvent,
ComponentIdentifier identifier,
DiscordUser user,
DiscordGuildMember member,
DiscordMessageChannel channel, DiscordInteractionHook interaction) {
super(jdaEvent, identifier, user, member, channel, interaction);
this.discordSRV = discordSRV;
}
@Override
public CompletableFuture<DiscordInteractionHook> reply(SendableDiscordMessage message, boolean ephemeral) {
return discordSRV.discordAPI().mapExceptions(
() -> jdaEvent.reply(SendableDiscordMessageUtil.toJDASend(message)).setEphemeral(ephemeral).submit()
.thenApply(ih -> new DiscordInteractionHookImpl(discordSRV, ih))
);
}
}

View File

@ -0,0 +1,39 @@
package com.discordsrv.common.event.events.discord.interaction.command;
import com.discordsrv.api.discord.entity.DiscordUser;
import com.discordsrv.api.discord.entity.channel.DiscordMessageChannel;
import com.discordsrv.api.discord.entity.guild.DiscordGuildMember;
import com.discordsrv.api.discord.entity.interaction.DiscordInteractionHook;
import com.discordsrv.api.discord.entity.interaction.component.ComponentIdentifier;
import com.discordsrv.api.discord.entity.message.SendableDiscordMessage;
import com.discordsrv.api.event.events.discord.interaction.command.DiscordUserContextInteractionEvent;
import com.discordsrv.common.DiscordSRV;
import com.discordsrv.common.discord.api.entity.component.DiscordInteractionHookImpl;
import com.discordsrv.common.discord.api.entity.message.util.SendableDiscordMessageUtil;
import net.dv8tion.jda.api.events.interaction.command.UserContextInteractionEvent;
import java.util.concurrent.CompletableFuture;
public class DiscordUserContextInteractionEventImpl extends DiscordUserContextInteractionEvent {
private final DiscordSRV discordSRV;
public DiscordUserContextInteractionEventImpl(
DiscordSRV discordSRV,
UserContextInteractionEvent jdaEvent,
ComponentIdentifier identifier,
DiscordUser user,
DiscordGuildMember member,
DiscordMessageChannel channel, DiscordInteractionHook interaction) {
super(jdaEvent, identifier, user, member, channel, interaction);
this.discordSRV = discordSRV;
}
@Override
public CompletableFuture<DiscordInteractionHook> reply(SendableDiscordMessage message, boolean ephemeral) {
return discordSRV.discordAPI().mapExceptions(
() -> jdaEvent.reply(SendableDiscordMessageUtil.toJDASend(message)).setEphemeral(ephemeral).submit()
.thenApply(ih -> new DiscordInteractionHookImpl(discordSRV, ih))
);
}
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.discordsrv.common.player.event;
package com.discordsrv.common.event.events.player;
import com.discordsrv.api.event.events.Event;
import com.discordsrv.common.player.IPlayer;

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.discordsrv.common.player.event;
package com.discordsrv.common.event.events.player;
import com.discordsrv.api.event.events.Event;
import com.discordsrv.common.player.IPlayer;

View File

@ -20,14 +20,15 @@ package com.discordsrv.common.groupsync;
import com.discordsrv.api.DiscordSRVApi;
import com.discordsrv.api.discord.entity.guild.DiscordRole;
import com.discordsrv.api.discord.events.member.role.DiscordMemberRoleAddEvent;
import com.discordsrv.api.discord.events.member.role.DiscordMemberRoleRemoveEvent;
import com.discordsrv.api.event.bus.Subscribe;
import com.discordsrv.api.event.events.discord.member.role.DiscordMemberRoleAddEvent;
import com.discordsrv.api.event.events.discord.member.role.DiscordMemberRoleRemoveEvent;
import com.discordsrv.api.module.type.PermissionDataProvider;
import com.discordsrv.common.DiscordSRV;
import com.discordsrv.common.config.main.GroupSyncConfig;
import com.discordsrv.common.debug.DebugGenerateEvent;
import com.discordsrv.common.debug.file.TextDebugFile;
import com.discordsrv.common.event.events.player.PlayerConnectedEvent;
import com.discordsrv.common.future.util.CompletableFutureUtil;
import com.discordsrv.common.groupsync.enums.GroupSyncCause;
import com.discordsrv.common.groupsync.enums.GroupSyncDirection;
@ -36,7 +37,6 @@ import com.discordsrv.common.groupsync.enums.GroupSyncSide;
import com.discordsrv.common.logging.NamedLogger;
import com.discordsrv.common.module.type.AbstractModule;
import com.discordsrv.common.player.IPlayer;
import com.discordsrv.common.player.event.PlayerConnectedEvent;
import com.discordsrv.common.profile.Profile;
import com.github.benmanes.caffeine.cache.Cache;
import org.apache.commons.lang3.StringUtils;

View File

@ -20,8 +20,8 @@ package com.discordsrv.common.linking.impl;
import com.discordsrv.api.event.bus.Subscribe;
import com.discordsrv.common.DiscordSRV;
import com.discordsrv.common.event.events.player.PlayerConnectedEvent;
import com.discordsrv.common.linking.LinkProvider;
import com.discordsrv.common.player.event.PlayerConnectedEvent;
import com.github.benmanes.caffeine.cache.AsyncCacheLoader;
import com.github.benmanes.caffeine.cache.AsyncLoadingCache;
import com.github.benmanes.caffeine.cache.Cache;

View File

@ -27,10 +27,10 @@ import com.discordsrv.api.discord.entity.channel.DiscordMessageChannel;
import com.discordsrv.api.discord.entity.guild.DiscordGuild;
import com.discordsrv.api.discord.entity.guild.DiscordGuildMember;
import com.discordsrv.api.discord.entity.message.ReceivedDiscordMessage;
import com.discordsrv.api.discord.events.message.DiscordMessageDeleteEvent;
import com.discordsrv.api.discord.events.message.DiscordMessageReceiveEvent;
import com.discordsrv.api.discord.events.message.DiscordMessageUpdateEvent;
import com.discordsrv.api.event.bus.Subscribe;
import com.discordsrv.api.event.events.discord.message.DiscordMessageDeleteEvent;
import com.discordsrv.api.event.events.discord.message.DiscordMessageReceiveEvent;
import com.discordsrv.api.event.events.discord.message.DiscordMessageUpdateEvent;
import com.discordsrv.api.event.events.message.forward.discord.DiscordChatMessageForwardedEvent;
import com.discordsrv.api.event.events.message.process.discord.DiscordChatMessageProcessEvent;
import com.discordsrv.api.event.events.message.receive.discord.DiscordChatMessageReceiveEvent;

View File

@ -29,9 +29,9 @@ import com.discordsrv.api.discord.entity.guild.DiscordGuildMember;
import com.discordsrv.api.discord.entity.message.DiscordMessageEmbed;
import com.discordsrv.api.discord.entity.message.ReceivedDiscordMessage;
import com.discordsrv.api.discord.entity.message.SendableDiscordMessage;
import com.discordsrv.api.discord.events.message.DiscordMessageDeleteEvent;
import com.discordsrv.api.discord.events.message.DiscordMessageUpdateEvent;
import com.discordsrv.api.event.bus.Subscribe;
import com.discordsrv.api.event.events.discord.message.DiscordMessageDeleteEvent;
import com.discordsrv.api.event.events.discord.message.DiscordMessageUpdateEvent;
import com.discordsrv.api.event.events.message.forward.game.AbstractGameMessageForwardedEvent;
import com.discordsrv.api.event.events.message.receive.discord.DiscordChatMessageReceiveEvent;
import com.discordsrv.api.placeholder.PlainPlaceholderFormat;

View File

@ -28,9 +28,9 @@ import com.discordsrv.api.event.events.message.receive.game.AwardMessageReceiveE
import com.discordsrv.api.player.DiscordSRVPlayer;
import com.discordsrv.common.DiscordSRV;
import com.discordsrv.common.component.util.ComponentUtil;
import com.discordsrv.common.config.main.channels.server.AwardMessageConfig;
import com.discordsrv.common.config.main.channels.base.BaseChannelConfig;
import com.discordsrv.common.config.main.channels.base.server.ServerBaseChannelConfig;
import com.discordsrv.common.config.main.channels.server.AwardMessageConfig;
import com.github.benmanes.caffeine.cache.Cache;
import net.kyori.adventure.text.Component;

View File

@ -19,8 +19,8 @@
package com.discordsrv.common.placeholder.result;
import com.discordsrv.api.component.MinecraftComponent;
import com.discordsrv.api.placeholder.PlainPlaceholderFormat;
import com.discordsrv.api.placeholder.FormattedText;
import com.discordsrv.api.placeholder.PlainPlaceholderFormat;
import com.discordsrv.api.placeholder.mapper.PlaceholderResultMapper;
import com.discordsrv.common.DiscordSRV;
import com.discordsrv.common.component.util.ComponentUtil;

View File

@ -19,12 +19,12 @@
package com.discordsrv.common.player.provider;
import com.discordsrv.common.DiscordSRV;
import com.discordsrv.common.event.events.player.PlayerConnectedEvent;
import com.discordsrv.common.event.events.player.PlayerDisconnectedEvent;
import com.discordsrv.common.http.util.HttpUtil;
import com.discordsrv.common.player.IOfflinePlayer;
import com.discordsrv.common.player.IPlayer;
import com.discordsrv.common.player.OfflinePlayer;
import com.discordsrv.common.player.event.PlayerConnectedEvent;
import com.discordsrv.common.player.event.PlayerDisconnectedEvent;
import com.discordsrv.common.player.provider.model.GameProfileResponse;
import com.discordsrv.common.player.provider.model.SkinInfo;
import com.discordsrv.common.player.provider.model.Textures;

View File

@ -21,7 +21,6 @@ package com.discordsrv.common.player.provider;
import com.discordsrv.common.DiscordSRV;
import com.discordsrv.common.player.IOfflinePlayer;
import com.discordsrv.common.player.IPlayer;
import com.discordsrv.common.player.provider.AbstractPlayerProvider;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;

View File

@ -23,12 +23,12 @@ import com.discordsrv.common.DiscordSRV;
import com.discordsrv.common.config.connection.ConnectionConfig;
import com.discordsrv.common.config.connection.UpdateConfig;
import com.discordsrv.common.debug.data.VersionInfo;
import com.discordsrv.common.event.events.player.PlayerConnectedEvent;
import com.discordsrv.common.exception.MessageException;
import com.discordsrv.common.http.util.HttpUtil;
import com.discordsrv.common.logging.NamedLogger;
import com.discordsrv.common.permission.Permission;
import com.discordsrv.common.player.IPlayer;
import com.discordsrv.common.player.event.PlayerConnectedEvent;
import com.discordsrv.common.update.github.GitHubCompareResponse;
import com.discordsrv.common.update.github.GithubRelease;
import com.fasterxml.jackson.core.type.TypeReference;

View File

@ -21,11 +21,11 @@ package com.discordsrv.sponge;
import com.discordsrv.api.DiscordSRVApi;
import com.discordsrv.common.ServerDiscordSRV;
import com.discordsrv.common.command.game.handler.ICommandHandler;
import com.discordsrv.common.config.configurate.manager.ConnectionConfigManager;
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
import com.discordsrv.common.config.configurate.manager.MessagesConfigManager;
import com.discordsrv.common.config.connection.ConnectionConfig;
import com.discordsrv.common.config.main.MainConfig;
import com.discordsrv.common.config.configurate.manager.ConnectionConfigManager;
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
import com.discordsrv.common.config.messages.MessagesConfig;
import com.discordsrv.common.debug.data.OnlineMode;
import com.discordsrv.common.plugin.PluginManager;

View File

@ -20,11 +20,11 @@ package com.discordsrv.velocity;
import com.discordsrv.common.ProxyDiscordSRV;
import com.discordsrv.common.command.game.handler.ICommandHandler;
import com.discordsrv.common.config.configurate.manager.ConnectionConfigManager;
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
import com.discordsrv.common.config.configurate.manager.MessagesConfigManager;
import com.discordsrv.common.config.connection.ConnectionConfig;
import com.discordsrv.common.config.main.MainConfig;
import com.discordsrv.common.config.configurate.manager.ConnectionConfigManager;
import com.discordsrv.common.config.configurate.manager.MainConfigManager;
import com.discordsrv.common.config.messages.MessagesConfig;
import com.discordsrv.common.debug.data.OnlineMode;
import com.discordsrv.common.plugin.PluginManager;