diff --git a/api/src/main/java/com/discordsrv/api/discord/api/DiscordAPI.java b/api/src/main/java/com/discordsrv/api/discord/api/DiscordAPI.java index 776631e3..77025d97 100644 --- a/api/src/main/java/com/discordsrv/api/discord/api/DiscordAPI.java +++ b/api/src/main/java/com/discordsrv/api/discord/api/DiscordAPI.java @@ -46,7 +46,7 @@ public interface DiscordAPI { * @return the message channel */ @NotNull - Optional getMessageChannelById(@NotNull String id); + Optional getMessageChannelById(long id); /** * Gets a Discord direct message channel by id, the provided entity can be cached and will not update if it changes on Discord. @@ -54,7 +54,7 @@ public interface DiscordAPI { * @return the direct message channel */ @NotNull - Optional getDirectMessageChannelById(@NotNull String id); + Optional getDirectMessageChannelById(long id); /** * Gets a Discord text channel by id, the provided entity can be cached and will not update if it changes on Discord. @@ -62,7 +62,7 @@ public interface DiscordAPI { * @return the text channel */ @NotNull - Optional getTextChannelById(@NotNull String id); + Optional getTextChannelById(long id); /** * Gets a Discord server by id, the provided entity can be cached and will not update if it changes on Discord. @@ -70,7 +70,7 @@ public interface DiscordAPI { * @return the Discord server */ @NotNull - Optional getGuildById(@NotNull String id); + Optional getGuildById(long id); /** * Gets a Discord user by id, the provided entity can be cached and will not update if it changes on Discord. @@ -78,5 +78,5 @@ public interface DiscordAPI { * @return the Discord user */ @NotNull - Optional getUserById(@NotNull String id); + Optional getUserById(long id); } diff --git a/api/src/main/java/com/discordsrv/api/discord/api/entity/Snowflake.java b/api/src/main/java/com/discordsrv/api/discord/api/entity/Snowflake.java index 74041f9d..79cef9bb 100644 --- a/api/src/main/java/com/discordsrv/api/discord/api/entity/Snowflake.java +++ b/api/src/main/java/com/discordsrv/api/discord/api/entity/Snowflake.java @@ -23,8 +23,6 @@ package com.discordsrv.api.discord.api.entity; -import org.jetbrains.annotations.NotNull; - /** * A snowflake identifier. */ @@ -34,6 +32,5 @@ public interface Snowflake { * Gets the id of this entity. * @return the id of this entity */ - @NotNull - String getId(); + long getId(); } diff --git a/api/src/main/java/com/discordsrv/api/discord/api/entity/channel/DiscordMessageChannel.java b/api/src/main/java/com/discordsrv/api/discord/api/entity/channel/DiscordMessageChannel.java index ae2ae80b..8a004c1b 100644 --- a/api/src/main/java/com/discordsrv/api/discord/api/entity/channel/DiscordMessageChannel.java +++ b/api/src/main/java/com/discordsrv/api/discord/api/entity/channel/DiscordMessageChannel.java @@ -51,7 +51,7 @@ public interface DiscordMessageChannel extends Snowflake { * @param id the id of the message to delete * @return a future that will fail if the request fails */ - CompletableFuture deleteMessageById(String id); + CompletableFuture deleteMessageById(long id); /** * Edits the message identified by the id. @@ -62,6 +62,6 @@ public interface DiscordMessageChannel extends Snowflake { * @throws com.discordsrv.api.discord.api.exception.NotReadyException if DiscordSRV is not ready, {@link com.discordsrv.api.DiscordSRVApi#isReady()} */ @NotNull - CompletableFuture editMessageById(String id, SendableDiscordMessage message); + CompletableFuture editMessageById(long id, SendableDiscordMessage message); } diff --git a/api/src/main/java/com/discordsrv/api/discord/api/entity/guild/DiscordGuild.java b/api/src/main/java/com/discordsrv/api/discord/api/entity/guild/DiscordGuild.java index f8218563..b826989b 100644 --- a/api/src/main/java/com/discordsrv/api/discord/api/entity/guild/DiscordGuild.java +++ b/api/src/main/java/com/discordsrv/api/discord/api/entity/guild/DiscordGuild.java @@ -47,13 +47,13 @@ public interface DiscordGuild { * @param id the id for the Discord guild member * @return the Discord guild member from the cache */ - Optional getMemberById(String id); + Optional getMemberById(long id); /** * Gets a Discord role by id from the cache, the provided entity can be cached and will not update if it changes on Discord. * @param id the id for the Discord role * @return the Discord role from the cache */ - Optional getRoleById(String id); + Optional getRoleById(long id); } diff --git a/api/src/main/java/com/discordsrv/api/discord/api/entity/message/AllowedMention.java b/api/src/main/java/com/discordsrv/api/discord/api/entity/message/AllowedMention.java index 5c1fe41a..37366d40 100644 --- a/api/src/main/java/com/discordsrv/api/discord/api/entity/message/AllowedMention.java +++ b/api/src/main/java/com/discordsrv/api/discord/api/entity/message/AllowedMention.java @@ -51,7 +51,7 @@ public interface AllowedMention { * @param id the id of the role * @return a {@link AllowedMention} object */ - static AllowedMention role(String id) { + static AllowedMention role(long id) { return new Snowflake(id, false); } @@ -60,7 +60,7 @@ public interface AllowedMention { * @param id the id of the user * @return a {@link AllowedMention} object */ - static AllowedMention user(String id) { + static AllowedMention user(long id) { return new Snowflake(id, true); } @@ -84,15 +84,15 @@ public interface AllowedMention { class Snowflake implements AllowedMention { - private final String id; + private final long id; private final boolean user; - public Snowflake(String id, boolean user) { + public Snowflake(long id, boolean user) { this.id = id; this.user = user; } - public String getId() { + public long getId() { return id; } diff --git a/common/src/main/java/com/discordsrv/common/channel/ChannelConfigHelper.java b/common/src/main/java/com/discordsrv/common/channel/ChannelConfigHelper.java index 7e63ea44..f8dc35ef 100644 --- a/common/src/main/java/com/discordsrv/common/channel/ChannelConfigHelper.java +++ b/common/src/main/java/com/discordsrv/common/channel/ChannelConfigHelper.java @@ -42,7 +42,7 @@ public class ChannelConfigHelper { private final DiscordSRV discordSRV; private final LoadingCache nameToChannelCache; - private final Map> discordToConfigMap; + private final Map> discordToConfigMap; public ChannelConfigHelper(DiscordSRV discordSRV) { this.discordSRV = discordSRV; @@ -74,13 +74,13 @@ public class ChannelConfigHelper { return; } - Map> newMap = new HashMap<>(); + Map> newMap = new HashMap<>(); for (Map.Entry entry : channels().entrySet()) { String channelName = entry.getKey(); BaseChannelConfig value = entry.getValue(); if (value instanceof ChannelConfig) { ChannelConfig channelConfig = (ChannelConfig) value; - for (String channelId : channelConfig.channelIds) { + for (long channelId : channelConfig.channelIds) { newMap.put(channelId, Pair.of(channelName, channelConfig)); } } @@ -88,7 +88,7 @@ public class ChannelConfigHelper { synchronized (discordToConfigMap) { discordToConfigMap.clear(); - for (Map.Entry> entry : newMap.entrySet()) { + for (Map.Entry> entry : newMap.entrySet()) { discordToConfigMap.put(entry.getKey(), entry.getValue()); } } diff --git a/common/src/main/java/com/discordsrv/common/config/main/channels/ChannelConfig.java b/common/src/main/java/com/discordsrv/common/config/main/channels/ChannelConfig.java index 0f0cf9a6..f309775a 100644 --- a/common/src/main/java/com/discordsrv/common/config/main/channels/ChannelConfig.java +++ b/common/src/main/java/com/discordsrv/common/config/main/channels/ChannelConfig.java @@ -50,6 +50,6 @@ public class ChannelConfig extends BaseChannelConfig { } @Comment("The channels this in-game channel will forward to in Discord") - public List channelIds = new ArrayList<>(Collections.singletonList("channel-id-here")); + public List channelIds = new ArrayList<>(Collections.singletonList(0L)); } diff --git a/common/src/main/java/com/discordsrv/common/discord/api/DiscordAPIImpl.java b/common/src/main/java/com/discordsrv/common/discord/api/DiscordAPIImpl.java index 6310c3f4..f97846ba 100644 --- a/common/src/main/java/com/discordsrv/common/discord/api/DiscordAPIImpl.java +++ b/common/src/main/java/com/discordsrv/common/discord/api/DiscordAPIImpl.java @@ -58,12 +58,12 @@ public class DiscordAPIImpl implements DiscordAPI { private final DiscordSRV discordSRV; - private final AsyncLoadingCache cachedClients; + private final AsyncLoadingCache cachedClients; public DiscordAPIImpl(DiscordSRV discordSRV) { this.discordSRV = discordSRV; this.cachedClients = discordSRV.caffeineBuilder() - .removalListener((RemovalListener) (id, client, cause) -> { + .removalListener((RemovalListener) (id, client, cause) -> { if (client != null) { client.close(); } @@ -72,7 +72,7 @@ public class DiscordAPIImpl implements DiscordAPI { .buildAsync(new WebhookCacheLoader()); } - public CompletableFuture queryWebhookClient(String channelId) { + public CompletableFuture queryWebhookClient(long channelId) { return cachedClients.get(channelId); } @@ -82,7 +82,7 @@ public class DiscordAPIImpl implements DiscordAPI { } @Override - public @NotNull Optional getMessageChannelById(@NotNull String id) { + public @NotNull Optional getMessageChannelById(long id) { Optional textChannel = getTextChannelById(id); if (textChannel.isPresent()) { return textChannel; @@ -92,37 +92,37 @@ public class DiscordAPIImpl implements DiscordAPI { } @Override - public @NotNull Optional getDirectMessageChannelById(@NotNull String id) { + public @NotNull Optional getDirectMessageChannelById(long id) { return discordSRV.jda() .map(jda -> jda.getPrivateChannelById(id)) .map(privateChannel -> new DiscordDMChannelImpl(discordSRV, privateChannel)); } @Override - public @NotNull Optional getTextChannelById(@NotNull String id) { + public @NotNull Optional getTextChannelById(long id) { return discordSRV.jda() .map(jda -> jda.getTextChannelById(id)) .map(textChannel -> new DiscordTextChannelImpl(discordSRV, textChannel)); } @Override - public @NotNull Optional getGuildById(@NotNull String id) { + public @NotNull Optional getGuildById(long id) { return discordSRV.jda() .map(jda -> jda.getGuildById(id)) .map(guild -> new DiscordGuildImpl(discordSRV, guild)); } @Override - public @NotNull Optional getUserById(@NotNull String id) { + public @NotNull Optional getUserById(long id) { return discordSRV.jda() .map(jda -> jda.getUserById(id)) .map(DiscordUserImpl::new); } - private class WebhookCacheLoader implements AsyncCacheLoader { + private class WebhookCacheLoader implements AsyncCacheLoader { @Override - public @NonNull CompletableFuture asyncLoad(@NonNull String channelId, @NonNull Executor executor) { + public @NonNull CompletableFuture asyncLoad(@NonNull Long channelId, @NonNull Executor executor) { CompletableFuture future = new CompletableFuture<>(); JDA jda = discordSRV.jda().orElse(null); @@ -169,9 +169,9 @@ public class DiscordAPIImpl implements DiscordAPI { } } - private class WebhookCacheExpiry implements Expiry { + private class WebhookCacheExpiry implements Expiry { - private boolean isConfiguredChannel(String channelId) { + private boolean isConfiguredChannel(Long channelId) { for (BaseChannelConfig config : discordSRV.config().channels.values()) { if (config instanceof ChannelConfig && ((ChannelConfig) config).channelIds.contains(channelId)) { @@ -181,22 +181,22 @@ public class DiscordAPIImpl implements DiscordAPI { return false; } - private long expireAfterWrite(String channelId) { + private long expireAfterWrite(Long channelId) { return isConfiguredChannel(channelId) ? Long.MAX_VALUE : TimeUnit.MINUTES.toNanos(15); } @Override - public long expireAfterCreate(@NonNull String channelId, @NonNull WebhookClient webhookClient, long currentTime) { + public long expireAfterCreate(@NonNull Long channelId, @NonNull WebhookClient webhookClient, long currentTime) { return expireAfterWrite(channelId); } @Override - public long expireAfterUpdate(@NonNull String channelId, @NonNull WebhookClient webhookClient, long currentTime, @NonNegative long currentDuration) { + public long expireAfterUpdate(@NonNull Long channelId, @NonNull WebhookClient webhookClient, long currentTime, @NonNegative long currentDuration) { return expireAfterWrite(channelId); } @Override - public long expireAfterRead(@NonNull String channelId, @NonNull WebhookClient webhookClient, long currentTime, @NonNegative long currentDuration) { + public long expireAfterRead(@NonNull Long channelId, @NonNull WebhookClient webhookClient, long currentTime, @NonNegative long currentDuration) { return isConfiguredChannel(channelId) ? Long.MAX_VALUE : TimeUnit.MINUTES.toNanos(10); } } diff --git a/common/src/main/java/com/discordsrv/common/discord/api/channel/DiscordDMChannelImpl.java b/common/src/main/java/com/discordsrv/common/discord/api/channel/DiscordDMChannelImpl.java index 1610ea4c..6bb0cdee 100644 --- a/common/src/main/java/com/discordsrv/common/discord/api/channel/DiscordDMChannelImpl.java +++ b/common/src/main/java/com/discordsrv/common/discord/api/channel/DiscordDMChannelImpl.java @@ -37,12 +37,12 @@ import java.util.concurrent.CompletableFuture; public class DiscordDMChannelImpl extends DiscordMessageChannelImpl implements DiscordDMChannel { private final DiscordSRV discordSRV; - private final String id; + private final long id; private final DiscordUser user; public DiscordDMChannelImpl(DiscordSRV discordSRV, PrivateChannel privateChannel) { this.discordSRV = discordSRV; - this.id = privateChannel.getId(); + this.id = privateChannel.getIdLong(); this.user = new DiscordUserImpl(privateChannel.getUser()); } @@ -61,7 +61,7 @@ public class DiscordDMChannelImpl extends DiscordMessageChannelImpl implements D } @Override - public @NotNull String getId() { + public long getId() { return id; } @@ -84,7 +84,7 @@ public class DiscordDMChannelImpl extends DiscordMessageChannelImpl implements D } @Override - public CompletableFuture deleteMessageById(String id) { + public CompletableFuture deleteMessageById(long id) { CompletableFuture future = privateChannel() .deleteMessageById(id) .submit(); @@ -92,7 +92,7 @@ public class DiscordDMChannelImpl extends DiscordMessageChannelImpl implements D } @Override - public @NotNull CompletableFuture editMessageById(String id, SendableDiscordMessage message) { + public @NotNull CompletableFuture editMessageById(long id, SendableDiscordMessage message) { if (message.isWebhookMessage()) { throw new IllegalArgumentException("Cannot send webhook messages to DMChannels"); } diff --git a/common/src/main/java/com/discordsrv/common/discord/api/channel/DiscordTextChannelImpl.java b/common/src/main/java/com/discordsrv/common/discord/api/channel/DiscordTextChannelImpl.java index 3982869b..726afbfc 100644 --- a/common/src/main/java/com/discordsrv/common/discord/api/channel/DiscordTextChannelImpl.java +++ b/common/src/main/java/com/discordsrv/common/discord/api/channel/DiscordTextChannelImpl.java @@ -36,7 +36,6 @@ import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.entities.MessageChannel; import net.dv8tion.jda.api.entities.TextChannel; import net.dv8tion.jda.api.requests.restaction.MessageAction; -import net.dv8tion.jda.api.utils.MiscUtil; import org.jetbrains.annotations.NotNull; import java.util.concurrent.CompletableFuture; @@ -45,21 +44,21 @@ import java.util.function.BiFunction; public class DiscordTextChannelImpl extends DiscordMessageChannelImpl implements DiscordTextChannel { private final DiscordSRV discordSRV; - private final String id; + private final long id; private final String name; private final String topic; private final DiscordGuild guild; public DiscordTextChannelImpl(DiscordSRV discordSRV, TextChannel textChannel) { this.discordSRV = discordSRV; - this.id = textChannel.getId(); + this.id = textChannel.getIdLong(); this.name = textChannel.getName(); this.topic = textChannel.getTopic(); this.guild = new DiscordGuildImpl(discordSRV, textChannel.getGuild()); } @Override - public @NotNull String getId() { + public long getId() { return id; } @@ -84,15 +83,15 @@ public class DiscordTextChannelImpl extends DiscordMessageChannelImpl implements } @Override - public CompletableFuture deleteMessageById(String id) { + public CompletableFuture deleteMessageById(long id) { return null; // TODO } @Override - public @NotNull CompletableFuture editMessageById(String id, SendableDiscordMessage message) { + public @NotNull CompletableFuture editMessageById(long id, SendableDiscordMessage message) { return message( message, - (client, msg) -> client.edit(MiscUtil.parseLong(id), msg), + (client, msg) -> client.edit(id, msg), (textChannel, msg) -> textChannel.editMessageById(id, msg) ); } diff --git a/common/src/main/java/com/discordsrv/common/discord/api/guild/DiscordGuildImpl.java b/common/src/main/java/com/discordsrv/common/discord/api/guild/DiscordGuildImpl.java index 836ca485..9b05631f 100644 --- a/common/src/main/java/com/discordsrv/common/discord/api/guild/DiscordGuildImpl.java +++ b/common/src/main/java/com/discordsrv/common/discord/api/guild/DiscordGuildImpl.java @@ -54,14 +54,14 @@ public class DiscordGuildImpl implements DiscordGuild { } @Override - public Optional getMemberById(String id) { + public Optional getMemberById(long id) { return guild() .map(guild -> guild.getMemberById(id)) .map(DiscordGuildMemberImpl::new); } @Override - public Optional getRoleById(String id) { + public Optional getRoleById(long id) { return guild() .map(guild -> guild.getRoleById(id)) .map(DiscordRoleImpl::new); diff --git a/common/src/main/java/com/discordsrv/common/discord/api/guild/DiscordRoleImpl.java b/common/src/main/java/com/discordsrv/common/discord/api/guild/DiscordRoleImpl.java index 7b885aba..d8c41671 100644 --- a/common/src/main/java/com/discordsrv/common/discord/api/guild/DiscordRoleImpl.java +++ b/common/src/main/java/com/discordsrv/common/discord/api/guild/DiscordRoleImpl.java @@ -24,16 +24,16 @@ import org.jetbrains.annotations.NotNull; public class DiscordRoleImpl implements DiscordRole { - private final String id; + private final long id; private final String name; public DiscordRoleImpl(Role role) { - this.id = role.getId(); + this.id = role.getIdLong(); this.name = role.getName(); } @Override - public @NotNull String getId() { + public long getId() { return id; } diff --git a/common/src/main/java/com/discordsrv/common/discord/api/message/ReceivedDiscordMessageImpl.java b/common/src/main/java/com/discordsrv/common/discord/api/message/ReceivedDiscordMessageImpl.java index a231f16e..92a24632 100644 --- a/common/src/main/java/com/discordsrv/common/discord/api/message/ReceivedDiscordMessageImpl.java +++ b/common/src/main/java/com/discordsrv/common/discord/api/message/ReceivedDiscordMessageImpl.java @@ -60,8 +60,8 @@ public class ReceivedDiscordMessageImpl extends SendableDiscordMessageImpl imple discordSRV, textChannel, user, - message.getChannel().getId(), - message.getId(), + message.getChannel().getIdLong(), + message.getIdLong(), message.getContentRaw(), mappedEmbeds, webhookUsername, @@ -109,15 +109,15 @@ public class ReceivedDiscordMessageImpl extends SendableDiscordMessageImpl imple : String.format(User.DEFAULT_AVATAR_URL, Integer.parseInt(author.getDiscriminator()) % 5); DiscordTextChannel textChannel = discordSRV.discordAPI().getTextChannelById( - Long.toUnsignedString(webhookMessage.getChannelId())).orElse(null); + webhookMessage.getChannelId()).orElse(null); DiscordUser user = discordSRV.discordAPI().getUserById( - Long.toUnsignedString(webhookMessage.getAuthor().getId())).orElse(null); + webhookMessage.getAuthor().getId()).orElse(null); return new ReceivedDiscordMessageImpl( discordSRV, textChannel, user, - Long.toUnsignedString(webhookMessage.getChannelId()), - Long.toUnsignedString(webhookMessage.getId()), + webhookMessage.getChannelId(), + webhookMessage.getId(), webhookMessage.getContent(), mappedEmbeds, author.getName(), @@ -128,15 +128,15 @@ public class ReceivedDiscordMessageImpl extends SendableDiscordMessageImpl imple private final DiscordSRV discordSRV; private final DiscordTextChannel textChannel; private final DiscordUser author; - private final String channelId; - private final String id; + private final long channelId; + private final long id; private ReceivedDiscordMessageImpl( DiscordSRV discordSRV, DiscordTextChannel textChannel, DiscordUser author, - String channelId, - String id, + long channelId, + long id, String content, List embeds, String webhookUsername, @@ -151,7 +151,7 @@ public class ReceivedDiscordMessageImpl extends SendableDiscordMessageImpl imple } @Override - public @NotNull String getId() { + public long getId() { return id; } diff --git a/common/src/main/java/com/discordsrv/common/discord/api/message/util/SendableDiscordMessageUtil.java b/common/src/main/java/com/discordsrv/common/discord/api/message/util/SendableDiscordMessageUtil.java index 718dcfe8..d5e4cd62 100644 --- a/common/src/main/java/com/discordsrv/common/discord/api/message/util/SendableDiscordMessageUtil.java +++ b/common/src/main/java/com/discordsrv/common/discord/api/message/util/SendableDiscordMessageUtil.java @@ -38,14 +38,14 @@ public final class SendableDiscordMessageUtil { public static Message toJDA(@NotNull SendableDiscordMessage message) { List allowedTypes = new ArrayList<>(); - List allowedUsers = new ArrayList<>(); - List allowedRoles = new ArrayList<>(); + List allowedUsers = new ArrayList<>(); + List allowedRoles = new ArrayList<>(); Set allowedMentions = message.getAllowedMentions(); if (allowedMentions != null) { for (AllowedMention allowedMention : allowedMentions) { if (allowedMention instanceof AllowedMention.Snowflake) { - String id = ((AllowedMention.Snowflake) allowedMention).getId(); + long id = ((AllowedMention.Snowflake) allowedMention).getId(); if (((AllowedMention.Snowflake) allowedMention).isUser()) { allowedUsers.add(id); } else { @@ -66,8 +66,8 @@ public final class SendableDiscordMessageUtil { .setContent(message.getContent()) .setEmbeds(embeds) .setAllowedMentions(allowedTypes) - .mentionUsers(allowedUsers.toArray(new String[0])) - .mentionRoles(allowedRoles.toArray(new String[0])) + .mentionUsers(allowedUsers.stream().mapToLong(l -> l).toArray()) + .mentionRoles(allowedRoles.stream().mapToLong(l -> l).toArray()) .build(); } diff --git a/common/src/main/java/com/discordsrv/common/discord/api/user/DiscordUserImpl.java b/common/src/main/java/com/discordsrv/common/discord/api/user/DiscordUserImpl.java index b615c5c8..d8e23029 100644 --- a/common/src/main/java/com/discordsrv/common/discord/api/user/DiscordUserImpl.java +++ b/common/src/main/java/com/discordsrv/common/discord/api/user/DiscordUserImpl.java @@ -24,18 +24,18 @@ import org.jetbrains.annotations.NotNull; public class DiscordUserImpl implements DiscordUser { - private final String id; + private final long id; private final String username; private final String discriminator; public DiscordUserImpl(User user) { - this.id = user.getId(); + this.id = user.getIdLong(); this.username = user.getName(); this.discriminator = user.getDiscriminator(); } @Override - public @NotNull String getId() { + public long getId() { return id; } diff --git a/common/src/main/java/com/discordsrv/common/listener/GameChatListener.java b/common/src/main/java/com/discordsrv/common/listener/GameChatListener.java index 46e87ed8..2da7f02c 100644 --- a/common/src/main/java/com/discordsrv/common/listener/GameChatListener.java +++ b/common/src/main/java/com/discordsrv/common/listener/GameChatListener.java @@ -67,13 +67,13 @@ public class GameChatListener extends AbstractListener { .addReplacement("%message%", DiscordSerializer.INSTANCE.serialize(message)) .build(); - List channelIds = channelConfig.get(cfg -> cfg instanceof ChannelConfig ? ((ChannelConfig) cfg).channelIds : null); + List channelIds = channelConfig.get(cfg -> cfg instanceof ChannelConfig ? ((ChannelConfig) cfg).channelIds : null); if (channelIds == null || channelIds.isEmpty()) { return; } List> futures = new ArrayList<>(); - for (String channelId : channelIds) { + for (Long channelId : channelIds) { discordSRV.discordAPI().getTextChannelById(channelId).ifPresent(textChannel -> futures.add(textChannel.sendMessage(discordMessage))); } diff --git a/sponge/loader/src/main/java/com/discordsrv/sponge/loader/DiscordSRVSpongeLoader.java b/sponge/loader/src/main/java/com/discordsrv/sponge/loader/DiscordSRVSpongeLoader.java index fec1140f..df9f1c6b 100644 --- a/sponge/loader/src/main/java/com/discordsrv/sponge/loader/DiscordSRVSpongeLoader.java +++ b/sponge/loader/src/main/java/com/discordsrv/sponge/loader/DiscordSRVSpongeLoader.java @@ -32,7 +32,7 @@ import org.spongepowered.api.event.lifecycle.RefreshGameEvent; import org.spongepowered.api.event.lifecycle.StartedEngineEvent; import org.spongepowered.api.event.lifecycle.StoppingEngineEvent; import org.spongepowered.plugin.PluginContainer; -import org.spongepowered.plugin.jvm.Plugin; +import org.spongepowered.plugin.builtin.jvm.Plugin; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException;