Video man enters the scene

- Fixes multiple issues that were preventing the project from building
- Fixes an issue that was causing project build class files to be included in git commits
This commit is contained in:
Video 2023-03-10 23:41:06 -07:00
parent adbad1ad9b
commit 982a991fb0
6 changed files with 216 additions and 212 deletions

2
.gitignore vendored
View File

@ -29,7 +29,7 @@ manifest.mf
*.iml
# Maven excludes
/target
target/
# OS generated files
.DS_Store

View File

@ -60,4 +60,184 @@
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<!-- Filter resources for build.properties -->
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<!-- Compiler -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<outputFileName>TotalFreedomMod.jar</outputFileName>
<compilerVersion>17</compilerVersion>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<!-- Git describe -->
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>4.9.10</version>
<executions>
<execution>
<id>get-the-git-infos</id>
<goals>
<goal>revision</goal>
</goals>
</execution>
<execution>
<id>validate-the-git-infos</id>
<goals>
<goal>validateRevision</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
<prefix>git</prefix>
<dateFormat>yyyy-MM-dd HH:mm:ss</dateFormat>
<verbose>false</verbose>
<format>properties</format>
<failOnNoGitDirectory>false</failOnNoGitDirectory>
<failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo>
<includeOnlyProperties>
<includeOnlyProperty>git.commit.id.abbrev</includeOnlyProperty>
</includeOnlyProperties>
<gitDescribe>
<skip>false</skip>
<always>false</always>
<abbrev>7</abbrev>
<dirty>-dirty</dirty>
<match>*</match>
</gitDescribe>
</configuration>
</plugin>
<!-- Antrun -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>default-cli</id>
<phase>initialize</phase>
<configuration>
<target>
<propertyfile file="${project.basedir}/src/main/resources/build.properties"
comment="Build information. Edit this to your liking.">
<entry key="buildAuthor" default="unknown"/>
<entry key="buildNumber" default="0"/>
<entry key="buildCodeName" value="${tfm.build.codename}"/>
<entry key="buildVersion" value="${project.version}"/>
<entry key="buildDate" value="${timestamp}"/>
<!--suppress UnresolvedMavenProperty -->
<entry key="buildHead" value="${git.commit.id.abbrev}"/>
</propertyfile>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Properties -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.1.0</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.basedir}/src/main/resources/build.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
<!-- Buildnumber -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<buildNumberPropertyName>maven.buildnumber</buildNumberPropertyName>
<buildNumberPropertiesFileLocation>${project.basedir}/src/main/resources/build.properties
</buildNumberPropertiesFileLocation>
<format>{0,number,#}</format>
<items>
<item>buildNumber</item>
</items>
</configuration>
</plugin>
<!-- Shade -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>true</minimizeJar>
<relocations>
<relocation>
<pattern>io.papermc.lib</pattern>
<shadedPattern>me.totalfreedom.totalfreedommod.paperlib
</shadedPattern> <!-- Replace this -->
</relocation>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>me.totalfreedom.totalfreedommod</shadedPattern>
</relocation>
</relocations>
<artifactSet>
<includes>
<include>org.reflections:reflections</include>
<include>io.papermc:paperlib</include>
<include>org.bstats:bstats-bukkit</include>
<include>org.bstats:bstats-base</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -38,4 +38,32 @@
</dependency>
</dependencies>
<build>
<plugins>
<!-- Shade -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>true</minimizeJar>
<artifactSet>
<includes>
<include>com.discord4j:discord4j-core</include>
<include>io.projectreactor:reactor-core</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,8 +1,8 @@
package me.totalfreedom.discord.listener;
import discord4j.core.event.domain.message.MessageCreateEvent;
import me.totalfreedom.discord.Bot;
import me.totalfreedom.discord.TFD4J;
import me.totalfreedom.discord.discord.Discord;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.player.PlayerData;
@ -29,21 +29,22 @@ public class PrivateMessageListener
{
String code = event.getMessage().getContent().strip();
String name;
if (Discord.LINK_CODES.get(code) != null)
if (tfd4j.getBot().getLinkCodes().get(code) != null)
{
PlayerData player = Discord.LINK_CODES.get(code);
PlayerData player = tfd4j.getBot().getLinkCodes().get(code);
name = player.getName();
player.setDiscordID(event.getMessage().getAuthor().orElseThrow().getId().asString());
Admin admin = TotalFreedomMod.getPlugin().al.getEntryByUuid(player.getUuid());
if (admin != null)
{
Discord.syncRoles(admin, player.getDiscordID());
tfd4j.getImpl().syncRoles(admin, player.getDiscordID());
}
TotalFreedomMod.getPlugin().pl.save(player);
Discord.LINK_CODES.remove(code);
} else
tfd4j.getBot().getLinkCodes().remove(code);
}
else
{
return;
}

View File

@ -1,31 +1,5 @@
package me.totalfreedom.discord.util;
import com.google.common.collect.ImmutableList;
import discord4j.core.object.entity.Guild;
import discord4j.core.object.entity.Message;
import discord4j.core.object.entity.channel.Channel;
import discord4j.core.object.entity.channel.TextChannel;
import discord4j.core.object.reaction.ReactionEmoji;
import discord4j.core.spec.EmbedCreateSpec;
import discord4j.core.spec.MessageCreateSpec;
import discord4j.discordjson.json.EmojiData;
import discord4j.discordjson.json.ReactionData;
import me.totalfreedom.discord.TFD4J;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FLog;
import org.apache.commons.lang.WordUtils;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.time.Instant;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class Utilities
{
private Utilities() {

179
pom.xml
View File

@ -199,185 +199,6 @@
</pluginRepository>
</pluginRepositories>
<build>
<!-- Filter resources for build.properties -->
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<!-- Compiler -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<outputFileName>TotalFreedomMod.jar</outputFileName>
<compilerVersion>17</compilerVersion>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<!-- Git describe -->
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>4.9.10</version>
<executions>
<execution>
<id>get-the-git-infos</id>
<goals>
<goal>revision</goal>
</goals>
</execution>
<execution>
<id>validate-the-git-infos</id>
<goals>
<goal>validateRevision</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
<prefix>git</prefix>
<dateFormat>yyyy-MM-dd HH:mm:ss</dateFormat>
<verbose>false</verbose>
<format>properties</format>
<failOnNoGitDirectory>false</failOnNoGitDirectory>
<failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo>
<includeOnlyProperties>
<includeOnlyProperty>git.commit.id.abbrev</includeOnlyProperty>
</includeOnlyProperties>
<gitDescribe>
<skip>false</skip>
<always>false</always>
<abbrev>7</abbrev>
<dirty>-dirty</dirty>
<match>*</match>
</gitDescribe>
</configuration>
</plugin>
<!-- Antrun -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>default-cli</id>
<phase>initialize</phase>
<configuration>
<target>
<propertyfile file="${project.basedir}/src/main/resources/build.properties"
comment="Build information. Edit this to your liking.">
<entry key="buildAuthor" default="unknown"/>
<entry key="buildNumber" default="0"/>
<entry key="buildCodeName" value="${tfm.build.codename}"/>
<entry key="buildVersion" value="${project.version}"/>
<entry key="buildDate" value="${timestamp}"/>
<!--suppress UnresolvedMavenProperty -->
<entry key="buildHead" value="${git.commit.id.abbrev}"/>
</propertyfile>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Properties -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.1.0</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.basedir}/src/main/resources/build.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
<!-- Buildnumber -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<buildNumberPropertyName>maven.buildnumber</buildNumberPropertyName>
<buildNumberPropertiesFileLocation>${project.basedir}/src/main/resources/build.properties
</buildNumberPropertiesFileLocation>
<format>{0,number,#}</format>
<items>
<item>buildNumber</item>
</items>
</configuration>
</plugin>
<!-- Shade -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>true</minimizeJar>
<relocations>
<relocation>
<pattern>io.papermc.lib</pattern>
<shadedPattern>me.totalfreedom.totalfreedommod.paperlib
</shadedPattern> <!-- Replace this -->
</relocation>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>me.totalfreedom.totalfreedommod</shadedPattern>
</relocation>
</relocations>
<artifactSet>
<includes>
<include>org.reflections:reflections</include>
<include>io.papermc:paperlib</include>
<include>org.bstats:bstats-bukkit</include>
<include>org.bstats:bstats-base</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<!-- Checkstyle -->
<plugins>