Added private Minecraft chat, Discord login, show message pinning, Maven project check, some of #12 #39

Merged
NorbiPeti merged 21 commits from dev into master 2017-07-04 16:14:01 +00:00
3 changed files with 5 additions and 4 deletions
Showing only changes of commit 9abb342aa9 - Show all commits

View file

@ -20,6 +20,7 @@ public abstract class DiscordCommandBase {
commands.put("userinfo", new UserinfoCommand());
commands.put("help", new HelpCommand());
commands.put("role", new RoleCommand());
commands.put("mcchat", new MCChatCommand());
}
public static void runCommand(String cmd, String args, IMessage message) {

View file

@ -19,7 +19,7 @@ public class MCChatCommand extends DiscordCommandBase {
}
PlayerData<Boolean> mcchat = DiscordPlayer.getUser(message.getAuthor().getStringID(), DiscordPlayer.class)
.minecraftChat();
mcchat.set(!mcchat.get());
mcchat.set(!mcchat.getOrDefault(false));
message.reply("Minecraft chat " + (mcchat.get() ? "enabled." : "disabled."));
}

View file

@ -64,7 +64,7 @@ public class MCChatListener implements Listener, IListener<MessageReceivedEvent>
final IUser iUser = data.channel.getUsersHere().stream()
.filter(u -> u.getLongID() != u.getClient().getOurUser().getLongID()).findFirst().get(); // Doesn't support group DMs
final DiscordPlayer user = DiscordPlayer.getUser(iUser.getStringID(), DiscordPlayer.class);
if (user.minecraftChat().get() && e.shouldSendTo(getSender(data.channel, iUser, user)))
if (user.minecraftChat().getOrDefault(false) && e.shouldSendTo(getSender(data.channel, iUser, user)))
doit.accept(data);
}
} // TODO: Author URL
@ -125,8 +125,8 @@ public class MCChatListener implements Listener, IListener<MessageReceivedEvent>
public void handle(MessageReceivedEvent event) {
final IUser author = event.getMessage().getAuthor();
if (!event.getMessage().getChannel().getStringID().equals(DiscordPlugin.chatchannel.getStringID())
&& !(event.getMessage().getChannel().isPrivate()
&& DiscordPlayer.getUser(author.getStringID(), DiscordPlayer.class).minecraftChat().get()))
&& !(event.getMessage().getChannel().isPrivate() && DiscordPlayer
.getUser(author.getStringID(), DiscordPlayer.class).minecraftChat().getOrDefault(false)))
return;
resetLastMessage();
lastlist++;