mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-01 05:57:09 +00:00
Fix Minor Discrepancy
This commit is contained in:
parent
3a6e7921cc
commit
f9ecebd5c9
@ -241,16 +241,6 @@ public class Bot
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextChannel channel = server.getChannelById(SnowflakeEntry.reportChannelID)
|
|
||||||
.ofType(TextChannel.class)
|
|
||||||
.block();
|
|
||||||
|
|
||||||
if (channel == null)
|
|
||||||
{
|
|
||||||
FLog.severe("The report channel ID specified in the config is invalid.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import discord4j.core.object.Embed;
|
|||||||
import discord4j.core.object.entity.Member;
|
import discord4j.core.object.entity.Member;
|
||||||
import discord4j.core.object.entity.Message;
|
import discord4j.core.object.entity.Message;
|
||||||
import discord4j.core.object.entity.channel.Channel;
|
import discord4j.core.object.entity.channel.Channel;
|
||||||
|
import discord4j.core.object.entity.channel.TextChannel;
|
||||||
import discord4j.discordjson.json.MessageCreateRequest;
|
import discord4j.discordjson.json.MessageCreateRequest;
|
||||||
import me.totalfreedom.discord.TFD4J;
|
import me.totalfreedom.discord.TFD4J;
|
||||||
import me.totalfreedom.discord.util.SnowflakeEntry;
|
import me.totalfreedom.discord.util.SnowflakeEntry;
|
||||||
@ -44,13 +45,12 @@ public class ReactionListener
|
|||||||
|
|
||||||
public void reactionWork(ReactionAddEvent event)
|
public void reactionWork(ReactionAddEvent event)
|
||||||
{
|
{
|
||||||
final Channel archiveChannel = tfd4j.getBot().getClient().getChannelById(SnowflakeEntry.archiveChannelID).block();
|
final TextChannel archiveChannel = tfd4j.getBot()
|
||||||
|
.getClient()
|
||||||
if (archiveChannel == null)
|
.getChannelById(SnowflakeEntry.archiveChannelID)
|
||||||
{
|
.ofType(TextChannel.class)
|
||||||
FLog.warning("Report archive channel is defined in the config, yet doesn't actually exist!");
|
.blockOptional()
|
||||||
return;
|
.orElseThrow();
|
||||||
}
|
|
||||||
|
|
||||||
final Message message = event.getMessage().blockOptional().orElseThrow();
|
final Message message = event.getMessage().blockOptional().orElseThrow();
|
||||||
final Member completer = event.getMember().orElseThrow();
|
final Member completer = event.getMember().orElseThrow();
|
||||||
|
@ -14,6 +14,7 @@ import me.totalfreedom.discord.TFD4J;
|
|||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
import org.apache.commons.lang.WordUtils;
|
import org.apache.commons.lang.WordUtils;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import reactor.core.publisher.Flux;
|
import reactor.core.publisher.Flux;
|
||||||
@ -136,9 +137,10 @@ public class Utilities
|
|||||||
|
|
||||||
if (server == null) return false;
|
if (server == null) return false;
|
||||||
|
|
||||||
final Channel channel = server.getChannelById(SnowflakeEntry.reportChannelID).block();
|
final TextChannel channel = server.getChannelById(SnowflakeEntry.reportChannelID)
|
||||||
|
.ofType(TextChannel.class)
|
||||||
if (!(channel instanceof TextChannel tch)) return false;
|
.blockOptional()
|
||||||
|
.orElseThrow();
|
||||||
|
|
||||||
final EmbedCreateSpec.Builder builder = EmbedCreateSpec.builder()
|
final EmbedCreateSpec.Builder builder = EmbedCreateSpec.builder()
|
||||||
.title("Report for " + reported.getName() + " (offline)")
|
.title("Report for " + reported.getName() + " (offline)")
|
||||||
@ -157,7 +159,7 @@ public class Utilities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
EmbedCreateSpec embed = builder.build();
|
EmbedCreateSpec embed = builder.build();
|
||||||
Message message = tch.createMessage(embed).block();
|
Message message = channel.createMessage(embed).block();
|
||||||
|
|
||||||
if (message != null && !ConfigEntry.DISCORD_REPORT_ARCHIVE_CHANNEL_ID.getString().isEmpty())
|
if (message != null && !ConfigEntry.DISCORD_REPORT_ARCHIVE_CHANNEL_ID.getString().isEmpty())
|
||||||
{
|
{
|
||||||
@ -187,13 +189,9 @@ public class Utilities
|
|||||||
|
|
||||||
final TextChannel channel = server.getChannelById(SnowflakeEntry.reportChannelID)
|
final TextChannel channel = server.getChannelById(SnowflakeEntry.reportChannelID)
|
||||||
.ofType(TextChannel.class)
|
.ofType(TextChannel.class)
|
||||||
.block();
|
.blockOptional()
|
||||||
|
.orElseThrow();
|
||||||
|
|
||||||
if (channel == null)
|
|
||||||
{
|
|
||||||
FLog.severe("The report channel ID specified in the config is invalid.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
String location = "World: " + Objects.requireNonNull(reported.getLocation().getWorld()).getName() + ", X: " + reported.getLocation().getBlockX() + ", Y: " + reported.getLocation().getBlockY() + ", Z: " + reported.getLocation().getBlockZ();
|
String location = "World: " + Objects.requireNonNull(reported.getLocation().getWorld()).getName() + ", X: " + reported.getLocation().getBlockX() + ", Y: " + reported.getLocation().getBlockY() + ", Z: " + reported.getLocation().getBlockZ();
|
||||||
|
|
||||||
final EmbedCreateSpec spec = EmbedCreateSpec.builder()
|
final EmbedCreateSpec spec = EmbedCreateSpec.builder()
|
||||||
|
Loading…
Reference in New Issue
Block a user