Fix /mcchat not using the configured prefix
This commit is contained in:
parent
3ee1eb3dec
commit
d784d8b1e2
4 changed files with 5 additions and 4 deletions
|
@ -180,7 +180,7 @@ public class DiscordPlugin extends ButtonPlugin {
|
||||||
Component.registerComponent(this, new GameRoleModule()); //Needs the mainServer to be set
|
Component.registerComponent(this, new GameRoleModule()); //Needs the mainServer to be set
|
||||||
Component.registerComponent(this, new AnnouncerModule());
|
Component.registerComponent(this, new AnnouncerModule());
|
||||||
Component.registerComponent(this, new FunModule());
|
Component.registerComponent(this, new FunModule());
|
||||||
new ChromaBot(this).updatePlayerList(); //Initialize ChromaBot - The MCCHatModule is tested to be enabled
|
new ChromaBot(this).updatePlayerList(); //Initialize ChromaBot - The MCChatModule is tested to be enabled
|
||||||
|
|
||||||
getManager().registerCommand(new VersionCommand());
|
getManager().registerCommand(new VersionCommand());
|
||||||
getManager().registerCommand(new UserinfoCommand());
|
getManager().registerCommand(new UserinfoCommand());
|
||||||
|
|
|
@ -225,6 +225,7 @@ public class MCChatListener implements Listener {
|
||||||
timings.printElapsed("Chat event");
|
timings.printElapsed("Chat event");
|
||||||
val author = ev.getMessage().getAuthor();
|
val author = ev.getMessage().getAuthor();
|
||||||
final boolean hasCustomChat = MCChatCustom.hasCustomChat(ev.getMessage().getChannelId());
|
final boolean hasCustomChat = MCChatCustom.hasCustomChat(ev.getMessage().getChannelId());
|
||||||
|
var prefix = DiscordPlugin.getPrefix();
|
||||||
return ev.getMessage().getChannel().filter(channel -> {
|
return ev.getMessage().getChannel().filter(channel -> {
|
||||||
timings.printElapsed("Filter 1");
|
timings.printElapsed("Filter 1");
|
||||||
return !(ev.getMessage().getChannelId().asLong() != module.chatChannel().get().asLong()
|
return !(ev.getMessage().getChannelId().asLong() != module.chatChannel().get().asLong()
|
||||||
|
@ -236,7 +237,7 @@ public class MCChatListener implements Listener {
|
||||||
return !(channel instanceof PrivateChannel //Only in private chat
|
return !(channel instanceof PrivateChannel //Only in private chat
|
||||||
&& ev.getMessage().getContent().isPresent()
|
&& ev.getMessage().getContent().isPresent()
|
||||||
&& ev.getMessage().getContent().get().length() < "/mcchat<>".length()
|
&& ev.getMessage().getContent().get().length() < "/mcchat<>".length()
|
||||||
&& ev.getMessage().getContent().get().replace("/", "")
|
&& ev.getMessage().getContent().get().replace(prefix + "", "")
|
||||||
.equalsIgnoreCase("mcchat")); //Either mcchat or /mcchat
|
.equalsIgnoreCase("mcchat")); //Either mcchat or /mcchat
|
||||||
//Allow disabling the chat if needed
|
//Allow disabling the chat if needed
|
||||||
}).filterWhen(channel -> CommandListener.runCommand(ev.getMessage(), channel, true))
|
}).filterWhen(channel -> CommandListener.runCommand(ev.getMessage(), channel, true))
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class MCChatUtils {
|
||||||
LastMsgData lastmsgdata;
|
LastMsgData lastmsgdata;
|
||||||
static LongObjectHashMap<Message> lastmsgfromd = new LongObjectHashMap<>(); // Last message sent by a Discord user, used for clearing checkmarks
|
static LongObjectHashMap<Message> lastmsgfromd = new LongObjectHashMap<>(); // Last message sent by a Discord user, used for clearing checkmarks
|
||||||
private static MinecraftChatModule module;
|
private static MinecraftChatModule module;
|
||||||
private static HashMap<Class<? extends Event>, HashSet<String>> staticExcludedPlugins = new HashMap<>();
|
private static final HashMap<Class<? extends Event>, HashSet<String>> staticExcludedPlugins = new HashMap<>();
|
||||||
|
|
||||||
public static void updatePlayerList() {
|
public static void updatePlayerList() {
|
||||||
val mod = getModule();
|
val mod = getModule();
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class MinecraftChatModule extends Component<DiscordPlugin> {
|
||||||
/**
|
/**
|
||||||
* If this is on, each chat channel will have a player list in their description.
|
* If this is on, each chat channel will have a player list in their description.
|
||||||
* It only gets added if there's no description yet or there are (at least) two lines of "----" following each other.
|
* It only gets added if there's no description yet or there are (at least) two lines of "----" following each other.
|
||||||
* Note that it will replace <b>everything</b> between the first and last "----" but it will only detect exactly four dashes.
|
* Note that it will replace <b>everything</b> above the first and below the last "----" but it will only detect exactly four dashes.
|
||||||
* So if you want to use dashes for something else in the description, make sure it's either less or more dashes in one line.
|
* So if you want to use dashes for something else in the description, make sure it's either less or more dashes in one line.
|
||||||
*/
|
*/
|
||||||
public ConfigData<Boolean> showPlayerListOnDC() {
|
public ConfigData<Boolean> showPlayerListOnDC() {
|
||||||
|
|
Loading…
Reference in a new issue