Fix custom chat PL update NPE (#124)
This commit is contained in:
parent
1fa2635317
commit
ffdf5a2f18
4 changed files with 11 additions and 15 deletions
|
@ -1,4 +1,4 @@
|
|||
# DiscordPlugin
|
||||
# Chroma-Discord
|
||||
A plugin that provides Minecraft chat functionality and other features.
|
||||
|
||||
## Setup
|
||||
|
|
6
pom.xml
6
pom.xml
|
@ -170,12 +170,6 @@
|
|||
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc.</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.14.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.discord4j/Discord4J -->
|
||||
<dependency>
|
||||
<groupId>com.discord4j</groupId>
|
||||
|
|
|
@ -109,7 +109,7 @@ public class DiscordPlugin extends ButtonPlugin {
|
|||
getLogger().info("Initializing...");
|
||||
plugin = this;
|
||||
manager = new Command2DC();
|
||||
getCommand2MC().registerCommand(new DiscordMCCommand()); //Register so that the reset command works
|
||||
registerCommand(new DiscordMCCommand()); //Register so that the reset command works
|
||||
String token;
|
||||
File tokenFile = new File("TBMC", "Token.txt");
|
||||
if (tokenFile.exists()) //Legacy support
|
||||
|
@ -214,7 +214,6 @@ public class DiscordPlugin extends ButtonPlugin {
|
|||
TBMCCoreAPI.RegisterUserClass(DiscordPlayer.class);
|
||||
ChromaGamerBase.addConverter(sender -> Optional.ofNullable(sender instanceof DiscordSenderBase
|
||||
? ((DiscordSenderBase) sender).getChromaUser() : null));
|
||||
setupProviders();
|
||||
|
||||
IHaveConfig.pregenConfig(this, null);
|
||||
if (!TBMCCoreAPI.IsTestServer()) {
|
||||
|
|
|
@ -49,7 +49,8 @@ public class MCChatUtils {
|
|||
* May contain P<DiscordID> as key for public chat
|
||||
*/
|
||||
public static final HashMap<String, HashMap<Snowflake, DiscordPlayerSender>> OnlineSenders = new HashMap<>();
|
||||
static @Nullable LastMsgData lastmsgdata;
|
||||
static @Nullable
|
||||
LastMsgData lastmsgdata;
|
||||
static LongObjectHashMap<Message> lastmsgfromd = new LongObjectHashMap<>(); // Last message sent by a Discord user, used for clearing checkmarks
|
||||
private static MinecraftChatModule module;
|
||||
private static HashMap<Class<? extends Event>, HashSet<String>> staticExcludedPlugins = new HashMap<>();
|
||||
|
@ -91,7 +92,9 @@ public class MCChatUtils {
|
|||
gid = buttondevteam.core.component.channel.Channel.GROUP_EVERYONE; // (Though it's a public chat then rn)
|
||||
AtomicInteger C = new AtomicInteger();
|
||||
s[s.length - 1] = "Players: " + Bukkit.getOnlinePlayers().stream()
|
||||
.filter(p -> gid.equals(lmd.mcchannel.getGroupID(p))) //If they can see it
|
||||
.filter(p -> (lmd.mcchannel == null
|
||||
? gid.equals(buttondevteam.core.component.channel.Channel.GROUP_EVERYONE) //If null, allow if public (custom chats will have their channel stored anyway)
|
||||
: gid.equals(lmd.mcchannel.getGroupID(p)))) //If they can see it
|
||||
.filter(MCChatUtils::checkEssentials)
|
||||
.filter(p -> C.incrementAndGet() > 0) //Always true
|
||||
.map(p -> DPUtils.sanitizeString(p.getDisplayName())).collect(Collectors.joining(", "));
|
||||
|
|
Loading…
Reference in a new issue