1.16 Update (#219)

This commit is contained in:
Seth 2020-07-09 17:07:03 -07:00 committed by GitHub
parent 4ddcc3b8d7
commit 7b7f09e457
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
189 changed files with 2912 additions and 4951 deletions

8
.gitignore vendored
View File

@ -19,7 +19,11 @@ manifest.mf
# IntelliJ excludes
*.ipr
*.iws
/.idea
/.idea/modules.xml
/.idea/discord.xml
/.idea/jarRepositories.xml
/.idea/workspace.xml
/.idea/libraries
*.iml
# Maven excludes
@ -32,5 +36,3 @@ manifest.mf
.Trashes
ehthumbs.db
Thumbs.db
TotalFreedomMod\.iml

View File

@ -1,8 +0,0 @@
<component name="ArtifactManager">
<artifact type="jar" build-on-make="true" name="TotalFreedomMod:jar">
<output-path>$PROJECT_DIR$/target</output-path>
<root id="archive" name="TotalFreedomMod.jar">
<element id="module-output" name="TotalFreedomMod" />
</root>
</artifact>
</component>

1
.idea/compiler.xml generated
View File

@ -11,7 +11,6 @@
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="totalfreedom" target="1.8" />
<module name="TotalFreedomMod" target="1.8" />
</bytecodeTargetLevel>
</component>

2
.idea/encodings.xml generated
View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

11
.idea/misc.xml generated Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
</project>

8
.idea/modules.xml generated
View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/TotalFreedomMod.iml" filepath="$PROJECT_DIR$/TotalFreedomMod.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -1,165 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>PAPER</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.9.4-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.avaje:ebean:2.8.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.14.1-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.14-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.papermc:paperlib:1.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:Essentials:2.13.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.dv8tion:JDA:3.8.0_423" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okhttp3:okhttp:3.8.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okio:okio:1.13.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.json:json:20160810" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.papermc:paperlib:1.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:Essentials:2.13.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.dv8tion:JDA:3.8.0_423" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okhttp3:okhttp:3.8.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okio:okio:1.13.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.json:json:20160810" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.13.1-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.papermc:paperlib:1.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:Essentials:2.13.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:craftbukkit:1.13.2-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.dv8tion:JDA:3.8.0_423" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okhttp3:okhttp:3.8.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okio:okio:1.13.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.json:json:20160810" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.coreprotect:coreprotect:2.15.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.13-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.0" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.9" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.9" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.15-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.Pravian:Aero:5f82926" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.12-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TotalFreedom:BukkitTelnet:4.5-pre1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-core:2.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches:TF-LibsDisguises:11aea9b3cd" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.protocol:ProtocolLib:4.5.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: cglib:cglib-nodep:3.2.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.executors:BukkitExecutors:1.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-bukkit:7.1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-core:7.1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit.worldedit-libs:core:7.1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: de.schlichtherle:truezip:6.8.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-profile-default_2.13:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.scala-lang:scala-library:2.13.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-http:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-kernel-spec:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-annotations:2.5.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:annotations:3.0.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-cio:2.5.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-io:2.5.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-services:2.5.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-logging:2.5.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.inject:javax.inject:1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.httpcomponents:httpclient:4.5.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.httpcomponents:httpcore:4.4.12" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:jcl-over-slf4j:1.7.28" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-odf:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-comp-zipdriver:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-comp-zip:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bouncycastle:bcprov-jdk15on:1.63" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-tar:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-comp-tardriver:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.commons:commons-compress:1.19" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-tar-bzip2:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-tar-gzip:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-tar-xz:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.tukaani:xz:1.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-zip-raes:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-profile-base_2.13:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-access-swing:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-access:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-file:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-jar:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-zip:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-comp-ibm437:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-kernel-impl_2.13:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-key-console:2.5.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-key-default:2.5.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-key-swing:2.5.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-key-macosx:2.5.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-key-spec:2.5.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-shed:2.5.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mozilla:rhino:1.7.11" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: it.unimi.dsi:fastutil:8.2.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.antlr:antlr4-runtime:4.7.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit.worldedit-libs:bukkit:7.1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.13.2-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.papermc:paperlib:1.0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-slf4j-impl:2.8.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bstats:bstats-bukkit:1.7" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:EssentialsX:2.16.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:NMSProvider:2.16.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:UpdatedMetaProvider:2.16.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:1_8_R1Provider:2.16.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:1_8_R2Provider:2.16.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:LegacyProvider:2.16.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:ReflectionProvider:2.16.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:FlattenedProvider:2.16.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.dv8tion:JDA:4.0.0_39" 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: org.jetbrains:annotations:16.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.neovisionaries:nv-websocket-client:2.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okhttp3:okhttp:3.13.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okio:okio:1.17.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: club.minnced:opus-java-api:1.0.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.dev.jna:jna:4.4.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: club.minnced:opus-java-natives:1.0.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.commons:commons-collections4:4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.sf.trove4j:trove4j:3.0.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.coreprotect:coreprotect:2.16.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard:worldguard-bukkit:7.0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard:worldguard-core:7.0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard.worldguard-libs:core:7.0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.flywaydb:flyway-core:3.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:commandbook:2.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.destroystokyo.paper:paper-api:1.15.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: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.1" 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.code.gson:gson:2.8.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.13-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.25" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm:7.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-commons:7.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-tree:7.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-analysis:7.1" level="project" />
<orderEntry type="library" name="Maven: me.rayzr522:jsonmessage:1.0.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.vexsoftware:votifier:v1.9" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.ConnorLinfoot:ActionBarAPI:5b2d642d3d" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.goldtreeservers:worldguardextraflags:4.0.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.boydti:fawe-api:17.07.12-6b6f285-750-13.7.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:Essentials:2.13-SNAPSHOT" level="project" />
</component>
</module>

47
pom.xml
View File

@ -90,11 +90,6 @@
<url>http://maven.sk89q.com/repo/</url>
</repository>
<repository>
<id>CodeMC</id>
<url>https://repo.codemc.org/repository/maven-public</url>
</repository>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
@ -138,14 +133,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.15-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.Pravian</groupId>
<artifactId>Aero</artifactId>
<version>5f82926</version>
<version>1.16.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
@ -159,8 +147,7 @@
<dependency>
<groupId>com.github.TFPatches</groupId>
<artifactId>TF-LibsDisguises</artifactId>
<version>11aea9b3cd</version>
<scope>provided</scope>
<version>0cfa32159a</version>
</dependency>
<dependency>
@ -201,7 +188,7 @@
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.15.1-R0.1-SNAPSHOT</version>
<version>1.16.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
@ -219,9 +206,9 @@
</dependency>
<dependency>
<groupId>com.github.ConnorLinfoot</groupId>
<artifactId>ActionBarAPI</artifactId>
<version>5b2d642d3d</version>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.16.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
@ -232,6 +219,24 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.11</version>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.12.1.GA</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.10</version>
</dependency>
</dependencies>
<build>
@ -376,7 +381,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
@ -390,6 +395,8 @@
<include>commons-io:commons-io</include>
<include>org.apache.commons:commons-lang3</include>
<include>commons-codec:commons-codec</include>
<include>org.reflections:reflections</include>
<include>javassist:javassist</include>
</includes>
</artifactSet>
</configuration>

View File

@ -21,13 +21,8 @@ public class Announcer extends FreedomService
private String prefix;
private BukkitTask announcer;
public Announcer(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
enabled = ConfigEntry.ANNOUNCER_ENABLED.getBoolean();
interval = ConfigEntry.ANNOUNCER_INTERVAL.getInteger() * 20L;
@ -64,7 +59,7 @@ public class Announcer extends FreedomService
}
@Override
protected void onStop()
public void onStop()
{
if (announcer == null)
{

View File

@ -4,7 +4,6 @@ import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -13,19 +12,13 @@ import org.bukkit.event.block.BlockPlaceEvent;
public class AntiNuke extends FreedomService
{
public AntiNuke(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}

View File

@ -1,5 +1,7 @@
package me.totalfreedom.totalfreedommod;
import java.util.ArrayList;
import java.util.List;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.util.FSync;
import me.totalfreedom.totalfreedommod.util.FUtil;
@ -10,13 +12,8 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerLoginEvent.Result;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class AntiSpam extends FreedomService
{
@ -27,13 +24,8 @@ public class AntiSpam extends FreedomService
//
public BukkitTask cycleTask = null;
public AntiSpam(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
new BukkitRunnable()
{
@ -47,7 +39,7 @@ public class AntiSpam extends FreedomService
}
@Override
protected void onStop()
public void onStop()
{
FUtil.cancel(cycleTask);
}

View File

@ -8,7 +8,6 @@ import java.util.Map;
import me.totalfreedom.totalfreedommod.banning.Ban;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.util.Ips;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
@ -19,25 +18,20 @@ public class AutoEject extends FreedomService
private final Map<String, Integer> ejects = new HashMap<>(); // ip -> amount
public AutoEject(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}
public void autoEject(Player player, String kickMessage)
{
EjectMethod method = EjectMethod.STRIKE_ONE;
final String ip = Ips.getIp(player);
final String ip = FUtil.getIp(player);
if (!ejects.containsKey(ip))
{

View File

@ -15,13 +15,8 @@ public class AutoKick extends FreedomService
private long autoKickTicks;
private double autoKickThreshold;
public AutoKick(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
autoKickTicks = (long)ConfigEntry.AUTOKICK_TIME.getInteger() * 1000L;
autoKickThreshold = ConfigEntry.AUTOKICK_THRESHOLD.getDouble();
@ -43,7 +38,7 @@ public class AutoKick extends FreedomService
}
@Override
protected void onStop()
public void onStop()
{
FUtil.cancel(kickTask);
kickTask = null;

View File

@ -1,18 +1,23 @@
package me.totalfreedom.totalfreedommod;
import com.sk89q.worldedit.bukkit.BukkitConfiguration;
import java.io.File;
import me.totalfreedom.totalfreedommod.config.YamlConfig;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.component.PluginComponent;
import net.pravian.aero.config.YamlConfig;
import org.bukkit.util.FileUtil;
import org.yaml.snakeyaml.Yaml;
public class BackupManager extends PluginComponent<TotalFreedomMod>
public class BackupManager extends FreedomService
{
public BackupManager(TotalFreedomMod plugin)
@Override
public void onStart()
{
}
@Override
public void onStop()
{
super(plugin);
}
public void createBackups(String file)

View File

@ -1,47 +1,39 @@
package me.totalfreedom.totalfreedommod;
import com.google.common.base.Strings;
import java.time.LocalDate;
import java.time.Period;
import java.util.Date;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.rank.Displayable;
import me.totalfreedom.totalfreedommod.shop.ShopData;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FSync;
import me.totalfreedom.totalfreedommod.util.FUtil;
import static me.totalfreedom.totalfreedommod.util.FUtil.playerMsg;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Sound;
import org.bukkit.SoundCategory;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.Sound;
import org.bukkit.SoundCategory;
import static me.totalfreedom.totalfreedommod.util.FUtil.playerMsg;
public class ChatManager extends FreedomService
{
public ChatManager(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerChatFormat(AsyncPlayerChatEvent event)
{
try
@ -66,15 +58,10 @@ public class ChatManager extends FreedomService
if (ConfigEntry.SHOP_REACTIONS_ENABLED.getBoolean() && !plugin.sh.reactionString.isEmpty() && message.equals(plugin.sh.reactionString))
{
event.setCancelled(true);
ShopData data = plugin.sh.getData(player);
PlayerData data = plugin.pl.getData(player);
data.setCoins(data.getCoins() + plugin.sh.coinsPerReactionWin);
plugin.sh.save(data);
plugin.sh.reactionString = "";
Date currentTime = new Date();
long seconds = (currentTime.getTime() - plugin.sh.reactionStartTime.getTime()) / 1000;
String reactionMessage = ChatColor.DARK_GRAY + "[" + ChatColor.YELLOW + "Reaction" + ChatColor.DARK_GRAY + "] "
+ ChatColor.GREEN + player.getName() + ChatColor.AQUA + " won in " + seconds + " seconds!";
FUtil.bcastMsg(reactionMessage, false);
plugin.pl.save(data);
plugin.sh.endReaction(player.getName());
player.sendMessage(ChatColor.GREEN + "You have been given " + ChatColor.GOLD + plugin.sh.coinsPerReactionWin + ChatColor.GREEN + " coins!");
return;
}
@ -82,7 +69,7 @@ public class ChatManager extends FreedomService
if (!ConfigEntry.TOGGLE_CHAT.getBoolean() && !plugin.al.isAdmin(player))
{
event.setCancelled(true);
playerMsg(player, "Chat is currently disabled.", ChatColor.RED);
playerMsg(player, "Chat is currently disabled.", org.bukkit.ChatColor.RED);
return;
}

View File

@ -5,23 +5,16 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.ChatColor;
public class CommandSpy extends FreedomService
{
public CommandSpy(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}

View File

@ -16,11 +16,6 @@ public class EntityWiper extends FreedomService
{
private BukkitTask wiper;
public EntityWiper(TotalFreedomMod plugin)
{
super(plugin);
}
public List<EntityType> BLACKLIST = Arrays.asList(
EntityType.ARMOR_STAND,
EntityType.PAINTING,
@ -31,7 +26,7 @@ public class EntityWiper extends FreedomService
);
@Override
protected void onStart()
public void onStart()
{
// Continuous Entity Wiper
wiper = new BukkitRunnable()
@ -45,7 +40,7 @@ public class EntityWiper extends FreedomService
}
@Override
protected void onStop()
public void onStop()
{
wiper.cancel();
wiper = null;

View File

@ -1,13 +1,24 @@
package me.totalfreedom.totalfreedommod;
import net.pravian.aero.component.service.AbstractService;
import me.totalfreedom.totalfreedommod.util.FLog;
import org.bukkit.Server;
import org.bukkit.event.Listener;
public abstract class FreedomService extends AbstractService<TotalFreedomMod>
public abstract class FreedomService implements Listener
{
protected final TotalFreedomMod plugin;
protected final Server server;
protected final FLog logger;
public FreedomService(TotalFreedomMod plugin)
public FreedomService()
{
super(plugin);
plugin = TotalFreedomMod.getPlugin();
server = plugin.getServer();
logger = new FLog();
plugin.getServer().getPluginManager().registerEvents(this, plugin);
plugin.fsh.add(this);
}
public abstract void onStart();
public abstract void onStop();
}

View File

@ -0,0 +1,26 @@
package me.totalfreedom.totalfreedommod;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
public class FreedomServiceHandler
{
@Getter
private List<FreedomService> services;
public FreedomServiceHandler()
{
this.services = new ArrayList<>();
}
public void add(FreedomService service)
{
services.add(service);
}
public int getServiceAmount()
{
return services.size();
}
}

View File

@ -9,18 +9,13 @@ import org.bukkit.event.player.PlayerMoveEvent;
public class Fuckoff extends FreedomService
{
public Fuckoff(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}
@ -53,7 +48,7 @@ public class Fuckoff extends FreedomService
if (distanceSquared < (fuckoffRange * fuckoffRange))
{
onlinePlayer.setVelocity(onlinePlayer.getLocation().toVector().subtract(foLocation.toVector()).normalize().multiply(fPlayer.getFuckoffRadius()));
fuckoffPlayer.setVelocity(onlinePlayer.getLocation().toVector().add(foLocation.toVector()).normalize().multiply(fPlayer.getFuckoffRadius()));
break;
}
}

View File

@ -13,10 +13,8 @@ public class GameRuleHandler extends FreedomService
private final Map<GameRule, Boolean> rules = new EnumMap<>(GameRule.class);
public GameRuleHandler(TotalFreedomMod plugin)
public GameRuleHandler()
{
super(plugin);
for (GameRule gameRule : GameRule.values())
{
rules.put(gameRule, gameRule.getDefaultValue());
@ -24,7 +22,7 @@ public class GameRuleHandler extends FreedomService
}
@Override
protected void onStart()
public void onStart()
{
setGameRule(GameRule.DO_DAYLIGHT_CYCLE, !ConfigEntry.DISABLE_NIGHT.getBoolean(), false);
setGameRule(GameRule.DO_FIRE_TICK, ConfigEntry.ALLOW_FIRE_SPREAD.getBoolean(), false);
@ -41,7 +39,7 @@ public class GameRuleHandler extends FreedomService
}
@Override
protected void onStop()
public void onStop()
{
}

View File

@ -23,19 +23,13 @@ import org.bukkit.scheduler.BukkitRunnable;
public class LogViewer extends FreedomService
{
public LogViewer(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}

View File

@ -5,11 +5,10 @@ import java.util.List;
import java.util.regex.Pattern;
import lombok.Getter;
import lombok.Setter;
import me.totalfreedom.totalfreedommod.command.Command_vanish;
import me.rayzr522.jsonmessage.JSONMessage;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilder;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FSync;
import me.totalfreedom.totalfreedommod.util.FUtil;
@ -22,7 +21,6 @@ import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.scheduler.BukkitRunnable;
import me.rayzr522.jsonmessage.JSONMessage;
public class LoginProcess extends FreedomService
{
@ -38,18 +36,13 @@ public class LoginProcess extends FreedomService
@Setter
private static boolean lockdownEnabled = false;
public LoginProcess(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}
@ -194,7 +187,7 @@ public class LoginProcess extends FreedomService
{
final Player player = event.getPlayer();
final FPlayer fPlayer = plugin.pl.getPlayer(player);
final VPlayer verificationPlayer = plugin.pv.getVerificationPlayer(player);
final PlayerData playerData = plugin.pl.getData(player);
player.sendTitle(FUtil.colorize(ConfigEntry.SERVER_LOGIN_TITLE.getString()), FUtil.colorize(ConfigEntry.SERVER_LOGIN_SUBTITLE.getString()), 20, 100, 60);
player.setOp(true);
@ -210,6 +203,12 @@ public class LoginProcess extends FreedomService
return;
}
if (!playerData.hasVerification() && !playerData.getIps().contains(FUtil.getIp(player)))
{
playerData.addIp(FUtil.getIp(player));
plugin.pl.save(playerData);
}
if (CLEAR_ON_JOIN.contains(player.getName()) || ConfigEntry.AUTO_CLEAR.getBoolean())
{
player.getInventory().clear();
@ -237,22 +236,12 @@ public class LoginProcess extends FreedomService
if (!plugin.al.isAdmin(player))
{
if (plugin.mbl.isMasterBuilder(player))
String tag = playerData.getTag();
if (tag != null)
{
MasterBuilder masterBuilder = plugin.mbl.getMasterBuilder(player);
if (masterBuilder.getTag() != null)
{
fPlayer.setTag(FUtil.colorize(masterBuilder.getTag()));
fPlayer.setTag(FUtil.colorize(tag));
}
}
else
{
VPlayer vPlayer = plugin.pv.getVerificationPlayer(player);
if (vPlayer.getEnabled() && vPlayer.getTag() != null)
{
fPlayer.setTag(FUtil.colorize(vPlayer.getTag()));
}
int noteCount = vPlayer.getNotes().size();
int noteCount = playerData.getNotes().size();
if (noteCount != 0)
{
String noteMessage = "This player has " + noteCount + " staff note" + (noteCount > 1 ? "s" : "") + ".";
@ -269,7 +258,6 @@ public class LoginProcess extends FreedomService
}
}
}
}
new BukkitRunnable()
{

View File

@ -18,18 +18,13 @@ public class Monitors extends FreedomService
private final DecimalFormat decimalFormat = new DecimalFormat("#");
private String potionSpyPrefix = ChatColor.DARK_GRAY + "[" + ChatColor.YELLOW + "PotionSpy" + ChatColor.DARK_GRAY + "] ";
public Monitors(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}

View File

@ -5,12 +5,12 @@ import ca.momothereal.mojangson.value.MojangsonCompound;
import ca.momothereal.mojangson.value.MojangsonValue;
import java.util.List;
import java.util.Objects;
import net.minecraft.server.v1_15_R1.NBTTagCompound;
import net.minecraft.server.v1_15_R1.NBTTagList;
import net.minecraft.server.v1_16_R1.NBTTagCompound;
import net.minecraft.server.v1_16_R1.NBTTagList;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -19,7 +19,6 @@ import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
public class MovementValidator extends FreedomService
{
@ -27,18 +26,13 @@ public class MovementValidator extends FreedomService
public static final int MAX_XYZ_COORD = 29999998;
public static final int MAX_DISTANCE_TRAVELED = 100;
public MovementValidator(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}
@ -137,7 +131,7 @@ public class MovementValidator extends FreedomService
private Boolean exploitItem(ItemStack item)
{
net.minecraft.server.v1_15_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(item);
net.minecraft.server.v1_16_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(item);
NBTTagList modifiers = getAttributeList(nmsStack);
MojangsonCompound compound = new MojangsonCompound();
boolean foundNegative = false;
@ -174,7 +168,7 @@ public class MovementValidator extends FreedomService
}
private NBTTagList getAttributeList(net.minecraft.server.v1_15_R1.ItemStack stack)
private NBTTagList getAttributeList(net.minecraft.server.v1_16_R1.ItemStack stack)
{
if (stack.getTag() == null)
{

View File

@ -21,32 +21,25 @@ public class Muter extends FreedomService
{
public static final List<String> MUTE_COMMANDS = Arrays.asList(StringUtils.split("say,me,msg,tell,reply,mail", ","));
public final List<String> MUTED_PLAYERS = new ArrayList();
public Muter(TotalFreedomMod plugin)
{
super(plugin);
}
public final List<String> MUTED_PLAYERS = new ArrayList<>();
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}
@EventHandler(priority = EventPriority.LOW)
@EventHandler(priority = EventPriority.HIGHEST)
public void onAsyncPlayerChatEvent(AsyncPlayerChatEvent event)
{
Player player = event.getPlayer();
FPlayer fPlayer = plugin.pl.getPlayerSync(player);
FLog.info("checking mute");
if (!fPlayer.isMuted())
{
return;

View File

@ -9,19 +9,13 @@ import org.bukkit.util.Vector;
public class Orbiter extends FreedomService
{
public Orbiter(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}

View File

@ -32,13 +32,8 @@ public class ProtectArea extends FreedomService
//
private final Map<String, SerializableProtectedRegion> areas = Maps.newHashMap();
public ProtectArea(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
if (!ConfigEntry.PROTECTAREA_ENABLED.getBoolean())
{
@ -68,7 +63,7 @@ public class ProtectArea extends FreedomService
}
@Override
protected void onStop()
public void onStop()
{
save();
}

View File

@ -12,19 +12,13 @@ import static me.totalfreedom.totalfreedommod.util.FUtil.SAVED_FLAGS_FILENAME;
public class SavedFlags extends FreedomService
{
public SavedFlags(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}

View File

@ -4,28 +4,22 @@ import java.util.Arrays;
import java.util.List;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.minecraft.server.v1_15_R1.EntityPlayer;
import net.minecraft.server.v1_15_R1.MinecraftServer;
import net.minecraft.server.v1_16_R1.EntityPlayer;
import net.minecraft.server.v1_16_R1.MinecraftServer;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_15_R1.CraftServer;
import org.bukkit.craftbukkit.v1_16_R1.CraftServer;
public class ServerInterface extends FreedomService
{
public static final String COMPILE_NMS_VERSION = "v1_15_R1";
public ServerInterface(TotalFreedomMod plugin)
{
super(plugin);
}
public static final String COMPILE_NMS_VERSION = "v1_16_R1";
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}

View File

@ -9,19 +9,13 @@ import org.bukkit.event.server.ServerListPingEvent;
public class ServerPing extends FreedomService
{
public ServerPing(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}

View File

@ -3,6 +3,7 @@ package me.totalfreedom.totalfreedommod;
import java.io.File;
import java.io.InputStream;
import java.util.Properties;
import java.util.Set;
import me.totalfreedom.totalfreedommod.admin.ActivityLog;
import me.totalfreedom.totalfreedommod.admin.AdminList;
import me.totalfreedom.totalfreedommod.banning.BanManager;
@ -24,6 +25,7 @@ import me.totalfreedom.totalfreedommod.bridge.WorldEditBridge;
import me.totalfreedom.totalfreedommod.bridge.WorldGuardBridge;
import me.totalfreedom.totalfreedommod.caging.Cager;
import me.totalfreedom.totalfreedommod.command.CommandLoader;
import me.totalfreedom.totalfreedommod.command.FreedomCommand;
import me.totalfreedom.totalfreedommod.config.MainConfig;
import me.totalfreedom.totalfreedommod.discord.Discord;
import me.totalfreedom.totalfreedommod.freeze.Freezer;
@ -32,38 +34,38 @@ import me.totalfreedom.totalfreedommod.fun.ItemFun;
import me.totalfreedom.totalfreedommod.fun.Jumppads;
import me.totalfreedom.totalfreedommod.fun.Landminer;
import me.totalfreedom.totalfreedommod.fun.MP44;
import me.totalfreedom.totalfreedommod.fun.MobStacker;
import me.totalfreedom.totalfreedommod.fun.RealTimer;
import me.totalfreedom.totalfreedommod.fun.Trailer;
import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon;
import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilder;
import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilderList;
import me.totalfreedom.totalfreedommod.world.WorldRestrictions;
import me.totalfreedom.totalfreedommod.permissions.PermissionConfig;
import me.totalfreedom.totalfreedommod.permissions.PermissionManager;
import me.totalfreedom.totalfreedommod.player.PlayerList;
import me.totalfreedom.totalfreedommod.playerverification.PlayerVerification;
import me.totalfreedom.totalfreedommod.punishments.PunishmentList;
import me.totalfreedom.totalfreedommod.rank.RankManager;
import me.totalfreedom.totalfreedommod.shop.Shop;
import me.totalfreedom.totalfreedommod.shop.Votifier;
import me.totalfreedom.totalfreedommod.sql.SQLite;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import me.totalfreedom.totalfreedommod.util.MethodTimer;
import me.totalfreedom.totalfreedommod.world.CleanroomChunkGenerator;
import me.totalfreedom.totalfreedommod.world.WorldManager;
import net.pravian.aero.component.service.ServiceManager;
import net.pravian.aero.plugin.AeroPlugin;
import me.totalfreedom.totalfreedommod.world.WorldRestrictions;
import org.bstats.Metrics;
import org.bukkit.Bukkit;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import org.reflections.Reflections;
import org.spigotmc.SpigotConfig;
public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
public class TotalFreedomMod extends JavaPlugin
{
private static TotalFreedomMod plugin;
public static TotalFreedomMod getPlugin()
{
return plugin;
}
public static final String CONFIG_FILENAME = "config.yml";
//
public static final BuildProperties build = new BuildProperties();
@ -74,8 +76,11 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
public MainConfig config;
public PermissionConfig permissions;
//
// Service Handler
public FreedomServiceHandler fsh;
// Command Loader
public CommandLoader cl;
// Services
public ServiceManager<TotalFreedomMod> services;
public ServerInterface si;
public SavedFlags sf;
public WorldManager wm;
@ -83,7 +88,6 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
public AdminList al;
public ActivityLog acl;
public RankManager rm;
public CommandLoader cl;
public CommandBlocker cb;
public EventBlocker eb;
public BlockBlocker bb;
@ -95,6 +99,7 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
public AntiSpam as;
public PlayerList pl;
public Shop sh;
public Votifier vo;
public SQLite sql;
public Announcer an;
public ChatManager cm;
@ -121,21 +126,16 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
public CurseListener cul;
public ItemFun it;
public Landminer lm;
public MobStacker ms;
public MP44 mp;
public Jumppads jp;
public Trailer tr;
public HTTPDaemon hd;
public MasterBuilderList mbl;
public WorldRestrictions wr;
public SignBlocker snp;
public PlayerVerification pv;
public EntityWiper ew;
public RealTimer rt;
//public HubWorldRestrictions hwr;
//
// Bridges
public ServiceManager<TotalFreedomMod> bridges;
public BukkitTelnetBridge btb;
public EssentialsBridge esb;
public LibsDisguisesBridge ldb;
@ -144,19 +144,20 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
public WorldGuardBridge wgb;
@Override
public void load()
public void onLoad()
{
plugin = this;
TotalFreedomMod.pluginName = plugin.getDescription().getName();
TotalFreedomMod.pluginVersion = plugin.getDescription().getVersion();
FLog.setPluginLogger(plugin.getLogger());
FLog.setServerLogger(server.getLogger());
FLog.setServerLogger(getServer().getLogger());
build.load(plugin);
}
@Override
public void enable()
public void onEnable()
{
FLog.info("Created by Madgeek1450 and Prozza");
FLog.info("Version " + build.version);
@ -172,14 +173,31 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
FUtil.deleteCoreDumps();
FUtil.deleteFolder(new File("./_deleteme"));
BackupManager backups = new BackupManager(this);
fsh = new FreedomServiceHandler();
cl = new CommandLoader();
Reflections commandDir = new Reflections("me.totalfreedom.totalfreedommod.command");
Set<Class<? extends FreedomCommand>> commandClasses = commandDir.getSubTypesOf(FreedomCommand.class);
for (Class<? extends FreedomCommand> commandClass : commandClasses)
{
try
{
cl.add(commandClass.newInstance());
}
catch (InstantiationException | IllegalAccessException | ExceptionInInitializerError ex)
{
FLog.warning("Failed to register command: /" + commandClass.getSimpleName().replace("Command_" , ""));
}
}
BackupManager backups = new BackupManager();
backups.createBackups(TotalFreedomMod.CONFIG_FILENAME, true);
backups.createBackups(AdminList.CONFIG_FILENAME);
backups.createBackups(PermbanList.CONFIG_FILENAME);
backups.createBackups(PermissionConfig.PERMISSIONS_FILENAME, true);
backups.createBackups(MasterBuilder.CONFIG_FILENAME);
backups.createBackups(PunishmentList.CONFIG_FILENAME);
backups.createBackups("");
backups.createBackups("database.db");
config = new MainConfig(this);
config.load();
@ -188,82 +206,78 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
permissions.load();
// Start services
services = new ServiceManager<>(plugin);
si = services.registerService(ServerInterface.class);
sf = services.registerService(SavedFlags.class);
wm = services.registerService(WorldManager.class);
lv = services.registerService(LogViewer.class);
sql = services.registerService(SQLite.class);
al = services.registerService(AdminList.class);
acl = services.registerService(ActivityLog.class);
rm = services.registerService(RankManager.class);
cl = services.registerService(CommandLoader.class);
cb = services.registerService(CommandBlocker.class);
eb = services.registerService(EventBlocker.class);
bb = services.registerService(BlockBlocker.class);
mb = services.registerService(MobBlocker.class);
ib = services.registerService(InteractBlocker.class);
pb = services.registerService(PotionBlocker.class);
lp = services.registerService(LoginProcess.class);
nu = services.registerService(AntiNuke.class);
as = services.registerService(AntiSpam.class);
mbl = services.registerService(MasterBuilderList.class);
wr = services.registerService(WorldRestrictions.class);
pl = services.registerService(PlayerList.class);
sh = services.registerService(Shop.class);
an = services.registerService(Announcer.class);
cm = services.registerService(ChatManager.class);
dc = services.registerService(Discord.class);
pul = services.registerService(PunishmentList.class);
bm = services.registerService(BanManager.class);
pm = services.registerService(PermbanList.class);
pem = services.registerService(PermissionManager.class);
pa = services.registerService(ProtectArea.class);
gr = services.registerService(GameRuleHandler.class);
snp = services.registerService(SignBlocker.class);
ew = services.registerService(EntityWiper.class);
si = new ServerInterface();
sf = new SavedFlags();
wm = new WorldManager();
lv = new LogViewer();
sql = new SQLite();
al = new AdminList();
acl = new ActivityLog();
rm = new RankManager();
cb = new CommandBlocker();
eb = new EventBlocker();
bb = new BlockBlocker();
mb = new MobBlocker();
ib = new InteractBlocker();
pb = new PotionBlocker();
lp = new LoginProcess();
nu = new AntiNuke();
as = new AntiSpam();
wr = new WorldRestrictions();
pl = new PlayerList();
sh = new Shop();
vo = new Votifier();
an = new Announcer();
cm = new ChatManager();
dc = new Discord();
pul = new PunishmentList();
bm = new BanManager();
pm = new PermbanList();
pem = new PermissionManager();
pa = new ProtectArea();
gr = new GameRuleHandler();
snp = new SignBlocker();
ew = new EntityWiper();
// Single admin utils
cs = services.registerService(CommandSpy.class);
ca = services.registerService(Cager.class);
fm = services.registerService(Freezer.class);
or = services.registerService(Orbiter.class);
mu = services.registerService(Muter.class);
ebl = services.registerService(EditBlocker.class);
pbl = services.registerService(PVPBlocker.class);
fo = services.registerService(Fuckoff.class);
ak = services.registerService(AutoKick.class);
ae = services.registerService(AutoEject.class);
mo = services.registerService(Monitors.class);
cs = new CommandSpy();
ca = new Cager();
fm = new Freezer();
or = new Orbiter();
mu = new Muter();
ebl = new EditBlocker();
pbl = new PVPBlocker();
fo = new Fuckoff();
ak = new AutoKick();
ae = new AutoEject();
mo = new Monitors();
mv = services.registerService(MovementValidator.class);
sp = services.registerService(ServerPing.class);
pv = services.registerService(PlayerVerification.class);
mv = new MovementValidator();
sp = new ServerPing();
// Fun
cul = services.registerService(CurseListener.class);
it = services.registerService(ItemFun.class);
lm = services.registerService(Landminer.class);
ms = services.registerService(MobStacker.class);
mp = services.registerService(MP44.class);
jp = services.registerService(Jumppads.class);
tr = services.registerService(Trailer.class);
rt = services.registerService(RealTimer.class);
cul = new CurseListener();
it = new ItemFun();
lm = new Landminer();
mp = new MP44();
jp = new Jumppads();
tr = new Trailer();
// HTTPD
hd = services.registerService(HTTPDaemon.class);
services.start();
hd = new HTTPDaemon();
// Start bridges
bridges = new ServiceManager<>(plugin);
btb = bridges.registerService(BukkitTelnetBridge.class);
cpb = bridges.registerService(CoreProtectBridge.class);
esb = bridges.registerService(EssentialsBridge.class);
ldb = bridges.registerService(LibsDisguisesBridge.class);
web = bridges.registerService(WorldEditBridge.class);
wgb = bridges.registerService(WorldGuardBridge.class);
bridges.start();
btb = new BukkitTelnetBridge();
cpb = new CoreProtectBridge();
esb = new EssentialsBridge();
ldb = new LibsDisguisesBridge();
web = new WorldEditBridge();
wgb = new WorldGuardBridge();
for (FreedomService service : fsh.getServices())
service.onStart();
FLog.info("Started " + fsh.getServiceAmount() + "services.");
timer.update();
FLog.info("Version " + pluginVersion + " for " + ServerInterface.COMPILE_NMS_VERSION + " enabled in " + timer.getTotal() + "ms");
@ -285,13 +299,15 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
}
@Override
public void disable()
public void onDisable()
{
// Stop services and bridges
bridges.stop();
services.stop();
for (FreedomService service : fsh.getServices())
{
service.onStop();
}
server.getScheduler().cancelTasks(plugin);
getServer().getScheduler().cancelTasks(plugin);
FLog.info("Plugin disabled");
}

View File

@ -4,10 +4,9 @@ import com.google.common.collect.Maps;
import java.util.Map;
import lombok.Getter;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.config.YamlConfig;
import me.totalfreedom.totalfreedommod.util.FLog;
import net.pravian.aero.config.YamlConfig;
import net.pravian.aero.util.Ips;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
@ -28,21 +27,19 @@ public class ActivityLog extends FreedomService
private final YamlConfig config;
public ActivityLog(TotalFreedomMod plugin)
public ActivityLog()
{
super(plugin);
this.config = new YamlConfig(plugin, FILENAME, true);
}
@Override
protected void onStart()
public void onStart()
{
load();
}
@Override
protected void onStop()
public void onStop()
{
save();
}
@ -110,7 +107,7 @@ public class ActivityLog extends FreedomService
ActivityLogEntry activityLog = getEntryByName(player.getName());
if (activityLog == null)
{
String ip = Ips.getIp(player);
String ip = FUtil.getIp(player);
activityLog = getEntryByIp(ip);
if (activityLog != null)
{
@ -129,7 +126,7 @@ public class ActivityLog extends FreedomService
config.save();
}
}
String ip = Ips.getIp(player);
String ip = FUtil.getIp(player);
if (!activityLog.getIps().contains(ip))
{
activityLog.addIp(ip);

View File

@ -6,15 +6,13 @@ import java.util.Date;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import me.totalfreedom.totalfreedommod.config.IConfig;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.base.ConfigLoadable;
import net.pravian.aero.base.ConfigSavable;
import net.pravian.aero.base.Validatable;
import org.apache.commons.lang.Validate;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
public class ActivityLogEntry implements ConfigLoadable, ConfigSavable, Validatable
public class ActivityLogEntry implements IConfig
{
@Getter

View File

@ -1,8 +1,8 @@
package me.totalfreedom.totalfreedommod.admin;
import com.google.common.collect.Lists;
import java.util.Arrays;
import java.util.Collections;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@ -12,10 +12,9 @@ import lombok.Setter;
import me.totalfreedom.totalfreedommod.LogViewer.LogsRegistrationMode;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.util.Ips;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
public class Admin
@ -31,7 +30,6 @@ public class Admin
private Rank rank = Rank.SUPER_ADMIN;
@Getter
private final List<String> ips = Lists.newArrayList();
private final List<String> backupCodes = Lists.newArrayList();
@Getter
@Setter
private Date lastLogin = new Date();
@ -40,12 +38,6 @@ public class Admin
private String loginMessage = null;
@Getter
@Setter
private String discordID = null;
@Getter
@Setter
private String tag = null;
@Getter
@Setter
private Boolean commandSpy = false;
@Getter
@Setter
@ -60,32 +52,33 @@ public class Admin
@Setter
private Boolean logStick = false;
public static final String CONFIG_FILENAME = "admins.yml";
public Admin(Player player)
{
this.name = player.getName();
this.ips.add(Ips.getIp(player));
this.ips.add(FUtil.getIp(player));
}
public Admin(String username, List<String> ips, Rank rank, Boolean active, Date lastLogin, String loginMessage, String tag, String discordID, List<String> backupCodes, Boolean commandSpy, Boolean potionSpy, String acFormat, Boolean oldTags, Boolean logStick)
public Admin(ResultSet resultSet)
{
this.name = username;
this.active = active;
this.rank = rank;
try
{
this.name = resultSet.getString("username");
this.active = resultSet.getBoolean("active");
this.rank = Rank.findRank(resultSet.getString("rank"));
this.ips.clear();
this.ips.addAll(ips);
this.lastLogin = lastLogin;
this.loginMessage = loginMessage;
this.tag = tag;
this.discordID = discordID;
this.backupCodes.clear();
this.backupCodes.addAll(backupCodes);
this.commandSpy = commandSpy;
this.potionSpy = potionSpy;
this.acFormat = acFormat;
this.oldTags = oldTags;
this.logStick = logStick;
this.ips.addAll(FUtil.stringToList(resultSet.getString("ips")));
this.lastLogin = new Date(resultSet.getLong("last_login"));
this.loginMessage = resultSet.getString("login_message");
this.commandSpy = resultSet.getBoolean("command_spy");
this.potionSpy = resultSet.getBoolean("potion_spy");
this.acFormat = resultSet.getString("ac_format");
this.oldTags = resultSet.getBoolean("old_tags");
this.logStick = resultSet.getBoolean("log_stick");
}
catch (SQLException e)
{
FLog.severe("Failed to load admin: " + e.getMessage());
}
}
@Override
@ -99,13 +92,10 @@ public class Admin
.append("- Custom Login Message: ").append(loginMessage).append("\n")
.append("- Rank: ").append(rank.getName()).append("\n")
.append("- Is Active: ").append(active).append("\n")
.append("- Discord ID: ").append(discordID).append("\n")
.append("- Tag: ").append(tag).append("\n").append(ChatColor.GRAY)
.append("- Potion Spy: ").append(potionSpy).append("\n")
.append("- Admin Chat Format: ").append(acFormat).append("\n")
.append("- Old Tags: ").append(oldTags).append("\n")
.append("- Log Stick: ").append(logStick).append("\n")
.append("- Backup Codes: ").append(backupCodes.size()).append("/10");
.append("- Log Stick: ").append(logStick).append("\n");
return output.toString();
}
@ -114,7 +104,7 @@ public class Admin
{
name = player.getName();
ips.clear();
ips.add(Ips.getIp(player));
ips.add(FUtil.getIp(player));
}
public Map<String, Object> toSQLStorable()
@ -125,11 +115,8 @@ public class Admin
put("active", active);
put("rank", rank.toString());
put("ips", FUtil.listToString(ips));
put("backup_codes", FUtil.listToString(backupCodes));
put("last_login", lastLogin.getTime());
put("login_message", loginMessage);
put("discord_id", discordID);
put("tag", tag);
put("command_spy", commandSpy);
put("potion_spy", potionSpy);
put("ac_format", acFormat);
@ -179,22 +166,6 @@ public class Admin
ips.clear();
}
public List<String> getBackupCodes()
{
return Collections.unmodifiableList(backupCodes);
}
public void setBackupCodes(List<String> codes)
{
backupCodes.clear();
backupCodes.addAll(codes);
}
public void removeBackupCode(String code)
{
backupCodes.remove(code);
}
public void setActive(boolean active)
{
this.active = active;

View File

@ -1,6 +1,5 @@
package me.totalfreedom.totalfreedommod.admin;
import com.google.common.base.Function;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import java.sql.ResultSet;
@ -13,23 +12,16 @@ import java.util.Set;
import java.util.concurrent.TimeUnit;
import lombok.Getter;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.config.YamlConfig;
import net.pravian.aero.util.Ips;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.ServicePriority;
public class AdminList extends FreedomService
{
public static final String CONFIG_FILENAME = "admins.yml";
@Getter
private final Set<Admin> allAdmins = Sets.newHashSet(); // Includes disabled admins
// Only active admins below
@ -40,42 +32,21 @@ public class AdminList extends FreedomService
public final List<String> verifiedNoAdmins = new ArrayList<>();
public final Map<String, List<String>> verifiedNoAdminIps = Maps.newHashMap();
public static ArrayList<Player> vanished = new ArrayList<>();
//
private final YamlConfig config;
public AdminList(TotalFreedomMod plugin)
{
super(plugin);
this.config = new YamlConfig(plugin, CONFIG_FILENAME, true);
}
@Override
protected void onStart()
public void onStart()
{
load();
server.getServicesManager().register(Function.class, new Function<Player, Boolean>()
{
@Override
public Boolean apply(Player player)
{
return isAdmin(player);
}
}, plugin, ServicePriority.Normal);
deactivateOldEntries(false);
}
@Override
protected void onStop()
public void onStop()
{
}
public void load()
{
config.load();
allAdmins.clear();
try
{
@ -83,28 +54,14 @@ public class AdminList extends FreedomService
{
while (adminSet.next())
{
String name = adminSet.getString("username");
List<String> ips = FUtil.stringToList(adminSet.getString("ips"));
Rank rank = Rank.findRank(adminSet.getString("rank"));
Boolean active = adminSet.getBoolean("active");;
Date lastLogin = new Date(adminSet.getLong("last_login"));
String loginMessage = adminSet.getString("login_message");
String tag = adminSet.getString("tag");
String discordID = adminSet.getString("discord_id");
List<String> backupCodes = FUtil.stringToList(adminSet.getString("backup_codes"));
Boolean commandSpy = adminSet.getBoolean("command_spy");
Boolean potionSpy = adminSet.getBoolean("potion_spy");
String acFormat = adminSet.getString("ac_format");
Boolean oldTags = adminSet.getBoolean("old_tags");
Boolean logStick = adminSet.getBoolean("log_stick");
Admin admin = new Admin(name, ips, rank, active, lastLogin, loginMessage, tag, discordID, backupCodes, commandSpy, potionSpy, acFormat, oldTags, logStick);
Admin admin = new Admin(adminSet);
allAdmins.add(admin);
}
}
}
catch (SQLException e)
{
FLog.severe("Failed to get adminlist: " + e.getMessage());
FLog.severe("Failed to load adminlist: " + e.getMessage());
}
updateTables();
@ -149,6 +106,17 @@ public class AdminList extends FreedomService
return admin != null && admin.isActive();
}
public boolean isTelnetAdmin(CommandSender sender)
{
Admin admin = getAdmin(sender);
if (admin == null)
{
return false;
}
return admin.getRank().ordinal() >= Rank.TELNET_ADMIN.ordinal();
}
public boolean isSeniorAdmin(CommandSender sender)
{
Admin admin = getAdmin(sender);
@ -173,7 +141,7 @@ public class AdminList extends FreedomService
public Admin getAdmin(Player player)
{
// Find admin
String ip = Ips.getIp(player);
String ip = FUtil.getIp(player);
Admin admin = getEntryByName(player.getName());
// Admin by name
@ -257,7 +225,7 @@ public class AdminList extends FreedomService
public boolean isVerifiedAdmin(Player player)
{
return verifiedNoAdmins.contains(player.getName()) && verifiedNoAdminIps.get(player.getName()).contains(Ips.getIp(player));
return verifiedNoAdmins.contains(player.getName()) && verifiedNoAdminIps.get(player.getName()).contains(FUtil.getIp(player));
}
public boolean isIdentityMatched(Player player)
@ -356,7 +324,7 @@ public class AdminList extends FreedomService
for (Map.Entry<String, Object> entry : admin.toSQLStorable().entrySet())
{
Object storedValue = plugin.sql.getValue(currentSave, entry.getKey(), entry.getValue());
if (storedValue != null && !storedValue.equals(entry.getValue()) || storedValue == null && entry.getValue() != null)
if (storedValue != null && !storedValue.equals(entry.getValue()) || storedValue == null && entry.getValue() != null || entry.getValue() == null)
{
plugin.sql.setAdminValue(admin, entry.getKey(), entry.getValue());
}

View File

@ -1,7 +1,6 @@
package me.totalfreedom.totalfreedommod.banning;
import com.google.common.collect.Lists;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.util.ArrayList;
@ -14,14 +13,14 @@ import java.util.Set;
import lombok.Getter;
import lombok.Setter;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.config.IConfig;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.base.Validatable;
import net.pravian.aero.util.Ips;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
public class Ban implements Validatable
public class Ban implements IConfig
{
public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
@ -81,7 +80,7 @@ public class Ban implements Validatable
public static Ban forPlayerIp(Player player, CommandSender by, Date expiry, String reason)
{
return new Ban(null, Arrays.asList(Ips.getIp(player)), by.getName(), Date.from(Instant.now()), expiry, reason);
return new Ban(null, Arrays.asList(FUtil.getIp(player)), by.getName(), Date.from(Instant.now()), expiry, reason);
}
public static Ban forPlayerIp(String ip, CommandSender by, Date expiry, String reason)
@ -116,7 +115,7 @@ public class Ban implements Validatable
public static Ban forPlayer(Player player, CommandSender by, Date expiry, String reason)
{
return new Ban(player.getName(),
Ips.getIp(player),
FUtil.getIp(player),
by.getName(),
Date.from(Instant.now()),
expiry,
@ -126,7 +125,7 @@ public class Ban implements Validatable
public static Ban forPlayerFuzzy(Player player, CommandSender by, Date expiry, String reason)
{
return new Ban(player.getName(),
FUtil.getFuzzyIp(Ips.getIp(player)),
FUtil.getFuzzyIp(FUtil.getIp(player)),
by.getName(),
Date.from(Instant.now()),
expiry,
@ -235,6 +234,16 @@ public class Ban implements Validatable
return hash;
}
@Override
public void loadFrom(ConfigurationSection cs)
{
}
@Override
public void saveTo(ConfigurationSection cs)
{
}
@Override
public boolean isValid()
{

View File

@ -9,17 +9,14 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.util.Ips;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -36,13 +33,8 @@ public class BanManager extends FreedomService
//
public BanManager(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
bans.clear();
try
@ -79,7 +71,7 @@ public class BanManager extends FreedomService
}
@Override
protected void onStop()
public void onStop()
{
}
@ -121,7 +113,7 @@ public class BanManager extends FreedomService
continue;
}
if (Ips.fuzzyIpMatch(ip, loopIp, 4))
if (FUtil.fuzzyIpMatch(ip, loopIp, 4))
{
return loopBan;
}
@ -180,10 +172,23 @@ public class BanManager extends FreedomService
public boolean addBan(Ban ban)
{
if (getByUsername(ban.getUsername()) != null)
if (ban.getUsername() != null && getByUsername(ban.getUsername()) != null)
{
removeBan(ban);
}
else
{
for (String ip : ban.getIps())
{
if (getByIp(ip) != null)
{
removeBan(ban);
break;
}
}
}
if (bans.add(ban))
{
plugin.sql.addBan(ban);
@ -219,7 +224,7 @@ public class BanManager extends FreedomService
public void onPlayerLogin(PlayerLoginEvent event)
{
final String username = event.getPlayer().getName();
final String ip = Ips.getIp(event);
final String ip = FUtil.getIp(event);
// Regular ban
Ban ban = getByUsername(username);
@ -246,14 +251,19 @@ public class BanManager extends FreedomService
}
// Unban admins
for (String storedIp : data.getIps())
Ban ban = getByUsername(player.getName());
if (ban != null)
{
unbanIp(storedIp);
unbanIp(FUtil.getFuzzyIp(storedIp));
removeBan(ban);
}
else
{
ban = getByIp(FUtil.getIp(player));
if (ban != null)
{
removeBan(ban);
}
}
unbanUsername(player.getName());
player.setOp(true);
}
private void updateViews()

View File

@ -4,12 +4,10 @@ import com.google.common.collect.Sets;
import java.util.Set;
import lombok.Getter;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.config.YamlConfig;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.config.YamlConfig;
import net.pravian.aero.util.Ips;
import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -25,13 +23,8 @@ public class PermbanList extends FreedomService
@Getter
private final Set<String> permbannedIps = Sets.newHashSet();
public PermbanList(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
permbannedNames.clear();
permbannedIps.clear();
@ -49,7 +42,7 @@ public class PermbanList extends FreedomService
}
@Override
protected void onStop()
public void onStop()
{
}
@ -57,7 +50,7 @@ public class PermbanList extends FreedomService
public void onPlayerLogin(PlayerLoginEvent event)
{
final String username = event.getPlayer().getName();
final String ip = Ips.getIp(event);
final String ip = FUtil.getIp(event);
// Permbanned IPs
for (String testIp : getPermbannedIps())

View File

@ -2,15 +2,11 @@ package me.totalfreedom.totalfreedommod.blocking;
import java.util.List;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import me.totalfreedom.totalfreedommod.util.Groups;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Banner;
import org.bukkit.block.Block;
import org.bukkit.block.Skull;
import org.bukkit.block.banner.Pattern;
import org.bukkit.entity.Player;
@ -23,19 +19,13 @@ import org.bukkit.inventory.meta.SkullMeta;
public class BlockBlocker extends FreedomService
{
public BlockBlocker(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}
@ -68,6 +58,7 @@ public class BlockBlocker extends FreedomService
break;
}
case FIRE:
case SOUL_FIRE:
{
if (!ConfigEntry.ALLOW_FIRE_PLACE.getBoolean())
{
@ -142,7 +133,7 @@ public class BlockBlocker extends FreedomService
case PLAYER_WALL_HEAD:
{
Skull skull = (Skull) event.getBlockPlaced().getState();
if (skull.hasOwner())
if (skull.getOwner() != null)
{
if (skull.getOwner().contains("\u00A7"))
{
@ -168,18 +159,25 @@ public class BlockBlocker extends FreedomService
}
break;
}
case RESPAWN_ANCHOR:
{
if (!ConfigEntry.ALLOW_RESPAWN_ANCHORS.getBoolean())
{
player.sendMessage(ChatColor.GRAY + "Respawn anchors are disabled.");
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
event.setCancelled(true);
}
break;
}
}
if (Groups.BANNERS.contains(event.getBlockPlaced().getType()))
{
Banner banner = (Banner) event.getBlockPlaced().getState();
List<Pattern> patterns = banner.getPatterns();
Banner handBanner = (Banner) (((Block) event.getItemInHand()).getState());
List<Pattern> handPatterns = banner.getPatterns();
List<Pattern> patterns = banner.getPatterns();;
if (patterns.size() >= 2)
{
banner.setPatterns(patterns.subList(0, 2));
handBanner.setPatterns(handPatterns.subList(0, 2));
player.sendMessage(ChatColor.GRAY + "Your banner had too many patterns on it, so some were removed.");
}
}

View File

@ -1,7 +1,6 @@
package me.totalfreedom.totalfreedommod.blocking;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.util.FSync;
import org.bukkit.ChatColor;
@ -12,19 +11,13 @@ import org.bukkit.event.block.BlockPlaceEvent;
public class EditBlocker extends FreedomService
{
public EditBlocker(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}

View File

@ -1,28 +1,23 @@
package me.totalfreedom.totalfreedommod.blocking;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FUtil;
import me.totalfreedom.totalfreedommod.util.Groups;
import org.bukkit.Material;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.block.data.AnaloguePowerable;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Powerable;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Tameable;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockDispenseEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.event.block.BlockRedstoneEvent;
import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.block.BlockGrowEvent;
import org.bukkit.event.block.*;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent;
@ -32,22 +27,17 @@ import org.bukkit.event.entity.FireworkExplodeEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.material.Redstone;
public class EventBlocker extends FreedomService
{
public EventBlocker(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}
@ -206,7 +196,7 @@ public class EventBlocker extends FreedomService
}
}
@EventHandler(priority = EventPriority.HIGH)
//@EventHandler(priority = EventPriority.HIGH)
public void onBlockRedstone(BlockRedstoneEvent event)
{
if (!ConfigEntry.ALLOW_REDSTONE.getBoolean())
@ -215,6 +205,20 @@ public class EventBlocker extends FreedomService
}
}
// TODO: Revert back to old redstone block system when (or if) it is fixed in Bukkit, Spigot or Paper.
private ArrayList<Material> redstoneBlocks = new ArrayList<>(Arrays.asList(Material.REDSTONE, Material.DISPENSER, Material.DROPPER, Material.REDSTONE_LAMP));
@EventHandler
public void onBlockPhysics(BlockPhysicsEvent event) {
if (!ConfigEntry.ALLOW_REDSTONE.getBoolean())
{
// Check if the block is involved with redstone.
if(event.getBlock().getBlockData() instanceof AnaloguePowerable || event.getBlock().getBlockData() instanceof Powerable || redstoneBlocks.contains(event.getBlock().getType()))
{
event.setCancelled(true);
}
}
}
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerRespawn(PlayerRespawnEvent event)
{

View File

@ -1,13 +1,10 @@
package me.totalfreedom.totalfreedommod.blocking;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.Groups;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Biome;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -16,19 +13,13 @@ import org.bukkit.inventory.ItemStack;
public class InteractBlocker extends FreedomService
{
public InteractBlocker(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}
@ -56,17 +47,11 @@ public class InteractBlocker extends FreedomService
@EventHandler(priority = EventPriority.HIGH)
public void onRightClickBell(PlayerInteractEvent event)
{
if (event.getClickedBlock() != null)
{
if (event.getClickedBlock().getType().equals(Material.BELL))
{
if (!ConfigEntry.ALLOW_BELLS.getBoolean())
if (event.getClickedBlock() != null && event.getClickedBlock().getType().equals(Material.BELL) && !ConfigEntry.ALLOW_BELLS.getBoolean())
{
event.setCancelled(true);
}
}
}
}
private void handleRightClick(PlayerInteractEvent event)
{
@ -89,12 +74,14 @@ public class InteractBlocker extends FreedomService
return;
}
if (Groups.BED_COLORS.contains(event.getMaterial()) && event.getClickedBlock().getBiome().equals(Biome.NETHER))
// TODO: lookup new biomes that have bed explosions in 1.16
/*if (Groups.BED_COLORS.contains(event.getMaterial()) && event.getClickedBlock().getBiome().equals(Biome.NETHER))
{
player.sendMessage(ChatColor.RED + "You can't sleep in hell.");
event.setCancelled(true);
return;
}
}*/
switch (event.getMaterial())
{

View File

@ -1,9 +1,7 @@
package me.totalfreedom.totalfreedommod.blocking;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FLog;
import org.bukkit.attribute.Attributable;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.Bat;
@ -22,19 +20,13 @@ import org.bukkit.event.entity.EntitySpawnEvent;
public class MobBlocker extends FreedomService
{
public MobBlocker(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}

View File

@ -1,32 +1,25 @@
package me.totalfreedom.totalfreedommod.blocking;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.FishHook;
import org.bukkit.entity.Player;
import org.bukkit.entity.Trident;
import org.bukkit.entity.FishHook;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
public class PVPBlocker extends FreedomService
{
public PVPBlocker(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}

View File

@ -2,7 +2,6 @@ package me.totalfreedom.totalfreedommod.blocking;
import java.util.Collection;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.entity.ThrownPotion;
@ -19,18 +18,13 @@ public class PotionBlocker extends FreedomService
public static final int POTION_BLOCK_RADIUS_SQUARED = 20 * 20;
public PotionBlocker(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}

View File

@ -1,12 +1,10 @@
package me.totalfreedom.totalfreedommod.blocking;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import net.minecraft.server.v1_15_R1.NBTTagCompound;
import net.minecraft.server.v1_16_R1.NBTTagCompound;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Tag;
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -19,19 +17,13 @@ import org.bukkit.inventory.ItemStack;
public class SignBlocker extends FreedomService
{
public SignBlocker(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}
@ -43,7 +35,7 @@ public class SignBlocker extends FreedomService
if (Tag.SIGNS.getValues().contains(event.getBlock().getType()))
{
ItemStack sign = event.getItemInHand();
net.minecraft.server.v1_15_R1.ItemStack nmsSign = CraftItemStack.asNMSCopy(sign);
net.minecraft.server.v1_16_R1.ItemStack nmsSign = CraftItemStack.asNMSCopy(sign);
NBTTagCompound compound = (nmsSign.hasTag()) ? nmsSign.getTag() : new NBTTagCompound();
NBTTagCompound bet = compound.getCompound("BlockEntityTag");
String line1 = bet.getString("Text1");
@ -55,16 +47,6 @@ public class SignBlocker extends FreedomService
player.sendMessage(ChatColor.GRAY + "You are not allowed to place command signs.");
event.setCancelled(true);
}
if (line1.contains("translate") || line2.contains("translate") || line3.contains("translate") || line4.contains("translate"))
{
player.sendMessage(ChatColor.GRAY + "You are not allowed to place broken strings that Mojang never fixed.");
event.setCancelled(true);
}
if (line1.contains("translation.test.") || line2.contains("translation.test.") || line3.contains("translation.test.") || line4.contains("translation.test."))
{
player.sendMessage(ChatColor.BOLD + "No.");
event.setCancelled(true);
}
}
}

View File

@ -2,24 +2,25 @@ package me.totalfreedom.totalfreedommod.blocking.command;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import java.lang.reflect.Field;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.command.CommandReflection;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandMap;
import org.bukkit.command.CommandSender;
import org.bukkit.command.SimpleCommandMap;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.Bukkit;
import org.bukkit.plugin.SimplePluginManager;
public class CommandBlocker extends FreedomService
{
@ -29,34 +30,43 @@ public class CommandBlocker extends FreedomService
private final Map<String, CommandBlockerEntry> entryList = Maps.newHashMap();
private final List<String> unknownCommands = Lists.newArrayList();
public CommandBlocker(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
load();
}
@Override
protected void onStop()
public void onStop()
{
entryList.clear();
}
public static CommandMap getCommandMap()
{
try
{
SimplePluginManager simplePluginManager = (SimplePluginManager) Bukkit.getServer().getPluginManager();
Field commandMapField = SimplePluginManager.class.getDeclaredField("commandMap");
commandMapField.setAccessible(true);
SimpleCommandMap simpleCommandMap = (SimpleCommandMap) commandMapField.get(simplePluginManager);
return simpleCommandMap;
}
catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e)
{
FLog.severe("Failed to get command map field (" + e.getMessage() + ")");
}
return null;
}
public void load()
{
entryList.clear();
unknownCommands.clear();
final CommandMap commandMap = CommandReflection.getCommandMap();
if (commandMap == null)
{
FLog.severe("Error loading commandMap.");
return;
}
final CommandMap commandMap = getCommandMap();
@SuppressWarnings("unchecked")
List<String> blockedCommands = (List<String>)ConfigEntry.BLOCKED_COMMANDS.getList();
@ -106,9 +116,9 @@ public class CommandBlocker extends FreedomService
continue;
}
final CommandBlockerEntry blockedCommandEntry = new CommandBlockerEntry(rank, action, commandName, subCommand, message);
entryList.put(blockedCommandEntry.getCommand(), blockedCommandEntry);
final CommandBlockerEntry blockedCommandEntry = new CommandBlockerEntry(rank, action, commandName, subCommand, message);
entryList.put(commandName, blockedCommandEntry);
if (command != null)
{
for (String alias : command.getAliases())
@ -130,12 +140,6 @@ public class CommandBlocker extends FreedomService
// CommandBlocker handles messages and broadcasts
event.setCancelled(true);
}
if (event.getMessage().contains("translation.test.invalid") || event.getMessage().contains("translation.test.invalid2"))
{
event.setCancelled(true);
FUtil.playerMsg(event.getPlayer(), ChatColor.RED + "No crishy crashy faggy");
}
}
public boolean isCommandBlocked(String command, CommandSender sender)

View File

@ -10,7 +10,6 @@ import me.totalfreedom.bukkittelnet.api.TelnetPreLoginEvent;
import me.totalfreedom.bukkittelnet.api.TelnetRequestDataTagsEvent;
import me.totalfreedom.bukkittelnet.session.ClientSession;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FLog;
@ -24,18 +23,13 @@ public class BukkitTelnetBridge extends FreedomService
private BukkitTelnet bukkitTelnetPlugin = null;
public BukkitTelnetBridge(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}

View File

@ -9,7 +9,6 @@ import java.sql.Statement;
import java.util.Arrays;
import java.util.List;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FLog;
import net.coreprotect.CoreProtect;
@ -28,18 +27,13 @@ public class CoreProtectBridge extends FreedomService
private BukkitTask wiper;
public CoreProtectBridge(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}

View File

@ -3,7 +3,6 @@ package me.totalfreedom.totalfreedommod.bridge;
import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.User;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FLog;
@ -26,18 +25,13 @@ public class EssentialsBridge extends FreedomService
private Essentials essentialsPlugin = null;
public EssentialsBridge(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}

View File

@ -2,10 +2,9 @@ package me.totalfreedom.totalfreedommod.bridge;
import me.libraryaddict.disguise.DisguiseAPI;
import me.libraryaddict.disguise.LibsDisguises;
import me.totalfreedom.libsdisguises.BlockedDisguises;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.libraryaddict.disguise.BlockedDisguises;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
@ -14,18 +13,13 @@ public class LibsDisguisesBridge extends FreedomService
private LibsDisguises libsDisguisesPlugin = null;
public LibsDisguisesBridge(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}
@ -120,6 +114,6 @@ public class LibsDisguisesBridge extends FreedomService
{
final LibsDisguises libsDisguises = getLibsDisguisesPlugin();
return libsDisguises != null && libsDisguises.isEnabled();
return libsDisguises != null;
}
}

View File

@ -4,7 +4,6 @@ import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.bukkit.BukkitPlayer;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.util.FLog;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
@ -15,18 +14,13 @@ public class WorldEditBridge extends FreedomService
//
private WorldEditPlugin worldeditPlugin = null;
public WorldEditBridge(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}

View File

@ -7,27 +7,20 @@ import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import com.sk89q.worldguard.protection.regions.RegionContainer;
import java.util.Map;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import org.bukkit.World;
import org.bukkit.plugin.Plugin;
public class WorldGuardBridge extends FreedomService
{
public WorldGuardBridge(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
plugin.wr.protectWorld(plugin.wm.hubworld.getWorld());
plugin.wr.protectWorld(plugin.wm.masterBuilderWorld.getWorld());
}
@Override
protected void onStop()
public void onStop()
{
}

View File

@ -1,7 +1,6 @@
package me.totalfreedom.totalfreedommod.caging;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
@ -17,19 +16,13 @@ import org.bukkit.event.player.PlayerQuitEvent;
public class Cager extends FreedomService
{
public Cager(TotalFreedomMod plugin)
{
super(plugin);
}
@Override
protected void onStart()
public void onStart()
{
}
@Override
protected void onStop()
public void onStop()
{
}

View File

@ -1,45 +1,59 @@
package me.totalfreedom.totalfreedommod.command;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import lombok.Getter;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.util.FLog;
import net.pravian.aero.command.handler.SimpleCommandHandler;
import org.bukkit.ChatColor;
public class CommandLoader extends FreedomService
{
@Getter
private final SimpleCommandHandler<TotalFreedomMod> handler;
private final List<FreedomCommand> commands;
public CommandLoader(TotalFreedomMod plugin)
public CommandLoader()
{
super(plugin);
handler = new SimpleCommandHandler<>(plugin);
commands = new ArrayList<>();
}
@Override
protected void onStart()
public void onStart()
{
handler.clearCommands();
handler.setExecutorFactory(new FreedomCommandExecutor.FreedomExecutorFactory(plugin));
handler.setCommandClassPrefix("Command_");
handler.setPermissionMessage(ChatColor.RED + "You do not have permission to use this command.");
handler.setOnlyConsoleMessage(ChatColor.RED + "This command can only be used from the console.");
handler.setOnlyPlayerMessage(ChatColor.RED + "This command can only be used by players.");
handler.loadFrom(FreedomCommand.class.getPackage());
handler.registerAll(plugin.getDescription().getName(), true);
FLog.info("Loaded " + handler.getExecutors().size() + " commands.");
}
@Override
protected void onStop()
public void onStop()
{
handler.clearCommands();
}
public void add(FreedomCommand command)
{
commands.add(command);
command.register();
}
public FreedomCommand getByName(String name)
{
for (FreedomCommand command : commands)
{
if (name.equals(command.getName()))
return command;
}
return null;
}
public boolean isAlias(String alias)
{
for (FreedomCommand command : commands)
{
if (Arrays.asList(command.getAliases().split(",")).contains(alias))
return true;
}
return false;
}
public int getCommandAmount()
{
return commands.size();
}
}

View File

@ -1,6 +1,5 @@
package me.totalfreedom.totalfreedommod.command;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

View File

@ -12,7 +12,7 @@ public class Command_announce extends FreedomCommand
{
@Override
protected boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length < 1)
{

View File

@ -8,7 +8,6 @@ import me.totalfreedom.totalfreedommod.punishments.Punishment;
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.util.Ips;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
@ -74,7 +73,7 @@ public class Command_ban extends FreedomCommand
return true;
}
username = entry.getUsername();
username = entry.getName();
ips.addAll(entry.getIps());
}
else
@ -82,7 +81,7 @@ public class Command_ban extends FreedomCommand
final PlayerData entry = plugin.pl.getData(player);
username = player.getName();
//ips.addAll(entry.getIps());/
ips.add(Ips.getIp(player));
ips.add(FUtil.getIp(player));
// Deop
player.setOp(false);
@ -152,7 +151,7 @@ public class Command_ban extends FreedomCommand
player.kickPlayer(ban.bakeKickMessage());
for (Player p : Bukkit.getOnlinePlayers())
{
if (Ips.getIp(p).equals(Ips.getIp(player)))
if (FUtil.getIp(p).equals(FUtil.getIp(player)))
{
p.kickPlayer(ChatColor.RED + "You've been kicked because someone on your IP has been banned.");
}

View File

@ -2,13 +2,13 @@ package me.totalfreedom.totalfreedommod.command;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import java.util.Random;
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Spawns a random type of fish at your location.", usage = "/<command>")

View File

@ -48,14 +48,6 @@ public class Command_cage extends FreedomCommand
final FPlayer fPlayer = plugin.pl.getPlayer(player);
if (fPlayer.getCageData().isCaged())
{
FUtil.adminAction(sender.getName(), "Uncaging " + sender.getName(), true);
final FPlayer playerdata = plugin.pl.getPlayer(playerSender);
playerdata.getCageData().setCaged(false);
return true;
}
Material outerMaterial = Material.GLASS;
Material innerMaterial = Material.AIR;
if (args.length >= 2 && args[1] != null)

View File

@ -1,16 +1,12 @@
package me.totalfreedom.totalfreedommod.command;
import java.util.stream.IntStream;
import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilder;
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Clears the chat for players who are not opt-out.", usage = "/<command>", aliases = "cc")
public class Command_clearchat extends FreedomCommand
{
@ -19,52 +15,13 @@ public class Command_clearchat extends FreedomCommand
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (plugin.al.isAdmin(playerSender))
{
for (Player player : server.getOnlinePlayers())
{
boolean optedOut = false;
if (plugin.al.isAdmin(player))
{
optedOut = true;
}
else if (plugin.mbl.isMasterBuilder(player) && plugin.mbl.getMasterBuilder(player).isClearChatOptOut())
{
optedOut = true;
}
else if (plugin.pv.getVerificationPlayer(player).getEnabled() && plugin.pv.getVerificationPlayer(player).isClearChatOptOut())
{
optedOut = true;
}
if (!optedOut)
if (!plugin.al.isAdmin(player))
{
IntStream.range(0, 100).mapToObj(i -> "").forEach(player::sendMessage);
}
}
FUtil.adminAction(sender.getName(), "Cleared chat", true);
}
else if (plugin.mbl.isMasterBuilder(playerSender))
{
MasterBuilder mb = plugin.mbl.getMasterBuilder(playerSender);
mb.setClearChatOptOut(!mb.isClearChatOptOut());
msg((mb.isClearChatOptOut() ? "Opted-out of" : "Opted-in to") + " clear chat.");
plugin.mbl.save();
plugin.mbl.updateTables();
}
else if (plugin.pv.getVerificationPlayer(playerSender).getEnabled())
{
VPlayer vp = plugin.pv.getVerificationPlayer(playerSender);
vp.setClearChatOptOut(!vp.isClearChatOptOut());
msg((vp.isClearChatOptOut() ? "Opted-out of" : "Opted-in to") + " clear chat.");
plugin.pv.saveVerificationData(vp);
return true;
}
else
{
msg("Only Master Builders, admins, and players with verification enabled can opt-out of clear chat.", ChatColor.RED);
}
return true;
}

View File

@ -67,7 +67,7 @@ public class Command_clearinventory extends FreedomCommand
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (args.length == 1 && plugin.al.isAdmin(playerSender))
if (args.length == 1 && plugin.al.isAdmin(sender))
{
List<String> players = FUtil.getPlayerList();
players.add("-a");

View File

@ -0,0 +1,29 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.shop.ShopItem;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Obtain a clown fish", usage = "/<command>")
public class Command_clownfish extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (plugin.pl.getData(playerSender).hasItem(ShopItem.CLOWN_FISH))
{
playerSender.getInventory().addItem(plugin.sh.getClownFish());
msg("You have been given a Clown Fish", ChatColor.GREEN);
}
else
{
msg("You do not own a Clown Fish! Purchase one from the shop.", ChatColor.RED);
}
return true;
}
}

View File

@ -1,16 +1,16 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FUtil;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.shop.ShopData;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Shows the amount of coins you have or another player", usage = "/<command> [playername]")
@CommandParameters(description = "Shows the amount of coins you have or another player has", usage = "/<command> [playername]")
public class Command_coins extends FreedomCommand
{
@ -48,8 +48,8 @@ public class Command_coins extends FreedomCommand
p = playerSender;
}
}
ShopData sd = plugin.sh.getData(p);
msg(prefix + ChatColor.GREEN + (args.length > 0 ? p.getName() + " has " : "You have ") + ChatColor.RED + sd.getCoins() + ChatColor.GREEN + " coins.");
PlayerData playerData = plugin.pl.getData(p);
msg(prefix + ChatColor.GREEN + (args.length > 0 ? p.getName() + " has " : "You have ") + ChatColor.RED + playerData.getCoins() + ChatColor.GREEN + " coins.");
return true;
}
}

View File

@ -1,10 +1,8 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;

View File

@ -1,54 +0,0 @@
package me.totalfreedom.totalfreedommod.command;
import java.util.Collections;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.ChatColor;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Cuck someone - sends an unclearable title to the specified player.", usage = "/<command> <player>")
public class Command_cuck extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (FUtil.isPaper())
{
msg("This command won't work on Paper!", ChatColor.RED);
return true;
}
if (args.length == 0)
{
return false;
}
final Player player = getPlayer(args[0]);
if (player == null)
{
msg(FreedomCommand.PLAYER_NOT_FOUND);
return true;
}
player.remove();
msg("Cucked " + player.getName());
player.sendTitle(ChatColor.DARK_RED + "HAHA CUCKED", ChatColor.RED + "relog if u want to be uncucked loser", 20, 200, 60);
return true;
}
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (args.length == 1 && plugin.al.isAdmin(sender))
{
return FUtil.getPlayerList();
}
return Collections.emptyList();
}
}

View File

@ -4,10 +4,10 @@ import java.util.Collections;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.ChatColor;
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Curse someone - sends a cursed texture pack to the specified player.", usage = "/<command> <player>")

View File

@ -1,6 +1,5 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.libsdisguises.BlockedDisguises;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.Command;
@ -21,7 +20,7 @@ public class Command_disguisetoggle extends FreedomCommand
return true;
}
FUtil.adminAction(sender.getName(), (BlockedDisguises.disabled ? "Enabling" : "Disabling") + " disguises", false);
FUtil.adminAction(sender.getName(), (plugin.ldb.isDisguisesEnabled() ? "Disabling" : "Enabling") + " disguises", false);
if (plugin.ldb.isDisguisesEnabled())
{
@ -33,7 +32,7 @@ public class Command_disguisetoggle extends FreedomCommand
plugin.ldb.setDisguisesEnabled(true);
}
msg("Disguises are now " + (BlockedDisguises.disabled ? "disabled." : "enabled."));
msg("Disguises are now " + (plugin.ldb.isDisguisesEnabled() ? "enabled." : "disabled."));
return true;
}

View File

@ -0,0 +1,87 @@
package me.totalfreedom.totalfreedommod.command;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE)
@CommandParameters(description = "Adds or removes donators", usage = "/<command> <mode> <name> <ip> <package> [forum_user]")
public class Command_donator extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!FUtil.isFromHostConsole(sender.getName()) && !ConfigEntry.SERVER_OWNERS.getStringList().contains(sender.getName()))
{
return noPerms();
}
Boolean mode = args[0].equals("add");
String name = args[1];
String ip = args[2];
String pkg = args[3];
String forum_id = null;
if (args.length > 4)
{
forum_id = args[4];
}
PlayerData data = plugin.pl.getData(name);
if (data == null)
{
data = plugin.pl.getDataByIp(ip);
}
if (data != null)
{
data.setDonator(mode);
plugin.pl.save(data);
}
Player player = getPlayer(name);
if (player != null)
{
plugin.rm.updateDisplay(player);
}
if (forum_id != null && !forum_id.equals("0"))
{
String baseurl = ConfigEntry.DONATION_PROBOARDS_URL.getString();
String group_id = ConfigEntry.DONATION_GROUP_ID.getString();
String session_id = ConfigEntry.DONATION_SESSION_ID.getString();
String csrf_token = ConfigEntry.DONATION_CSRF_TOKEN.getString();
if (baseurl == null || group_id == null || session_id == null || csrf_token == null)
{
return true;
}
String url = baseurl + "/user/group_members/" + (mode ? "adding" : "remove");
List<String> headers = Arrays.asList("Cookie:session_id=" + session_id, "X-Requested-With:XMLHttpRequest");
String payload = "group_id=" + group_id + "&user_ids[]=" + forum_id + "&csrf_token=" + csrf_token;
try
{
String result = FUtil.postRequestToEndpoint(url, "POST", headers, payload);
msg(result);
}
catch (IOException e)
{
FLog.severe(e.getMessage());
e.printStackTrace();
}
}
return true;
}
}

View File

@ -7,8 +7,6 @@ import me.totalfreedom.totalfreedommod.punishments.Punishment;
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import static me.totalfreedom.totalfreedommod.util.FUtil.playerMsg;
import net.pravian.aero.util.Ips;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
@ -55,7 +53,7 @@ public class Command_doom extends FreedomCommand
plugin.al.updateTables();
if (plugin.dc.enabled && ConfigEntry.DISCORD_ROLE_SYNC.getBoolean())
{
plugin.dc.syncRoles(admin);
plugin.dc.syncRoles(admin, plugin.pl.getData(admin.getName()).getDiscordID());
}
}
@ -100,7 +98,7 @@ public class Command_doom extends FreedomCommand
final String kickReason = (reason == null ? "FUCKOFF, and get your shit together!" : reason);
// Log doom
plugin.pul.logPunishment(new Punishment(player.getName(), Ips.getIp(player), sender.getName(), PunishmentType.DOOM, reason));
plugin.pul.logPunishment(new Punishment(player.getName(), FUtil.getIp(player), sender.getName(), PunishmentType.DOOM, reason));
new BukkitRunnable()
{

View File

@ -3,7 +3,6 @@ package me.totalfreedom.totalfreedommod.command;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.Rank;

View File

@ -4,12 +4,11 @@ import java.util.Collections;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Surprise someone.", usage = "/<command> <player>")
@ -32,10 +31,26 @@ public class Command_explode extends FreedomCommand
return true;
}
msg("Exploded " + player.getName());
player.setFlying(false);
player.setVelocity(player.getVelocity().clone().add(new Vector(0, 50, 0)));
for (int i = 1; i <= 3; i++)
{
FUtil.createExplosionOnDelay(player.getLocation(), 2L, i * 10);
}
new BukkitRunnable()
{
@Override
public void run()
{
for (int i = 0; i < 4; i++)
{
player.getWorld().strikeLightning(player.getLocation());
player.getWorld().createExplosion(player.getLocation(), 4L);
}
player.setHealth(0.0);
player.getWorld().createExplosion(player.getLocation(), 0F, false);
msg("Exploded " + player.getName());
}
}.runTaskLater(plugin, 40);
return true;
}

View File

@ -15,7 +15,7 @@ public class Command_fireball extends FreedomCommand
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (plugin.sh.getData(playerSender).hasItem(ShopItem.FIRE_BALL))
if (plugin.pl.getData(playerSender).hasItem(ShopItem.FIRE_BALL))
{
playerSender.getInventory().addItem(plugin.sh.getFireBall());
msg("You have been given a Fire Ball", ChatColor.GREEN);

View File

@ -1,211 +0,0 @@
package me.totalfreedom.totalfreedommod.command;
import java.nio.charset.StandardCharsets;
import java.util.Iterator;
import java.util.UUID;
import me.totalfreedom.totalfreedommod.banning.Ban;
import me.totalfreedom.totalfreedommod.freeze.FreezeData;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
@CommandParameters(
description = "Use admin commands on someone by hash. Use mode 'list' to get a player's hash. Other modes are kick, nameban, ipban, ban, op, deop, ci, fr, smite.",
usage = "/<command> [list | [<kick | nameban | ipban | ban | op | deop | ci | fr | smite> <targethash>] ]")
//codebeat:disable
//basically a deprecated command that still exists
public class Command_gadmin extends FreedomCommand
{
private enum GadminMode
{
LIST("list"),
KICK("kick"),
NAMEBAN("nameban"),
IPBAN("ipban"),
BAN("ban"),
OP("op"),
DEOP("deop"),
CI("ci"),
FR("fr"),
SMITE("smite");
private final String modeName;
private GadminMode(String command)
{
this.modeName = command;
}
public String getModeName()
{
return modeName;
}
public static GadminMode findMode(String needle)
{
for (final GadminMode mode : GadminMode.values())
{
if (needle.equalsIgnoreCase(mode.getModeName()))
{
return mode;
}
}
return null;
}
}
public String getPlayerHash(Player player)
{
return UUID.nameUUIDFromBytes(player.getName().toLowerCase().getBytes(StandardCharsets.UTF_8)).toString().substring(0, 4);
}
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length == 0)
{
return false;
}
final GadminMode mode = GadminMode.findMode(args[0].toLowerCase());
if (mode == null)
{
msg("Invalid mode: " + args[0], ChatColor.RED);
return true;
}
final Iterator<? extends Player> it = server.getOnlinePlayers().iterator();
if (mode == GadminMode.LIST)
{
msg("[ Real Name ] : [ Display Name ] - Hash:");
while (it.hasNext())
{
final Player player = it.next();
sender.sendMessage(ChatColor.GRAY + String.format("[ %s ] : [ %s ] - %s",
player.getName(),
ChatColor.stripColor(player.getDisplayName()),
getPlayerHash(player)));
}
return true;
}
if (args.length < 2)
{
return false;
}
Player target = null;
while (it.hasNext() && target == null)
{
final Player player = it.next();
final String hash = getPlayerHash(player);
if (hash.equalsIgnoreCase(args[1]))
{
target = player;
}
}
if (target == null)
{
msg("Invalid player hash: " + args[1], ChatColor.RED);
return true;
}
switch (mode)
{
case KICK:
{
FUtil.adminAction(sender.getName(), String.format("Kicking: %s.", target.getName()), false);
target.kickPlayer("Kicked by Administrator");
break;
}
case NAMEBAN:
{
FUtil.adminAction(sender.getName(), String.format("Banning Name: %s.", target.getName()), true);
plugin.bm.addBan(Ban.forPlayerName(target, sender, null, null));
target.kickPlayer("Username banned by Administrator.");
break;
}
case IPBAN:
{
String ip = target.getAddress().getAddress().getHostAddress();
String[] ip_parts = ip.split("\\.");
if (ip_parts.length == 4)
{
ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
}
FUtil.adminAction(sender.getName(), String.format("Banning IP: %s.", ip), true);
plugin.bm.addBan(Ban.forPlayerIp(ip, sender, null, null));
target.kickPlayer("IP address banned by Administrator.");
break;
}
case BAN:
{
String ip = target.getAddress().getAddress().getHostAddress();
String[] ip_parts = ip.split("\\.");
if (ip_parts.length == 4)
{
ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
}
FUtil.adminAction(sender.getName(), String.format("Banning Name: %s, IP: %s.", target.getName(), ip), true);
plugin.bm.addBan(Ban.forPlayer(target, sender));
target.kickPlayer("IP and username banned by Administrator.");
break;
}
case OP:
{
FUtil.adminAction(sender.getName(), String.format("Opping %s.", target.getName()), false);
target.setOp(true);
target.sendMessage(FreedomCommand.YOU_ARE_OP);
break;
}
case DEOP:
{
FUtil.adminAction(sender.getName(), String.format("Deopping %s.", target.getName()), false);
target.setOp(false);
target.sendMessage(FreedomCommand.YOU_ARE_NOT_OP);
break;
}
case CI:
{
target.getInventory().clear();
break;
}
case FR:
{
FreezeData fd = plugin.pl.getPlayer(target).getFreezeData();
fd.setFrozen(!fd.isFrozen());
msg(target.getName() + " has been " + (fd.isFrozen() ? "frozen" : "unfrozen") + ".");
target.sendMessage(ChatColor.AQUA + "You have been " + (fd.isFrozen() ? "frozen" : "unfrozen") + ".");
break;
}
case SMITE:
{
Command_smite.smite(sender, target);
break;
}
}
return true;
}
}

View File

@ -8,7 +8,6 @@ import me.totalfreedom.totalfreedommod.punishments.Punishment;
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.util.Ips;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@ -25,25 +24,6 @@ public class Command_glist extends FreedomCommand
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length < 1)
{
return false;
}
if (args.length == 1)
{
if ("purge".equals(args[0]))
{
checkRank(Rank.SENIOR_ADMIN);
plugin.pl.purgeAllData();
msg("Purged playerbase.");
return true;
}
return false;
}
if (args.length < 2)
{
return false;
@ -71,13 +51,13 @@ public class Command_glist extends FreedomCommand
return true;
}
username = entry.getUsername();
username = entry.getName();
ips.addAll(entry.getIps());
}
else
{
final PlayerData entry = plugin.pl.getData(player);
username = entry.getUsername();
username = entry.getName();
ips.addAll(entry.getIps());
}
}

View File

@ -0,0 +1,32 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Toggles the glowing outline effect because y'all lazy as fuck", usage = "/<command>")
public class Command_glow extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
boolean glowing = false;
if (playerSender.getPotionEffect(PotionEffectType.GLOWING) != null)
{
playerSender.removePotionEffect(PotionEffectType.GLOWING);
}
else
{
PotionEffect glow = new PotionEffect(PotionEffectType.GLOWING, 1000000, 1, false, false);
playerSender.addPotionEffect(glow);
glowing = true;
}
msg("You " + (glowing ? "are now" : "no longer") + " glowing.");
return true;
}
}

View File

@ -15,7 +15,7 @@ public class Command_grapplinghook extends FreedomCommand
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (plugin.sh.getData(playerSender).hasItem(ShopItem.GRAPPLING_HOOK))
if (plugin.pl.getData(playerSender).hasItem(ShopItem.GRAPPLING_HOOK))
{
playerSender.getInventory().addItem(plugin.sh.getGrapplingHook());
msg("You have been given a Grappling Hook", ChatColor.GREEN);

View File

@ -1,16 +1,10 @@
package me.totalfreedom.totalfreedommod.command;
import com.google.common.collect.ContiguousSet;
import com.google.common.collect.DiscreteDomain;
import com.google.common.collect.Range;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.stream.DoubleStream;
import me.totalfreedom.totalfreedommod.fun.Jumppads;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;

View File

@ -4,7 +4,6 @@ import me.totalfreedom.totalfreedommod.punishments.Punishment;
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.util.Ips;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@ -16,7 +15,7 @@ import org.bukkit.entity.Player;
public class Command_kick extends FreedomCommand
{
@Override
protected boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length == 0)
{
@ -53,7 +52,7 @@ public class Command_kick extends FreedomCommand
player.kickPlayer(builder.toString());
plugin.pul.logPunishment(new Punishment(player.getName(), Ips.getIp(player), sender.getName(), PunishmentType.KICK, reason));
plugin.pul.logPunishment(new Punishment(player.getName(), FUtil.getIp(player), sender.getName(), PunishmentType.KICK, reason));
return true;
}

View File

@ -15,7 +15,7 @@ public class Command_lightningrod extends FreedomCommand
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (plugin.sh.getData(playerSender).hasItem(ShopItem.LIGHTNING_ROD))
if (plugin.pl.getData(playerSender).hasItem(ShopItem.LIGHTNING_ROD))
{
playerSender.getInventory().addItem(plugin.sh.getLightningRod());
msg("You have been given a Lightning Rod", ChatColor.GREEN);

View File

@ -1,9 +1,7 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.discord.Discord;
import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilder;
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@ -11,7 +9,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Link your Discord account to your Minecraft account", usage = "/<command>")
@CommandParameters(description = "Link your Discord account to your Minecraft account", usage = "/<command> [<name> <id>]")
public class Command_linkdiscord extends FreedomCommand
{
@ -24,64 +22,37 @@ public class Command_linkdiscord extends FreedomCommand
return true;
}
if (args.length > 1 && plugin.al.isAdmin(playerSender))
{
PlayerData playerData = plugin.pl.getData(args[0]);
if (playerData == null)
{
msg(PLAYER_NOT_FOUND);
return true;
}
playerData.setDiscordID(args[1]);
msg("Linked " + args[0] + "'s discord account.", ChatColor.GREEN);
return true;
}
String code;
if (plugin.al.isAdmin(playerSender))
{
Admin admin = plugin.al.getAdmin(playerSender);
if (admin.getDiscordID() != null)
PlayerData data = plugin.pl.getData(playerSender);
if (data.getDiscordID() != null)
{
msg("Your Minecraft account is already linked to a Discord account.", ChatColor.RED);
return true;
}
if (Discord.ADMIN_LINK_CODES.containsValue(admin))
if (Discord.LINK_CODES.containsValue(data))
{
code = Discord.getCodeForAdmin(admin);
code = Discord.getCode(data);
}
else
{
code = plugin.dc.generateCode(5);
Discord.ADMIN_LINK_CODES.put(code, admin);
}
}
else if (plugin.mbl.isMasterBuilder(playerSender))
{
MasterBuilder masterBuilder = plugin.mbl.getMasterBuilder(playerSender);
if (masterBuilder.getDiscordID() != null)
{
msg("Your Minecraft account is already linked to a Discord account.", ChatColor.RED);
return true;
}
if (Discord.MASTER_BUILDER_LINK_CODES.containsValue(masterBuilder))
{
code = Discord.getCodeForMasterBuilder(masterBuilder);
}
else
{
code = plugin.dc.generateCode(5);
Discord.MASTER_BUILDER_LINK_CODES.put(code, masterBuilder);
}
}
else
{
VPlayer data = plugin.pv.getVerificationPlayer(playerSender);
if (data.getDiscordId() != null)
{
msg("Your Minecraft account is already linked to a Discord account.", ChatColor.RED);
return true;
}
if (Discord.PLAYER_LINK_CODES.containsValue(data))
{
code = Discord.getCodeForPlayer(data);
}
else
{
code = plugin.dc.generateCode(5);
Discord.PLAYER_LINK_CODES.put(code, data);
}
Discord.LINK_CODES.put(code, data);
}
msg("Your linking code is " + ChatColor.AQUA + code, ChatColor.GREEN);
msg("Take this code and DM the server bot (" + plugin.dc.formatBotTag() + ") the code (do not put anything else in the message, only the code)");

View File

@ -16,7 +16,7 @@ import org.bukkit.entity.Player;
public class Command_links extends FreedomCommand
{
@Override
protected boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
YamlConfiguration config = plugin.config.configuration;
ConfigurationSection section = config.getConfigurationSection("social_links");

View File

@ -7,10 +7,9 @@ import me.totalfreedom.totalfreedommod.admin.AdminList;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.Displayable;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.md_5.bungee.api.ChatColor;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View File

@ -1,7 +1,7 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.shop.ShopData;
import me.totalfreedom.totalfreedommod.shop.ShopItem;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang.StringUtils;
@ -48,21 +48,21 @@ public class Command_manageshop extends FreedomCommand
msg(PLAYER_NOT_FOUND);
return true;
}
ShopData shopData = plugin.sh.getData(player);
shopData.setCoins(shopData.getCoins() + amount);
plugin.sh.save(shopData);
msg("Successfully added " + amount + " coins to " + player.getName() + ". Their new balance is " + shopData.getCoins(), ChatColor.GREEN);
player.sendMessage(ChatColor.GREEN + sender.getName() + " gave you " + amount + " coins. Your new balance is " + shopData.getCoins());
PlayerData playerData = plugin.pl.getData(player);
playerData.setCoins(playerData.getCoins() + amount);
plugin.pl.save(playerData);
msg("Successfully added " + amount + " coins to " + player.getName() + ". Their new balance is " + playerData.getCoins(), ChatColor.GREEN);
player.sendMessage(ChatColor.GREEN + sender.getName() + " gave you " + amount + " coins. Your new balance is " + playerData.getCoins());
return true;
}
else
{
for (Player player : server.getOnlinePlayers())
{
ShopData shopData = plugin.sh.getData(player);
shopData.setCoins(shopData.getCoins() + amount);
plugin.sh.save(shopData);
player.sendMessage(ChatColor.GREEN + sender.getName() + " gave you " + amount + " coins. Your new balance is " + shopData.getCoins());
PlayerData playerData = plugin.pl.getData(player);
playerData.setCoins(playerData.getCoins() + amount);
plugin.pl.save(playerData);
player.sendMessage(ChatColor.GREEN + sender.getName() + " gave you " + amount + " coins. Your new balance is " + playerData.getCoins());
}
msg("Successfully added " + amount + " coins to all online players.", ChatColor.GREEN);
return true;
@ -85,29 +85,29 @@ public class Command_manageshop extends FreedomCommand
msg(PLAYER_NOT_FOUND);
return true;
}
ShopData shopData = plugin.sh.getData(player);
shopData.setCoins(shopData.getCoins() + amount);
if (shopData.getCoins() < 0)
PlayerData playerData = plugin.pl.getData(player);
playerData.setCoins(playerData.getCoins() + amount);
if (playerData.getCoins() < 0)
{
shopData.setCoins(0);
playerData.setCoins(0);
}
plugin.sh.save(shopData);
msg("Successfully removed " + amount + " coins from " + player.getName() + ". Their new balance is " + shopData.getCoins(), ChatColor.GREEN);
player.sendMessage(ChatColor.RED + sender.getName() + " took " + amount + " coins from you. Your new balance is " + shopData.getCoins());
plugin.pl.save(playerData);
msg("Successfully removed " + amount + " coins from " + player.getName() + ". Their new balance is " + playerData.getCoins(), ChatColor.GREEN);
player.sendMessage(ChatColor.RED + sender.getName() + " took " + amount + " coins from you. Your new balance is " + playerData.getCoins());
return true;
}
else
{
for (Player player : server.getOnlinePlayers())
{
ShopData shopData = plugin.sh.getData(player);
shopData.setCoins(shopData.getCoins() - amount);
if (shopData.getCoins() < 0)
PlayerData playerData = plugin.pl.getData(player);
playerData.setCoins(playerData.getCoins() - amount);
if (playerData.getCoins() < 0)
{
shopData.setCoins(0);
playerData.setCoins(0);
}
plugin.sh.save(shopData);
player.sendMessage(ChatColor.RED + sender.getName() + " took " + amount + " coins from you. Your new balance is " + shopData.getCoins());
plugin.pl.save(playerData);
player.sendMessage(ChatColor.RED + sender.getName() + " took " + amount + " coins from you. Your new balance is " + playerData.getCoins());
}
msg("Successfully took " + amount + " coins from all online players.", ChatColor.GREEN);
return true;
@ -128,9 +128,9 @@ public class Command_manageshop extends FreedomCommand
msg(PLAYER_NOT_FOUND);
return true;
}
ShopData shopData = plugin.sh.getData(player);
shopData.setCoins(amount);
plugin.sh.save(shopData);
PlayerData playerData = plugin.pl.getData(player);
playerData.setCoins(amount);
plugin.pl.save(playerData);
msg("Successfully set " + player.getName() + "'s coins to " + amount, ChatColor.GREEN);
player.sendMessage(ChatColor.GREEN + sender.getName() + " set your coin balance to " + amount);
return true;
@ -171,9 +171,9 @@ public class Command_manageshop extends FreedomCommand
return true;
}
ShopData shopData = plugin.sh.getData(player);
shopData.giveItem(item);
plugin.sh.save(shopData);
PlayerData playerData = plugin.pl.getData(player);
playerData.giveItem(item);
plugin.pl.save(playerData);
msg("Successfully gave the " + item.getName() + " to " + player.getName(), ChatColor.GREEN);
player.sendMessage(ChatColor.GREEN + sender.getName() + " gave the " + item.getName() + " to you");
return true;
@ -194,9 +194,9 @@ public class Command_manageshop extends FreedomCommand
return true;
}
ShopData shopData = plugin.sh.getData(player);
shopData.removeItem(item);
plugin.sh.save(shopData);
PlayerData playerData = plugin.pl.getData(player);
playerData.removeItem(item);
plugin.pl.save(playerData);
msg("Successfully took the " + item.getName() + " from " + player.getName(), ChatColor.GREEN);
player.sendMessage(ChatColor.RED + sender.getName() + " took the " + item.getName() + " from you");
return true;

View File

@ -0,0 +1,57 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Manually verify someone", usage = "/<command> <playername>", aliases="mv")
public class Command_manuallyverify extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!plugin.dc.enabled)
{
msg("The Discord verification system is currently disabled", ChatColor.RED);
return true;
}
if (args.length == 0)
{
return false;
}
final Player player = getPlayer(args[0]);
if (player == null)
{
msg(FreedomCommand.PLAYER_NOT_FOUND);
return true;
}
if (!plugin.pl.isImposter(player))
{
msg("That player is not an impostor.");
return true;
}
FUtil.adminAction(sender.getName(), "Manually verifying player " + player.getName(), false);
player.setOp(true);
player.sendMessage(YOU_ARE_OP);
if (plugin.pl.getPlayer(player).getFreezeData().isFrozen())
{
plugin.pl.getPlayer(player).getFreezeData().setFrozen(false);
player.sendMessage(ChatColor.GRAY + "You have been unfrozen.");
}
plugin.pl.verify(player, null);
plugin.rm.updateDisplay(player);
return true;
}
}

View File

@ -0,0 +1,42 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "seth's personal command", usage = "/<command> <players>", aliases = "genocide")
public class Command_massmurder extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!ConfigEntry.SERVER_OWNERS.getStringList().contains(playerSender.getName()))
{
return noPerms();
}
if (args.length < 1)
{
return false;
}
int count = 0;
for (String name : args)
{
Player player = getPlayer(name);
if (player != null)
{
player.setHealth(0);
count++;
}
}
msg("Mass murdered a school of " + count);
return true;
}
}

View File

@ -4,7 +4,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import me.totalfreedom.totalfreedommod.world.WorldTime;
import me.totalfreedom.totalfreedommod.world.WorldWeather;
import org.bukkit.World;

View File

@ -1,23 +1,19 @@
package me.totalfreedom.totalfreedommod.command;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilder;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.util.Ips;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH, blockHostConsole = true)
@CommandParameters(description = "List, add, or remove master builders, reload the master builder list, or view the info of master builders.", usage = "/<command> <list | reload | | <add | remove | info> <username>>")
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "List, add, or remove master builders, reload the master builder list, or view the info of master builders.", usage = "/<command> <list | <<add | remove> <username>>>")
public class Command_mbconfig extends FreedomCommand
{
@ -33,50 +29,7 @@ public class Command_mbconfig extends FreedomCommand
{
case "list":
{
msg("Master Builders: " + StringUtils.join(plugin.mbl.getMasterBuilderNames(), ", "), ChatColor.GOLD);
return true;
}
case "reload":
{
checkRank(Rank.SENIOR_ADMIN);
FUtil.adminAction(sender.getName(), "Reloading the Master Builder list", true);
plugin.mbl.load();
msg("Master Builder list reloaded!");
return true;
}
case "info":
{
if (args.length < 2)
{
return false;
}
checkRank(Rank.SUPER_ADMIN);
MasterBuilder masterBuilder = plugin.mbl.getEntryByName(args[1]);
if (masterBuilder == null)
{
final Player player = getPlayer(args[1]);
if (player != null)
{
masterBuilder = plugin.mbl.getMasterBuilder(player);
}
}
if (masterBuilder == null)
{
msg("Master Builder not found: " + args[1]);
}
else
{
msg(masterBuilder.toString());
}
msg("Master Builders: " + StringUtils.join(plugin.pl.getMasterBuilderNames(), ", "), ChatColor.GOLD);
return true;
}
@ -87,89 +40,43 @@ public class Command_mbconfig extends FreedomCommand
return false;
}
checkConsole();
checkRank(Rank.TELNET_ADMIN);
if (!plugin.pl.canManageMasterBuilders(sender.getName()))
{
return noPerms();
}
// Player already on the list?
final Player player = getPlayer(args[1]);
if (player != null && plugin.mbl.isMasterBuilder(player))
PlayerData data = plugin.pl.getData(player);
if (data.isMasterBuilder() && plugin.pl.isPlayerImpostor(player))
{
FUtil.adminAction(sender.getName(), "Re-adding " + player.getName() + " to the Master Builder list", true);
player.setOp(true);
player.sendMessage(YOU_ARE_OP);
if (plugin.pl.getPlayer(player).getFreezeData().isFrozen())
{
plugin.pl.getPlayer(player).getFreezeData().setFrozen(false);
player.sendMessage(ChatColor.GRAY + "You have been unfrozen.");
}
plugin.pl.verify(player, null);
plugin.rm.updateDisplay(player);
}
else if (!data.isMasterBuilder())
{
FUtil.adminAction(sender.getName(), "Adding " + player.getName() + " to the Master Builder list", true);
data.setMasterBuilder(true);
data.setVerification(true);
plugin.pl.save(data);
plugin.rm.updateDisplay(player);
return true;
}
else
{
msg("That player is already on the Master Builder list.");
return true;
}
// Find the entry
String name = player != null ? player.getName() : args[1];
MasterBuilder masterBuilder = null;
for (MasterBuilder loopMasterBuilder : plugin.mbl.getAllMasterBuilders().values())
{
if (loopMasterBuilder.getName().equalsIgnoreCase(name))
{
masterBuilder = loopMasterBuilder;
break;
}
}
if (masterBuilder == null) // New entry
{
checkRank(Rank.SENIOR_ADMIN);
if (!FUtil.canManageMasterBuilders(sender.getName()))
{
noPerms();
}
if (player == null)
{
msg(FreedomCommand.PLAYER_NOT_FOUND);
return true;
}
FUtil.adminAction(sender.getName(), "Adding " + player.getName() + " to the Master Builder list", true);
plugin.mbl.addMasterBuilder(new MasterBuilder(player));
if (player != null)
{
plugin.rm.updateDisplay(player);
}
}
else // Existing admin
{
FUtil.adminAction(sender.getName(), "Readding " + masterBuilder.getName() + " to the Master Builder list", true);
if (player != null)
{
masterBuilder.setName(player.getName());
masterBuilder.addIp(Ips.getIp(player));
}
masterBuilder.setLastLogin(new Date());
plugin.mbl.save();
plugin.mbl.updateTables();
if (player != null)
{
plugin.rm.updateDisplay(player);
}
}
if (player != null)
{
final FPlayer fPlayer = plugin.pl.getPlayer(player);
if (fPlayer.getFreezeData().isFrozen())
{
fPlayer.getFreezeData().setFrozen(false);
msg(player.getPlayer(), "You have been unfrozen.");
}
if (!player.isOp())
{
player.setOp(true);
player.sendMessage(YOU_ARE_OP);
}
plugin.pv.removeEntry(player.getName()); // master builders can't have player verification entries
}
return true;
}
case "remove":
{
if (args.length < 2)
@ -177,28 +84,28 @@ public class Command_mbconfig extends FreedomCommand
return false;
}
checkConsole();
checkRank(Rank.SENIOR_ADMIN);
if (!FUtil.canManageMasterBuilders(sender.getName()))
if (!plugin.pl.canManageMasterBuilders(sender.getName()))
{
noPerms();
return noPerms();
}
Player player = getPlayer(args[1]);
MasterBuilder masterBuilder = player != null ? plugin.mbl.getMasterBuilder(player) : plugin.mbl.getEntryByName(args[1]);
PlayerData data = plugin.pl.getData(player);
if (masterBuilder == null)
if (!data.isMasterBuilder())
{
msg("Master Builder not found: " + args[1]);
return true;
}
FUtil.adminAction(sender.getName(), "Removing " + masterBuilder.getName() + " from the Master Builder list", true);
plugin.mbl.removeMasterBuilder(masterBuilder);
if (player != null)
FUtil.adminAction(sender.getName(), "Removing " + data.getName() + " from the Master Builder list", true);
data.setMasterBuilder(false);
if (data.getDiscordID() == null)
{
plugin.rm.updateDisplay(player);
data.setVerification(false);
}
plugin.pl.save(data);
plugin.rm.updateDisplay(player);
return true;
}
@ -210,40 +117,22 @@ public class Command_mbconfig extends FreedomCommand
}
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (sender instanceof Player)
{
if (args.length == 1)
{
List<String> arguments = new ArrayList<>();
arguments.add("list");
if (plugin.al.isAdmin(sender))
{
arguments.add("info");
}
return arguments;
}
else if (args.length == 2 && args[0].equals("info") && plugin.al.isAdmin(sender))
{
return plugin.al.getActiveAdminNames();
}
return Collections.emptyList();
}
else
{
if (args.length == 1)
{
return Arrays.asList("add", "remove", "reload", "list", "info");
return Arrays.asList("add", "remove", "list");
}
else if (args.length == 2)
{
if (args[0].equals("add") || args[0].equals("remove") || args[0].equals("setrank") || args[0].equals("info"))
if (args[0].equals("add"))
{
return FUtil.getPlayerList();
}
else if (args[0].equals("remove"))
{
return plugin.pl.getMasterBuilderNames();
}
}
return Collections.emptyList();
}

View File

@ -4,15 +4,12 @@ import java.util.ArrayList;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.minecraft.server.v1_15_R1.NBTTagCompound;
import net.minecraft.server.v1_15_R1.NBTTagInt;
import net.minecraft.server.v1_15_R1.NBTTagList;
import net.minecraft.server.v1_15_R1.NBTTagString;
import net.minecraft.server.v1_16_R1.NBTTagCompound;
import net.minecraft.server.v1_16_R1.NBTTagList;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -189,7 +186,7 @@ public class Command_modifyitem extends FreedomCommand
return true;
}
private NBTTagList getAttributeList(net.minecraft.server.v1_15_R1.ItemStack stack)
private NBTTagList getAttributeList(net.minecraft.server.v1_16_R1.ItemStack stack)
{
if (stack.getTag() == null)
{

View File

@ -9,7 +9,6 @@ import me.totalfreedom.totalfreedommod.punishments.Punishment;
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.util.Ips;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
@ -153,7 +152,7 @@ public class Command_mute extends FreedomCommand
msg(player, "You have been muted by " + ChatColor.YELLOW + sender.getName(), ChatColor.RED);
msg("Muted " + player.getName());
plugin.pul.logPunishment(new Punishment(player.getName(), Ips.getIp(player), sender.getName(), PunishmentType.MUTE, reason));
plugin.pul.logPunishment(new Punishment(player.getName(), FUtil.getIp(player), sender.getName(), PunishmentType.MUTE, reason));
}
else
{

View File

@ -6,9 +6,9 @@ import java.util.Collections;
import java.util.List;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.util.Ips;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@ -16,12 +16,12 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Manage your admin entry.", usage = "/<command> [-o <admin>] <clearips | clearip <ip> | setlogin <message> | clearlogin | setacformat <format> | clearacformat> | oldtags | logstick | syncroles | genbackupcodes>")
@CommandParameters(description = "Manage your admin entry.", usage = "/<command> [-o <admin>] <clearips | clearip <ip> | setlogin <message> | clearlogin | setacformat <format> | clearacformat> | oldtags | logstick | syncroles>")
public class Command_myadmin extends FreedomCommand
{
@Override
protected boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length < 1)
{
@ -59,7 +59,7 @@ public class Command_myadmin extends FreedomCommand
}
}
final String targetIp = Ips.getIp(targetPlayer);
final String targetIp = FUtil.getIp(targetPlayer);
switch (args[0])
{
@ -86,6 +86,8 @@ public class Command_myadmin extends FreedomCommand
plugin.al.save(target);
plugin.al.updateTables();
plugin.pl.syncIps(target);
msg(counter + " IPs removed.");
msg(targetPlayer, target.getIps().get(0) + " is now your only IP address");
return true;
@ -130,6 +132,8 @@ public class Command_myadmin extends FreedomCommand
plugin.al.save(target);
plugin.al.updateTables();
plugin.pl.syncIps(target);
msg("Removed IP " + args[1]);
msg("Current IPs: " + StringUtils.join(target.getIps(), ", "));
return true;
@ -154,9 +158,9 @@ public class Command_myadmin extends FreedomCommand
msg("Your login message cannot be more than 64 characters (excluding your rank and your name)", ChatColor.RED);
return true;
}
String previewMessage = plugin.rm.craftLoginMessage(targetPlayer, message);
FUtil.adminAction(sender.getName(), "Setting personal login message" + (init == null ? "" : " for " + targetPlayer.getName()), false);
target.setLoginMessage(message);
String previewMessage = plugin.rm.craftLoginMessage(targetPlayer, message);
msg((init == null ? "Your" : targetPlayer.getName() + "'s") + " login message is now: ");
msg("> " + previewMessage);
plugin.al.save(target);
@ -173,17 +177,6 @@ public class Command_myadmin extends FreedomCommand
return true;
}
case "settag":
{
msg("Please use /tag set to set your tag.", ChatColor.RED);
return true;
}
case "cleartag":
{
msg("Please use /tag off to remove your tag.", ChatColor.RED);
return true;
}
case "setacformat":
{
String format = StringUtils.join(args, " ", 1, args.length);
@ -229,12 +222,13 @@ public class Command_myadmin extends FreedomCommand
msg("Role syncing is not enabled.", ChatColor.RED);
return true;
}
boolean synced = plugin.dc.syncRoles(target);
if (target.getDiscordID() == null)
PlayerData playerData = plugin.pl.getData(target.getName());
if (playerData.getDiscordID() == null)
{
msg("Please run /linkdiscord first!", ChatColor.RED);
return true;
}
boolean synced = plugin.dc.syncRoles(target, playerData.getDiscordID());
if (synced)
{
msg("Successfully synced your roles.", ChatColor.GREEN);
@ -249,29 +243,7 @@ public class Command_myadmin extends FreedomCommand
}
case "genbackupcodes":
if (!plugin.dc.enabled)
{
msg("The Discord verification system is currently disabled.", ChatColor.RED);
return true;
}
else if (target.getDiscordID() == null || target.getDiscordID().isEmpty())
{
msg("Discord verification is not enabled for you.", ChatColor.RED);
return true;
}
msg("Generating backup codes...", ChatColor.GREEN);
boolean generated = plugin.dc.sendBackupCodes(target);
if (generated)
{
msg("Your backup codes have been sent to your discord account. They can be re-generated at anytime.", ChatColor.GREEN);
}
else
{
msg("Failed to generate backup codes, please contact a developer (preferably Seth)", ChatColor.RED);
}
msg("Moved to /pv genbackupcodes", ChatColor.RED);
return true;
default:
@ -290,7 +262,7 @@ public class Command_myadmin extends FreedomCommand
}
List<String> singleArguments = Arrays.asList("clearips", "setlogin", "setacformat");
List<String> doubleArguments = Arrays.asList("clearip", "clearlogin", "clearacformat", "oldtags", "logstick", "syncroles", "genbackupcodes");
List<String> doubleArguments = Arrays.asList("clearip", "clearlogin", "clearacformat", "oldtags", "logstick", "syncroles");
if (args.length == 1)
{
List<String> options = new ArrayList<>();
@ -312,7 +284,7 @@ public class Command_myadmin extends FreedomCommand
if (args[0].equals("clearip"))
{
List<String> ips = plugin.al.getAdmin(sender).getIps();
ips.remove(Ips.getIp(playerSender));
ips.remove(FUtil.getIp((Player) sender));
return ips;
}
}

View File

@ -1,237 +0,0 @@
package me.totalfreedom.totalfreedommod.command;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilder;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.util.Ips;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Manage your Master Builder entry", usage = "/<command> [-o <masterbuilder>] <clearips | clearip <ip> | genbackupcodes>", aliases = "mymb")
public class Command_mymasterbuilder extends FreedomCommand
{
@Override
protected boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length < 1)
{
return false;
}
Player init = null;
MasterBuilder target = plugin.mbl.getMasterBuilder(playerSender);
Player targetPlayer = playerSender;
// -o switch
if (args[0].equals("-o"))
{
if (!FUtil.canManageMasterBuilders(playerSender.getName()))
{
return noPerms();
}
init = playerSender;
targetPlayer = getPlayer(args[1]);
if (targetPlayer == null)
{
msg(FreedomCommand.PLAYER_NOT_FOUND);
return true;
}
target = plugin.mbl.getMasterBuilder(playerSender);
if (target == null)
{
msg("That player is not a Master Builder", ChatColor.RED);
return true;
}
// Shift 2
args = Arrays.copyOfRange(args, 2, args.length);
if (args.length < 1)
{
return false;
}
}
final String targetIp = Ips.getIp(targetPlayer);
switch (args[0])
{
case "clearips":
{
if (args.length != 1)
{
return false; // Double check: the player might mean "clearip"
}
if (init == null)
{
FUtil.adminAction(sender.getName(), "Clearing my IPs", false);
}
else
{
FUtil.adminAction(sender.getName(), "Clearing " + target.getName() + "' IPs", true);
}
int counter = target.getIps().size() - 1;
target.clearIPs();
target.addIp(targetIp);
plugin.mbl.save();
plugin.mbl.updateTables();
msg(counter + " IPs removed.");
msg(targetPlayer, target.getIps().get(0) + " is now your only IP address");
return true;
}
case "clearip":
{
if (args.length != 2)
{
return false; // Double check: the player might mean "clearips"
}
if (!target.getIps().contains(args[1]))
{
if (init == null)
{
msg("That IP is not registered to you.");
}
else
{
msg("That IP does not belong to that player.");
}
return true;
}
if (targetIp.equals(args[1]))
{
if (init == null)
{
msg("You cannot remove your current IP.");
}
else
{
msg("You cannot remove that Master Builders's current IP.");
}
return true;
}
FUtil.adminAction(sender.getName(), "Removing an IP" + (init == null ? "" : " from " + targetPlayer.getName() + "'s IPs"), true);
target.removeIp(args[1]);
plugin.mbl.save();
plugin.mbl.updateTables();
msg("Removed IP " + args[1]);
msg("Current IPs: " + StringUtils.join(target.getIps(), ", "));
return true;
}
case "genbackupcodes":
if (!plugin.dc.enabled)
{
msg("The Discord verification system is currently disabled.", ChatColor.RED);
return true;
}
else if (target.getDiscordID() == null || target.getDiscordID().isEmpty())
{
msg("Discord verification is not enabled for you.", ChatColor.RED);
return true;
}
msg("Generating backup codes...", ChatColor.GREEN);
boolean generated = plugin.dc.sendBackupCodes(target);
if (generated)
{
msg("Your backup codes have been sent to your discord account. They can be re-generated at anytime.", ChatColor.GREEN);
}
else
{
msg("Failed to generate backup codes, please contact a developer (preferably Seth)", ChatColor.RED);
}
return true;
default:
{
return false;
}
}
}
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (!plugin.mbl.isMasterBuilder(playerSender) && !FUtil.canManageMasterBuilders(playerSender.getName()))
{
return Collections.emptyList();
}
List<String> singleArguments = Arrays.asList("clearips");
List<String> doubleArguments = Arrays.asList("clearip", "genbackupcodes");
if (args.length == 1)
{
List<String> options = new ArrayList<>();
options.add("-o");
options.addAll(singleArguments);
options.addAll(doubleArguments);
return options;
}
else if (args.length == 2)
{
if (args[0].equals("-o"))
{
return FUtil.getPlayerList();
}
else
{
if (doubleArguments.contains(args[0]))
{
if (args[0].equals("clearip"))
{
if (args[0].equals("clearip"))
{
List<String> ips = plugin.mbl.getMasterBuilder(sender).getIps();
ips.remove(Ips.getIp(playerSender));
return ips;
}
}
}
}
}
else if (args.length == 3)
{
if (args[0].equals("-o"))
{
List<String> options = new ArrayList<>();
options.addAll(singleArguments);
options.addAll(doubleArguments);
return options;
}
}
else if (args.length == 4)
{
if (args[0].equals("-o") && args[2].equals("clearip"))
{
MasterBuilder masterBuilder = plugin.mbl.getEntryByName(args[1]);
if (masterBuilder != null)
{
return masterBuilder.getIps();
}
}
}
return FUtil.getPlayerList();
}
}

View File

@ -12,7 +12,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Essentials Interface Command - Remove illegal chatcodes from nicknames of all players on server.", usage = "/<command>", aliases = "nc")
@CommandParameters(description = "Essentials Interface Command - Remove illegal chatcodes from nicknames of one or all players on server.", usage = "/<command> [player]", aliases = "nc")
public class Command_nickclean extends FreedomCommand
{
@ -25,7 +25,31 @@ public class Command_nickclean extends FreedomCommand
{
FUtil.adminAction(sender.getName(), "Cleaning all nicknames", false);
if (args.length > 1)
{
Player player = getPlayer(args[0]);
if (player == null)
{
msg(PLAYER_NOT_FOUND);
return true;
}
FUtil.adminAction(sender.getName(), "Cleaning " + player.getName() + "'s nickname", false);
cleanNickname(player);
return true;
}
FUtil.adminAction(sender.getName(), "Cleaning all nicknames", false);
for (final Player player : server.getOnlinePlayers())
{
cleanNickname(player);
}
return true;
}
public void cleanNickname(Player player)
{
final String playerName = player.getName();
final String nickName = plugin.esb.getNickname(playerName);
@ -40,6 +64,4 @@ public class Command_nickclean extends FreedomCommand
}
}
}
return true;
}
}

View File

@ -3,13 +3,11 @@ package me.totalfreedom.totalfreedommod.command;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -28,7 +26,7 @@ public class Command_notes extends FreedomCommand
return false;
}
VPlayer vPlayer;
PlayerData playerData;
final Player player = getPlayer(args[0]);
if (player == null)
@ -41,23 +39,21 @@ public class Command_notes extends FreedomCommand
return true;
}
vPlayer = plugin.pv.getVerificationPlayer(entry.getUsername());
playerData = plugin.pl.getData(entry.getName());
}
else
{
vPlayer = plugin.pv.getVerificationPlayer(player);
playerData = plugin.pl.getData(player);
}
if (args[1].equals("list"))
{
final StringBuilder noteList = new StringBuilder();
noteList.append(ChatColor.GREEN + "Player notes for " + vPlayer.getName() + ":");
noteList.append(ChatColor.GREEN + "Player notes for " + playerData.getName() + ":");
int id = 1;
for (Map<?, ?> noteMap : vPlayer.getNotes())
for (String note : playerData.getNotes())
{
String admin = String.valueOf(noteMap.keySet().toArray()[0]);
String note = String.valueOf(noteMap.get(admin));
String noteLine = id + ". " + admin + ": " + note;
String noteLine = id + ". " + note;
noteList.append("\n" + ChatColor.GOLD + noteLine);
id++;
}
@ -70,9 +66,9 @@ public class Command_notes extends FreedomCommand
{
return false;
}
String note = StringUtils.join(ArrayUtils.subarray(args, 2, args.length), " ");
vPlayer.addNote(sender.getName(), note);
plugin.pv.saveVerificationData(vPlayer);
String note = sender.getName() + ": " + StringUtils.join(ArrayUtils.subarray(args, 2, args.length), " ");
playerData.addNote(note);
plugin.pl.save(playerData);
msg("Note added.", ChatColor.GREEN);
return true;
}
@ -93,9 +89,9 @@ public class Command_notes extends FreedomCommand
return true;
}
id--;
if (vPlayer.removeNote(id))
if (playerData.removeNote(id))
{
plugin.pv.saveVerificationData(vPlayer);
plugin.pl.save(playerData);
msg("Note removed.");
}
else
@ -106,9 +102,9 @@ public class Command_notes extends FreedomCommand
}
else if (args[1].equals("clear"))
{
int count = vPlayer.getNotes().size();
vPlayer.clearNotes();
plugin.pv.saveVerificationData(vPlayer);
int count = playerData.getNotes().size();
playerData.clearNotes();
plugin.pl.save(playerData);
msg("Cleared " + count + " notes.", ChatColor.GREEN);
return true;
}

View File

@ -2,7 +2,6 @@ package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View File

@ -25,8 +25,8 @@ public class Command_permban extends FreedomCommand
}
msg("Reloading permban list...", ChatColor.RED);
plugin.pm.stop();
plugin.pm.start();
plugin.pm.onStop();
plugin.pm.onStart();
msg("Reloaded permban list.");
msg(plugin.pm.getPermbannedIps().size() + " IPs and "
+ plugin.pm.getPermbannedNames().size() + " usernames loaded.");

View File

@ -4,22 +4,22 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.rank.Rank;
import net.pravian.aero.util.Ips;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Manage your verification", usage = "/<command> <enable | disable | clearips | status | genbackupcodes>", aliases = "playerverification,pv")
public class Command_playerverify extends FreedomCommand
@CommandParameters(description = "Manage your verification", usage = "/<command> <enable | disable | clearips | clearip <ip> | status | genbackupcodes>", aliases = "playerverify,pv")
public class Command_playerverification extends FreedomCommand
{
@Override
protected boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
VPlayer target = plugin.pv.getVerificationPlayer(playerSender);
PlayerData target = plugin.pl.getData(playerSender);
List<String> ips = new ArrayList<>();
ips.addAll(target.getIps());
@ -31,16 +31,29 @@ public class Command_playerverify extends FreedomCommand
int cleared = 0;
for (String ip : ips)
{
if (!ip.equals(Ips.getIp(playerSender)))
if (!ip.equals(FUtil.getIp(playerSender)))
{
target.removeIp(ip);
cleared++;
}
}
msg("Cleared all IP's except your current IP \"" + Ips.getIp(playerSender) + "\"");
msg("Cleared all IP's except your current IP \"" + FUtil.getIp(playerSender) + "\"");
msg("Cleared " + cleared + " IP's.");
plugin.pv.saveVerificationData(target);
plugin.pl.save(target);
plugin.pl.syncIps(target);
return true;
}
else if (args[0].equalsIgnoreCase("clearip"))
{
if (args.length < 2)
{
return false;
}
target.removeIp(args[1]);
msg("Removed" + args[1] + " from your list of IPs");
plugin.pl.save(target);
plugin.pl.syncIps(target);
return true;
}
}
@ -50,13 +63,7 @@ public class Command_playerverify extends FreedomCommand
return false;
}
if (plugin.al.isAdmin(sender))
{
msg("This command is only for OP's.", ChatColor.RED);
return true;
}
VPlayer data = plugin.pv.getVerificationPlayer(playerSender);
PlayerData data = plugin.pl.getData(playerSender);
switch (args[0].toLowerCase())
{
@ -66,37 +73,37 @@ public class Command_playerverify extends FreedomCommand
msg("The Discord verification system is currently disabled.", ChatColor.RED);
return true;
}
else if (data.getEnabled())
else if (data.hasVerification())
{
msg("Discord verification is already enabled for you.", ChatColor.RED);
return true;
}
else if (data.getDiscordId() == null)
else if (data.getDiscordID() == null)
{
msg("Please link a discord account with /linkdiscord.", ChatColor.RED);
return true;
}
data.setEnabled(true);
plugin.pv.saveVerificationData(data);
data.setVerification(true);
plugin.pl.save(data);
msg("Re-enabled Discord verification.", ChatColor.GREEN);
return true;
case "disable":
if (!data.getEnabled())
if (!data.hasVerification())
{
msg("Discord verification is already disabled for you.", ChatColor.RED);
return true;
}
data.setEnabled(false);
plugin.pv.saveVerificationData(data);
data.setVerification(false);
plugin.pl.save(data);
msg("Disabled Discord verification.", ChatColor.GREEN);
return true;
case "status":
boolean enabled = target.getEnabled();
boolean specified = target.getDiscordId() != null;
boolean enabled = target.hasVerification();
boolean specified = target.getDiscordID() != null;
msg(ChatColor.GRAY + "Discord Verification Enabled: " + (enabled ? ChatColor.GREEN + "true" : ChatColor.RED + "false"));
msg(ChatColor.GRAY + "Discord ID: " + (specified ? ChatColor.GREEN + target.getDiscordId() : ChatColor.RED + "not set"));
msg(ChatColor.GRAY + "Discord ID: " + (specified ? ChatColor.GREEN + target.getDiscordID() : ChatColor.RED + "not set"));
msg(ChatColor.GRAY + "Backup Codes: " + data.getBackupCodes().size() + "/" + "10");
return true;
@ -106,7 +113,7 @@ public class Command_playerverify extends FreedomCommand
msg("The Discord verification system is currently disabled.", ChatColor.RED);
return true;
}
else if (!data.getEnabled())
else if (!data.hasVerification())
{
msg("Discord verification is not enabled for you.", ChatColor.RED);
return true;

View File

@ -1,12 +1,8 @@
package me.totalfreedom.totalfreedommod.command;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.io.IOException;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FSync;

Some files were not shown because too many files have changed in this diff Show More