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

View file

@ -218,15 +218,6 @@ public class DiscordPlugin extends ButtonPlugin {
TBMCCoreAPI.SendUnsentExceptions();
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();
blw.start();
((Logger) LogManager.getRootLogger()).addAppender(blw);
@ -274,8 +265,6 @@ public class DiscordPlugin extends ButtonPlugin {
try {
SafeMode = true; // Stop interacting with Discord
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);
timings.printElapsed("Logging out...");
dc.logout().block();

View file

@ -3,12 +3,14 @@ package buttondevteam.discordplugin.broadcaster;
import buttondevteam.discordplugin.DiscordPlugin;
import buttondevteam.lib.TBMCCoreAPI;
import buttondevteam.lib.architecture.Component;
import buttondevteam.lib.architecture.ComponentMetadata;
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.
* If this component is enabled then these messages will show up on Discord.
*/
@ComponentMetadata(enabledByDefault = false)
public class GeneralEventBroadcasterModule extends Component<DiscordPlugin> {
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.
* 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.

View file

@ -4,6 +4,7 @@ import buttondevteam.core.ComponentManager;
import buttondevteam.discordplugin.DPUtils;
import buttondevteam.discordplugin.DiscordPlugin;
import buttondevteam.lib.architecture.Component;
import buttondevteam.lib.architecture.ComponentMetadata;
import buttondevteam.lib.architecture.ReadOnlyConfigData;
import discord4j.core.event.domain.role.RoleCreateEvent;
import discord4j.core.event.domain.role.RoleDeleteEvent;
@ -25,6 +26,7 @@ import java.util.stream.Collectors;
* Automatically collects roles with a certain color.
* Users can add these roles to themselves using the /role Discord command.
*/
@ComponentMetadata(enabledByDefault = false)
public class GameRoleModule extends Component<DiscordPlugin> {
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.
*/
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.

View file

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