mirror of
https://github.com/TotalFreedomMC/TFGuilds.git
synced 2024-12-22 07:55:03 +00:00
Update 2022.01
Update to the guilds plugin includes: - Fixed reflections methods for TFM Bridge to reflect new naming conventions - Added in an entry checker for the configuration file to ensure that the file contains the necessary key value pairs - Minor code QoL improvements - Convert to Paper
This commit is contained in:
parent
e2d6f9a09c
commit
0ba0e1aeaa
12 changed files with 116 additions and 104 deletions
|
@ -1,20 +1,15 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||||
<component name="CheckStyle-IDEA-Module">
|
|
||||||
<option name="configuration">
|
|
||||||
<map />
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
<component name="FacetManager">
|
<component name="FacetManager">
|
||||||
<facet type="minecraft" name="Minecraft">
|
<facet type="minecraft" name="Minecraft">
|
||||||
<configuration>
|
<configuration>
|
||||||
<autoDetectTypes>
|
<autoDetectTypes>
|
||||||
<platformType>SPIGOT</platformType>
|
<platformType>PAPER</platformType>
|
||||||
</autoDetectTypes>
|
</autoDetectTypes>
|
||||||
</configuration>
|
</configuration>
|
||||||
</facet>
|
</facet>
|
||||||
</component>
|
</component>
|
||||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_17">
|
||||||
<output url="file://$MODULE_DIR$/target/classes" />
|
<output url="file://$MODULE_DIR$/target/classes" />
|
||||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
|
@ -24,81 +19,33 @@
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.16.4-R0.1-SNAPSHOT" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: io.papermc.paper:paper-api:1.18.1-R0.1-SNAPSHOT" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:31.0.1-jre" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:failureaccess:1.0.1" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.16-R0.3" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.26" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.AtlasMediaGroup:TotalFreedomMod:development-0be2aa718f-1" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.errorprone:error_prone_annotations:2.7.1" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven.plugins:maven-checkstyle-plugin:3.1.1" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.j2objc:j2objc-annotations:1.3" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven:maven-artifact:3.0" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.8" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven:maven-core:3.0" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.16-R0.4" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven:maven-settings:3.0" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.30" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven:maven-settings-builder:3.0" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven:maven-repository-metadata:3.0" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: it.unimi.dsi:fastutil:8.5.6" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven:maven-model-builder:3.0" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.17.1" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven:maven-aether-provider:3.0" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-api:1.8.0-beta4" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.sonatype.aether:aether-impl:1.7" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-api:4.9.3" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.sonatype.aether:aether-spi:1.7" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-key:4.9.3" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.sonatype.aether:aether-api:1.7" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:examination-api:1.3.0" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.sonatype.aether:aether-util:1.7" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:examination-string:1.3.0" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.sonatype.sisu:sisu-inject-plexus:1.4.2" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jetbrains:annotations:22.0.0" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.sonatype.sisu:sisu-inject-bean:1.4.2" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-serializer-gson:4.9.3" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.sonatype.sisu:sisu-guice:noaop:2.1.7" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-serializer-legacy:4.9.3" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.codehaus.plexus:plexus-classworlds:2.2.3" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-serializer-plain:4.9.3" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.sonatype.plexus:plexus-sec-dispatcher:1.3" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.checkerframework:checker-qual:3.21.0" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.sonatype.plexus:plexus-cipher:1.4" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm:9.2" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven:maven-model:3.0" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-commons:9.2" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven:maven-plugin-api:3.0" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-tree:9.2" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven.reporting:maven-reporting-api:3.0" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-analysis:9.2" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven.reporting:maven-reporting-impl:2.3" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven.shared:maven-shared-utils:0.6" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:2.0.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven.doxia:doxia-core:1.2" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: xerces:xercesImpl:2.9.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: xml-apis:xml-apis:1.3.04" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.httpcomponents:httpclient:4.0.2" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.httpcomponents:httpcore:4.0.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-codec:commons-codec:1.3" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-validator:commons-validator:1.3.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-digester:commons-digester:1.6" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-logging:commons-logging:1.0.4" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven.doxia:doxia-sink-api:1.4" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven.doxia:doxia-logging-api:1.4" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven.doxia:doxia-decoration-model:1.4" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven.doxia:doxia-site-renderer:1.4" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven.doxia:doxia-module-xhtml:1.4" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven.doxia:doxia-module-fml:1.4" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.codehaus.plexus:plexus-i18n:1.0-beta-7" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.velocity:velocity-tools:2.0" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-chain:commons-chain:1.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: dom4j:dom4j:1.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: oro:oro:2.0.8" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: sslext:sslext:1.2-0" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.struts:struts-core:1.3.8" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.struts:struts-taglib:1.3.8" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.struts:struts-tiles:1.3.8" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.maven.doxia:doxia-integration-tools:1.6" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-io:commons-io:1.4" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.codehaus.plexus:plexus-container-default:1.0-alpha-9" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:3.8.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: classworlds:classworlds:1.1-alpha-2" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.codehaus.plexus:plexus-component-annotations:2.0.0" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.codehaus.plexus:plexus-resources:1.1.0" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.codehaus.plexus:plexus-utils:3.3.0" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.codehaus.plexus:plexus-interpolation:1.26" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.codehaus.plexus:plexus-velocity:1.2" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.puppycrawl.tools:checkstyle:8.29" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: info.picocli:picocli:4.1.4" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: antlr:antlr:2.7.7" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.antlr:antlr4-runtime:4.8-1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-beanutils:commons-beanutils:1.9.4" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.sf.saxon:Saxon-HE:9.9.1-6" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.velocity:velocity:1.7" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-collections:commons-collections:3.2.2" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.xml.bind:jaxb-api:2.3.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.activation:javax.activation-api:1.2.0" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.16" level="project" />
|
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
|
@ -11,7 +11,7 @@
|
||||||
</profile>
|
</profile>
|
||||||
</annotationProcessing>
|
</annotationProcessing>
|
||||||
<bytecodeTargetLevel>
|
<bytecodeTargetLevel>
|
||||||
<module name="TFGuilds" target="16" />
|
<module name="TFGuilds" target="17" />
|
||||||
</bytecodeTargetLevel>
|
</bytecodeTargetLevel>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -11,6 +11,11 @@
|
||||||
<option name="name" value="jitpack.io" />
|
<option name="name" value="jitpack.io" />
|
||||||
<option name="url" value="https://jitpack.io" />
|
<option name="url" value="https://jitpack.io" />
|
||||||
</remote-repository>
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="papermc" />
|
||||||
|
<option name="name" value="papermc" />
|
||||||
|
<option name="url" value="https://papermc.io/repo/repository/maven-public/" />
|
||||||
|
</remote-repository>
|
||||||
<remote-repository>
|
<remote-repository>
|
||||||
<option name="id" value="sonatype" />
|
<option name="id" value="sonatype" />
|
||||||
<option name="name" value="sonatype" />
|
<option name="name" value="sonatype" />
|
||||||
|
|
|
@ -16,5 +16,5 @@
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="false" project-jdk-name="11" project-jdk-type="JavaSDK" />
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="openjdk-17" project-jdk-type="JavaSDK" />
|
||||||
</project>
|
</project>
|
|
@ -13,7 +13,7 @@ You can copy and paste the single properties, into the pom.xml file and the IDE
|
||||||
That way multiple projects can share the same settings (useful for formatting rules for example).
|
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||||
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||||
-->
|
-->
|
||||||
<netbeans.hint.jdkPlatform>JDK_11</netbeans.hint.jdkPlatform>
|
<netbeans.hint.jdkPlatform>JDK_17</netbeans.hint.jdkPlatform>
|
||||||
<org-netbeans-modules-javascript2-requirejs.enabled>true</org-netbeans-modules-javascript2-requirejs.enabled>
|
<org-netbeans-modules-javascript2-requirejs.enabled>true</org-netbeans-modules-javascript2-requirejs.enabled>
|
||||||
</properties>
|
</properties>
|
||||||
</project-shared-configuration>
|
</project-shared-configuration>
|
||||||
|
|
16
pom.xml
16
pom.xml
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<groupId>com.github.AtlasMediaGroup</groupId>
|
<groupId>com.github.AtlasMediaGroup</groupId>
|
||||||
<artifactId>TFGuilds</artifactId>
|
<artifactId>TFGuilds</artifactId>
|
||||||
<version>2021.06-RC3</version>
|
<version>2022.01</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>TFGuilds</name>
|
<name>TFGuilds</name>
|
||||||
|
@ -25,8 +25,8 @@
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.8.1</version>
|
<version>3.8.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>11</source>
|
<source>17</source>
|
||||||
<target>11</target>
|
<target>17</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -60,16 +60,16 @@
|
||||||
<url>https://jitpack.io</url>
|
<url>https://jitpack.io</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>spigotmc-repo</id>
|
<id>papermc</id>
|
||||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>io.papermc.paper</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>paper-api</artifactId>
|
||||||
<version>1.16.5-R0.1-SNAPSHOT</version>
|
<version>1.18.1-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -14,6 +14,7 @@ import me.totalfreedom.tfguilds.listener.ChatListener;
|
||||||
import me.totalfreedom.tfguilds.listener.JoinListener;
|
import me.totalfreedom.tfguilds.listener.JoinListener;
|
||||||
import me.totalfreedom.tfguilds.sql.SQLDatabase;
|
import me.totalfreedom.tfguilds.sql.SQLDatabase;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class TFGuilds extends JavaPlugin
|
public class TFGuilds extends JavaPlugin
|
||||||
{
|
{
|
||||||
|
@ -54,13 +55,13 @@ public class TFGuilds extends JavaPlugin
|
||||||
{
|
{
|
||||||
getSQL().getConnection().close();
|
getSQL().getConnection().close();
|
||||||
}
|
}
|
||||||
catch (SQLException throwables)
|
catch (SQLException ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Config getConfig()
|
public @NotNull Config getConfig()
|
||||||
{
|
{
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class TFMBridge
|
||||||
Bukkit.getLogger().warning("TotalFreedomMod not detected, checking operator status instead.");
|
Bukkit.getLogger().warning("TotalFreedomMod not detected, checking operator status instead.");
|
||||||
return player.isOp();
|
return player.isOp();
|
||||||
}
|
}
|
||||||
Object al = ReflectionsHelper.getField(getTfm(), "al");
|
Object al = ReflectionsHelper.getField(getTfm(), "adminList");
|
||||||
Method isAdmin = ReflectionsHelper.getMethod(al, "isAdmin", Player.class);
|
Method isAdmin = ReflectionsHelper.getMethod(al, "isAdmin", Player.class);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,7 @@ public class TFMBridge
|
||||||
Bukkit.getLogger().warning("TotalFreedomMod not detected, checking operator status instead.");
|
Bukkit.getLogger().warning("TotalFreedomMod not detected, checking operator status instead.");
|
||||||
return sender.isOp();
|
return sender.isOp();
|
||||||
}
|
}
|
||||||
Object al = ReflectionsHelper.getField(getTfm(), "al");
|
Object al = ReflectionsHelper.getField(getTfm(), "adminList");
|
||||||
Method isAdmin = ReflectionsHelper.getMethod(al, "isAdmin", CommandSender.class);
|
Method isAdmin = ReflectionsHelper.getMethod(al, "isAdmin", CommandSender.class);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -81,7 +81,7 @@ public class TFMBridge
|
||||||
Bukkit.getLogger().warning("TotalFreedomMod not detected, vanish will return false.");
|
Bukkit.getLogger().warning("TotalFreedomMod not detected, vanish will return false.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Object al = ReflectionsHelper.getField(getTfm(), "al");
|
Object al = ReflectionsHelper.getField(getTfm(), "adminList");
|
||||||
Method isVanished = ReflectionsHelper.getMethod(al, "isVanished", String.class);
|
Method isVanished = ReflectionsHelper.getMethod(al, "isVanished", String.class);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -101,7 +101,7 @@ public class TFMBridge
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object pl = ReflectionsHelper.getField(getTfm(), "pl");
|
Object pl = ReflectionsHelper.getField(getTfm(), "playerList");
|
||||||
Method getPlayer = ReflectionsHelper.getMethod(pl, "getPlayer", Player.class);
|
Method getPlayer = ReflectionsHelper.getMethod(pl, "getPlayer", Player.class);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -125,7 +125,7 @@ public class TFMBridge
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// getTfm().pl.getPlayer(player).setTag(null);
|
// getTfm().pl.getPlayer(player).setTag(null);
|
||||||
Object pl = ReflectionsHelper.getField(getTfm(), "pl");
|
Object pl = ReflectionsHelper.getField(getTfm(), "playerList");
|
||||||
Method getPlayer = ReflectionsHelper.getMethod(pl, "getPlayer", Player.class);
|
Method getPlayer = ReflectionsHelper.getMethod(pl, "getPlayer", Player.class);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,20 +1,27 @@
|
||||||
package me.totalfreedom.tfguilds.config;
|
package me.totalfreedom.tfguilds.config;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.Arrays;
|
||||||
import me.totalfreedom.tfguilds.TFGuilds;
|
import me.totalfreedom.tfguilds.TFGuilds;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
public class Config extends YamlConfiguration
|
public class Config extends YamlConfiguration
|
||||||
{
|
{
|
||||||
|
|
||||||
private final TFGuilds plugin;
|
|
||||||
private final File file;
|
private final File file;
|
||||||
|
|
||||||
public Config(String fileName)
|
public Config(String fileName)
|
||||||
{
|
{
|
||||||
this.plugin = TFGuilds.getPlugin();
|
TFGuilds plugin = TFGuilds.getPlugin();
|
||||||
this.file = new File(plugin.getDataFolder(), fileName);
|
this.file = new File(plugin.getDataFolder(), fileName);
|
||||||
|
|
||||||
if (!file.exists())
|
if (!file.exists())
|
||||||
|
@ -22,6 +29,8 @@ public class Config extends YamlConfiguration
|
||||||
plugin.saveResource(fileName, false);
|
plugin.saveResource(fileName, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkForFields();
|
||||||
|
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,4 +57,50 @@ public class Config extends YamlConfiguration
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void checkForFields()
|
||||||
|
{
|
||||||
|
if (!file.exists())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Arrays.stream(ConfigEntry.values()).forEach(entry -> {
|
||||||
|
if (entry.getString().isBlank() || entry.getString().isEmpty() || entry.getString() == null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
String[] split = entry.getName().split("\\.");
|
||||||
|
String key = split[0];
|
||||||
|
String subKey = split[1];
|
||||||
|
String value = "REPLACE_ME";
|
||||||
|
FileWriter writer = new FileWriter(file, true);
|
||||||
|
InputStream is = TFGuilds.getPlugin().getResource("config.yml");
|
||||||
|
if (is == null) {
|
||||||
|
Bukkit.getServer().getLogger().severe("Unable to read from resource! Things may not work correctly!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||||
|
while (reader.ready()) {
|
||||||
|
if (!reader.readLine().trim().startsWith(subKey)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
value = reader.readLine().trim().split(":")[1].trim();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
writer.write("\n"
|
||||||
|
+ key
|
||||||
|
+ ": "
|
||||||
|
+ "\n"
|
||||||
|
+ subKey.indent(2)
|
||||||
|
+ ": "
|
||||||
|
+ value);
|
||||||
|
}
|
||||||
|
catch (IOException ignored)
|
||||||
|
{
|
||||||
|
Bukkit.getServer().getLogger().severe("The FileWriter could not add the necessary configuration options to the yaml file! Things may not work correctly!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,4 +45,8 @@ public enum ConfigEntry
|
||||||
{
|
{
|
||||||
return config.getString(path);
|
return config.getString(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
settings:
|
settings:
|
||||||
# Types: mysql, sqlite
|
# Types: mysql, sqlite
|
||||||
connection: sqlite
|
connection: mysql
|
||||||
|
|
||||||
server:
|
server:
|
||||||
# Log guild chat to console?
|
# Log guild chat to console?
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
name: TFGuilds
|
name: TFGuilds
|
||||||
version: ${project.version}
|
version: ${project.version}
|
||||||
main: me.totalfreedom.tfguilds.TFGuilds
|
main: me.totalfreedom.tfguilds.TFGuilds
|
||||||
api-version: 1.16
|
api-version: 1.17
|
||||||
authors: [ Fleek, super, speed ]
|
authors: [ Fleek, super, speed ]
|
||||||
description: A guilds plugin for the TotalFreedom server.
|
description: A guilds plugin for the TotalFreedom server.
|
||||||
softdepend:
|
softdepend:
|
||||||
|
|
Loading…
Reference in a new issue