Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

import com.google.inject.Inject;
import com.mojang.brigadier.context.CommandContext;
import org.anvilpowered.anvil.api.Anvil;
import org.anvilpowered.anvil.api.coremember.CoreMemberManager;
import org.anvilpowered.anvil.api.model.coremember.CoreMember;
import org.anvilpowered.anvil.api.util.TextService;
import org.anvilpowered.anvil.api.util.UserService;
import org.anvilpowered.catalyst.api.plugin.PluginMessages;
Expand Down Expand Up @@ -62,19 +65,35 @@ public int execute(CommandContext<TCommandSource> context, Class<?> consoleClass
textService.send(pluginMessages.messageSelf(), context.getSource());
return 0;
}
privateMessageService.sendMessage(
userService.getUserName((TPlayer) context.getSource()),
name,
message
);
privateMessageService.replyMap().put(
userService.getUUID(targetPlayer.get()),
userService.getUUID((TPlayer) context.getSource())
);
privateMessageService.replyMap().put(
userService.getUUID((TPlayer) context.getSource()),
userService.getUUID(targetPlayer.get())
);
Anvil.getServiceManager().provide(CoreMemberManager.class).getPrimaryComponent()
.getOneForUser(
userService.getUUID((TPlayer) context.getSource())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this up to the line before,
so it goes
.getOneForUser(userUUID)
.thenAcceptAsync()

).thenAcceptAsync(optionalMember -> {
if (!optionalMember.isPresent()) {
return;
}
CoreMember<?> coreMember = optionalMember.get();
if (Anvil.getServiceManager().provide(CoreMemberManager.class).getPrimaryComponent().checkMuted(coreMember)) {
textService.send(
pluginMessages.getMuteMessage(coreMember.getMuteReason(), coreMember.getMuteEndUtc()),
context.getSource()
);
} else {
privateMessageService.sendMessage(
userService.getUserName((TPlayer) context.getSource()),
name,
message
);
privateMessageService.replyMap().put(
userService.getUUID(targetPlayer.get()),
userService.getUUID((TPlayer) context.getSource())
);
privateMessageService.replyMap().put(
userService.getUUID((TPlayer) context.getSource()),
userService.getUUID(targetPlayer.get())
);
}
});
} else {
textService.send(pluginMessages.offlineOrInvalidPlayer(), context.getSource());
}
Expand Down