Update D4J & role debug refined & fixed a )
PLW tested and confirmed working Moved a ) to fix #105
This commit is contained in:
parent
91f1c8c4f7
commit
e4d5dcd0a2
3 changed files with 8 additions and 8 deletions
2
pom.xml
2
pom.xml
|
@ -193,7 +193,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.discord4j</groupId>
|
<groupId>com.discord4j</groupId>
|
||||||
<artifactId>discord4j-core</artifactId>
|
<artifactId>discord4j-core</artifactId>
|
||||||
<version>3.0.6</version>
|
<version>3.0.8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-jdk14 -->
|
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-jdk14 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -233,8 +233,8 @@ public class MCChatListener implements Listener {
|
||||||
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()
|
||||||
&& !(channel instanceof PrivateChannel
|
&& !(channel instanceof PrivateChannel
|
||||||
&& author.map(u -> MCChatPrivate.isMinecraftChatEnabled(u.getId().asString())).orElse(false)
|
&& author.map(u -> MCChatPrivate.isMinecraftChatEnabled(u.getId().asString())).orElse(false))
|
||||||
&& !hasCustomChat)); //Chat isn't enabled on this channel
|
&& !hasCustomChat); //Chat isn't enabled on this channel
|
||||||
}).filter(channel -> {
|
}).filter(channel -> {
|
||||||
timings.printElapsed("Filter 2");
|
timings.printElapsed("Filter 2");
|
||||||
return !(channel instanceof PrivateChannel //Only in private chat
|
return !(channel instanceof PrivateChannel //Only in private chat
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class GameRoleModule extends Component<DiscordPlugin> {
|
||||||
@Override
|
@Override
|
||||||
protected void enable() {
|
protected void enable() {
|
||||||
getPlugin().getManager().registerCommand(new RoleCommand(this));
|
getPlugin().getManager().registerCommand(new RoleCommand(this));
|
||||||
GameRoles = DiscordPlugin.mainServer.getRoles().filterWhen(this::isGameRole).map(Role::getName).collect(Collectors.toList()).block();
|
GameRoles = DiscordPlugin.mainServer.getRoles().filterWhen(r -> isGameRole(r, false)).map(Role::getName).collect(Collectors.toList()).block();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -47,7 +47,7 @@ public class GameRoleModule extends Component<DiscordPlugin> {
|
||||||
if (roleEvent instanceof RoleCreateEvent) {
|
if (roleEvent instanceof RoleCreateEvent) {
|
||||||
Bukkit.getScheduler().runTaskLaterAsynchronously(DiscordPlugin.plugin, () -> {
|
Bukkit.getScheduler().runTaskLaterAsynchronously(DiscordPlugin.plugin, () -> {
|
||||||
Role role=((RoleCreateEvent) roleEvent).getRole();
|
Role role=((RoleCreateEvent) roleEvent).getRole();
|
||||||
grm.isGameRole(role).flatMap(b -> {
|
grm.isGameRole(role, false).flatMap(b -> {
|
||||||
if (!b)
|
if (!b)
|
||||||
return Mono.empty(); //Deleted or not a game role
|
return Mono.empty(); //Deleted or not a game role
|
||||||
GameRoles.add(role.getName());
|
GameRoles.add(role.getName());
|
||||||
|
@ -68,7 +68,7 @@ public class GameRoleModule extends Component<DiscordPlugin> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Role or=event.getOld().get();
|
Role or=event.getOld().get();
|
||||||
grm.isGameRole(event.getCurrent()).flatMap(b -> {
|
grm.isGameRole(event.getCurrent(), true).flatMap(b -> {
|
||||||
if (!b) {
|
if (!b) {
|
||||||
if (GameRoles.remove(or.getName()) && logChannel != null)
|
if (GameRoles.remove(or.getName()) && logChannel != null)
|
||||||
return logChannel.flatMap(ch -> ch.createMessage("Removed " + or.getName() + " as a game role because it's color changed."));
|
return logChannel.flatMap(ch -> ch.createMessage("Removed " + or.getName() + " as a game role because it's color changed."));
|
||||||
|
@ -89,8 +89,8 @@ public class GameRoleModule extends Component<DiscordPlugin> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Mono<Boolean> isGameRole(Role r) {
|
private Mono<Boolean> isGameRole(Role r, boolean debugMC) {
|
||||||
boolean debug = r.getName().equalsIgnoreCase("Minecraft");
|
boolean debug = debugMC && r.getName().equalsIgnoreCase("Minecraft");
|
||||||
if (debug) TBMCCoreAPI.sendDebugMessage("Checking if Minecraft is a game role...");
|
if (debug) TBMCCoreAPI.sendDebugMessage("Checking if Minecraft is a game role...");
|
||||||
if (r.getGuildId().asLong() != DiscordPlugin.mainServer.getId().asLong()) {
|
if (r.getGuildId().asLong() != DiscordPlugin.mainServer.getId().asLong()) {
|
||||||
if (debug) TBMCCoreAPI.sendDebugMessage("Not in the main server: " + r.getGuildId().asString());
|
if (debug) TBMCCoreAPI.sendDebugMessage("Not in the main server: " + r.getGuildId().asString());
|
||||||
|
|
Loading…
Reference in a new issue