Fix some things, disable some modules by default

This commit is contained in:
Norbi Peti 2020-10-30 00:56:08 +01:00
parent e57974ebcd
commit 64994ee44e
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
6 changed files with 16 additions and 19 deletions

11
pom.xml
View file

@ -23,6 +23,7 @@
<resources> <resources>
<resource> <resource>
<directory>src/main/resources</directory> <directory>src/main/resources</directory>
<filtering>true</filtering>
</resource> </resource>
</resources> </resources>
<finalName>Chroma-Discord</finalName> <finalName>Chroma-Discord</finalName>
@ -39,8 +40,10 @@
</goals> </goals>
<configuration> <configuration>
<artifactSet> <artifactSet>
<excludes> <!-- <includes>
</excludes> <!-- http://stackoverflow.com/questions/28458058/maven-shade-plugin-exclude-a-dependency-and-all-its-transitive-dependencies --> <include>com.discord4j:discord4j*</include>
<include>com.vdurmont:emoji-java</include>
</includes> --> <!-- http://stackoverflow.com/questions/28458058/maven-shade-plugin-exclude-a-dependency-and-all-its-transitive-dependencies -->
</artifactSet> </artifactSet>
<!-- <minimizeJar>true</minimizeJar> Tried using filters but we need pretty much all of that 12 MB --> <!-- <minimizeJar>true</minimizeJar> Tried using filters but we need pretty much all of that 12 MB -->
<relocations> <relocations>
@ -148,11 +151,11 @@
<version>3.1.1</version> <version>3.1.1</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-jdk14 --> <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-jdk14 -->
<dependency> <!-- <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId> <artifactId>slf4j-jdk14</artifactId>
<version>1.7.21</version> <version>1.7.21</version>
</dependency> </dependency> -->
<dependency> <dependency>
<groupId>com.github.TBMCPlugins.ChromaCore</groupId> <groupId>com.github.TBMCPlugins.ChromaCore</groupId>
<artifactId>Chroma-Core</artifactId> <artifactId>Chroma-Core</artifactId>

View file

@ -218,15 +218,6 @@ public class DiscordPlugin extends ButtonPlugin {
TBMCCoreAPI.SendUnsentExceptions(); TBMCCoreAPI.SendUnsentExceptions();
TBMCCoreAPI.SendUnsentDebugMessages(); TBMCCoreAPI.SendUnsentDebugMessages();
//Bukkit.getLogger().addHandler(new BukkitLogWatcher());
/*val lc = (LoggerContext) LogManager.getContext(false);
var blw = new BukkitLogWatcher();
blw.start();
lc.getConfiguration().addAppender(blw);
Logger logger = lc.getRootLogger();
logger.addAppender(lc.getConfiguration().getAppender(blw.getName()));
logger.get().addAppender(blw, Level.INFO, blw.getFilter());
lc.updateLoggers();*/
var blw = new BukkitLogWatcher(); var blw = new BukkitLogWatcher();
blw.start(); blw.start();
((Logger) LogManager.getRootLogger()).addAppender(blw); ((Logger) LogManager.getRootLogger()).addAppender(blw);
@ -274,8 +265,6 @@ public class DiscordPlugin extends ButtonPlugin {
try { try {
SafeMode = true; // Stop interacting with Discord SafeMode = true; // Stop interacting with Discord
ChromaBot.delete(); ChromaBot.delete();
//timings.printElapsed("Updating presence...");
//dc.updatePresence(Presence.idle(Activity.playing("logging out"))).block(); //No longer using the same account for testing
((Logger) LogManager.getRootLogger()).removeAppender(logWatcher); ((Logger) LogManager.getRootLogger()).removeAppender(logWatcher);
timings.printElapsed("Logging out..."); timings.printElapsed("Logging out...");
dc.logout().block(); dc.logout().block();

View file

@ -3,12 +3,14 @@ package buttondevteam.discordplugin.broadcaster;
import buttondevteam.discordplugin.DiscordPlugin; import buttondevteam.discordplugin.DiscordPlugin;
import buttondevteam.lib.TBMCCoreAPI; import buttondevteam.lib.TBMCCoreAPI;
import buttondevteam.lib.architecture.Component; import buttondevteam.lib.architecture.Component;
import buttondevteam.lib.architecture.ComponentMetadata;
import lombok.Getter; import lombok.Getter;
/** /**
* Uses a bit of a hacky method of getting all broadcasted messages, including advancements and any other message that's for everyone. * Uses a bit of a hacky method of getting all broadcasted messages, including advancements and any other message that's for everyone.
* If this component is enabled then these messages will show up on Discord. * If this component is enabled then these messages will show up on Discord.
*/ */
@ComponentMetadata(enabledByDefault = false)
public class GeneralEventBroadcasterModule extends Component<DiscordPlugin> { public class GeneralEventBroadcasterModule extends Component<DiscordPlugin> {
private static @Getter boolean hooked = false; private static @Getter boolean hooked = false;

View file

@ -107,7 +107,7 @@ public class MinecraftChatModule extends Component<DiscordPlugin> {
* Whether players logged on from Discord (mcchat command) should be recognised by other plugins. Some plugins might break if it's turned off. * Whether players logged on from Discord (mcchat command) should be recognised by other plugins. Some plugins might break if it's turned off.
* But it's really hacky. * But it's really hacky.
*/ */
private final ConfigData<Boolean> addFakePlayersToBukkit = getConfig().getData("addFakePlayersToBukkit", true); private final ConfigData<Boolean> addFakePlayersToBukkit = getConfig().getData("addFakePlayersToBukkit", false);
/** /**
* Set by the component to report crashes. * Set by the component to report crashes.

View file

@ -4,6 +4,7 @@ import buttondevteam.core.ComponentManager;
import buttondevteam.discordplugin.DPUtils; import buttondevteam.discordplugin.DPUtils;
import buttondevteam.discordplugin.DiscordPlugin; import buttondevteam.discordplugin.DiscordPlugin;
import buttondevteam.lib.architecture.Component; import buttondevteam.lib.architecture.Component;
import buttondevteam.lib.architecture.ComponentMetadata;
import buttondevteam.lib.architecture.ReadOnlyConfigData; import buttondevteam.lib.architecture.ReadOnlyConfigData;
import discord4j.core.event.domain.role.RoleCreateEvent; import discord4j.core.event.domain.role.RoleCreateEvent;
import discord4j.core.event.domain.role.RoleDeleteEvent; import discord4j.core.event.domain.role.RoleDeleteEvent;
@ -25,6 +26,7 @@ import java.util.stream.Collectors;
* Automatically collects roles with a certain color. * Automatically collects roles with a certain color.
* Users can add these roles to themselves using the /role Discord command. * Users can add these roles to themselves using the /role Discord command.
*/ */
@ComponentMetadata(enabledByDefault = false)
public class GameRoleModule extends Component<DiscordPlugin> { public class GameRoleModule extends Component<DiscordPlugin> {
public List<String> GameRoles; public List<String> GameRoles;
@ -42,7 +44,7 @@ public class GameRoleModule extends Component<DiscordPlugin> {
/** /**
* The channel where the bot logs when it detects a role change that results in a new game role or one being removed. * The channel where the bot logs when it detects a role change that results in a new game role or one being removed.
*/ */
private ReadOnlyConfigData<Mono<MessageChannel>> logChannel = DPUtils.channelData(getConfig(), "logChannel"); private final ReadOnlyConfigData<Mono<MessageChannel>> logChannel = DPUtils.channelData(getConfig(), "logChannel");
/** /**
* The role color that is used by game roles. * The role color that is used by game roles.

View file

@ -1,11 +1,12 @@
name: Chroma-Discord name: Chroma-Discord
main: buttondevteam.discordplugin.DiscordPlugin main: buttondevteam.discordplugin.DiscordPlugin
version: '1.0' version: '${noprefix.version}'
author: NorbiPeti author: NorbiPeti
depend: [ChromaCore] depend: [ Chroma-Core ]
softdepend: softdepend:
- Essentials - Essentials
commands: commands:
discord: discord:
description: 'Main command for Chroma-Discord'
website: 'https://github.com/TBMCPlugins/Chroma-Discord' website: 'https://github.com/TBMCPlugins/Chroma-Discord'
api-version: '1.13' api-version: '1.13'